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

Side by Side Diff: frog/minfrog

Issue 8772070: Check constness of default args (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 4452 matching lines...) Expand 10 before | Expand all | Expand 10 after
4463 else if (this.isInitializer && !this.method.get$isConstructor()) { 4463 else if (this.isInitializer && !this.method.get$isConstructor()) {
4464 $globals.world.error('initializer parameters only allowed on constructors', this.definition.span); 4464 $globals.world.error('initializer parameters only allowed on constructors', this.definition.span);
4465 } 4465 }
4466 } 4466 }
4467 Parameter.prototype.genValue = function(method, context) { 4467 Parameter.prototype.genValue = function(method, context) {
4468 if (this.definition.value == null || this.value != null) return; 4468 if (this.definition.value == null || this.value != null) return;
4469 if (context == null) { 4469 if (context == null) {
4470 context = new MethodGenerator(method, null); 4470 context = new MethodGenerator(method, null);
4471 } 4471 }
4472 this.value = this.definition.value.visit(context); 4472 this.value = this.definition.value.visit(context);
4473 if (!this.value.get$isConst()) {
4474 $globals.world.error('default arguments must be constant', this.value.span);
4475 }
4473 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse); 4476 this.value = this.value.convertTo(context, this.type, this.definition.value, f alse);
4474 } 4477 }
4475 Parameter.prototype.copyWithNewType = function(newMethod, newType) { 4478 Parameter.prototype.copyWithNewType = function(newMethod, newType) {
4476 var ret = new Parameter(this.definition, newMethod); 4479 var ret = new Parameter(this.definition, newMethod);
4477 ret.set$type(newType); 4480 ret.set$type(newType);
4478 ret.set$name(this.name); 4481 ret.set$name(this.name);
4479 ret.set$isInitializer(this.isInitializer); 4482 ret.set$isInitializer(this.isInitializer);
4480 return ret; 4483 return ret;
4481 } 4484 }
4482 Parameter.prototype.get$isOptional = function() { 4485 Parameter.prototype.get$isOptional = function() {
(...skipping 8111 matching lines...) Expand 10 before | Expand all | Expand 10 after
12594 } 12597 }
12595 } 12598 }
12596 } 12599 }
12597 // ********** Code for LibraryReader ************** 12600 // ********** Code for LibraryReader **************
12598 function LibraryReader() { 12601 function LibraryReader() {
12599 // Initializers done 12602 // Initializers done
12600 if ($eq($globals.options.config, 'dev')) { 12603 if ($eq($globals.options.config, 'dev')) {
12601 this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'c orelib.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corelib_impl .dart'), 'dart:html', joinPaths($globals.options.libDir, '../../client/html/rele ase/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, '../../clie nt/html/release/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, '../../client/dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options. libDir, 'json.dart')]); 12604 this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'c orelib.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corelib_impl .dart'), 'dart:html', joinPaths($globals.options.libDir, '../../client/html/rele ase/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, '../../clie nt/html/release/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, '../../client/dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options. libDir, 'json.dart')]);
12602 } 12605 }
12603 else if ($eq($globals.options.config, 'sdk')) { 12606 else if ($eq($globals.options.config, 'sdk')) {
12604 this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'c ore/core_frog.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corei mpl/coreimpl_frog.dart'), 'dart:html', joinPaths($globals.options.libDir, 'html/ html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, 'htmlimpl/htmli mpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, 'dom/frog/frog_dom.da rt'), 'dart:json', joinPaths($globals.options.libDir, 'coreimpl/frog/json.dart') ]); 12607 this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'c ore/core_frog.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corei mpl/coreimpl_frog.dart'), 'dart:html', joinPaths($globals.options.libDir, 'html/ html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, 'htmlimpl/htmli mpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, 'dom/frog/frog_dom.da rt'), 'dart:json', joinPaths($globals.options.libDir, 'json/json_frog.dart')]);
12605 } 12608 }
12606 else { 12609 else {
12607 $globals.world.error(('Invalid configuration ' + $globals.options.config)); 12610 $globals.world.error(('Invalid configuration ' + $globals.options.config));
12608 } 12611 }
12609 } 12612 }
12610 LibraryReader.prototype.readFile = function(fullname) { 12613 LibraryReader.prototype.readFile = function(fullname) {
12611 var filename = this._specialLibs.$index(fullname); 12614 var filename = this._specialLibs.$index(fullname);
12612 if (filename == null) { 12615 if (filename == null) {
12613 filename = fullname; 12616 filename = fullname;
12614 } 12617 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
12938 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ ueueEntry_KeyValuePair_K$V); 12941 $inheritsMembers(_DoubleLinkedQueueEntrySentinel_KeyValuePair_K$V, DoubleLinkedQ ueueEntry_KeyValuePair_K$V);
12939 // ********** Globals ************** 12942 // ********** Globals **************
12940 function $static_init(){ 12943 function $static_init(){
12941 } 12944 }
12942 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/; 12945 var const$0 = new NoMoreElementsException()/*const NoMoreElementsException()*/;
12943 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/; 12946 var const$2 = new EmptyQueueException()/*const EmptyQueueException()*/;
12944 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/; 12947 var const$3 = new _DeletedKeySentinel()/*const _DeletedKeySentinel()*/;
12945 var $globals = {}; 12948 var $globals = {};
12946 $static_init(); 12949 $static_init();
12947 main(); 12950 main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698