/// <summary>
        /// Creates a wrapper around an IL method definition.
        /// </summary>
        /// <param name="definition">
        /// The definition to wrap in a Flame method.
        /// </param>
        /// <param name="parentType">
        /// The definition's declaring type.
        /// </param>
        public ClrMethodDefinition(
            MethodDefinition definition,
            ClrTypeDefinition parentType)
        {
            this.Definition    = definition;
            this.ParentType    = parentType;
            this.IsConstructor = Definition.IsConstructor;
            this.IsStatic      = Definition.IsStatic;

            this.FullName = NameConversion
                            .ParseSimpleName(definition.Name)
                            .Qualify(parentType.FullName);

            this.genericParameterCache = parentType.Assembly
                                         .CreateSynchronizedLazy <IReadOnlyList <IGenericParameter> >(() =>
                                                                                                      definition.GenericParameters
                                                                                                      .Select(param => new ClrGenericParameter(param, this))
                                                                                                      .ToArray());

            this.signatureInitializer = parentType.Assembly
                                        .CreateSynchronizedInitializer(AnalyzeSignature);

            this.methodBody = parentType.Assembly
                              .CreateSynchronizedLazy(AnalyzeBody);
        }
 /// <summary>
 /// Creates a Flame type definition that wraps
 /// around an IL generic parameter.
 /// </summary>
 /// <param name="definition">
 /// The IL type definition to wrap.
 /// </param>
 /// <param name="parentType">
 /// The parent type that defines the generic parameter.
 /// </param>
 public ClrGenericParameter(
     GenericParameter definition,
     ClrTypeDefinition parentType)
     : this(
         definition,
         parentType.Assembly,
         new TypeParent(parentType))
 {
 }
Exemple #3
0
 /// <summary>
 /// Creates a Flame field definition that wraps
 /// around an IL field definition.
 /// </summary>
 /// <param name="definition">
 /// The IL field definition to wrap.
 /// </param>
 /// <param name="parentType">
 /// The parent type that defines the field wrapper.
 /// </param>
 public ClrFieldDefinition(
     FieldDefinition definition,
     ClrTypeDefinition parentType)
 {
     this.Definition = definition;
     this.ParentType = parentType;
     this.FullName   = new SimpleName(definition.Name)
                       .Qualify(parentType.FullName);
     this.IsStatic            = definition.IsStatic;
     this.contentsInitializer = parentType.Assembly
                                .CreateSynchronizedInitializer(AnalyzeContents);
 }
 /// <summary>
 /// Creates a Flame type that wraps a particular nested type
 /// definition.
 /// </summary>
 /// <param name="definition">The definition to wrap.</param>
 /// <param name="parentType">
 /// The type that directly defines this type.
 /// </param>
 public ClrTypeDefinition(
     TypeDefinition definition,
     ClrTypeDefinition parentType)
     : this(
         definition,
         parentType.Assembly,
         new TypeParent(parentType),
         NameConversion
         .ParseSimpleName(definition.Name)
         .Qualify(parentType.FullName))
 {
 }
Exemple #5
0
 /// <summary>
 /// Creates a wrapper around an IL property definition.
 /// </summary>
 /// <param name="definition">
 /// The definition to wrap in a Flame property.
 /// </param>
 /// <param name="parentType">
 /// The definition's declaring type.
 /// </param>
 public ClrPropertyDefinition(
     PropertyDefinition definition,
     ClrTypeDefinition parentType)
 {
     this.Definition = definition;
     this.ParentType = parentType;
     this.FullName   = new SimpleName(definition.Name)
                       .Qualify(parentType.FullName);
     this.contentsInitializer = parentType.Assembly
                                .CreateSynchronizedInitializer(AnalyzeContents);
     this.accessorDefs = parentType.Assembly
                         .CreateSynchronizedLazy(AnalyzeAccessors);
 }