Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --strong-mode --harmony-arrow-functions --harmony-reflect | 5 // Flags: --strong-mode --harmony-arrow-functions --harmony-reflect |
| 6 // Flags: --harmony-spreadcalls --harmony-rest-parameters --allow-natives-syntax | 6 // Flags: --harmony-spreadcalls --harmony-rest-parameters --allow-natives-syntax |
| 7 | 7 |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 | 10 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 })(); | 169 })(); |
| 170 | 170 |
| 171 | 171 |
| 172 (function Constructor() { | 172 (function Constructor() { |
| 173 for (let genParams of [generateParams, generateParamsWithRest]) { | 173 for (let genParams of [generateParams, generateParamsWithRest]) { |
| 174 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { | 174 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { |
| 175 for (let parameterCount = 0; parameterCount < 3; parameterCount++) { | 175 for (let parameterCount = 0; parameterCount < 3; parameterCount++) { |
| 176 let defs = [ | 176 let defs = [ |
| 177 `'use strong'; | 177 `'use strong'; |
| 178 class C { constructor(${genParams(parameterCount)}) {} }`, | 178 class C { constructor(${genParams(parameterCount)}) {} }`, |
| 179 `'use strict'; | |
| 180 class C { | |
| 181 constructor(${genParams(parameterCount, true)}) { 'use strong'; } | |
| 182 }`, | |
| 183 ]; | 179 ]; |
| 184 for (let def of defs) { | 180 for (let def of defs) { |
| 185 let calls = [ | 181 let calls = [ |
| 186 `new C(${generateArguments(argumentCount)})`, | 182 `new C(${generateArguments(argumentCount)})`, |
| 187 `new C(${generateSpread(argumentCount)})`, | 183 `new C(${generateSpread(argumentCount)})`, |
| 188 `Reflect.construct(C, [${generateArguments(argumentCount)}])`, | 184 `Reflect.construct(C, [${generateArguments(argumentCount)}])`, |
| 189 ]; | 185 ]; |
| 190 for (let call of calls) { | 186 for (let call of calls) { |
| 191 let code = `${def}; ${call};`; | 187 let code = `${def}; ${call};`; |
| 192 if (argumentCount < parameterCount) { | 188 if (argumentCount < parameterCount) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 210 let defs = [ | 206 let defs = [ |
| 211 `'use strong'; | 207 `'use strong'; |
| 212 class B { | 208 class B { |
| 213 constructor(${genParams(parameterCount)}) {} | 209 constructor(${genParams(parameterCount)}) {} |
| 214 } | 210 } |
| 215 class C extends B { | 211 class C extends B { |
| 216 constructor() { | 212 constructor() { |
| 217 super(${genArgs(argumentCount)}); | 213 super(${genArgs(argumentCount)}); |
| 218 } | 214 } |
| 219 }`, | 215 }`, |
| 220 `'use strict'; | |
|
rossberg
2015/09/01 16:52:40
I don't think you want to delete this test altoget
conradw
2015/09/01 16:55:54
My impression was that it would need to be deleted
| |
| 221 class B { | |
| 222 constructor(${genParams(parameterCount, true)}) { 'use strong'; } | |
| 223 } | |
| 224 class C extends B { | |
| 225 constructor() { | |
| 226 super(${genArgs(argumentCount)}); | |
| 227 } | |
| 228 }`, | |
| 229 ]; | 216 ]; |
| 230 for (let def of defs) { | 217 for (let def of defs) { |
| 231 let code = `${def}; new C();`; | 218 let code = `${def}; new C();`; |
| 232 if (argumentCount < parameterCount) { | 219 if (argumentCount < parameterCount) { |
| 233 assertThrows(code, TypeError); | 220 assertThrows(code, TypeError); |
| 234 } else { | 221 } else { |
| 235 assertDoesNotThrow(code); | 222 assertDoesNotThrow(code); |
| 236 } | 223 } |
| 237 } | 224 } |
| 238 } | 225 } |
| 239 } | 226 } |
| 240 } | 227 } |
| 241 } | 228 } |
| 242 })(); | 229 })(); |
| 243 | 230 |
| 244 | 231 |
| 245 (function DerivedConstructorDefaultConstructorInDerivedClass() { | 232 (function DerivedConstructorDefaultConstructorInDerivedClass() { |
| 246 for (let genParams of [generateParams, generateParamsWithRest]) { | 233 for (let genParams of [generateParams, generateParamsWithRest]) { |
| 247 for (let genArgs of [generateArguments, generateSpread]) { | 234 for (let genArgs of [generateArguments, generateSpread]) { |
| 248 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { | 235 for (let argumentCount = 0; argumentCount < 3; argumentCount++) { |
| 249 for (let parameterCount = 0; parameterCount < 3; parameterCount++) { | 236 for (let parameterCount = 0; parameterCount < 3; parameterCount++) { |
| 250 let defs = [ | 237 let defs = [ |
| 251 `'use strong'; | 238 `'use strong'; |
| 252 class B { | 239 class B { |
| 253 constructor(${genParams(parameterCount)}) {} | 240 constructor(${genParams(parameterCount)}) {} |
| 254 } | 241 } |
| 255 class C extends B {}`, | 242 class C extends B {}`, |
| 256 `'use strict'; | |
|
rossberg
2015/09/01 16:52:40
Same here perhaps.
conradw
2015/09/01 16:55:54
See above.
| |
| 257 class B { | |
| 258 constructor(${genParams(parameterCount, true)}) { 'use strong'; } | |
| 259 } | |
| 260 class C extends B {}`, | |
| 261 ]; | 243 ]; |
| 262 for (let def of defs) { | 244 for (let def of defs) { |
| 263 let code = `${def}; new C(${genArgs(argumentCount)})`; | 245 let code = `${def}; new C(${genArgs(argumentCount)})`; |
| 264 if (argumentCount < parameterCount) { | 246 if (argumentCount < parameterCount) { |
| 265 assertThrows(code, TypeError); | 247 assertThrows(code, TypeError); |
| 266 } else { | 248 } else { |
| 267 assertDoesNotThrow(code); | 249 assertDoesNotThrow(code); |
| 268 } | 250 } |
| 269 } | 251 } |
| 270 } | 252 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 if (argumentCount < parameterCount) { | 333 if (argumentCount < parameterCount) { |
| 352 assertThrows(code, TypeError); | 334 assertThrows(code, TypeError); |
| 353 } else { | 335 } else { |
| 354 assertDoesNotThrow(code); | 336 assertDoesNotThrow(code); |
| 355 } | 337 } |
| 356 } | 338 } |
| 357 } | 339 } |
| 358 } | 340 } |
| 359 } | 341 } |
| 360 })(); | 342 })(); |
| OLD | NEW |