Adding support for compound assignment to indented implicit objects.
This commit is contained in:
parent
8c45aa480b
commit
fd6e9a1e66
|
@ -573,6 +573,8 @@
|
|||
return new OpNode($2, $1, $3);
|
||||
}), o("Expression COMPOUND_ASSIGN Expression", function() {
|
||||
return new OpNode($2, $1, $3);
|
||||
}), o("Expression COMPOUND_ASSIGN INDENT Expression OUTDENT", function() {
|
||||
return new OpNode($2, $1, $4);
|
||||
}), o("Expression INSTANCEOF Expression", function() {
|
||||
return new OpNode('instanceof', $1, $3);
|
||||
}), o("Expression IN Expression", function() {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -539,6 +539,7 @@ grammar =
|
|||
o "Expression COMPARE Expression", -> new OpNode $2, $1, $3
|
||||
o "Expression LOGIC Expression", -> new OpNode $2, $1, $3
|
||||
o "Expression COMPOUND_ASSIGN Expression", -> new OpNode $2, $1, $3
|
||||
o "Expression COMPOUND_ASSIGN INDENT Expression OUTDENT", -> new OpNode $2, $1, $4
|
||||
|
||||
o "Expression INSTANCEOF Expression", -> new OpNode 'instanceof', $1, $3
|
||||
o "Expression IN Expression", -> new InNode $1, $3
|
||||
|
|
|
@ -118,3 +118,15 @@ num = 10; ok (num ^= 3) is 9
|
|||
num = 10; ok (num |= 3) is 11
|
||||
|
||||
|
||||
# Compound assignment with implicit objects.
|
||||
obj = undefined
|
||||
obj ?=
|
||||
one: 1
|
||||
|
||||
ok obj.one is 1
|
||||
|
||||
obj and=
|
||||
two: 2
|
||||
|
||||
ok not obj.one
|
||||
ok obj.two is 2
|
Loading…
Reference in New Issue