Add tests for position of module declarations

Assert that ImportDeclaration and ExportDeclaration match only the
ModuleItem symbol.

According to the definition of HostResolveImportedModule, it is
acceptable for an implementation to throw a SyntaxError in the event
that a requested module can neither be found nor created:

> If a Module Record corresponding to the pair referencingModule,
> specifier does not exist or cannot be created, an exception must be
> thrown.

In order to reliably detect a SyntaxError in response to the correct
interpretation of the grammar (and not a SyntaxError from an *incorrect*
interpretation of the grammar followed by a failure to resolve the
requested module), the ModuleSpecifier of ExportDeclarations should
describe a valid resource.
This commit is contained in:
Mike Pennisi 2016-02-18 16:17:21 -05:00
parent 7d345fc95b
commit a6dcd0dcca
90 changed files with 982 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The `export` declaration may not appear within eval code
id: sec-scripts
flags: [module]
info: |
Eval code is the source text supplied to the built-in eval function. More
precisely, if the parameter to the built-in eval function is a String, it
is treated as an ECMAScript Script. The eval code for a particular
invocation of eval is the global code portion of that Script.
A.5 Scripts and Modules
Script:
ScriptBodyopt
ScriptBody:
StatementList
---*/
assert.throws(SyntaxError, function() {
eval('export default null;');
});

View File

@ -0,0 +1,24 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The `import` declaration may not appear within eval code
id: sec-scripts
flags: [module]
info: |
Eval code is the source text supplied to the built-in eval function. More
precisely, if the parameter to the built-in eval function is a String, it
is treated as an ECMAScript Script. The eval code for a particular
invocation of eval is the global code portion of that Script.
A.5 Scripts and Modules
Script:
ScriptBodyopt
ScriptBody:
StatementList
---*/
assert.throws(SyntaxError, function() {
eval('import v from "./import.js";');
});

View File

@ -0,0 +1,17 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The `export` declaration may not appear within a ScriptBody
id: sec-scripts
negative: SyntaxError
info: |
A.5 Scripts and Modules
Script:
ScriptBodyopt
ScriptBody:
StatementList
---*/
export default null;

View File

@ -0,0 +1,17 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The `import` declaration may not appear within a ScriptBody
id: sec-scripts
negative: SyntaxError
info: |
A.5 Scripts and Modules
Script:
ScriptBodyopt
ScriptBody:
StatementList
---*/
import v from './import.js';

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
() => { export default null; };

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
{ void 0; export default null; }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
{ export default null; }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { static method() { export default null; } }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { method() { export default null; } }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { static *method() { export default null; } }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { *method() { export default null; } }

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { static *method() { export default null; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { *method() { export default null; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { static method() { export default null; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { method() { export default null; } });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
do export default null; while (false)

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (const x = 0; false;)
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (const y in [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (let y in [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (y in [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (var y in [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (let x = 0; false;)
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (x = 0; false;)
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (const y of [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (let y of [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (y of [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (var y of [])
export default null;

View File

@ -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.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (var x = 0; false;)
export default null;

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
function f() { export default null; }

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(function() { export default null; });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
function* g() { export default null; }

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(function*() { export default null; });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
if (true) { } else export default null;

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
if (false) export default null;

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
test262: export default null;

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ *m() { export default null; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ get m() { export default null; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ m() { export default null; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ set m(x) { export default null; } });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
switch(0) { case 1: export default null; default: }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
switch(0) { case 1: export default null; }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
switch(0) { default: export default null; }

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try { } catch (err) { } finally {
export default null;
}

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try { } catch (err) {
export default null;
}

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try { } finally {
export default null;
}

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try {
export default null;
} catch (err) { }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `export` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
while (false) export default null;

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
() => { import v from './decl-pos-import-arrow-function.js'; };

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
{ void 0; import v from './decl-pos-import-block-stmt-list.js'; }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
{ import v from './decl-pos-import-block-stmt.js'; }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { static method() { import v from './decl-pos-import-class-decl-meth-static.js'; } }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { method() { import v from './decl-pos-import-class-decl-meth.js'; } }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { static *method() { import v from './decl-pos-import-class-decl-method-gen-static.js'; } }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
class C { *method() { import v from './decl-pos-import-class-decl-method-gen.js'; } }

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { static *method() { import v from './decl-pos-import-class-expr-meth-gen-static.js'; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { *method() { import v from './decl-pos-import-class-expr-meth-gen.js'; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { static method() { import v from './decl-pos-import-class-expr-meth-static.js'; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(class { method() { import v from './decl-pos-import-class-expr-meth.js'; } });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
do import v from './decl-pos-import-do-while.js'; while (false)

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (const x = 0; false;)
import v from './decl-pos-import-for-const.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (const y in [])
import v from './decl-pos-import-for-in-const.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (let y in [])
import v from './decl-pos-import-for-in-let.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (y in [])
import v from './decl-pos-import-for-in-lhs.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (var y in [])
import v from './decl-pos-import-for-in-var.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (let x = 0; false;)
import v from './decl-pos-import-for-let.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (x = 0; false;)
import v from './decl-pos-import-for-lhs.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (const y of [])
import v from './decl-pos-import-for-of-const.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (let y of [])
import v from './decl-pos-import-for-of-let.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (y of [])
import v from './decl-pos-import-for-of-lhs.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (var y of [])
import v from './decl-pos-import-for-of-var.js';

View File

@ -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.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
for (var x = 0; false;)
import v from './decl-pos-import-for-var.js';

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
function f() { import v from './decl-pos-import-function-decl.js'; }

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(function() { import v from './decl-pos-import-function-expr.js'; });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
function* g() { import v from './decl-pos-import-generator-decl.js'; }

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
(function*() { import v from './decl-pos-import-generator-expr.js'; });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
if (true) { } else import v from './decl-pos-import-if-else.js';

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
if (false) import v from './decl-pos-import-if-if.js';

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
test262: import v from './decl-pos-import-labeled.js';

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ *m() { import v from './decl-pos-import-object-gen-method.js'; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ get m() { import v from './decl-pos-import-object-getter.js'; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ m() { import v from './decl-pos-import-object-method.js'; } });

View File

@ -0,0 +1,10 @@
// 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 cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
({ set m(x) { import v from './decl-pos-import-object-setter.js'; } });

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
switch(0) { case 1: import v from './decl-pos-import-switch-case-dflt.js'; default: }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
switch(0) { case 1: import v from './decl-pos-import-switch-case.js'; }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
switch(0) { default: import v from './decl-pos-import-switch-dftl.js'; }

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try { } catch (err) { } finally {
import v from './decl-pos-import-try-catch-finally.js';
}

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try { } catch (err) {
import v from './decl-pos-import-try-catch.js';
}

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try { } finally {
import v from './decl-pos-import-try-finally.js';
}

View File

@ -0,0 +1,12 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
try {
import v from './decl-pos-import-try-try.js';
} catch (err) { }

View File

@ -0,0 +1,10 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Statement cannot contain an `import` declaration
id: sec-modules
negative: SyntaxError
flags: [module]
---*/
while (false) import v from './decl-pos-import-while.js';