mirror of https://github.com/tc39/test262.git
Module code: syntax validation
Assert that module code is parsed as specified.
This commit is contained in:
parent
355ba1ba83
commit
f817f10858
|
@ -0,0 +1,11 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-exports
|
||||
es6id: 15.2.3
|
||||
description: The default export may not be a LexicalDeclaration (const)
|
||||
flags: [module]
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
export default const x = null;
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Expression not permitted in AssignmentExpression position
|
||||
esid: sec-exports
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export default null, null;
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-exports
|
||||
es6id: 15.2.3
|
||||
description: The default export may not be a LexicalDeclaration (let)
|
||||
flags: [module]
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
export default let x;
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-exports
|
||||
es6id: 15.2.3
|
||||
description: The default export may not be a VariableStatement
|
||||
flags: [module]
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
export default var x;
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Function declarations are interpreted as lexically-scoped in module code
|
||||
esid: sec-module-semantics-static-semantics-lexicallydeclarednames
|
||||
info: |
|
||||
ModuleItem : StatementListItem
|
||||
|
||||
1. Return LexicallyDeclaredNames of StatementListItem.
|
||||
|
||||
15.2.1.1 Static Semantics: Early Errors
|
||||
|
||||
- It is a Syntax Error if any element of the LexicallyDeclaredNames of
|
||||
ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
var f;
|
||||
function f() {}
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Generator function declarations are interpreted as lexically-scoped in
|
||||
module code
|
||||
esid: sec-module-semantics-static-semantics-lexicallydeclarednames
|
||||
info: |
|
||||
ModuleItem : StatementListItem
|
||||
|
||||
1. Return LexicallyDeclaredNames of StatementListItem.
|
||||
|
||||
15.2.1.1 Static Semantics: Early Errors
|
||||
|
||||
- It is a Syntax Error if any element of the LexicallyDeclaredNames of
|
||||
ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
var g;
|
||||
function* g() {}
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Anonymous function declaration must not be interpreted as an expression
|
||||
esid: sec-exports
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export default function() {}();
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
Anonymous generator function declaration must not be interpreted as an
|
||||
expression
|
||||
esid: sec-exports
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export default function* () {}();
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: Early ReferenceError resulting from module parsing
|
||||
esid: sec-parsemodule
|
||||
negative: ReferenceError
|
||||
info: |
|
||||
[...]
|
||||
2. Parse sourceText using Module as the goal symbol and analyze the parse
|
||||
result for any Early Error conditions. If the parse was successful and
|
||||
no early errors were found, let body be the resulting parse tree.
|
||||
Otherwise, let body be a List of one or more SyntaxError or
|
||||
ReferenceError objects representing the parsing errors and/or early
|
||||
errors.
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
1++;
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
"export default AssignmentExpression" declarations require a trailing
|
||||
semicolon or LineTerminator
|
||||
esid: sec-exports
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export default null null;
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
"export ExportClause FromClause" declarations require a trailing semicolon
|
||||
or LineTerminator
|
||||
esid: sec-exports
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export {} from './parse-err-semi-export-clause-from.js' null;
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
"export ExportClause" declarations require a trailing semicolon or
|
||||
LineTerminator
|
||||
esid: sec-exports
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export {} null;
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: >
|
||||
"export *" declarations require a trailing semicolon or LineTerminator
|
||||
esid: sec-exports
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
negative: SyntaxError
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export * from './parse-err-semi-export-star.js' null;
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: Early SyntaxError resulting from module parsing
|
||||
esid: sec-parsemodule
|
||||
negative: SyntaxError
|
||||
info: |
|
||||
[...]
|
||||
2. Parse sourceText using Module as the goal symbol and analyze the parse
|
||||
result for any Early Error conditions. If the parse was successful and
|
||||
no early errors were found, let body be the resulting parse tree.
|
||||
Otherwise, let body be a List of one or more SyntaxError or
|
||||
ReferenceError objects representing the parsing errors and/or early
|
||||
errors.
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
?
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
description: An ExportClause does not require an ExportsList.
|
||||
esid: sec-parsemodule
|
||||
info: |
|
||||
ExportDeclaration:
|
||||
export * FromClause;
|
||||
export ExportClause FromClause;
|
||||
export ExportClause;
|
||||
export VariableStatement
|
||||
export Declaration
|
||||
export default HoistableDeclaration[Default]
|
||||
export default ClassDeclaration[Default]
|
||||
export default [lookahead ∉ { function, class }] AssignmentExpression[In];
|
||||
|
||||
ExportClause:
|
||||
{ }
|
||||
{ ExportsList }
|
||||
{ ExportsList , }
|
||||
|
||||
NOTE: This form has no observable side effects.
|
||||
flags: [module]
|
||||
---*/
|
||||
|
||||
export{};
|
||||
export {};
|
||||
export {}
|
||||
export { };
|
||||
export
|
||||
{
|
||||
|
||||
};
|
||||
export//-
|
||||
{//-
|
||||
//-
|
||||
};
|
||||
export/**/{/**/};
|
Loading…
Reference in New Issue