Apply review feedback for hashbang

This commit is contained in:
Leo Balter 2019-02-05 12:46:27 -05:00 committed by Rick Waldron
parent da8ef2e779
commit 353cf531d6
26 changed files with 142 additions and 6 deletions

View File

@ -7,6 +7,10 @@
#
# https://github.com/tc39/process-document
# Hashbang Grammar
# https://github.com/tc39/proposal-hashbang
hashbang
# Object.fromEntries
# https://github.com/tc39/proposal-object-from-entries
Object.fromEntries

View File

@ -0,0 +1,14 @@
#\041
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters \041
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -2,9 +2,13 @@
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters
Hashbang comments should not be allowed to have encoded characters \u0021
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -0,0 +1,14 @@
#\u{21}
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters \u{21}
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -0,0 +1,14 @@
#\x21
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters \x21
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -0,0 +1,14 @@
\043!
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters \043
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -2,9 +2,13 @@
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters
Hashbang comments should not be allowed to have encoded characters \u0023
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -0,0 +1,14 @@
\u{23}!
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters \u{23}
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -0,0 +1,14 @@
\x23!
/*---
esid: pending
description: >
Hashbang comments should not be allowed to have encoded characters \x23
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -7,4 +7,8 @@ info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -5,6 +5,9 @@ description: >
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
features: [hashbang]
---*/
assert.sameValue(eval('#!\n'), undefined);
assert.sameValue(eval('#!\n1'), 1)
assert.sameValue(eval('#!2\n'), undefined);

View File

@ -9,6 +9,10 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/
DONOTEVALUATE();
function fn() {#!
}

View File

@ -5,11 +5,12 @@ description: >
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
features: [hashbang]
---*/
const AsyncFunction = (async function (){}).constructor;
const GeneratorFunction = (function *(){}).constructor;
const AsyncGeneratorFunction = (async function *(){}).constructor;
for (ctor of [
for (const ctor of [
Function,
AsyncFunction,
GeneratorFunction,

View File

@ -7,4 +7,5 @@ info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [module]
features: [hashbang]
---*/

View File

@ -1,4 +1,5 @@
#!/*
DONOTEVALUATE();
these characters should not be considered within a comment
*/
/*---
@ -12,4 +13,5 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -6,6 +6,7 @@ info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
features: [hashbang]
---*/
eval('#!');
assert.sameValue(eval('#!'), undefined);

View File

@ -7,5 +7,6 @@ info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
features: [hashbang]
---*/

View File

@ -0,0 +1,15 @@
"use strict";
#!
/*---
esid: pending
description: >
Hashbang comments should only be allowed at start of source texts and should not be preceded by DirectivePrologues.
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -11,4 +11,5 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -10,4 +10,5 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -11,4 +11,5 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -11,4 +11,5 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -11,4 +11,5 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -1,4 +1,4 @@
#!
#!
/*---
esid: pending
description: >
@ -10,4 +10,5 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/

View File

@ -9,6 +9,7 @@ flags: [raw]
negative:
phase: parse
type: SyntaxError
features: [hashbang]
---*/
{
#!

View File

@ -2,11 +2,12 @@
/*---
esid: pending
description: >
Hashbang comments should not be interpretted and should not generate DirectivePrologues.
Hashbang comments should not be interpreted and should not generate DirectivePrologues.
info: |
HashbangComment::
#! SingleLineCommentChars[opt]
flags: [raw]
features: [hashbang]
---*/
with ({}) {}