Skip to content

Commit ffda9ac

Browse files
authored
Allow an empty AssertClause (#95)
@waldemarhorwat pointed out during Stage 3 review that the current syntax does not permit an empty AssertClause. Though an empty AssertClause would not be semantically different from leaving out the AssertClause altogether, it seems reasonable to allow an empty one for consistency's sake because other parts of `import`/`export` syntax permit empty lists. For example it would be strange if the first `{ }` was permitted in the following statement (which is currently the case), but the second was not: `import { } from "./foo.js" assert { }`. Thus this PR edits the spec to allow an AssertClause that has no entries. Closes #94.
1 parent f4eeefa commit ffda9ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ <h1>Syntax</h1>
3737
`export` `default` [lookahead &lt;! {`function`, `async` [no |LineTerminator| here] `function`, `class`}] AssignmentExpression[+In, ~Yield, ~Await] `;`
3838

3939
AssertClause :
40+
<ins>`assert` `{` `}`</ins>
4041
<ins>`assert` `{` AssertEntries `,`? `}`</ins>
4142

4243
AssertEntries :
@@ -224,6 +225,11 @@ <h1>Static Semantics: Early Errors</h1>
224225

225226
<emu-clause id="sec-assert-clause-to-assertions" aoid="AssertClauseToAssertions">
226227
<h1>Runtime Semantics: AssertClauseToAssertions</h1>
228+
<emu-grammar>AssertClause : `assert` `{` `}`</emu-grammar>
229+
<emu-alg>
230+
1. Return a new empty List.
231+
</emu-alg>
232+
227233
<emu-grammar>AssertClause : `assert` `{` AssertEntries `,`? `}`</emu-grammar>
228234
<emu-alg>
229235
1. Let _assertions_ be AssertClauseToAssertions of |AssertEntries|.

0 commit comments

Comments
 (0)