當前位置: 首頁>>代碼示例>>C#>>正文


C# CodeGenerator.EmitInitializePlace方法代碼示例

本文整理匯總了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);
        }
開發者ID:iolevel,項目名稱:peachpie,代碼行數:30,代碼來源:BoundVariable.cs

示例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);
     }
 }
開發者ID:iolevel,項目名稱:peachpie,代碼行數:17,代碼來源:SourceFieldSymbol.cs


注:本文中的Pchp.CodeAnalysis.CodeGen.CodeGenerator.EmitInitializePlace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。