Пример #1
0
        internal static IRef createSpecial(Context cx, object obj, string name)
        {
            IScriptable target = ScriptConvert.ToObjectOrNull(cx, obj);

            if (target == null)
            {
                throw ScriptRuntime.UndefReadError(obj, name);
            }

            Types type;

            if (name.Equals("__proto__"))
            {
                type = Types.Proto;
            }
            else if (name.Equals("__parent__"))
            {
                type = Types.Parent;
            }
            else
            {
                throw new ArgumentException(name);
            }

            if (!cx.HasFeature(Context.Features.ParentProtoProperties))
            {
                // Clear special after checking for valid name!
                type = Types.None;
            }

            return(new SpecialRef(target, type, name));
        }
Пример #2
0
 public object Get(Context cx)
 {
     if (xmlObject == null)
     {
         throw ScriptRuntime.UndefReadError(Undefined.Value, ToString());
     }
     return(xmlObject.GetXMLProperty(this));
 }