Jacek Caban : jscript: Added support for relational CC expressions.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Oct 2 16:29:22 CDT 2014
Module: wine
Branch: master
Commit: e7b8459bc334f47824a4739926734bebd0425b8c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e7b8459bc334f47824a4739926734bebd0425b8c
Author: Jacek Caban <jacek at 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);
- at set @test = (1+true==false+1)
-ok(@test === false, "@test = " + @test);
+function expect(val, exval) {
+ ok(val === exval, "got " + val + " expected " + exval);
+}
+
+ at set @test = (false < 0.5)
+expect(@test, true);
+
+ at set @test = (true == 0 < 0.5)
+expect(@test, true);
+
+ at set @test = (false < 0)
+expect(@test, false);
+
+ at set @test = (false > 0.5)
+expect(@test, false);
+
+ at set @test = (1 < true)
+expect(@test, false);
+
+ at set @test = (1 <= true)
+expect(@test, true);
+
+ at set @test = (1 >= true)
+expect(@test, true);
+
+ at set @test = (1 >= true-1)
+expect(@test, true);
@if (false)
this wouldn not parse
More information about the wine-cvs
mailing list