예제 #1
0
        private void AnalyzeDotSourcedFile(string filename)
        {
            // invoke a new analysis on the file, and merge the results with
            // the current analysis's results.
            string path = Path.GetFullPath(Path.Combine(this.Directory, filename));

            var result = CommandAnalyzer.AnalyzeFile(path, LocalCommands, ModuleCommands);

            MergeResult(result);
        }
예제 #2
0
        private void AnalyzeCommandInvocation(CommandAst commandAst, string commandName)
        {
            bool isModuleFunction = ModuleCommands.ContainsKey(commandName);

            if (isModuleFunction)
            {
                // nothing to analyze, it's in another module.
                return;
            }

            bool isLocalFunction = LocalCommands.TryGetValue(commandName, out var functionDefinition);

            if (isLocalFunction)
            {
                // visit the invoked function's body
                var result = CommandAnalyzer.AnalyzeAst(this.Directory, functionDefinition.Body, LocalCommands, ModuleCommands);
                MergeResult(result);
                return;
            }

            ValidationError(commandName + " is not defined", commandAst.Extent);
        }