public ITokenMatching <ISetUp <IBox <TFrontendCodeElement>, Tpn.IValue> > TryMake(IMatchedTokenMatching tokenMatching) { var matching = tokenMatching .Has(new BinaryOperationMatcher(Symbol), out var _); return(matching.ConvertIfMatched(match => { var left = OrType.Make <ISetUp <IBox <IFrontendCodeElement>, Tpn.ITypeProblemNode>, IError>(match.lhs.SafeCastTo(out ISetUp <IBox <IFrontendCodeElement>, Tpn.ITypeProblemNode> _)); var right = OrType.Make <ISetUp <IBox <IFrontendCodeElement>, Tpn.ITypeProblemNode>, IError>(match.rhs.SafeCastTo(out ISetUp <IBox <IFrontendCodeElement>, Tpn.ITypeProblemNode> _)); var res = new BinaryPopulateScope <TFrontendCodeElement, TCodeElement>(left, right, Make, keyMaker, intoInitScope); return res; }, tokenMatching)); }
//private BinaryOperation.MakeBinaryType<IBox<IFrontendType<IVerifiableType>>> Make { get; } public ITokenMatching <ISetUp <IBox <IFrontendType <IVerifiableType> >, Tpn.TypeProblem2.TypeReference> > TryMake(IMatchedTokenMatching tokenMatching) { var matching = tokenMatching .Has(new BinaryTypeOperationMatcher(Symbol), out var match); if (matching is IMatchedTokenMatching matched) { //var left = matching.Context.Map.GetGreatestParent(match.lhs); //var right = matching.Context.Map.GetGreatestParent(match.rhs); //IOrType<ISetUp<IBox<IFrontendType<IVerifiableType>>, Tpn.ITypeProblemNode>, IError> leftType = OrType.Make<ISetUp<IBox<IFrontendType<IVerifiableType>>, Tpn.ITypeProblemNode>, IError>(Error.Other("Must be a type")); //if (left is IOrType<ISetUp<IBox<IFrontendType<IVerifiableType>>, Tpn.ITypeProblemNode>,IError> leftTypeMatched ) { // leftType = leftTypeMatched; //} //IOrType<ISetUp<IBox<IFrontendType<IVerifiableType>>, Tpn.ITypeProblemNode>, IError> rightType = OrType.Make<ISetUp<IBox<IFrontendType<IVerifiableType>>, Tpn.ITypeProblemNode>, IError>(Error.Other("Must be a type")); //if (right is IOrType<ISetUp<IBox<IFrontendType<IVerifiableType>>, Tpn.ITypeProblemNode>, IError> rightTypeMatched) //{ // rightType = rightTypeMatched; //} var res = new BinaryPopulateScope(match.lhs, match.rhs, /*Make,*/ toTypeProblemThings); //matching.Context.Map.SetElementParent(match.lhs, res); //matching.Context.Map.SetElementParent(match.rhs, res); return(TokenMatching <ISetUp <IBox <IFrontendType <IVerifiableType> >, Tpn.TypeProblem2.TypeReference> > .MakeMatch( tokenMatching, res, matched.EndIndex )); } return(TokenMatching <ISetUp <IBox <IFrontendType <IVerifiableType> >, Tpn.TypeProblem2.TypeReference> > .MakeNotMatch( matching.Context)); }