Exemplo n.º 1
0
        public override void VisitDerefArray(ASTDereferenceArray n)
        {
            CFlatType arrType = CheckSubTree(n.Array);
            CFlatType index   = CheckSubTree(n.Index);

            if (arrType.IsArray && index is TypeInt)
            {
                _lastSeenType = n.CFlatType = ((TypeArray)arrType).BaseType;
            }
            else
            {
                ReportError(n.Location, "Array index must be an integer.");
            }
        }
Exemplo n.º 2
0
        public override void VisitDerefArray(ASTDereferenceArray n)
        {
            n.Array.Visit(this);
            n.Index.Visit(this);
            //store the type of the array elements
            _lastWalkedType = _typeManager.LookupCilType(n.CFlatType);

            if (n.IsLeftHandSide)
            {
                _assignmentCallback = gen => gen.Emit(n.CFlatType.StoreElementOpCode);
            }
            else
            {
                _gen.Emit(n.CFlatType.LoadElementOpCode);
            }
        }