示例#1
0
		} // JObject constructor
	
	
	// Object manipulation methods.  Names are taken from the ECMAScript spec.
	
	// Return the value of our property with the given name.  If we have no
	// such property, search the prototype chain, and then return undefined.
	public virtual object Get(string propName)
		{
		JProperty prop;
		if (LookupProperty(propName, out prop))
			return prop.value;
		else if (proto != null)
			return proto.Get(propName);
		else
			return JUndefinedObject.instance;
		
		} // Get (string propName)
示例#2
0
		} // WithTypeof
	
	
	// Execute a call expression where the function to be called is specified
	// by an identifier inside one or more with scopes.  We determine the
	// actual function or method as for WithPut.
	//
	// This method may alter the args array (performing type conversions on
	// arguments as needed to match the method parameters).
	public static object WithCall( JObject lhs, string id, object[] withs,
								   params object[] args )
		{
		for (int i=0; i<withs.Length; i++)
			if (HasProperty(withs[i], id))
				return CallMethod(withs[i], id, args);
		
		return Call(lhs.Get(id), args);
		} // WithCall
示例#3
0
		} // LiteralArray
	
	
	// Read an identifier value, searching one or more "with" scopes.
	// We first search for id in each object in the withs array, starting
	// with the last entry in the array.  If any object in the array has
	// a property of the given name, we return the property value.  Otherwise,
	// if lhs has a property of that name, we return its value.  If no
	// object had a property of the given name, we return undefined.
	public static object WithGet(JObject lhs, string id, params object[] withs)
		{
		for (int i=0; i<withs.Length; i++)
			{
			object value = GetProperty(withs[i], id);
			if (!(value is JUndefinedObject))
				return value;
			}
		
		return lhs.Get(id);
		} // WithGet