/// <summary> Resolve the object into a variable by various means and /// using the current context. /// </summary> /// <returns> variable, or <code>null</code> /// </returns> internal virtual Variable resolveToVariable(Object o) { Variable v = null; // if o is a variable already, then we're done! if (o is Variable) { return((Variable)o); } /* * Resolve the name to something */ { // not an id so try as name String name = o.ToString(); long id = nameAsId(name); /* * if #N was used just pick up the variable, otherwise * we need to use the current context to resolve * the name to a member */ if (id != Value.UNKNOWN_ID) { // TODO what here? } else { // try to resolve as a member of current context (will set context if null) id = determineContext(name); v = locateForNamed((int)id, name, true); if (v != null) { v = new VariableFacade(v, id); } else if (v == null && m_createIfMissing && name[0] != '$') { v = new VariableFacade(id, name); } } } /* return the variable */ return(v); }
/// <summary> Resolve the object into a variable by various means and /// using the current context. /// </summary> /// <returns> variable, or <code>null</code> /// </returns> internal virtual Variable resolveToVariable(Object o) { Variable v = null; // if o is a variable already, then we're done! if (o is Variable) return (Variable) o; /* * Resolve the name to something */ { // not an id so try as name String name = o.ToString(); long id = nameAsId(name); /* * if #N was used just pick up the variable, otherwise * we need to use the current context to resolve * the name to a member */ if (id != Value.UNKNOWN_ID) { // TODO what here? } else { // try to resolve as a member of current context (will set context if null) id = determineContext(name); v = locateForNamed((int) id, name, true); if (v != null) v = new VariableFacade(v, id); else if (v == null && m_createIfMissing && name[0] != '$') v = new VariableFacade(id, name); } } /* return the variable */ return v; }