Add tests for restricted grammar productions

This commit is contained in:
Mike Pennisi 2016-07-01 16:34:26 -04:00
parent 24391fb9e8
commit 14595b47b8
5 changed files with 119 additions and 0 deletions

View File

@ -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.
/*---
esid: sec-scripts
es6id: 15.1
description: ReturnStatement may not be used directly within global code
info: |
Syntax
Script :
ScriptBodyopt
ScriptBody :
StatementList[~Yield, ~Return]
negative: SyntaxError
---*/
return;

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.
/*---
esid: sec-scripts
es6id: 15.1
description: >
The `yield` token is interpreted as an Identifier when it appears in global
code (non-strict mode)
info: |
Syntax
Script :
ScriptBodyopt
ScriptBody :
StatementList[~Yield, ~Return]
flags: [noStrict]
---*/
// Avoid test failures in cases where the host has defined a `yield` property
// on the global object.
try {
yield = 0;
} catch (_) {}

View File

@ -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.
/*---
esid: sec-scripts
es6id: 15.1
description: >
The `yield` token is interpreted as an Identifier when it appears in global
code (strict mode)
info: |
Syntax
Script :
ScriptBodyopt
ScriptBody :
StatementList[~Yield, ~Return]
flags: [onlyStrict]
negative: SyntaxError
---*/
yield;

View File

@ -0,0 +1,28 @@
// 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-modules
es6id: 15.2
description: ReturnStatement may not be used directly within ModuleBody
info: |
Syntax
Module :
ModuleBodyopt
ModuleBody :
ModuleItemList
ModuleItemList :
ModuleItem
ModuleItemList ModuleItem
ModuleItem:
ImportDeclaration
ExportDeclaration
StatementListItem[~Yield, ~Return]
flags: [module]
negative: SyntaxError
---*/
return;

View File

@ -0,0 +1,28 @@
// 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-modules
es6id: 15.2
description: YieldExpression may not be used directly within ModuleBody
info: |
Syntax
Module :
ModuleBodyopt
ModuleBody :
ModuleItemList
ModuleItemList :
ModuleItem
ModuleItemList ModuleItem
ModuleItem:
ImportDeclaration
ExportDeclaration
StatementListItem[~Yield, ~Return]
flags: [module]
negative: SyntaxError
---*/
yield;