mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 20:37:46 -05:00
Merge branch 'master' into libReference
This commit is contained in:
@@ -503,7 +503,13 @@ namespace ts {
|
||||
|
||||
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false, scriptKind?: ScriptKind): SourceFile {
|
||||
performance.mark("beforeParse");
|
||||
const result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
|
||||
let result: SourceFile;
|
||||
if (languageVersion === ScriptTarget.JSON) {
|
||||
result = Parser.parseJsonText(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes);
|
||||
}
|
||||
else {
|
||||
result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind);
|
||||
}
|
||||
performance.mark("afterParse");
|
||||
performance.measure("Parse", "beforeParse", "afterParse");
|
||||
return result;
|
||||
@@ -3566,7 +3572,7 @@ namespace ts {
|
||||
// 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
|
||||
if (token() === SyntaxKind.AsyncKeyword) {
|
||||
nextToken();
|
||||
// If the "async" is followed by "=>" token then it is not a begining of an async arrow-function
|
||||
// If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function
|
||||
// but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher"
|
||||
if (scanner.hasPrecedingLineBreak() || token() === SyntaxKind.EqualsGreaterThanToken) {
|
||||
return Tristate.False;
|
||||
|
||||
Reference in New Issue
Block a user