Exemplo n.º 1
0
        public void OrTypesJustNeedBothToMatchOne()
        {
            var a1 = A1();
            var b1 = B1();
            var b2 = B2();
            var b3 = B3();

            var or1 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(Array.Empty <WeakMemberDefinition>()),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >());
            var or2 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b2)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b3)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(new List <WeakMemberDefinition> {
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("bm1"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(new NumberType()))),
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("bm2"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(new NumberType())))
            }),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >());

            // this works since both b2 and b3 are b1
            Assert.True(or1.TheyAreUs(or2, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
            // this does not work because niether b2 nor b3 are a1
            Assert.False(or2.TheyAreUs(or1, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
        }
Exemplo n.º 2
0
        public void OrTypesAreVarient()
        {
            var a1 = A1();
            var a2 = A2();
            var b1 = B1();
            var b2 = B2();

            var or1 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(Array.Empty <WeakMemberDefinition>()),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >()
                );
            var or2 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a2)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b2)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(Array.Empty <WeakMemberDefinition>()),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >()
                );

            Assert.True(or1.TheyAreUs(or2, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
            Assert.False(or2.TheyAreUs(or1, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()).Is1OrThrow());
        }
Exemplo n.º 3
0
                public Type CreateGenericType(IStaticScope parent, IOrType <NameKey, ImplicitKey> key, IReadOnlyList <TypeAndConverter> placeholders, IConvertTo <Type, IOrType <WeakTypeDefinition, WeakGenericTypeDefinition, Tac.SyntaxModel.Elements.AtomicTypes.IPrimitiveType> > converter)
                {
                    var res = new Type(
                        this,
                        $"generic-{key}-{placeholders.Aggregate("", (x, y) => x + "-" + y)}",
                        Possibly.Is(key),
                        converter,
                        Possibly.IsNot <Guid>(),
                        Possibly.IsNot <IInterfaceType>());

                    IsChildOf(parent, res);
                    HasType(parent, key.SwitchReturns <IKey>(x => x, x => x), res);
                    var i = 0;

                    foreach (var placeholder in placeholders)
                    {
                        var placeholderType = new TypeProblem2.GenericTypeParameter(this, $"generic-parameter-{placeholder.key}", i++, Prototypist.Toolbox.OrType.Make <MethodType, Type, Method, InferredType>(res));
                        //var placeholderType = new Type(
                        //    this,
                        //    $"generic-parameter-{placeholder.key}",
                        //    Possibly.Is(placeholder.key),
                        //    placeholder.converter,
                        //    Possibly.IsNot<Guid>(),
                        //    Possibly.IsNot<IInterfaceType>());
                        HasGenericType(Prototypist.Toolbox.OrType.Make <MethodType, Type, Method>(res), placeholder.key, placeholderType);
                    }
                    return(res);
                }
Exemplo n.º 4
0
        public void Any()
        {
            var a1 = A1();
            var a2 = A2();
            var b1 = B1();
            var b2 = B2();
            var m1 = new MethodType(new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a2)), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)));
            var m2 = new MethodType(new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b2)));
            var t1 = new HasMembersType(new WeakScope(new List <WeakMemberDefinition> {
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("a"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1))),
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("b"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)))
            }));
            var t2 = new HasMembersType(new WeakScope(new List <WeakMemberDefinition> {
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("a"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a2))),
                new WeakMemberDefinition(Access.ReadWrite, new NameKey("b"), new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b2)))
            }));
            var or1 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(Array.Empty <WeakMemberDefinition>()),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >()
                );
            var or2 = new FrontEndOrType(
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(b1)),
                new Box <IOrType <IFrontendType <IVerifiableType>, IError> >(OrType.Make <IFrontendType <IVerifiableType>, IError>(a1)),
                OrType.Make <IReadOnlyList <WeakMemberDefinition>, IError>(Array.Empty <WeakMemberDefinition>()),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >(),
                Possibly.IsNot <IBox <IOrType <IFrontendType <IVerifiableType>, IError> > >()
                );

            var any = new AnyType();

            Assert.All(new[] { a1, a2, b1, b2, m1, m2, t1, t2, or1, or2 }, x => any.TheyAreUs(x, new List <(IFrontendType <IVerifiableType>, IFrontendType <IVerifiableType>)>()));
        }
Exemplo n.º 5
0
                // TODO
                // {A48C75B3-07B4-4D84-8803-250D6406695D}
                // this is a bit weird
                // it is get or create
                // but like if something as already made a hopeful member it will just throw
                // that is probably a bug
                // x.y := 5
                // 5 > x
                // boom, probably
                public TransientMember GetReturns(IValue value)
                {
                    if (value.Hopeful is IIsDefinately <InferredType> inferredType)
                    {
                        return(inferredType.Value.Returns.GetOrThrow());
                    }
                    else
                    {
                        var inferredMethodType = new InferredType(this, "generated infered method type");
                        value.Hopeful = Possibly.Is(inferredMethodType);

                        // shared code {A9E37392-760B-427D-852E-8829EEFCAE99}
                        // we don't use has member input/output doesn't go in the member list
                        // it is not a public member
                        // and infered to do not have private members
                        var methodInputKey = new NameKey("generated infered method input - " + Guid.NewGuid());
                        var inputMember    = new Member(this, methodInputKey.ToString() !);
                        inputMember.LooksUp      = Possibly.Is(Prototypist.Toolbox.OrType.Make <MethodType, Type, Object, OrType, InferredType, GenericTypeParameter, IError>(new InferredType(this, "implicit input")));
                        inferredMethodType.Input = Possibly.Is(inputMember);

                        var returnMember = new TransientMember(this, "generated infered method return -" + Guid.NewGuid());
                        returnMember.LooksUp       = Possibly.Is(Prototypist.Toolbox.OrType.Make <MethodType, Type, Object, OrType, InferredType, GenericTypeParameter, IError>(new InferredType(this, "implicit return")));
                        inferredMethodType.Returns = Possibly.Is(returnMember);

                        return(returnMember);
                    }
                }
Exemplo n.º 6
0
        //public static IOrType<MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric> Broaden(this IOrType<MustHave, MustBePrimitive, GivenPathThen,  HasMembers, IsGenericRestraintFor, IsExternal> self) {
        //    return self.SwitchReturns(
        //        x => OrType.Make<MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric>(x),
        //        x => OrType.Make<MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric>(x),
        //        x => OrType.Make<MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric>(x),
        //        x => OrType.Make<MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric>(x),
        //        x => OrType.Make<MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric>(x),
        //        x => OrType.Make<MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric>(x));
        //}

        public static IOrType <IIsPossibly <Guid>, IError> Primitive(this EqualableHashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, HasMembers, IsGeneric, IsExternal> > self)
        {
            var primitives = self.SelectMany(x =>
            {
                if (x.Is2(out var v2))
                {
                    return(new[] { v2 });
                }
                return(Array.Empty <MustBePrimitive>());
            }).ToArray();

            if (primitives.Length == self.Count())
            {
                var groupedPrimitives = primitives.GroupBy(x => x.primitive).ToArray();
                if (groupedPrimitives.Length == 1)
                {
                    return(OrType.Make <IIsPossibly <Guid>, IError>(Possibly.Is(groupedPrimitives.First().Key)));
                }
                return(OrType.Make <IIsPossibly <Guid>, IError>(Error.Other("multiple primitives types...")));
            }

            if (primitives.Any())
            {
                return(OrType.Make <IIsPossibly <Guid>, IError>(Error.Other("primitives and non primitives")));
            }
            return(OrType.Make <IIsPossibly <Guid>, IError>(Possibly.IsNot <Guid>()));
        }
Exemplo n.º 7
0
                public IReadOnlyDictionary <NameKey, GenericTypeParameter> HasGenerics(IValue value, NameKey[] keys)
                {
                    InferredType?inferredType;

                    if (value.Hopeful.Is(out var innerInferredType))
                    {
                        inferredType = innerInferredType;
                    }
                    else
                    {
                        var inferredMethodType = new InferredType(this, "generated infered method type");
                        value.Hopeful = Possibly.Is(inferredMethodType);
                        inferredType  = inferredMethodType;
                    }
                    if (inferredType.Generics.Count > 0)
                    {
                        throw new Exception("this already has generics!");
                    }
                    var i = 0;

                    foreach (var key in keys)
                    {
                        inferredType.Generics.Add(key, new GenericTypeParameter(this, $"generic-parameter-{key}", i++, Prototypist.Toolbox.OrType.Make <MethodType, Type, Method, InferredType>(inferredType)));
                    }
                    return(inferredType.Generics);
                }
Exemplo n.º 8
0
            public IIsPossibly <WeakPathOperation> Run(IResolvableScope scope, IResolveReferenceContext context)
            {
                var res = Possibly.Is(new WeakPathOperation(
                                          left.Run(scope, context),
                                          Possibly.Is(new WeakMemberReference(left.GetReturnedType().GetMemberDefinition(new NameKey(name))))));

                return(res);
            }
Exemplo n.º 9
0
 public static IIsPossibly <ICodeElement> PossiblyConvert(this IFrontendCodeElement self, IConversionContext context)
 {
     if (self is IConvertableFrontendCodeElement <ICodeElement> convertable)
     {
         return(Possibly.Is(convertable.Convert(context)));
     }
     return(Possibly.IsNot <ICodeElement>());
 }
Exemplo n.º 10
0
 internal static IIsPossibly <IBox <IIsPossibly <IWeakMemberDefinition> > > PossiblyGetMember(this IResolvableScope scope, bool staticOnly, IKey name)
 {
     if (scope.TryGetMember(name, staticOnly, out var thing))
     {
         return(Possibly.Is(thing));
     }
     return(Possibly.IsNot <IBox <IIsPossibly <IWeakMemberDefinition> > >());
 }
Exemplo n.º 11
0
                public Type CreateType(IStaticScope parent, IOrType <NameKey, ImplicitKey> key, IConvertTo <Type, IOrType <WeakTypeDefinition, WeakGenericTypeDefinition, Tac.SyntaxModel.Elements.AtomicTypes.IPrimitiveType> > converter, IIsPossibly <Guid> primitive)
                {
                    var res = new Type(this, key.ToString() !, Possibly.Is(key), converter, primitive, Possibly.IsNot <IInterfaceType>());

                    IsChildOf(parent, res);
                    HasType(parent, key.SwitchReturns <IKey>(x => x, x => x), res);
                    return(res);
                }
Exemplo n.º 12
0
 public void Set(T t)
 {
     if (t is IIsPossibly <T> && !(t is IIsDefinately <T>))
     {
         throw new ApplicationException();
     }
     this.t = Possibly.Is(t);
 }
Exemplo n.º 13
0
 internal static IIsPossibly <IBox <IIsPossibly <IFrontendType> > > PossiblyGetType(this IResolvableScope scope, IKey name)
 {
     if (scope.TryGetType(name, out var thing))
     {
         return(Possibly.Is(thing));
     }
     return(Possibly.IsNot <IBox <IIsPossibly <IFrontendType> > >());
 }
Exemplo n.º 14
0
                public TransientMember CreateTransientMember(IScope parent, string debugName)
                {
                    var res = new TransientMember(this, debugName);

                    HasTransientMember(parent, res);
                    res.Context = Possibly.Is(parent);
                    return(res);
                }
Exemplo n.º 15
0
 public TypeOrOperationMaker() : base(SymbolsRegistry.StaticTypeOrSymbol, (l, r) =>
                                      Possibly.Is <IWeakTypeReference>(
                                          new WeakTypeReference(
                                              Possibly.Is <IBox <IIsPossibly <IConvertableFrontendType <IVerifiableType> > > >(
                                                  new Box <IIsPossibly <IConvertableFrontendType <IVerifiableType> > >(
                                                      Possibly.Is <IConvertableFrontendType <IVerifiableType> >(
                                                          new WeakTypeOrOperation(l, r)))))))
 {
 }
Exemplo n.º 16
0
                public TransientMember CreateTransientMember(IScope parent, IKey typeKey, string debugName)
                {
                    var res = new TransientMember(this, debugName);

                    HasTransientMember(parent, res);
                    res.Context = Possibly.Is(parent);
                    res.TypeKey = Prototypist.Toolbox.OrType.Make <IKey, IError, Unset>(typeKey);
                    return(res);
                }
Exemplo n.º 17
0
                public Value CreateValue(IScope scope, IKey typeKey)
                {
                    var res = new Value(this, typeKey.ToString() !);

                    HasValue(scope, res);
                    res.Context = Possibly.Is(scope);
                    res.TypeKey = Prototypist.Toolbox.OrType.Make <IKey, IError, Unset>(typeKey);
                    return(res);
                }
Exemplo n.º 18
0
                public TypeReference CreateTypeReference(IStaticScope context, IKey typeKey, IConvertTo <TypeReference, IFrontendType <IVerifiableType> > converter)
                {
                    var res = new TypeReference(this, typeKey.ToString() !, converter);

                    HasReference(context, res);
                    res.Context = Possibly.Is(context);
                    res.TypeKey = Prototypist.Toolbox.OrType.Make <IKey, IError, Unset>(typeKey);
                    return(res);
                }
Exemplo n.º 19
0
            public IIsPossibly <WeakObjectDefinition> Run(IResolvableScope _, IResolveReferenceContext context)
            {
                var innerRes = new WeakObjectDefinition(
                    scope,
                    elements.Select(x => x.Run(scope, context).Cast <IIsPossibly <WeakAssignOperation> >()).ToArray());
                var res = Possibly.Is(innerRes);

                return(res);
            }
Exemplo n.º 20
0
            public IIsPossibly <WeakAssignOperation> Run(IResolvableScope scope, IResolveReferenceContext context)
            {
                var leftRes = left.Run(scope, context);
                var res     = Possibly.Is(new WeakAssignOperation(
                                              leftRes,
                                              right.Run(scope, context)));

                return(res);
            }
Exemplo n.º 21
0
 public IIsPossibly <WeakBlockDefinition> Run(IResolvableScope _, IResolveReferenceContext context)
 {
     return
         (Possibly.Is(
              new WeakBlockDefinition(
                  resolveReferance.Select(x => x.Run(scope, context)).ToArray(),
                  scope,
                  new IIsPossibly <IConvertableFrontendCodeElement <ICodeElement> > [0])));
 }
Exemplo n.º 22
0
        public PopulatableScope(PopulatableScope parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            Parent           = Possibly.Is(parent);
            finalizableScope = new FinalizableScope(this);
        }
Exemplo n.º 23
0
                public Type CreateTypeExternalType(IStaticScope parent, IConvertTo <Type, IOrType <WeakTypeDefinition, WeakGenericTypeDefinition, Tac.SyntaxModel.Elements.AtomicTypes.IPrimitiveType> > converter, IInterfaceType interfaceType)
                {
                    var key = new ImplicitKey(Guid.NewGuid());
                    var res = new Type(this, key.ToString() !, Possibly.IsNot <IOrType <NameKey, ImplicitKey> >(), converter, Possibly.IsNot <Guid>(), Possibly.Is(interfaceType));

                    IsChildOf(parent, res);
                    // migiht need this, let's try without first
                    //HasType(parent, key, res);
                    return(res);
                }
Exemplo n.º 24
0
        public OverlayMemberDefinition(IWeakMemberDefinition backing, Overlay overlay)
        {
            if (overlay == null)
            {
                throw new ArgumentNullException(nameof(overlay));
            }

            this.backing = backing ?? throw new ArgumentNullException(nameof(backing));
            this.Type    = backing.Type.IfIs(x => Possibly.Is(new OverlayTypeReference(x, overlay)));
        }
Exemplo n.º 25
0
 public ResolvableScope(
     ConcurrentDictionary <IKey, ConcurrentSet <Visiblity <IBox <IIsPossibly <WeakMemberDefinition> > > > > members,
     ConcurrentDictionary <IKey, ConcurrentSet <Visiblity <IBox <IIsPossibly <IFrontendType> > > > > types,
     ConcurrentDictionary <NameKey, ConcurrentSet <Visiblity <IBox <IIsPossibly <IFrontendGenericType> > > > > genericTypes)
 {
     Parent            = Possibly.IsNot <IResolvableScope>();
     this.members      = members ?? throw new ArgumentNullException(nameof(members));
     this.types        = types ?? throw new ArgumentNullException(nameof(types));
     this.genericTypes = genericTypes ?? throw new ArgumentNullException(nameof(genericTypes));
 }
Exemplo n.º 26
0
        public static IIsPossibly <IOrType <EqualableHashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric, IsExternal> >, IError> > Input(this EqualableHashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, HasMembers, IsGeneric, IsExternal> > self)
        {
            if (self.ErrorCheck(out var error))
            {
                return(Possibly.Is(OrType.Make <EqualableHashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric, IsExternal> >, IError>(error)));
            }

            var mustHaves = self
                            .SelectMany(x =>
            {
                if (x.Is1(out var v1))
                {
                    return(new[] { v1 });
                }
                return(Array.Empty <MustHave>());
            })
                            .Where(x => x.path.Is2(out var _))
                            .ToArray();

            if (mustHaves.Any())
            {
                var set = new HashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric, IsExternal> >();

                var givenPaths = self
                                 .SelectMany(x =>
                {
                    if (x.Is3(out var v3))
                    {
                        return(new[] { v3 });
                    }
                    return(Array.Empty <GivenPathThen>());
                })
                                 .Where(x => x.path.Is2(out var _));

                foreach (var mustHave in mustHaves)
                {
                    foreach (var constraint in  mustHave.dependent.GetExtendedConstraints())
                    {
                        set.Add(constraint);
                    }
                }


                foreach (var givenPath in givenPaths)
                {
                    foreach (var constraint in givenPath.dependent.GetExtendedConstraints())
                    {
                        set.Add(constraint);
                    }
                }
                return(Possibly.Is(OrType.Make <EqualableHashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric, IsExternal> >, IError>(new EqualableHashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric, IsExternal> >(set))));
            }

            return(Possibly.IsNot <IOrType <EqualableHashSet <IOrType <MustHave, MustBePrimitive, GivenPathThen, OrConstraint, HasMembers, IsGeneric, IsExternal> >, IError> >());
        }
Exemplo n.º 27
0
            public IIsPossibly <WeakModuleDefinition> Run(IResolvableScope _, IResolveReferenceContext context)
            {
                var innerRes = new WeakModuleDefinition(
                    scope,
                    resolveReferance.Select(x => x.Run(scope, context)).ToArray(),
                    nameKey);

                var res = Possibly.Is(innerRes);

                return(res);
            }
Exemplo n.º 28
0
                public Member CreatePrivateMember(
                    IStaticScope scope,
                    IHavePrivateMembers havePrivateMembers,
                    IKey key)
                {
                    var res = new Member(this, key.ToString() !);

                    HasPrivateMember(havePrivateMembers, key, res);
                    res.Context = Possibly.Is(scope);
                    return(res);
                }
Exemplo n.º 29
0
                public Member CreatePrivateMember(
                    IHavePrivateMembers scope,
                    IKey key,
                    IOrType <MethodType, Type, Object, OrType, InferredType, GenericTypeParameter, IError> type)
                {
                    var res = new Member(this, key.ToString() !);

                    HasPrivateMember(scope, key, res);
                    res.LooksUp = Possibly.Is(type);
                    return(res);
                }
Exemplo n.º 30
0
            public IIsPossibly <WeakMemberReference> Run(IResolvableScope scope, IResolveReferenceContext context)
            {
                memberDefinitionBox.Fill(
                    Possibly.Is(
                        new WeakMemberDefinition(
                            isReadonly,
                            memberName,
                            type.Run(scope, context))));

                return(Possibly.Is(new WeakMemberReference(Possibly.Is(memberDefinitionBox))));
            }