From e1f4ced053f79db40eeb9cbb3815a72a7610f228 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Thu, 15 Feb 2018 15:25:56 -0500 Subject: [PATCH] built-ins/Generator*: make all indentation consistent (depth & character) (#1441) --- .../GeneratorFunction/extensibility.js | 2 +- .../GeneratorFunction/has-instance.js | 4 +- .../instance-construct-throws.js | 4 +- .../GeneratorFunction/instance-length.js | 2 +- .../GeneratorFunction/instance-name.js | 2 +- .../GeneratorFunction/instance-prototype.js | 2 +- .../instance-yield-expr-in-param.js | 2 +- .../invoked-as-constructor-no-arguments.js | 2 +- .../invoked-as-function-multiple-arguments.js | 2 +- .../invoked-as-function-no-arguments.js | 2 +- .../invoked-as-function-single-argument.js | 2 +- test/built-ins/GeneratorFunction/length.js | 2 +- test/built-ins/GeneratorFunction/name.js | 2 +- .../proto-from-ctor-realm.js | 4 +- .../prototype/constructor.js | 2 +- .../prototype/extensibility.js | 2 +- .../GeneratorFunction/prototype/prop-desc.js | 2 +- .../next/consecutive-yields.js | 5 +- .../next/context-method-invocation.js | 9 +++- .../next/from-state-executing.js | 2 + .../GeneratorPrototype/next/lone-return.js | 4 +- .../GeneratorPrototype/next/lone-yield.js | 4 +- .../next/this-val-not-generator.js | 32 +++++++++---- .../next/this-val-not-object.js | 48 ++++++++++++++----- .../return/this-val-not-generator.js | 32 +++++++++---- .../return/this-val-not-object.js | 48 ++++++++++++++----- .../return/try-finally-before-try.js | 5 +- .../return/try-finally-following-finally.js | 4 +- ...finally-nested-try-catch-within-finally.js | 4 +- ...try-catch-within-outer-try-after-nested.js | 3 +- .../return/try-finally-within-finally.js | 4 +- .../throw/from-state-completed.js | 5 +- .../throw/from-state-suspended-start.js | 5 +- .../throw/this-val-not-generator.js | 32 +++++++++---- .../throw/this-val-not-object.js | 48 ++++++++++++++----- .../throw/try-catch-before-try.js | 5 +- .../throw/try-catch-following-catch.js | 5 +- .../throw/try-catch-within-catch.js | 5 +- .../throw/try-finally-before-try.js | 7 ++- .../throw/try-finally-following-finally.js | 5 +- ...y-finally-nested-try-catch-within-catch.js | 5 +- ...finally-nested-try-catch-within-finally.js | 5 +- ...try-catch-within-outer-try-after-nested.js | 5 +- ...ry-catch-within-outer-try-before-nested.js | 5 +- .../throw/try-finally-within-finally.js | 5 +- .../throw/try-finally-within-try.js | 5 +- 46 files changed, 282 insertions(+), 109 deletions(-) diff --git a/test/built-ins/GeneratorFunction/extensibility.js b/test/built-ins/GeneratorFunction/extensibility.js index 265cffc02c..4328a904e3 100644 --- a/test/built-ins/GeneratorFunction/extensibility.js +++ b/test/built-ins/GeneratorFunction/extensibility.js @@ -10,6 +10,6 @@ info: | features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; assert(Object.isExtensible(GeneratorFunction)); diff --git a/test/built-ins/GeneratorFunction/has-instance.js b/test/built-ins/GeneratorFunction/has-instance.js index 80d176b784..3b5ad67f80 100644 --- a/test/built-ins/GeneratorFunction/has-instance.js +++ b/test/built-ins/GeneratorFunction/has-instance.js @@ -8,10 +8,10 @@ description: > features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; function* gDecl() {} -var gExpr = function* () {}; +var gExpr = function*() {}; assert( gDecl instanceof GeneratorFunction, diff --git a/test/built-ins/GeneratorFunction/instance-construct-throws.js b/test/built-ins/GeneratorFunction/instance-construct-throws.js index 8225a4776a..1cec55dd73 100644 --- a/test/built-ins/GeneratorFunction/instance-construct-throws.js +++ b/test/built-ins/GeneratorFunction/instance-construct-throws.js @@ -21,10 +21,10 @@ info: | features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; var instance = GeneratorFunction(); assert.throws(TypeError, function() { - new instance(); + new instance(); }) diff --git a/test/built-ins/GeneratorFunction/instance-length.js b/test/built-ins/GeneratorFunction/instance-length.js index fb1389f736..0951a1a2a3 100644 --- a/test/built-ins/GeneratorFunction/instance-length.js +++ b/test/built-ins/GeneratorFunction/instance-length.js @@ -25,7 +25,7 @@ includes: [propertyHelper.js] features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; assert.sameValue(GeneratorFunction().length, 0); assert.sameValue(GeneratorFunction('').length, 0); diff --git a/test/built-ins/GeneratorFunction/instance-name.js b/test/built-ins/GeneratorFunction/instance-name.js index 5dab8a3124..88fcd961a3 100644 --- a/test/built-ins/GeneratorFunction/instance-name.js +++ b/test/built-ins/GeneratorFunction/instance-name.js @@ -17,7 +17,7 @@ includes: [propertyHelper.js] features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; assert.sameValue(GeneratorFunction().name, 'anonymous'); verifyNotEnumerable(GeneratorFunction(), 'name'); diff --git a/test/built-ins/GeneratorFunction/instance-prototype.js b/test/built-ins/GeneratorFunction/instance-prototype.js index 3f6db037d2..e542b89640 100644 --- a/test/built-ins/GeneratorFunction/instance-prototype.js +++ b/test/built-ins/GeneratorFunction/instance-prototype.js @@ -21,7 +21,7 @@ includes: [propertyHelper.js] features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; var instance = GeneratorFunction(); diff --git a/test/built-ins/GeneratorFunction/instance-yield-expr-in-param.js b/test/built-ins/GeneratorFunction/instance-yield-expr-in-param.js index a04982da88..419360a88f 100644 --- a/test/built-ins/GeneratorFunction/instance-yield-expr-in-param.js +++ b/test/built-ins/GeneratorFunction/instance-yield-expr-in-param.js @@ -17,7 +17,7 @@ info: | features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; // YieldExpression is permitted in function body. GeneratorFunction('x = yield'); diff --git a/test/built-ins/GeneratorFunction/invoked-as-constructor-no-arguments.js b/test/built-ins/GeneratorFunction/invoked-as-constructor-no-arguments.js index cb5bf8e8a9..564810fa12 100644 --- a/test/built-ins/GeneratorFunction/invoked-as-constructor-no-arguments.js +++ b/test/built-ins/GeneratorFunction/invoked-as-constructor-no-arguments.js @@ -8,7 +8,7 @@ description: > features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; var g = new GeneratorFunction(); var iter = g(); diff --git a/test/built-ins/GeneratorFunction/invoked-as-function-multiple-arguments.js b/test/built-ins/GeneratorFunction/invoked-as-function-multiple-arguments.js index a32adad02a..7b7ac8429c 100644 --- a/test/built-ins/GeneratorFunction/invoked-as-function-multiple-arguments.js +++ b/test/built-ins/GeneratorFunction/invoked-as-function-multiple-arguments.js @@ -10,7 +10,7 @@ description: > features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; var g = GeneratorFunction('x', 'y', 'yield x + y;'); var iter = g(2, 3); diff --git a/test/built-ins/GeneratorFunction/invoked-as-function-no-arguments.js b/test/built-ins/GeneratorFunction/invoked-as-function-no-arguments.js index 928f733744..204d5a30b5 100644 --- a/test/built-ins/GeneratorFunction/invoked-as-function-no-arguments.js +++ b/test/built-ins/GeneratorFunction/invoked-as-function-no-arguments.js @@ -8,7 +8,7 @@ description: > features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; var g = GeneratorFunction(); var iter = g(); diff --git a/test/built-ins/GeneratorFunction/invoked-as-function-single-argument.js b/test/built-ins/GeneratorFunction/invoked-as-function-single-argument.js index e49ddcbc4e..279bfd129f 100644 --- a/test/built-ins/GeneratorFunction/invoked-as-function-single-argument.js +++ b/test/built-ins/GeneratorFunction/invoked-as-function-single-argument.js @@ -9,7 +9,7 @@ description: > features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; var g = GeneratorFunction('yield 1;'); var iter = g(); diff --git a/test/built-ins/GeneratorFunction/length.js b/test/built-ins/GeneratorFunction/length.js index f118d1de61..b989303dec 100644 --- a/test/built-ins/GeneratorFunction/length.js +++ b/test/built-ins/GeneratorFunction/length.js @@ -10,7 +10,7 @@ includes: [propertyHelper.js] features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; assert.sameValue(GeneratorFunction.length, 1); diff --git a/test/built-ins/GeneratorFunction/name.js b/test/built-ins/GeneratorFunction/name.js index 99f02561ca..2d517748b1 100644 --- a/test/built-ins/GeneratorFunction/name.js +++ b/test/built-ins/GeneratorFunction/name.js @@ -20,7 +20,7 @@ includes: [propertyHelper.js] features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; assert.sameValue(GeneratorFunction.name, 'GeneratorFunction'); diff --git a/test/built-ins/GeneratorFunction/proto-from-ctor-realm.js b/test/built-ins/GeneratorFunction/proto-from-ctor-realm.js index b8215acf4e..313fd4baab 100644 --- a/test/built-ins/GeneratorFunction/proto-from-ctor-realm.js +++ b/test/built-ins/GeneratorFunction/proto-from-ctor-realm.js @@ -29,10 +29,10 @@ info: | features: [generators, cross-realm, Reflect] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; var other = $262.createRealm().global; var OtherGeneratorFunction = Object.getPrototypeOf( - other.eval('(0, function* () {})') + other.eval('(0, function* () {})') ).constructor; var C = new other.Function(); C.prototype = null; diff --git a/test/built-ins/GeneratorFunction/prototype/constructor.js b/test/built-ins/GeneratorFunction/prototype/constructor.js index 26c4370b14..87cb431844 100644 --- a/test/built-ins/GeneratorFunction/prototype/constructor.js +++ b/test/built-ins/GeneratorFunction/prototype/constructor.js @@ -15,7 +15,7 @@ includes: [propertyHelper.js] features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; assert.sameValue(GeneratorFunction.prototype.constructor, GeneratorFunction); diff --git a/test/built-ins/GeneratorFunction/prototype/extensibility.js b/test/built-ins/GeneratorFunction/prototype/extensibility.js index 4a71347693..ca9f590996 100644 --- a/test/built-ins/GeneratorFunction/prototype/extensibility.js +++ b/test/built-ins/GeneratorFunction/prototype/extensibility.js @@ -10,6 +10,6 @@ info: | features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; assert(Object.isExtensible(GeneratorFunction.prototype)); diff --git a/test/built-ins/GeneratorFunction/prototype/prop-desc.js b/test/built-ins/GeneratorFunction/prototype/prop-desc.js index 1ba38ae8aa..e28a1d04bb 100644 --- a/test/built-ins/GeneratorFunction/prototype/prop-desc.js +++ b/test/built-ins/GeneratorFunction/prototype/prop-desc.js @@ -10,7 +10,7 @@ includes: [propertyHelper.js] features: [generators] ---*/ -var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor; +var GeneratorFunction = Object.getPrototypeOf(function*() {}).constructor; verifyNotEnumerable(GeneratorFunction, 'prototype'); verifyNotWritable(GeneratorFunction, 'prototype'); diff --git a/test/built-ins/GeneratorPrototype/next/consecutive-yields.js b/test/built-ins/GeneratorPrototype/next/consecutive-yields.js index 3f6332163c..3986c63d0f 100644 --- a/test/built-ins/GeneratorPrototype/next/consecutive-yields.js +++ b/test/built-ins/GeneratorPrototype/next/consecutive-yields.js @@ -8,7 +8,10 @@ description: > features: [generators] ---*/ -function* g() { yield 1; yield 2; } +function* g() { + yield 1; + yield 2; +} var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/next/context-method-invocation.js b/test/built-ins/GeneratorPrototype/next/context-method-invocation.js index 5e6f3ed5a5..aff5667ad8 100644 --- a/test/built-ins/GeneratorPrototype/next/context-method-invocation.js +++ b/test/built-ins/GeneratorPrototype/next/context-method-invocation.js @@ -9,8 +9,13 @@ features: [generators] ---*/ var context; -function* g() { context = this; } -var obj = { g: g }; + +function* g() { + context = this; +} +var obj = { + g: g +}; var iter = obj.g(); iter.next(); diff --git a/test/built-ins/GeneratorPrototype/next/from-state-executing.js b/test/built-ins/GeneratorPrototype/next/from-state-executing.js index 29461cc117..2a05f8c2f7 100644 --- a/test/built-ins/GeneratorPrototype/next/from-state-executing.js +++ b/test/built-ins/GeneratorPrototype/next/from-state-executing.js @@ -37,9 +37,11 @@ features: [generators] ---*/ var iter, result; + function* withoutVal() { iter.next(); } + function* withVal() { iter.next(42); } diff --git a/test/built-ins/GeneratorPrototype/next/lone-return.js b/test/built-ins/GeneratorPrototype/next/lone-return.js index cae93289b4..0a444cbc14 100644 --- a/test/built-ins/GeneratorPrototype/next/lone-return.js +++ b/test/built-ins/GeneratorPrototype/next/lone-return.js @@ -8,7 +8,9 @@ description: > features: [generators] ---*/ -function* g() { return 23; } +function* g() { + return 23; +} var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/next/lone-yield.js b/test/built-ins/GeneratorPrototype/next/lone-yield.js index 76199c6721..c909af1480 100644 --- a/test/built-ins/GeneratorPrototype/next/lone-yield.js +++ b/test/built-ins/GeneratorPrototype/next/lone-yield.js @@ -8,7 +8,9 @@ description: > features: [generators] ---*/ -function* g() { yield 1; } +function* g() { + yield 1; +} var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js b/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js index dee7dfc4ef..25727d062d 100644 --- a/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js +++ b/test/built-ins/GeneratorPrototype/next/this-val-not-generator.js @@ -27,44 +27,60 @@ var GeneratorPrototype = Object.getPrototypeOf(g).prototype; assert.throws( TypeError, - function() { GeneratorPrototype.next.call({}); }, + function() { + GeneratorPrototype.next.call({}); + }, 'ordinary object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call({}, 1); }, + function() { + GeneratorPrototype.next.call({}, 1); + }, 'ordinary object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(function() {}); }, + function() { + GeneratorPrototype.next.call(function() {}); + }, 'function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(function() {}, 1); }, + function() { + GeneratorPrototype.next.call(function() {}, 1); + }, 'function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g); }, + function() { + GeneratorPrototype.next.call(g); + }, 'generator function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g, 1); }, + function() { + GeneratorPrototype.next.call(g, 1); + }, 'generator function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g.prototype); }, + function() { + GeneratorPrototype.next.call(g.prototype); + }, 'generator function prototype object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(g.prototype, 1); }, + function() { + GeneratorPrototype.next.call(g.prototype, 1); + }, 'generator function prototype object (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/next/this-val-not-object.js b/test/built-ins/GeneratorPrototype/next/this-val-not-object.js index 646590b6fe..c42b5777f0 100644 --- a/test/built-ins/GeneratorPrototype/next/this-val-not-object.js +++ b/test/built-ins/GeneratorPrototype/next/this-val-not-object.js @@ -26,66 +26,90 @@ var symbol = Symbol(); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(undefined); }, + function() { + GeneratorPrototype.next.call(undefined); + }, 'undefined (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(undefined, 1); }, + function() { + GeneratorPrototype.next.call(undefined, 1); + }, 'undefined (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(null); }, + function() { + GeneratorPrototype.next.call(null); + }, 'null (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(null, 1); }, + function() { + GeneratorPrototype.next.call(null, 1); + }, 'null (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(true); }, + function() { + GeneratorPrototype.next.call(true); + }, 'boolean (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(true, 1); }, + function() { + GeneratorPrototype.next.call(true, 1); + }, 'boolean (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call('s'); }, + function() { + GeneratorPrototype.next.call('s'); + }, 'string (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call('s', 1); }, + function() { + GeneratorPrototype.next.call('s', 1); + }, 'string (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(1); }, + function() { + GeneratorPrototype.next.call(1); + }, 'number (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(1, 1); }, + function() { + GeneratorPrototype.next.call(1, 1); + }, 'number (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(symbol); }, + function() { + GeneratorPrototype.next.call(symbol); + }, 'symbol (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.next.call(symbol, 1); }, + function() { + GeneratorPrototype.next.call(symbol, 1); + }, 'symbol (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js b/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js index 1af04d2996..dd0ff4b332 100644 --- a/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js +++ b/test/built-ins/GeneratorPrototype/return/this-val-not-generator.js @@ -27,44 +27,60 @@ var GeneratorPrototype = Object.getPrototypeOf(g).prototype; assert.throws( TypeError, - function() { GeneratorPrototype.return.call({}); }, + function() { + GeneratorPrototype.return.call({}); + }, 'ordinary object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call({}, 1); }, + function() { + GeneratorPrototype.return.call({}, 1); + }, 'ordinary object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(function() {}); }, + function() { + GeneratorPrototype.return.call(function() {}); + }, 'function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(function() {}, 1); }, + function() { + GeneratorPrototype.return.call(function() {}, 1); + }, 'function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g); }, + function() { + GeneratorPrototype.return.call(g); + }, 'generator function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g, 1); }, + function() { + GeneratorPrototype.return.call(g, 1); + }, 'generator function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g.prototype); }, + function() { + GeneratorPrototype.return.call(g.prototype); + }, 'generator function prototype object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(g.prototype, 1); }, + function() { + GeneratorPrototype.return.call(g.prototype, 1); + }, 'generator function prototype object (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/return/this-val-not-object.js b/test/built-ins/GeneratorPrototype/return/this-val-not-object.js index edf0b124ed..c8431b407c 100644 --- a/test/built-ins/GeneratorPrototype/return/this-val-not-object.js +++ b/test/built-ins/GeneratorPrototype/return/this-val-not-object.js @@ -26,66 +26,90 @@ var symbol = Symbol(); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(undefined); }, + function() { + GeneratorPrototype.return.call(undefined); + }, 'undefined (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(undefined, 1); }, + function() { + GeneratorPrototype.return.call(undefined, 1); + }, 'undefined (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(null); }, + function() { + GeneratorPrototype.return.call(null); + }, 'null (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(null, 1); }, + function() { + GeneratorPrototype.return.call(null, 1); + }, 'null (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(true); }, + function() { + GeneratorPrototype.return.call(true); + }, 'boolean (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(true, 1); }, + function() { + GeneratorPrototype.return.call(true, 1); + }, 'boolean (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call('s'); }, + function() { + GeneratorPrototype.return.call('s'); + }, 'string (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call('s', 1); }, + function() { + GeneratorPrototype.return.call('s', 1); + }, 'string (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(1); }, + function() { + GeneratorPrototype.return.call(1); + }, 'number (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(1, 1); }, + function() { + GeneratorPrototype.return.call(1, 1); + }, 'number (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(symbol); }, + function() { + GeneratorPrototype.return.call(symbol); + }, 'symbol (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.return.call(symbol, 1); }, + function() { + GeneratorPrototype.return.call(symbol, 1); + }, 'symbol (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js b/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js index 1f1522fbb8..24be6db3c5 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-before-try.js @@ -10,12 +10,11 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield; unreachable += 1; - try { - } finally { - } + try {} finally {} } var iter = g(); var result; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js b/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js index 9066852be2..665e968b46 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-following-finally.js @@ -11,9 +11,9 @@ features: [generators] var afterFinally = 0; var unreachable = 0; + function* g() { - try { - } finally {} + try {} finally {} afterFinally += 1; yield; unreachable += 1; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js index 42ff56701b..6bfef0e304 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-finally.js @@ -11,11 +11,11 @@ features: [generators] var inFinally = 0; var unreachable = 0; + function* g() { try { throw new Error(); - try { - } catch (e) {} + try {} catch (e) {} } finally { inFinally += 1; yield; diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js index 2342f69a60..5e056c140c 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-nested-try-catch-within-outer-try-after-nested.js @@ -13,6 +13,7 @@ features: [generators] var inCatch = 0; var inFinally = 0; var unreachable = 0; + function* g() { try { try { @@ -29,7 +30,7 @@ function* g() { var iter = g(); var result; - iter.next(); +iter.next(); assert.sameValue(inCatch, 1, '`catch` code path executed'); assert.sameValue(inFinally, 1, '`finally` code path executed'); diff --git a/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js b/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js index 4ea893dc34..fbec889d98 100644 --- a/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js +++ b/test/built-ins/GeneratorPrototype/return/try-finally-within-finally.js @@ -11,9 +11,9 @@ features: [generators] var inFinally = 0; var unreachable = 0; + function* g() { - try { - } finally { + try {} finally { inFinally += 1; yield; unreachable += 1; diff --git a/test/built-ins/GeneratorPrototype/throw/from-state-completed.js b/test/built-ins/GeneratorPrototype/throw/from-state-completed.js index 3d8e6cbf5d..209ab9fed5 100644 --- a/test/built-ins/GeneratorPrototype/throw/from-state-completed.js +++ b/test/built-ins/GeneratorPrototype/throw/from-state-completed.js @@ -9,13 +9,16 @@ features: [generators] ---*/ function E() {} + function* G() {} var iter; iter = G(); iter.next(); -assert.throws(E, function() { iter.throw(new E()); }); +assert.throws(E, function() { + iter.throw(new E()); +}); var result = iter.next(); diff --git a/test/built-ins/GeneratorPrototype/throw/from-state-suspended-start.js b/test/built-ins/GeneratorPrototype/throw/from-state-suspended-start.js index 53d44904e5..3bf6296c35 100644 --- a/test/built-ins/GeneratorPrototype/throw/from-state-suspended-start.js +++ b/test/built-ins/GeneratorPrototype/throw/from-state-suspended-start.js @@ -10,6 +10,7 @@ features: [generators] ---*/ function E() {} + function* G() { yield 1; yield 2; @@ -17,7 +18,9 @@ function* G() { var iter; iter = G(); -assert.throws(E, function() { iter.throw(new E()); }); +assert.throws(E, function() { + iter.throw(new E()); +}); var result = iter.next(); diff --git a/test/built-ins/GeneratorPrototype/throw/this-val-not-generator.js b/test/built-ins/GeneratorPrototype/throw/this-val-not-generator.js index 8667ad8979..fae6fe7b75 100644 --- a/test/built-ins/GeneratorPrototype/throw/this-val-not-generator.js +++ b/test/built-ins/GeneratorPrototype/throw/this-val-not-generator.js @@ -27,44 +27,60 @@ var GeneratorPrototype = Object.getPrototypeOf(g).prototype; assert.throws( TypeError, - function() { GeneratorPrototype.throw.call({}); }, + function() { + GeneratorPrototype.throw.call({}); + }, 'ordinary object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call({}, 1); }, + function() { + GeneratorPrototype.throw.call({}, 1); + }, 'ordinary object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(function() {}); }, + function() { + GeneratorPrototype.throw.call(function() {}); + }, 'function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(function() {}, 1); }, + function() { + GeneratorPrototype.throw.call(function() {}, 1); + }, 'function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(g); }, + function() { + GeneratorPrototype.throw.call(g); + }, 'generator function object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(g, 1); }, + function() { + GeneratorPrototype.throw.call(g, 1); + }, 'generator function object (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(g.prototype); }, + function() { + GeneratorPrototype.throw.call(g.prototype); + }, 'generator function prototype object (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(g.prototype, 1); }, + function() { + GeneratorPrototype.throw.call(g.prototype, 1); + }, 'generator function prototype object (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/throw/this-val-not-object.js b/test/built-ins/GeneratorPrototype/throw/this-val-not-object.js index 8b4d342be2..8122f2b382 100644 --- a/test/built-ins/GeneratorPrototype/throw/this-val-not-object.js +++ b/test/built-ins/GeneratorPrototype/throw/this-val-not-object.js @@ -26,66 +26,90 @@ var symbol = Symbol(); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(undefined); }, + function() { + GeneratorPrototype.throw.call(undefined); + }, 'undefined (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(undefined, 1); }, + function() { + GeneratorPrototype.throw.call(undefined, 1); + }, 'undefined (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(null); }, + function() { + GeneratorPrototype.throw.call(null); + }, 'null (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(null, 1); }, + function() { + GeneratorPrototype.throw.call(null, 1); + }, 'null (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(true); }, + function() { + GeneratorPrototype.throw.call(true); + }, 'boolean (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(true, 1); }, + function() { + GeneratorPrototype.throw.call(true, 1); + }, 'boolean (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call('s'); }, + function() { + GeneratorPrototype.throw.call('s'); + }, 'string (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call('s', 1); }, + function() { + GeneratorPrototype.throw.call('s', 1); + }, 'string (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(1); }, + function() { + GeneratorPrototype.throw.call(1); + }, 'number (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(1, 1); }, + function() { + GeneratorPrototype.throw.call(1, 1); + }, 'number (with value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(symbol); }, + function() { + GeneratorPrototype.throw.call(symbol); + }, 'symbol (without value)' ); assert.throws( TypeError, - function() { GeneratorPrototype.throw.call(symbol, 1); }, + function() { + GeneratorPrototype.throw.call(symbol, 1); + }, 'symbol (with value)' ); diff --git a/test/built-ins/GeneratorPrototype/throw/try-catch-before-try.js b/test/built-ins/GeneratorPrototype/throw/try-catch-before-try.js index bfd3086c7a..bc2707e5c8 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-catch-before-try.js +++ b/test/built-ins/GeneratorPrototype/throw/try-catch-before-try.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield 1; unreachable += 1; @@ -31,7 +32,9 @@ assert.sameValue( unreachable, 0, 'statement following `yield` not executed (paused at yield)' ); -assert.throws(Test262Error, function() { iter.throw(new Test262Error()); }); +assert.throws(Test262Error, function() { + iter.throw(new Test262Error()); +}); assert.sameValue( unreachable, diff --git a/test/built-ins/GeneratorPrototype/throw/try-catch-following-catch.js b/test/built-ins/GeneratorPrototype/throw/try-catch-following-catch.js index 1e69125421..1866ad20dc 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-catch-following-catch.js +++ b/test/built-ins/GeneratorPrototype/throw/try-catch-following-catch.js @@ -11,6 +11,7 @@ features: [generators] var obj = {}; var unreachable = 0; + function* g() { yield 1; try { @@ -41,7 +42,9 @@ result = iter.next(); assert.sameValue(result.value, 3, 'Fourth result `value`'); assert.sameValue(result.done, false, 'Fourth result `done` flag'); -assert.throws(Test262Error, function() { iter.throw(new Test262Error()); }); +assert.throws(Test262Error, function() { + iter.throw(new Test262Error()); +}); assert.sameValue( unreachable, diff --git a/test/built-ins/GeneratorPrototype/throw/try-catch-within-catch.js b/test/built-ins/GeneratorPrototype/throw/try-catch-within-catch.js index 176b4cc412..9370044287 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-catch-within-catch.js +++ b/test/built-ins/GeneratorPrototype/throw/try-catch-within-catch.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield 1; try { @@ -38,7 +39,9 @@ result = iter.next(); assert.sameValue(result.value, exception, 'Third result `value`'); assert.sameValue(result.done, false, 'Third result `done` flag'); -assert.throws(Test262Error, function() { iter.throw(new Test262Error()); }); +assert.throws(Test262Error, function() { + iter.throw(new Test262Error()); +}); assert.sameValue( unreachable, diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-before-try.js b/test/built-ins/GeneratorPrototype/throw/try-finally-before-try.js index 4ecd883b9b..daad602d03 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-before-try.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-before-try.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield 1; unreachable += 1; @@ -33,7 +34,9 @@ assert.sameValue( unreachable, 0, 'statement following `yield` not executed (paused at yield)' ); -assert.throws(Test262Error, function() { iter.throw(new Test262Error()); }); +assert.throws(Test262Error, function() { + iter.throw(new Test262Error()); +}); assert.sameValue( unreachable, @@ -45,7 +48,7 @@ result = iter.next(); assert.sameValue( result.value, undefined, 'Result `value` is undefined when done' ); -assert.sameValue( result.done, true, 'Result `done` flag is `true` when done'); +assert.sameValue(result.done, true, 'Result `done` flag is `true` when done'); assert.sameValue( unreachable, 0, 'statement following `yield` not executed (once "completed")' ); diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-following-finally.js b/test/built-ins/GeneratorPrototype/throw/try-finally-following-finally.js index fdc9fa55d2..aac9dd1309 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-following-finally.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-following-finally.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield 1; try { @@ -39,7 +40,9 @@ result = iter.next(); assert.sameValue(result.value, 4, 'Third result `value`'); assert.sameValue(result.done, false, 'Third result `done` flag'); -assert.throws(Test262Error, function() { iter.throw(new Test262Error()); }); +assert.throws(Test262Error, function() { + iter.throw(new Test262Error()); +}); assert.sameValue( unreachable, diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-catch.js b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-catch.js index c69d12f424..16c78fe313 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-catch.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-catch.js @@ -11,6 +11,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { try { yield 1; @@ -47,7 +48,9 @@ result = iter.throw(new Test262Error()); assert.sameValue(result.value, 4, 'Fourth result `value`'); assert.sameValue(result.done, false, 'Fourth result `done` flag'); -assert.throws(Test262Error, function() { iter.next(); }); +assert.throws(Test262Error, function() { + iter.next(); +}); assert.sameValue( unreachable, diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-finally.js b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-finally.js index 8c5392ea7a..eb691f39ce 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-finally.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-finally.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { try { yield 1; @@ -38,7 +39,9 @@ result = iter.next(); assert.sameValue(result.value, 4, 'Second result `value`'); assert.sameValue(result.done, false, 'First result `done` flag'); -assert.throws(Test262Error, function() { iter.throw(new Test262Error()); }); +assert.throws(Test262Error, function() { + iter.throw(new Test262Error()); +}); assert.sameValue( unreachable, diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-after-nested.js b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-after-nested.js index 93c9cbad5e..cb1c4318b4 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-after-nested.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-after-nested.js @@ -11,6 +11,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { try { yield 1; @@ -57,7 +58,9 @@ assert.sameValue( 'statement following `yield` not executed (following `throw`)' ); -assert.throws(Test262Error, function() { iter.next(); }); +assert.throws(Test262Error, function() { + iter.next(); +}); result = iter.next(); assert.sameValue( diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-before-nested.js b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-before-nested.js index 942234e3cc..5ce3a05164 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-before-nested.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-nested-try-catch-within-outer-try-before-nested.js @@ -11,6 +11,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { try { yield 1; @@ -43,7 +44,9 @@ assert.sameValue( 'statement following `yield` not executed (following `throw`)' ); -assert.throws(Test262Error, function() { iter.next(); }); +assert.throws(Test262Error, function() { + iter.next(); +}); result = iter.next(); assert.sameValue( diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-within-finally.js b/test/built-ins/GeneratorPrototype/throw/try-finally-within-finally.js index 8a83967c56..6289871167 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-within-finally.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-within-finally.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield 1; try { @@ -35,7 +36,9 @@ result = iter.next(); assert.sameValue(result.value, 3, 'Third result `value`'); assert.sameValue(result.done, false, 'Third result `done` flag'); -assert.throws(Test262Error, function() { iter.throw(new Test262Error()); }); +assert.throws(Test262Error, function() { + iter.throw(new Test262Error()); +}); assert.sameValue( unreachable, diff --git a/test/built-ins/GeneratorPrototype/throw/try-finally-within-try.js b/test/built-ins/GeneratorPrototype/throw/try-finally-within-try.js index 19764d8b7b..91105b8b70 100644 --- a/test/built-ins/GeneratorPrototype/throw/try-finally-within-try.js +++ b/test/built-ins/GeneratorPrototype/throw/try-finally-within-try.js @@ -10,6 +10,7 @@ features: [generators] ---*/ var unreachable = 0; + function* g() { yield 1; try { @@ -41,7 +42,9 @@ assert.sameValue( 'statement following `yield` not executed (following `throw`)' ); -assert.throws(Test262Error, function() { iter.next(); }); +assert.throws(Test262Error, function() { + iter.next(); +}); result = iter.next(); assert.sameValue(