Esempio n. 1
0
 private IExpressionBinding Visit(Declaration module, Declaration parent, VBAParser.CallStmtContext expression, IBoundExpression withBlockVariable, StatementResolutionContext statementContext)
 {
     // Call statements always have an argument list.
     // One of the reasons we're doing this is that an empty argument list could represent a call to a default member,
     // which requires us to use an IndexDefaultBinding.
     if (expression.CALL() == null)
     {
         dynamic lexpr        = expression.expression();
         var     lexprBinding = Visit(module, parent, lexpr, withBlockVariable, StatementResolutionContext.Undefined);
         var     argList      = VisitArgumentList(module, parent, expression.argumentList(), withBlockVariable, StatementResolutionContext.Undefined);
         SetLeftMatch(lexprBinding, argList.Arguments.Count);
         return(new IndexDefaultBinding(_declarationFinder, Declaration.GetProjectParent(parent), module, parent, expression.expression(), lexprBinding, argList));
     }
     else
     {
         var lexprBinding = Visit(module, parent, (dynamic)expression.expression(), withBlockVariable, StatementResolutionContext.Undefined);
         if (!(lexprBinding is IndexDefaultBinding))
         {
             return(new IndexDefaultBinding(_declarationFinder, Declaration.GetProjectParent(parent), module, parent, expression.expression(), lexprBinding, new ArgumentList()));
         }
         else
         {
             return(lexprBinding);
         }
     }
 }
Esempio n. 2
0
 public static VBAParser.ArgumentListContext GetArgumentList(VBAParser.CallStmtContext callStmt)
 {
     VBAParser.ArgumentListContext argList = null;
     if (callStmt.CALL() != null && callStmt.expression() is VBAParser.LExprContext && ((VBAParser.LExprContext)callStmt.expression()).lExpression() is VBAParser.IndexExprContext)
     {
         var indexExpr = (VBAParser.IndexExprContext)((VBAParser.LExprContext)callStmt.expression()).lExpression();
         argList = indexExpr.argumentList();
     }
     else
     {
         argList = callStmt.argumentList();
     }
     return(argList);
 }
Esempio n. 3
0
        private IExpressionBinding Visit(Declaration module, Declaration parent, VBAParser.CallStmtContext expression, IBoundExpression withBlockVariable)
        {
            var lExpression        = expression.lExpression();
            var lExpressionBinding = Visit(module, parent, lExpression, withBlockVariable, StatementResolutionContext.Undefined);

            if (expression.CALL() == null)
            {
                var argList = VisitArgumentList(module, parent, expression.argumentList(), withBlockVariable);
                SetLeftMatch(lExpressionBinding, argList.Arguments.Count);
                if (argList.HasArguments)
                {
                    return(new IndexDefaultBinding(expression.lExpression(), lExpressionBinding, argList, parent));
                }

                return(new ProcedureCoercionDefaultBinding(expression.lExpression(), lExpressionBinding, false, parent));
            }

            return(new ProcedureCoercionDefaultBinding(expression.lExpression(), lExpressionBinding, true, parent));
        }
Esempio n. 4
0
 public static VBAParser.ArgumentListContext GetArgumentList(VBAParser.CallStmtContext callStmt)
 {
     VBAParser.ArgumentListContext argList = null;
     if (callStmt.CALL() != null)
     {
         var lExpr = callStmt.lExpression();
         if (lExpr is VBAParser.IndexExprContext)
         {
             var indexExpr = (VBAParser.IndexExprContext)lExpr;
             argList = indexExpr.argumentList();
         }
         else if (lExpr is VBAParser.WhitespaceIndexExprContext)
         {
             var indexExpr = (VBAParser.WhitespaceIndexExprContext)lExpr;
             argList = indexExpr.argumentList();
         }
     }
     else
     {
         argList = callStmt.argumentList();
     }
     return(argList);
 }