/// <summary> Returns the query portion of the URL, broken up into individual key/value /// pairs. Does NOT unescape the keys and values. /// </summary> public virtual LinkedHashMap getParameterMap() { LinkedHashMap map; SupportClass.Tokenizer tokens = new SupportClass.Tokenizer(Query, "?&"); //$NON-NLS-1$ // multiply by 2 to create a sufficiently large HashMap map = new LinkedHashMap(tokens.Count * 2); while (tokens.HasMoreTokens()) { String nameValuePair = tokens.NextToken(); String name = nameValuePair; String value = ""; //$NON-NLS-1$ int equalsIndex = nameValuePair.IndexOf('='); if (equalsIndex != - 1) { name = nameValuePair.Substring(0, (equalsIndex) - (0)); if (name.Length > 0) { value = nameValuePair.Substring(equalsIndex + 1); } } map.Add(name, value); } return map; }
public Enumerator(LinkedHashMap map) { m_Map = map; m_CurrentNode = null; }
/// <summary> The compiler sometimes creates special local variables called /// "activation objects." When it decides to do this (e.g. if the /// current function contains any anonymous functions, try/catch /// blocks, complicated E4X expressions, or "with" clauses), then /// all locals and arguments are actually stored as children of /// this activation object, rather than the usual way. /// /// We need to hide this implementation detail from the user. So, /// if we find any activation objects among the locals of the current /// function, then we will "pull up" its members, and represent them /// as if they were actually args/locals of the function itself. /// /// </summary> /// <param name="depth">the depth of the stackframe we are fixing; 0 is topmost /// </param> private void pullUpActivationObjectVariables(int depth) { DValue frame = m_manager.getValue(Value.BASE_ID - depth); DStackContext context = m_manager.getFrame(depth); DVariable[] frameVars = (DVariable[]) frame.getMembers(this); LinkedHashMap varmap = new LinkedHashMap(frameVars.Length); // preserves order System.Collections.IList activationObjects = new System.Collections.ArrayList(); Regex activationObjectNamePattern = new Regex(@"^.*\$\d+$"); //$NON-NLS-1$ // loop through all frame variables, and separate them into two // groups: activation objects, and all others (locals and arguments) for (int i = 0; i < frameVars.Length; ++i) { DVariable member = frameVars[i]; Match match = activationObjectNamePattern.Match(member.getName()); if (match.Success) activationObjects.Add(member); else varmap[member.getName()] = member; } // If there are no activation objects, then we don't need to do anything if (activationObjects.Count == 0) return ; // overwrite existing args and locals with ones pulled from the activation objects for (int i = 0; i < activationObjects.Count; ++i) { DVariable activationObject = (DVariable) activationObjects[i]; DVariable[] activationMembers = (DVariable[]) activationObject.getValue().getMembers(this); for (int j = 0; j < activationMembers.Length; ++j) { DVariable member = activationMembers[j]; int attributes = member.getAttributes(); // For some odd reason, the activation object often contains a whole bunch of // other variables that we shouldn't be displaying. I don't know what they // are, but I do know that they are all marked "static". if ((attributes & VariableAttribute.IS_STATIC) != 0) continue; // No matter what the activation object member's scope is, we want all locals // and arguments to be considered "public" attributes &= ~ (VariableAttribute.PRIVATE_SCOPE | VariableAttribute.PROTECTED_SCOPE | VariableAttribute.NAMESPACE_SCOPE); attributes |= VariableAttribute.PUBLIC_SCOPE; member.setAttributes(attributes); String name = member.getName(); DVariable oldvar = (DVariable)(varmap.Contains(name) ? varmap[name] : null); int vartype; if (oldvar != null) vartype = oldvar.getAttributes() & (VariableAttribute.IS_ARGUMENT | VariableAttribute.IS_LOCAL); else vartype = VariableAttribute.IS_LOCAL; member.setAttributes(member.getAttributes() | vartype); varmap[name] = member; } context.convertLocalToActivationObject(activationObject); } foreach (DVariable next in varmap.Values) { frame.addMember(next); if (next.isAttributeSet(VariableAttribute.IS_LOCAL)) { context.addLocal(next); } else if (next.isAttributeSet(VariableAttribute.IS_ARGUMENT)) { if (next.getName().Equals("this")) //$NON-NLS-1$ context.setThis(next); else context.addArgument(next); } } }
public Enumerator(LinkedHashMap map) { m_Map = map; m_CurrentNode = null; }