experimental support for preserving local variable names in the generated code

This commit is contained in:
Zahary Karadjov 2012-04-13 16:01:26 +03:00
commit f25c638dc4
6 changed files with 146 additions and 22 deletions

View file

@ -244,12 +244,17 @@ const
sfDispatcher* = sfDeadCodeElim # copied method symbol is the dispatcher
sfNoInit* = sfMainModule # don't generate code to init the variable
sfImmediate* = sfDeadCodeElim # macro or template is immediately expanded
# without considering any possible overloads
sfImmediate* = sfDeadCodeElim
# macro or template is immediately expanded
# without considering any possible overloads
sfAnon* = sfCompilerProc # symbol name that was generated by the compiler
# the compiler will avoid printing such names
# in user messages.
sfAnon* = sfDiscardable
# symbol name that was generated by the compiler
# the compiler will avoid printing such names
# in user messages.
sfShadowed* = sfInnerProc
# a variable that was shadowed in some inner scope
const
# getting ready for the future expr/stmt merge
@ -647,6 +652,14 @@ const
resultPos* = 5
dispatcherPos* = 6 # caution: if method has no 'result' it can be position 5!
nkCallKinds* = {nkCall, nkInfix, nkPrefix, nkPostfix,
nkCommand, nkCallStrLit}
nkLambdaKinds* = {nkLambda, nkDo}
skLocalVars* = {skVar, skLet, skForVar, skParam}
# creator procs:
proc NewSym*(symKind: TSymKind, Name: PIdent, owner: PSym): PSym
proc NewType*(kind: TTypeKind, owner: PSym): PType
@ -691,11 +704,6 @@ proc copyNode*(src: PNode): PNode
proc copyTree*(src: PNode): PNode
# does copy its sons!
const nkCallKinds* = {nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand,
nkCallStrLit}
const nkLambdaKinds* = {nkLambda, nkDo}
proc isCallExpr*(n: PNode): bool =
result = n.kind in nkCallKinds