mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fixed issue where parser improperly parses a function declaration with no identifier.
This commit is contained in:
parent
d6888b2834
commit
e69b9e6362
@ -5379,6 +5379,10 @@ module ts {
|
||||
var isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0;
|
||||
|
||||
function reportImplementationExpectedError(node: FunctionDeclaration): void {
|
||||
if (node.name && node.name.kind === SyntaxKind.Missing) {
|
||||
return;
|
||||
}
|
||||
|
||||
var seen = false;
|
||||
var subsequentNode = forEachChild(node.parent, c => {
|
||||
if (seen) {
|
||||
|
||||
@ -953,7 +953,10 @@ module ts {
|
||||
return finishNode(node);
|
||||
}
|
||||
error(Diagnostics.Identifier_expected);
|
||||
return <Identifier>createMissingNode();
|
||||
|
||||
var node = <Identifier>createMissingNode();
|
||||
node.text = "";
|
||||
return node;
|
||||
}
|
||||
|
||||
function parseIdentifier(): Identifier {
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction1.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction1.ts (1 errors) ====
|
||||
function =>
|
||||
~~
|
||||
!!! Identifier expected.
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
!!! Identifier expected.
|
||||
@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (5 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (4 errors) ====
|
||||
function (a => b;
|
||||
~
|
||||
!!! Identifier expected.
|
||||
@ -7,6 +7,4 @@
|
||||
~
|
||||
!!! ',' expected.
|
||||
|
||||
!!! ')' expected.
|
||||
|
||||
!!! Function implementation is missing or not immediately following the declaration.
|
||||
!!! ')' expected.
|
||||
Loading…
x
Reference in New Issue
Block a user