Exemple #1
0
        internal void Parse(BoundArgListOperator boundArgListOperator)
        {
            base.Parse(boundArgListOperator);

            foreach (var boundExpression in boundArgListOperator.Arguments)
            {
                this.arguments.Add(Deserialize(boundExpression) as Expression);
            }
        }
            public ExpandedVarargsMethodSymbol(MethodSymbol underlyingMethod, BoundArgListOperator argList)
            {
                this.underlyingMethod = underlyingMethod;

                ArrayBuilder<ParameterSymbol> builder = ArrayBuilder<ParameterSymbol>.GetInstance();
                for (int i = 0; i < argList.Arguments.Count; ++i)
                {
                    Debug.Assert(argList.Arguments[i].Type != null);

                    builder.Add(new SynthesizedParameterSymbol(
                        container: this, 
                        type: argList.Arguments[i].Type,
                        ordinal: i + underlyingMethod.ParameterCount,
                        refKind: argList.ArgumentRefKindsOpt.IsNullOrEmpty ? RefKind.None : argList.ArgumentRefKindsOpt[i],
                        name: "")); // these fake parameters are never accessed by name.
                }

                this.extraParameters = builder.ToReadOnlyAndFree();
            }
Exemple #3
0
            public ExpandedVarargsMethodSymbol(MethodSymbol underlyingMethod, BoundArgListOperator argList)
            {
                this.underlyingMethod = underlyingMethod;

                ArrayBuilder <ParameterSymbol> builder = ArrayBuilder <ParameterSymbol> .GetInstance();

                for (int i = 0; i < argList.Arguments.Count; ++i)
                {
                    Debug.Assert(argList.Arguments[i].Type != null);

                    builder.Add(new SynthesizedParameterSymbol(
                                    container: this,
                                    type: argList.Arguments[i].Type,
                                    ordinal: i + underlyingMethod.ParameterCount,
                                    refKind: argList.ArgumentRefKindsOpt.IsNullOrEmpty ? RefKind.None : argList.ArgumentRefKindsOpt[i],
                                    name: "")); // these fake parameters are never accessed by name.
                }

                this.extraParameters = builder.ToReadOnlyAndFree();
            }
Exemple #4
0
 private void EmitSymbolToken(
     MethodSymbol method,
     SyntaxNode syntaxNode,
     BoundArgListOperator optArgList,
     bool encodeAsRawDefinitionToken = false
     )
 {
     _builder.EmitToken(
         _module.Translate(
             method,
             syntaxNode,
             _diagnostics,
             optArgList,
             needDeclaration: encodeAsRawDefinitionToken
             ),
         syntaxNode,
         _diagnostics,
         encodeAsRawDefinitionToken
         );
 }
Exemple #5
0
        internal MethodSymbol GetExpandedSymbol(BoundArgListOperator argList)
        {
            if (expandedSymbols == null)
            {
                Interlocked.CompareExchange(ref expandedSymbols, new ConcurrentHashSet <ExpandedVarargsMethodSymbol>(), null);
            }

            ExpandedVarargsMethodSymbol newX = new ExpandedVarargsMethodSymbol(this, argList);

            // There are races here where we could end up with two outstanding copies of "the same"
            // expanded symbol; we really don't care. The worst that will happen is we emit a duplicate
            // entry in the method ref table.
            foreach (ExpandedVarargsMethodSymbol x in expandedSymbols)
            {
                if (x == newX)
                {
                    return(x);
                }
            }
            expandedSymbols.Add(newX);
            return(newX);
        }
        internal MethodSymbol GetExpandedSymbol(BoundArgListOperator argList)
        {
            if (expandedSymbols == null)
            {
                Interlocked.CompareExchange(ref expandedSymbols, new ConcurrentHashSet<ExpandedVarargsMethodSymbol>(), null);
            }

            ExpandedVarargsMethodSymbol newX = new ExpandedVarargsMethodSymbol(this, argList);

            // There are races here where we could end up with two outstanding copies of "the same"
            // expanded symbol; we really don't care. The worst that will happen is we emit a duplicate
            // entry in the method ref table.
            foreach(ExpandedVarargsMethodSymbol x in expandedSymbols)
            {
                if (x == newX)
                {
                    return x;
                }
            }
            expandedSymbols.Add(newX);
            return newX;
        }
Exemple #7
0
 private void EmitSymbolToken(MethodSymbol method, CSharpSyntaxNode syntaxNode, BoundArgListOperator optArgList)
 {
     _builder.EmitToken(_module.Translate(method, syntaxNode, _diagnostics, optArgList), syntaxNode, _diagnostics);
 }
Exemple #8
0
 private void EmitArgListOperator(BoundArgListOperator expression)
 {
     for (int i = 0; i < expression.Arguments.Length; i++)
     {
         BoundExpression argument = expression.Arguments[i];
         RefKind refKind = expression.ArgumentRefKindsOpt.IsDefaultOrEmpty ? RefKind.None : expression.ArgumentRefKindsOpt[i];
         EmitArgument(argument, refKind);
     }
 }
 private void EmitSymbolToken(MethodSymbol method, CSharpSyntaxNode syntaxNode, BoundArgListOperator optArgList)
 {
     builder.EmitToken(module.Translate(method, syntaxNode, diagnostics, optArgList), syntaxNode, diagnostics);
 }
Exemple #10
0
 private void EmitSymbolToken(MethodSymbol method, SyntaxNode syntaxNode, BoundArgListOperator optArgList, bool encodeAsRawDefinitionToken = false)
 {
     _builder.EmitToken(_module.Translate(method, syntaxNode, _diagnostics, optArgList, needDeclaration: encodeAsRawDefinitionToken), syntaxNode, _diagnostics, encodeAsRawDefinitionToken);
 }
Exemple #11
0
 public override object VisitArgListOperator(BoundArgListOperator node, object arg)
 {
     return Unimplemented(node, "arglist");
 }
Exemple #12
0
 public override object VisitArgListOperator(BoundArgListOperator node, object arg)
 {
     return(Unimplemented(node, "arglist"));
 }