use of kalang.antlr.KalangParser.MethodDeclContext in project kalang by kasonyang.
the class ClassNodeMetaBuilder method visitScriptDef.
@Override
public Object visitScriptDef(KalangParser.ScriptDefContext ctx) {
// FIXME fix filename
// thisClazz.fileName = this.compilationUnit.getSource().getFileName();
thisClazz.setSuperType(this.getScriptType());
List<MethodDeclContext> mds = ctx.methodDecl();
if (mds != null) {
for (MethodDeclContext m : mds) {
visit(m);
}
}
MethodNode mm = thisClazz.createMethodNode(Types.VOID_TYPE, "execute", Modifier.PUBLIC);
mm.addExceptionType(Types.getExceptionClassType());
method = mm;
List<KalangParser.StatContext> stats = ctx.stat();
if (stats != null) {
this.methodStatsContexts.put(mm, stats.toArray(new KalangParser.StatContext[stats.size()]));
}
AstUtil.createEmptyConstructor(thisClazz);
AstUtil.createScriptMainMethodIfNotExists(thisClazz);
return null;
}
Aggregations