Clean out oldast (#14837)

* Clean out old Deprecated CLI switch
* Update to remove --oldast CLI option
This commit is contained in:
Juan Carlos
2020-06-30 05:01:25 -03:00
committed by GitHub
parent 5c1fa142d6
commit 74d1f25010
7 changed files with 14 additions and 25 deletions

View File

@@ -220,6 +220,7 @@ proc mydiv(a, b): int {.raises: [].} =
See [docgen](docgen.html#introduction-quick-start) for details.
- Removed the `--oldNewlines` switch.
- Removed the `--laxStrings` switch for mutating the internal zero terminator on strings.
- Removed the `--oldast` switch.
- `$getType(untyped)` is now "untyped" instead of "expr", `$getType(typed)` is now "typed" instead of "stmt"

View File

@@ -320,7 +320,6 @@ proc testCompileOption*(conf: ConfigRef; switch: string, info: TLineInfo): bool
of "patterns", "trmacros": result = contains(conf.options, optTrMacros)
of "excessivestacktrace": result = contains(conf.globalOptions, optExcessiveStackTrace)
of "nilseqs": result = contains(conf.options, optNilSeqs)
of "oldast": result = contains(conf.options, optOldAst)
else: invalidCmdLineOption(conf, passCmd1, switch, info)
proc processPath(conf: ConfigRef; path: string, info: TLineInfo,
@@ -583,7 +582,6 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
undefSymbol(conf.symbols, "hotcodereloading")
undefSymbol(conf.symbols, "useNimRtl")
of "nilseqs": processOnOffSwitch(conf, {optNilSeqs}, arg, pass, info)
of "oldast": processOnOffSwitch(conf, {optOldAst}, arg, pass, info)
of "checks", "x": processOnOffSwitch(conf, ChecksOptions, arg, pass, info)
of "floatchecks":
processOnOffSwitch(conf, {optNaNCheck, optInfCheck}, arg, pass, info)

View File

@@ -40,7 +40,6 @@ type # please make sure we have under 32 options
optTrMacros, # en/disable pattern matching
optMemTracker,
optNilSeqs,
optOldAst,
optSinkInference # 'sink T' inference

View File

@@ -586,23 +586,19 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
b.add a[^2]
b.add copyTree(def)
addToVarSection(c, result, n, b)
if optOldAst in c.config.options:
if def.kind != nkEmpty:
v.ast = def
# this is needed for the evaluation pass, guard checking
# and custom pragmas:
var ast = newNodeI(nkIdentDefs, a.info)
if a[j].kind == nkPragmaExpr:
var p = newNodeI(nkPragmaExpr, a.info)
p.add newSymNode(v)
p.add a[j][1].copyTree
ast.add p
else:
# this is needed for the evaluation pass, guard checking
# and custom pragmas:
var ast = newNodeI(nkIdentDefs, a.info)
if a[j].kind == nkPragmaExpr:
var p = newNodeI(nkPragmaExpr, a.info)
p.add newSymNode(v)
p.add a[j][1].copyTree
ast.add p
else:
ast.add newSymNode(v)
ast.add a[^2].copyTree
ast.add def
v.ast = ast
ast.add newSymNode(v)
ast.add a[^2].copyTree
ast.add def
v.ast = ast
else:
if def.kind in {nkPar, nkTupleConstr}: v.ast = def[j]
# bug #7663, for 'nim check' this can be a non-tuple:

View File

@@ -510,10 +510,7 @@ proc extractPragma(s: PSym): PNode =
proc warnAboutDeprecated(conf: ConfigRef; info: TLineInfo; s: PSym) =
var pragmaNode: PNode
if optOldAst in conf.options and s.kind in {skVar, skLet}:
pragmaNode = nil
else:
pragmaNode = if s.kind == skEnumField: extractPragma(s.owner) else: extractPragma(s)
pragmaNode = if s.kind == skEnumField: extractPragma(s.owner) else: extractPragma(s)
let name =
if s.kind == skEnumField and sfDeprecated notin s.flags: "enum '" & s.owner.name.s & "' which contains field '" & s.name.s & "'"
else: s.name.s

View File

@@ -314,7 +314,6 @@ tcc.options.always = "-w"
@if nimv019:
--multimethods:on
--oldAst:on
--define:nimOldCaseObjects
--define:nimOldShiftRight
@end

View File

@@ -105,7 +105,6 @@ Advanced options:
backwards compatibility
--seqsv2:on|off use the new string/seq implementation based on
destructors
--oldast:on|off use old AST for backwards compatibility
--skipCfg:on|off do not read the nim installation's configuration file
--skipUserCfg:on|off do not read the user's configuration file
--skipParentCfg:on|off do not read the parent dirs' configuration files