Skip to content

Commit

Permalink
Make nkError the "default" node kind
Browse files Browse the repository at this point in the history
  • Loading branch information
Clyybber committed Mar 10, 2024
1 parent bbc5717 commit 4f9c27d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/ast/ast_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type
## belongs to a certain class
## Expressions:
## Atoms:
nkError ## erroneous AST node see `errorhandling`
nkEmpty ## the node is empty
nkIdent ## node is an identifier
nkSym ## node is a symbol
Expand Down Expand Up @@ -232,7 +233,6 @@ type
## transformation
nkFuncDef ## a func
nkTupleConstr ## a tuple constructor
nkError ## erroneous AST node see `errorhandling`
nkNimNodeLit ## a ``NimNode`` literal. Stores a single sub node
## that represents the ``NimNode`` AST
nkModuleRef ## for .rod file support: A (moduleId, itemId) pair
Expand Down
6 changes: 3 additions & 3 deletions lib/core/macros.nim
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ template skipEnumValue(define: untyped, predecessor: untyped; gap = 1): untyped

type
NimNodeKind* = enum
nnkEmpty = skipEnumValue(nimskullNoNkNone, -1),
nnkError, ## erroneous AST node
nnkEmpty,
nnkIdent, nnkSym,
nnkType, nnkCharLit, nnkIntLit, nnkInt8Lit,
nnkInt16Lit, nnkInt32Lit, nnkInt64Lit, nnkUIntLit, nnkUInt8Lit,
Expand Down Expand Up @@ -112,8 +113,7 @@ type
nnkGotoState,
nnkFuncDef = skipEnumValue(nimHasNkBreakStateNodeRemoved, nnkGotoState, 2),
nnkTupleConstr,
nnkError, ## erroneous AST node
nnkNimNodeLit
nnkNimNodeLit = skipEnumValue(nimskullNoNkNone, nnkTupleConstr)

NimNodeKinds* = set[NimNodeKind]
NimTypeKind* = enum # some types are no longer used, see ast.nim
Expand Down

0 comments on commit 4f9c27d

Please sign in to comment.