Пример #1
0
            /// <inheritdoc />
            protected override Result <TypeReference, IError> GetGenericTypeParameter(
                TypeReference expectedTypeReference,
                FreezableStepData freezableStepData,
                TypeResolver typeResolver)
            {
                var variableName = freezableStepData
                                   .TryGetVariableName(nameof(GetVariable <object> .Variable), StepType);

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

                if (expectedTypeReference != TypeReference.Unknown.Instance &&
                    typeResolver.Dictionary.TryGetValue(variableName.Value, out var tr))
                {
                    if (tr.Allow(expectedTypeReference, typeResolver))
                    {
                        return(expectedTypeReference);
                    }
                    else if (expectedTypeReference.Allow(tr, typeResolver))
                    {
                        return(tr);
                    }

                    return(Result.Failure <TypeReference, IError>(
                               ErrorCode.WrongOutputType
                               .ToErrorBuilder(TypeName, tr.Name, expectedTypeReference.Name)
                               .WithLocation(freezableStepData)
                               ));
                }

                return(new TypeReference.Variable(variableName.Value));
            }
Пример #2
0
            GetVariablesSet(
                TypeReference expectedTypeReference,
                FreezableStepData freezableStepData,
                TypeResolver typeResolver)
            {
                var vn = freezableStepData.TryGetVariableName(
                    nameof(SetVariable <object> .Variable),
                    StepType
                    );

                if (vn.IsFailure)
                {
                    yield break;
                }

                var memberType = GetGenericTypeParameter(
                    expectedTypeReference,
                    freezableStepData,
                    typeResolver
                    );

                if (memberType.IsFailure)
                {
                    yield return(vn.Value, TypeReference.Unknown.Instance);
                }
                else
                {
                    yield return(vn.Value, memberType.Value);
                }
            }
Пример #3
0
            GetVariablesSet(
                TypeReference expectedTypeReference,
                FreezableStepData freezableStepData,
                TypeResolver typeResolver)
            {
                var vn = freezableStepData.TryGetVariableName(nameof(AppendString.Variable), StepType);

                if (vn.IsFailure)
                {
                    yield break;
                }

                yield return(
                    vn.Value,
                    TypeReference.Actual.String);
            }