本文整理匯總了C#中Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitInitializePlace方法的典型用法代碼示例。如果您正苦於以下問題:C# CodeGenerator.EmitInitializePlace方法的具體用法?C# CodeGenerator.EmitInitializePlace怎麽用?C# CodeGenerator.EmitInitializePlace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pchp.CodeAnalysis.CodeGen.CodeGenerator
的用法示例。
在下文中一共展示了CodeGenerator.EmitInitializePlace方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: EmitInit
internal override void EmitInit(CodeGenerator cg)
{
if (cg.HasUnoptimizedLocals)
{
return;
}
// declare variable in global scope
var il = cg.Builder;
var def = il.LocalSlotManager.DeclareLocal(
(Cci.ITypeReference)_symbol.Type, _symbol as ILocalSymbolInternal,
this.Name, SynthesizedLocalKind.UserDefined,
LocalDebugId.None, 0, LocalSlotConstraints.None, false, default(ImmutableArray<TypedConstant>), false);
_place = new LocalPlace(def);
il.AddLocalToScope(def);
//
if (_symbol is SynthesizedLocalSymbol)
return;
// Initialize local variable with void.
// This is mandatory since even assignments reads the target value to assign properly to PhpAlias.
// TODO: Once analysis tells us, the target cannot be alias, this step won't be necessary.
// TODO: only if the local will be used uninitialized
cg.EmitInitializePlace(_place);
}
示例2: EmitInit
internal void EmitInit(CodeGenerator cg)
{
var fldplace = new FieldPlace(IsStatic ? null : new ArgPlace(ContainingType, 0), this);
if (this.Initializer != null)
{
// fld = <initializer>
fldplace.EmitStorePrepare(cg.Builder);
cg.EmitConvert(this.Initializer, this.Type);
fldplace.EmitStore(cg.Builder);
}
else
{
// fld = default(type)
cg.EmitInitializePlace(fldplace);
}
}