Beispiel #1
0
 public override IBuildIntention <IGenericMethodDefinition> GetBuildIntention(IConversionContext context)
 {
     var(toBuild, maker) = GenericMethodDefinition.Create();
     return(new BuildIntention <IGenericMethodDefinition>(toBuild, () =>
     {
         maker.Build(
             OutputType.Is1OrThrow().Convert(context),
             ParameterDefinition.Convert(context),
             Scope.Is1OrThrow().Convert(context),
             Body.GetValue().Select(x => x.Is1OrThrow().GetValue().ConvertElementOrThrow(context)).ToArray(),
             StaticInitailizers.Select(x => x.GetOrThrow().ConvertElementOrThrow(context)).ToArray(),
             TypeParameterDefinitions.Select(x => x.Is1OrThrow().Convert(context).SafeCastTo(out IGenericTypeParameter _)).ToArray());
     }));
Beispiel #2
0
        public IBuildIntention <IImplementationDefinition> GetBuildIntention(IConversionContext context)
        {
            var(toBuild, maker) = ImplementationDefinition.Create();



            return(new BuildIntention <IImplementationDefinition>(toBuild, () =>
            {
                var contextMember = ContextDefinition.Convert(context);

                maker.Build(
                    OutputType.Is1OrThrow().Convert(context),
                    contextMember,
                    ParameterDefinition.Convert(context),
                    Scope.GetValue().Convert(context),
                    MethodBody.GetValue().Select(x => x.Is1OrThrow().GetValue().ConvertElementOrThrow(context)).ToArray(),
                    StaticInitialzers.Select(x => x.ConvertElementOrThrow(context)).ToArray(),
                    Model.Instantiated.Scope.CreateAndBuild(new IsStatic[] {
                    new IsStatic(contextMember, false)
                }));
            }));
        }