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

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

Issue 2847893002: fix #27258, don't allow dynamic set of a final field (Closed)
Patch Set: format Created 3 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 this[x$] = x; 94 this[x$] = x;
95 this[y$] = y; 95 this[y$] = y;
96 this[radius$] = radius; 96 this[radius$] = radius;
97 } 97 }
98 }; 98 };
99 const x$ = Symbol("Circle.x"); 99 const x$ = Symbol("Circle.x");
100 const y$ = Symbol("Circle.y"); 100 const y$ = Symbol("Circle.y");
101 const radius$ = Symbol("Circle.radius"); 101 const radius$ = Symbol("Circle.radius");
102 dart.setSignature(circle.Circle, { 102 dart.setSignature(circle.Circle, {
103 fields: () => ({ 103 fields: () => ({
104 x: core.num, 104 x: dart.finalFieldType(core.num),
105 y: core.num, 105 y: dart.finalFieldType(core.num),
106 radius: core.num 106 radius: dart.finalFieldType(core.num)
107 }) 107 })
108 }); 108 });
109 painter.CirclePainter = class CirclePainter extends core.Object { 109 painter.CirclePainter = class CirclePainter extends core.Object {
110 new() { 110 new() {
111 this[color] = painter.ORANGE; 111 this[color] = painter.ORANGE;
112 } 112 }
113 get color() { 113 get color() {
114 return this[color]; 114 return this[color];
115 } 115 }
116 set color(value) { 116 set color(value) {
117 this[color] = value; 117 this[color] = value;
118 } 118 }
119 draw(context) { 119 draw(context) {
120 context.beginPath(); 120 context.beginPath();
121 context.lineWidth = 2; 121 context.lineWidth = 2;
122 context.fillStyle = this.color; 122 context.fillStyle = this.color;
123 context.strokeStyle = this.color; 123 context.strokeStyle = this.color;
124 context[dartx.arc](this.x, this.y, this.radius, 0, painter.TAU, false); 124 context[dartx.arc](this.x, this.y, this.radius, 0, painter.TAU, false);
125 context[dartx.fill](); 125 context[dartx.fill]();
126 context.closePath(); 126 context.closePath();
127 context.stroke(); 127 context.stroke();
128 } 128 }
129 }; 129 };
130 const color = Symbol("CirclePainter.color"); 130 const color = Symbol("CirclePainter.color");
131 painter.CirclePainter[dart.implements] = () => [circle.Circle]; 131 painter.CirclePainter[dart.implements] = () => [circle.Circle];
132 dart.setSignature(painter.CirclePainter, { 132 dart.setSignature(painter.CirclePainter, {
133 fields: () => ({color: core.String}), 133 fields: () => ({color: dart.fieldType(core.String)}),
134 methods: () => ({draw: dart.definiteFunctionType(dart.void, [html.CanvasRend eringContext2D])}) 134 methods: () => ({draw: dart.definiteFunctionType(dart.void, [html.CanvasRend eringContext2D])})
135 }); 135 });
136 sunflower.SunflowerSeed = class SunflowerSeed extends dart.mixin(circle.Circle , painter.CirclePainter) { 136 sunflower.SunflowerSeed = class SunflowerSeed extends dart.mixin(circle.Circle , painter.CirclePainter) {
137 new(x, y, radius, color) { 137 new(x, y, radius, color) {
138 if (color === void 0) color = null; 138 if (color === void 0) color = null;
139 super.new(x, y, radius); 139 super.new(x, y, radius);
140 if (color != null) this.color = color; 140 if (color != null) this.color = color;
141 } 141 }
142 }; 142 };
143 dart.defineLazy(painter, { 143 dart.defineLazy(painter, {
(...skipping 29 matching lines...) Expand all
173 }, null); 173 }, null);
174 // Exports: 174 // Exports:
175 return { 175 return {
176 sunflower: sunflower, 176 sunflower: sunflower,
177 circle: circle, 177 circle: circle,
178 painter: painter 178 painter: painter
179 }; 179 };
180 }); 180 });
181 181
182 //# sourceMappingURL=sunflower.js.map 182 //# sourceMappingURL=sunflower.js.map
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/codegen_expected/closure.js ('k') | pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698