// used to assign a value to an internal variable internal virtual bool assignInternal(InternalProperty var, Object v) { // otherwise set it long l = ArithmeticExp.toLong(v); m_cache.put(var.Name, (int)l); return(true); }
/// <summary> All the really good stuff about finding where name exists goes here! /// /// If name is not null, then it implies that we use the existing /// m_current to find a member of m_current. If m_current is null /// Then we need to probe variable context points attempting to locate /// name. When we find a match we set the m_current to this context /// /// If name is null then we simply return the current context. /// </summary> internal virtual int determineContext(String name) { long id = Value.UNKNOWN_ID; // have we already resolved our context... if (m_current != null) { Object value; if (m_current is Variable) { value = ((Variable)m_current).getValue().ValueAsObject; } else if (m_current is Value) { value = ((Value)m_current).ValueAsObject; } else { value = m_current; } id = ArithmeticExp.toLong(value); } // nothing to go on, so we're done else if (name == null) { } // use the name and try and resolve where we are... else { // Each stack frame has a root variable under (BASE_ID-depth) // where depth is the depth of the stack. // So we query for our current stack depth and use that // as the context for our base computation int baseId = Value.BASE_ID; int depth = ((Int32)m_cache.get_Renamed(DebugCLI.DISPLAY_FRAME_NUMBER)); baseId -= depth; // obtain data about our current state Variable contextVar = null; Value contextVal = null; Value val = null; // look for 'name' starting from local scope if ((val = locateParentForNamed(baseId, name, false)) != null) { } // get the this pointer, then look for 'name' starting from that point else if (((contextVar = locateForNamed(baseId, "this", false)) != null) && (setName("this") && (val = locateParentForNamed(contextVar.getValue().Id, name, true)) != null)) //$NON-NLS-1$ { } // now try to see if 'name' exists off of _root else if (setName("_root") && (val = locateParentForNamed(Value.ROOT_ID, name, true)) != null) //$NON-NLS-1$ { } // now try to see if 'name' exists off of _global else if (setName("_global") && (val = locateParentForNamed(Value.GLOBAL_ID, name, true)) != null) //$NON-NLS-1$ { } // now try off of class level, if such a thing can be found else if (((contextVal = locate(Value.GLOBAL_ID, CurrentPackageName, false)) != null) && (setName("_global." + CurrentPackageName) && (val = locateParentForNamed(contextVal.Id, name, true)) != null)) //$NON-NLS-1$ { } // if we found it then stake this as our context! if (val != null) { id = val.Id; pushName(name); lockName(); } } return((int)id); }