Permalink
Browse files

find enhancements

  • Loading branch information...
1 parent be08afb commit 81329eea996f5670fe316eac96bbc8d59f371b95 @kprevas committed Mar 25, 2012
@@ -15,6 +15,7 @@
import gw.lang.reflect.IType;
import gw.lang.reflect.TypeSystem;
import gw.lang.reflect.gs.IGosuClass;
+import gw.lang.reflect.gs.IGosuEnhancement;
import gw.util.GosuClassUtil;
import org.apache.commons.io.FileUtils;
@@ -146,6 +147,11 @@ private static void findReferencedTypes(IGosuClass gsClass, Set<IGosuClass> gosu
findReferencedTypes((IGosuClass) innerClass, gosuClasses);
}
}
+ List<? extends IGosuEnhancement> enhancements =
+ gsClass.getTypeLoader().getEnhancementIndex().getEnhancementsForGenericType(gsClass);
+ for (IGosuEnhancement enhancement : enhancements) {
+ findReferencedTypes(enhancement, gosuClasses);
+ }
List<ITypeLiteralExpression> results = new ArrayList<ITypeLiteralExpression>();
IClassFileStatement classFileStatement = gsClass.getClassStatement().getClassFileStatement();
if (classFileStatement != null) {
@@ -68,6 +68,7 @@
import gw.util.GosuClassUtil;
import java.lang.reflect.Method;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -827,12 +828,13 @@ private void transformCompositeExpression(StringBuilder builder, IRCompositeExpr
.append("(");
appendSymbolsAsParams(auxMethodsBuilder, symbols, false);
auxMethodsBuilder.append(") {\n");
+ HashMap<String,IRSymbol> tempSymbols = Maps.newHashMap(symbols);
for (IRElement element : elements) {
if (element instanceof IRStatement) {
- appendStatement(auxMethodsBuilder, (IRStatement) element, symbols);
+ appendStatement(auxMethodsBuilder, (IRStatement) element, tempSymbols);
} else {
auxMethodsBuilder.append("return ");
- appendExpression(auxMethodsBuilder, (IRExpression) element, symbols);
+ appendExpression(auxMethodsBuilder, (IRExpression) element, tempSymbols);
auxMethodsBuilder.append(";\n");
}
}
@@ -12,8 +12,11 @@ class GwtTest implements EntryPoint {
* This is the entry point method.
*/
override function onModuleLoad() {
- var label = new Label(new OtherClientClass().Label)
+ var other = new OtherClientClass()
+ var label = new Label(other.Label)
RootPanel.get("main").add(label)
+ var label2 = new Label(other.enhx())
+ RootPanel.get("main").add(label2)
var builder = new RequestBuilder(RequestBuilder.GET, "Main/data")
builder.sendRequest(null, new RequestCallback() {
override function onError(req : Request, e : Throwable) {
@@ -0,0 +1,9 @@
+package client
+
+enhancement OtherClientClassEnhx : OtherClientClass {
+
+ function enhx() : String {
+ return "!"
+ }
+
+}

0 comments on commit 81329ee

Please sign in to comment.