Esempio n. 1
0
        private bool ParseAddressExpression(TokenReader reader, out Expression expression)
        {
            expression = null;
            Token tok = reader.Peek();
            if (!this.Expect(reader, Keyword.Address))
            {
                return false;
            }

            ReferenceExpression refExpr = null;
            if (!this.ParseReferenceExpression(reader, out refExpr))
            {
                return false;
            }

            expression = new AddressExpression(tok, refExpr);
            return true;
        }
Esempio n. 2
0
        private bool TryEmitAddressExpression(
            AddressExpression addrExpr,
            CompilerContext context,
            Scope scope,
            MethodImpl method,
            out TypeDefinition valueType)
        {
            string innerLoc = null;
            TypeDefinition storageType = null;
            MethodInfo calleeMethod = null;
            if (!this.TryEmitReference(addrExpr.Inner, context, scope, method, out innerLoc, out storageType, out calleeMethod))
            {
                valueType = null;
                return false;
            }

            method.Statements.Add(new AsmStatement { Instruction = string.Format("lea eax,{0}", innerLoc) });
            valueType = context.GetPointerType(storageType);
            return true;
        }