예제 #1
0
 private static void AddDependentType(PhpTypeDesc /*!*/ selfType, List <KeyValuePair <string, DTypeDesc> > /*!*/ dependentTypes, DTypeDesc dependentType)
 {
     if (dependentType != null && dependentType is PhpTypeDesc && !IsSameCompilationUnit(selfType, dependentType))
     {
         dependentTypes.Add(new KeyValuePair <string, DTypeDesc>(dependentType.MakeFullName(), dependentType));
     }
 }
예제 #2
0
        private static bool IsSameCompilationUnit(PhpTypeDesc /*!*/ selfType, DTypeDesc dependentType)
        {
            Debug.Assert(selfType != null && dependentType != null);

            if (object.ReferenceEquals(dependentType.RealType.Module, selfType.RealType.Module))
            {
                int    selfTransientId, dependentTransientId;
                string selfFileName, dependentFileName;
                string selfTypeName, dependentTypeName;

                ReflectionUtils.ParseTypeId(selfType.RealType, out selfTransientId, out selfFileName, out selfTypeName);
                if (selfTransientId != PHP.Core.Reflection.TransientAssembly.InvalidEvalId) // always true, => TransientCompilationUnit
                {
                    ReflectionUtils.ParseTypeId(dependentType.RealType, out dependentTransientId, out dependentFileName, out dependentTypeName);
                    // transient modules, must have same ids
                    return(selfTransientId == dependentTransientId);
                }
                else
                {
                    // same module, not transient modules
                    return(true);
                }
            }
            else
            {
                // different modules => different units for sure
                return(false);
            }
        }
예제 #3
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 {
     typeDesc.AddMethod("__construct", PhpMemberAttributes.Private, __construct);
     typeDesc.AddMethod("__toString", PhpMemberAttributes.Public, __toString);
     typeDesc.AddMethod("Add", PhpMemberAttributes.Public, Add);
     typeDesc.AddMethod("Remove", PhpMemberAttributes.Public, Remove);
 }
예제 #4
0
        /// <summary>
        /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
        /// This is called to fill the type description table with dynamic stubs. They are called then in runtime.
        /// </summary>
        /// <param name="typeDesc">The type desc to populate.</param>
        private static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
        {
            typeDesc.SetStaticInit(MyPhpClass.__InitializeStaticFields);

            typeDesc.AddMethod("Foo", PhpMemberAttributes.Public, Foo);
            typeDesc.AddMethod("__construct", PhpMemberAttributes.Public, __construct);

            typeDesc.AddProperty("x", PhpMemberAttributes.Public, __get_x, __set_x);
            typeDesc.AddProperty("y", PhpMemberAttributes.Public | PhpMemberAttributes.Static, __get_y, __set_y);
        }
예제 #5
0
        /// <summary>
        /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
        /// </summary>
        /// <param name="typeDesc">The type desc to populate.</param>
        private static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
        {
            typeDesc.AddMethod("read", PhpMemberAttributes.Public, read);
            typeDesc.AddMethod("rewind", PhpMemberAttributes.Public, rewind);
            typeDesc.AddMethod("close", PhpMemberAttributes.Public, close);

            typeDesc.AddProperty("handle", PhpMemberAttributes.Public,
                                 (instance) => ((Directory)instance).handle,
                                 (instance, value) => ((Directory)instance).handle = (PhpReference)value);
            typeDesc.AddProperty("path", PhpMemberAttributes.Public,
                                 (instance) => ((Directory)instance).path,
                                 (instance, value) => ((Directory)instance).path = (PhpReference)value);
        }
예제 #6
0
 /// <summary></summary>
 private static void __PopulateTypeDesc(PhpTypeDesc desc)
 {
     desc.AddMethod("__call", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__call));
     desc.AddMethod("__doRequest", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__doRequest));
     desc.AddMethod("__getFunctions", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getFunctions));
     desc.AddMethod("__getLastRequest", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastRequest));
     desc.AddMethod("__getLastRequestHeaders", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastRequestHeaders));
     desc.AddMethod("__getLastResponse", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastResponse));
     desc.AddMethod("__getLastResponseHeaders", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastResponseHeaders));
     desc.AddMethod("__getTypes", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getTypes));
     desc.AddMethod("__setCookie", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__setCookie));
     desc.AddMethod("__setLocation", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__setLocation));
     desc.AddMethod("__setSoapHeaders", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__setSoapHeaders));
     desc.AddMethod("__construct", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__construct));
 }
예제 #7
0
        /// <summary>
        /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
        /// </summary>
        /// <param name="typeDesc">The type desc to populate.</param>
        internal static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
        {
            typeDesc.AddMethod("__construct", PhpMemberAttributes.Public, __construct);
            typeDesc.AddMethod("__toString", PhpMemberAttributes.Public, __toString);
            typeDesc.AddMethod("getMessage", PhpMemberAttributes.Public, getMessage);
            typeDesc.AddMethod("getCode", PhpMemberAttributes.Public, getCode);
            typeDesc.AddMethod("getFile", PhpMemberAttributes.Public, getFile);
            typeDesc.AddMethod("getTrace", PhpMemberAttributes.Public, getTrace);
            typeDesc.AddMethod("getPrevious", PhpMemberAttributes.Public, getPrevious);
            typeDesc.AddMethod("getTraceAsString", PhpMemberAttributes.Public, getTraceAsString);
            typeDesc.AddMethod("getLine", PhpMemberAttributes.Public, getLine);
            typeDesc.AddMethod("getColumn", PhpMemberAttributes.Public, getColumn);

            typeDesc.AddProperty("message", PhpMemberAttributes.Protected, __get_message, __set_message);
            typeDesc.AddProperty("code", PhpMemberAttributes.Protected, __get_code, __set_code);
            typeDesc.AddProperty("file", PhpMemberAttributes.Protected, __get_file, __set_file);
            typeDesc.AddProperty("line", PhpMemberAttributes.Protected, __get_line, __set_line);
            typeDesc.AddProperty("column", PhpMemberAttributes.Protected, __get_column, __set_column);
        }
예제 #8
0
        /// <summary>
        /// Reflect PHP classes declared statically in the given script <c>type</c>.
        /// </summary>
        /// <param name="scriptType">Script type to reflect.</param>
        /// <param name="types">List of types to reflect to.</param>
        private static void ReflectScriptTypeClasses(Type scriptType,
                                                     Dictionary <string, DTypeDesc> /*!*/ types)
        {
            ScriptDeclaresAttribute script_declares = ScriptDeclaresAttribute.Reflect(scriptType);

            if (script_declares == null)
            {
                return;
            }

            var module = scriptType.Module;

            foreach (var typeToken in script_declares.DeclaredTypes)
            {
                Type type = module.ResolveType(typeToken);

                // reflect PHP class, skip PHP types that were declared conditionally
                if (PhpType.IsPhpRealType(type) && !PhpType.IsRealConditionalDefinition(type))
                {
                    // converts CLR namespaces and nested types to PHP namespaces:
                    string full_name = QualifiedName.FromClrNotation(type.FullName, true).ToString();

                    // Creating PhpTypeDesc with cache lookup since this type can be in the cache already:
                    // Also force PHP type, because we already checked PhpType.IsPhpRealType(type)
                    PhpTypeDesc phpType = (PhpTypeDesc)DTypeDesc.Create(type.TypeHandle);

                    DTypeDesc existing;
                    if (types.TryGetValue(full_name, out existing))
                    {
                        // TODO (TP): can be generic overload!!
                        existing.MemberAttributes |= PhpMemberAttributes.Ambiguous;
                    }
                    types.Add(full_name, phpType);
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Reflect argfull function, PHP types and constants from given <c>type</c>.
        /// </summary>
        /// <param name="types">Dictionary of types where newly discovered PHP types will be placed. (Types having [ImplementsType] attribute.)</param>
        /// <param name="functions">Dictionary of reflected functions.</param>
        /// <param name="constants">Dictionary of reflected constants.</param>
        /// <param name="type">The type to reflect functions from.</param>
        /// <param name="full">Whether to perform full function reflect.</param>
        private void ReflectArgfulls(
            Dictionary <string, DTypeDesc> /*!*/ types,
            Dictionary <string, DRoutineDesc> /*!*/ functions,
            DualDictionary <string, DConstantDesc> /*!*/ constants,
            Type /*!*/ type, bool full)
        {
            // skip generic types:
            if (type.IsGenericTypeDefinition)
            {
                return;
            }

            if (PhpType.IsPhpRealType(type))
            {
                var dtype = PhpTypeDesc.Create(type);
                types[dtype.MakeSimpleName()] = dtype;
            }

            // reflect even if it is PhpType to find global functions [ImplementsFunction] and constants [ImplementsConstant]
            if (IsLibraryType(type))
            {
                ReflectLibraryType(functions, constants, type, full);
            }
        }
예제 #10
0
 private static void AddDependentType(PhpTypeDesc/*!*/selfType, List<KeyValuePair<string, DTypeDesc>>/*!*/dependentTypes, DTypeDesc dependentType)
 {
     if (dependentType != null && dependentType is PhpTypeDesc && !IsSameCompilationUnit(selfType, dependentType))
         dependentTypes.Add(new KeyValuePair<string, DTypeDesc>(dependentType.MakeFullName(), dependentType));
 }
예제 #11
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("nodeName", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_nodeName), null);
			desc.AddProperty("nodeValue", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_nodeValue), new SetterDelegate(DOMAttr.__set_nodeValue));
			desc.AddProperty("namespaceURI", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_namespaceURI), null);
			desc.AddProperty("nodeType", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_nodeType), null);
			desc.AddProperty("name", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_name), null);
			desc.AddProperty("value", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_value), new SetterDelegate(DOMAttr.__set_value));
			desc.AddProperty("ownerElement", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_ownerElement), null);
			desc.AddProperty("schemaTypeInfo", PhpMemberAttributes.Public, new GetterDelegate(DOMAttr.__get_schemaTypeInfo), null);
			desc.AddMethod("__construct", PhpMemberAttributes.Public, new RoutineDelegate(DOMAttr.__construct));
			desc.AddMethod("isId", PhpMemberAttributes.Public, new RoutineDelegate(DOMAttr.isId));
		}
예제 #12
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddMethod("__soapCall", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__soapCall));
			desc.AddMethod("__call", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__call));
			desc.AddMethod("__doRequest", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__doRequest));
			desc.AddMethod("__getFunctions", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getFunctions));
			desc.AddMethod("__getLastRequest", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastRequest));
			desc.AddMethod("__getLastRequestHeaders", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastRequestHeaders));
			desc.AddMethod("__getLastResponse", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastResponse));
			desc.AddMethod("__getLastResponseHeaders", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getLastResponseHeaders));
			desc.AddMethod("__getTypes", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__getTypes));
			desc.AddMethod("__setCookie", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__setCookie));
			desc.AddMethod("__setLocation", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__setLocation));
			desc.AddMethod("__setSoapHeaders", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__setSoapHeaders));
			desc.AddMethod("__construct", PhpMemberAttributes.Public, new RoutineDelegate(SoapClient.__construct));
		}
예제 #13
0
        private static bool IsSameCompilationUnit(PhpTypeDesc/*!*/selfType, DTypeDesc dependentType)
        {
            Debug.Assert(selfType != null && dependentType != null);

            if (object.ReferenceEquals(dependentType.RealType.Module, selfType.RealType.Module))
            {
                int selfTransientId, dependentTransientId;
                string selfFileName, dependentFileName;
                string selfTypeName, dependentTypeName;

                ReflectionUtils.ParseTypeId(selfType.RealType, out selfTransientId, out selfFileName, out selfTypeName);
                if (selfTransientId != PHP.Core.Reflection.TransientAssembly.InvalidEvalId) // always true, => TransientCompilationUnit
                {
                    ReflectionUtils.ParseTypeId(dependentType.RealType, out dependentTransientId, out dependentFileName, out dependentTypeName);
                    // transient modules, must have same ids
                    return selfTransientId == dependentTransientId;
                }
                else
                {
                    // same module, not transient modules
                    return true;
                }
            }
            else
            {
                // different modules => different units for sure
                return false;
            }
        }
예제 #14
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 {
     typeDesc.AddProperty(ClassNameFieldName, PhpMemberAttributes.Public,
                          (instance) => ((__PHP_Incomplete_Class)instance).__PHP_Incomplete_Class_Name,
                          (instance, value) => ((__PHP_Incomplete_Class)instance).__PHP_Incomplete_Class_Name = (PhpReference)value);
 }
예제 #15
0
        /// <summary>
        /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
        /// This is called to fill the type description table with dynamic stubs. They are called then in runtime.
        /// </summary>
        /// <param name="typeDesc">The type desc to populate.</param>
        private static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
        {
            typeDesc.SetStaticInit(MyPhpClass.__InitializeStaticFields);

            typeDesc.AddMethod("Foo", PhpMemberAttributes.Public, Foo);
            typeDesc.AddMethod("__construct", PhpMemberAttributes.Public, __construct);

            typeDesc.AddProperty("x", PhpMemberAttributes.Public, __get_x, __set_x);
            typeDesc.AddProperty("y", PhpMemberAttributes.Public | PhpMemberAttributes.Static, __get_y, __set_y);
        }
예제 #16
0
		/// <summary>
		/// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
		/// </summary>
		/// <param name="typeDesc">The type desc to populate.</param>
		internal static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
		{
			typeDesc.AddMethod("__construct", PhpMemberAttributes.Public, __construct);
			typeDesc.AddMethod("__toString", PhpMemberAttributes.Public, __toString);
			typeDesc.AddMethod("getMessage", PhpMemberAttributes.Public, getMessage);
			typeDesc.AddMethod("getCode", PhpMemberAttributes.Public, getCode);
			typeDesc.AddMethod("getFile", PhpMemberAttributes.Public, getFile);
			typeDesc.AddMethod("getTrace", PhpMemberAttributes.Public, getTrace);
            typeDesc.AddMethod("getPrevious", PhpMemberAttributes.Public, getPrevious);
			typeDesc.AddMethod("getTraceAsString", PhpMemberAttributes.Public, getTraceAsString);
			typeDesc.AddMethod("getLine", PhpMemberAttributes.Public, getLine);
			typeDesc.AddMethod("getColumn", PhpMemberAttributes.Public, getColumn);

			typeDesc.AddProperty("message", PhpMemberAttributes.Protected, __get_message, __set_message);
			typeDesc.AddProperty("code", PhpMemberAttributes.Protected, __get_code, __set_code);
			typeDesc.AddProperty("file", PhpMemberAttributes.Protected, __get_file, __set_file);
			typeDesc.AddProperty("line", PhpMemberAttributes.Protected, __get_line, __set_line);
			typeDesc.AddProperty("column", PhpMemberAttributes.Protected, __get_column, __set_column);
		}
예제 #17
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 {
     typeDesc.AddMethod("getModifierNames", PhpMemberAttributes.Public | PhpMemberAttributes.Static, getModifierNames);
     typeDesc.AddMethod("export", PhpMemberAttributes.Public | PhpMemberAttributes.Static, export);
 }
예제 #18
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("length", PhpMemberAttributes.Public, new GetterDelegate(DOMNodeList.__get_length), null);
			desc.AddMethod("item", PhpMemberAttributes.Public, new RoutineDelegate(DOMNodeList.item));
		}
예제 #19
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddMethod("findOffset16", PhpMemberAttributes.Public, new RoutineDelegate(DOMStringExtend.findOffset16));
			desc.AddMethod("findOffset32", PhpMemberAttributes.Public, new RoutineDelegate(DOMStringExtend.findOffset32));
		}
예제 #20
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("length", PhpMemberAttributes.Public, new GetterDelegate(DOMNameList.__get_length), null);
			desc.AddMethod("getName", PhpMemberAttributes.Public, new RoutineDelegate(DOMNameList.getName));
			desc.AddMethod("getNamespaceURI", PhpMemberAttributes.Public, new RoutineDelegate(DOMNameList.getNamespaceURI));
		}
예제 #21
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("length", PhpMemberAttributes.Public, new GetterDelegate(DOMNamedNodeMap.__get_length), null);
			desc.AddMethod("getNamedItem", PhpMemberAttributes.Public, new RoutineDelegate(DOMNamedNodeMap.getNamedItem));
			desc.AddMethod("setNamedItem", PhpMemberAttributes.Public, new RoutineDelegate(DOMNamedNodeMap.setNamedItem));
			desc.AddMethod("removeNamedItem", PhpMemberAttributes.Public, new RoutineDelegate(DOMNamedNodeMap.removeNamedItem));
			desc.AddMethod("item", PhpMemberAttributes.Public, new RoutineDelegate(DOMNamedNodeMap.item));
			desc.AddMethod("getNamedItemNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMNamedNodeMap.getNamedItemNS));
			desc.AddMethod("setNamedItemNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMNamedNodeMap.setNamedItemNS));
			desc.AddMethod("removeNamedItemNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMNamedNodeMap.removeNamedItemNS));
		}
예제 #22
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("nodeType", PhpMemberAttributes.Public, new GetterDelegate(DOMEntity.__get_nodeType), null);
			desc.AddProperty("publicId", PhpMemberAttributes.Public, new GetterDelegate(DOMEntity.__get_publicId), null);
			desc.AddProperty("systemId", PhpMemberAttributes.Public, new GetterDelegate(DOMEntity.__get_systemId), null);
			desc.AddProperty("notationName", PhpMemberAttributes.Public, new GetterDelegate(DOMEntity.__get_notationName), null);
			desc.AddProperty("actualEncoding", PhpMemberAttributes.Public, new GetterDelegate(DOMEntity.__get_actualEncoding), new SetterDelegate(DOMEntity.__set_actualEncoding));
			desc.AddProperty("encoding", PhpMemberAttributes.Public, new GetterDelegate(DOMEntity.__get_encoding), new SetterDelegate(DOMEntity.__set_encoding));
			desc.AddProperty("version", PhpMemberAttributes.Public, new GetterDelegate(DOMEntity.__get_version), new SetterDelegate(DOMEntity.__set_version));
		}
예제 #23
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 {
     typeDesc.AddMethod("getModifierNames", PhpMemberAttributes.Public | PhpMemberAttributes.Static, getModifierNames);
     typeDesc.AddMethod("export", PhpMemberAttributes.Public | PhpMemberAttributes.Static, export);
 }
예제 #24
0
        private void Bake()
        {
            if (types != null)
            {
                bakedTypes = new KeyValuePair <string, PhpTypeDesc> [types.Count];

                int i = 0;
                foreach (Declaration declaration in types.Values)
                {
                    PhpType type = (PhpType)declaration.Declaree;

                    // store full name before calling Bake() as it nulls the PhpType:
                    string      full_name = type.FullName;
                    PhpTypeDesc baked     = type.Bake();

                    // baked is null if the type is indefinite
                    // (its base class may be evaluated when the module's main method is executed):
                    if (baked != null && !declaration.IsConditional)
                    {
                        bakedTypes[i++] = new KeyValuePair <string, PhpTypeDesc>(full_name, baked);
                    }
                }

                // trim:
                Array.Resize(ref bakedTypes, i);

                types = null;
            }

            if (functions != null)
            {
                bakedFunctions = new KeyValuePair <string, PhpRoutineDesc> [functions.Count];

                int i = 0;
                foreach (Declaration declaration in functions.Values)
                {
                    PhpFunction function = (PhpFunction)declaration.Declaree;

                    string         full_name = function.FullName;
                    PhpRoutineDesc baked     = function.Bake();

                    if (!declaration.IsConditional)
                    {
                        bakedFunctions[i++] = new KeyValuePair <string, PhpRoutineDesc>(full_name, baked);
                    }
                }

                // trim:
                Array.Resize(ref bakedFunctions, i);

                functions = null;
            }

            if (constants != null)
            {
                bakedConstants = new KeyValuePair <string, DConstantDesc> [constants.Count];

                int i = 0;
                foreach (Declaration declaration in constants.Values)
                {
                    GlobalConstant constant = (GlobalConstant)declaration.Declaree;

                    string        full_name = constant.FullName;
                    DConstantDesc baked     = constant.Bake();

                    if (!declaration.IsConditional)
                    {
                        bakedConstants[i++] = new KeyValuePair <string, DConstantDesc>(full_name, baked);
                    }
                }

                // trim:
                Array.Resize(ref bakedConstants, i);

                constants = null;
            }
        }
예제 #25
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("nodeName", PhpMemberAttributes.Public, new GetterDelegate(DOMEntityReference.__get_nodeName), null);
			desc.AddProperty("nodeValue", PhpMemberAttributes.Public, new GetterDelegate(DOMEntityReference.__get_nodeValue), new SetterDelegate(DOMEntityReference.__set_nodeValue));
			desc.AddProperty("namespaceURI", PhpMemberAttributes.Public, new GetterDelegate(DOMEntityReference.__get_namespaceURI), null);
			desc.AddProperty("nodeType", PhpMemberAttributes.Public, new GetterDelegate(DOMEntityReference.__get_nodeType), null);
			desc.AddMethod("__construct", PhpMemberAttributes.Public, new RoutineDelegate(DOMEntityReference.__construct));
		}
예제 #26
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static new void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 { }
예제 #27
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static new void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 {
 }
예제 #28
0
 internal static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 {
     // the method is empty, which means that stdClass has no methods or CT properties;
     // existence of this method however avoids the slow reflection when creating its DTypeDesc
 }
예제 #29
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("nodeName", PhpMemberAttributes.Public, new GetterDelegate(DOMElement.__get_nodeName), null);
			desc.AddProperty("nodeValue", PhpMemberAttributes.Public, new GetterDelegate(DOMElement.__get_nodeValue), new SetterDelegate(DOMElement.__set_nodeValue));
			desc.AddProperty("namespaceURI", PhpMemberAttributes.Public, new GetterDelegate(DOMElement.__get_namespaceURI), null);
			desc.AddProperty("nodeType", PhpMemberAttributes.Public, new GetterDelegate(DOMElement.__get_nodeType), null);
			desc.AddProperty("attributes", PhpMemberAttributes.Public, new GetterDelegate(DOMElement.__get_attributes), null);
			desc.AddProperty("tagName", PhpMemberAttributes.Public, new GetterDelegate(DOMElement.__get_tagName), null);
			desc.AddMethod("__construct", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.__construct));
			desc.AddMethod("getAttribute", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.getAttribute));
			desc.AddMethod("getAttributeNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.getAttributeNS));
			desc.AddMethod("setAttribute", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.setAttribute));
			desc.AddMethod("setAttributeNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.setAttributeNS));
			desc.AddMethod("removeAttribute", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.removeAttribute));
			desc.AddMethod("removeAttributeNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.removeAttributeNS));
			desc.AddMethod("getAttributeNode", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.getAttributeNode));
			desc.AddMethod("getAttributeNodeNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.getAttributeNodeNS));
			desc.AddMethod("setAttributeNode", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.setAttributeNode));
			desc.AddMethod("setAttributeNodeNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.setAttributeNodeNS));
			desc.AddMethod("removeAttributeNode", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.removeAttributeNode));
			desc.AddMethod("hasAttribute", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.hasAttribute));
			desc.AddMethod("hasAttributeNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.hasAttributeNS));
			desc.AddMethod("getElementsByTagName", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.getElementsByTagName));
			desc.AddMethod("getElementsByTagNameNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.getElementsByTagNameNS));
			desc.AddMethod("setIdAttribute", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.setIdAttribute));
			desc.AddMethod("setIdAttributeNS", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.setIdAttributeNS));
			desc.AddMethod("setIdAttributeNode", PhpMemberAttributes.Public, new RoutineDelegate(DOMElement.setIdAttributeNode));
		}
예제 #30
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("code", PhpMemberAttributes.Public, new GetterDelegate(DOMException.__get_code), null);
		}
예제 #31
0
		/// <summary>
		/// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
		/// </summary>
		/// <param name="typeDesc">The type desc to populate.</param>
		private static void __PopulateTypeDesc(PhpTypeDesc typeDesc)
		{
			typeDesc.AddMethod("read", PhpMemberAttributes.Public, read);
			typeDesc.AddMethod("rewind", PhpMemberAttributes.Public, rewind);
			typeDesc.AddMethod("close", PhpMemberAttributes.Public, close);

            typeDesc.AddProperty("handle", PhpMemberAttributes.Public,
                    (instance) => ((Directory)instance).handle,
                    (instance, value) => ((Directory)instance).handle = (PhpReference)value);
            typeDesc.AddProperty("path", PhpMemberAttributes.Public,
                    (instance) => ((Directory)instance).path,
                    (instance, value) => ((Directory)instance).path = (PhpReference)value);
		}
예제 #32
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static new void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 {
     throw new NotImplementedException();
 }
예제 #33
0
		private static void __PopulateTypeDesc(PhpTypeDesc desc)
		{
			desc.AddProperty("document", PhpMemberAttributes.Public, new GetterDelegate(DOMXPath.__get_document), null);
			desc.AddMethod("__construct", PhpMemberAttributes.Public, new RoutineDelegate(DOMXPath.__construct));
			desc.AddMethod("registerNamespace", PhpMemberAttributes.Public, new RoutineDelegate(DOMXPath.registerNamespace));
			desc.AddMethod("query", PhpMemberAttributes.Public, new RoutineDelegate(DOMXPath.query));
			desc.AddMethod("evaluate", PhpMemberAttributes.Public, new RoutineDelegate(DOMXPath.evaluate));
		}
예제 #34
0
 /// <summary>
 /// Populates the provided <see cref="DTypeDesc"/> with this class's methods and properties.
 /// </summary>
 /// <param name="typeDesc">The type desc to populate.</param>
 internal static new void __PopulateTypeDesc(PhpTypeDesc typeDesc)
 { throw new NotImplementedException(); }
예제 #35
0
 private static void AddDependentType(PhpTypeDesc/*!*/selfType, List<KeyValuePair<string, DTypeDesc>>/*!*/dependentTypes, DTypeDesc dependentType)
 {
     if (dependentType != null && dependentType is PhpTypeDesc && dependentType.RealType.Module != selfType.RealType.Module)// base type if from different module (external dependency)
         dependentTypes.Add(new KeyValuePair<string, DTypeDesc>(dependentType.MakeFullName(), dependentType));
 }