perform a fixpoint iteration for proper Nimscript support

This commit is contained in:
Andreas Rumpf 2015-12-21 16:07:07 +01:00
commit beb0ccda39

View file

@ -1021,34 +1021,40 @@ proc doAction(options: Options) =
# re-read it from the compiler. # re-read it from the compiler.
# TODO: It doesn't appear that this actually happens, can we just remove this? # TODO: It doesn't appear that this actually happens, can we just remove this?
var command = compiler_options.command.parseActionType() var command = compiler_options.command.parseActionType()
var doLoop = true
case command while doLoop:
of actionUpdate: doLoop = false
update(options) let cmd = compiler_options.command.normalize
of actionInstall: case command
discard install(options.action.packages, options) of actionUpdate:
of actionUninstall: update(options)
uninstall(options) of actionInstall:
of actionSearch: discard install(options.action.packages, options)
search(options) of actionUninstall:
of actionList: uninstall(options)
if options.queryInstalled: listInstalled(options) of actionSearch:
else: list(options) search(options)
of actionPath: of actionList:
listPaths(options) if options.queryInstalled: listInstalled(options)
of actionBuild: else: list(options)
build(options) of actionPath:
of actionCompile: listPaths(options)
compile(options) of actionBuild:
of actionInit: build(options)
init(options) of actionCompile:
of actionPublish: compile(options)
var pkgInfo = getPkgInfo(getCurrentDir()) of actionInit:
publish(pkgInfo) init(options)
of actionDump: of actionPublish:
dump(options) var pkgInfo = getPkgInfo(getCurrentDir())
of actionNil, actionCustom: publish(pkgInfo)
assert false of actionDump:
dump(options)
of actionNil: discard "assuming nimscript 'nop' command here"
of actionCustom:
# calls Nimscript as a side effect :-/
discard getPkgInfo(getCurrentDir())
doLoop = cmd != compiler_options.command.normalize
when isMainModule: when isMainModule:
when defined(release): when defined(release):