本文整理汇总了C#中AstExpression.APut方法的典型用法代码示例。如果您正苦于以下问题:C# AstExpression.APut方法的具体用法?C# AstExpression.APut怎么用?C# AstExpression.APut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstExpression
的用法示例。
在下文中一共展示了AstExpression.APut方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitExpression
//.........这里部分代码省略.........
var arrayR = frame.AllocateTemp(darrType);
this.Add(node.SourceLocation, RCode.Invoke_static, methodRef, compTypeR, dimArrayR);
var last = this.Add(node.SourceLocation, RCode.Move_result_object, arrayR);
return new RLRange(first, last, arrayR);
}
case AstCode.ByRefArray:
case AstCode.ByRefOutArray:
{
// Create array
var type = (XTypeReference) node.Operand;
var dType = new ArrayType(type.GetReference(targetPackage));
var arrayR = frame.AllocateTemp(dType);
var lengthR = frame.AllocateTemp(PrimitiveType.Int);
// length=1
var initLength = this.Add(node.SourceLocation, RCode.Const, 1, lengthR);
// newarray
this.Add(node.SourceLocation, RCode.New_array, dType, arrayR, lengthR);
if (node.Code == AstCode.ByRefArray)
{
var valueR = args[0].Result;
var arrayType = node.InferredType;
// Perform type conversion if needed
bool isConverted;
var converted = this.ConvertTypeBeforeStore(node.SourceLocation, type, arrayType.ElementType,
valueR, targetPackage, frame, compiler,
out isConverted);
if (isConverted) valueR = converted.Result;
// array[0]=value
var indexR = frame.AllocateTemp(PrimitiveType.Int);
this.Add(node.SourceLocation, RCode.Const, 0, indexR);
this.Add(node.SourceLocation, arrayType.APut(), valueR, arrayR, indexR);
}
var end = this.Add(node.SourceLocation, RCode.Nop);
return new RLRange(initLength, end, arrayR);
}
case AstCode.Ldlen:
{
var r = frame.AllocateTemp(PrimitiveType.Int);
return new RLRange(this.Add(node.SourceLocation, RCode.Array_length, r, args[0].Result), r);
}
case AstCode.Stelem_I:
case AstCode.Stelem_I1:
case AstCode.Stelem_I2:
case AstCode.Stelem_I4:
case AstCode.Stelem_I8:
case AstCode.Stelem_R4:
case AstCode.Stelem_R8:
case AstCode.Stelem_Ref:
case AstCode.Stelem_Any:
{
var first = this.Add(node.SourceLocation, RCode.Nop);
var arrayR = args[0].Result;
var indexR = args[1].Result;
var valueR = args[2].Result;
var valueType = node.Arguments[2].GetResultType();
var arrayType = node.Arguments[0].GetResultType();
// Perform type conversion if needed
bool isConverted;
var converted = this.ConvertTypeBeforeStore(node.SourceLocation, valueType,
arrayType.ElementType, valueR, targetPackage,
frame, compiler, out isConverted);
if (isConverted) valueR = converted.Result;