本文整理匯總了C#中Pchp.CodeAnalysis.CodeGen.CodeGenerator.Emit_PhpValue_Void方法的典型用法代碼示例。如果您正苦於以下問題:C# CodeGenerator.Emit_PhpValue_Void方法的具體用法?C# CodeGenerator.Emit_PhpValue_Void怎麽用?C# CodeGenerator.Emit_PhpValue_Void使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pchp.CodeAnalysis.CodeGen.CodeGenerator
的用法示例。
在下文中一共展示了CodeGenerator.Emit_PhpValue_Void方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: EmitStore
public void EmitStore(CodeGenerator cg, TypeSymbol valueType)
{
var type = _place.TypeOpt;
// Write Ref
if (_access.IsWriteRef)
{
if (valueType != cg.CoreTypes.PhpAlias)
{
Debug.Assert(false, "caller should get aliased value");
cg.EmitConvertToPhpValue(valueType, 0);
valueType = cg.Emit_PhpValue_MakeAlias();
}
//
if (type == cg.CoreTypes.PhpAlias)
{
// <place> = <alias>
_place.EmitStore(cg.Builder);
}
else if (type == cg.CoreTypes.PhpValue)
{
// <place> = PhpValue.Create(<alias>)
cg.EmitCall(ILOpCode.Call, cg.CoreMethods.PhpValue.Create_PhpAlias);
_place.EmitStore(cg.Builder);
}
else
{
Debug.Assert(false, "Assigning alias to non-aliasable variable.");
cg.EmitConvert(valueType, 0, type);
_place.EmitStore(cg.Builder);
}
}
else if (_access.IsUnset)
{
Debug.Assert(valueType == null);
// <place> =
if (type == cg.CoreTypes.PhpAlias)
{
// new PhpAlias(void)
cg.Emit_PhpValue_Void();
cg.Emit_PhpValue_MakeAlias();
}
else if (type.IsReferenceType)
{
// null
cg.Builder.EmitNullConstant();
}
else
{
// default(T)
cg.EmitLoadDefaultOfValueType(type);
}
_place.EmitStore(cg.Builder);
}
else
{
//
if (type == cg.CoreTypes.PhpAlias)
{
// <place>.Value = <value>
cg.EmitConvertToPhpValue(valueType, 0);
cg.Emit_PhpAlias_SetValue();
}
else if (type == cg.CoreTypes.PhpValue)
{
if (_thint.IsRef)
{
// Operators.SetValue(ref <place>, (PhpValue)<value>);
cg.EmitConvertToPhpValue(valueType, 0);
cg.EmitCall(ILOpCode.Call, cg.CoreMethods.Operators.SetValue_PhpValueRef_PhpValue);
}
else
{
// <place> = <value>
cg.EmitConvertToPhpValue(valueType, 0);
_place.EmitStore(cg.Builder);
}
}
else
{
cg.EmitConvert(valueType, 0, type);
_place.EmitStore(cg.Builder);
}
}
}
示例2: EmitUnset
public void EmitUnset(CodeGenerator cg)
{
var bound = (IBoundReference)this;
bound.EmitStorePrepare(cg);
bound.EmitStore(cg, cg.Emit_PhpValue_Void());
}