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

Side by Side Diff: test/codegen_expected/language/call_operator_test.js

Issue 2200913002: fixes #616, statics on callable functions (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 4 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
1 dart_library.library('language/call_operator_test', null, /* Imports */[ 1 dart_library.library('language/call_operator_test', null, /* Imports */[
2 'dart_sdk', 2 'dart_sdk',
3 'expect' 3 'expect'
4 ], function load__call_operator_test(exports, dart_sdk, expect) { 4 ], function load__call_operator_test(exports, dart_sdk, expect) {
5 'use strict'; 5 'use strict';
6 const core = dart_sdk.core; 6 const core = dart_sdk.core;
7 const dart = dart_sdk.dart; 7 const dart = dart_sdk.dart;
8 const dartx = dart_sdk.dartx; 8 const dartx = dart_sdk.dartx;
9 const expect$ = expect.expect; 9 const expect$ = expect.expect;
10 const call_operator_test = Object.create(null); 10 const call_operator_test = Object.create(null);
11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))(); 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
12 call_operator_test.A1 = dart.callableClass(function A1(...args) { 12 call_operator_test.A1 = dart.callableClass(function A1(...args) {
13 const self = this;
14 function call(...args) { 13 function call(...args) {
15 return self.call.apply(self, args); 14 return call.call.apply(call, args);
16 } 15 }
17 call.__proto__ = this.__proto__; 16 call.__proto__ = this.__proto__;
18 call.new.apply(call, args); 17 call.new.apply(call, args);
19 return call; 18 return call;
20 }, class A1 extends core.Object { 19 }, class A1 extends core.Object {
21 call() { 20 call() {
22 return 42; 21 return 42;
23 } 22 }
24 }); 23 });
25 dart.setSignature(call_operator_test.A1, { 24 dart.setSignature(call_operator_test.A1, {
26 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [])}) 25 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [])})
27 }); 26 });
28 call_operator_test.A2 = dart.callableClass(function A2(...args) { 27 call_operator_test.A2 = dart.callableClass(function A2(...args) {
29 const self = this;
30 function call(...args) { 28 function call(...args) {
31 return self.call.apply(self, args); 29 return call.call.apply(call, args);
32 } 30 }
33 call.__proto__ = this.__proto__; 31 call.__proto__ = this.__proto__;
34 call.new.apply(call, args); 32 call.new.apply(call, args);
35 return call; 33 return call;
36 }, class A2 extends core.Object { 34 }, class A2 extends core.Object {
37 call() { 35 call() {
38 return 35; 36 return 35;
39 } 37 }
40 }); 38 });
41 dart.setSignature(call_operator_test.A2, { 39 dart.setSignature(call_operator_test.A2, {
42 methods: () => ({call: dart.definiteFunctionType(core.int, [])}) 40 methods: () => ({call: dart.definiteFunctionType(core.int, [])})
43 }); 41 });
44 call_operator_test.B = dart.callableClass(function B(...args) { 42 call_operator_test.B = dart.callableClass(function B(...args) {
45 const self = this;
46 function call(...args) { 43 function call(...args) {
47 return self.call.apply(self, args); 44 return call.call.apply(call, args);
48 } 45 }
49 call.__proto__ = this.__proto__; 46 call.__proto__ = this.__proto__;
50 call.new.apply(call, args); 47 call.new.apply(call, args);
51 return call; 48 return call;
52 }, class B extends core.Object { 49 }, class B extends core.Object {
53 call() { 50 call() {
54 return 28; 51 return 28;
55 } 52 }
56 }); 53 });
57 dart.setSignature(call_operator_test.B, { 54 dart.setSignature(call_operator_test.B, {
58 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [])}) 55 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [])})
59 }); 56 });
60 call_operator_test.C = dart.callableClass(function C(...args) { 57 call_operator_test.C = dart.callableClass(function C(...args) {
61 const self = this;
62 function call(...args) { 58 function call(...args) {
63 return self.call.apply(self, args); 59 return call.call.apply(call, args);
64 } 60 }
65 call.__proto__ = this.__proto__; 61 call.__proto__ = this.__proto__;
66 call.new.apply(call, args); 62 call.new.apply(call, args);
67 return call; 63 return call;
68 }, class C extends core.Object { 64 }, class C extends core.Object {
69 call(arg) { 65 call(arg) {
70 return 7 * dart.notNull(core.num._check(arg)); 66 return 7 * dart.notNull(core.num._check(arg));
71 } 67 }
72 }); 68 });
73 dart.setSignature(call_operator_test.C, { 69 dart.setSignature(call_operator_test.C, {
74 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [dart.dynamic ])}) 70 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [dart.dynamic ])})
75 }); 71 });
76 call_operator_test.D = dart.callableClass(function D(...args) { 72 call_operator_test.D = dart.callableClass(function D(...args) {
77 const self = this;
78 function call(...args) { 73 function call(...args) {
79 return self.call.apply(self, args); 74 return call.call.apply(call, args);
80 } 75 }
81 call.__proto__ = this.__proto__; 76 call.__proto__ = this.__proto__;
82 call.new.apply(call, args); 77 call.new.apply(call, args);
83 return call; 78 return call;
84 }, class D extends core.Object { 79 }, class D extends core.Object {
85 call(arg) { 80 call(arg) {
86 if (arg === void 0) arg = 6; 81 if (arg === void 0) arg = 6;
87 return 7 * dart.notNull(core.num._check(arg)); 82 return 7 * dart.notNull(core.num._check(arg));
88 } 83 }
89 }); 84 });
90 dart.setSignature(call_operator_test.D, { 85 dart.setSignature(call_operator_test.D, {
91 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [], [dart.dyn amic])}) 86 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [], [dart.dyn amic])})
92 }); 87 });
93 call_operator_test.E = dart.callableClass(function E(...args) { 88 call_operator_test.E = dart.callableClass(function E(...args) {
94 const self = this;
95 function call(...args) { 89 function call(...args) {
96 return self.call.apply(self, args); 90 return call.call.apply(call, args);
97 } 91 }
98 call.__proto__ = this.__proto__; 92 call.__proto__ = this.__proto__;
99 call.new.apply(call, args); 93 call.new.apply(call, args);
100 return call; 94 return call;
101 }, class E extends core.Object { 95 }, class E extends core.Object {
102 call(str, opts) { 96 call(str, opts) {
103 let count = opts && 'count' in opts ? opts.count : 1; 97 let count = opts && 'count' in opts ? opts.count : 1;
104 let buffer = new core.StringBuffer(); 98 let buffer = new core.StringBuffer();
105 for (let i = 0; i < dart.notNull(count); i++) { 99 for (let i = 0; i < dart.notNull(count); i++) {
106 buffer.write(str); 100 buffer.write(str);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 expect$.Expect.equals("foo", e.call("foo")); 135 expect$.Expect.equals("foo", e.call("foo"));
142 expect$.Expect.equals("foo:foo", e.call("foo", {count: 2})); 136 expect$.Expect.equals("foo:foo", e.call("foo", {count: 2}));
143 expect$.Expect.equals("foo:foo:foo", e.call("foo", {count: 3})); 137 expect$.Expect.equals("foo:foo:foo", e.call("foo", {count: 3}));
144 expect$.Expect.isTrue(core.Function.is(a1)); 138 expect$.Expect.isTrue(core.Function.is(a1));
145 expect$.Expect.isTrue(core.Function.is(e)); 139 expect$.Expect.isTrue(core.Function.is(e));
146 }; 140 };
147 dart.fn(call_operator_test.main, VoidTodynamic()); 141 dart.fn(call_operator_test.main, VoidTodynamic());
148 // Exports: 142 // Exports:
149 exports.call_operator_test = call_operator_test; 143 exports.call_operator_test = call_operator_test;
150 }); 144 });
OLDNEW
« no previous file with comments | « test/codegen_expected/language/call_function_apply_test.js ('k') | test/codegen_expected/language/call_this_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698