Chakracore: BUG: ImportCall is a CallExpression, it can't be preceded by the new keyword

Created on 25 Oct 2018  路  1Comment  路  Source: chakra-core/ChakraCore

Most helpful comment

Note currently this throws a runtime error instead of a syntax error.

Super easy fix could either:
a) check if the last token was new and if so throw here:
https://github.com/Microsoft/ChakraCore/blob/276661f908707e4d2cc6137fe94e6b5422b2b492/lib/Parser/Parse.cpp#L3578-L3583
OR
b) Check if the next token is import here and if so throw:
https://github.com/Microsoft/ChakraCore/blob/276661f908707e4d2cc6137fe94e6b5422b2b492/lib/Parser/Parse.cpp#L3461

Will submit a PR if wanted when one of my existing ones has been merged. edit: may have got impatient, PR open.

>All comments

Note currently this throws a runtime error instead of a syntax error.

Super easy fix could either:
a) check if the last token was new and if so throw here:
https://github.com/Microsoft/ChakraCore/blob/276661f908707e4d2cc6137fe94e6b5422b2b492/lib/Parser/Parse.cpp#L3578-L3583
OR
b) Check if the next token is import here and if so throw:
https://github.com/Microsoft/ChakraCore/blob/276661f908707e4d2cc6137fe94e6b5422b2b492/lib/Parser/Parse.cpp#L3461

Will submit a PR if wanted when one of my existing ones has been merged. edit: may have got impatient, PR open.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajatd picture rajatd  路  6Comments

d3x0r picture d3x0r  路  5Comments

Kureev picture Kureev  路  5Comments

basdl picture basdl  路  3Comments

ross-weir picture ross-weir  路  4Comments