This adds [no |LineTerminator| here] assertions to ExtractorBindingPattern, ExtractorAssignmentPattern, and ExtractorMemberExpression to align with Option (2) as discussed in #24:
Introduce an NLT in ExtractorBindingPattern and ExtractorAssignmentPattern.
This is an alternative solution to the one implemented in #25.
The outcome of this change is as follows:
For
let x
(a) = b
the source is interpreted as let x; (a) = b; due to the NLT assertion and ASI.
For
let x
[a](b) = c
the source is interpreted as let x; [a](b) = c; due to the NLT assertion and ASI. Note that [a](b) is not a valid ExtractorAssignmentPattern as [a] is not a valid ExtractorMemberExpression and will result in an Early Error when applying static semantics for destructuring assignment.
For
let x[a]
(b) = c
the source is interpreted as let x[a]; (b) = c; due to the NLT assertion and ASI and results in a Syntax Error at parse time.
For
x
(a) = b
the source is interpreted as x(a) = b; when parsing AssignmentExpression, but will result in an Early Error when applying static semantics for destructuring assignment since ExtractorAssignmentPattern has an NLT restriction. Since this is enforced as a static semantics rule, ASI will not trigger.
For
x
[a](b) = c
the source is interpreted as x[a](b) = c; when parsing AssignmentExpression, but will result in an Early Error when applying static semantics for destructuring assignment since ExtractorAssignmentPattern has an NLT restriction. Since this is enforced as a static semantics rule, ASI will not trigger.
For
x
[a]
(b) = c
the source is interpreted as x[a](b) = c; when parsing AssignmentExpression, but will result in an Early Error when applying static semantics for destructuring assignment since ExtractorAssignmentPattern has an NLT restriction. Since this is enforced as a static semantics rule, ASI will not trigger.
This adds
[no |LineTerminator| here]
assertions to ExtractorBindingPattern, ExtractorAssignmentPattern, and ExtractorMemberExpression to align with Option (2) as discussed in #24:This is an alternative solution to the one implemented in #25.
The outcome of this change is as follows:
For
the source is interpreted as
let x; (a) = b;
due to the NLT assertion and ASI.For
the source is interpreted as
let x; [a](b) = c;
due to the NLT assertion and ASI. Note that[a](b)
is not a valid ExtractorAssignmentPattern as[a]
is not a valid ExtractorMemberExpression and will result in an Early Error when applying static semantics for destructuring assignment.For
the source is interpreted as
let x[a]; (b) = c;
due to the NLT assertion and ASI and results in a Syntax Error at parse time.For
the source is interpreted as
x(a) = b;
when parsing AssignmentExpression, but will result in an Early Error when applying static semantics for destructuring assignment since ExtractorAssignmentPattern has an NLT restriction. Since this is enforced as a static semantics rule, ASI will not trigger.For
the source is interpreted as
x[a](b) = c;
when parsing AssignmentExpression, but will result in an Early Error when applying static semantics for destructuring assignment since ExtractorAssignmentPattern has an NLT restriction. Since this is enforced as a static semantics rule, ASI will not trigger.For
the source is interpreted as
x[a](b) = c;
when parsing AssignmentExpression, but will result in an Early Error when applying static semantics for destructuring assignment since ExtractorAssignmentPattern has an NLT restriction. Since this is enforced as a static semantics rule, ASI will not trigger.Fixes #24 Related #25