mirror of
https://github.com/reactos/wine.git
synced 2025-02-18 03:48:01 +00:00
jscript: Fix shift/reduce conflict in IfStatement rule.
The famous "dangling else" problem.
This commit is contained in:
parent
7b9e827a75
commit
169f92b5a8
@ -253,6 +253,9 @@ static source_elements_t *source_elements_add_function(source_elements_t*,functi
|
||||
%type <literal> BooleanLiteral
|
||||
%type <srcptr> KFunction
|
||||
|
||||
%nonassoc LOWER_THAN_ELSE
|
||||
%nonassoc kELSE
|
||||
|
||||
%%
|
||||
|
||||
/* ECMA-262 3rd Edition 14 */
|
||||
@ -389,7 +392,7 @@ ExpressionStatement
|
||||
IfStatement
|
||||
: kIF '(' Expression ')' Statement kELSE Statement
|
||||
{ $$ = new_if_statement(ctx, $3, $5, $7); }
|
||||
| kIF '(' Expression ')' Statement
|
||||
| kIF '(' Expression ')' Statement %prec LOWER_THAN_ELSE
|
||||
{ $$ = new_if_statement(ctx, $3, $5, NULL); }
|
||||
|
||||
/* ECMA-262 3rd Edition 12.6 */
|
||||
|
@ -773,6 +773,18 @@ try {
|
||||
ok(false, "deleteTest not throwed exception?");
|
||||
}catch(ex) {}
|
||||
|
||||
if (false)
|
||||
if (true)
|
||||
ok(false, "if evaluated");
|
||||
else
|
||||
ok(false, "else should be associated with nearest if statement");
|
||||
|
||||
if (true)
|
||||
if (false)
|
||||
ok(false, "if evaluated");
|
||||
else
|
||||
ok(true, "else should be associated with nearest if statement");
|
||||
|
||||
ok(isNaN(0.5) === false, "isNaN(0.5) !== false");
|
||||
ok(isNaN() === true, "isNaN() !== true");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user