Skip to content

Commit 8a9a78e

Browse files
committed
Thanks java...
1 parent eb11c5e commit 8a9a78e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/java/org/luapp/language/handlers/ClassBodyHandler.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.antlr.v4.runtime.ParserRuleContext;
44
import org.antlr.v4.runtime.tree.ParseTree;
5+
import org.antlr.v4.runtime.tree.TerminalNodeImpl;
56
import org.luapp.language.generator.luappParser;
67
import org.luapp.language.listeners.LuaPPListener;
78

@@ -12,15 +13,15 @@ public ClassBodyHandler() {
1213
}
1314

1415
public boolean isClassFunction(ParseTree context){
15-
return context instanceof luappParser.ClassfunctionContext;
16+
return ((ParserRuleContext)context).getRuleIndex() == luappParser.RULE_classfunction;
1617
}
1718

1819
public boolean isClassGetSet(ParseTree context){
19-
return context instanceof luappParser.ClassgetsetContext;
20+
return ((ParserRuleContext)context).getRuleIndex() == luappParser.RULE_classgetset;
2021
}
2122

2223
public boolean isClassConstructor(ParseTree context){
23-
return context instanceof luappParser.ConstructorContext;
24+
return ((ParserRuleContext)context).getRuleIndex() == luappParser.RULE_constructor;
2425
}
2526

2627

@@ -38,10 +39,14 @@ public void onEnterContext(ParserRuleContext enterContext) {
3839
return;
3940
}
4041
for (ParseTree child : enterContext.children) {
42+
if(child instanceof TerminalNodeImpl) continue;
4143
if(isClassFunction(child)){
4244
System.out.println("Class function");
4345
}else if(isClassConstructor(child)){
44-
System.out.println("Constructor");
46+
System.out.println("Constructor!");
47+
this.listenerManager
48+
.GetInstangeByTarget(luappParser.RULE_constructor)
49+
.handleEnterContext((ParserRuleContext)child);
4550
}else if(isClassGetSet(child)){
4651
System.out.println("Get/Set");
4752
}

0 commit comments

Comments
 (0)