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

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

Issue 949383003: use js_ast instead of strings to generate JS (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Created 5 years, 9 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 var fieldtest; 1 var fieldtest;
2 (function (fieldtest) { 2 (function(fieldtest) {
3 'use strict'; 3 'use strict';
4 class A extends dart.Object { 4 class A extends dart.Object {
5 A() { 5 A() {
6 this.x = 42; 6 this.x = 42;
7 } 7 }
8 } 8 }
9
10 let B$ = dart.generic(function(T) { 9 let B$ = dart.generic(function(T) {
11 class B extends dart.Object { 10 class B extends dart.Object {
12 B() { 11 B() {
13 this.x = dart.as(null, core.int); 12 this.x = dart.as(null, core.int);
14 this.y = null; 13 this.y = null;
15 this.z = dart.as(null, T); 14 this.z = dart.as(null, T);
16 } 15 }
17 } 16 }
18 return B; 17 return B;
19 }); 18 });
20 let B = B$(dynamic); 19 let B = B$(dynamic);
21
22 // Function foo: (A) → int 20 // Function foo: (A) → int
23 function foo(a) { 21 function foo(a) {
24 core.print(a.x); 22 core.print(a.x);
25 return a.x; 23 return a.x;
26 } 24 }
27
28 // Function bar: (dynamic) → int 25 // Function bar: (dynamic) → int
29 function bar(a) { 26 function bar(a) {
30 core.print(dart.dload(a, "x")); 27 core.print(dart.dload(a, 'x'));
31 return dart.as(dart.dload(a, "x"), core.int); 28 return dart.as(dart.dload(a, 'x'), core.int);
32 } 29 }
33
34 // Function baz: (A) → dynamic 30 // Function baz: (A) → dynamic
35 function baz(a) { return a.x; } 31 function baz(a) {
36 32 return a.x;
33 }
37 // Function compute: () → int 34 // Function compute: () → int
38 function compute() { return 123; } 35 function compute() {
39 36 return 123;
37 }
40 dart.defineLazyProperties(fieldtest, { 38 dart.defineLazyProperties(fieldtest, {
41 get y() { return compute() + 444 }, 39 get y() {
42 set y(x) {}, 40 return compute() + 444;
41 },
42 set y() {}
43 }); 43 });
44
45 dart.copyProperties(fieldtest, { 44 dart.copyProperties(fieldtest, {
46 get q() { return core.String['+'](core.String['+']('life, ', 'the universe ' ), 'and everything'); }, 45 get q() {
47 get z() { return 42; }, 46 return core.String['+'](core.String['+']('life, ', 'the universe '), 'and everything');
47 },
48 get z() {
49 return 42;
50 },
48 set z(value) { 51 set z(value) {
49 fieldtest.y = dart.as(value, core.int); 52 fieldtest.y = dart.as(value, core.int);
50 }, 53 }
51 }); 54 });
52
53 // Function main: () → void 55 // Function main: () → void
54 function main() { 56 function main() {
55 let a = new A(); 57 let a = new A();
56 foo(a); 58 foo(a);
57 bar(a); 59 bar(a);
58 core.print(baz(a)); 60 core.print(baz(a));
59 } 61 }
60
61 // Exports: 62 // Exports:
62 fieldtest.A = A; 63 fieldtest.A = A;
63 fieldtest.B = B; 64 fieldtest.B = B;
64 fieldtest.B$ = B$; 65 fieldtest.B$ = B$;
65 fieldtest.foo = foo; 66 fieldtest.foo = foo;
66 fieldtest.bar = bar; 67 fieldtest.bar = bar;
67 fieldtest.baz = baz; 68 fieldtest.baz = baz;
68 fieldtest.compute = compute; 69 fieldtest.compute = compute;
70 fieldtest.q = q;
71 fieldtest.z = z;
72 fieldtest.z = z;
69 fieldtest.main = main; 73 fieldtest.main = main;
70 })(fieldtest || (fieldtest = {})); 74 })(fieldtest || (fieldtest = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698