Exemple #1
0
        public Var GetVar(ScopeGroup getter, string name, Location location)
        {
            Var var = GetScopeable <Var>(getter, name);

            if (var == null && location != null)
            {
                throw SyntaxErrorException.VariableDoesNotExist(name, location);
            }
            return(var);
        }
        public DefinedVar GetVar(string name, Range range, List <Diagnostic> diagnostics)
        {
            DefinedVar var        = null;
            ScopeGroup checkGroup = this;

            while (var == null && checkGroup != null)
            {
                var        = checkGroup.InScope.FirstOrDefault(v => v.Name == name);
                checkGroup = checkGroup.Parent;
            }

            if (var == null && range != null && diagnostics != null)
            {
                throw SyntaxErrorException.VariableDoesNotExist(name, range);
            }

            return(var);
        }