| Index: test/codegen/expect/sunflower/sunflower.js
|
| diff --git a/test/codegen/expect/sunflower/sunflower.js b/test/codegen/expect/sunflower/sunflower.js
|
| deleted file mode 100644
|
| index 4ae1f95732f7e2fc1d2a27d111c894d8fef62e1e..0000000000000000000000000000000000000000
|
| --- a/test/codegen/expect/sunflower/sunflower.js
|
| +++ /dev/null
|
| @@ -1,93 +0,0 @@
|
| -var sunflower;
|
| -(function(sunflower) {
|
| - 'use strict';
|
| - let ORANGE = "orange";
|
| - let SEED_RADIUS = 2;
|
| - let SCALE_FACTOR = 4;
|
| - let TAU = math.PI * 2;
|
| - let MAX_D = 300;
|
| - let centerX = MAX_D / 2;
|
| - let centerY = centerX;
|
| - // Function querySelector: (String) → Element
|
| - function querySelector(selector) {
|
| - return dom.document.querySelector(selector);
|
| - }
|
| - sunflower.seeds = 0;
|
| - dart.defineLazyProperties(sunflower, {
|
| - get slider() {
|
| - return dart.as(querySelector("#slider"), dom.InputElement);
|
| - },
|
| - get notes() {
|
| - return querySelector("#notes");
|
| - },
|
| - get PHI() {
|
| - return (math.sqrt(5) + 1) / 2;
|
| - },
|
| - get context() {
|
| - return dart.as(dart.as(querySelector("#canvas"), dom.CanvasElement).getContext('2d'), dom.CanvasRenderingContext2D);
|
| - }
|
| - });
|
| - class Circle extends dart.Object {
|
| - Circle(x, y, radius) {
|
| - this.x = x;
|
| - this.y = y;
|
| - this.radius = radius;
|
| - }
|
| - }
|
| - class CirclePainter extends dart.Object {
|
| - CirclePainter() {
|
| - this.color = ORANGE;
|
| - }
|
| - draw() {
|
| - sunflower.context.beginPath();
|
| - sunflower.context.lineWidth = 2;
|
| - sunflower.context.fillStyle = this.color;
|
| - sunflower.context.strokeStyle = this.color;
|
| - sunflower.context.arc(this.x, this.y, this.radius, 0, TAU, false);
|
| - sunflower.context.fill();
|
| - sunflower.context.closePath();
|
| - sunflower.context.stroke();
|
| - }
|
| - }
|
| - class SunflowerSeed extends dart.mixin(Circle, CirclePainter) {
|
| - SunflowerSeed(x, y, radius, color) {
|
| - if (color === void 0)
|
| - color = null;
|
| - super.Circle(x, y, radius);
|
| - if (color !== null)
|
| - this.color = color;
|
| - }
|
| - }
|
| - // Function main: () → void
|
| - function main() {
|
| - sunflower.slider.addEventListener('change', (e) => draw());
|
| - draw();
|
| - }
|
| - // Function draw: () → void
|
| - function draw() {
|
| - sunflower.seeds = core.int.parse(sunflower.slider.value);
|
| - sunflower.context.clearRect(0, 0, MAX_D, MAX_D);
|
| - for (let i = 0; i < sunflower.seeds; i++) {
|
| - let theta = dart.notNull(i * dart.notNull(TAU)) / dart.notNull(sunflower.PHI);
|
| - let r = math.sqrt(i) * SCALE_FACTOR;
|
| - let x = dart.notNull(centerX) + dart.notNull(dart.notNull(r) * math.cos(theta));
|
| - let y = dart.notNull(centerY) - dart.notNull(dart.notNull(r) * math.sin(theta));
|
| - new SunflowerSeed(x, y, SEED_RADIUS).draw();
|
| - }
|
| - sunflower.notes.textContent = `${sunflower.seeds} seeds`;
|
| - }
|
| - // Exports:
|
| - sunflower.ORANGE = ORANGE;
|
| - sunflower.SEED_RADIUS = SEED_RADIUS;
|
| - sunflower.SCALE_FACTOR = SCALE_FACTOR;
|
| - sunflower.TAU = TAU;
|
| - sunflower.MAX_D = MAX_D;
|
| - sunflower.centerX = centerX;
|
| - sunflower.centerY = centerY;
|
| - sunflower.querySelector = querySelector;
|
| - sunflower.Circle = Circle;
|
| - sunflower.CirclePainter = CirclePainter;
|
| - sunflower.SunflowerSeed = SunflowerSeed;
|
| - sunflower.main = main;
|
| - sunflower.draw = draw;
|
| -})(sunflower || (sunflower = {}));
|
|
|