Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 public IIsPossibly <IFrontendType> Returns()
 {
     return(Possibly.Is <IFrontendType>(PrimitiveTypes.CreateEmptyType()));
 }
Esempio n. 3
0
 public IIsPossibly <IFrontendType> Returns()
 {
     return(Possibly.Is <IConvertableFrontendType <IVerifiableType> >(PrimitiveTypes.CreateEmptyType()));
 }
Esempio n. 4
0
        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())));
        }