Skip to content

Instantly share code, notes, and snippets.

@peschwa
Created April 19, 2016 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peschwa/386df8991a91852c31db9a9e664b379e to your computer and use it in GitHub Desktop.
Save peschwa/386df8991a91852c31db9a9e664b379e to your computer and use it in GitHub Desktop.
public static SixModelObject getattr(SixModelObject obj, SixModelObject ch, String name, ThreadContext tc) {
SixModelObject Str = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.strBoxType;
SixModelObject Num = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.numBoxType;
SixModelObject Int = tc.curFrame.codeRef.staticInfo.compUnit.hllConfig.intBoxType;
try {
return obj.get_attribute_boxed(tc, decont(ch, tc), name, STable.NO_HINT);
}
catch (RuntimeException rte) {
try {
return box_i(getattr_i(obj, ch, name, tc), Int, tc);
}
catch (RuntimeException rte1) {
try {
return box_n(getattr_n(obj, ch, name, tc), Num, tc);
}
catch (RuntimeException rte2) {
try {
return box_s(getattr_s(obj, ch, name, tc), Str, tc);
}
catch (RuntimeException rte3) {
throw new StupidRTE("Attribute '" + name + "' is weird and this is stupid anyway");
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment