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); }
public TypeOrOperationMaker() : base( SymbolsRegistry.StaticTypeOrSymbol, //(l, r) => new Box<FrontEndOrType>(new WeakTypeOrOperation(l, r).FrontendType()), (s, c, l, r) => { var key = new ImplicitKey(Guid.NewGuid()); var orType = c.TypeProblem.CreateOrType( s, key, l.SetUpSideNode.TransformInner(y => y.SafeCastTo <Tpn.ITypeProblemNode, Tpn.TypeProblem2.TypeReference>()), r.SetUpSideNode.TransformInner(y => y.SafeCastTo <Tpn.ITypeProblemNode, Tpn.TypeProblem2.TypeReference>()), new WeakTypeOrOperationConverter()); var reference = c.TypeProblem.CreateTypeReference(s, key, new WeakTypeReferenceConverter()); return(reference); }) { }
public ISetUpResult <IBox <WeakObjectDefinition>, Tpn.IValue> Run(Tpn.IStaticScope scope, ISetUpContext context) { scope = scope.EnterInitizaionScopeIfNessisary(); if (!(scope is Tpn.IScope runtimeScope)) { throw new NotImplementedException("this should be an IError"); } var key = new ImplicitKey(Guid.NewGuid()); var box = new Box <IReadOnlyList <IOrType <IBox <WeakAssignOperation>, IError> > >(); var myScope = context.TypeProblem.CreateObjectOrModule(scope, key, new WeakObjectConverter(box), new WeakScopeConverter()); // {6B83A7F1-0E28-4D07-91C8-57E6878E97D9} // module has similar code //foreach (var element in elements) //{ // element.Switch( // y => // { // list.Add(OrType.Make<IResolve<IBox<IFrontendCodeElement>>, IError>(y.Run(myScope, context).Resolve)); // }, // y => // { // // it is a bit weird that types are not used at all // y.Run(myScope, context); // }, // y => // { // // this is also a bit wierd, these errors are anything that was not parsed // // they are not really related to the assignments they are bing placed next to // list.Add(OrType.Make<IResolve<IBox<IFrontendCodeElement>>, IError>(y)); // }); //} var nextElements = elements.Select(x => x.TransformInner(y => y.Run(myScope, context.CreateChildContext(this)).Resolve)).ToArray(); var value = context.TypeProblem.CreateValue(runtimeScope, key); // ugh! an object is a type // return(new SetUpResult <IBox <WeakObjectDefinition>, Tpn.IValue>(new ResolveReferanceObjectDefinition(myScope, nextElements, box), OrType.Make <Tpn.IValue, IError>(value))); }
public Tpn.TypeProblem2.Object InitizeForTypeProblem(Tpn.TypeProblem2 typeProblem2) { key = new ImplicitKey(Guid.NewGuid()); myScope = typeProblem2.builder.CreateObjectOrModule(typeProblem2.Dependency, key, new WeakRootConverter(assignmentsBox, entryBox), new WeakScopeConverter()); return(myScope); }