Addressed CR feedback.

This commit is contained in:
Daniel Rosenwasser
2015-07-13 17:55:48 -07:00
parent a6d17d82c2
commit 30c6947ae3
2 changed files with 34 additions and 19 deletions

View File

@@ -4345,10 +4345,6 @@ namespace ts {
}
}
function nextTokenIsStringLiteralOnSameLine() {
return !scanner.hasPrecedingLineBreak() && token === SyntaxKind.StringLiteral;
}
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
nextToken();
return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === SyntaxKind.StringLiteral);
@@ -5141,9 +5137,9 @@ namespace ts {
node.exportClause = parseNamedImportsOrExports(SyntaxKind.NamedExports);
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
if (token === SyntaxKind.FromKeyword || lookAhead(nextTokenIsStringLiteralOnSameLine)) {
if (token === SyntaxKind.FromKeyword || (token === SyntaxKind.StringLiteral && !scanner.hasPrecedingLineBreak())) {
parseExpected(SyntaxKind.FromKeyword)
node.moduleSpecifier = parseModuleSpecifier();
}