public VarargExpressionGenerator(GeneratorFactory factory, FunctionDefinitionSyntaxNode func, VarargExpressionSyntaxNode expr) : base(0)
 {
     _isVararg      = expr.ReceiverMultiRetState == ExpressionReceiverMultiRetState.Variable;
     _type          = func.VarargType.GetVMSpecializationType();
     _funcVarargSig = factory.Function.VarargSignature;
 }
 public override void EmitGet(InstructionWriter writer, IStackFragment sigBlock, StackSignature sigType,
                              int sigIndex, bool keepSig)
 {
     Debug.Assert(_isVararg);
     if (sigIndex > 255 || sigBlock.Offset > 255 | sigType.FixedSize > 127)
     {
         throw new NotImplementedException();
     }
     //Note that for VARG/VARGC, we are using a different version of R1-R3. See OpCodes doc for details.
     Debug.Assert(_funcVarargSig.FixedSize == 0);
     if (_funcVarargSig.IsCompatibleWith(sigType))
     {
         writer.WriteUUS(keepSig ? OpCodes.VARG : OpCodes.VARGC,
                         sigBlock.Offset, sigIndex, sigType.FixedSize);
     }
     else
     {
         writer.WriteUUS(keepSig ? OpCodes.VARG : OpCodes.VARGC,
                         sigBlock.Offset, sigIndex, -1);
     }
 }
Exemple #3
0
 //For vararg expr: calculate the value and write to stack at sigblock's location, with the given sig index.
 //The sigIndex is the index into proto's signature list. This should be the out signature of function calls.
 //sigType is the instance at sig index. It is needed by the new sig adjustment method.
 //EmitPrep will be called before this.
 public virtual void EmitGet(InstructionWriter writer, IStackFragment sigBlock, StackSignature sigType,
                             int sigIndex, bool keepSig)
 {
     throw new NotSupportedException();
 }