public Globals(ObjectValue globalObject, AnalysisValue numberPrototype, AnalysisValue stringPrototype, AnalysisValue booleanPrototype, AnalysisValue functionPrototype, FunctionValue arrayFunction, ObjectValue objectPrototype, BuiltinFunctionValue requireFunction, ExpandoValue arrayPrototype, BuiltinFunctionValue objectGetOwnPropertyDescriptor) {
     GlobalObject = globalObject;
     NumberPrototype = numberPrototype;
     StringPrototype = stringPrototype;
     BooleanPrototype = booleanPrototype;
     FunctionPrototype = functionPrototype;
     ArrayFunction = arrayFunction;
     ObjectPrototype = objectPrototype;
     RequireFunction = requireFunction;
     ArrayPrototype = arrayPrototype;
     ObjectGetOwnPropertyDescriptor = objectGetOwnPropertyDescriptor;
 }
        private void GenerateMethod(ExpandoValue exports, Dictionary<string, FunctionSpecializer> specialMethods, dynamic method) {
            string methodName = (string)method["name"];

            ObjectValue returnValue = null;
            if (methodName.StartsWith("create") && methodName.Length > 6) {
                string klassName = methodName.Substring(6);
                PropertyDescriptorValue propDesc;
                if (exports.Descriptors.TryGetValue(klassName, out propDesc) && propDesc.Values != null) {
                    var types = propDesc.Values.Types;
                    if (types != null && types.Count == 1) {
                        var type = types.First().Value;
                        if (type is FunctionValue) {
                            returnValue = ((FunctionValue)type)._instance;
                        }
                    }
                }
            }

            foreach (var sig in method["signatures"]) {
                BuiltinFunctionValue function;
                FunctionSpecializer specialMethod;
                if (specialMethods != null &&
                    specialMethods.TryGetValue(methodName, out specialMethod)) {
                    function = specialMethod.Specialize(
                        exports.ProjectEntry,
                        methodName,
                        ParseDocumentation((string)method["desc"]),
                        returnValue,
                        GetParameters(sig["params"])
                    );
                } else if (returnValue != null) {
                    function = new ReturningFunctionValue(
                        exports.ProjectEntry,
                        methodName,
                        returnValue.SelfSet,
                        ParseDocumentation((string)method["desc"]),
                        GetParameters(sig["params"])
                    );
                } else {
                    function = new BuiltinFunctionValue(
                        exports.ProjectEntry,
                        methodName,
                        ParseDocumentation((string)method["desc"]),
                        null,
                        GetParameters(sig["params"])
                    );
                }

                exports.Add(function);
            }
        }
        private BuiltinFunctionValue ObjectFunction(out ObjectValue objectPrototype, out BuiltinFunctionValue getOwnPropertyDescriptor) {
            var builtinEntry = _analyzer._builtinEntry;

            objectPrototype = new BuiltinObjectPrototypeValue(builtinEntry) {
                SpecializedFunction(
                    "__defineGetter__",
                    DefineGetter,
                    "Creates a getter method for the given property name",
                    Parameter("sprop", "The property name"),
                    Parameter("fun", "The function to be invoked")
                ),   
                BuiltinFunction(
                    "__lookupGetter__",
                    "Gets the getter function for the given property name",
                    Parameter("sprop", "The property name")
                ),   
                SpecializedFunction(
                    "__defineSetter__",
                    DefineSetter,
                    "Creates a setter method for the given property name",
                    Parameter("sprop", "The property name"),
                    Parameter("fun", "The function to be invoked")
                ),   
                BuiltinFunction(
                    "__lookupSetter__",
                    "Gets the setter function for the given property name",
                    Parameter("sprop", "The property name")
                ),   

                BuiltinFunction("constructor"),   
                ReturningFunction("toString", _analyzer._emptyStringValue),   
                ReturningFunction("toLocaleString", _analyzer._emptyStringValue),   
                BuiltinFunction("valueOf"),   
                ReturningFunction("hasOwnProperty", _analyzer._trueInst),   
                ReturningFunction(
                    "isPrototypeOf",
                    _analyzer._trueInst,
                    "Determines whether an object exists in another object's prototype chain.",
                    Parameter("v", "Another object whose prototype chain is to be checked.")
                ),   
                ReturningFunction(
                    "propertyIsEnumerable",
                    _analyzer._trueInst,
                    "Determines whether a specified property is enumerable.",
                    Parameter("v", "A property name.")
                ),   
            };

            getOwnPropertyDescriptor = SpecializedFunction(
                "getOwnPropertyDescriptor",
                GetOwnPropertyDescriptor,
                @"Gets the own property descriptor of the specified object. 
An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. ",
                Parameter("o", "Object that contains the property."),
                Parameter("p", "Name of the property.")
            );

            return new SpecializedFunctionValue(
                builtinEntry, 
                "Object", 
                NewObject,
                null,
                objectPrototype) { 
                BuiltinFunction(
                    "getPrototypeOf",
                    "Returns the prototype of an object."
                ),
                getOwnPropertyDescriptor,
                BuiltinFunction(
                    "getOwnPropertyNames",
                    @"Returns the names of the own properties of an object. The own properties of an object are those that are defined directly 
on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.",
                    Parameter("o", "Object that contains the own properties.")

                ),
                BuiltinFunction(
                    "create",
                    "Creates an object that has the specified prototype, and that optionally contains specified properties.",
                    Parameter("o", "Object to use as a prototype. May be null"),
                    Parameter("properties", "JavaScript object that contains one or more property descriptors.")
                ),
                SpecializedFunction(
                    "defineProperty",
                    DefineProperty,
                    "Adds a property to an object, or modifies attributes of an existing property.",
                    Parameter("o", "Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object."),
                    Parameter("p", "The property name."),
                    Parameter("attributes", "Descriptor for the property. It can be for a data property or an accessor property.")
                ),
                SpecializedFunction(
                    "defineProperties", 
                    DefineProperties,
                    "Adds one or more properties to an object, and/or modifies attributes of existing properties.",
                    Parameter("o", "Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object."),
                    Parameter("properties", "JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.")
                ),
                BuiltinFunction(
                    "seal",
                    "Prevents the modification of attributes of existing properties, and prevents the addition of new properties.",
                    Parameter("o", "Object on which to lock the attributes.")
                ),
                BuiltinFunction(
                    "freeze",
                    "Prevents the modification of existing property attributes and values, and prevents the addition of new properties.",
                    Parameter("o", "Object on which to lock the attributes.")
                ),
                BuiltinFunction(
                    "preventExtensions",
                    "Prevents the addition of new properties to an object.",
                    Parameter("o", "Object to make non-extensible.")
                ),
                ReturningFunction(
                    "isSealed",
                    _analyzer._trueInst,
                    "Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.",
                    Parameter("o", "Object to test. ")
                ),
                ReturningFunction(
                    "isFrozen",
                    _analyzer._trueInst,
                    "Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.",
                    Parameter("o", "Object to test.")
                ),
                ReturningFunction(
                    "isExtensible",
                    _analyzer._trueInst,
                    "Returns a value that indicates whether new properties can be added to an object.",
                    Parameter("o", "Object to test.")
                ),
                SpecializedFunction(
                    "keys",
                    ObjectKeys,
                    "Returns the names of the enumerable properties and methods of an object.",
                    Parameter("o", "Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.")
                ),
                ReturningFunction("is", _analyzer._trueInst),
            };
        }