From 4f9c27d5f40b80c9a722833d77a1f17948414f28 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Thu, 7 Mar 2024 18:28:04 +0100 Subject: [PATCH] Make nkError the "default" node kind --- compiler/ast/ast_types.nim | 2 +- lib/core/macros.nim | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/ast/ast_types.nim b/compiler/ast/ast_types.nim index 1f8b599ffd211..c5b048d0bb77a 100644 --- a/compiler/ast/ast_types.nim +++ b/compiler/ast/ast_types.nim @@ -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 @@ -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 diff --git a/lib/core/macros.nim b/lib/core/macros.nim index cda36f3b04e9f..6bd6e58812bfd 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -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, @@ -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