コード例 #1
0
        public static IReturnsResult <TMock> Returns <TMock>(this IReturns <TMock, IPromise <DataType> > mock, DataType type)
            where TMock : class
        {
            var promise = new AcyclicPromise <DataType>();

            promise.BeginFulfilling();
            promise.Fulfill(type);
            return(mock.Returns(promise));
        }
コード例 #2
0
        public NonMemberSymbol(Symbol symbol)
        {
            if (!(symbol.ContainingSymbol is NamespaceOrPackageSymbol ||
                  symbol.ContainingSymbol is null))
            {
                throw new ArgumentException("Symbol must be for a non-member declaration", nameof(symbol));
            }
            var containingSymbol = symbol.ContainingSymbol as NamespaceOrPackageSymbol;

            InCurrentPackage    = false;
            ContainingNamespace = containingSymbol?.NamespaceName ?? NamespaceName.Global;
            Name   = symbol.Name ?? throw new ArgumentException("Symbol must have a name", nameof(symbol));
            Symbol = AcyclicPromise.ForValue(symbol);
        }
 public ConstructorDeclarationSyntax(
     IClassDeclarationSyntax declaringType,
     TextSpan span,
     CodeFile file,
     IAccessModifierToken?accessModifier,
     TextSpan nameSpan,
     Name?name,
     ISelfParameterSyntax implicitSelfParameter,
     FixedList <IConstructorParameterSyntax> parameters,
     IReachabilityAnnotationsSyntax reachabilityAnnotations,
     IBodySyntax body)
     : base(span, file, accessModifier, nameSpan, name, parameters, reachabilityAnnotations,
            new AcyclicPromise <ConstructorSymbol>())
 {
     DeclaringClass        = declaringType;
     ImplicitSelfParameter = implicitSelfParameter;
     Parameters            = parameters;
     Body   = body;
     Symbol = (AcyclicPromise <ConstructorSymbol>)base.Symbol;
 }
コード例 #4
0
 protected MethodDeclarationSyntax(
     IClassDeclarationSyntax declaringClass,
     TextSpan span,
     CodeFile file,
     IAccessModifierToken?accessModifier,
     TextSpan nameSpan,
     Name name,
     ISelfParameterSyntax selfParameter,
     FixedList <INamedParameterSyntax> parameters,
     ITypeSyntax?returnType,
     IReachabilityAnnotationsSyntax reachabilityAnnotations)
     : base(span, file, accessModifier, nameSpan, name,
            parameters, reachabilityAnnotations, new AcyclicPromise <MethodSymbol>())
 {
     DeclaringClass = declaringClass;
     Name           = name;
     SelfParameter  = selfParameter;
     Parameters     = parameters;
     ReturnType     = returnType;
     Symbol         = (AcyclicPromise <MethodSymbol>)base.Symbol;
 }
コード例 #5
0
 public AssociatedFunctionDeclarationSyntax(
     IClassDeclarationSyntax declaringClass,
     TextSpan span,
     CodeFile file,
     IAccessModifierToken?accessModifier,
     TextSpan nameSpan,
     Name name,
     FixedList <INamedParameterSyntax> parameters,
     ITypeSyntax?returnTypeSyntax,
     IReachabilityAnnotationsSyntax reachabilityAnnotations,
     IBodySyntax body)
     : base(span, file, accessModifier, nameSpan, name, parameters,
            reachabilityAnnotations, new AcyclicPromise <FunctionSymbol>())
 {
     DeclaringClass = declaringClass;
     Name           = name;
     Parameters     = parameters;
     ReturnType     = returnTypeSyntax;
     Body           = body;
     Symbol         = (AcyclicPromise <FunctionSymbol>)base.Symbol;
 }