Fix multiple postfix conditionals

This commit is contained in:
xixixao 2013-12-17 02:55:32 +01:00
parent 6c786f0fb7
commit d7862647d9
4 changed files with 25 additions and 6 deletions

View File

@ -584,7 +584,7 @@
]
};
operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']];
operators = [['left', '.', '?.', '::', '?::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['left', 'POST_IF']];
tokens = [];

File diff suppressed because one or more lines are too long

View File

@ -592,7 +592,7 @@ operators = [
['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS']
['right', 'FORIN', 'FOROF', 'BY', 'WHEN']
['right', 'IF', 'ELSE', 'FOR', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS']
['right', 'POST_IF']
['left', 'POST_IF']
]
# Wrapping Up

View File

@ -198,6 +198,14 @@ test "#748: trailing reserved identifiers", ->
nonce
eq nonce, result
# Postfix
test "#3056: multiple postfix conditionals", ->
temp = 'initial'
temp = 'ignored' unless true if false
eq temp, 'initial'
# Loops
test "basic `while` loops", ->
@ -296,6 +304,7 @@ test "break *not* at the top level", ->
result
eq 2, someFunc()
# Switch
test "basic `switch`", ->
@ -420,6 +429,7 @@ test "Issue #997. Switch doesn't fallthrough.", ->
eq val, 1
# Throw
test "Throw should be usable as an expression.", ->
try