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

Side by Side Diff: frog/minfrog

Issue 8921009: frog: check that const constructors have potentially const initializers. Also (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env node 1 #!/usr/bin/env node
2 // ********** Library dart:core ************** 2 // ********** Library dart:core **************
3 // ********** Natives dart:core ************** 3 // ********** Natives dart:core **************
4 /** 4 /**
5 * Generates a dynamic call stub for a function. 5 * Generates a dynamic call stub for a function.
6 * Our goal is to create a stub method like this on-the-fly: 6 * Our goal is to create a stub method like this on-the-fly:
7 * function($0, $1, capture) { return this($0, $1, true, capture); } 7 * function($0, $1, capture) { return this($0, $1, true, capture); }
8 * 8 *
9 * This stub then replaces the dynamic one on Function, with one that is 9 * This stub then replaces the dynamic one on Function, with one that is
10 * specialized for that particular function, taking into account its default 10 * specialized for that particular function, taking into account its default
(...skipping 5581 matching lines...) Expand 10 before | Expand all | Expand 10 after
5592 var fname = $i0.next$0(); 5592 var fname = $i0.next$0();
5593 fields.$setindex(fname, value.get$fields().$index(fname)); 5593 fields.$setindex(fname, value.get$fields().$index(fname));
5594 } 5594 }
5595 } 5595 }
5596 } 5596 }
5597 else { 5597 else {
5598 var assign = init; 5598 var assign = init;
5599 var x = assign.x; 5599 var x = assign.x;
5600 var fname = x.get$name().get$name(); 5600 var fname = x.get$name().get$name();
5601 var val = this.generator.visitValue(assign.y); 5601 var val = this.generator.visitValue(assign.y);
5602 if (!val.get$isConst()) {
5603 $globals.world.error('invalid non-const initializer in const construct or', assign.y.span);
5604 }
5602 fields.$setindex(fname, val); 5605 fields.$setindex(fname, val);
5603 } 5606 }
5604 } 5607 }
5605 this.generator._popBlock(); 5608 this.generator._popBlock();
5606 } 5609 }
5607 var $$list = this.declaringType.get$members().getValues(); 5610 var $$list = this.declaringType.get$members().getValues();
5608 for (var $$i = this.declaringType.get$members().getValues().iterator$0(); $$i. hasNext$0(); ) { 5611 for (var $$i = this.declaringType.get$members().getValues().iterator$0(); $$i. hasNext$0(); ) {
5609 var f = $$i.next$0(); 5612 var f = $$i.next$0();
5610 if ((f instanceof FieldMember) && !f.get$isStatic() && f.get$value() != null && !fields.containsKey(f.get$name())) { 5613 if ((f instanceof FieldMember) && !f.get$isStatic() && !fields.containsKey(f .get$name())) {
5611 fields.$setindex(f.get$name(), f.computeValue$0()); 5614 if (!f.get$isFinal()) {
5615 $globals.world.error(('const class "' + this.declaringType.name + '" has non-final ') + ('field "' + f.get$name() + '"'), f.get$span());
5616 }
5617 if (f.get$value() != null) {
5618 fields.$setindex(f.get$name(), f.computeValue$0());
5619 }
5612 } 5620 }
5613 } 5621 }
5614 return $globals.world.gen.globalForConst(ConstObjectValue.ConstObjectValue$fac tory(target.get$type(), fields, code, node.span), args.values); 5622 return $globals.world.gen.globalForConst(ConstObjectValue.ConstObjectValue$fac tory(target.get$type(), fields, code, node.span), args.values);
5615 } 5623 }
5616 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode, isDynamic) { 5624 MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar gsCode, isDynamic) {
5617 var allConst = target.get$isConst() && args.values.every((function (arg) { 5625 var allConst = target.get$isConst() && args.values.every((function (arg) {
5618 return arg.get$isConst(); 5626 return arg.get$isConst();
5619 }) 5627 })
5620 ); 5628 );
5621 if (this.declaringType.get$isNum()) { 5629 if (this.declaringType.get$isNum()) {
(...skipping 7614 matching lines...) Expand 10 before | Expand all | Expand 10 after
13236 $globals._NO_COLOR = '\u001b[0m'; 13244 $globals._NO_COLOR = '\u001b[0m';
13237 $globals._RED_COLOR = '\u001b[31m'; 13245 $globals._RED_COLOR = '\u001b[31m';
13238 } 13246 }
13239 var const$0 = new EnvMap()/*const EnvMap()*/; 13247 var const$0 = new EnvMap()/*const EnvMap()*/;
13240 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; 13248 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/;
13241 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; 13249 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/;
13242 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/; 13250 var const$8 = new NoMoreElementsException()/*const NoMoreElementsException()*/;
13243 var $globals = {}; 13251 var $globals = {};
13244 $static_init(); 13252 $static_init();
13245 main(); 13253 main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698