private IInterpetedOperation <IInterpetedAnyType> MethodDefinition <TIn, TOut>(IInternalMethodDefinition codeElement) where TIn : class, IInterpetedAnyType where TOut : class, IInterpetedAnyType { if (backing.TryGetValue(codeElement, out var res)) { return(res); } else { var op = new InterpetedMethodDefinition <TIn, TOut>(); backing.Add(codeElement, op); op.Init( MemberDefinition(codeElement.ParameterDefinition).Cast <InterpetedMemberDefinition <TIn> >(), codeElement.Body.Select(x => x.Convert(this)).ToArray(), new InterpetedScopeTemplate(codeElement.Scope, codeElement.Scope.ToVerifiableType()), codeElement.Returns().Cast <IMethodType>()); if (codeElement.IsEntryPoint) { // sloppy this should be on the prop if (EntryPoint == null) { EntryPoint = op.Cast <IInterpetedOperation <IInterpetedMethod <IInterpedEmpty, IInterpedEmpty> > >(); } else { new Exception("we already have an entry point"); } } return(op); } }
public IInterpetedOperation MethodDefinition(IInternalMethodDefinition codeElement) { if (backing.TryGetValue(codeElement, out var res)) { return(res); } else { var op = new InterpetedMethodDefinition(); backing.Add(codeElement, op); op.Init( MemberDefinition(codeElement.ParameterDefinition).CastTo <InterpetedMemberDefinition>(), codeElement.Body.Select(x => x.Convert(this)).ToArray(), new InterpetedScopeTemplate(codeElement.Scope, codeElement.Scope.ToVerifiableType()), codeElement.Returns().CastTo <IMethodType>()); return(op); } }