(ObjExpr objx, ISeq form, Symbol thistag, Map overrideables)
| 9017 | } |
| 9018 | |
| 9019 | static NewInstanceMethod parse(ObjExpr objx, ISeq form, Symbol thistag, |
| 9020 | Map overrideables) { |
| 9021 | //(methodname [this-name args*] body...) |
| 9022 | //this-name might be nil |
| 9023 | NewInstanceMethod method = new NewInstanceMethod(objx, (ObjMethod) METHOD.deref()); |
| 9024 | Symbol dotname = (Symbol)RT.first(form); |
| 9025 | Symbol name = (Symbol) Symbol.intern(null,munge(dotname.name)).withMeta(RT.meta(dotname)); |
| 9026 | IPersistentVector parms = (IPersistentVector) RT.second(form); |
| 9027 | if(parms.count() == 0) |
| 9028 | { |
| 9029 | throw new IllegalArgumentException("Must supply at least one argument for 'this' in: " + dotname); |
| 9030 | } |
| 9031 | Symbol thisName = (Symbol) parms.nth(0); |
| 9032 | parms = RT.subvec(parms,1,parms.count()); |
| 9033 | ISeq body = RT.next(RT.next(form)); |
| 9034 | try |
| 9035 | { |
| 9036 | method.line = lineDeref(); |
| 9037 | method.column = columnDeref(); |
| 9038 | //register as the current method and set up a new env frame |
| 9039 | PathNode pnode = new PathNode(PATHTYPE.PATH, null); |
| 9040 | method.clearRoot = pnode; |
| 9041 | Var.pushThreadBindings( |
| 9042 | RT.mapUniqueKeys( |
| 9043 | METHOD, method, |
| 9044 | LOCAL_ENV, LOCAL_ENV.deref(), |
| 9045 | LOOP_LOCALS, null, |
| 9046 | NEXT_LOCAL_NUM, 0 |
| 9047 | ,CLEAR_PATH, pnode |
| 9048 | ,CLEAR_ROOT, pnode |
| 9049 | ,CLEAR_SITES, PersistentHashMap.EMPTY |
| 9050 | ,METHOD_RETURN_CONTEXT, RT.T |
| 9051 | )); |
| 9052 | |
| 9053 | //register 'this' as local 0 |
| 9054 | if(thisName != null) |
| 9055 | registerLocal((thisName == null) ? dummyThis:thisName,thistag, null,false); |
| 9056 | else |
| 9057 | getAndIncLocalNum(); |
| 9058 | |
| 9059 | PersistentVector argLocals = PersistentVector.EMPTY; |
| 9060 | method.retClass = tagClass(tagOf(name)); |
| 9061 | method.argTypes = new Type[parms.count()]; |
| 9062 | boolean hinted = tagOf(name) != null; |
| 9063 | Class[] pclasses = new Class[parms.count()]; |
| 9064 | Symbol[] psyms = new Symbol[parms.count()]; |
| 9065 | |
| 9066 | for(int i = 0; i < parms.count(); i++) |
| 9067 | { |
| 9068 | if(!(parms.nth(i) instanceof Symbol)) |
| 9069 | throw new IllegalArgumentException("params must be Symbols"); |
| 9070 | Symbol p = (Symbol) parms.nth(i); |
| 9071 | Object tag = tagOf(p); |
| 9072 | if(tag != null) |
| 9073 | hinted = true; |
| 9074 | if(p.getNamespace() != null) |
| 9075 | p = Symbol.intern(p.name); |
| 9076 | Class pclass = tagClass(tag); |
no test coverage detected