Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined label #113

Closed
Taritsyn opened this issue Oct 12, 2019 · 7 comments · Fixed by #114
Closed

Undefined label #113

Taritsyn opened this issue Oct 12, 2019 · 7 comments · Fixed by #114
Labels

Comments

@Taritsyn
Copy link

Hello!

During parsing of the typescript-combined.js file the following error occurs:

Esprima.ParserException: Line 34409: Undefined label "outer"
   at Esprima.JavaScriptParser.ThrowError(String messageFormat, Object[] values) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 4156
   at Esprima.JavaScriptParser.ParseContinueStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2717
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3041
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2028
   at Esprima.JavaScriptParser.ParseSwitchCase() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2823
   at Esprima.JavaScriptParser.ParseSwitchStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2850
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3062
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2028
   at Esprima.JavaScriptParser.ParseBlock() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2052
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3014
   at Esprima.JavaScriptParser.IsolateCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 474
   at Esprima.JavaScriptParser.ParseForStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2692
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3050
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2028
   at Esprima.JavaScriptParser.ParseBlock() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2052
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3014
   at Esprima.JavaScriptParser.IsolateCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 474
   at Esprima.JavaScriptParser.ParseForStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2692
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3050
   at Esprima.JavaScriptParser.ParseLabelledStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2888
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3031
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2034
   at Esprima.JavaScriptParser.ParseFunctionSourceElements() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3118
   at Esprima.JavaScriptParser.ParseFunctionExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3412
   at Esprima.JavaScriptParser.ParsePrimaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 638
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseLeftHandSideExpressionAllowCall() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1351
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseUpdateExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1486
   at Esprima.JavaScriptParser.ParseUnaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1535
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseExponentiationExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1545
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseBinaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1655
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseConditionalExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1722
   at Esprima.JavaScriptParser.ParseAssignmentExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1870
   at Esprima.JavaScriptParser.IsolateCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 474
   at Esprima.JavaScriptParser.ParseVariableDeclaration(Boolean& inFor) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2373
   at Esprima.JavaScriptParser.ParseVariableDeclarationList(Boolean& inFor) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2388
   at Esprima.JavaScriptParser.ParseVariableStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2404
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3071
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2028
   at Esprima.JavaScriptParser.ParseFunctionSourceElements() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3118
   at Esprima.JavaScriptParser.ParseFunctionDeclaration(Boolean identifierIsOptional) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3330
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2018
   at Esprima.JavaScriptParser.ParseFunctionSourceElements() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3118
   at Esprima.JavaScriptParser.ParseFunctionDeclaration(Boolean identifierIsOptional) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3330
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2018
   at Esprima.JavaScriptParser.ParseFunctionSourceElements() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3118
   at Esprima.JavaScriptParser.ParseFunctionDeclaration(Boolean identifierIsOptional) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3330
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2018
   at Esprima.JavaScriptParser.ParseFunctionSourceElements() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3118
   at Esprima.JavaScriptParser.ParseFunctionExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3412
   at Esprima.JavaScriptParser.ParsePrimaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 638
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseLeftHandSideExpressionAllowCall() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1351
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseUpdateExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1486
   at Esprima.JavaScriptParser.ParseUnaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1535
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseExponentiationExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1545
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseBinaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1655
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseConditionalExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1722
   at Esprima.JavaScriptParser.ParseAssignmentExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1870
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseGroupExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1140
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParsePrimaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 600
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseLeftHandSideExpressionAllowCall() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1351
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseUpdateExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1486
   at Esprima.JavaScriptParser.ParseUnaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1535
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseExponentiationExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1545
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseBinaryExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1655
   at Esprima.JavaScriptParser.InheritCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 497
   at Esprima.JavaScriptParser.ParseConditionalExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1722
   at Esprima.JavaScriptParser.ParseAssignmentExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1870
   at Esprima.JavaScriptParser.IsolateCoverGrammar[T](Func`1 parseFunction) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 474
   at Esprima.JavaScriptParser.ParseExpression() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 1964
   at Esprima.JavaScriptParser.ParseExpressionStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2424
   at Esprima.JavaScriptParser.ParseStatement() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 3018
   at Esprima.JavaScriptParser.ParseStatementListItem() in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 2034
   at Esprima.JavaScriptParser.ParseProgram(Boolean strict) in C:\temp\TestEsprima\Esprima\JavascriptParser.cs:line 162

Parser from the Jint version 2.X correctly processed this code. ChakraCore and V8 can also parse this code correctly.

@lahma
Copy link
Collaborator

lahma commented Oct 13, 2019

Thanks for reporting, fixed as part of #114

@Taritsyn
Copy link
Author

Thanks!

@Taritsyn
Copy link
Author

How did I understand that current version of the Jint engine is not yet compatible with latest version of the Esprima parser?

In most cases, the following error occurs:

System.MissingFieldException: Field not found: 'Esprima.Ast.Program.Body'.
   at Jint.Engine.Execute(Program program)

@lahma
Copy link
Collaborator

lahma commented Oct 13, 2019

Sounds odd, I think the current NuGet Jint references the latest published Esprima package and they are working together.

@Taritsyn
Copy link
Author

Nothing strange, just I locally builded a package with latest version of the Esprima parser.

@lahma
Copy link
Collaborator

lahma commented Oct 13, 2019

@sebastienros should we release a new version of esprima and link Jint against it?

@Taritsyn
Copy link
Author

In principle, you can not rush, because I plan tomorrow to describe the error that occurs in the CoffeeScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants