Skip to content
Snippets Groups Projects
Commit 052bf237 authored by Gorkem Yakin's avatar Gorkem Yakin
Browse files

Merge pull request #475 from bocoup/completion-reform

Tests for ES2015/2016 Completion Reform
parents 23d0f459 e62d43c8
No related branches found
No related tags found
No related merge requests found
Showing
with 741 additions and 0 deletions
// 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.12.11
description: >
Completion value when execution continues through multiple cases and ends
with an empty abrupt completion in the default case
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
1. Let V = undefined.
2. Let A be the list of CaseClause items in the first CaseClauses, in
source text order. If the first CaseClauses is not present A is « ».
3. Let found be false.
4. Repeat for each CaseClause C in A
[...]
5. Let foundInB be false.
6. Let B be the List containing the CaseClause items in the second
CaseClauses, in source text order. If the second CaseClauses is not
present B is « ».
7. If found is false, then
[...]
8. If foundInB is true, return NormalCompletion(V).
9. Let R be the result of evaluating DefaultClause.
10. If R.[[value]] is not empty, let V = R.[[value]].
11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
---*/
assert.sameValue(
eval('1; switch ("a") { case "a": 2; default: 3; break; }'),
3,
'Non-empty value replaces previous non-empty value'
);
assert.sameValue(
eval('4; switch ("a") { case "a": default: 5; break; }'),
5,
'Non-empty value replaces empty value'
);
assert.sameValue(
eval('6; switch ("a") { case "a": 7; default: break; }'),
7,
'Empty value does not replace previous non-empty value'
);
assert.sameValue(
eval('8; do { switch ("a") { case "a": 9; default: 10; continue; } } while (false)'),
10,
'Non-empty value replaces previous non-empty value'
);
assert.sameValue(
eval('11; do { switch ("a") { case "a": default: 12; continue; } } while (false)'),
12,
'Non-empty value replaces empty value'
);
assert.sameValue(
eval('13; do { switch ("a") { case "a": 14; default: continue; } } while (false)'),
14,
'Empty value does not replace previous non-empty value'
);
// 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.12.11
description: >
Completion value when execution continues through multiple cases and ends
with a normal completion in the default case
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
1. Let V = undefined.
2. Let A be the list of CaseClause items in the first CaseClauses, in
source text order. If the first CaseClauses is not present A is « ».
3. Let found be false.
4. Repeat for each CaseClause C in A
[...]
5. Let foundInB be false.
6. Let B be the List containing the CaseClause items in the second
CaseClauses, in source text order. If the second CaseClauses is not
present B is « ».
7. If found is false, then
[...]
8. If foundInB is true, return NormalCompletion(V).
9. Let R be the result of evaluating DefaultClause.
10. If R.[[value]] is not empty, let V = R.[[value]].
11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
12. Repeat for each CaseClause C in B (NOTE this is another complete
iteration of the second CaseClauses)
[...]
13. Return NormalCompletion(V).
---*/
assert.sameValue(
eval('1; switch ("a") { case "a": 2; default: 3; }'),
3,
'Non-empty value replaces previous non-empty value'
);
assert.sameValue(
eval('4; switch ("a") { case "a": default: 5; }'),
5,
'Non-empty value replaces empty value'
);
assert.sameValue(
eval('6; switch ("a") { case "a": 7; default: }'),
7,
'Empty value does not replace previous non-empty value'
);
// 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.12.11
description: Completion value when the default case matches and is final
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClauses }
1. Let V = undefined.
2. Let A be the list of CaseClause items in the first CaseClauses, in
source text order. If the first CaseClauses is not present A is « ».
3. Let found be false.
4. Repeat for each CaseClause C in A
[...]
5. Let foundInB be false.
6. Let B be the List containing the CaseClause items in the second
CaseClauses, in source text order. If the second CaseClauses is not
present B is « ».
7. If found is false, then
a. Repeat for each CaseClause C in B
[...]
8. If foundInB is true, return NormalCompletion(V).
9. Let R be the result of evaluating DefaultClause.
10. If R.[[value]] is not empty, let V = R.[[value]].
[...]
13. Return NormalCompletion(V).
---*/
assert.sameValue(
eval('1; switch ("a") { default: }'),
undefined,
'empty StatementList (lone case)'
);
assert.sameValue(
eval('2; switch ("a") { default: 3; }'),
3,
'non-empy StatementList (lone case)'
);
assert.sameValue(
eval('4; switch ("b") { case "a": default: }'),
undefined,
'empty StatementList (following an empty case)'
);
assert.sameValue(
eval('5; switch ("b") { case "a": default: 6; }'),
6,
'non-empty StatementList (following an empty case)'
);
assert.sameValue(
eval('7; switch ("b") { case "a": 8; default: }'),
undefined,
'empty StatementList (following a non-empty case)'
);
assert.sameValue(
eval('9; switch ("b") { case "a": 10; default: 11; }'),
11,
'non-empty StatementList (following a non-empty case)'
);
// 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.12.11
description: >
Completion value when the matching case is exited via an empty abrupt
completion
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClauses }
1. Let V = undefined.
2. Let A be the List of CaseClause items in CaseClauses, in source text
order.
3. Let found be false.
4. Repeat for each CaseClause C in A,
a. If found is false, then
i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
ii. If clauseSelector is an abrupt completion, then
1. If clauseSelector.[[value]] is empty, return
Completion{[[type]]: clauseSelector.[[type]], [[value]]:
undefined, [[target]]: clauseSelector.[[target]]}.
2. Else, return Completion(clauseSelector).
iii. Let found be the result of performing Strict Equality Comparison
input === clauseSelector.[[value]].
b. If found is true, then
i. Let R be the result of evaluating C.
ii. If R.[[value]] is not empty, let V = R.[[value]].
iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
V)).
---*/
assert.sameValue(eval('1; switch ("a") { case "a": break; }'), undefined);
assert.sameValue(eval('2; switch ("a") { case "a": { 3; break; } }'), 3);
assert.sameValue(
eval('4; do { switch ("a") { case "a": continue; } } while (false)'),
undefined
);
assert.sameValue(
eval('5; do { switch ("a") { case "a": { 6; continue; } } } while (false)'),
6
);
// 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.12.11
description: >
Completion value when execution continues through multiple cases and ends
with an empty abrupt completion
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClauses }
1. Let V = undefined.
2. Let A be the List of CaseClause items in CaseClauses, in source text
order.
3. Let found be false.
4. Repeat for each CaseClause C in A,
a. If found is false, then
[...]
b. If found is true, then
i. Let R be the result of evaluating C.
ii. If R.[[value]] is not empty, let V = R.[[value]].
iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
V)).
---*/
assert.sameValue(
eval('1; switch ("a") { case "a": 2; case "b": 3; break; }'),
3,
'Non-empty value replaces previous non-empty value'
);
assert.sameValue(
eval('4; switch ("a") { case "a": case "b": 5; break; }'),
5,
'Non-empty value replaces empty value'
);
assert.sameValue(
eval('6; switch ("a") { case "a": 7; case "b": break; }'),
7,
'Empty value does not replace previous non-empty value'
);
assert.sameValue(
eval('8; do { switch ("a") { case "a": 9; case "b": 10; continue; } } while (false)'),
10,
'Non-empty value replaces previous non-empty value'
);
assert.sameValue(
eval('11; do { switch ("a") { case "a": case "b": 12; continue; } } while (false)'),
12,
'Non-empty value replaces empty value'
);
assert.sameValue(
eval('13; do { switch ("a") { case "a": 14; case "b": continue; } } while (false)'),
14,
'Empty value does not replace previous non-empty value'
);
// 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.12.11
description: >
Completion value when execution continues through multiple cases and ends
with a normal completion
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClauses }
1. Let V = undefined.
2. Let A be the List of CaseClause items in CaseClauses, in source text
order.
3. Let found be false.
4. Repeat for each CaseClause C in A,
a. If found is false, then
[...]
b. If found is true, then
i. Let R be the result of evaluating C.
ii. If R.[[value]] is not empty, let V = R.[[value]].
[...]
5. Return NormalCompletion(V).
---*/
assert.sameValue(
eval('1; switch ("a") { case "a": 2; case "b": 3; }'),
3,
'Non-empty value replaces previous non-empty value'
);
assert.sameValue(
eval('4; switch ("a") { case "a": case "b": 5; }'),
5,
'Non-empty value replaces empty value'
);
assert.sameValue(
eval('6; switch ("a") { case "a": 7; case "b": }'),
7,
'Empty value does not replace previous non-empty value'
);
// 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.12.11
description: Completion value when only the final case matches
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClauses }
1. Let V = undefined.
2. Let A be the List of CaseClause items in CaseClauses, in source text
order.
3. Let found be false.
4. Repeat for each CaseClause C in A,
a. If found is false, then
i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
ii. If clauseSelector is an abrupt completion, then
1. If clauseSelector.[[value]] is empty, return
Completion{[[type]]: clauseSelector.[[type]], [[value]]:
undefined, [[target]]: clauseSelector.[[target]]}.
2. Else, return Completion(clauseSelector).
iii. Let found be the result of performing Strict Equality Comparison
input === clauseSelector.[[value]].
b. If found is true, then
i. Let R be the result of evaluating C.
ii. If R.[[value]] is not empty, let V = R.[[value]].
iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
V)).
5. Return NormalCompletion(V).
---*/
assert.sameValue(
eval('1; switch ("a") { case "a": }'),
undefined,
'empty StatementList (lone case)'
);
assert.sameValue(
eval('2; switch ("a") { case "a": 3; }'),
3,
'non-empy StatementList (lone case)'
);
assert.sameValue(
eval('4; switch ("b") { case "a": case "b": }'),
undefined,
'empty StatementList (following an empty case)'
);
assert.sameValue(
eval('5; switch ("b") { case "a": case "b": 6; }'),
6,
'non-empty StatementList (following an empty case)'
);
assert.sameValue(
eval('7; switch ("b") { case "a": 8; case "b": }'),
undefined,
'empty StatementList (following a non-empty case)'
);
assert.sameValue(
eval('9; switch ("b") { case "a": 10; case "b": 11; }'),
11,
'non-empty StatementList (following a non-empty case)'
);
// 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.12.11
description: Completion value when no cases match
info: >
SwitchStatement : switch ( Expression ) CaseBlock
[...]
8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
argument switchValue.
9. Set the running execution context’s LexicalEnvironment to oldEnv.
10. Return R.
13.12.9 Runtime Semantics: CaseBlockEvaluation
CaseBlock : { CaseClauses }
1. Let V = undefined.
2. Let A be the List of CaseClause items in CaseClauses, in source text
order.
3. Let found be false.
4. Repeat for each CaseClause C in A,
a. If found is false, then
i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
ii. If clauseSelector is an abrupt completion, then
[...]
iii. Let found be the result of performing Strict Equality Comparison
input === clauseSelector.[[value]].
b. If found is true, then
[...]
5. Return NormalCompletion(V).
---*/
assert.sameValue(
eval('1; switch ("a") { case null: }'), undefined, 'empty StatementList'
);
assert.sameValue(
eval('2; switch ("a") { case null: 3; }'),
undefined,
'non-empty StatementList'
);
// 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.15.8
description: Completion value from `catch` clause of a try..catch statement
info: >
TryStatement : try Block Catch
1. Let B be the result of evaluating Block.
2. If B.[[type]] is throw, then
a. Let C be CatchClauseEvaluation of Catch with parameter B.[[value]].
3. Else B.[[type]] is not throw,
[...]
4. If C.[[type]] is return, or C.[[type]] is throw, return Completion(C).
5. If C.[[value]] is not empty, return Completion(C).
6. Return Completion{[[type]]: C.[[type]], [[value]]: undefined,
[[target]]: C.[[target]]}.
13.15.7 Runtime Semantics: CatchClauseEvaluation
Catch : catch ( CatchParameter ) Block
[...]
7. Let B be the result of evaluating Block.
8. Set the running execution context’s LexicalEnvironment to oldEnv.
9. Return Completion(B).
---*/
assert.sameValue(eval('1; try { throw null; } catch (err) { }'), undefined);
assert.sameValue(eval('2; try { throw null; } catch (err) { 3; }'), 3);
// 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.15.8
description: >
Completion value from `finally` clause of a try..catch..finally statement
(following execution of `catch` block)
info: >
TryStatement : try Block Catch Finally
1. Let B be the result of evaluating Block.
2. If B.[[type]] is throw, then
a. Let C be CatchClauseEvaluation of Catch with parameter B.[[value]].
[...]
4. Let F be the result of evaluating Finally.
5. If F.[[type]] is normal, let F be C.
6. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
7. If F.[[value]] is not empty, return NormalCompletion(F.[[value]]).
8. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
[[target]]: F.[[target]]}.
13.15.7 Runtime Semantics: CatchClauseEvaluation
Catch : catch ( CatchParameter ) Block
[...]
7. Let B be the result of evaluating Block.
8. Set the running execution context’s LexicalEnvironment to oldEnv.
9. Return Completion(B).
---*/
assert.sameValue(
eval('1; try { throw null; } catch (err) { } finally { }'), undefined
);
assert.sameValue(
eval('2; try { throw null; } catch (err) { 3; } finally { }'), 3
);
assert.sameValue(
eval('4; try { throw null; } catch (err) { } finally { 5; }'), undefined
);
assert.sameValue(
eval('6; try { throw null; } catch (err) { 7; } finally { 8; }'), 7
);
// 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.15.8
description: >
Completion value from `finally` clause of a try..catch..finally statement
(when `catch` block is not executed)
info: >
TryStatement : try Block Catch Finally
1. Let B be the result of evaluating Block.
2. If B.[[type]] is throw, then
[...]
3. Else B.[[type]] is not throw, let C be B.
4. Let F be the result of evaluating Finally.
5. If F.[[type]] is normal, let F be C.
6. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
7. If F.[[value]] is not empty, return NormalCompletion(F.[[value]]).
8. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
[[target]]: F.[[target]]}.
---*/
assert.sameValue(eval('1; try { } catch (err) { } finally { }'), undefined);
assert.sameValue(eval('2; try { } catch (err) { 3; } finally { }'), undefined);
assert.sameValue(eval('4; try { } catch (err) { } finally { 5; }'), undefined);
assert.sameValue(eval('6; try { } catch (err) { 7; } finally { 8; }'), undefined);
assert.sameValue(eval('9; try { 10; } catch (err) { } finally { }'), 10);
assert.sameValue(eval('11; try { 12; } catch (err) { 13; } finally { }'), 12);
assert.sameValue(eval('14; try { 15; } catch (err) { } finally { 16; }'), 15);
assert.sameValue(eval('17; try { 18; } catch (err) { 19; } finally { 20; }'), 18);
// 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.15.8
description: Completion value from `finally` clause of a try..finally statement
info: >
TryStatement : try Block Finally
1. Let B be the result of evaluating Block.
2. Let F be the result of evaluating Finally.
3. If F.[[type]] is normal, let F be B.
4. If F.[[type]] is return, or F.[[type]] is throw, return Completion(F).
5. If F.[[value]] is not empty, return Completion(F).
6. Return Completion{[[type]]: F.[[type]], [[value]]: undefined,
[[target]]: F.[[target]]}.
---*/
assert.sameValue(eval('1; try { } finally { }'), undefined);
assert.sameValue(eval('2; try { 3; } finally { }'), 3);
assert.sameValue(eval('4; try { } finally { 5; }'), undefined);
assert.sameValue(eval('6; try { 7; } finally { 8; }'), 7);
// 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.15.8
description: Completion value from `try` clause of a try..catch statement
info: >
TryStatement : try Block Catch
1. Let B be the result of evaluating Block.
2. If B.[[type]] is throw, then
[...]
3. Else B.[[type]] is not throw,
a. Let C be B.
4. If C.[[type]] is return, or C.[[type]] is throw, return Completion(C).
5. If C.[[value]] is not empty, return Completion(C).
6. Return Completion{[[type]]: C.[[type]], [[value]]: undefined,
[[target]]: C.[[target]]}.
---*/
assert.sameValue(eval('1; try { } catch (err) { }'), undefined);
assert.sameValue(eval('2; try { 3; } catch (err) { }'), 3);
assert.sameValue(eval('4; try { } catch (err) { 5; }'), undefined);
assert.sameValue(eval('6; try { 7; } catch (err) { 8; }'), 7);
// 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.3.6
description: >
Completion value when iteration completes due to an empty abrupt completion
info: >
IterationStatement : while ( Expression ) Statement
1. Let V = undefined.
2. Repeat
a. Let exprRef be the result of evaluating Expression.
b. Let exprValue be GetValue(exprRef).
c. ReturnIfAbrupt(exprValue).
d. If ToBoolean(exprValue) is false, return NormalCompletion(V).
e. Let stmt be the result of evaluating Statement.
f. If LoopContinues (stmt, labelSet) is false, return
Completion(UpdateEmpty(stmt, V)).
---*/
assert.sameValue(eval('1; while (true) { break; }'), undefined);
assert.sameValue(eval('2; while (true) { 3; break; }'), 3);
assert.sameValue(
eval('4; outer: do { while (true) { continue outer; } } while (false)'),
undefined
);
assert.sameValue(
eval('5; outer: do { while (true) { 6; continue outer; } } while (false)'), 6
);
// 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.3.6
description: >
Completion value when iteration completes due to expression value
info: >
IterationStatement : while ( Expression ) Statement
1. Let V = undefined.
2. Repeat
a. Let exprRef be the result of evaluating Expression.
b. Let exprValue be GetValue(exprRef).
c. ReturnIfAbrupt(exprValue).
d. If ToBoolean(exprValue) is false, return NormalCompletion(V).
e. Let stmt be the result of evaluating Statement.
f. If LoopContinues (stmt, labelSet) is false, return
Completion(UpdateEmpty(stmt, V)).
g. If stmt.[[value]] is not empty, let V = stmt.[[value]].
---*/
assert.sameValue(eval('var count1 = 2; 1; while (count1 -= 1) { }'), undefined);
assert.sameValue(eval('var count2 = 2; 2; while (count2 -= 1) { 3; }'), 3);
// 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.3.6
description: >
Completion value when no iteration occurs
info: >
IterationStatement : while ( Expression ) Statement
1. Let V = undefined.
2. Repeat
a. Let exprRef be the result of evaluating Expression.
b. Let exprValue be GetValue(exprRef).
c. ReturnIfAbrupt(exprValue).
d. If ToBoolean(exprValue) is false, return NormalCompletion(V).
---*/
assert.sameValue(eval('1; while (false) { }'), undefined);
assert.sameValue(eval('2; while (false) { 3; }'), undefined);
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es7id: pending
description: >
Statement completion value when body returns an empty abrupt completion
info: >
WithStatement : with ( Expression ) Statement
[...]
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]
---*/
assert.sameValue(
eval('1; do { 2; with({}) { 3; break; } 4; } while (false);'), 3
);
assert.sameValue(
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)'), undefined
);
// 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
description: Statement completion value when body returns a normal 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).
11. Return Completion(C).
flags: [noStrict]
---*/
assert.sameValue(eval('1; with({}) { }'), undefined);
assert.sameValue(eval('2; with({}) { 3; }'), 3);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment