public Object invoke(Object proxy, Method method, Object[] args) throws Throwable{ Class rt = method.getReturnType(); IFn fn = (IFn) fns.valAt(method.getName()); if(fn == null)
@Override public Object valAt(Object o) { if (o instanceof Keyword) { return valAt(((Keyword) o).getName()); } return getMap().valAt(o); }
@Override public Object valAt(Object o) { if(o instanceof Keyword) { return valAt(((Keyword) o).getName()); } return getMap().valAt(o); }
public Var findInternedVar(Symbol symbol){ Object o = mappings.get().valAt(symbol); if(o != null && o instanceof Var && ((Var) o).ns == this) return (Var) o; return null; }
static public String munge(String name){ StringBuilder sb = new StringBuilder(); for(char c : name.toCharArray()) { String sub = (String) CHAR_MAP.valAt(c); if(sub != null) sb.append(sub); else sb.append(c); } return sb.toString(); }
public void emitKeyword(GeneratorAdapter gen, Keyword k){ Integer i = (Integer) keywords.valAt(k); emitConstant(gen, i); // gen.getStatic(fntype, munge(k.sym.toString()), KEYWORD_TYPE); }
private boolean isBound(Symbol sym) { Object m= map.valAt(sym); if (m==null) return false; return ((Mapping)m).isBound(); }
public void emitVar(GeneratorAdapter gen, Var var){ Integer i = (Integer) vars.valAt(var); emitConstant(gen, i); //gen.getStatic(fntype, munge(var.sym.toString()), VAR_TYPE); }
static boolean isPreserveReadCond(Object opts) { if(RT.booleanCast(READ_COND_ENV.deref()) && opts instanceof IPersistentMap) { Object readCond = ((IPersistentMap) opts).valAt(OPT_READ_COND); return COND_PRESERVE.equals(readCond); } else return false; }
public static boolean hasFeature(Object feature, Object opts) { if (! (feature instanceof Keyword)) throw Util.runtimeException("Feature should be a keyword: " + feature); if(DEFAULT_FEATURE.equals(feature)) return true; IPersistentSet custom = (IPersistentSet) ((IPersistentMap)opts).valAt(OPT_FEATURES); return custom != null && custom.contains(feature); }
@Override public Expression substitute(IPersistentMap bindings) { if(bindings.containsKey(sym)) { return Constant.create(bindings.valAt(sym)); } return this; }
@Override public Object valAt(Object o) { if(o instanceof Keyword) { return valAt(((Keyword) o).getName()); } return getMap().valAt(o); }
@SuppressWarnings("unchecked") private IPersistentSet accumulateDependents(IPersistentSet set, Symbol key) { IPersistentSet ss=(IPersistentSet)(dependents.valAt(key)); if ((ss==null)||(ss==PersistentHashSet.EMPTY)) return set; for (Symbol s: ((java.util.Collection<Symbol>)ss)) { if (!set.contains(s)) { set=(IPersistentSet) set.cons(s); accumulateDependents(set,s); } } return set; }
@Override public Object valAt(Object o) { if(o instanceof Keyword) { return valAt(((Keyword) o).getName()); } return getMap().valAt(o); }
public V put(K k, V v){ Ref r = bins[binFor(k)]; IPersistentMap map = (IPersistentMap) r.deref(); Object ret = map.valAt(k); r.set(map.assoc(k, v)); return (V) ret; }
static private Object installPlatformFeature(Object opts) { if(opts == null) return RT.mapUniqueKeys(LispReader.OPT_FEATURES, PLATFORM_FEATURES); else { IPersistentMap mopts = (IPersistentMap) opts; Object features = mopts.valAt(OPT_FEATURES); if (features == null) return mopts.assoc(LispReader.OPT_FEATURES, PLATFORM_FEATURES); else return mopts.assoc(LispReader.OPT_FEATURES, RT.conj((IPersistentSet) RT.conj((IPersistentSet) features, PLATFORM_KEY), DUNAJ_KEY)); } }