Scope scope =
fieldAttrs.visibility == Visibility.PUBLIC ? Scope.PUBLIC :
fieldAttrs.visibility == Visibility.PROTECTED ? Scope.PROTECTED :
fieldAttrs.visibility == Visibility.PRIVATE ? Scope.PRIVATE :
Scope.PROTECTED ;
MethodDef mdef = new MethodDef(scope,retType,mdecl.name,vars) ;
mdef = mdef.setAbstract(fieldAttrs.isAbstract) ;
mdef = mdef.setStatic(fieldAttrs.isStatic) ;
mdef = mdef.setSynchronized(fieldAttrs.isSynchronized) ;
mdef = mdef.setNative(fieldAttrs.isNative) ;
mdef = mdef.setFinal(fieldAttrs.isFinal) ;
for(String ex: mdecl.exceptions) {
mdef = mdef.addThrow(context.fullyQualified(ex)) ;
}
if (!fieldAttrs.isAbstract) {
InstList il = new InstList() ;
final ArrayList<Statement> body = new ArrayList<Statement>(mdecl.body);
if (mdecl.name.equals("<init>")) {
modifyConstructor(context, body);
}
for(Statement st: body) {
context.compile(st,il) ;
}
StdJavaExpressions.loadZero(TypeCode.getType(retType),il) ;
il.add(new Return(TypeCode.getType(retType))) ;
mdef = mdef.addInstructions(il.instructions.toArray(new Inst[0])) ;
errors.addAll(il.errors) ;
}
return mdef;
}