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

Side by Side Diff: test/mjsunit/es6/classes-derived-return-type.js

Issue 1565263002: Revert of Ship ES2015 sloppy-mode function hoisting, let, class (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --harmony-sloppy
6
7
8 class Base {}
9
10 class DerivedWithReturn extends Base {
11 constructor(x) {
12 super();
13 return x;
14 }
15 }
16
17 assertThrows(function() {
18 new DerivedWithReturn(null);
19 }, TypeError);
20 assertThrows(function() {
21 new DerivedWithReturn(42);
22 }, TypeError);
23 assertThrows(function() {
24 new DerivedWithReturn(true);
25 }, TypeError);
26 assertThrows(function() {
27 new DerivedWithReturn('hi');
28 }, TypeError);
29 assertThrows(function() {
30 new DerivedWithReturn(Symbol());
31 }, TypeError);
32
33
34 assertInstanceof(new DerivedWithReturn(undefined), DerivedWithReturn);
35 function f() {}
36 assertInstanceof(new DerivedWithReturn(new f()), f);
37 assertInstanceof(new DerivedWithReturn(/re/), RegExp);
38
39
40 class DerivedWithReturnNoSuper extends Base {
41 constructor(x) {
42 return x;
43 }
44 }
45
46
47 assertThrows(function() {
48 new DerivedWithReturnNoSuper(null);
49 }, TypeError);
50 assertThrows(function() {
51 new DerivedWithReturnNoSuper(42);
52 }, TypeError);
53 assertThrows(function() {
54 new DerivedWithReturnNoSuper(true);
55 }, TypeError);
56 assertThrows(function() {
57 new DerivedWithReturnNoSuper('hi');
58 }, TypeError);
59 assertThrows(function() {
60 new DerivedWithReturnNoSuper(Symbol());
61 }, TypeError);
62 assertThrows(function() {
63 new DerivedWithReturnNoSuper(undefined);
64 }, ReferenceError);
65
66
67 function f2() {}
68 assertInstanceof(new DerivedWithReturnNoSuper(new f2()), f2);
69 assertInstanceof(new DerivedWithReturnNoSuper(/re/), RegExp);
70
71
72 class DerivedReturn extends Base {
73 constructor() {
74 super();
75 return;
76 }
77 }
78
79 assertInstanceof(new DerivedReturn(), DerivedReturn);
80
81
82
83 class DerivedReturnThis extends Base {
84 constructor() {
85 super();
86 return this;
87 }
88 }
89
90 assertInstanceof(new DerivedReturnThis(), DerivedReturnThis);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/block-scope-class.js ('k') | test/mjsunit/harmony/block-eval-var-over-legacy-const.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698