public IRef NameRef(Context cx, object name, IScriptable scope, int memberTypeFlags) { XMLName nameRef = XMLName.Parse(this, cx, name); if (nameRef == null) { return(null); } return(nameRef); }
public IRef MemberRef(Context cx, object elem, int memberTypeFlags) { XMLName name = XMLName.Parse(lib, cx, elem); if ((memberTypeFlags & Node.ATTRIBUTE_FLAG) != 0) { name.IsAttributeName = true; } if ((memberTypeFlags & Node.DESCENDANTS_FLAG) != 0) { name.IsDescendants = true; } name.BindTo(this); return(name); }
public object EcmaGet(Context cx, object id) { XMLName name = XMLName.Parse(lib, cx, id); if (name == null) { long index = ScriptRuntime.lastUint32Result(cx); object result = base.Get((int)index, this); if (result == UniqueTag.NotFound) { return(Undefined.Value); } return(result); } return(GetXMLProperty(name)); }
public void EcmaPut(Context cx, object id, object value) { if (cx == null) { cx = Context.CurrentContext; } XMLName xmlName = XMLName.Parse(lib, cx, id); if (xmlName == null) { long index = ScriptRuntime.lastUint32Result(cx); // TODO Fix this cast Put((int)index, this, value); return; } PutXMLProperty(xmlName, value); }
public override object ExecIdCall(IdFunctionObject f, Context cx, IScriptable scope, IScriptable thisObj, object [] args) { if (!f.HasTag(XMLOBJECT_TAG)) { return(base.ExecIdCall(f, cx, scope, thisObj, args)); } int id = f.MethodId; if (id == Id_constructor) { return(JsConstructor(cx, thisObj == null, args)); } // All XML.prototype methods require thisObj to be XML if (!(thisObj is XMLList)) { throw IncompatibleCallError(f); } XMLList realThis = (XMLList)thisObj; XMLName xmlName; switch (id) { case Id_attribute: xmlName = XMLName.Parse(lib, cx, GetArgSafe(args, 0)); return(realThis.Attribute(xmlName)); case Id_attributes: return(realThis.Attributes()); case Id_child: xmlName = XMLName.Parse(lib, cx, GetArgSafe(args, 0)); if (xmlName == null) { long index = ScriptRuntime.lastUint32Result(cx); return(realThis.Child(index)); } else { return(realThis.Child(xmlName)); } case Id_children: return(realThis.Children()); case Id_contains: return(realThis.Contains(GetArgSafe(args, 0))); case Id_copy: return(realThis.Copy()); case Id_descendants: { xmlName = (args.Length == 0) ? XMLName.FormStar() : XMLName.Parse(lib, cx, GetArgSafe(args, 0)); return(realThis.Descendants(xmlName)); } case Id_hasOwnProperty: xmlName = XMLName.Parse(lib, cx, GetArgSafe(args, 0)); return(realThis.HasOwnProperty(xmlName)); case Id_hasComplexContent: return(realThis.HasComplexContent()); case Id_hasSimpleContent: return(realThis.HasSimpleContent()); case Id_length: return(realThis.Length()); case Id_normalize: realThis.Normalize(); return(Undefined.Value); case Id_parent: return(realThis.Parent()); case Id_processingInstructions: xmlName = (args.Length > 0) ? XMLName.Parse(lib, cx, args [0]) : XMLName.FormStar(); return(realThis.ProcessingInstructions(xmlName)); case Id_propertyIsEnumerable: { return(realThis.PropertyIsEnumerable(GetArgSafe(args, 0))); } case Id_text: return(realThis.Text()); case Id_toString: return(realThis.ToString()); case Id_toXMLString: return(realThis.ToXMLString()); case Id_valueOf: return(realThis); case Id_addNamespace: return(realThis.DelegateTo("addNamespace").AddNamespace(GetArgSafe(args, 0))); case Id_appendChild: return(realThis.DelegateTo("appendChild").AppendChild(GetArgSafe(args, 0))); case Id_childIndex: return(realThis.DelegateTo("childIndex").ChildIndex()); case Id_inScopeNamespaces: return(realThis.DelegateTo("inScopeNamespaces").InScopeNamespaces()); case Id_insertChildAfter: return(realThis.DelegateTo("insertChildAfter").InsertChildAfter(GetArgSafe(args, 0), GetArgSafe(args, 1))); case Id_insertChildBefore: return(realThis.DelegateTo("insertChildBefore").InsertChildBefore(GetArgSafe(args, 0), GetArgSafe(args, 1))); case Id_localName: return(realThis.DelegateTo("localName").LocalName()); case Id_name: return(realThis.DelegateTo("name").Name()); case Id_namespace: return(realThis.DelegateTo("namespace").Namespace(GetArgSafe(args, 0))); case Id_namespaceDeclarations: return(realThis.DelegateTo("namespaceDeclarations").NamespaceDeclarations()); case Id_nodeKind: return(realThis.DelegateTo("nodeKind").NodeKind()); case Id_prependChild: return(realThis.DelegateTo("prependChild").PrependChild(GetArgSafe(args, 0))); case Id_removeNamespace: return(realThis.DelegateTo("removeNamespace").RemoveNamespace(GetArgSafe(args, 0))); case Id_replace: return(realThis.DelegateTo("replace").Replace(GetArgSafe(args, 0), GetArgSafe(args, 1))); case Id_setChildren: return(realThis.DelegateTo("setChildren").SetChildren(GetArgSafe(args, 0))); case Id_setLocalName: realThis.DelegateTo("setLocalName").SetLocalName(GetArgSafe(args, 0)); return(Undefined.Value); case Id_setName: realThis.DelegateTo("setName").SetName(GetArgSafe(args, 0)); return(Undefined.Value); case Id_setNamespace: realThis.DelegateTo("setNamespace").SetNamespace(GetArgSafe(args, 0)); return(Undefined.Value); } throw new System.ArgumentException(System.Convert.ToString(id)); }