(ObjExpr objx, ISeq form, Object rettag)
| 5908 | } |
| 5909 | |
| 5910 | static FnMethod parse(ObjExpr objx, ISeq form, Object rettag) { |
| 5911 | //([args] body...) |
| 5912 | IPersistentVector parms = (IPersistentVector) RT.first(form); |
| 5913 | ISeq body = RT.next(form); |
| 5914 | try |
| 5915 | { |
| 5916 | FnMethod method = new FnMethod(objx, (ObjMethod) METHOD.deref()); |
| 5917 | method.line = lineDeref(); |
| 5918 | method.column = columnDeref(); |
| 5919 | //register as the current method and set up a new env frame |
| 5920 | PathNode pnode = new PathNode(PATHTYPE.PATH,null); |
| 5921 | method.clearRoot = pnode; |
| 5922 | Var.pushThreadBindings( |
| 5923 | RT.mapUniqueKeys( |
| 5924 | METHOD, method, |
| 5925 | LOCAL_ENV, LOCAL_ENV.deref(), |
| 5926 | LOOP_LOCALS, null, |
| 5927 | NEXT_LOCAL_NUM, 0 |
| 5928 | ,CLEAR_PATH, pnode |
| 5929 | ,CLEAR_ROOT, pnode |
| 5930 | ,CLEAR_SITES, PersistentHashMap.EMPTY |
| 5931 | ,METHOD_RETURN_CONTEXT, RT.T |
| 5932 | )); |
| 5933 | |
| 5934 | method.prim = primInterface(parms); |
| 5935 | if(method.prim != null) |
| 5936 | method.prim = method.prim.replace('.', '/'); |
| 5937 | |
| 5938 | if(rettag instanceof String) |
| 5939 | rettag = Symbol.intern(null, (String) rettag); |
| 5940 | if(!(rettag instanceof Symbol)) |
| 5941 | rettag = null; |
| 5942 | if(rettag != null) |
| 5943 | { |
| 5944 | String retstr = ((Symbol)rettag).getName(); |
| 5945 | if(!(retstr.equals("long") || retstr.equals("double"))) |
| 5946 | rettag = null; |
| 5947 | } |
| 5948 | method.retClass = tagClass(tagOf(parms)!=null?tagOf(parms):rettag); |
| 5949 | if(method.retClass.isPrimitive()){ |
| 5950 | if(!(method.retClass == double.class || method.retClass == long.class)) |
| 5951 | throw new IllegalArgumentException("Only long and double primitives are supported"); |
| 5952 | } |
| 5953 | else |
| 5954 | method.retClass = Object.class; |
| 5955 | //register 'this' as local 0 |
| 5956 | //registerLocal(THISFN, null, null); |
| 5957 | // if(!canBeDirect) |
| 5958 | // { |
| 5959 | if(objx.thisName != null) |
| 5960 | registerLocal(Symbol.intern(objx.thisName), null, null,false); |
| 5961 | else |
| 5962 | getAndIncLocalNum(); |
| 5963 | // } |
| 5964 | PSTATE state = PSTATE.REQ; |
| 5965 | PersistentVector argLocals = PersistentVector.EMPTY; |
| 5966 | ArrayList<Type> argtypes = new ArrayList(); |
| 5967 | ArrayList<Class> argclasses = new ArrayList(); |
no test coverage detected