[loose parser] Make unclosed objects / lists span to the start of the next node
That way, whitespace at their end is considered part of them, and Tern can recognize when the cursor is inside of them.
This commit is contained in:
parent
75b58c07d4
commit
97f4e9a026
@ -905,7 +905,12 @@
|
||||
}
|
||||
}
|
||||
popCx();
|
||||
eat(tt.braceR);
|
||||
if (!eat(tt.braceR)) {
|
||||
// If there is no closing brace, make the node span to the start
|
||||
// of the next token (this is useful for Tern)
|
||||
lastEnd = token.start;
|
||||
if (options.locations) lastEndLoc = token.startLoc;
|
||||
}
|
||||
if (isClass) {
|
||||
semicolon();
|
||||
finishNode(node.body, "ClassBody");
|
||||
@ -1152,7 +1157,12 @@
|
||||
eat(tt.comma);
|
||||
}
|
||||
popCx();
|
||||
eat(close);
|
||||
if (!eat(close)) {
|
||||
// If there is no closing brace, make the node span to the start
|
||||
// of the next token (this is useful for Tern)
|
||||
lastEnd = token.start;
|
||||
if (options.locations) lastEndLoc = token.startLoc;
|
||||
}
|
||||
return elts;
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user