This commit is contained in:
parent
44355f8eef
commit
9b3197c6e8
|
@ -481,12 +481,12 @@
|
||||||
return $1.addElse(new If($4, $5, {
|
return $1.addElse(new If($4, $5, {
|
||||||
type: $3
|
type: $3
|
||||||
}));
|
}));
|
||||||
}), o('IfBlock ELSE Block', function() {
|
|
||||||
return $1.addElse($3);
|
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
If: [
|
If: [
|
||||||
o('IfBlock'), o('Statement POST_IF Expression', function() {
|
o('IfBlock'), o('IfBlock ELSE Block', function() {
|
||||||
|
return $1.addElse($3);
|
||||||
|
}), o('Statement POST_IF Expression', function() {
|
||||||
return new If($3, Expressions.wrap([$1]), {
|
return new If($3, Expressions.wrap([$1]), {
|
||||||
type: $2,
|
type: $2,
|
||||||
statement: true
|
statement: true
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -483,13 +483,13 @@ grammar =
|
||||||
IfBlock: [
|
IfBlock: [
|
||||||
o 'IF Expression Block', -> new If $2, $3, type: $1
|
o 'IF Expression Block', -> new If $2, $3, type: $1
|
||||||
o 'IfBlock ELSE IF Expression Block', -> $1.addElse new If $4, $5, type: $3
|
o 'IfBlock ELSE IF Expression Block', -> $1.addElse new If $4, $5, type: $3
|
||||||
o 'IfBlock ELSE Block', -> $1.addElse $3
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# The full complement of *if* expressions, including postfix one-liner
|
# The full complement of *if* expressions, including postfix one-liner
|
||||||
# *if* and *unless*.
|
# *if* and *unless*.
|
||||||
If: [
|
If: [
|
||||||
o 'IfBlock'
|
o 'IfBlock'
|
||||||
|
o 'IfBlock ELSE Block', -> $1.addElse $3
|
||||||
o 'Statement POST_IF Expression', -> new If $3, Expressions.wrap([$1]), type: $2, statement: true
|
o 'Statement POST_IF Expression', -> new If $3, Expressions.wrap([$1]), type: $2, statement: true
|
||||||
o 'Expression POST_IF Expression', -> new If $3, Expressions.wrap([$1]), type: $2, statement: true
|
o 'Expression POST_IF Expression', -> new If $3, Expressions.wrap([$1]), type: $2, statement: true
|
||||||
]
|
]
|
||||||
|
|
|
@ -45,3 +45,13 @@ eq λ, 5
|
||||||
|
|
||||||
test "don't accidentally stringify keywords", ->
|
test "don't accidentally stringify keywords", ->
|
||||||
ok (-> this == 'this')() is false
|
ok (-> this == 'this')() is false
|
||||||
|
|
||||||
|
test "#1026", ->
|
||||||
|
cantCompile '''
|
||||||
|
if a
|
||||||
|
b
|
||||||
|
else
|
||||||
|
c
|
||||||
|
else
|
||||||
|
d
|
||||||
|
'''
|
||||||
|
|
Loading…
Reference in New Issue