diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-16 03:03:39 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-16 03:03:39 (GMT) |
commit | 58e541dd805046b912bb82468d3251b0d5141710 (patch) | |
tree | b254c41cb1521d76eadba6dd89d55a463821d541 /src/declarative | |
parent | 0dfe225df98a1b204e4a90bb8b1b66aefbe74d81 (diff) | |
download | Qt-58e541dd805046b912bb82468d3251b0d5141710.zip Qt-58e541dd805046b912bb82468d3251b0d5141710.tar.gz Qt-58e541dd805046b912bb82468d3251b0d5141710.tar.bz2 |
Remove some unreliable binary expression support
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qmlbasicscript.cpp | 64 |
1 files changed, 1 insertions, 63 deletions
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index d6d6625..cc8d528 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -64,12 +64,7 @@ struct ScriptInstruction { FetchD0Constant, // constant FetchD1Constant, // constant - - Add, // NA - Subtract, // NA - Multiply, // NA Equals, // NA - And, // NA Int, // integer Bool, // boolean @@ -448,15 +443,6 @@ void QmlBasicScript::dump() qWarning().nospace() << "FETCH\t\t" << instr.fetch.idx << "\t\t" << QByteArray(data + instr.fetch.idx); break; - case ScriptInstruction::Add: - qWarning().nospace() << "ADD"; - break; - case ScriptInstruction::Subtract: - qWarning().nospace() << "SUBTRACT"; - break; - case ScriptInstruction::Multiply: - qWarning().nospace() << "MULTIPLY"; - break; case ScriptInstruction::Equals: qWarning().nospace() << "EQUALS"; break; @@ -682,11 +668,7 @@ bool QmlBasicScriptCompiler::tryBinaryExpression(AST::Node *node) AST::BinaryExpression *expr = static_cast<AST::BinaryExpression *>(node); - if (expr->op == QSOperator::Add || - expr->op == QSOperator::Sub || - expr->op == QSOperator::Equal || - expr->op == QSOperator::And || - expr->op == QSOperator::Mul) + if (expr->op == QSOperator::Equal) return true; } return false; @@ -703,21 +685,9 @@ bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node) ScriptInstruction instr; switch (expr->op) { - case QSOperator::Add: - instr.type = ScriptInstruction::Add; - break; - case QSOperator::Sub: - instr.type = ScriptInstruction::Subtract; - break; case QSOperator::Equal: instr.type = ScriptInstruction::Equals; break; - case QSOperator::And: - instr.type = ScriptInstruction::And; - break; - case QSOperator::Mul: - instr.type = ScriptInstruction::Multiply; - break; default: return false; } @@ -916,30 +886,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c case ScriptInstruction::Bool: stack.push(QVariant(instr.boolean.value)); break; - case ScriptInstruction::Add: - { - QVariant rhs = stack.pop(); - QVariant lhs = stack.pop(); - - stack.push(rhs.toDouble() + lhs.toDouble()); - } - break; - case ScriptInstruction::Subtract: - { - QVariant rhs = stack.pop(); - QVariant lhs = stack.pop(); - - stack.push(lhs.toDouble() - rhs.toDouble()); - } - break; - case ScriptInstruction::Multiply: - { - QVariant rhs = stack.pop(); - QVariant lhs = stack.pop(); - - stack.push(rhs.toDouble() * lhs.toDouble()); - } - break; case ScriptInstruction::Equals: { QVariant rhs = stack.pop(); @@ -948,14 +894,6 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c stack.push(rhs == lhs); } break; - case ScriptInstruction::And: - { - QVariant rhs = stack.pop(); - QVariant lhs = stack.pop(); - - stack.push(rhs.toBool() && lhs.toBool()); - } - break; default: break; } |