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

Unified Diff: test/codegen/expect/constructors.js

Issue 1965213003: simplify constructors, fixes #564 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/codegen/expect/closure.js ('k') | test/codegen/expect/covariance.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/expect/constructors.js
diff --git a/test/codegen/expect/constructors.js b/test/codegen/expect/constructors.js
index 919f5464368d15d7e45d2beef53db68193a6112a..bd6fc9c914c1660d9d6f361dd2d62dc7f24b4422 100644
--- a/test/codegen/expect/constructors.js
+++ b/test/codegen/expect/constructors.js
@@ -8,11 +8,11 @@ dart_library.library('constructors', null, /* Imports */[
const constructors = Object.create(null);
constructors.A = class A extends core.Object {};
constructors.B = class B extends core.Object {
- B() {
+ new() {
}
};
dart.setSignature(constructors.B, {
- constructors: () => ({B: [constructors.B, []]})
+ constructors: () => ({new: [constructors.B, []]})
});
constructors.C = class C extends core.Object {
named() {
@@ -32,7 +32,7 @@ dart_library.library('constructors', null, /* Imports */[
constructors: () => ({named: [constructors.C2, []]})
});
constructors.D = class D extends core.Object {
- D() {
+ new() {
}
named() {
}
@@ -40,44 +40,44 @@ dart_library.library('constructors', null, /* Imports */[
dart.defineNamedConstructor(constructors.D, 'named');
dart.setSignature(constructors.D, {
constructors: () => ({
- D: [constructors.D, []],
+ new: [constructors.D, []],
named: [constructors.D, []]
})
});
constructors.E = class E extends core.Object {
- E(name) {
+ new(name) {
this.name = name;
}
};
dart.setSignature(constructors.E, {
- constructors: () => ({E: [constructors.E, [core.String]]})
+ constructors: () => ({new: [constructors.E, [core.String]]})
});
constructors.F = class F extends constructors.E {
- F(name) {
- super.E(name);
+ new(name) {
+ super.new(name);
}
};
dart.setSignature(constructors.F, {
- constructors: () => ({F: [constructors.F, [core.String]]})
+ constructors: () => ({new: [constructors.F, [core.String]]})
});
constructors.G = class G extends core.Object {
- G(p1) {
+ new(p1) {
if (p1 === void 0) p1 = null;
}
};
dart.setSignature(constructors.G, {
- constructors: () => ({G: [constructors.G, [], [core.String]]})
+ constructors: () => ({new: [constructors.G, [], [core.String]]})
});
constructors.H = class H extends core.Object {
- H(opts) {
+ new(opts) {
let p1 = opts && 'p1' in opts ? opts.p1 : null;
}
};
dart.setSignature(constructors.H, {
- constructors: () => ({H: [constructors.H, [], {p1: core.String}]})
+ constructors: () => ({new: [constructors.H, [], {p1: core.String}]})
});
constructors.I = class I extends core.Object {
- I() {
+ new() {
this.name = 'default';
}
named(name) {
@@ -87,21 +87,21 @@ dart_library.library('constructors', null, /* Imports */[
dart.defineNamedConstructor(constructors.I, 'named');
dart.setSignature(constructors.I, {
constructors: () => ({
- I: [constructors.I, []],
+ new: [constructors.I, []],
named: [constructors.I, [core.String]]
})
});
constructors.J = class J extends core.Object {
- J() {
+ new() {
this.initialized = true;
this.nonInitialized = null;
}
};
dart.setSignature(constructors.J, {
- constructors: () => ({J: [constructors.J, []]})
+ constructors: () => ({new: [constructors.J, []]})
});
constructors.K = class K extends core.Object {
- K() {
+ new() {
this.s = 'a';
}
withS(s) {
@@ -111,21 +111,21 @@ dart_library.library('constructors', null, /* Imports */[
dart.defineNamedConstructor(constructors.K, 'withS');
dart.setSignature(constructors.K, {
constructors: () => ({
- K: [constructors.K, []],
+ new: [constructors.K, []],
withS: [constructors.K, [core.String]]
})
});
constructors.L = class L extends core.Object {
- L(foo) {
+ new(foo) {
this.foo = foo;
}
};
dart.setSignature(constructors.L, {
- constructors: () => ({L: [constructors.L, [dart.dynamic]]})
+ constructors: () => ({new: [constructors.L, [dart.dynamic]]})
});
constructors.M = class M extends constructors.L {
named(x) {
- super.L(dart.notNull(x) + 42);
+ super.new(dart.notNull(x) + 42);
}
};
dart.defineNamedConstructor(constructors.M, 'named');
@@ -142,28 +142,28 @@ dart_library.library('constructors', null, /* Imports */[
constructors: () => ({named: [constructors.N, [core.int]]})
});
constructors.P = class P extends constructors.N {
- P(z) {
+ new(z) {
super.named(dart.notNull(z) + 9000);
}
foo(x) {
- this.P(dart.notNull(x) + 42);
+ P.prototype.new.call(this, dart.notNull(x) + 42);
}
bar() {
- this.foo(1);
+ P.prototype.foo.call(this, 1);
}
};
dart.defineNamedConstructor(constructors.P, 'foo');
dart.defineNamedConstructor(constructors.P, 'bar');
dart.setSignature(constructors.P, {
constructors: () => ({
- P: [constructors.P, [core.int]],
+ new: [constructors.P, [core.int]],
foo: [constructors.P, [core.int]],
bar: [constructors.P, []]
})
});
constructors.Q$ = dart.generic(T => {
class Q extends core.Object {
- Q(y) {
+ new(y) {
this.x = dart.as(y, T);
}
static foo() {
@@ -183,7 +183,7 @@ dart_library.library('constructors', null, /* Imports */[
}
}
dart.setSignature(Q, {
- constructors: () => ({Q: [constructors.Q$(T), [dart.dynamic]]}),
+ constructors: () => ({new: [constructors.Q$(T), [dart.dynamic]]}),
methods: () => ({
bar: [core.String, []],
bar2: [core.String, []]
« no previous file with comments | « test/codegen/expect/closure.js ('k') | test/codegen/expect/covariance.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698