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

Unified Diff: frog/leg/emitter.dart

Issue 9382041: Support getting of static functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comments. Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/lib/core.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/emitter.dart
diff --git a/frog/leg/emitter.dart b/frog/leg/emitter.dart
index c6642c1eef92307123593607d40b110f1100b5dc..b227b497fb3a0e1fc193f0dc71dc6c380bda0188 100644
--- a/frog/leg/emitter.dart
+++ b/frog/leg/emitter.dart
@@ -266,6 +266,28 @@ function(child, parent) {
namer.isolateBailoutPropertyAccess);
}
+ void emitStaticFunctionGetters(StringBuffer buffer) {
+ Set<FunctionElement> functionsNeedingGetter =
+ compiler.universe.staticFunctionsNeedingGetter;
+ for (FunctionElement element in functionsNeedingGetter) {
+ // The static function does not have the correct name. Since
+ // [addParameterStubs] use the name to create its stubs we simply
+ // create a fake element with the correct name.
+ // Note: the callElement will not have the correct modifiers (in case
+ // of static functions) and will not have any enclosingElement.
+ FunctionElement callElement =
+ new FunctionElement.from(Namer.CLOSURE_INVOCATION_NAME,
+ element,
+ null);
+ String staticName = namer.isolatePropertyAccess(element);
+ int parameterCount = element.parameterCount(compiler);
+ String invocationName =
+ namer.instanceMethodName(callElement.name, parameterCount);
+ buffer.add("$staticName.$invocationName = $staticName;\n");
+ addParameterStubs(callElement, staticName, buffer);
+ }
+ }
+
void emitStaticNonFinalFieldInitializations(StringBuffer buffer) {
// Adds initializations inside the Isolate constructor.
// Example:
@@ -357,6 +379,7 @@ function(child, parent) {
emitClasses(buffer);
emitNoSuchMethodCalls(buffer);
emitStaticFunctions(buffer);
+ emitStaticFunctionGetters(buffer);
emitStaticFinalFieldInitializations(buffer);
buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
Element main = compiler.mainApp.find(Compiler.MAIN);
« no previous file with comments | « frog/leg/compiler.dart ('k') | frog/leg/lib/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698