}else{
block = new WeaselBlockInfo(false, -paramNames.size());
block.newVar(0, "this", classCompiler.genericClass);
}
for(int i=0; i<paramNames.size(); i++){
WeaselGenericMethod2 genericMethod = classCompiler.genericClass.getGenericMethod(method.getNameAndDesk(), null);
block.newVar(paramModifier.get(i), paramNames.get(i), genericMethod.getGenericParams()[i]);
}
WeaselInstructionList instructions = new WeaselInstructionList();
ListIterator<WeaselToken> iterator = methodTokens.listIterator();
if(method.getName().equals("<preInit>")){
if(method.getParentClass().getSuperClass()!=null){
instructions.add(0, new WeaselInstructionLoadVariable(getVariable("this").pos));
instructions.add(0, new WeaselInstructionInvoke(method.getParentClass().getSuperClass().getRealName()+".<preInit>()"));
}
}else if(method.getName().equals("<init>")){
boolean auto = true;
if(iterator.hasNext()){
WeaselToken token = iterator.next();
if(token!=null && token.tokenType==WeaselTokenType.KEYWORD){
if(iterator.next().tokenType==WeaselTokenType.OPENBRACKET){
try{
if(token.param==WeaselKeyWord.THIS){
superCaller = false;
auto = false;
WeaselTree tree = WeaselTree.parse(iterator, WeaselTokenType.CLOSEBRACKET);
List<WeaselGenericMethod2> methods = classCompiler.genericClass.getGenericMethodsOfThis("<init>", true);
WeaselParameterCompileReturn wpcr = WeaselTree.compileParamList(token.line, "<init>", compiler, this, tree, methods);
instructions.addAll(wpcr.instructions);
instructions.add(token.line, new WeaselInstructionInvoke(wpcr.method.getMethod().getMethod().getClassNameAndDesk()));
token = iterator.next();
if(token.tokenType!=WeaselTokenType.SEMICOLON)
throw new WeaselCompilerException(token.line, "Expect ; but got %s", token);
}else if(token.param==WeaselKeyWord.SUPER){
superCaller = true;
auto = false;
WeaselTree tree = WeaselTree.parse(iterator, WeaselTokenType.CLOSEBRACKET);
List<WeaselGenericMethod2> methods = classCompiler.genericClass.getGenericSuperClass().getGenericMethodsOfThis("<init>", true);
WeaselParameterCompileReturn wpcr = WeaselTree.compileParamList(token.line, "<init>", compiler, this, tree, methods);
instructions.addAll(wpcr.instructions);
instructions.add(token.line, new WeaselInstructionInvoke(wpcr.method.getMethod().getMethod().getClassNameAndDesk()));
token = iterator.next();
if(token.tokenType!=WeaselTokenType.SEMICOLON)
throw new WeaselCompilerException(token.line, "Expect ; but got %s", token);
}else{
iterator.previous();
iterator.previous();
}
}catch(WeaselCompilerException e){
compiler.addWeaselCompilerMessage(new WeaselCompilerMessage(MessageType.ERROR, e.getLine(), parentClass.getFileName(), e.getMessage()));
iterator.previous();
token = iterator.next();
while(token.tokenType!=WeaselTokenType.SEMICOLON && iterator.hasNext()){
token = iterator.next();
}
}
}else{
iterator.previous();
iterator.previous();
}
}else{
iterator.previous();
}
}
if(auto){
superCaller = true;
if(classCompiler.genericClass.getGenericSuperClass()!=null){
WeaselGenericMethod2 method = classCompiler.genericClass.getGenericSuperClass().getGenericMethodOfThis("<init>()", new WeaselGenericClass[0]);
if(method==null){
compiler.addWeaselCompilerMessage(
new WeaselCompilerMessage(MessageType.ERROR, 0, parentClass.getFileName(),
String.format("No default constructor in %s found", classCompiler.genericClass.getGenericSuperClass())));
}else{
instructions.add(0, new WeaselInstructionInvoke(method.getMethod().getMethod().getClassNameAndDesk()));
}
}
}
}
while(iterator.hasNext()){