| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent edcfffe commit d6124d8
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,6 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const { | |
| 4 | - ArrayFrom, | ||
| 5 | 4 | ArrayPrototypeForEach, | |
| 6 | 5 | ArrayPrototypeIncludes, | |
| 7 | 6 | ArrayPrototypeJoin, | |
@@ -155,7 +154,7 @@ for (const nodeType of ObjectKeys(walk.base)) { | |||
| 155 | 154 | function processTopLevelAwait(src) { | |
| 156 | 155 | const wrapPrefix = '(async () => { '; | |
| 157 | 156 | const wrapped = `${wrapPrefix}${src} })()`; | |
| 158 | - const wrappedArray = ArrayFrom(wrapped); | ||
| 157 | + const wrappedArray = StringPrototypeSplit(wrapped, ''); | ||
| 159 | 158 | let root; | |
| 160 | 159 | try { | |
| 161 | 160 | root = parser.parse(wrapped, { ecmaVersion: 'latest' }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,17 +9,31 @@ const { processTopLevelAwait } = require('internal/repl/await'); | |||
| 9 | 9 | // This test was created based on | |
| 10 | 10 | // https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/http/tests/inspector-unit/preprocess-top-level-awaits.js?rcl=358caaba5e763e71c4abb9ada2d9cd8b1188cac9 | |
| 11 | 11 | ||
| 12 | + const surrogate = ( | ||
| 13 | + '"\u{1F601}\u{1f468}\u200d\u{1f469}\u200d\u{1f467}\u200d\u{1f466}"' | ||
| 14 | + ); | ||
| 15 | + | ||
| 12 | 16 | const testCases = [ | |
| 13 | 17 | [ '0', | |
| 14 | 18 | null ], | |
| 15 | 19 | [ 'await 0', | |
| 16 | 20 | '(async () => { return (await 0) })()' ], | |
| 21 | + [ `await ${surrogate}`, | ||
| 22 | + `(async () => { return (await ${surrogate}) })()` ], | ||
| 17 | 23 | [ 'await 0;', | |
| 18 | 24 | '(async () => { return (await 0); })()' ], | |
| 25 | + [ `await ${surrogate};`, | ||
| 26 | + `(async () => { return (await ${surrogate}); })()` ], | ||
| 27 | + [ `await ${surrogate};`, | ||
| 28 | + `(async () => { return (await ${surrogate}); })()` ], | ||
| 19 | 29 | [ '(await 0)', | |
| 20 | 30 | '(async () => { return ((await 0)) })()' ], | |
| 31 | + [ `(await ${surrogate})`, | ||
| 32 | + `(async () => { return ((await ${surrogate})) })()` ], | ||
| 21 | 33 | [ '(await 0);', | |
| 22 | 34 | '(async () => { return ((await 0)); })()' ], | |
| 35 | + [ `(await ${surrogate});`, | ||
| 36 | + `(async () => { return ((await ${surrogate})); })()` ], | ||
| 23 | 37 | [ 'async function foo() { await 0; }', | |
| 24 | 38 | null ], | |
| 25 | 39 | [ 'async () => await 0', | |
@@ -28,8 +42,12 @@ const testCases = [ | |||
| 28 | 42 | null ], | |
| 29 | 43 | [ 'await 0; return 0;', | |
| 30 | 44 | null ], | |
| 45 | + [ `await ${surrogate}; await ${surrogate};`, | ||
| 46 | + `(async () => { await ${surrogate}; return (await ${surrogate}); })()` ], | ||
| 31 | 47 | [ 'var a = await 1', | |
| 32 | 48 | 'var a; (async () => { void (a = await 1) })()' ], | |
| 49 | + [ `var a = await ${surrogate}`, | ||
| 50 | + `var a; (async () => { void (a = await ${surrogate}) })()` ], | ||
| 33 | 51 | [ 'let a = await 1', | |
| 34 | 52 | 'let a; (async () => { void (a = await 1) })()' ], | |
| 35 | 53 | [ 'const a = await 1', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments