public ReflectionTypeSystemProvider() { _referenceCache = new MemoizedFunction<Assembly, AssemblyReference>(AssemblyEqualityComparer.Default, CreateReference); MapTo(typeof(object), new ObjectTypeImpl(this)); MapTo(typeof(Builtins.duck), new ObjectTypeImpl(this)); MapTo(typeof(void), new VoidTypeImpl(this)); }
public ReflectionTypeSystemProvider() { _referenceCache = new MemoizedFunction <Assembly, AssemblyReference>(AssemblyEqualityComparer.Default, CreateReference); MapTo(typeof(object), new ObjectTypeImpl(this)); MapTo(typeof(Builtins.duck), new ObjectTypeImpl(this)); MapTo(typeof(void), new VoidTypeImpl(this)); }
public NameResolutionService() { _resolveExtensionFor = new MemoizedFunction <string, IType, IEntity>(StringComparer.Ordinal, ResolveExtensionFor); _resolveName = new MemoizedFunction <string, EntityType, IEntity>(StringComparer.Ordinal, ResolveImpl); _current.Changed += (sender, args) => ClearResolutionCache(); _global = My <GlobalNamespace> .Instance; Reset(); }
internal AssemblyReference(ReflectionTypeSystemProvider provider, Assembly assembly) { if (null == assembly) { throw new ArgumentNullException("assembly"); } _provider = provider; _assembly = assembly; _typeEntityCache = new MemoizedFunction <Type, IType>(NewType); _memberCache = new MemoizedFunction <MemberInfo, IEntity>(NewEntityForMember); }
public void EnterNamespace(INamespace ns) { if (null == ns) { throw new ArgumentNullException("ns"); } _stackNameCaches.Push(_resolveName); _stackExtensionCaches.Push(_resolveExtensionFor); _resolveName = _resolveName.Clone(); _resolveExtensionFor = _resolveExtensionFor.Clone(); CurrentNamespace = ns; }
public TypeSystemServices(CompilerContext context) { if (null == context) throw new ArgumentNullException("context"); _context = context; _anonymousCallablesManager = new AnonymousCallablesManager(this); _findImplicitConversionOperator = new MemoizedFunction<IType, IType, IMethod>((fromType, toType) => FindConversionOperator("op_Implicit", fromType, toType)); _findExplicitConversionOperator = new MemoizedFunction<IType, IType, IMethod>((fromType, toType) => FindConversionOperator("op_Explicit", fromType, toType)); My<CurrentScope>.Instance.Changed += (sender, args) => ClearScopeDependentMemoizedFunctions(); _canBeReachedByPromotion = new MemoizedFunction<IType, IType, bool>(CanBeReachedByPromotionImpl); DuckType = Map(typeof(Builtins.duck)); IQuackFuType = Map(typeof(IQuackFu)); VoidType = Map(Types.Void); ObjectType = Map(Types.Object); RegexType = Map(Types.Regex); ValueTypeType = Map(typeof(ValueType)); EnumType = Map(typeof(Enum)); ArrayType = Map(Types.Array); TypeType = Map(Types.Type); StringType = Map(Types.String); BoolType = Map(Types.Bool); SByteType = Map(Types.SByte); CharType = Map(Types.Char); ShortType = Map(Types.Short); IntType = Map(Types.Int); LongType = Map(Types.Long); ByteType = Map(Types.Byte); UShortType = Map(Types.UShort); UIntType = Map(Types.UInt); ULongType = Map(Types.ULong); SingleType = Map(Types.Single); DoubleType = Map(Types.Double); DecimalType = Map(Types.Decimal); TimeSpanType = Map(Types.TimeSpan); DateTimeType = Map(Types.DateTime); RuntimeServicesType = Map(Types.RuntimeServices); BuiltinsType = Map(Types.Builtins); ListType = Map(Types.List); HashType = Map(Types.Hash); ICallableType = Map(Types.ICallable); IEnumerableType = Map(Types.IEnumerable); IEnumeratorType = Map(typeof(IEnumerator)); ICollectionType = Map(Types.ICollection); IDisposableType = Map(typeof(IDisposable)); IntPtrType = Map(Types.IntPtr); UIntPtrType = Map(Types.UIntPtr); MulticastDelegateType = Map(Types.MulticastDelegate); DelegateType = Map(Types.Delegate); SystemAttribute = Map(typeof(Attribute)); ConditionalAttribute = Map(typeof(ConditionalAttribute)); IEnumerableGenericType = Map(Types.IEnumerableGeneric); IEnumeratorGenericType = Map(typeof(IEnumerator<>)); ICollectionGenericType = Map(typeof(ICollection<>)); IListGenericType = Map(typeof (IList<>)); IListType = Map(typeof (IList)); IAstMacroType = Map(typeof(IAstMacro)); IAstGeneratorMacroType = Map(typeof(IAstGeneratorMacro)); AstNodeType = Map(typeof(Node)); ObjectArrayType = ObjectType.MakeArrayType(1); PreparePrimitives(); PrepareBuiltinFunctions(); }
public ArrayTypeCache(IType elementType) { _arrayTypes = new MemoizedFunction<int, IArrayType>(newRank => new ArrayType(elementType, newRank)); }
public CallableResolutionService() : base(CompilerContext.Current) { _calculateArgumentScore = new MemoizedFunction <IType, IType, int>(CalculateArgumentScore); My <CurrentScope> .Instance.Changed += (sender, args) => _calculateArgumentScore.Clear(); }
public ReflectionNamespace(IReflectionTypeSystemProvider provider) { _childNamespaces = new MemoizedFunction <string, ReflectionNamespace>(StringComparer.Ordinal, CreateChildNamespace); _typeLists = new MemoizedFunction <string, List <Type> >(StringComparer.Ordinal, NewTypeList); _provider = provider; }
private ReflectionTypeSystemProvider(MemoizedFunction<Assembly, AssemblyReference> referenceCache) { _referenceCache = referenceCache; }
public ArrayTypeCache(IType elementType) { _arrayTypes = new MemoizedFunction <int, IArrayType>(newRank => new ArrayType(elementType, newRank)); }
private ReflectionTypeSystemProvider(MemoizedFunction <Assembly, AssemblyReference> referenceCache) { _referenceCache = referenceCache; }
public ReflectionTypeSystemProvider() { _referenceCache = new MemoizedFunction <Assembly, AssemblyReference>(AssemblyEqualityComparer.Default, CreateReference); Initialize(); }
public ReflectionNamespace(IReflectionTypeSystemProvider provider) { _childNamespaces = new MemoizedFunction<string, ReflectionNamespace>(StringComparer.Ordinal, CreateChildNamespace); _typeLists = new MemoizedFunction<string, List<Type>>(StringComparer.Ordinal, NewTypeList); _provider = provider; }
public void LeaveNamespace() { CurrentNamespace = CurrentNamespace.ParentNamespace; _resolveName = _stackNameCaches.Pop(); _resolveExtensionFor = _stackExtensionCaches.Pop(); }
public TypeSystemServices(CompilerContext context) { if (null == context) { throw new ArgumentNullException("context"); } _context = context; _anonymousCallablesManager = new AnonymousCallablesManager(this); _findImplicitConversionOperator = new MemoizedFunction <IType, IType, IMethod>((fromType, toType) => FindConversionOperator("op_Implicit", fromType, toType)); _findExplicitConversionOperator = new MemoizedFunction <IType, IType, IMethod>((fromType, toType) => FindConversionOperator("op_Explicit", fromType, toType)); My <CurrentScope> .Instance.Changed += (sender, args) => ClearScopeDependentMemoizedFunctions(); _canBeReachedByPromotion = new MemoizedFunction <IType, IType, bool>(CanBeReachedByPromotionImpl); DuckType = Map(typeof(Builtins.duck)); IQuackFuType = Map(typeof(IQuackFu)); VoidType = Map(Types.Void); ObjectType = Map(Types.Object); RegexType = Map(Types.Regex); ValueTypeType = Map(typeof(ValueType)); EnumType = Map(typeof(Enum)); ArrayType = Map(Types.Array); TypeType = Map(Types.Type); StringType = Map(Types.String); BoolType = Map(Types.Bool); SByteType = Map(Types.SByte); CharType = Map(Types.Char); ShortType = Map(Types.Short); IntType = Map(Types.Int); LongType = Map(Types.Long); ByteType = Map(Types.Byte); UShortType = Map(Types.UShort); UIntType = Map(Types.UInt); ULongType = Map(Types.ULong); SingleType = Map(Types.Single); DoubleType = Map(Types.Double); DecimalType = Map(Types.Decimal); TimeSpanType = Map(Types.TimeSpan); DateTimeType = Map(Types.DateTime); RuntimeServicesType = Map(Types.RuntimeServices); BuiltinsType = Map(Types.Builtins); ListType = Map(Types.List); HashType = Map(Types.Hash); ICallableType = Map(Types.ICallable); IEnumerableType = Map(Types.IEnumerable); IEnumeratorType = Map(typeof(IEnumerator)); ICollectionType = Map(Types.ICollection); IDisposableType = Map(typeof(IDisposable)); IntPtrType = Map(Types.IntPtr); UIntPtrType = Map(Types.UIntPtr); MulticastDelegateType = Map(Types.MulticastDelegate); DelegateType = Map(Types.Delegate); SystemAttribute = Map(typeof(Attribute)); ConditionalAttribute = Map(typeof(ConditionalAttribute)); IEnumerableGenericType = Map(Types.IEnumerableGeneric); IEnumeratorGenericType = Map(typeof(IEnumerator <>)); ICollectionGenericType = Map(typeof(ICollection <>)); IListGenericType = Map(typeof(IList <>)); IListType = Map(typeof(IList)); IAstMacroType = Map(typeof(IAstMacro)); IAstGeneratorMacroType = Map(typeof(IAstGeneratorMacro)); ObjectArrayType = ObjectType.MakeArrayType(1); PreparePrimitives(); PrepareBuiltinFunctions(); }
public ReflectionTypeSystemProvider() { _referenceCache = new MemoizedFunction<Assembly, AssemblyReference>(AssemblyEqualityComparer.Default, CreateReference); Initialize(); }