diff options
Diffstat (limited to 'src/scriptengine.cpp')
-rw-r--r-- | src/scriptengine.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/scriptengine.cpp b/src/scriptengine.cpp index 7b5df03..b828409 100644 --- a/src/scriptengine.cpp +++ b/src/scriptengine.cpp | |||
@@ -56,19 +56,35 @@ Number ScriptEngine::exec( Expression *pExpr ) | |||
56 | break; | 56 | break; |
57 | 57 | ||
58 | case Token::tPlus: | 58 | case Token::tPlus: |
59 | sNums.push( sNums.peekPop() + sNums.peekPop() ); | 59 | { |
60 | Number a = sNums.peekPop(); | ||
61 | Number b = sNums.peekPop(); | ||
62 | sNums.push( a + b ); | ||
63 | } | ||
60 | break; | 64 | break; |
61 | 65 | ||
62 | case Token::tMinus: | 66 | case Token::tMinus: |
63 | sNums.push( sNums.peekPop() - sNums.peekPop() ); | 67 | { |
68 | Number a = sNums.peekPop(); | ||
69 | Number b = sNums.peekPop(); | ||
70 | sNums.push( a - b ); | ||
71 | } | ||
64 | break; | 72 | break; |
65 | 73 | ||
66 | case Token::tDivide: | 74 | case Token::tDivide: |
67 | sNums.push( sNums.peekPop() / sNums.peekPop() ); | 75 | { |
76 | Number a = sNums.peekPop(); | ||
77 | Number b = sNums.peekPop(); | ||
78 | sNums.push( a / b ); | ||
79 | } | ||
68 | break; | 80 | break; |
69 | 81 | ||
70 | case Token::tMultiply: | 82 | case Token::tMultiply: |
71 | sNums.push( sNums.peekPop() * sNums.peekPop() ); | 83 | { |
84 | Number a = sNums.peekPop(); | ||
85 | Number b = sNums.peekPop(); | ||
86 | sNums.push( a * b ); | ||
87 | } | ||
72 | break; | 88 | break; |
73 | 89 | ||
74 | case Token::tNegate: | 90 | case Token::tNegate: |