aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4function_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-30 15:35:16 +0100
committerLars Knoll <lars.knoll@qt.io>2016-12-09 08:30:51 +0000
commit55101d6937880f4dfd8d8eb79fbb15a8e7bb508a (patch)
treec43905119590ac7b99da1471086fca86a6032acd /src/qml/jsruntime/qv4function_p.h
parent9f4cfec74517f7ff3f65037ad04abac33e2104ba (diff)
Move the check whether a function is simple to QV4::Function
This allows re-using the check in the QQmlJavascriptExpression code. Change-Id: I647a6edb4844911f540f08c4a067d055676dd0ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4function_p.h')
-rw-r--r--src/qml/jsruntime/qv4function_p.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h
index beba5a1fd6..802af43cdc 100644
--- a/src/qml/jsruntime/qv4function_p.h
+++ b/src/qml/jsruntime/qv4function_p.h
@@ -91,6 +91,15 @@ struct Q_QML_EXPORT Function {
inline bool needsActivation() const
{ return activationRequired; }
+ inline bool canUseSimpleFunction() const {
+ if (needsActivation() ||
+ compiledFunction->flags & CompiledData::Function::HasCatchOrWith ||
+ compiledFunction->nFormals > QV4::Global::ReservedArgumentCount ||
+ isNamedExpression())
+ return false;
+ return true;
+ }
+
QQmlSourceLocation sourceLocation() const
{
return QQmlSourceLocation(sourceFile(), compiledFunction->location.line, compiledFunction->location.column);