ABT.Attribute.CGenAddress C# (CSharp) Method

CGenAddress() public method

public CGenAddress ( CGenState state ) : void
state CodeGeneration.CGenState
return void
        public override void CGenAddress(CGenState state) {
            if (this.Expr.Type.Kind != ExprTypeKind.STRUCT_OR_UNION) {
                throw new InvalidProgramException();
            }

            // %eax = address of struct or union
            this.Expr.CGenAddress(state);

            // offset inside the pack
            Int32 offset = ((StructOrUnionType)this.Expr.Type)
                        .Attribs
                        .First(_ => _.name == this.Name)
                        .offset;

            state.ADDL(offset, Reg.EAX);
        }
    }