Пример #1
0
		} } // ObjectConstructorObj
	
	
	// Implementation for calling the Object constructor as a function.
	// "When Object is called as a function rather than as a constructor, it
	// performs a type conversion."
	private static object ObjectConstructorFunction(object this_, params object[] args)
		{
		if (args.Length == 0 || args[0] == null || args[0] is JUndefinedObject)
			return ObjectConstructor(null, args);
		
		return JConvert.ToObject(args[0]);
		} // ObjectConstructorFunction
Пример #2
0
		} // ObjectConstructorFunction
	
	
	// Implementation for calling the Object constructor as a constructor.
	// "When Object is called as part of a new expression, it is a
	// constructor that may create an object."
	public static object ObjectConstructor(object this_, params object[] args)
		{
		if (args.Length == 0 || args[0] == null || args[0] is JUndefinedObject)
			return new JObject(ObjectPrototype, ObjectConstructorObj, "Object");
		else
			{
			object v = args[0];
			if (v is bool || IsNumber(v) || v is string)
				return JConvert.ToObject(v);
			else
				return v;
			
			}
		
		} // ObjectConstructor