-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove most
getChalkScope
(#395)
Previous preparation for the new con4m culminated in nearly every get and set occurring from the top level [1]. Refactor so that helper procs always get and set from the top level, so that we generally no longer write `getChalkScope()` when getting or setting. Before this commit, there was a lot of `getChalkScope()` noise: $ git grep --ignore-case 'getChalkScope' -- '*.nim' | wc -l 266 With this commit, there's much less: $ git grep --ignore-case 'getChalkScope' -- '*.nim' | wc -l 14 $ git grep --break --heading --ignore-case 'getChalkScope' -- '*.nim' src/chalk_common.nim 484: if getChalkScope() != nil and attrGet[bool]("chalk_debug"): src/confload.nim 109: if tb != "" and getChalkScope() == nil or attrGet[bool]("chalk_debug"): src/run_management.nim 20:proc getChalkScope*(): AttrScope = 24: getChalkScope().getObjectOpt(s).isSome() 27: get[T](getChalkScope(), fqn) 30: getOpt[T](getChalkScope(), fqn) 33: getObject(getChalkScope(), fqn) 55: doAssert attrSet(getChalkScope(), fqn, value, attrType).code == errOk 58: discard attrLookup(getChalkScope(), fqn.split('.'), ix = 0, op = vlSecDef) src/selfextract.nim 153: if getChalkScope() != nil and attrGet[bool]("chalk_debug"): src/sinks.nim 47: if (llStr in toLogLevelMap) and getChalkScope() != nil and 153: if getChalkScope() != nil and attrGet[bool]("chalk_debug"): 185: attrRoot = if attr != nil: attr else: getChalkScope() 273: discard setOverride(getChalkScope(), section & ".pinned_cert_file", some(pack(path))) This commit squashes the below refactors: - Replace top-level get with attrGet. - Replace top-level getOpt with attrGetOpt. - Replace top-level getObject with attrGetObject. - run_management: make getChalkSubsections use attrGetObject. - conffile: replace a top-level attrLookup with attrGetOpt. - Make sectionExists work from top level. And for now, inline the use of sectionExists in sinks.nim that wasn't necessarily from the top level. - Make con4mAttrSet work from top level. - config, run_management: add a con4mSectionCreate helper proc. Refs: #269 [1] 6ce7679
- Loading branch information
Showing
39 changed files
with
283 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.