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

Side by Side Diff: test/codegen/expect/notnull.js

Issue 1988503002: Move generated files to gen/. (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Revise. 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 unified diff | Download patch
« no previous file with comments | « test/codegen/expect/node_modules.txt ('k') | test/codegen/expect/notnull.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 dart_library.library('notnull', null, /* Imports */[
2 'dart_sdk'
3 ], function(exports, dart_sdk) {
4 'use strict';
5 const core = dart_sdk.core;
6 const dart = dart_sdk.dart;
7 const dartx = dart_sdk.dartx;
8 const notnull = Object.create(null);
9 notnull.intAssignments = function() {
10 let i = 0;
11 i = i & 1;
12 i = (i | 1) >>> 0;
13 i = (i ^ 1) >>> 0;
14 i = i[dartx['>>']](1);
15 i = i << 1 >>> 0;
16 i = i - 1;
17 i = i[dartx['%']](1);
18 i = i + 1;
19 let t = i;
20 t == null ? i = 1 : t;
21 i = i * 1;
22 i = (i / 1)[dartx.truncate]();
23 i++;
24 --i;
25 core.print(i + 1);
26 let j = 1;
27 j = i < 10 ? 1 : 2;
28 core.print(j + 1);
29 };
30 dart.fn(notnull.intAssignments, dart.void, []);
31 notnull.doubleAssignments = function() {
32 let d = 0.0;
33 d = d / 1;
34 core.print(d + 1);
35 };
36 dart.fn(notnull.doubleAssignments, dart.void, []);
37 notnull.boolAssignments = function() {
38 let b = true;
39 b != b;
40 core.print(b);
41 };
42 dart.fn(notnull.boolAssignments, dart.void, []);
43 notnull.increments = function() {
44 let i = 1;
45 core.print(++i);
46 core.print(i++);
47 core.print(--i);
48 core.print(i--);
49 let j = null;
50 j = 1;
51 core.print((j = dart.notNull(j) + 1));
52 core.print((() => {
53 let x = j;
54 j = dart.notNull(x) + 1;
55 return x;
56 })());
57 core.print((j = dart.notNull(j) - 1));
58 core.print((() => {
59 let x = j;
60 j = dart.notNull(x) - 1;
61 return x;
62 })());
63 };
64 dart.fn(notnull.increments, dart.void, []);
65 notnull.conditionals = function(cond) {
66 if (cond === void 0) cond = null;
67 let nullable = null;
68 nullable = 1;
69 let nonNullable = 1;
70 let a = dart.notNull(cond) ? nullable : nullable;
71 let b = dart.notNull(cond) ? nullable : nonNullable;
72 let c = dart.notNull(cond) ? nonNullable : nonNullable;
73 let d = dart.notNull(cond) ? nonNullable : nullable;
74 core.print(dart.notNull(a) + dart.notNull(b) + c + dart.notNull(d));
75 };
76 dart.fn(notnull.conditionals, dart.void, [], [core.bool]);
77 notnull.nullAwareOps = function() {
78 let nullable = null;
79 let nonNullable = 1;
80 let a = (nullable != null ? nullable : nullable);
81 let b = (nullable != null ? nullable : nonNullable);
82 let c = nonNullable;
83 let d = nonNullable;
84 core.print(dart.notNull(a) + dart.notNull(b) + c + d);
85 let s = "";
86 core.print(dart.notNull(s[dartx.length]) + 1);
87 };
88 dart.fn(notnull.nullAwareOps, dart.void, []);
89 notnull.nullableLocals = function(param) {
90 core.print(dart.notNull(param) + 1);
91 let i = null;
92 i = 1;
93 core.print(dart.notNull(i) + 1);
94 let j = 1;
95 j = i == 1 ? 1 : null;
96 core.print(dart.notNull(j) + 1);
97 };
98 dart.fn(notnull.nullableLocals, dart.void, [core.int]);
99 notnull.optParams = function(x, y) {
100 if (x === void 0) x = null;
101 if (y === void 0) y = 1;
102 core.print(dart.notNull(x) + dart.notNull(y));
103 };
104 dart.fn(notnull.optParams, dart.void, [], [core.int, core.int]);
105 notnull.namedParams = function(opts) {
106 let x = opts && 'x' in opts ? opts.x : null;
107 let y = opts && 'y' in opts ? opts.y : 1;
108 core.print(dart.notNull(x) + dart.notNull(y));
109 };
110 dart.fn(notnull.namedParams, dart.void, [], {x: core.int, y: core.int});
111 notnull.forLoops = function(length) {
112 for (let i = 0; i < 10; i++) {
113 core.print(i + 1);
114 }
115 for (let i = 0; i < dart.notNull(length()); i++) {
116 core.print(i + 1);
117 }
118 for (let i = 0, n = length(); i < dart.notNull(n); i++) {
119 core.print(i + 1);
120 }
121 for (let i = 0, n = dart.notNull(length()) + 0; i < n; i++) {
122 core.print(i + 1);
123 }
124 };
125 dart.fn(notnull.forLoops, dart.void, [dart.functionType(core.int, [])]);
126 notnull.nullableCycle = function() {
127 let x = 1;
128 let y = 2;
129 let z = null;
130 x = y;
131 y = z;
132 z = x;
133 core.print(dart.notNull(x) + dart.notNull(y) + dart.notNull(z));
134 let s = null;
135 s = s;
136 core.print(dart.notNull(s) + 1);
137 };
138 dart.fn(notnull.nullableCycle, dart.void, []);
139 notnull.nonNullableCycle = function() {
140 let x = 1;
141 let y = 2;
142 let z = 3;
143 x = y;
144 y = z;
145 z = x;
146 core.print(x + y + z);
147 let s = 1;
148 s = s;
149 core.print(s + 1);
150 };
151 dart.fn(notnull.nonNullableCycle, dart.void, []);
152 notnull.Foo = class Foo extends core.Object {
153 new() {
154 this.intField = null;
155 this.varField = null;
156 }
157 f(o) {
158 core.print(1 + dart.notNull(dart.as(this.varField, core.num)) + 2);
159 while (dart.test(dart.dsend(this.varField, '<', 10))) {
160 this.varField = dart.dsend(this.varField, '+', 1);
161 }
162 while (dart.test(dart.dsend(this.varField, '<', 10)))
163 this.varField = dart.dsend(this.varField, '+', 1);
164 core.print(1 + dart.notNull(this.intField) + 2);
165 while (dart.notNull(this.intField) < 10) {
166 this.intField = dart.notNull(this.intField) + 1;
167 }
168 while (dart.notNull(this.intField) < 10)
169 this.intField = dart.notNull(this.intField) + 1;
170 core.print(1 + dart.notNull(o.intField) + 2);
171 while (dart.notNull(o.intField) < 10) {
172 o.intField = dart.notNull(o.intField) + 1;
173 }
174 while (dart.notNull(o.intField) < 10)
175 o.intField = dart.notNull(o.intField) + 1;
176 }
177 };
178 dart.setSignature(notnull.Foo, {
179 methods: () => ({f: [dart.dynamic, [notnull.Foo]]})
180 });
181 notnull._foo = function() {
182 return 1;
183 };
184 dart.fn(notnull._foo, core.int, []);
185 notnull.calls = function() {
186 let a = 1;
187 let b = 1;
188 b = dart.as(dart.dcall(dart.fn(x => x), a), core.int);
189 core.print(dart.notNull(b) + 1);
190 let c = notnull._foo();
191 core.print(dart.notNull(c) + 1);
192 };
193 dart.fn(notnull.calls);
194 notnull.localEscapes = function() {
195 let a = 1;
196 let f = dart.fn(x => a = dart.as(x, core.int));
197 let b = 1;
198 function g(x) {
199 return b = dart.as(x, core.int);
200 }
201 dart.fn(g);
202 dart.dcall(f, 1);
203 g(1);
204 core.print(dart.notNull(a) + dart.notNull(b));
205 };
206 dart.fn(notnull.localEscapes);
207 notnull.controlFlow = function() {
208 for (let i = null, j = null;;) {
209 i = j = 1;
210 core.print(dart.notNull(i) + dart.notNull(j) + 1);
211 break;
212 }
213 try {
214 dart.throw(1);
215 } catch (e) {
216 core.print(dart.dsend(e, '+', 1));
217 }
218
219 try {
220 dart.dsend(null, 'foo');
221 } catch (e) {
222 let trace = dart.stackTrace(e);
223 core.print(`${typeof e == 'string' ? e : dart.toString(e)} at ${trace}`);
224 }
225
226 };
227 dart.fn(notnull.controlFlow);
228 notnull.cascadesOnNull = function() {
229 let x = null;
230 core.print(dart.hashCode(((() => {
231 dart.toString(x);
232 dart.runtimeType(x);
233 return x;
234 })())));
235 let y = null;
236 core.print(dart.hashCode(((() => {
237 dart.toString(y);
238 dart.runtimeType(y);
239 return y;
240 })())));
241 };
242 dart.fn(notnull.cascadesOnNull);
243 notnull.main = function() {
244 notnull.intAssignments();
245 notnull.doubleAssignments();
246 notnull.boolAssignments();
247 notnull.nullableLocals(1);
248 notnull.optParams(1, 2);
249 notnull.namedParams({x: 1, y: 2});
250 notnull.forLoops(dart.fn(() => 10, core.int, []));
251 notnull.increments();
252 notnull.conditionals(true);
253 notnull.calls();
254 notnull.localEscapes();
255 notnull.controlFlow();
256 notnull.cascadesOnNull();
257 notnull.nullableCycle();
258 notnull.nonNullableCycle();
259 };
260 dart.fn(notnull.main);
261 // Exports:
262 exports.notnull = notnull;
263 });
OLDNEW
« no previous file with comments | « test/codegen/expect/node_modules.txt ('k') | test/codegen/expect/notnull.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698