コード例 #1
0
 /// <inheritdoc />
 protected override Result <TypeReference, IErrorBuilder> GetExpectedArrayTypeReference(
     TypeReference expectedTypeReference)
 {
     return(expectedTypeReference
            .CheckAllows(TypeReference.Unit.Instance, StepType, null)
            .Map(_ => new TypeReference.Array(TypeReference.Any.Instance) as TypeReference));
 }
コード例 #2
0
            /// <inheritdoc />
            protected override Result <TypeReference, IError> GetGenericTypeParameter(
                TypeReference expectedTypeReference,
                FreezableStepData freezableStepData,
                TypeResolver typeResolver)
            {
                var checkResult = expectedTypeReference
                                  .CheckAllows(TypeReference.Actual.Bool, StepType, typeResolver)
                                  .MapError(x => x.WithLocation(freezableStepData));

                if (checkResult.IsFailure)
                {
                    return(checkResult.ConvertFailure <TypeReference>());
                }

                var result = freezableStepData
                             .TryGetStep(nameof(Terms), StepType)
                             .Bind(
                    x => x.TryGetOutputTypeReference(
                        new TypeReference.Array(TypeReference.Any.Instance),
                        typeResolver
                        )
                    )
                             .Bind(
                    x => x.TryGetArrayMemberTypeReference(typeResolver)
                    .MapError(e => e.WithLocation(freezableStepData))
                    );

                return(result);
            }
コード例 #3
0
ファイル: SimpleStepFactory.cs プロジェクト: reductech/Core
        /// <inheritdoc />
        public override Result <TypeReference, IError> TryGetOutputTypeReference(
            TypeReference expectedTypeReference,
            FreezableStepData freezableStepData,
            TypeResolver typeResolver)
        {
            var reference = TypeReference.Create(typeof(TOutput));

            return(expectedTypeReference
                   .CheckAllows(reference, StepType, typeResolver)
                   .MapError(x => x.WithLocation(freezableStepData))
                   .Map(_ => reference));
        }
コード例 #4
0
ファイル: ArrayLength.cs プロジェクト: reductech/Core
            /// <inheritdoc />
            protected override Result <TypeReference, IErrorBuilder> GetExpectedArrayTypeReference(
                TypeReference expectedTypeReference)
            {
                var r = expectedTypeReference.CheckAllows(
                    TypeReference.Actual.Integer,
                    StepType,
                    null
                    );

                if (r.IsFailure)
                {
                    return(r.ConvertFailure <TypeReference>());
                }

                return(new TypeReference.Array(TypeReference.Any.Instance));
            }
コード例 #5
0
            /// <inheritdoc />
            protected override Result <TypeReference, IError> GetGenericTypeParameter(
                TypeReference expectedTypeReference,
                FreezableStepData freezableStepData,
                TypeResolver typeResolver)
            {
                var checkResult =
                    expectedTypeReference.CheckAllows(
                        TypeReference.Unit.Instance,
                        StepType,
                        typeResolver
                        );

                if (checkResult.IsFailure)
                {
                    return(checkResult.ConvertFailure <TypeReference>()
                           .MapError(x => x.WithLocation(freezableStepData)));
                }

                var stepTypeReference = freezableStepData.TryGetStep(nameof(Step), StepType)
                                        .Bind(x => x.TryGetOutputTypeReference(TypeReference.Any.Instance, typeResolver));

                return(stepTypeReference);
            }