/// <summary> /// Used by compiler for functions. /// </summary> internal PhpRoutineDesc(DModule/*!*/ declaringModule, PhpMemberAttributes memberAttributes) : base(declaringModule.GlobalType.TypeDesc, memberAttributes, null, false) { Debug.Assert(declaringModule != null); Debug.Assert((memberAttributes & PhpMemberAttributes.Static) != 0); }
internal static void ReflectConstants(Assembly/*!*/ realAssembly, DModule/*!*/ declaringModule, DualDictionary<string, DConstantDesc>/*!*/ constants) { Debug.Assert(realAssembly != null && constants != null); foreach (FieldInfo real_field in ReflectionUtils.GetGlobalFields(realAssembly, BindingFlags.Public | BindingFlags.Static)) { if (real_field.IsLiteral && !real_field.IsSpecialName) { string full_name = QualifiedName.FromClrNotation(real_field.Name, true).ToString(); DConstantDesc existing; if (constants.TryGetValue(full_name, out existing)) { // can be already loaded from different module (CRL or CLib): existing.MemberAttributes |= PhpMemberAttributes.Ambiguous; } else { object value = real_field.GetValue(null); DConstantDesc const_desc = new DConstantDesc(declaringModule, PhpMemberAttributes.Public | PhpMemberAttributes.Static, value); constants.Add(full_name, const_desc, false); } } } }
internal void WriteUp(DModule/*!*/ module, int uniqueIndex) { Debug.Assert(this.module == null, "Already written up"); Debug.Assert(module != null); this.module = module; this.uniqueIndex = uniqueIndex; this.configurationSectionName = null; // to be written up by configuration }
internal void Invalidate() { this.configurationSectionName = null; this.module = null; this.uniqueIndex = -1; }
///// <summary> ///// Returns a name of default extension which is implemented by the library. ///// </summary> ///// <remarks>The first item (if any) is considered to be default extension for the library.</remarks> //public string DefaultExtension //{ // get { // string[] extensions = this.ImplementedExtensions; // if (extensions.Length > 0) // return extensions[0]; // else // return null; // } //} #endregion #region Construction /// <summary> /// Subclasses should have a parameter-less constructor. /// </summary> protected PhpLibraryDescriptor() { this.module = null; this.uniqueIndex = -1; this.configurationSectionName = null; }
/// <summary> /// Used by compiler for global constants. /// </summary> public DConstantDesc(DModule/*!*/ declaringModule, PhpMemberAttributes memberAttributes, object literalValue) : base(declaringModule.GlobalType.TypeDesc, memberAttributes | PhpMemberAttributes.Static) { Debug.Assert(declaringModule != null); this.literalValue = literalValue; }
/// <summary> /// Used for constants created by run-time, but with known declaring module /// </summary> internal GlobalConstant(DModule/*!*/ declaringModule, QualifiedName qualifiedName, FieldInfo info) : base(new DConstantDesc(declaringModule, PhpMemberAttributes.None, null)) { this.realField = info; this.qualifiedName = qualifiedName; }
/// <summary> /// Used by compiler for global constants. /// </summary> public DConstantDesc(DModule /*!*/ declaringModule, PhpMemberAttributes memberAttributes, object literalValue) : base(declaringModule.GlobalType.TypeDesc, memberAttributes | PhpMemberAttributes.Static) { Debug.Assert(declaringModule != null); this.literalValue = literalValue; }
/// <summary> /// Used for constants created by run-time, but with known declaring module /// </summary> internal GlobalConstant(DModule /*!*/ declaringModule, QualifiedName qualifiedName, FieldInfo info) : base(new DConstantDesc(declaringModule, PhpMemberAttributes.None, null)) { this.realField = info; this.qualifiedName = qualifiedName; }