public DefaultUnresolvedAttribute(ITypeReference attributeType, IEnumerable<ITypeReference> constructorParameterTypes) { if (attributeType == null) throw new ArgumentNullException("attributeType"); this.attributeType = attributeType; this.ConstructorParameterTypes.AddRange(constructorParameterTypes); }
private void WriteDefaultOf(ITypeReference type) { WriteKeyword("default", true); WriteSymbol("("); WriteTypeName(type, true); WriteSymbol(")"); }
private static IEnumerable<ITypeReference> AnalyzeNonGenericTypeReference(ITypeReference typeReference) { if (typeReference is Vector) return AnalyzeVectorTypeReference(typeReference); else return AnalyzeNonVectorTypeReference(typeReference); }
public InstanceCreatorOptions(IUnitReflector reflector, ILocalVariableBindings locals, ITypeReference type, params ITypeReference[] constructorParameters) { this.type = type; this.locals = locals; this.reflector = reflector; this.constructorParameters = constructorParameters; }
public CustomAttribute( IMethodReference constructor, ITypeReference type, ReadOnlyArray<MetadataConstant> positionalArguments) : this(constructor, type, positionalArguments, ReadOnlyArray<IMetadataNamedArgument>.Empty) { }
internal ConstantExpression( ITypeReference typeReference, object/*?*/ value ) { this.TypeReference = typeReference; this.value = value; }
public SimpleConstantValue(ITypeReference type, object value) { if (type == null) throw new ArgumentNullException("type"); this.type = type; this.value = value; }
public DefaultAttribute(ITypeReference attributeType, IEnumerable<ITypeReference> constructorParameterTypes) { if (attributeType == null) throw new ArgumentNullException("attributeType"); this.attributeType = attributeType; this.constructorParameterTypes = constructorParameterTypes != null ? constructorParameterTypes.ToArray() : null; }
public static ITypeReference Unspecialize(ITypeReference type) { var sntr = type as ISpecializedNestedTypeReference; if (sntr != null) return sntr.UnspecializedVersion; var gtir = type as IGenericTypeInstanceReference; if (gtir != null) return gtir.GenericType; return type; }
protected override LocalDefinition DeclareLocalInternal( ITypeReference type, object identity, string name, bool isCompilerGenerated, LocalSlotConstraints constraints, bool isDynamic, ImmutableArray<TypedConstant> dynamicTransformFlags) { if (allLocals == null) { allLocals = ImmutableArray.CreateBuilder<ILocalDefinition>(1); } var local = new LocalDefinition( identity: identity, name: name, type: type, slot: this.allLocals.Count, isCompilerGenerated: isCompilerGenerated, constraints: constraints, isDynamic: isDynamic, dynamicTransformFlags: dynamicTransformFlags); this.allLocals.Add(local); return local; }
public static ITypeReference Create(ITypeReference elementType) { if (elementType is IType) return new PointerType((IType)elementType); else return new PointerTypeReference(elementType); }
public ConstantArrayCreation(ITypeReference type, IList<ConstantExpression> arrayElements) { if (arrayElements == null) throw new ArgumentNullException("arrayElements"); this.elementType = type; this.arrayElements = arrayElements; }
string TypeToString(ITypeReference type, ITypeDefinition currentTypeDef = null) { var builder = CreateBuilder(currentTypeDef); IType resolvedType = type.Resolve(ctx); AstType node = builder.ConvertType(resolvedType); return node.ToString(); }
public static string GetName(ITypeReference value) { if (value != null) { ITypeCollection genericParameters = value.GenericArguments; if (genericParameters.Count > 0) { using (StringWriter writer = new StringWriter(CultureInfo.InvariantCulture)) { for (int i = 0; i < genericParameters.Count; i++) { if (i != 0) { writer.Write(","); } IType genericParameter = genericParameters[i]; if (genericParameter != null) { writer.Write(genericParameter.ToString()); } } return value.Name + "<" + writer.ToString() + ">"; } } return value.Name; } throw new NotSupportedException(); }
private string NameForLocal(int depth, ITypeReference type) { Contract.Requires(0 <= depth); Contract.Requires(type != null); var str = String.Format("stack_{0}_{1}", depth, TypeHelper.GetTypeName(type)); return CleanUpIdentifierName(str); }
/// <summary> /// Creates a fresh local var of the given Type and adds it to the /// Bpl Implementation /// </summary> /// <param name="typeReference"> The type of the new variable </param> /// <returns> A fresh Variable with automatic generated name and location </returns> public Bpl.Variable CreateFreshLocal(ITypeReference typeReference) { Bpl.IToken loc = Bpl.Token.NoToken; // Helper Variables do not have a location Bpl.Type t = TranslationHelper.CciTypeToBoogie(typeReference); Bpl.LocalVariable v = new Bpl.LocalVariable(loc, new Bpl.TypedIdent(loc, TranslationHelper.GenerateTempVarName(), t)); ILocalDefinition dummy = new LocalDefinition(); // Creates a dummy entry for the Dict, since only locals in the dict are translated to boogie localVarMap.Add(dummy, v); return v; }
public ModifiedTypeReference(ITypeReference modifiedType, IEnumerable<ICustomModifier> customModifiers) { Debug.Assert(modifiedType != null); Debug.Assert(customModifiers != null); this.modifiedType = modifiedType; this.customModifiers = customModifiers; }
public ModifiedTypeReference(ITypeReference modifiedType, ImmutableArray<ICustomModifier> customModifiers) { Debug.Assert(modifiedType != null); Debug.Assert(!customModifiers.IsDefault); this.modifiedType = modifiedType; this.customModifiers = customModifiers; }
/// <summary> /// Initializes a new instance of the <see cref="VB6UnresolvedMethod"/> class. /// </summary> /// <param name="method">The instance of <see cref="IVbMethod"/> that is the source of this entity.</param> /// <param name="file">The file that is the source of this entity.</param> /// <param name="typeReference">The <see cref="IUnresolvedTypeReference"/> that this member is a child of. May be null.</param> /// <param name="typeDefinition">The <see cref="IUnresolvedTypeDefinition"/> that this entity is a child of. May be null.</param> internal VB6UnresolvedMethod(IVbMethod method, IUnresolvedFile file, ITypeReference typeReference, IUnresolvedTypeDefinition typeDefinition) : base(method, file, typeReference, typeDefinition) { if (method == null) { throw new ArgumentNullException("method"); } }
public bool Matches(ITypeReference typeReference) { typeReference = TypeHelper.UninstantiateAndUnspecialize(typeReference); string name = TypeHelper.GetTypeName(typeReference, NameFormattingOptions.TypeParameters ); _log.Debug("Matching type : " + name+" by " + _identifier.ClassName); return _identifier.ClassName == name; }
public IExpression TypeOf(ITypeReference typeReference) { var typeOf = new TypeOf(); typeOf.TypeToGet = typeReference; typeOf.Type = reflector.Get<Type>(); return typeOf; }
private Tuple<int, uint> KeyForLocal(int depth, ITypeReference type) { Contract.Requires(0 <= depth); Contract.Requires(type != null); var key = Tuple.Create(depth, type.InternedKey); return key; }
public DefaultUnresolvedParameter(ITypeReference type, string name) { if (type == null) throw new ArgumentNullException("type"); if (name == null) throw new ArgumentNullException("name"); this.type = type; this.name = name; }
internal static ITypeReference Substitute(ITypeReference type, TypeVisitor substitution, ITypeResolveContext context) { if (substitution == null) return type; if (context != null) return type.Resolve(context).AcceptVisitor(substitution); else return SubstitutionTypeReference.Create(type, substitution); }
public AttributeTypeReference(ITypeReference withoutSuffix, ITypeReference withSuffix) { if (withoutSuffix == null) throw new ArgumentNullException("withoutSuffix"); if (withSuffix == null) throw new ArgumentNullException("withSuffix"); this.withoutSuffix = withoutSuffix; this.withSuffix = withSuffix; }
public static IAssembly GetDefiningAssembly(ITypeReference type) { IUnit unit = TypeHelper.GetDefiningUnit(CanonicalizeType(type)); // TODO: Does this work? IModule module = unit as IModule; if (module != null) unit = module.ContainingAssembly; return unit as IAssembly; }
public static ITypeReference Create(ITypeReference baseTypeReference, TypeVisitor substitution) { IType baseType = baseTypeReference as IType; if (baseType != null && substitution != null) { return baseType.AcceptVisitor(substitution); } else { return new SubstitutionTypeReference(baseTypeReference, substitution); } }
public DefaultExplicitInterfaceImplementation(ITypeReference interfaceType, string memberName) { if (interfaceType == null) throw new ArgumentNullException("interfaceType"); if (memberName == null) throw new ArgumentNullException("memberName"); this.InterfaceType = interfaceType; this.MemberName = memberName; }
public ExplicitInterfaceImplementationMemberReference(ITypeReference typeReference, IMemberReference interfaceMemberReference) { if (typeReference == null) throw new ArgumentNullException("typeReference"); if (interfaceMemberReference == null) throw new ArgumentNullException("interfaceMemberReference"); this.typeReference = typeReference; this.interfaceMemberReference = interfaceMemberReference; }
public SubstitutionTypeReference(ITypeReference baseTypeReference, TypeVisitor substitution) { if (baseTypeReference == null) throw new ArgumentNullException("baseTypeReference"); if (substitution == null) throw new ArgumentNullException("substitution"); this.baseTypeReference = baseTypeReference; this.substitution = substitution; }
public virtual void PrintTypeReference(ITypeReference typeReference) { Contract.Requires(typeReference != null); PrintTypeReferenceName(typeReference); }
public static IAssembly RewriteModule(IMetadataHost host, PdbReader pdbReader, IAssembly assembly, ITypeReference contractClassType, ITypeReference compilerGeneratedAttributeType, ITypeReference systemAttributeType, ITypeReference systemBooleanType, ITypeReference systemObjectType, ITypeReference systemStringType, ITypeReference systemVoidType) { var me = new AsmMetaRewriter(host, pdbReader, contractClassType, compilerGeneratedAttributeType, systemAttributeType, systemBooleanType, systemObjectType, systemStringType, systemVoidType); return(me.Rewrite(assembly)); }
public virtual void Visit(ITypeReference typeReference) { this.DispatchAsReference(typeReference); }
void ISupportsInterning.PrepareForInterning(IInterningProvider provider) { declaringTypeRef = provider.Intern(declaringTypeRef); name = provider.Intern(name); }
private void AddTransferInstruction(BasicBlock block, BasicBlock succ, int successorIndex, object targetLocal, object sourceLocal, ITypeReference type) { Contract.Requires(block != null); Contract.Requires(succ != null); Contract.Requires(type != null); if (block.transferBlocks == null) { block.transferBlocks = new PeBasicBlock <Instruction> [this.cdfg.SuccessorsFor(block).Count]; } Contract.Assume(0 <= successorIndex && successorIndex < block.transferBlocks.Length); var transferBlock = block.transferBlocks[successorIndex]; if (transferBlock == null) { transferBlock = block.transferBlocks[successorIndex] = new PeBasicBlock <Instruction>(); } var transferInstructions = transferBlock.transferInstructions; if (transferInstructions == null) { transferInstructions = transferBlock.transferInstructions = new List <Instruction>(); } var ldlocOp = new Operation() { OperationCode = Cci.OperationCode.Ldloc, Value = sourceLocal }; var ldlocInstr = new Instruction() { Operation = ldlocOp, Type = type }; transferInstructions.Add(ldlocInstr); var stlocOp = new Operation() { OperationCode = Cci.OperationCode.Stloc, Value = targetLocal }; var stlocInstr = new Instruction() { Operation = stlocOp, Type = type.PlatformType.SystemVoid }; transferInstructions.Add(stlocInstr); }
private void WriteTypeName(ITypeReference type, ITypeReference containingType, IEnumerable <ICustomAttribute> attributes = null, byte?methodNullableContextValue = null) { var useKeywords = containingType.GetTypeName() != type.GetTypeName(); WriteTypeName(type, attributes: attributes, useTypeKeywords: useKeywords, methodNullableContextValue: methodNullableContextValue); }
/// <summary> /// Creates a reference to the specified type. /// </summary> /// <param name="type">The type to be converted.</param> /// <returns>Returns the type reference.</returns> /// <remarks> /// If the type is open (contains type parameters '`0' or '``0'), /// an <see cref="ITypeResolveContext"/> with the appropriate CurrentTypeDefinition/CurrentMember is required /// to resolve the type reference. /// For closed types, the root type resolve context for the compilation is sufficient. /// </remarks> public static ITypeReference ToTypeReference(this Type type) { if (type == null) { return(SpecialType.UnknownType); } if (type.IsGenericType && !type.IsGenericTypeDefinition) { ITypeReference def = ToTypeReference(type.GetGenericTypeDefinition()); Type[] arguments = type.GetGenericArguments(); ITypeReference[] args = new ITypeReference[arguments.Length]; bool allUnbound = true; for (int i = 0; i < arguments.Length; i++) { args[i] = ToTypeReference(arguments[i]); allUnbound &= args[i].Equals(SpecialType.UnboundTypeArgument); } if (allUnbound) { return(def); } else { return(new ParameterizedTypeReference(def, args)); } } else if (type.IsArray) { return(new ArrayTypeReference(ToTypeReference(type.GetElementType()), type.GetArrayRank())); } else if (type.IsPointer) { return(new PointerTypeReference(ToTypeReference(type.GetElementType()))); } else if (type.IsByRef) { return(new ByReferenceTypeReference(ToTypeReference(type.GetElementType()))); } else if (type.IsGenericParameter) { if (type.DeclaringMethod != null) { return(TypeParameterReference.Create(SymbolKind.Method, type.GenericParameterPosition)); } else { return(TypeParameterReference.Create(SymbolKind.TypeDefinition, type.GenericParameterPosition)); } } else if (type.DeclaringType != null) { if (type == typeof(Dynamic)) { return(SpecialType.Dynamic); } else if (type == typeof(NInt)) { return(SpecialType.NInt); } else if (type == typeof(NUInt)) { return(SpecialType.NUInt); } else if (type == typeof(Null)) { return(SpecialType.NullType); } else if (type == typeof(UnboundTypeArgument)) { return(SpecialType.UnboundTypeArgument); } ITypeReference baseTypeRef = ToTypeReference(type.DeclaringType); int typeParameterCount; string name = SplitTypeParameterCountFromReflectionName(type.Name, out typeParameterCount); return(new NestedTypeReference(baseTypeRef, name, typeParameterCount)); } else { IModuleReference assemblyReference = new DefaultAssemblyReference(type.Assembly.FullName); int typeParameterCount; string name = SplitTypeParameterCountFromReflectionName(type.Name, out typeParameterCount); return(new GetClassTypeReference(assemblyReference, type.Namespace, name, typeParameterCount)); } }
public TypeExpression(ITypeReference t, Location l) { type = t; loc = l; }
internal PdbMetadataConstant(object value, ITypeReference type) { this.value = value; this.type = type; }
public SizeofExpression(ITypeReference measuredType) { this.MeasuredType = measuredType; }
public ConvertExpression(IExpression operand, ConvertOperation operation, ITypeReference conversionType) { this.Operand = operand; this.Operation = operation; this.ConversionType = conversionType; }
public CatchExpression(ITypeReference exceptionType) { this.ExceptionType = exceptionType; }
void ISupportsInterning.PrepareForInterning(IInterningProvider provider) { withoutSuffix = provider.Intern(withoutSuffix); withSuffix = provider.Intern(withSuffix); }
unsafe uint IMetaDataImport.GetTypeDefProps(uint td, IntPtr szTypeDef, uint cchTypeDef, out uint pchTypeDef, IntPtr pdwTypeDefFlags) { pchTypeDef = 0; if (td == 0) { return(0); } ITypeReference t = null; if ((td & 0xFF000000) == 0x1B000000) { t = this.writer.typeSpecList[(int)(td & 0xFFFFFF) - 1]; IGenericTypeInstanceReference gt = t as IGenericTypeInstanceReference; if (gt != null) { t = gt.GenericType; } } else { t = this.writer.typeDefList[(int)(td & 0xFFFFFF) - 1]; } string tName; uint parentToken = 0; if (this.lastTd == td) { tName = this.lastTName; parentToken = this.lastParentToken; } else { tName = TypeHelper.GetTypeName(t, NameFormattingOptions.UseGenericTypeNameSuffix | NameFormattingOptions.OmitContainingType); this.lastTd = td; this.lastTName = tName; ITypeReference bc = null; foreach (ITypeReference baseClassRef in t.ResolvedType.BaseClasses) { bc = baseClassRef; } if (bc != null) { parentToken = (uint)this.writer.GetTypeToken(bc); } this.lastParentToken = parentToken; } pchTypeDef = (uint)tName.Length; if (pchTypeDef >= cchTypeDef) { pchTypeDef = cchTypeDef - 1; } char *pTypeDef = (char *)szTypeDef.ToPointer(); for (int i = 0; i < pchTypeDef; i++) { *(pTypeDef + i) = tName[i]; } *(pTypeDef + pchTypeDef) = (char)0; uint *pFlags = (uint *)pdwTypeDefFlags.ToPointer(); *(pFlags) = PeWriter.GetTypeDefFlags(t.ResolvedType); return(parentToken); }
protected override TypeSpecificationHandle GetOrAddTypeSpecificationHandle(ITypeReference reference) { return(MetadataTokens.TypeSpecificationHandle(_typeSpecIndex.GetOrAdd(reference))); }
/// <summary> /// If a definition should be captured, capture it. Otherwise noop. /// /// The act of capturing means mapping the definition (or its type's interned id if the definition is a reference to THIS) to /// a new BoundField object that represents a field in the closure class. /// </summary> /// <param name="definition"></param> private void CaptureDefinition(object definition) { IThisReference /*?*/ thisRef = definition as IThisReference; if (thisRef != null) { definition = thisRef.Type.ResolvedType.InternedKey; } if (this.fieldForCapturedLocalOrParameter.ContainsKey(definition)) { return; } IName /*?*/ name = null; ITypeReference /*?*/ type = null; ILocalDefinition /*?*/ local = definition as ILocalDefinition; var containingClass = this.generatedclosureClass; if (local != null) { if (!this.localOrParameter2ClosureClass.TryGetValue(local, out containingClass)) { return; } if (false && containingClass == this.generatedclosureClass) { // A use of a local is captured only if it is found in a *nested* closure, // not the closure where the local is defined. return; } name = local.Name; type = local.Type; } else { IParameterDefinition /*?*/ par = definition as IParameterDefinition; if (par != null) { if (!this.localOrParameter2ClosureClass.TryGetValue(par, out containingClass)) { return; } name = par.Name; type = par.Type; } else { if (definition is uint) { type = thisRef.Type; name = this.nameTable.GetNameFor("__this value"); } else { return; } } } if (name == null) { return; } FieldDefinition field = new FieldDefinition() { ContainingTypeDefinition = containingClass, InternFactory = this.host.InternFactory, Name = name, Type = this.copyTypeToClosure.Visit(type), Visibility = TypeMemberVisibility.Public }; containingClass.Fields.Add(field); BoundField be = new BoundField(field, field.Type); this.fieldForCapturedLocalOrParameter.Add(definition, be); }
private static IObjectFieldDescriptor UseFiltering( IObjectFieldDescriptor descriptor, Type?filterType, ITypeSystemMember?filterTypeInstance = null) { FieldMiddleware placeholder = next => context => default; string argumentPlaceholder = "_" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); descriptor .Use(placeholder) .Extend() .OnBeforeCreate((c, definition) => { Type?argumentType = filterType; if (argumentType is null) { if (definition.ResultType is null || definition.ResultType == typeof(object) || !c.TypeInspector.TryCreateTypeInfo( definition.ResultType, out ITypeInfo? typeInfo)) { throw new ArgumentException( FilterResources.FilterObjectFieldDescriptor_InvalidType, nameof(descriptor)); } argumentType = typeof(FilterInputType <>) .MakeGenericType(typeInfo.NamedType); } ITypeReference argumentTypeReference = filterTypeInstance is null ? (ITypeReference)c.TypeInspector.GetTypeRef( argumentType, TypeContext.Input) : TypeReference.Create(filterTypeInstance); if (argumentType == typeof(object)) { throw new SchemaException( SchemaErrorBuilder.New() .SetMessage( FilterResources.FilterObjectFieldDescriptor_InvalidType_Msg) .SetCode(ErrorCodes.Filtering.FilterObjectType) .Build()); } var argumentDefinition = new ArgumentDefinition { Name = argumentPlaceholder, Type = c.TypeInspector.GetTypeRef(argumentType, TypeContext.Input) }; argumentDefinition.ConfigureArgumentName(); definition.Arguments.Add(argumentDefinition); ILazyTypeConfiguration lazyConfiguration = LazyTypeConfigurationBuilder .New <ObjectFieldDefinition>() .Definition(definition) .Configure((context, definition) => CompileMiddleware( context, definition, argumentTypeReference, placeholder)) .On(ApplyConfigurationOn.Completion) .DependsOn(argumentTypeReference, true) .Build(); definition.Configurations.Add(lazyConfiguration); }); return(descriptor); }
public new static SortObjectOperationDescriptor New( IDescriptorContext context, NameString name, ITypeReference type, SortOperation operation) => new SortObjectOperationDescriptor(context, name, type, operation);
internal static UsedNamespaceOrType CreateType(ITypeReference type, string aliasOpt = null) { Debug.Assert(type != null); return(new UsedNamespaceOrType(alias: aliasOpt, targetType: type)); }
public static IObjectFieldDescriptor UseSorting( this IObjectFieldDescriptor descriptor, Type sortType, ITypeSystemMember sortTypeInstance = null) { FieldMiddleware placeholder = next => context => Task.CompletedTask; descriptor .Use(placeholder) .Extend() .OnBeforeCreate(definition => { Type argumentType = GetArgumentType(definition, sortType); ITypeReference argumentTypeReference = sortTypeInstance is null ? (ITypeReference) new ClrTypeReference( argumentType, TypeContext.Input) : new SchemaTypeReference(sortTypeInstance); var argumentDefinition = new ArgumentDefinition { Type = new ClrTypeReference( argumentType, TypeContext.Input) }; ILazyTypeConfiguration lazyArgumentConfiguration = LazyTypeConfigurationBuilder .New <ArgumentDefinition>() .Definition(argumentDefinition) .Configure((context, definition) => { ISortingNamingConvention convention = context.DescriptorContext.GetSortingNamingConvention(); definition.Name = convention.ArgumentName; }) .On(ApplyConfigurationOn.Completion) .Build(); argumentDefinition.Configurations.Add(lazyArgumentConfiguration); definition.Arguments.Add(argumentDefinition); ILazyTypeConfiguration lazyConfiguration = LazyTypeConfigurationBuilder .New <ObjectFieldDefinition>() .Definition(definition) .Configure((context, definition) => CompileMiddleware( context, definition, argumentTypeReference, placeholder)) .On(ApplyConfigurationOn.Completion) .DependsOn(argumentTypeReference, true) .Build(); definition.Configurations.Add(lazyConfiguration); }); return(descriptor); }
public ModuleType(string name, ITypeReference body) : base(name) { Body = body; }
public static bool IsUnsafeType(this ITypeReference type) { return(type.TypeCode == PrimitiveTypeCode.Pointer); }
public PInvokeMethodMetadataTraverser(ITypeReference skipTypeReference) { this.skipTypeReference = skipTypeReference; }
// Token: 0x06001CC4 RID: 7364 RVA: 0x0009C21F File Offset: 0x0009A61F public TypeReference(ITypeReference typeReference) { this.assemblyQualifiedName = typeReference.assemblyQualifiedName; }
public static IObjectFieldDescriptor UseSorting( this IObjectFieldDescriptor descriptor, Type?sortType, ITypeSystemMember?sortTypeInstance = null) { FieldMiddleware placeholder = next => context => default; string argumentPlaceholder = "_" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); descriptor .Use(placeholder) .Extend() .OnBeforeCreate((c, definition) => { Type argumentType = GetArgumentType(definition, sortType, c.TypeInspector); ITypeReference argumentTypeReference = sortTypeInstance is null ? (ITypeReference)c.TypeInspector.GetTypeRef( argumentType, TypeContext.Input) : TypeReference.Create(sortTypeInstance); var argumentDefinition = new ArgumentDefinition { Name = argumentPlaceholder, Type = c.TypeInspector.GetTypeRef(argumentType, TypeContext.Input) }; ILazyTypeConfiguration lazyArgumentConfiguration = LazyTypeConfigurationBuilder .New <ArgumentDefinition>() .Definition(argumentDefinition) .Configure((context, definition) => { ISortingNamingConvention convention = context.DescriptorContext.GetSortingNamingConvention(); definition.Name = convention.ArgumentName; }) .On(ApplyConfigurationOn.Completion) .Build(); argumentDefinition.Configurations.Add(lazyArgumentConfiguration); definition.Arguments.Add(argumentDefinition); ILazyTypeConfiguration lazyConfiguration = LazyTypeConfigurationBuilder .New <ObjectFieldDefinition>() .Definition(definition) .Configure((context, definition) => CompileMiddleware( context, definition, argumentTypeReference, placeholder)) .On(ApplyConfigurationOn.Completion) .DependsOn(argumentTypeReference, true) .Build(); definition.Configurations.Add(lazyConfiguration); }); return(descriptor); }
/// <summary> /// Use this routine, rather than ITypeReference.Dispatch, to call the appropriate derived overload of an ITypeReference. /// The former routine will call Visit(INamespaceTypeDefinition) rather than Visit(INamespaceTypeReference), etc., /// in the case where a definition is used as a reference to itself. /// </summary> /// <param name="typeReference">A reference to a type definition. Note that a type definition can serve as a reference to itself.</param> protected void DispatchAsReference(ITypeReference typeReference) { INamespaceTypeReference namespaceTypeReference = typeReference.AsNamespaceTypeReference; if (namespaceTypeReference != null) { this.Visit(namespaceTypeReference); return; } IGenericTypeInstanceReference genericTypeInstanceReference = typeReference.AsGenericTypeInstanceReference; if (genericTypeInstanceReference != null) { this.Visit(genericTypeInstanceReference); return; } INestedTypeReference nestedTypeReference = typeReference.AsNestedTypeReference; if (nestedTypeReference != null) { this.Visit(nestedTypeReference); return; } IArrayTypeReference arrayTypeReference = typeReference as IArrayTypeReference; if (arrayTypeReference != null) { this.Visit(arrayTypeReference); return; } IGenericTypeParameterReference genericTypeParameterReference = typeReference.AsGenericTypeParameterReference; if (genericTypeParameterReference != null) { this.Visit(genericTypeParameterReference); return; } IGenericMethodParameterReference genericMethodParameterReference = typeReference.AsGenericMethodParameterReference; if (genericMethodParameterReference != null) { this.Visit(genericMethodParameterReference); return; } IPointerTypeReference pointerTypeReference = typeReference as IPointerTypeReference; if (pointerTypeReference != null) { this.Visit(pointerTypeReference); return; } IModifiedTypeReference modifiedTypeReference = typeReference as IModifiedTypeReference; if (modifiedTypeReference != null) { this.Visit(modifiedTypeReference); return; } }
public override void ApplyInterningProvider(IInterningProvider provider) { base.ApplyInterningProvider(provider); returnType = provider.Intern(returnType); interfaceImplementations = provider.InternList(interfaceImplementations); }
public static string GetCodeStringForType(ITypeReference typeReference) { return(typeReference.IsList ? "System.Collections.Generic.List<" + typeReference.GetEnumerableContentType().GetUnderlyingType() + ">" : typeReference.GetUnderlyingType().ToString()); }
public MetadataCreateArray(IArrayTypeReference arrayType, ITypeReference elementType, IMetadataExpression[] initializers) { ArrayType = arrayType; ElementType = elementType; Elements = initializers; }
protected override void RecordTypeReference(ITypeReference typeReference) { }