next steps to hygienic templates
This commit is contained in:
parent
5e15dec175
commit
da190876de
17 changed files with 97 additions and 76 deletions
|
|
@ -259,7 +259,10 @@ const
|
|||
sfImmediate* = sfDeadCodeElim
|
||||
# macro or template is immediately expanded
|
||||
# without considering any possible overloads
|
||||
|
||||
|
||||
sfDirty* = sfPure
|
||||
# template is not hygienic (old styled template)
|
||||
|
||||
sfAnon* = sfDiscardable
|
||||
# symbol name that was generated by the compiler
|
||||
# the compiler will avoid printing such names
|
||||
|
|
@ -691,7 +694,8 @@ const
|
|||
|
||||
|
||||
# creator procs:
|
||||
proc NewSym*(symKind: TSymKind, Name: PIdent, owner: PSym): PSym
|
||||
proc NewSym*(symKind: TSymKind, Name: PIdent, owner: PSym,
|
||||
info: TLineInfo): PSym
|
||||
proc NewType*(kind: TTypeKind, owner: PSym): PType
|
||||
proc newNode*(kind: TNodeKind): PNode
|
||||
proc newIntNode*(kind: TNodeKind, intVal: BiggestInt): PNode
|
||||
|
|
@ -922,11 +926,10 @@ proc copyType(t: PType, owner: PSym, keepId: bool): PType =
|
|||
result.sym = t.sym # backend-info should not be copied
|
||||
|
||||
proc copySym(s: PSym, keepId: bool = false): PSym =
|
||||
result = newSym(s.kind, s.name, s.owner)
|
||||
result = newSym(s.kind, s.name, s.owner, s.info)
|
||||
result.ast = nil # BUGFIX; was: s.ast which made problems
|
||||
result.info = s.info
|
||||
result.typ = s.typ
|
||||
if keepId:
|
||||
if keepId:
|
||||
result.id = s.id
|
||||
else:
|
||||
result.id = getID()
|
||||
|
|
@ -939,13 +942,14 @@ proc copySym(s: PSym, keepId: bool = false): PSym =
|
|||
result.loc = s.loc
|
||||
result.annex = s.annex # BUGFIX
|
||||
|
||||
proc NewSym(symKind: TSymKind, Name: PIdent, owner: PSym): PSym =
|
||||
proc NewSym(symKind: TSymKind, Name: PIdent, owner: PSym,
|
||||
info: TLineInfo): PSym =
|
||||
# generates a symbol and initializes the hash field too
|
||||
new(result)
|
||||
result.Name = Name
|
||||
result.Kind = symKind
|
||||
result.flags = {}
|
||||
result.info = UnknownLineInfo()
|
||||
result.info = info
|
||||
result.options = gOptions
|
||||
result.owner = owner
|
||||
result.offset = - 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue