本文整理汇总了C#中AstExpression.SGet方法的典型用法代码示例。如果您正苦于以下问题:C# AstExpression.SGet方法的具体用法?C# AstExpression.SGet怎么用?C# AstExpression.SGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstExpression
的用法示例。
在下文中一共展示了AstExpression.SGet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitExpression
//.........这里部分代码省略.........
var valueR = args[1].Result;
// Perform type conversion if needed
bool isConverted;
var converted = this.ConvertTypeBeforeStore(node.SourceLocation, type, field.FieldType, valueR,
targetPackage, frame, compiler,
out isConverted);
if (isConverted) valueR = converted.Result;
// Store in field
var iput = this.Add(node.SourceLocation, field.IPut(), dField, valueR, args[0].Result);
return new RLRange(first, iput, valueR);
}
case AstCode.Ldsfld:
{
var field = (XFieldReference) node.Operand;
XFieldDefinition fieldDef;
field.TryResolve(out fieldDef);
var fieldType = field.FieldType;
// Allocate register
var valueR = frame.AllocateTemp(fieldType.GetReference(targetPackage));
string resourceName;
if ((fieldDef != null) && fieldDef.TryGetResourceIdAttribute(out resourceName))
{
// Replace by resource id.
var id = FindResourceId(compiler.ResourceTable, resourceName);
return new RLRange(args, this.Add(node.SourceLocation, RCode.Const, id, valueR), valueR);
}
else
{
// Normal get from field
var dField = field.GetReference(targetPackage);
var iget = this.Add(node.SourceLocation, node.SGet(), dField, valueR);
return new RLRange(iget, valueR);
}
}
case AstCode.Stsfld:
{
var field = (XFieldReference) node.Operand;
var dField = field.GetReference(targetPackage);
var type = node.InferredType;
var first = this.Add(node.SourceLocation, RCode.Nop);
var valueR = args[0].Result;
// Perform type conversion if needed
bool isConverted;
var converted = this.ConvertTypeBeforeStore(node.SourceLocation, type, field.FieldType, valueR,
targetPackage, frame, compiler,
out isConverted);
if (isConverted) valueR = converted.Result;
// Store in field
var sput = this.Add(node.SourceLocation, node.SPut(), dField, valueR);
return new RLRange(first, sput, valueR);
}
#endregion
#region Object model
case AstCode.Newobj: // IL new
{
var ilCtorRef = (XMethodReference) node.Operand;
var ilType = ilCtorRef.DeclaringType;