mirror of https://github.com/tc39/test262.git
Update tests according to ES2016 draft semantics
The ES2016 draft further refines the completion values for `if` and `with` statements. Two tests must be removed outright because the completion value in those cases is no longer accessible from the runtime.
This commit is contained in:
parent
407b8964ce
commit
e62d43c815
|
@ -1,45 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 13.7.4.7
|
||||
description: >
|
||||
Completion value when head has a declaration but no "test" expression
|
||||
info: >
|
||||
IterationStatement :
|
||||
for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
|
||||
|
||||
1. Let varDcl be the result of evaluating VariableDeclarationList.
|
||||
2. ReturnIfAbrupt(varDcl).
|
||||
3. Return ForBodyEvaluation(the first Expression, the second Expression,
|
||||
Statement, « », labelSet).
|
||||
|
||||
13.7.4.8 Runtime Semantics: ForBodyEvaluation
|
||||
1. Let V = undefined.
|
||||
[...]
|
||||
4. Repeat
|
||||
a. If test is not [empty], then
|
||||
[...]
|
||||
b. Let result be the result of evaluating stmt.
|
||||
c. If LoopContinues(result, labelSet) is false, return
|
||||
Completion(UpdateEmpty(result, V)).
|
||||
|
||||
13.9.3 Runtime Semantics: Evaluation
|
||||
|
||||
BreakStatement : break ;
|
||||
|
||||
1. Return Completion{[[type]]: break, [[value]]: empty, [[target]]: empty}.
|
||||
---*/
|
||||
|
||||
assert.sameValue(eval('1; for (var run = true; ; ) { break; }'), undefined);
|
||||
assert.sameValue(
|
||||
eval('2; for (var first = true; ; ) { if (!first) { break; } first = false; 3; }'),
|
||||
3,
|
||||
'Updating an empty completion from a prior iteration.'
|
||||
);
|
||||
|
||||
assert.sameValue(eval('4; outer: do { for (var run = true; ; ) { continue outer; } } while (false)'), undefined);
|
||||
assert.sameValue(
|
||||
eval('5; outer: do { for (var first = true; ; ) { if (!first) { continue outer; } first = false; 6; } } while (false)'),
|
||||
6,
|
||||
'Updating an empty completion from a prior iteration.'
|
||||
);
|
|
@ -1,59 +0,0 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 13.7.4.7
|
||||
description: >
|
||||
Completion value when head has no declaration and no "test" expression
|
||||
info: >
|
||||
IterationStatement :
|
||||
for ( Expressionopt ; Expressionopt ; Expressionopt ) Statement
|
||||
|
||||
1. If the first Expression is present, then
|
||||
a. Let exprRef be the result of evaluating the first Expression.
|
||||
b. Let exprValue be GetValue(exprRef).
|
||||
c. ReturnIfAbrupt(exprValue).
|
||||
2. Return ForBodyEvaluation(the second Expression, the third Expression,
|
||||
Statement, « », labelSet).
|
||||
|
||||
13.7.4.8 Runtime Semantics: ForBodyEvaluation
|
||||
1. Let V = undefined.
|
||||
[...]
|
||||
4. Repeat
|
||||
a. If test is not [empty], then
|
||||
[...]
|
||||
b. Let result be the result of evaluating stmt.
|
||||
c. If LoopContinues(result, labelSet) is false, return
|
||||
Completion(UpdateEmpty(result, V)).
|
||||
|
||||
13.9.3 Runtime Semantics: Evaluation
|
||||
|
||||
BreakStatement : break ;
|
||||
|
||||
1. Return Completion{[[type]]: break, [[value]]: empty, [[target]]: empty}.
|
||||
---*/
|
||||
|
||||
assert.sameValue(eval('1; for ( ; ; ) { break; }'), undefined);
|
||||
assert.sameValue(eval('2; for ( ; ; ) { 3; break; }'), 3);
|
||||
assert.sameValue(
|
||||
eval('var first = true; 4; for ( ; ; ) { if (!first) { 5; break; } first = false; }'),
|
||||
5,
|
||||
'Updating an empty completion from a prior iteration.'
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('var first = true; 6; for ( ; ; ) { if (!first) { break; } first = false; 7; }'),
|
||||
7,
|
||||
'Updating an empty completion from a prior iteration.'
|
||||
);
|
||||
|
||||
assert.sameValue(eval('8; outer: do { for ( ; ; ) { continue outer; } } while (false)'), undefined);
|
||||
assert.sameValue(eval('9; outer: do { for ( ; ; ) { 10; continue outer; } } while (false)'), 10);
|
||||
assert.sameValue(
|
||||
eval('var first = true; 11; outer: do { for ( ; ; ) { if (!first) { 12; continue outer; } first = false; } } while (false)'),
|
||||
12,
|
||||
'Updating an empty completion from a prior iteration.'
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('var first = true; 13; outer: do { for ( ; ; ) { if (!first) { continue outer; } first = false; 14; } } while (false)'),
|
||||
14,
|
||||
'Updating an empty completion from a prior iteration.'
|
||||
);
|
|
@ -1,40 +1,40 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 13.6.7
|
||||
es7id: pending
|
||||
description:
|
||||
Completion value when expression is false with an `else` clause and body
|
||||
returns an empty abrupt completion
|
||||
info: >
|
||||
IfStatement : if ( Expression ) Statement else Statement
|
||||
|
||||
4. If exprValue is true, then
|
||||
3. If exprValue is true, then
|
||||
[...]
|
||||
5. Else,
|
||||
4. Else,
|
||||
a. Let stmtCompletion be the result of evaluating the second Statement.
|
||||
6. ReturnIfAbrupt(stmtCompletion).
|
||||
7. If stmtCompletion.[[value]] is not empty, return stmtCompletion.
|
||||
8. Return NormalCompletion(undefined).
|
||||
5. Return Completion(UpdateEmpty(stmtCompletion, undefined)).
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
eval('1; do { if (false) { } else { break; } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('2; do { 3; if (false) { } else { break; } } while (false)'), 3
|
||||
eval('2; do { 3; if (false) { } else { break; } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('4; do { if (false) { 5; } else { break; } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('6; do { 7; if (false) { 8; } else { break; } } while (false)'), 7
|
||||
eval('6; do { 7; if (false) { 8; } else { break; } } while (false)'),
|
||||
undefined
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
eval('9; do { if (false) { } else { continue; } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('10; do { 11; if (false) { } else { continue; } } while (false)'), 11
|
||||
eval('10; do { 11; if (false) { } else { continue; } } while (false)'),
|
||||
undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('12; do { if (false) { 13; } else { continue; } } while (false)'),
|
||||
|
@ -42,5 +42,5 @@ assert.sameValue(
|
|||
);
|
||||
assert.sameValue(
|
||||
eval('14; do { 15; if (false) { 16; } else { continue; } } while (false)'),
|
||||
15
|
||||
undefined
|
||||
);
|
||||
|
|
|
@ -1,42 +1,44 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 13.6.7
|
||||
es7id: pending
|
||||
description: >
|
||||
Completion value when expression is true with an `else` clause and body
|
||||
returns an abrupt completion
|
||||
info: >
|
||||
IfStatement : if ( Expression ) Statement else Statement
|
||||
|
||||
4. If exprValue is true, then
|
||||
3. If exprValue is true, then
|
||||
a. Let stmtCompletion be the result of evaluating the first Statement.
|
||||
5. Else,
|
||||
4. Else,
|
||||
[...]
|
||||
6. ReturnIfAbrupt(stmtCompletion).
|
||||
5. Return Completion(UpdateEmpty(stmtCompletion, undefined)).
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
eval('1; do { if (true) { break; } else { } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('2; do { 3; if (true) { break; } else { } } while (false)'), 3
|
||||
eval('2; do { 3; if (true) { break; } else { } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('4; do { if (true) { break; } else { 5; } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('6; do { 7; if (true) { break; } else { 8; } } while (false)'), 7
|
||||
eval('6; do { 7; if (true) { break; } else { 8; } } while (false)'),
|
||||
undefined
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
eval('1; do { if (true) { continue; } else { } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('2; do { 3; if (true) { continue; } else { } } while (false)'), 3
|
||||
eval('2; do { 3; if (true) { continue; } else { } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('4; do { if (true) { continue; } else { 5; } } while (false)'), undefined
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('6; do { 7; if (true) { continue; } else { 8; } } while (false)'), 7
|
||||
eval('6; do { 7; if (true) { continue; } else { 8; } } while (false)'),
|
||||
undefined
|
||||
);
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 13.6.7
|
||||
es7id: pending
|
||||
description: >
|
||||
Completion value when expression is true without an `else` clause and body
|
||||
returns an empty abrupt completion
|
||||
info: >
|
||||
IfStatement : if ( Expression ) Statement
|
||||
|
||||
[...]
|
||||
4. If exprValue is false, then
|
||||
3. If exprValue is false, then
|
||||
[...]
|
||||
5. Else,
|
||||
4. Else,
|
||||
a. Let stmtCompletion be the result of evaluating Statement.
|
||||
b. ReturnIfAbrupt(stmtCompletion).
|
||||
b. Return Completion(UpdateEmpty(stmtCompletion, undefined)).
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
eval('1; do { 2; if (true) { 3; break; } 4; } while (false)'), 3
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('5; do { 6; if (true) { break; } 7; } while (false)'), 6
|
||||
eval('5; do { 6; if (true) { break; } 7; } while (false)'), undefined
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
eval('8; do { 9; if (true) { 10; continue; } 11; } while (false)'), 10
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('12; do { 13; if (true) { continue; } 14; } while (false)'), 13
|
||||
eval('12; do { 13; if (true) { continue; } 14; } while (false)'), undefined
|
||||
);
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
es6id: 13.11.7
|
||||
es7id: pending
|
||||
description: >
|
||||
Statement completion value when body returns an empty abrupt completion
|
||||
info: >
|
||||
WithStatement : with ( Expression ) Statement
|
||||
|
||||
[...]
|
||||
8. Let C be the result of evaluating Statement.
|
||||
9. Set the running execution context’s Lexical Environment to oldEnv.
|
||||
10. If C.[[type]] is normal and C.[[value]] is empty, return
|
||||
NormalCompletion(undefined).
|
||||
7. Let C be the result of evaluating Statement.
|
||||
8. Set the running execution context's LexicalEnvironment to oldEnv.
|
||||
9. Return Completion(UpdateEmpty(C, undefined)).
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
|
@ -19,12 +18,12 @@ assert.sameValue(
|
|||
eval('1; do { 2; with({}) { 3; break; } 4; } while (false);'), 3
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('5; do { 6; with({}) { break; } 7; } while (false);'), 6
|
||||
eval('5; do { 6; with({}) { break; } 7; } while (false);'), undefined
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
eval('8; do { 9; with({}) { 10; continue; } 11; } while (false)'), 10
|
||||
);
|
||||
assert.sameValue(
|
||||
eval('12; do { 13; with({}) { continue; } 14; } while (false)'), 13
|
||||
eval('12; do { 13; with({}) { continue; } 14; } while (false)'), undefined
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue