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

Unified Diff: dart/frog/leg/compiler.dart

Issue 9315028: Support default values for optional parameters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: dart/frog/leg/compiler.dart
===================================================================
--- dart/frog/leg/compiler.dart (revision 3786)
+++ dart/frog/leg/compiler.dart (working copy)
@@ -212,7 +212,8 @@
String codegen(WorkItem work) {
String code;
- if (work.element.kind == ElementKind.FIELD) {
+ if (work.element.kind == ElementKind.FIELD
+ || work.element.kind == ElementKind.PARAMETER) {
compileTimeConstantHandler.compileWorkItem(work);
return null;
} else {
@@ -271,6 +272,14 @@
return resolver.resolveSignature(element);
}
+ Object compileVariable(VariableElement element) {
+ Element savedElement = currentElement;
floitsch 2012/02/01 14:35:39 why is this necessary?
ngeoffray 2012/02/01 15:54:59 To get proper error messages if the work item gene
+ currentElement = element;
+ compile(new WorkItem.toCompile(element));
+ currentElement = savedElement;
+ return compileTimeConstantHandler.compileVariable(element);
+ }
+
reportWarning(Node node, var message) {}
reportError(Node node, var message) {}

Powered by Google App Engine
This is Rietveld 408576698