private Object getValueByPointer(ValuePointer ptr) { return ((List<Object>)_delegates.nth(ptr.delegateIndex)).get(ptr.index); } }
public IPersistentVector cons(Object o){ return asVector().cons(o); }
public RecordIterator (ILookup rec, IPersistentVector basefields, Iterator extmap) { this.rec = rec; this.basefields = basefields; this.basecnt = basefields.count(); this.extmap = extmap; }
if((bindings.count() % 2) != 0) throw new IllegalArgumentException("Bad binding form, expected matched symbol expression pairs"); IPersistentMap backupMethodIndexLocals = method.indexlocals; IPersistentVector recurMismatches = PersistentVector.EMPTY; for (int i = 0; i < bindings.count()/2; i++) recurMismatches = recurMismatches.cons(RT.F); for(int i = 0; i < bindings.count(); i += 2) if(!(bindings.nth(i) instanceof Symbol)) throw new IllegalArgumentException( "Bad binding form, expected symbol, got: " + bindings.nth(i)); Symbol sym = (Symbol) bindings.nth(i); if(sym.getNamespace() != null) throw Util.runtimeException("Can't let qualified name: " + sym); Expr init = analyze(C.EXPRESSION, bindings.nth(i + 1), sym.name); if(isLoop) if(recurMismatches != null && RT.booleanCast(recurMismatches.nth(i/2))) if(lb.recurMistmatch) recurMismatches = (IPersistentVector)recurMismatches.assoc(i, RT.T); moreMismatches = true;
Expr k = analyze(context == C.EVAL ? context : C.EXPRESSION, e.key()); Expr v = analyze(context == C.EVAL ? context : C.EXPRESSION, e.val()); keyvals = (IPersistentVector) keyvals.cons(k); keyvals = (IPersistentVector) keyvals.cons(v); if(k instanceof LiteralExpr) for(int i=0;i<keyvals.length();i+= 2) m = m.assoc(((LiteralExpr)keyvals.nth(i)).val(), ((LiteralExpr)keyvals.nth(i+1)).val());
private static int registerKeywordCallsite(Keyword keyword){ if(!KEYWORD_CALLSITES.isBound()) throw new IllegalAccessError("KEYWORD_CALLSITES is not bound"); IPersistentVector keywordCallsites = (IPersistentVector) KEYWORD_CALLSITES.deref(); keywordCallsites = keywordCallsites.cons(keyword); KEYWORD_CALLSITES.set(keywordCallsites); return keywordCallsites.count()-1; }
public IPersistentVector assocN(int i, Object val){ return asVector().assocN(i, val); }
public ISeq seq(){ return asVector().seq(); }
static class ReifyParser implements IParser{ public Expr parse(C context, Object frm) { //(reify this-name? [interfaces] (method-name [args] body)*) ISeq form = (ISeq) frm; ObjMethod enclosingMethod = (ObjMethod) METHOD.deref(); String basename = enclosingMethod != null ? (trimGenID(enclosingMethod.objx.name) + "$") : (munge(currentNS().name.name) + "$"); String simpleName = "reify__" + RT.nextID(); String classname = basename + simpleName; ISeq rform = RT.next(form); IPersistentVector interfaces = ((IPersistentVector) RT.first(rform)).cons(Symbol.intern("clojure.lang.IObj")); rform = RT.next(rform); ObjExpr ret = build(interfaces, null, null, classname, Symbol.intern(classname), null, rform, frm); if(frm instanceof IObj && ((IObj) frm).meta() != null) return new MetaExpr(ret, MapExpr .parse(context == C.EVAL ? context : C.EXPRESSION, ((IObj) frm).meta())); else return ret; } }
for(int i=0;i<keyvals.length();i+= 2)
Type[] ctorTypes(){ IPersistentVector tv = !supportsMeta()?PersistentVector.EMPTY:RT.vector(IPERSISTENTMAP_TYPE); for(ISeq s = RT.keys(closes); s != null; s = s.next()) { LocalBinding lb = (LocalBinding) s.first(); if(lb.getPrimitiveType() != null) tv = tv.cons(Type.getType(lb.getPrimitiveType())); else tv = tv.cons(OBJECT_TYPE); } Type[] ret = new Type[tv.count()]; for(int i = 0; i < tv.count(); i++) ret[i] = (Type) tv.nth(i); return ret; }
private static int registerProtocolCallsite(Var v){ if(!PROTOCOL_CALLSITES.isBound()) throw new IllegalAccessError("PROTOCOL_CALLSITES is not bound"); IPersistentVector protocolCallsites = (IPersistentVector) PROTOCOL_CALLSITES.deref(); protocolCallsites = protocolCallsites.cons(v); PROTOCOL_CALLSITES.set(protocolCallsites); return protocolCallsites.count()-1; }