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

Side by Side Diff: pkg/dev_compiler/test/codegen_expected/sunflower/sunflower.js

Issue 2994203002: Optimize DDC private library files. (Closed)
Patch Set: Address comments Created 3 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 define(['dart_sdk'], function(dart_sdk) { 1 define(['dart_sdk'], function(dart_sdk) {
2 'use strict'; 2 'use strict';
3 const core = dart_sdk.core; 3 const core = dart_sdk.core;
4 const html = dart_sdk.html; 4 const html = dart_sdk.html;
5 const math = dart_sdk.math; 5 const math = dart_sdk.math;
6 const dart = dart_sdk.dart; 6 const dart = dart_sdk.dart;
7 const dartx = dart_sdk.dartx; 7 const dartx = dart_sdk.dartx;
8 const sunflower = Object.create(null); 8 const sunflower = Object.create(null);
9 const circle = Object.create(null); 9 const circle = Object.create(null);
10 const painter = Object.create(null); 10 const painter = Object.create(null);
(...skipping 28 matching lines...) Expand all
39 get context() { 39 get context() {
40 return html.CanvasRenderingContext2D.as(sunflower.canvas[dartx.getContext] ('2d')); 40 return html.CanvasRenderingContext2D.as(sunflower.canvas[dartx.getContext] ('2d'));
41 }, 41 },
42 get slider() { 42 get slider() {
43 return html.InputElement.as(sunflower.querySelector("#slider")); 43 return html.InputElement.as(sunflower.querySelector("#slider"));
44 }, 44 },
45 get notes() { 45 get notes() {
46 return sunflower.querySelector("#notes"); 46 return sunflower.querySelector("#notes");
47 }, 47 },
48 get PHI() { 48 get PHI() {
49 return (dart.notNull(math.sqrt(5)) + 1) / 2; 49 return (math.sqrt(5) + 1) / 2;
50 }, 50 },
51 get seeds() { 51 get seeds() {
52 return 0; 52 return 0;
53 }, 53 },
54 set seeds(_) {} 54 set seeds(_) {}
55 }); 55 });
56 sunflower.main = function() { 56 sunflower.main = function() {
57 sunflower.slider[dartx.addEventListener]('change', dart.fn(e => sunflower.dr aw(), EventTovoid())); 57 sunflower.slider[dartx.addEventListener]('change', dart.fn(e => sunflower.dr aw(), EventTovoid()));
58 sunflower.draw(); 58 sunflower.draw();
59 }; 59 };
60 dart.fn(sunflower.main, VoidTovoid()); 60 dart.fn(sunflower.main, VoidTovoid());
61 sunflower.draw = function() { 61 sunflower.draw = function() {
62 sunflower.seeds = core.int.parse(sunflower.slider.value); 62 sunflower.seeds = core.int.parse(sunflower.slider.value);
63 sunflower.context.clearRect(0, 0, sunflower.MAX_D, sunflower.MAX_D); 63 sunflower.context.clearRect(0, 0, sunflower.MAX_D, sunflower.MAX_D);
64 for (let i = 0; i < dart.notNull(sunflower.seeds); i++) { 64 for (let i = 0; i < dart.notNull(sunflower.seeds); i++) {
65 let theta = i * painter.TAU / dart.notNull(sunflower.PHI); 65 let theta = i * painter.TAU / dart.notNull(sunflower.PHI);
66 let r = dart.notNull(math.sqrt(i)) * sunflower.SCALE_FACTOR; 66 let r = math.sqrt(i) * sunflower.SCALE_FACTOR;
67 let x = sunflower.centerX + r * dart.notNull(math.cos(theta)); 67 let x = sunflower.centerX + r * math.cos(theta);
68 let y = sunflower.centerY - r * dart.notNull(math.sin(theta)); 68 let y = sunflower.centerY - r * math.sin(theta);
69 new sunflower.SunflowerSeed.new(x, y, sunflower.SEED_RADIUS).draw(sunflowe r.context); 69 new sunflower.SunflowerSeed.new(x, y, sunflower.SEED_RADIUS).draw(sunflowe r.context);
70 } 70 }
71 sunflower.notes[dartx.text] = dart.str`${sunflower.seeds} seeds`; 71 sunflower.notes[dartx.text] = dart.str`${sunflower.seeds} seeds`;
72 }; 72 };
73 dart.fn(sunflower.draw, VoidTovoid()); 73 dart.fn(sunflower.draw, VoidTovoid());
74 circle.Circle = class Circle extends core.Object { 74 circle.Circle = class Circle extends core.Object {
75 get x() { 75 get x() {
76 return this[x$]; 76 return this[x$];
77 } 77 }
78 set x(value) { 78 set x(value) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 }, null); 172 }, null);
173 // Exports: 173 // Exports:
174 return { 174 return {
175 sunflower: sunflower, 175 sunflower: sunflower,
176 circle: circle, 176 circle: circle,
177 painter: painter 177 painter: painter
178 }; 178 };
179 }); 179 });
180 180
181 //# sourceMappingURL=sunflower.js.map 181 //# sourceMappingURL=sunflower.js.map
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698