public JastMethod(SixModelObject jast, SixModelObject jastMethod, ThreadContext tc) throws Exception {
if (istype(jast, jastMethod, tc) == 0)
throw new Exception("JAST node isn't a JAST::Method");
SixModelObject iter;
beginAll = new Label();
endAll = new Label();
int curArgIndex = 1;
name = getattr_s(jast, jastMethod, "$!name", nameHint, tc);
returns = processType(getattr(jast, jastMethod, "$!returns", returnsHint, tc).get_str(tc));
isStatic = getattr_i(jast, jastMethod, "$!static", staticHint, tc) != 0;
if (isStatic)
curArgIndex = 0;
iter = iter(getattr(jast, jastMethod, "@!arguments", argumentsHint, tc), tc);
while (istrue(iter, tc) != 0) {
SixModelObject pair = iter.shift_boxed(tc);
String name = pair.at_pos_boxed(tc, 0).get_str(tc);
Type type = processType(pair.at_pos_boxed(tc, 1).get_str(tc));
arguments.add(type);
if (locals.containsKey(name))
throw new Exception("Duplicate local name: " + name);
locals.put(name, new VariableDef(curArgIndex, type.getDescriptor(), beginAll, endAll));
curArgIndex += (type == Type.LONG_TYPE || type == Type.DOUBLE_TYPE ? 2 : 1);
}
iter = iter(getattr(jast, jastMethod, "@!locals", localsHint, tc), tc);
while (istrue(iter, tc) != 0) {
SixModelObject pair = iter.shift_boxed(tc);
String name = pair.at_pos_boxed(tc, 0).get_str(tc);
Type type = processType(pair.at_pos_boxed(tc, 1).get_str(tc));
if (locals.containsKey(name))
throw new Exception("Duplicate local name: " + name);
locals.put(name, new VariableDef(curArgIndex, type.getDescriptor(), beginAll, endAll));
curArgIndex += (type == Type.LONG_TYPE || type == Type.DOUBLE_TYPE ? 2 : 1);
}
instructions = getattr(jast, jastMethod, "@!instructions", instructionsHint, tc);
crName = getattr_s(jast, jastMethod, "$!cr_name", crNameHint, tc);
crCuid = getattr_s(jast, jastMethod, "$!cr_cuid", crCuidHint, tc);
crOuter = (int) getattr_i(jast, jastMethod, "$!cr_outer", crOuterHint, tc);
fillList(crOlex, getattr(jast, jastMethod, "@!cr_olex", crOlexHint, tc), tc);
fillList(crIlex, getattr(jast, jastMethod, "@!cr_ilex", crIlexHint, tc), tc);
fillList(crNlex, getattr(jast, jastMethod, "@!cr_nlex", crNlexHint, tc), tc);
fillList(crSlex, getattr(jast, jastMethod, "@!cr_slex", crSlexHint, tc), tc);
SixModelObject handlersList = getattr(jast, jastMethod, "@!cr_handlers", crHandlersHint, tc);
iter = iter(handlersList, tc);
crHandlers = new long[(int) elems(handlersList, tc)];
for (int i = 0; istrue(iter, tc) != 0; i++) {
crHandlers[i] = iter.shift_boxed(tc).get_int(tc);
}