private IExpressionBinding VisitUnaryOp(Declaration module, Declaration parent, ParserRuleContext context, VBAParser.ExpressionContext expr, IBoundExpression withBlockVariable) { var exprBinding = Visit(module, parent, expr, withBlockVariable, StatementResolutionContext.Undefined); var letCoercionBinding = new LetCoercionDefaultBinding(expr, exprBinding); return(new UnaryOpDefaultBinding(context, letCoercionBinding)); }
private IExpressionBinding Visit(Declaration module, Declaration parent, VBAParser.ParenthesizedExprContext expression, IBoundExpression withBlockVariable) { var expressionParens = expression.expression(); var expressionBinding = Visit(module, parent, expressionParens, withBlockVariable, StatementResolutionContext.Undefined); var letCoercionBinding = new LetCoercionDefaultBinding(expressionParens, expressionBinding); return(new ParenthesizedDefaultBinding(expression, letCoercionBinding)); }
private IExpressionBinding VisitBinaryOp(Declaration module, Declaration parent, ParserRuleContext context, VBAParser.ExpressionContext left, VBAParser.ExpressionContext right, IBoundExpression withBlockVariable, bool isIsRelation = false) { var leftBinding = Visit(module, parent, left, withBlockVariable, StatementResolutionContext.Undefined); var rightBinding = Visit(module, parent, right, withBlockVariable, StatementResolutionContext.Undefined); if (!isIsRelation) { //All but the Is relation require value type arguments. leftBinding = new LetCoercionDefaultBinding(left, leftBinding); rightBinding = new LetCoercionDefaultBinding(right, rightBinding); } return(new BinaryOpDefaultBinding(context, leftBinding, rightBinding)); }
public void Resolve(Declaration calledProcedure, int parameterIndex, bool isArrayAccess = false) { ArgumentPosition = parameterIndex; var binding = _binding; if (calledProcedure != null) { NamedArgumentExpression = _namedArgumentExpressionCreator(calledProcedure); ReferencedParameter = ResolveReferencedParameter(calledProcedure, parameterIndex); if (!_isAddressOfArgument && !(Context is VBAParser.MissingArgumentContext) && (isArrayAccess || ReferencedParameter != null && !CanBeObject(ReferencedParameter))) { binding = new LetCoercionDefaultBinding(Context, binding); } } Expression = binding.Resolve(); }