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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: frog/minfrog
diff --git a/frog/minfrog b/frog/minfrog
index 1e2b9bdda7a01eae2c83c41e9d9bc8b7abe6cf91..e83e526a8c372873dbd59ec06ddae17b86d04ab3 100755
--- a/frog/minfrog
+++ b/frog/minfrog
@@ -4470,6 +4470,9 @@ Parameter.prototype.genValue = function(method, context) {
context = new MethodGenerator(method, null);
}
this.value = this.definition.value.visit(context);
+ if (!this.value.get$isConst()) {
+ $globals.world.error('default arguments must be constant', this.value.span);
+ }
this.value = this.value.convertTo(context, this.type, this.definition.value, false);
}
Parameter.prototype.copyWithNewType = function(newMethod, newType) {
@@ -12601,7 +12604,7 @@ function LibraryReader() {
this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'corelib.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'corelib_impl.dart'), 'dart:html', joinPaths($globals.options.libDir, '../../client/html/release/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, '../../client/html/release/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, '../../client/dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options.libDir, 'json.dart')]);
}
else if ($eq($globals.options.config, 'sdk')) {
- this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'core/core_frog.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'coreimpl/coreimpl_frog.dart'), 'dart:html', joinPaths($globals.options.libDir, 'html/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, 'htmlimpl/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, 'dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options.libDir, 'coreimpl/frog/json.dart')]);
+ this._specialLibs = _map(['dart:core', joinPaths($globals.options.libDir, 'core/core_frog.dart'), 'dart:coreimpl', joinPaths($globals.options.libDir, 'coreimpl/coreimpl_frog.dart'), 'dart:html', joinPaths($globals.options.libDir, 'html/html.dart'), 'dart:htmlimpl', joinPaths($globals.options.libDir, 'htmlimpl/htmlimpl.dart'), 'dart:dom', joinPaths($globals.options.libDir, 'dom/frog/frog_dom.dart'), 'dart:json', joinPaths($globals.options.libDir, 'json/json_frog.dart')]);
}
else {
$globals.world.error(('Invalid configuration ' + $globals.options.config));

Powered by Google App Engine
This is Rietveld 408576698