public static IConvertableFrontendType <IVerifiableType> MapType(IVerifiableType verifiableType) { if (verifiableType is INumberType) { return(PrimitiveTypes.CreateNumberType()); } if (verifiableType is IBooleanType) { return(PrimitiveTypes.CreateBooleanType()); } if (verifiableType is IStringType) { return(PrimitiveTypes.CreateStringType()); } if (verifiableType is IBlockType) { return(PrimitiveTypes.CreateBlockType()); } if (verifiableType is IEmptyType) { return(PrimitiveTypes.CreateEmptyType()); } if (verifiableType is IAnyType) { return(PrimitiveTypes.CreateAnyType()); } if (verifiableType is IMethodType method) { return(PrimitiveTypes.CreateMethodType( MapType(method.InputType), MapType(method.OutputType) )); } if (verifiableType is IImplementationType implementation) { return(PrimitiveTypes.CreateImplementationType( MapType(implementation.ContextType), MapType(implementation.InputType), MapType(implementation.OutputType) )); } throw new NotImplementedException(); }
public PopulatableScope() { this.Parent = Possibly.IsNot <PopulatableScope>(); finalizableScope = new FinalizableScope(this); // do these really belong here or should they be defined in some sort of 'standard library' // here for now I think TryAddType(new NameKey("int"), new Box <IIsPossibly <IFrontendType> >(Possibly.Is <IFrontendType>(PrimitiveTypes.CreateNumberType()))); TryAddType(new NameKey("string"), new Box <IIsPossibly <IFrontendType> >(Possibly.Is <IFrontendType>(PrimitiveTypes.CreateStringType()))); TryAddType(new NameKey("any"), new Box <IIsPossibly <IFrontendType> >(Possibly.Is <IFrontendType>(PrimitiveTypes.CreateAnyType()))); TryAddType(new NameKey("empty"), new Box <IIsPossibly <IFrontendType> >(Possibly.Is <IFrontendType>(PrimitiveTypes.CreateEmptyType()))); TryAddType(new NameKey("bool"), new Box <IIsPossibly <IFrontendType> >(Possibly.Is <IFrontendType>(PrimitiveTypes.CreateBooleanType()))); TryAddGeneric( new NameKey("method"), new Box <IIsPossibly <IFrontendGenericType> >(Possibly.Is <IFrontendGenericType>(PrimitiveTypes.CreateGenericMethodType()))); TryAddGeneric( new NameKey("implementation"), new Box <IIsPossibly <IFrontendGenericType> >(Possibly.Is <IFrontendGenericType>(PrimitiveTypes.CreateGenericImplementationType()))); }