예제 #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);
         }
     }
 }
예제 #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);
 }