Esempio n. 1
0
        public StaDynSourceFileAST completeDecorateAST(StaDynSourceFileAST file)
        {
            try {
                if (file.Ast == null)
                {
                    return(file);
                }

                //TypeTable.Instance.Clear();

                file.Ast.Accept(new VisitorSSA(), null);

                file.Ast.Accept(new VisitorTypeLoad(), null);

                file.Ast.Accept(new VisitorTypeDefinition(), null);

                string directory = Path.GetDirectoryName(file.FileName);

                //req.FileName.Remove(req.FileName.Length - ast.Location.FileName.Length);

                IDictionary <string, string> name = new Dictionary <string, string>();

                name.Add(file.Ast.Location.FileName, directory);

                VisitorSymbolIdentification vsi = new VisitorSymbolIdentification(name);

                file.Ast.Accept(vsi, null);

                file.Ast.Accept(new VisitorTypeInference(), null);
            } catch (Exception e) {
                ErrorManager.Instance.NotifyError(new ParserError(new Location(file.FileName, 0, 0), e.Message));
            }

            //Update refernces
            //ProjectFileAST.Instance.addOrReplaceAst(file);

            return(file);
        }
Esempio n. 2
0
        public void VisitorSymbolIdentification(string fileName)
        {
            StaDynSourceFileAST file = ProjectFileAST.Instance.getAstFile(fileName);

            if (file.Ast == null)
            {
                return;
            }

            string directory = Path.GetDirectoryName(fileName);

            //req.FileName.Remove(req.FileName.Length - ast.Location.FileName.Length);

            IDictionary <string, string> name = new Dictionary <string, string>();

            name.Add(file.Ast.Location.FileName, directory);

            VisitorSymbolIdentification vsi = new VisitorSymbolIdentification(name);

            file.Ast.Accept(vsi, null);

            //replace AST
            ProjectFileAST.Instance.addOrReplaceAst(file);
        }