コード例 #1
0
        public void Analyze(FilePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            // Get the absolute path to the script and make
            // sure that it exists.
            path = path.IsRelative ? path.MakeAbsolute(_environment) : path;
            if (!_fileSystem.Exist(path))
            {
                const string format  = "Could not find script '{0}'.";
                var          message = string.Format(CultureInfo.InvariantCulture, format, path.FullPath);
                _errors.Add(new ScriptAnalyzerError(_current?.Path ?? _script ?? path, 0, message));
                _current = new ScriptInformation(path);
                return;
            }

            if (_processedScripts.Contains(path))
            {
                _log.Debug("Script '{0}' has already been processed.", path.FullPath);
                return;
            }
            _processedScripts.Add(path);

            // Set as the current script.
            Push(path);

            // Analyze the script.
            _callback(this);

            // Pop the current script.
            Pop();
        }
コード例 #2
0
 public void Pop()
 {
     _stack.Pop();
     if (_stack.Count > 0)
     {
         _current = _stack.Peek();
     }
 }
コード例 #3
0
        public void Pop()
        {
            _stack.Pop();
            if (_stack.Count > 0)
            {
                _current = _stack.Peek();

                InsertLineDirective();
            }
        }
コード例 #4
0
        public void Push(FilePath path)
        {
            var script = new ScriptInformation(path);

            _current?.Includes.Add(script);

            _current = script;
            _stack.Push(_current);

            InsertLineDirective();
        }
コード例 #5
0
        public void Push(FilePath path)
        {
            var script = new ScriptInformation(path);

            if (_root == null)
            {
                _root = script;
            }

            if (_current != null)
            {
                _current.Includes.Add(script);
            }

            _current = script;
            _stack.Push(_current);
        }