private EmitInitializePlace ( IPlace place ) : void | ||
place | IPlace | |
return | void |
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); }
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); } }