Revision: 10039
Author: gwt.mirror...@gmail.com
Date: Wed Apr 20 11:54:19 2011
Log: Implement EntryMethodHolder.init in source.
Stub out EntryMethodHolder.init() so we can use the existing empty method
instead of having to create it from whole cloth.
http://gwt-code-reviews.appspot.com/1421803/
http://code.google.com/p/google-web-toolkit/source/detail?r=10039
Modified:
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
/trunk/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
=======================================
---
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
Tue Apr 19 10:10:18 2011
+++
/trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
Wed Apr 20 11:54:19 2011
@@ -872,7 +872,7 @@
return dependencyRecorder;
}
- private static JMethodCall createReboundModuleLoad(TreeLogger logger,
+ private static JMethodCall createReboundModuleLoad(TreeLogger logger,
SourceInfo info,
JDeclaredType reboundEntryType, String originalMainClassName,
JDeclaredType enclosingType)
throws UnableToCompleteException {
if (!(reboundEntryType instanceof JClassType)) {
@@ -902,10 +902,9 @@
throw new UnableToCompleteException();
}
- SourceInfo sourceInfo = entryClass.getSourceInfo();
JExpression qualifier = null;
if (!entryMethod.isStatic()) {
- qualifier = JGwtCreate.createInstantiationExpression(sourceInfo,
entryClass, enclosingType);
+ qualifier = JGwtCreate.createInstantiationExpression(info,
entryClass, enclosingType);
if (qualifier == null) {
logger.log(TreeLogger.ERROR,
@@ -915,21 +914,17 @@
throw new UnableToCompleteException();
}
}
- return new JMethodCall(sourceInfo, qualifier, entryMethod);
+ return new JMethodCall(info, qualifier, entryMethod);
}
private static void findEntryPoints(TreeLogger logger,
RebindPermutationOracle rpo,
String[] mainClassNames, JProgram program) throws
UnableToCompleteException {
Event findEntryPointsEvent =
SpeedTracerLogger.start(CompilerEventType.FIND_ENTRY_POINTS);
- SourceInfo sourceInfo =
program.createSourceInfoSynthetic(JavaToJavaScriptCompiler.class);
- JMethod bootStrapMethod =
- program.createMethod(sourceInfo, "init",
program.getIndexedType("EntryMethodHolder"),
- program.getTypeVoid(), false, true, true, false, false);
- bootStrapMethod.freezeParamTypes();
- bootStrapMethod.setSynthetic();
+ JMethod bootStrapMethod =
program.getIndexedMethod("EntryMethodHolder.init");
JMethodBody body = (JMethodBody) bootStrapMethod.getBody();
JBlock block = body.getBlock();
+ SourceInfo info = block.getSourceInfo().makeChild();
// Also remember $entry, which we'll handle specially in GenerateJsAst
JMethod registerEntry = program.getIndexedMethod("Impl.registerEntry");
@@ -947,7 +942,7 @@
JMethod mainMethod = findMainMethod(mainType);
if (mainMethod != null && mainMethod.isStatic()) {
- JMethodCall onModuleLoadCall = new JMethodCall(null, null,
mainMethod);
+ JMethodCall onModuleLoadCall = new JMethodCall(info, null,
mainMethod);
block.addStmt(onModuleLoadCall.makeStatement());
continue;
}
@@ -965,7 +960,7 @@
}
JMethodCall onModuleLoadCall =
- createReboundModuleLoad(logger, resultType, mainClassName,
bootStrapMethod
+ createReboundModuleLoad(logger, info, resultType,
mainClassName, bootStrapMethod
.getEnclosingType());
resultTypes.add((JClassType) resultType);
entryCalls.add(onModuleLoadCall);
@@ -974,7 +969,7 @@
block.addStmt(entryCalls.get(0).makeStatement());
} else {
JReboundEntryPoint reboundEntryPoint =
- new JReboundEntryPoint(mainType.getSourceInfo(), mainType,
resultTypes, entryCalls);
+ new JReboundEntryPoint(info, mainType, resultTypes,
entryCalls);
block.addStmt(reboundEntryPoint);
}
}
=======================================
---
/trunk/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
Fri Oct 10 08:56:20 2008
+++
/trunk/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
Wed Apr 20 11:54:19 2011
@@ -19,5 +19,7 @@
* This class holds the boot strap entry method that the compiler
generates.
*/
public class EntryMethodHolder {
-
-}
+ public static final void init() {
+ // Filled in by the compiler to call entry methods.
+ }
+}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors