本文整理汇总了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);
}
}