| Index: pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
|
| diff --git a/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart b/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
|
| index 8a86eda794f38ae280b234949db7f41412ce990d..1539ba8b4f8cbd02169ca321156a86fafe28e74f 100644
|
| --- a/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
|
| +++ b/pkg/compiler/lib/src/dart_backend/backend_ast_emitter.dart
|
| @@ -80,22 +80,26 @@ class ASTEmitter extends tree.Visitor<dynamic, Expression> {
|
|
|
| FieldDefinition emitField(tree.FieldDefinition definition) {
|
| currentElement = definition.element;
|
| - visitStatement(definition.body);
|
| - List<Statement> bodyParts;
|
| - for (tree.Variable variable in variableNames.keys) {
|
| - if (!declaredVariables.contains(variable)) {
|
| - addDeclaration(variable);
|
| + Expression initializer;
|
| + if (definition.hasInitializer) {
|
| + visitStatement(definition.body);
|
| + List<Statement> bodyParts;
|
| + for (tree.Variable variable in variableNames.keys) {
|
| + if (!declaredVariables.contains(variable)) {
|
| + addDeclaration(variable);
|
| + }
|
| }
|
| - }
|
| - if (variables.length > 0) {
|
| - bodyParts = new List<Statement>();
|
| - bodyParts.add(new VariableDeclarations(variables));
|
| - bodyParts.addAll(statementBuffer);
|
| - } else {
|
| - bodyParts = statementBuffer;
|
| + if (variables.length > 0) {
|
| + bodyParts = new List<Statement>();
|
| + bodyParts.add(new VariableDeclarations(variables));
|
| + bodyParts.addAll(statementBuffer);
|
| + } else {
|
| + bodyParts = statementBuffer;
|
| + }
|
| + initializer = ensureExpression(bodyParts);
|
| }
|
|
|
| - return new FieldDefinition(definition.element, ensureExpression(bodyParts));
|
| + return new FieldDefinition(definition.element, initializer);
|
| }
|
|
|
| /// Returns an expression that will evaluate all of [bodyParts].
|
|
|