本文整理汇总了C#中CodeGen.EmitPropertySet方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGen.EmitPropertySet方法的具体用法?C# CodeGen.EmitPropertySet怎么用?C# CodeGen.EmitPropertySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeGen
的用法示例。
在下文中一共展示了CodeGen.EmitPropertySet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitNestedTupleInit
private static void EmitNestedTupleInit(CodeGen cg, Type storageType)
{
if (Tuple.GetSize(storageType) > Tuple.MaxSize)
{
Slot tmp = cg.GetLocalTmp(storageType);
tmp.EmitSet(cg);
Type[] nestedTuples = storageType.GetGenericArguments();
for (int i = 0; i < nestedTuples.Length; i++)
{
Type t = nestedTuples[i];
if (t.IsSubclassOf(typeof(Tuple)))
{
tmp.EmitGet(cg);
cg.EmitNew(t.GetConstructor(ArrayUtils.EmptyTypes));
cg.EmitPropertySet(storageType, String.Format("Item{0:D3}", i));
tmp.EmitGet(cg);
cg.EmitPropertyGet(storageType, String.Format("Item{0:D3}", i));
EmitNestedTupleInit(cg, t);
}
}
cg.FreeLocalTmp(tmp);
}
else
{
int capacity = 0;
foreach (Type t in storageType.GetGenericArguments())
{
if (t == typeof(None))
{
break;
}
capacity++;
}
cg.EmitInt(capacity);
cg.EmitCall(typeof(RuntimeHelpers), "UninitializeEnvironmentTuple");
}
}
示例2: Emit
public override void Emit(CodeGen cg)
{
// emit "this", if any
if (_expression != null) {
if (_member.DeclaringType.IsValueType) {
_expression.EmitAddress(cg, _member.DeclaringType);
} else {
_expression.Emit(cg);
}
}
switch (_member.MemberType) {
case MemberTypes.Field:
_value.Emit(cg);
cg.EmitFieldSet((FieldInfo)_member);
break;
case MemberTypes.Property:
_value.Emit(cg);
cg.EmitPropertySet((PropertyInfo)_member);
break;
default:
Debug.Assert(false, "Invalid member type");
break;
}
}
示例3: EmitNewEnvironment
public override void EmitNewEnvironment(CodeGen cg)
{
ConstructorInfo ctor = EnvironmentType.GetConstructor(
ScriptDomainManager.Options.DebugMode ?
new Type[] {
StorageType,
typeof(SymbolId[]),
} :
new Type[] {
StorageType,
});
// emit: dict.Tuple[.Item000...].Item000 = dict, and then leave dict on the stack
cg.EmitNew(ctor);
cg.Emit(OpCodes.Dup);
Slot tmp = cg.GetLocalTmp(EnvironmentType);
tmp.EmitSet(cg);
cg.EmitPropertyGet(EnvironmentType, "TupleData");
PropertyInfo last = null;
foreach (PropertyInfo pi in Tuple.GetAccessPath(StorageType, 0)) {
if (last != null) {
cg.EmitPropertyGet(last);
}
last = pi;
}
tmp.EmitGet(cg);
cg.EmitPropertySet(last);
cg.FreeLocalTmp(tmp);
}
示例4: EmitSet
public override void EmitSet(CodeGen cg, Slot val)
{
_wrapper.EmitGet(cg);
val.EmitGet(cg);
cg.EmitPropertySet(typeof(ModuleGlobalWrapper), "CurrentValue");
}