本文整理汇总了C#中AstExpression.AGet方法的典型用法代码示例。如果您正苦于以下问题:C# AstExpression.AGet方法的具体用法?C# AstExpression.AGet怎么用?C# AstExpression.AGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstExpression
的用法示例。
在下文中一共展示了AstExpression.AGet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitExpression
//.........这里部分代码省略.........
// 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;
// Store in array
var aput = this.Add(node.SourceLocation, node.APut(), valueR, arrayR, indexR);
return new RLRange(first, aput, valueR);
}
case AstCode.Ldelem_I:
case AstCode.Ldelem_I1:
case AstCode.Ldelem_I2:
case AstCode.Ldelem_I4:
case AstCode.Ldelem_I8:
case AstCode.Ldelem_R4:
case AstCode.Ldelem_R8:
case AstCode.Ldelem_U1:
case AstCode.Ldelem_U2:
case AstCode.Ldelem_U4:
case AstCode.Ldelem_Ref:
case AstCode.Ldelem_Any:
{
var arrayR = args[0].Result;
var indexR = args[1].Result;
var arrayType = node.Arguments[0].GetResultType();
var elementType = arrayType.ElementType;
// Allocate registry for value
var valueR = frame.AllocateTemp(elementType.GetReference(targetPackage));
// Get from array
var first = this.Add(node.SourceLocation, node.AGet(), valueR, arrayR, indexR);
return new RLRange(first, valueR);
}
#endregion
#region Local variables / arguments
case AstCode.Ldloc:
{
var variable = (AstVariable) node.Operand;
var valueR = frame.GetArgument(variable);
return new RLRange(args, valueR);
}
case AstCode.Ldthis:
if (frame.ThisArgument == null)
throw new ArgumentException("No this in current method");
return new RLRange(args, frame.ThisArgument);
case AstCode.Stloc:
{
var variable = (AstVariable) node.Operand;
var resultType = node.Arguments[0].GetResultType();
var valueR = args[0].Result;
var first = this.Add(node.SourceLocation, RCode.Nop);
// Convert value if needed
bool isConverted;
var converted = this.ConvertTypeBeforeStore(node.SourceLocation, resultType, variable.Type,
valueR, targetPackage, frame, compiler,
out isConverted);
if (isConverted) valueR = converted.Result;
// Store in variable
var variableR = frame.GetArgument(variable);
return new RLRange(args, first, this.Add(node.SourceLocation, node.Move(), variableR, valueR),