-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #5779 from rhuanjl:exportNamespace This PR does the following: 1. implements support for `export * as ns from "module"` syntax a normative change PR to ecma262 which has tc39 consensus See spec diff: https://spectranaut.github.io/proposal-export-ns-from/ See normative PR here: tc39/ecma262#1174 (comment) This is placed behind a flag but set to default enabled 2. Adds some relevant tests 3. Fixes a bug where duplicate exports weren't always a syntax error (implementing this feature correctly without fixing this bug would have been awkward) 4. Some drive by syntax error message improvement for duplicate exports and alias'd exports - "Syntax error: Syntax error" -> "Syntax error: Duplicate export of name '%s'" - "Syntax error: Syntax error" -> "Syntax error: 'as' is only valid if followed by an identifier." There are unfortunately some remaining related test262 failures due to #5778 and #5501 closes #5759 fixes #5777
- Loading branch information
Showing
10 changed files
with
445 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} else { | ||
print (`Failed - threw ${e.constructor.toString()} but should have thrown SyntaxError`); | ||
} | ||
}); |
Oops, something went wrong.