Fix automatic semi-colon insertion

Fix automatic semi-colon insertion in var statements without
initialisers.
var i
i = 1;
is valid and not accepted by the parser

but
var i = 2
i = 3;
is valid and accepted by the parser, as it should be.

With this fix, both are accepted.
redux
fpirsch 12 years ago
parent 02af83f9b4
commit d7e853b87c

@ -1164,20 +1164,20 @@ VariableDeclarationListNoIn
}
VariableDeclaration
= name:Identifier __ value:Initialiser? {
= name:Identifier value:(__ Initialiser)? {
return {
type: "VariableDeclaration",
name: name,
value: value !== "" ? value : null
value: value !== "" ? value[1] : null
};
}
VariableDeclarationNoIn
= name:Identifier __ value:InitialiserNoIn? {
= name:Identifier value:(__ InitialiserNoIn)? {
return {
type: "VariableDeclaration",
name: name,
value: value !== "" ? value : null
value: value !== "" ? value[1] : null
};
}

Loading…
Cancel
Save