Exemplo n.º 1
0
 public override void OnMemberReferenceExpression(MemberReferenceExpression node)
 {
     if (node.Entity is IField)
     {
         this._currentStatement.Expression = new CodeFieldReferenceExpression(this.VisitExpr(node.Target), node.Name);
         return;
     }
     if (node.Entity is IProperty)
     {
         this._currentStatement.Expression = new CodePropertyReferenceExpression(this.VisitExpr(node.Target), node.Name);
         return;
     }
     if (node.Entity is IType)
     {
         this._currentStatement.Expression = new CodeTypeReferenceExpression(BooCodeDomConverter.GetType(node.ToCodeString()));
         return;
     }
     if (node.Entity is IEvent)
     {
         this._currentStatement.Expression = new CodeEventReferenceExpression(this.VisitExpr(node.Target), node.Name);
         return;
     }
     if (node.Entity is IMethod)
     {
         this._currentStatement.Expression = new CodeMethodReferenceExpression(this.VisitExpr(node.Target), node.Name);
         return;
     }
     throw new Exception(new StringBuilder("Unknown member type for ").Append(node.ToCodeString()).ToString());
 }
 public override void OnMemberReferenceExpression(MemberReferenceExpression node)
 {
     if (PhantomDslEngine.IsCleanupMethod(node.ParentNode))
     {
         ReplaceCurrentNode(new StringLiteralExpression(node.ToCodeString()));
     }
 }
 public override void OnMemberReferenceExpression(MemberReferenceExpression node)
 {
     if (IsTargetDependencyArray(node.ParentNode))
     {
         ReplaceCurrentNode(new StringLiteralExpression(node.ToCodeString()));
     }
 }
Exemplo n.º 4
0
 public override void OnMemberReferenceExpression(MemberReferenceExpression node)
 {
     if (IsCallMethod(node.ParentNode))
     {
         ReplaceCurrentNode(new StringLiteralExpression(node.ToCodeString()));
     }
 }
Exemplo n.º 5
0
            public override void OnMemberReferenceExpression(MemberReferenceExpression node)
            {
                var target = node.Target as ReferenceExpression;

                if (target != null && target.IsEnum())
                {
                    _literals.Add(node.ToCodeString());
                    return;
                }

                base.OnMemberReferenceExpression(node);
            }
Exemplo n.º 6
0
        private void ReplaceMappedEntity(MemberReferenceExpression node, IType mappedType)
        {
            var entity     = (IMember)node.Entity;
            var targetType = node.Target.ExpressionType;
            var newEntity  = (IMember)NameResolutionService.ResolveMember(targetType, entity.Name, entity.EntityType);

            node.Entity = newEntity;
            if (!newEntity.Type.Equals(mappedType))
            {
                var gmi = newEntity as IGenericMethodInfo;
                if (gmi != null)
                {
                    var args = ((IConstructedMethodInfo)entity).GenericArguments.Select(_replacer.MapType).ToArray();
                    newEntity = gmi.ConstructMethod(args);
                    if (newEntity.Type.Equals(mappedType))
                    {
                        node.Entity = newEntity;
                        return;
                    }
                }
                throw new System.NotImplementedException("Incorrect mapped type for " + node.ToCodeString());
            }
        }