Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up`ExportDeclaration` and semicolons/ASI #284
Comments
This was referenced Jan 13, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
allenwb
Jan 14, 2016
Member
Yes, the grammar is correct.
I suggest rewriting the first sentence of https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion to be:
Certain ECMAScript statements (empty statement, let, const, import, and >>some<< export declarations...
and yes, remove the two semicolon in Table 43 on the function exports.
|
Yes, the grammar is correct. I suggest rewriting the first sentence of https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion to be:
and yes, remove the two semicolon in Table 43 on the function exports. |
mathiasbynens commentedJan 13, 2016
https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion explicitly mentions
exportstatements:Furthermore, table 43 (although purely illustrative) includes the semicolons in all of its examples: https://tc39.github.io/ecma262/#table-42
However, the
ExportDeclarationgrammar doesn’t include the semicolon for the following cases:export HoistableDeclaration, e.g.export function foo() {}export ClassDeclaration, e.g.export class Bar {}export default HoistableDeclaration, e.g.export default function baz() {}export default ClassDeclaration, e.g.export default class Qux {}If the grammar is correct, then:
exportsince it’s currently overgeneralizingexport default function f(){}andexport default function(){}cc @jmm