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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart

Issue 762213002: Support top-level field declaration and assignment in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 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: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
index d5bad5dbef60864dcb65d8fc50635e5cd30f4be0..b3ad911bc2b9b5f008e77e18f22faeb12cffcef3 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart
@@ -534,18 +534,23 @@ class IrBuilder {
}
/// Create a [ir.FieldDefinition] for the current [Element] using [_root] as
- /// the body.
- ir.FieldDefinition makeFieldDefinition() {
- return new ir.FieldDefinition(state.currentElement,
- state.returnContinuation,
- _root);
+ /// the body using [initializer] as the initial value.
+ ir.FieldDefinition makeFieldDefinition(ir.Primitive initializer) {
+ if (initializer == null) {
+ return new ir.FieldDefinition.withoutInitializer(state.currentElement);
+ } else {
+ buildReturn(initializer);
+ return new ir.FieldDefinition(state.currentElement,
+ state.returnContinuation,
+ _root);
+ }
}
/// Create a [ir.FunctionDefinition] for [element] using [_root] as the body.
///
/// Parameters must be created before the construction of the body using
/// [createParameter].
- ir.FunctionDefinition buildFunctionDefinition(
+ ir.FunctionDefinition makeFunctionDefinition(
List<ConstantExpression> defaults) {
FunctionElement element = state.currentElement;
if (element.isAbstract || element.isExternal) {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/constant_propagation.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698