Skip to content

Commit

Permalink
Merge #543
Browse files Browse the repository at this point in the history
543: internals: `P/TIdent` moved to the `idents` module r=saem a=saem

## Summary

`PIdent` and `TIdent` were in the `ast_types` module. Moved them into `idents`. This now places the data type in the correct module (`idents`) and also drops the number of dependencies in `idents` module, `ast_types`.

There is an export in `ast_types` for the types with a comment to consider if there is a way or even worth eliminuating it.



Co-authored-by: saem <[email protected]>
  • Loading branch information
bors[bot] and saem authored Feb 15, 2023
2 parents b530f19 + 8f97369 commit b4f72b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
12 changes: 5 additions & 7 deletions compiler/ast/ast_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import compiler/ast/lineinfos
import compiler/utils/ropes
import std/[hashes]

from compiler/ast/idents import PIdent, TIdent

from compiler/front/in_options import TOption, TOptions # Stored in `PSym`

from compiler/utils/int128 import Int128

# xxx: is there a way to/worth eliminate the exports?
export PIdent, TIdent

const maxInstantiation* = 100
## maximum number of nested generic instantiations or macro pragma expansions

Expand Down Expand Up @@ -781,13 +786,6 @@ type
PType* = ref TType
PSym* = ref TSym

PIdent* = ref TIdent
TIdent*{.acyclic.} = object
id*: int ## unique id; use this for comparisons and not the pointers
s*: string
next*: PIdent ## for hash-table chaining
h*: Hash ## hash value of `s`

SemTypeMismatch* = object
formalTypeKind*: set[TTypeKind]
actualType*, formalType*: PType
Expand Down
10 changes: 7 additions & 3 deletions compiler/ast/idents.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ import
hashes
],
compiler/ast/[
ast_types,
wordrecg
]

export PIdent

type
PIdent* = ref TIdent
TIdent*{.acyclic.} = object
id*: int ## unique id; use this for comparisons and not the pointers
s*: string
next*: PIdent ## for hash-table chaining
h*: Hash ## hash value of `s`

IdentCache* = ref object
buckets: array[0..4096 * 2 - 1, PIdent]
wordCounter: int
Expand Down

0 comments on commit b4f72b4

Please sign in to comment.