Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: test/mjsunit/es6/new-target.js

Issue 1432493003: [turbofan] Fix new.target when a function is inlined to a constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@reland
Patch Set: Test added Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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: --harmony-reflect --harmony-destructuring --harmony-rest-parameters 5 // Flags: --harmony-reflect --harmony-destructuring --harmony-rest-parameters
6 6
7 7
8 (function TestClass() { 8 (function TestClass() {
9 'use strict'; 9 'use strict';
10 10
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 assertSame(f3, new f3({})); 378 assertSame(f3, new f3({}));
379 function f4(...a) { return new.target } 379 function f4(...a) { return new.target }
380 assertSame(f4, new f4); 380 assertSame(f4, new f4);
381 function f5() { 'use strict'; { let x; return new.target } } 381 function f5() { 'use strict'; { let x; return new.target } }
382 assertSame(f5, new f5); 382 assertSame(f5, new f5);
383 function f6() { with ({'new.target': 42}) return new.target } 383 function f6() { with ({'new.target': 42}) return new.target }
384 assertSame(f6, new f6); 384 assertSame(f6, new f6);
385 })(); 385 })();
386 386
387 387
388 // Has to be top-level to be inlined.
389 function get_new_target() { return new.target; }
390 (function TestInlining() {
391 "use strict";
392 new function() { assertEquals(undefined, get_new_target()); }
393 new function() { assertEquals(get_new_target, new get_new_target()); }
394
395 class A extends get_new_target {
396 constructor() {
397 var new_target = super();
398 this.new_target = new_target;
399 }
400 }
401 assertEquals(A, new A().new_target);
402 })();
403
404
388 (function TestEarlyErrors() { 405 (function TestEarlyErrors() {
389 assertThrows(function() { Function("new.target = 42"); }, ReferenceError); 406 assertThrows(function() { Function("new.target = 42"); }, ReferenceError);
390 assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, R eferenceError); 407 assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, R eferenceError);
391 assertThrows(function() { Function("var foo = 1; foo = new.target = 42"); }, R eferenceError); 408 assertThrows(function() { Function("var foo = 1; foo = new.target = 42"); }, R eferenceError);
392 assertThrows(function() { Function("new.target--"); }, ReferenceError); 409 assertThrows(function() { Function("new.target--"); }, ReferenceError);
393 assertThrows(function() { Function("--new.target"); }, ReferenceError); 410 assertThrows(function() { Function("--new.target"); }, ReferenceError);
394 assertThrows(function() { Function("(new.target)++"); }, ReferenceError); 411 assertThrows(function() { Function("(new.target)++"); }, ReferenceError);
395 assertThrows(function() { Function("++(new.target)"); }, ReferenceError); 412 assertThrows(function() { Function("++(new.target)"); }, ReferenceError);
396 assertThrows(function() { Function("for (new.target of {});"); }, SyntaxError) ; 413 assertThrows(function() { Function("for (new.target of {});"); }, SyntaxError) ;
397 })(); 414 })();
OLDNEW
« no previous file with comments | « src/runtime/runtime-function.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698