Skip to content

Commit

Permalink
Refactor active configuration handing
Browse files Browse the repository at this point in the history
- Move active configuration handing into a separate type that should
  contain all the required configuration parameters. Use this type in
  `ConfigRef` module, and use accessor procs for getting and setting values
  of different options, thus removing unguarded access for fields in a
  number of cases.
- Move report kind and category enums into `report_enums` in order to make
  them accessible from the `in_options` - it must be a lightweight
  dependency since it is supposed to be reused by other tools, like
  testament, that have to directly interact with the compiler.

Closes nim-works#158
  • Loading branch information
haxscramper committed Jan 28, 2022
1 parent b9ea9a1 commit e726324
Show file tree
Hide file tree
Showing 18 changed files with 1,865 additions and 1,634 deletions.
45 changes: 2 additions & 43 deletions compiler/ast/ast_types.nim
Original file line number Diff line number Diff line change
@@ -1,52 +1,11 @@
import utils/ropes
import std/[hashes]

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

const
hasFFI = defined(nimHasLibFFI)

type
TOption* = enum
## please make sure we have under 32 options (improves code efficiency
## a lot!) **keep binary compatible**
optNone
optObjCheck ## `ccgenexprs.nim` generates `isObj` check if this options
## is enabled for a procedure
optFieldCheck ## Codegen uses it to conditionally generate check for a
## discriminant field
optRangeCheck ## Control generation of range checks in the backend
optBoundsCheck ## Control generation of the array boundary checks in
## the backend
optOverflowCheck ## Integer overflow check control
optRefCheck ## Deprecated option, does something with refs in te
## `liftdestructors.nim`, need to investigate further
optNaNCheck ## Raise float invalid defect C backend if operation
## returned nan
optInfCheck ## Raise float overflow in C backend if operation reaturned
## inf
optStaticBoundsCheck
optStyleCheck ## Check symbol for spelling consistency
optAssert
optLineDir
optWarns
optHints
optOptimizeSpeed
optOptimizeSize
optStackTrace ## stack tracing support
optStackTraceMsgs ## enable custom runtime msgs via `setFrameMsg`
optLineTrace ## line tracing support (includes stack tracing)
optByRef ## use pass by ref for objects
## (for interfacing with C)
optProfiler ## profiler turned on
optImplicitStatic ## optimization: implicit at compile time
## evaluation
optTrMacros ## en/disable pattern matching
optMemTracker
optSinkInference ## 'sink T' inference
optCursorInference
optImportHidden

TOptions* = set[TOption]


type
FileIndex* = distinct int32
Expand Down
Loading

0 comments on commit e726324

Please sign in to comment.