Microsoft.JScript.Print.TranslateToIL C# (CSharp) Method

TranslateToIL() private method

private TranslateToIL ( ILGenerator il, Type rtype ) : void
il ILGenerator
rtype System.Type
return void
      internal override void TranslateToIL(ILGenerator il, Type rtype){
        if (this.context.document.debugOn)
          il.Emit(OpCodes.Nop);
        ASTList astList = this.operand;
        int n = astList.count;
        for (int i = 0; i < n; i++){
          AST ast = astList[i];
          IReflect ir = ast.InferType(null);
          if (ir == Typeob.String)
            ast.TranslateToIL(il, Typeob.String);
          else{
            ast.TranslateToIL(il, Typeob.Object);
            ConstantWrapper.TranslateToILInt(il, 1);
            il.Emit(OpCodes.Call, CompilerGlobals.toStringMethod);
          }
          if (i == n-1)
            il.Emit(OpCodes.Call, CompilerGlobals.writeLineMethod);
          else
            il.Emit(OpCodes.Call, CompilerGlobals.writeMethod);
        }
        if (n == 0){
          il.Emit(OpCodes.Ldstr, "");
          il.Emit(OpCodes.Call, CompilerGlobals.writeLineMethod);
        }
        if (rtype != Typeob.Void){
          il.Emit(OpCodes.Ldsfld, CompilerGlobals.undefinedField);
          Convert.Emit(this, il, Typeob.Object, rtype);
        }
      }