(ByteBuffer buffer, BHeader header)
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public LFunction parse(ByteBuffer buffer, BHeader header) { |
| 47 | if(header.debug) { |
| 48 | System.out.println("-- beginning to parse function"); |
| 49 | } |
| 50 | if(header.debug) { |
| 51 | System.out.println("-- parsing name...start...end...upvalues...params...varargs...stack"); |
| 52 | } |
| 53 | LFunctionParseState s = new LFunctionParseState(); |
| 54 | parse_main(buffer, header, s); |
| 55 | int[] lines = new int[s.lines.length.asInt()]; |
| 56 | for(int i = 0; i < lines.length; i++) { |
| 57 | lines[i] = s.lines.get(i).asInt(); |
| 58 | } |
| 59 | LAbsLineInfo[] abslineinfo = null; |
| 60 | if(s.abslineinfo != null) { |
| 61 | abslineinfo = s.abslineinfo.asArray(new LAbsLineInfo[s.abslineinfo.length.asInt()]); |
| 62 | } |
| 63 | LFunction lfunc = new LFunction(header, s.name, s.lineBegin, s.lineEnd, s.code, lines, abslineinfo, s.locals.asArray(new LLocal[s.locals.length.asInt()]), s.constants.asArray(new LObject[s.constants.length.asInt()]), s.upvalues, s.functions.asArray(new LFunction[s.functions.length.asInt()]), s.maximumStackSize, s.lenUpvalues, s.lenParameter, s.vararg); |
| 64 | for(LFunction child : lfunc.functions) { |
| 65 | child.parent = lfunc; |
| 66 | } |
| 67 | if(s.lines.length.asInt() == 0 && s.locals.length.asInt() == 0) { |
| 68 | lfunc.stripped = true; |
| 69 | } |
| 70 | return lfunc; |
| 71 | } |
| 72 | |
| 73 | abstract public List<Directive> get_directives(); |
| 74 |
no test coverage detected