IR TopLevel Nodes
Top level nodes are Nodes relating to the the module system. They either are part of the machinery that it works with (modules, imports) or define types and friends that work with the module system (structs, classes), or simply things that can only live in top level contexts (e.g. unittest blocks).
As you can see, it's a fairly nebulous group. There are things here that could be arguably placed elsewhere (an Enum is a Type, for instance). Or things that are elsewhere could arguably belong here! (Functions, as an example).
The reason for this nebulousity is that Volt is a child of the curly brace languages -- particularly D, and through that heritage, C++ and C. In C there was a very strict line about what could be defined where, and resulting languages have stretched that somewhat -- functions and structs inlined inside of functions, for example, a place where traditionally only statements reside.
So perhaps not the most elegant system, but usability trumps elegance, much to the chagrin of architect astronauts everywhere.
Classes
Module | The toplevelest node. |
Import | An Import adds a module to the search path of identifiers inside the module it's in. |
Attribute | Attributes apply different behaviours and access levels to one or more top level nodes. These are lowered onto the object by the attribremoval pass. |
Named | Named is a base class for named types, like Enum, Struct, Class and so on. This is slightly different from Aggregate since Enum is not a Aggregate, but is a named type. |
Aggregate | Aggregate is a base class for Struct, Union & Class. |
Class | Java style class declaration. Classes enable polymorphism, and are always accessed through opaque references (to prevent slicing -- look it up!) |
_Interface | Java style interface declaration. An interface defines multiple functions that an implementing class must define. A class can inherit from multiple interfaces, and can be treated as an instance of any one of them. |
Union | C style union. Structs are a POD data type, and should be binary compatible with the same union as defined by your friendly neighbourhood C compiler. |
Struct | C style struct. Structs are a POD data type, and should be binary compatible with the same struct as defined by your friendly neighbourhood C compiler. |
Enum | C style Enum. Enums create symbols that are associated with compile time constants. By default, they are enumerated with ascending numbers, hence the name. |
Unittest | Unittest code to be run on if selected by user. |
Condition | Node represention a compile time conditional compilation. |
ConditionTopLevel | Node represention a compile time conditional compilation, at the toplevel. Uses Condition to specify the if it should be compiled. |
MixinFunction | Node represention of a function mixin. |
MixinTemplate | Node represention of a template mixin. |