Exemple #1
0
 protected override IExpression ProjectAsNonConstantIExpression()
 {
     if (this.cachedProjection == null) {
     object member = this.ResolveAsValueContainer(true);
     INestedTypeDefinition groupType = member as INestedTypeDefinition;
     if (groupType != null) {
       // expression refers to a group
       Cast cast = new Cast(new Parenthesis(this.Instance, this.SourceLocation), TypeExpression.For(this.Type), this.SourceLocation);
       cast.SetContainingExpression(this);
       // TODO the projection of cast looses its source location, it only retains the source location of the casted expression,
       // so we stick the proper location on the casted expression itself
       return this.cachedProjection = cast.ProjectAsIExpression();
     }
     IFieldDefinition fieldDef = member as IFieldDefinition;
     if (fieldDef != null) {
       var addrOf = new VccAddressOf(new AddressableExpression(new ProjectionHelper(this.Qualifier, this.SimpleName, fieldDef, this.SourceLocation)), this.SourceLocation);
       addrOf.SetContainingExpression(this);
       return this.cachedProjection = addrOf.ProjectAsIExpression();
     }
     this.cachedProjection = new DummyExpression(this.SourceLocation);
       }
       return this.cachedProjection;
 }