Module: wine Branch: master Commit: e7b8459bc334f47824a4739926734bebd0425b8c URL: http://source.winehq.org/git/wine.git/?a=commit;h=e7b8459bc334f47824a4739926...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Oct 2 14:36:40 2014 +0200
jscript: Added support for relational CC expressions.
---
dlls/jscript/cc_parser.y | 8 ++++---- dlls/jscript/tests/cc.js | 29 +++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/dlls/jscript/cc_parser.y b/dlls/jscript/cc_parser.y index b22aef8..18c1cb1 100644 --- a/dlls/jscript/cc_parser.y +++ b/dlls/jscript/cc_parser.y @@ -192,13 +192,13 @@ CCEqualityExpression CCRelationalExpression : CCShiftExpression { $$ = $1; } | CCRelationalExpression '<' CCShiftExpression - { FIXME("'<' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } + { $$ = ccval_bool(get_ccnum($1) < get_ccnum($3)); } | CCRelationalExpression tLEQ CCShiftExpression - { FIXME("'<=' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } + { $$ = ccval_bool(get_ccnum($1) <= get_ccnum($3)); } | CCRelationalExpression '>' CCShiftExpression - { FIXME("'>' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } + { $$ = ccval_bool(get_ccnum($1) > get_ccnum($3)); } | CCRelationalExpression tGEQ CCShiftExpression - { FIXME("'>=' expression not implemented\n"); ctx->hres = E_NOTIMPL; YYABORT; } + { $$ = ccval_bool(get_ccnum($1) >= get_ccnum($3)); }
CCShiftExpression : CCAdditiveExpression { $$ = $1; } diff --git a/dlls/jscript/tests/cc.js b/dlls/jscript/tests/cc.js index 09ef285..8f45a3d 100644 --- a/dlls/jscript/tests/cc.js +++ b/dlls/jscript/tests/cc.js @@ -152,8 +152,33 @@ ok(@test === true, "@test = " + @test); @set @test = (1==false+1) ok(@test === true, "@test = " + @test);
-@set @test = (1+true==false+1) -ok(@test === false, "@test = " + @test); +function expect(val, exval) { + ok(val === exval, "got " + val + " expected " + exval); +} + +@set @test = (false < 0.5) +expect(@test, true); + +@set @test = (true == 0 < 0.5) +expect(@test, true); + +@set @test = (false < 0) +expect(@test, false); + +@set @test = (false > 0.5) +expect(@test, false); + +@set @test = (1 < true) +expect(@test, false); + +@set @test = (1 <= true) +expect(@test, true); + +@set @test = (1 >= true) +expect(@test, true); + +@set @test = (1 >= true-1) +expect(@test, true);
@if (false) this wouldn not parse