| OLD | NEW |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library fletchc.lazy_field_initializer_codegen; | 5 library fletchc.lazy_field_initializer_codegen; |
| 6 | 6 |
| 7 import 'package:compiler/src/dart2jslib.dart' show | 7 import 'package:compiler/src/dart2jslib.dart' show |
| 8 MessageKind, | 8 MessageKind, |
| 9 Registry; | 9 Registry; |
| 10 | 10 |
| 11 import 'package:compiler/src/elements/elements.dart'; | 11 import 'package:compiler/src/elements/elements.dart'; |
| 12 import 'package:compiler/src/resolution/resolution.dart'; | 12 import 'package:compiler/src/resolution/resolution.dart'; |
| 13 import 'package:compiler/src/tree/tree.dart'; | 13 import 'package:compiler/src/tree/tree.dart'; |
| 14 | 14 |
| 15 import 'fletch_context.dart'; | 15 import 'fletch_context.dart'; |
| 16 | 16 |
| 17 import 'compiled_function.dart' show | 17 import 'fletch_function_builder.dart' show |
| 18 CompiledFunction; | 18 FletchFunctionBuilder; |
| 19 | 19 |
| 20 import 'closure_environment.dart'; | 20 import 'closure_environment.dart'; |
| 21 | 21 |
| 22 import 'codegen_visitor.dart'; | 22 import 'codegen_visitor.dart'; |
| 23 | 23 |
| 24 class LazyFieldInitializerCodegen extends CodegenVisitor { | 24 class LazyFieldInitializerCodegen extends CodegenVisitor { |
| 25 | 25 |
| 26 LazyFieldInitializerCodegen(CompiledFunction compiledFunction, | 26 LazyFieldInitializerCodegen(FletchFunctionBuilder functionBuilder, |
| 27 FletchContext context, | 27 FletchContext context, |
| 28 TreeElements elements, | 28 TreeElements elements, |
| 29 Registry registry, | 29 Registry registry, |
| 30 ClosureEnvironment closureEnvironment, | 30 ClosureEnvironment closureEnvironment, |
| 31 FieldElement field) | 31 FieldElement field) |
| 32 : super(compiledFunction, context, elements, registry, | 32 : super(functionBuilder, context, elements, registry, |
| 33 closureEnvironment, field); | 33 closureEnvironment, field); |
| 34 | 34 |
| 35 FieldElement get field => element; | 35 FieldElement get field => element; |
| 36 | 36 |
| 37 void compile() { | 37 void compile() { |
| 38 Node initializer = field.initializer; | 38 Node initializer = field.initializer; |
| 39 visitForValue(initializer); | 39 visitForValue(initializer); |
| 40 // TODO(ajohnsen): Add cycle detection. | 40 // TODO(ajohnsen): Add cycle detection. |
| 41 builder | 41 builder |
| 42 ..storeStatic(context.getStaticFieldIndex(field, null)) | 42 ..storeStatic(context.getStaticFieldIndex(field, null)) |
| 43 ..ret() | 43 ..ret() |
| 44 ..methodEnd(); | 44 ..methodEnd(); |
| 45 } | 45 } |
| 46 } | 46 } |
| OLD | NEW |