Index: pkg/fletchc/lib/src/fletch_backend.dart |
diff --git a/pkg/fletchc/lib/src/fletch_backend.dart b/pkg/fletchc/lib/src/fletch_backend.dart |
index 60b5163eb3ebf8f50187ff2ec62efa1a75452b94..ce378a523bc03abac206f9532ff7cee73eb32334 100644 |
--- a/pkg/fletchc/lib/src/fletch_backend.dart |
+++ b/pkg/fletchc/lib/src/fletch_backend.dart |
@@ -50,6 +50,7 @@ import 'package:compiler/src/elements/elements.dart' show |
FunctionTypedElement, |
LibraryElement, |
MemberElement, |
+ MethodElement, |
Name, |
ParameterElement, |
PublicName; |
@@ -466,11 +467,7 @@ class FletchBackend extends Backend |
void onElementResolved(Element element, TreeElements elements) { |
if (alwaysEnqueue.contains(element)) { |
var registry = new FletchRegistry(compiler); |
- if (element.isStatic || element.isTopLevel) { |
- registry.registerStaticUse(new StaticUse.foreignUse(element)); |
- } else { |
- registry.registerDynamicUse(new Selector.fromElement(element)); |
- } |
+ registry.registerStaticInvocation(element); |
} |
} |
@@ -931,7 +928,7 @@ class FletchBackend extends Backend |
FunctionElement function, |
TreeElements elements, |
FletchRegistry registry) { |
- registry.registerStaticUse(new StaticUse.foreignUse(fletchSystemEntry)); |
+ registry.registerStaticInvocation(fletchSystemEntry); |
ClosureEnvironment closureEnvironment = createClosureEnvironment( |
function, |
@@ -965,13 +962,14 @@ class FletchBackend extends Backend |
} |
if (functionBuilder.isInstanceMember && !function.isGenerativeConstructor) { |
+ Name name = function is MethodElement |
+ ? function.memberName |
+ : new Name(functionBuilder.name, function.library); |
// Inject the function into the method table of the 'holderClass' class. |
// Note that while constructor bodies has a this argument, we don't inject |
// them into the method table. |
- String symbol = context.getSymbolForFunction( |
- functionBuilder.name, |
- function.functionSignature, |
- function.library); |
+ String symbol = context.getSymbolForFunction(name, |
+ function.functionSignature); |
int id = context.getSymbolId(symbol); |
int arity = function.functionSignature.parameterCount; |
SelectorKind kind = SelectorKind.Method; |
@@ -1032,14 +1030,14 @@ class FletchBackend extends Backend |
coroutineClass.lookupLocalMember("_coroutineStart"); |
Selector selector = new Selector.fromElement(coroutineStart); |
new FletchRegistry(compiler) |
- ..registerDynamicUse(selector); |
+ ..registerDynamicSelector(selector); |
} else if (name == "Process._spawn") { |
// The native method `Process._spawn` will do a closure invoke with 0, 1, |
// or 2 arguments. |
new FletchRegistry(compiler) |
- ..registerDynamicUse(new Selector.callClosure(0)) |
- ..registerDynamicUse(new Selector.callClosure(1)) |
- ..registerDynamicUse(new Selector.callClosure(2)); |
+ ..registerDynamicSelector(new Selector.callClosure(0)) |
+ ..registerDynamicSelector(new Selector.callClosure(1)) |
+ ..registerDynamicSelector(new Selector.callClosure(2)); |
} |
int arity = codegen.assembler.functionArity; |
@@ -1180,7 +1178,7 @@ class FletchBackend extends Backend |
createTearoffClass(createFletchFunctionBuilder(function)); |
// Be sure to actually enqueue the function for compilation. |
FletchRegistry registry = new FletchRegistry(compiler); |
- registry.registerStaticUse(new StaticUse.foreignUse(function)); |
+ registry.registerStaticInvocation(function); |
} |
FletchFunctionBase createParameterStubFor( |
@@ -1308,7 +1306,7 @@ class FletchBackend extends Backend |
if (function.element != null) { |
library = function.element.library; |
} |
- // TODO(sigurdm): Avoid allocating new name here. |
+ // TODO(sigurdm): Avoid allocating new Name and Selector here. |
Name name = new Name(function.name, library); |
int fletchSelector = context.toFletchSelector( |
new Selector.getter(name)); |
@@ -1680,7 +1678,6 @@ class FletchBackend extends Backend |
Uri resolvePatchUri(String libraryName, Uri libraryRoot) { |
throw "Not implemented"; |
} |
- |
} |
class FletchImpactTransformer extends ImpactTransformer { |