Ejemplo n.º 1
0
        /// <summary>
        /// Returns an expression corresponding to *(ptr + index) where ptr is this.IndexedObject and index is the first element of this.ConvertedArguments.
        /// </summary>
        protected override IExpression ProjectAsDereferencedPointerAddition()
        {
            //transform to *(ptr + index)

              IEnumerator<Expression> indexEnumerator = this.ConvertedArguments.GetEnumerator();
              if (!indexEnumerator.MoveNext()) return CodeDummy.Expression;
              Expression ptr = this.IndexedObject;
              if (this.FixedArrayElementType != null) {
            ptr = new VccAddressOf(new VccAddressableExpression(this.IndexedObject, true), this.IndexedObject.SourceLocation);
            ptr.SetContainingExpression(this);
              }
              Expression index = indexEnumerator.Current;
              if (index.Type.IsEnum) index = this.Helper.ExplicitConversion(index, index.Type.UnderlyingType.ResolvedType);
              VccAddition addition = new VccAddition(ptr, index, this.SourceLocation);
              AddressDereference aderef = new AddressDereference(addition, this.SourceLocation);
              aderef.SetContainingExpression(this);
              return aderef.ProjectAsIExpression();
        }