[Chapel Merge] Add Function declarations and improve Module decla

Branch: refs/heads/master
Revision: d42d9c5
Author: mppf
Log Message:

Merge pull request #17662 from mppf/add-fn-decls

Add Function declarations and improve Module declarations

  • Adds Function, FunctionDecl, Formal, FormalDecl uAST classes

  • Renames several enum members to be shorter when the interpretation is
    clear and otherwise be better worded

    • VISIBILITY_DEFAULT - > DEFAULT_VISIBILITY
    • VISIBILITY_PUBLIC -> PUBLIC
    • VISIBILITY_PRIVATE -> PRIVATE
    • One implication of this strategy is that Function::CONST_REF and
      Formal::CONST_REF have the same name (at least if the scoping is
      not considered). This PR adds a test to also check that they have the
      same value, in order to reduce confusion in the future, since they
      refer to the same concept. However, note that I am not expecting code
      to rely on these having the same value.
  • Renames several enum types and related functions named Tag (nested in
    classes) to Kind because Tag/ tag() refers to the ASTNode tag
    (indicating which class it is)

  • Updated ParserContext to track a declaration start location and to tidy
    up the code setting visibility or variable kind.

  • Improved parsing for several variants of identifiers so e.g. int will
    now parse.

Reviewed by @lydia-duncan - thanks!

Modified Files:
A compiler/next/include/chpl/uast/Formal.h

A compiler/next/include/chpl/uast/FormalDecl.h
A compiler/next/include/chpl/uast/Function.h
A compiler/next/include/chpl/uast/FunctionDecl.h
A compiler/next/lib/uast/Formal.cpp
A compiler/next/lib/uast/FormalDecl.cpp
A compiler/next/lib/uast/Function.cpp
A compiler/next/lib/uast/FunctionDecl.cpp
A compiler/next/test/frontend/testParseFunctions.cpp
A compiler/next/test/frontend/testParseModules.cpp
A compiler/next/test/uast/testConsistentEnums.cpp
M compiler/next/include/chpl/uast/ASTClassesList.h
M compiler/next/include/chpl/uast/ASTList.h
M compiler/next/include/chpl/uast/Decl.h
M compiler/next/include/chpl/uast/FnCall.h
M compiler/next/include/chpl/uast/Module.h
M compiler/next/include/chpl/uast/ModuleDecl.h
M compiler/next/include/chpl/uast/Sym.h
M compiler/next/include/chpl/uast/Variable.h
M compiler/next/include/chpl/uast/VariableDecl.h
M compiler/next/lib/frontend/Parser/ParserContext.h
M compiler/next/lib/frontend/Parser/ParserContextImpl.h
M compiler/next/lib/frontend/Parser/chapel.ypp
M compiler/next/lib/frontend/Parser/parser-dependencies.h
M compiler/next/lib/uast/Builder.cpp
M compiler/next/lib/uast/CMakeLists.txt
M compiler/next/lib/uast/Module.cpp
M compiler/next/lib/uast/ModuleDecl.cpp
M compiler/next/lib/uast/Variable.cpp
M compiler/next/lib/uast/VariableDecl.cpp
M compiler/next/test/frontend/CMakeLists.txt
M compiler/next/test/uast/CMakeLists.txt

Compare: https://github.com/chapel-lang/chapel/compare/2de2758b6301...d42d9c50a99d