diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-08-11 19:22:58 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-06-27 17:23:57 +0000 |
commit | 811d8b82b541e94d154697cb854a29b09ae92a0d (patch) | |
tree | b1c5ef43e01ce576d2a3a51d86b37be3af25b46d /qmake/library/qmakeevaluator.cpp | |
parent | 10e5ec25576eea821f2c767e62d00f80e9a01c94 (diff) |
qmake: make argument validation of built-ins data driven
at the time this patch was conceived, it was meant as an exercise in
getting rid of usages of ProString::toQString(m_tmp). however, this was
meanwhile superseded by use of toQStringView().
but the change itself should have been done a long time ago already, and
there is no harm in going through with it.
on the way, this also unifies and fixes some of the error messages.
Change-Id: I337aff994c508df783df4794c3fa0762d83a691b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake/library/qmakeevaluator.cpp')
-rw-r--r-- | qmake/library/qmakeevaluator.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 6b23412327..8f48ebc546 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -1762,12 +1762,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBoolFunction( QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction( const ProKey &func, const ushort *&tokPtr) { - if (int func_t = statics.functions.value(func)) { + auto adef = statics.functions.constFind(func); + if (adef != statics.functions.constEnd()) { //why don't the builtin functions just use args_list? --Sam ProStringList args; if (expandVariableReferences(tokPtr, 5, &args, true) == ReturnError) return ReturnError; - return evaluateBuiltinConditional(func_t, func, args); + return evaluateBuiltinConditional(*adef, func, args); } QHash<ProKey, ProFunctionDef>::ConstIterator it = @@ -1788,12 +1789,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction( QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateExpandFunction( const ProKey &func, const ushort *&tokPtr, ProStringList *ret) { - if (int func_t = statics.expands.value(func)) { + auto adef = statics.expands.constFind(func); + if (adef != statics.expands.constEnd()) { //why don't the builtin functions just use args_list? --Sam ProStringList args; if (expandVariableReferences(tokPtr, 5, &args, true) == ReturnError) return ReturnError; - return evaluateBuiltinExpand(func_t, func, args, *ret); + return evaluateBuiltinExpand(*adef, func, args, *ret); } QHash<ProKey, ProFunctionDef>::ConstIterator it = |