// 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);
                    }
                }
Esempio n. 2
0
 public override string?ToString()
 {
     return(key.ToString());
 }