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

Side by Side Diff: pkg/fletchc/lib/src/fletch_registry.dart

Issue 1450393002: Roll sdk dependency to 34357cdad108dcba734949bd13bd28c76ea285e0 (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Update status files Created 5 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 unified diff | Download patch
OLDNEW
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.fletch_codegen_registry; 5 library fletchc.fletch_codegen_registry;
6 6
7 import 'package:compiler/src/dart2jslib.dart' show 7 import 'package:compiler/src/compiler.dart' show
8 CodegenRegistry, 8 GlobalDependencyRegistry;
9
10 import 'package:compiler/src/common/codegen.dart' show
11 CodegenRegistry;
12
13 import 'package:compiler/src/common/registry.dart' show
9 Registry; 14 Registry;
10 15
11 import 'package:compiler/src/constants/values.dart' show 16 import 'package:compiler/src/universe/selector.dart' show
12 ConstantValue; 17 Selector;
13 18
14 import 'package:compiler/src/universe/universe.dart' show 19 import 'package:compiler/src/universe/use.dart' show
15 Selector, 20 DynamicUse,
16 UniverseSelector; 21 StaticUse;
ahe 2015/12/01 10:12:13 Shouldn't be imported here.
sigurdm 2015/12/03 14:48:10 Done.
17 22
18 import 'package:compiler/src/elements/elements.dart' show 23 import 'package:compiler/src/elements/elements.dart' show
19 ClassElement, 24 ClassElement,
20 Element, 25 Element,
21 FunctionElement, 26 FunctionElement,
22 LocalElement; 27 LocalElement;
23 28
24 import 'package:compiler/src/resolution/resolution.dart' show
25 TreeElements;
26
27 import 'package:compiler/src/dart_types.dart' show 29 import 'package:compiler/src/dart_types.dart' show
28 DartType, 30 DartType,
29 InterfaceType; 31 InterfaceType;
30 32
31 import 'package:compiler/src/util/util.dart' show
32 Setlet;
33
34 import 'fletch_backend.dart' show
35 FletchBackend;
36
37 import 'fletch_compiler_implementation.dart' show 33 import 'fletch_compiler_implementation.dart' show
38 FletchCompilerImplementation; 34 FletchCompilerImplementation;
39 35
40 import 'fletch_enqueuer.dart' show 36 import 'fletch_enqueuer.dart' show
41 FletchEnqueuer; 37 FletchEnqueuer;
42 38
43 /// 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]
44 /// in [./dynamic_call_enqueuer.dart]. 40 /// in [./dynamic_call_enqueuer.dart].
45 enum ClosureKind { 41 enum ClosureKind {
46 // Notes: 42 // Notes:
(...skipping 23 matching lines...) Expand all
70 /// The result of getting an instance method named "call" 66 /// The result of getting an instance method named "call"
71 functionLikeTearOff, 67 functionLikeTearOff,
72 68
73 /// A local function (aka closure) that has escaped 69 /// A local function (aka closure) that has escaped
74 localFunction, 70 localFunction,
75 71
76 /// The result of getting a super instance function 72 /// The result of getting a super instance function
77 superTearOff, 73 superTearOff,
78 } 74 }
79 75
80 get _notImplemented => throw "not implemented"; 76 class FletchRegistry {
81
82 abstract class FletchRegistry {
83 final FletchEnqueuer world; 77 final FletchEnqueuer world;
84 78
85 factory FletchRegistry( 79 FletchRegistry(FletchCompilerImplementation compiler)
86 FletchCompilerImplementation compiler, 80 : world = compiler.enqueuer.codegen;
87 TreeElements treeElements) = FletchRegistryImplementation;
88 81
89 FletchRegistry.internal(this.world); 82 void registerStaticUse(StaticUse staticUse) {
ahe 2015/12/01 10:12:13 Also think this is the wrong API.
sigurdm 2015/12/03 14:48:10 Done.
90
91 Registry get asRegistry;
92
93 void registerStaticInvocation(Element element) {
94 // TODO(ahe): Call a different method. 83 // TODO(ahe): Call a different method.
95 world.registerStaticUse(element); 84 world.registerStaticUse(staticUse);
96 } 85 }
97 86
98 void registerInstantiatedClass(ClassElement element) { 87 void registerInstantiatedClass(ClassElement element) {
99 world.registerInstantiatedType(element.rawType, this.asRegistry); 88 world.registerInstantiatedType(element.rawType);
100 } 89 }
101 90
102 void registerDynamicSetter(UniverseSelector selector) { 91 void registerDynamicUse(Selector selector) {
103 world.registerDynamicSetter(selector); 92 world.registerDynamicUse(new DynamicUse(selector, null));
ahe 2015/12/01 10:12:13 Shouldn't instantiate DynamicUse.
sigurdm 2015/12/03 14:48:10 Done.
104 }
105
106 void registerDynamicGetter(UniverseSelector selector) {
107 world.registerDynamicGetter(selector);
108 }
109
110 void registerDynamicInvocation(UniverseSelector selector) {
111 world.registerDynamicInvocation(selector);
112 } 93 }
113 94
114 void registerInstantiatedType(InterfaceType type) { 95 void registerInstantiatedType(InterfaceType type) {
115 world.registerInstantiatedType(type, this.asRegistry); 96 world.registerInstantiatedType(type);
116 } 97 }
117 98
118 void registerIsCheck(DartType type) { 99 void registerIsCheck(DartType type) {
119 world.registerIsCheck(type); 100 world.registerIsCheck(type);
120 } 101 }
121 102
122 void registerLocalInvoke(LocalElement element, Selector selector) { 103 void registerLocalInvoke(LocalElement element, Selector selector) {
123 world.recordElementUsage(element, selector); 104 world.recordElementUsage(element, selector);
124 } 105 }
125 106
(...skipping 10 matching lines...) Expand all
136 assert(function.isInstanceMember); 117 assert(function.isInstanceMember);
137 assert(function.name == "call"); 118 assert(function.name == "call");
138 break; 119 break;
139 120
140 case ClosureKind.localFunction: 121 case ClosureKind.localFunction:
141 assert(function.memberContext != function); 122 assert(function.memberContext != function);
142 } 123 }
143 world.dynamicCallEnqueuer.enqueueClosure(function, kind); 124 world.dynamicCallEnqueuer.enqueueClosure(function, kind);
144 } 125 }
145 } 126 }
146
147 @proxy
148 class FletchRegistryImplementation extends FletchRegistry
149 implements CodegenRegistry {
150 final TreeElements treeElements;
151
152 FletchRegistryImplementation(
153 FletchCompilerImplementation compiler,
154 this.treeElements)
155 : super.internal(compiler.enqueuer.codegen);
156
157 Registry get asRegistry => this;
158
159 noSuchMethod(invocation) => super.noSuchMethod(invocation);
160
161 // TODO(ahe): Remove this method, called by [Enqueuer], not [FletchEnqueuer].
162 void registerDependency(Element element) {
163 treeElements.registerDependency(element);
164 }
165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698