-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implement export * as ns from module syntax #5779
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -645,6 +645,7 @@ class Parser | |
ModuleImportOrExportEntry* AddModuleImportOrExportEntry(ModuleImportOrExportEntryList* importOrExportEntryList, IdentPtr importName, IdentPtr localName, IdentPtr exportName, IdentPtr moduleRequest); | ||
ModuleImportOrExportEntry* AddModuleImportOrExportEntry(ModuleImportOrExportEntryList* importOrExportEntryList, ModuleImportOrExportEntry* importOrExportEntry); | ||
void AddModuleLocalExportEntry(ParseNodePtr varDeclNode); | ||
void CheckForDuplicateExportEntry(IdentPtr exportName); | ||
void CheckForDuplicateExportEntry(ModuleImportOrExportEntryList* exportEntryList, IdentPtr exportName); | ||
|
||
ParseNodeVar * CreateModuleImportDeclNode(IdentPtr localName); | ||
|
@@ -1087,11 +1088,11 @@ class Parser | |
void AddToNodeList(ParseNode ** ppnodeList, ParseNode *** pppnodeLast, ParseNode * pnodeAdd); | ||
void AddToNodeListEscapedUse(ParseNode ** ppnodeList, ParseNode *** pppnodeLast, ParseNode * pnodeAdd); | ||
|
||
void ChkCurTokNoScan(int tk, int wErr) | ||
void ChkCurTokNoScan(int tk, int wErr, LPCWSTR stringOne = _u(""), LPCWSTR stringTwo = _u("")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I would prefer if new code only used char16, those old Windows-style ALLCAPSTYPENAMES are pretty inscrutable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These seem to be typedef'd to const char16_t (on xplat at least) but the windows CI failed if I used that here, wanting instead const wchar - not sure if I can use that on xplat. If I was going to change here to avoid problems I'd probably need to change it up the chain i.e. in Error() and ParseExceptionObject (admittedly I wrote the code in those two places in #5761) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh interesting. this code may be old enough then that it still expects there to be a difference between wchar types. If thats the case, then theres no issue. |
||
{ | ||
if (m_token.tk != tk) | ||
{ | ||
Error(wErr); | ||
Error(wErr, stringOne, stringTwo); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//------------------------------------------------------------------------------------------------------- | ||
// Copyright (C) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. | ||
//------------------------------------------------------------------------------------------------------- | ||
|
||
// Bug Issue 5777 https://github.com/Microsoft/ChakraCore/issues/5777 | ||
// Duplicate export names should cause an early syntax error | ||
|
||
WScript.RegisterModuleSource("a.js", | ||
`export const boo = 4; | ||
export {bar as boo} from "b.js"; | ||
print ("Should not be printed")`); | ||
WScript.RegisterModuleSource("b.js","export const bar = 5;"); | ||
|
||
import("a.js").then(()=>{ | ||
print("Failed - expected SyntaxError but no error thrown") | ||
}).catch ((e)=>{ | ||
if (e instanceof SyntaxError) { | ||
print("pass"); | ||
rhuanjl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} else { | ||
print (`Failed - threw ${e.constructor.toString()} but should have thrown SyntaxError`); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hurray for better error messages!