Beispiel #1
0
        public PopulatableScope(PopulatableScope parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            Parent           = Possibly.Is(parent);
            finalizableScope = new FinalizableScope(this);
        }
Beispiel #2
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())));
        }