Exemple #1
0
        public IBoundExpression Resolve()
        {
            IBoundExpression boundExpression = null;

            boundExpression = ResolveProcedureNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveEnclosingModuleNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveEnclosingProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveOtherProceduralModuleEnclosingProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveReferencedProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveModuleReferencedProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }

            if (_context.Start.Text == "[" && _context.Stop.Text == "]")
            {
                var bracketedExpression = _declarationFinder.OnBracketedExpression(_context.GetText(), _context);
                return(new SimpleNameExpression(bracketedExpression, ExpressionClassification.Unbound, _context));
            }
            //TODO - this is a complete and total hack to prevent `Mid` and `Mid$` from creating undeclared variables
            //pending an actual fix to the grammar.  See #2618
            else if (!_name.Equals("Mid") && !_name.Equals("Mid$"))
            {
                var undeclaredLocal = _declarationFinder.OnUndeclaredVariable(_parent, _name, _context);
                return(new SimpleNameExpression(undeclaredLocal, ExpressionClassification.Variable, _context));
            }
            return(new ResolutionFailedExpression());
        }
Exemple #2
0
        public IBoundExpression Resolve()
        {
            IBoundExpression boundExpression = null;

            boundExpression = ResolveProcedureNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveEnclosingModuleNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveEnclosingProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveOtherProceduralModuleEnclosingProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveReferencedProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }
            boundExpression = ResolveModuleReferencedProjectNamespace();
            if (boundExpression != null)
            {
                return(boundExpression);
            }

            if (_context.Start.Text == "[" && _context.Stop.Text == "]")
            {
                var bracketedExpression = _declarationFinder.OnBracketedExpression(_context.GetText(), _context);
                return(new SimpleNameExpression(bracketedExpression, ExpressionClassification.Unbound, _context));
            }

            var undeclaredLocal = _declarationFinder.OnUndeclaredVariable(_parent, _name, _context);

            return(new SimpleNameExpression(undeclaredLocal, ExpressionClassification.Variable, _context));
        }