public override BoundNode VisitAddressOfOperator(BoundAddressOfOperator node) { BoundExpression visitedOperand = this.VisitExpression(node.Operand, ExprContext.Address); return node.Update(visitedOperand, node.IsFixedStatementAddressOf, node.Type); }
private void EmitAddressOfExpression(BoundAddressOfOperator expression, bool used) { var temp = EmitAddress(expression.Operand, AddressKind.Writeable); Debug.Assert(temp == null, "If the operand is addressable, then a temp shouldn't be required."); if (used && !expression.IsFixedStatementAddressOf) { // When computing an address to be used to initialize a fixed-statement variable, we have to be careful // not to convert the managed reference to an unmanaged pointer before storing it. Otherwise the GC might // come along and move memory around, invalidating the pointer before it is pinned by being stored in // the fixed variable. But elsewhere in the code we do use a conv.u instruction to convert the managed // reference to the underlying type for unmanaged pointers, which is the type "unsigned int" (see CLI // standard, Partition I section 12.1.1.1). _builder.EmitOpCode(ILOpCode.Conv_u); } EmitPopIfUnused(used); }
internal void Parse(BoundAddressOfOperator boundAddressOfOperator) { base.Parse(boundAddressOfOperator); this.Operand = Deserialize(boundAddressOfOperator.Operand) as Expression; }