## Eliminate Variable Declarations in Function Type ## The parameters of a function had been living in the wrong place. As the function type has no relation with the actual declarations of the variables, but only the types of them, putting declarations in FunctionType is unnecessary. Meanwhile, in new-ast data model, the declaration nodes should be kept as unique as possible, since they semantically denote unique objects in the source code. Shared declarations often lead to undesirable behaviors, especially when weak references exist (reminder: currently weak references only point to declarations). They also pose difficulty for implementing correct _functional_ algorithms, as copying a declaration node _should_ always mean creating a new entity. In the programming language and type theory model, declarations are also never a part of function type; the functions `int f(int a)` and `int f(int b)` have the exact same type (int)->(int), and representing the type as (int a)->(int b) is misleading. ## Summary of Changes ## - `ast::FunctionDecl` Now owns its parameter and return variables directly. - `ast::FunctionType` Parameter and return types are now pure types (no more decls) Forall clause is part of type information so it is still kept. - Unify.cc Renamed some functions to reflect the changes (decl -> type) - Convert.cpp Drop decls in function type, unless it is directly in function decl (move them to `FunctionDecl` params and returns) Add dummy variable decls while converting back. ## Relevant Clean-up Work ## - CurrentObject.cpp No longer has weak references to type nodes and replaced by raw pointers. Using weak pointers do not accomplish anything since a non in-place mutation outside invalidates current iterator anyways and an in-place mutation outside is still seen by the iterator with just a raw pointer. - Validate.cc `EnumAndPointerDecay` is redundant in `resolveTypeof` and therefore dropped. Note: this pass needs some structural change to accommodate the new function type representation.