mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-02 19:22:40 +00:00
refactoring: removed dead code (#18567)
This commit is contained in:
@@ -65,7 +65,7 @@ type
|
||||
# you may be in position to supply a better error message
|
||||
# to the user.
|
||||
efWantStmt, efAllowStmt, efDetermineType, efExplain,
|
||||
efAllowDestructor, efWantValue, efOperand, efNoSemCheck,
|
||||
efWantValue, efOperand, efNoSemCheck,
|
||||
efNoEvaluateGeneric, efInCall, efFromHlo, efNoSem2Check,
|
||||
efNoUndeclared
|
||||
# Use this if undeclared identifiers should not raise an error during
|
||||
|
||||
@@ -623,10 +623,10 @@ proc semArrayConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
localError(c.config, x.info, "invalid order in array constructor")
|
||||
x = x[1]
|
||||
|
||||
let xx = semExprWithType(c, x, flags*{efAllowDestructor})
|
||||
let xx = semExprWithType(c, x, {})
|
||||
result.add xx
|
||||
typ = commonType(c, typ, xx.typ)
|
||||
#n[i] = semExprWithType(c, x, flags*{efAllowDestructor})
|
||||
#n[i] = semExprWithType(c, x, {})
|
||||
#result.add fitNode(c, typ, n[i])
|
||||
inc(lastIndex)
|
||||
addSonSkipIntLit(result.typ, typ, c.idgen)
|
||||
@@ -1758,13 +1758,9 @@ proc semAsgn(c: PContext, n: PNode; mode=asgnNormal): PNode =
|
||||
localError(c.config, a.info, errXCannotBeAssignedTo %
|
||||
renderTree(a, {renderNoComments}))
|
||||
else:
|
||||
let
|
||||
lhs = n[0]
|
||||
lhsIsResult = lhs.kind == nkSym and lhs.sym.kind == skResult
|
||||
var
|
||||
rhs = semExprWithType(c, n[1],
|
||||
if lhsIsResult: {efAllowDestructor} else: {})
|
||||
if lhsIsResult:
|
||||
let lhs = n[0]
|
||||
let rhs = semExprWithType(c, n[1], {})
|
||||
if lhs.kind == nkSym and lhs.sym.kind == skResult:
|
||||
n.typ = c.enforceVoidContext
|
||||
if c.p.owner.kind != skMacro and resultTypeIsInferrable(lhs.sym.typ):
|
||||
var rhsTyp = rhs.typ
|
||||
@@ -2512,8 +2508,7 @@ proc semTupleFieldsConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
let id = considerQuotedIdent(c, n[i][0])
|
||||
if containsOrIncl(ids, id.id):
|
||||
localError(c.config, n[i].info, errFieldInitTwice % id.s)
|
||||
n[i][1] = semExprWithType(c, n[i][1],
|
||||
flags*{efAllowDestructor})
|
||||
n[i][1] = semExprWithType(c, n[i][1], {})
|
||||
|
||||
if n[i][1].typ.kind == tyTypeDesc:
|
||||
localError(c.config, n[i][1].info, "typedesc not allowed as tuple field.")
|
||||
@@ -2533,7 +2528,7 @@ proc semTuplePositionsConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
result.transitionSonsKind(nkTupleConstr)
|
||||
var typ = newTypeS(tyTuple, c) # leave typ.n nil!
|
||||
for i in 0..<n.len:
|
||||
n[i] = semExprWithType(c, n[i], flags*{efAllowDestructor})
|
||||
n[i] = semExprWithType(c, n[i], {})
|
||||
addSonSkipIntLit(typ, n[i].typ, c.idgen)
|
||||
result.typ = typ
|
||||
|
||||
|
||||
@@ -222,8 +222,7 @@ proc semConstructFields(c: PContext, n: PNode,
|
||||
valsDiff.renderAsType(n[0].typ)])
|
||||
|
||||
let branchNode = n[selectedBranch]
|
||||
let flags = flags*{efAllowDestructor} + {efPreferStatic,
|
||||
efPreferNilResult}
|
||||
let flags = {efPreferStatic, efPreferNilResult}
|
||||
var discriminatorVal = semConstrField(c, flags,
|
||||
discriminator.sym,
|
||||
constrCtx.initExpr)
|
||||
@@ -436,6 +435,6 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||
|
||||
if initResult == initFull:
|
||||
incl result.flags, nfAllFieldsSet
|
||||
|
||||
|
||||
# wrap in an error see #17437
|
||||
if hasError: result = errorNode(c, result)
|
||||
|
||||
@@ -512,7 +512,7 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
||||
|
||||
var def: PNode = c.graph.emptyNode
|
||||
if a[^1].kind != nkEmpty:
|
||||
def = semExprWithType(c, a[^1], {efAllowDestructor})
|
||||
def = semExprWithType(c, a[^1], {})
|
||||
|
||||
if def.kind == nkSym and def.sym.kind in {skTemplate, skMacro}:
|
||||
typFlags.incl taIsTemplateOrMacro
|
||||
|
||||
Reference in New Issue
Block a user