OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.fletch_codegen_registry; | 5 library dartino_compiler.dartino_codegen_registry; |
6 | 6 |
7 import 'package:compiler/src/compiler.dart' show | 7 import 'package:compiler/src/compiler.dart' show |
8 GlobalDependencyRegistry; | 8 GlobalDependencyRegistry; |
9 | 9 |
10 import 'package:compiler/src/common/codegen.dart' show | 10 import 'package:compiler/src/common/codegen.dart' show |
11 CodegenRegistry; | 11 CodegenRegistry; |
12 | 12 |
13 import 'package:compiler/src/common/registry.dart' show | 13 import 'package:compiler/src/common/registry.dart' show |
14 Registry; | 14 Registry; |
15 | 15 |
16 import 'package:compiler/src/universe/selector.dart' show | 16 import 'package:compiler/src/universe/selector.dart' show |
17 Selector; | 17 Selector; |
18 | 18 |
19 import 'package:compiler/src/universe/use.dart' show | 19 import 'package:compiler/src/universe/use.dart' show |
20 DynamicUse, | 20 DynamicUse, |
21 StaticUse; | 21 StaticUse; |
22 | 22 |
23 import 'package:compiler/src/elements/elements.dart' show | 23 import 'package:compiler/src/elements/elements.dart' show |
24 ClassElement, | 24 ClassElement, |
25 Element, | 25 Element, |
26 FunctionElement, | 26 FunctionElement, |
27 LocalElement; | 27 LocalElement; |
28 | 28 |
29 import 'package:compiler/src/dart_types.dart' show | 29 import 'package:compiler/src/dart_types.dart' show |
30 DartType, | 30 DartType, |
31 InterfaceType; | 31 InterfaceType; |
32 | 32 |
33 import 'fletch_compiler_implementation.dart' show | 33 import 'dartino_compiler_implementation.dart' show |
34 FletchCompilerImplementation; | 34 DartinoCompilerImplementation; |
35 | 35 |
36 import 'fletch_enqueuer.dart' show | 36 import 'dartino_enqueuer.dart' show |
37 FletchEnqueuer; | 37 DartinoEnqueuer; |
38 | 38 |
39 /// Represents ways a function can used as a closure. See also [Closurization] | 39 /// Represents ways a function can used as a closure. See also [Closurization] |
40 /// in [./dynamic_call_enqueuer.dart]. | 40 /// in [./dynamic_call_enqueuer.dart]. |
41 enum ClosureKind { | 41 enum ClosureKind { |
42 // Notes: | 42 // Notes: |
43 // | 43 // |
44 // * We don't need to distinguish between instance/static/top-level | 44 // * We don't need to distinguish between instance/static/top-level |
45 // tear-offs. This information is implicit in the function whose usage is | 45 // tear-offs. This information is implicit in the function whose usage is |
46 // described.. | 46 // described.. |
47 // | 47 // |
(...skipping 18 matching lines...) Expand all Loading... |
66 /// The result of getting an instance method named "call" | 66 /// The result of getting an instance method named "call" |
67 functionLikeTearOff, | 67 functionLikeTearOff, |
68 | 68 |
69 /// A local function (aka closure) that has escaped | 69 /// A local function (aka closure) that has escaped |
70 localFunction, | 70 localFunction, |
71 | 71 |
72 /// The result of getting a super instance function | 72 /// The result of getting a super instance function |
73 superTearOff, | 73 superTearOff, |
74 } | 74 } |
75 | 75 |
76 class FletchRegistry { | 76 class DartinoRegistry { |
77 final FletchEnqueuer world; | 77 final DartinoEnqueuer world; |
78 | 78 |
79 FletchRegistry(FletchCompilerImplementation compiler) | 79 DartinoRegistry(DartinoCompilerImplementation compiler) |
80 : world = compiler.enqueuer.codegen; | 80 : world = compiler.enqueuer.codegen; |
81 | 81 |
82 void registerStaticUse(StaticUse staticUse) { | 82 void registerStaticUse(StaticUse staticUse) { |
83 // TODO(ahe): Call a different method. | 83 // TODO(ahe): Call a different method. |
84 world.registerStaticUse(staticUse); | 84 world.registerStaticUse(staticUse); |
85 } | 85 } |
86 | 86 |
87 void registerInstantiatedClass(ClassElement element) { | 87 void registerInstantiatedClass(ClassElement element) { |
88 world.registerInstantiatedType(element.rawType); | 88 world.registerInstantiatedType(element.rawType); |
89 } | 89 } |
(...skipping 27 matching lines...) Expand all Loading... |
117 assert(function.isInstanceMember); | 117 assert(function.isInstanceMember); |
118 assert(function.name == "call"); | 118 assert(function.name == "call"); |
119 break; | 119 break; |
120 | 120 |
121 case ClosureKind.localFunction: | 121 case ClosureKind.localFunction: |
122 assert(function.memberContext != function); | 122 assert(function.memberContext != function); |
123 } | 123 } |
124 world.dynamicCallEnqueuer.enqueueClosure(function, kind); | 124 world.dynamicCallEnqueuer.enqueueClosure(function, kind); |
125 } | 125 } |
126 } | 126 } |
OLD | NEW |