Example #1
0
        private IBoundExpression CreateFailedExpression(IBoundExpression expression)
        {
            var failedExpr = new ResolutionFailedExpression();

            failedExpr.AddSuccessfullyResolvedExpression(expression);
            return(failedExpr);
        }
Example #2
0
        public IBoundExpression Resolve()
        {
            IBoundExpression boundExpression = null;
            var lExpression = _lExpressionBinding.Resolve();

            if (lExpression.Classification == ExpressionClassification.ResolutionFailed)
            {
                return(lExpression);
            }
            string name = Identifier.GetName(_expression.unrestrictedIdentifier());

            if (lExpression.Classification != ExpressionClassification.ProceduralModule)
            {
                return(null);
            }
            boundExpression = ResolveMemberInModule(lExpression, name, lExpression.ReferencedDeclaration, DeclarationType.Function, ExpressionClassification.Function);
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveMemberInModule(lExpression, name, lExpression.ReferencedDeclaration, DeclarationType.Procedure, ExpressionClassification.Subroutine);
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            var failedExpr = new ResolutionFailedExpression();

            failedExpr.AddSuccessfullyResolvedExpression(lExpression);
            return(failedExpr);
        }
        public IBoundExpression Resolve()
        {
            IBoundExpression boundExpression = null;
            var lExpression = _lExpressionBinding.Resolve();

            if (lExpression.Classification == ExpressionClassification.ResolutionFailed)
            {
                return(lExpression);
            }
            string unrestrictedName = Identifier.GetName(_expression.unrestrictedIdentifier());

            boundExpression = ResolveLExpressionIsProject(lExpression, unrestrictedName);
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveLExpressionIsModule(lExpression, unrestrictedName);
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            var failedExpr = new ResolutionFailedExpression();

            failedExpr.AddSuccessfullyResolvedExpression(lExpression);
            return(failedExpr);
        }
        private IBoundExpression CreateFailedExpression(IBoundExpression expression, ParserRuleContext context)
        {
            var failedExpr = new ResolutionFailedExpression(context);

            failedExpr.AddSuccessfullyResolvedExpression(expression);
            return(failedExpr);
        }
Example #5
0
 private IExpressionBinding Visit(Declaration module, Declaration parent, VBAParser.WithMemberAccessExprContext expression, IBoundExpression withBlockVariable, StatementResolutionContext statementContext)
 {
     if (withBlockVariable == null)
     {
         withBlockVariable = new ResolutionFailedExpression(expression);
     }
     return(new MemberAccessDefaultBinding(_declarationFinder, Declaration.GetProjectParent(parent), module, parent, expression, withBlockVariable, expression.unrestrictedIdentifier().GetText(), statementContext, expression.unrestrictedIdentifier()));
 }
Example #6
0
        private static IBoundExpression CreateResolutionFailedExpression(IBoundExpression lExpression, ArgumentList argumentList, ParserRuleContext context, bool isDefaultMemberResolution)
        {
            var failedExpr = new ResolutionFailedExpression(context, isDefaultMemberResolution);

            failedExpr.AddSuccessfullyResolvedExpression(lExpression);
            var argumentExpressions = argumentList.Arguments.Select(arg => arg.Expression);

            return(failedExpr.JoinAsFailedResolution(context, argumentExpressions));
        }
Example #7
0
        private IBoundExpression CreateFailedExpression(IBoundExpression lExpression)
        {
            var failedExpr = new ResolutionFailedExpression();

            failedExpr.AddSuccessfullyResolvedExpression(lExpression);
            foreach (var arg in _argumentList.Arguments)
            {
                failedExpr.AddSuccessfullyResolvedExpression(arg.Expression);
            }
            return(failedExpr);
        }
Example #8
0
        public IBoundExpression Resolve()
        {
            var leftExpr  = _left.Resolve();
            var rightExpr = _right.Resolve();

            if (leftExpr.Classification == ExpressionClassification.ResolutionFailed || rightExpr.Classification == ExpressionClassification.ResolutionFailed)
            {
                var failedExpr = new ResolutionFailedExpression();
                failedExpr.AddSuccessfullyResolvedExpression(leftExpr);
                failedExpr.AddSuccessfullyResolvedExpression(rightExpr);
                return(failedExpr);
            }
            return(new BinaryOpExpression(null, _context, leftExpr, rightExpr));
        }
Example #9
0
        public IBoundExpression Resolve()
        {
            var expr     = _expressionBinding.Resolve();
            var typeExpr = _typeExpressionBinding.Resolve();

            if (expr.Classification == ExpressionClassification.ResolutionFailed || typeExpr.Classification == ExpressionClassification.ResolutionFailed)
            {
                var failedExpr = new ResolutionFailedExpression();
                failedExpr.AddSuccessfullyResolvedExpression(expr);
                failedExpr.AddSuccessfullyResolvedExpression(typeExpr);
                return(failedExpr);
            }
            return(new TypeOfIsExpression(null, _context, expr, typeExpr));
        }