diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index dc62e7c818..ba7e1500e3 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2901,22 +2901,6 @@ proc genDestroy(p: BProc; n: PNode) = internalError(p.config, n.info, "destructor turned out to be not trivial") discard "ignore calls to the default destructor" -proc genDispose(p: BProc; n: PNode) = - when false: - let elemType = n[1].typ.skipTypes(abstractVar).elementType - - var a: TLoc = initLocExpr(p, n[1].skipAddr) - - if isFinal(elemType): - if elemType.destructor != nil: - var destroyCall = newNodeI(nkCall, n.info) - genStmts(p, destroyCall) - lineFmt(p, cpsStmts, "#nimRawDispose($1, NIM_ALIGNOF($2))", [rdLoc(a), getTypeDesc(p.module, elemType)]) - else: - # ``nimRawDisposeVirtual`` calls the ``finalizer`` which is the same as the - # destructor, but it uses the runtime type. Afterwards the memory is freed: - lineCg(p, cpsStmts, ["#nimDestroyAndDispose($#)", rdLoc(a)]) - proc genSlice(p: BProc; e: PNode; d: var TLoc) = let (x, y) = genOpenArraySlice(p, e, e.typ, e.typ.elementType, prepareForMutation = e[1].kind == nkHiddenDeref and @@ -3490,7 +3474,6 @@ proc genConstHeader(m, q: BModule; p: BProc, sym: PSym) = m.initProc.procSec(cpsLocals).add('\t') m.initProc.procSec(cpsLocals).addAssignmentWithValue(sym.loc.snippet): m.initProc.procSec(cpsLocals).addCast(ptrType(getTypeDesc(m, sym.loc.t, dkVar))): - var getGlobalCall: CallBuilder m.initProc.procSec(cpsLocals).addCall("hcrGetGlobal", getModuleDllPath(q, sym), '"' & sym.loc.snippet & '"') @@ -3768,7 +3751,6 @@ proc expr(p: BProc, n: PNode, d: var TLoc) = if delayedCodegen(p.module): genConstStmt(p, n) else: # enforce addressable consts for exportc - let m = p.module for it in n: let symNode = skipPragmaExpr(it.firstSon) if symNode.kind == nkSym and sfExportc in symNode.sym.flags: diff --git a/compiler/ccgliterals.nim b/compiler/ccgliterals.nim index 0a1586ae29..ddedabf6ad 100644 --- a/compiler/ccgliterals.nim +++ b/compiler/ccgliterals.nim @@ -28,9 +28,6 @@ proc detectStrVersion(m: BModule): int = else: detectVersion(strVersion, "nimStrVersion") -proc detectSeqVersion(m: BModule): int = - detectVersion(seqVersion, "nimSeqVersion") - # ----- Version 1: GC'ed strings and seqs -------------------------------- proc genStringLiteralDataOnlyV1(m: BModule, s: string; result: var Rope) = @@ -132,25 +129,6 @@ proc genStringLiteralV2Const(m: BModule; n: PNode; isConst: bool; result: var Bu result.addField(strInit, name = "p"): result.add(cCast(ptrType("NimStrPayload"), cAddr(pureLit))) -proc ssoCharLit(ch: char): string = - ## Return a C char literal for ch, with proper escaping. - const hexDigits = "0123456789abcdef" - result = "'" - case ch - of '\'': result.add("\\'") - of '\\': result.add("\\\\") - of '\0': result.add("\\0") - of '\n': result.add("\\n") - of '\r': result.add("\\r") - of '\t': result.add("\\t") - elif ch.ord < 32 or ch.ord == 127: - result.add("\\x") - result.add(hexDigits[ch.ord shr 4]) - result.add(hexDigits[ch.ord and 0xf]) - else: - result.add(ch) - result.add('\'') - proc ssoBytesLit(m: BModule; s: string; slen: int): string = ## Compute the `bytes` field value for the new SmallString layout. ## byte 0 = slen, bytes 1-7 = inline chars 0-6 (zero-padded). @@ -320,19 +298,6 @@ proc genStringLiteralV3(m: BModule; n: PNode; isConst: bool; result: var Builder # ------ Version selector --------------------------------------------------- -proc genStringLiteralDataOnly(m: BModule; s: string; info: TLineInfo; - isConst: bool; result: var Rope) = - case detectStrVersion(m) - of 0, 1: genStringLiteralDataOnlyV1(m, s, result) - of 2: - let tmp = getTempName(m) - genStringLiteralDataOnlyV2(m, s, tmp, isConst) - result.add tmp - of 3: - localError(m.config, info, "genStringLiteralDataOnly not supported for SmallString (nimsso)") - else: - localError(m.config, info, "cannot determine how to produce code for string literal") - proc genNilStringLiteral(m: BModule; info: TLineInfo; result: var Builder) = result.add(cCast(ptrType(cgsymValue(m, "NimStringDesc")), NimNil)) diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index cffee9c77d..f4c6cfab9e 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -1354,92 +1354,6 @@ proc genTryCpp(p: BProc, t: PNode, d: var TLoc) = linefmt(p, cpsStmts, "if (T$1_) std::rethrow_exception(T$1_);$n", [etmp]) endSimpleBlock(p, scope) -proc genTryCppOld(p: BProc, t: PNode, d: var TLoc) = - # There are two versions we generate, depending on whether we - # catch C++ exceptions, imported via .importcpp or not. The - # code can be easier if there are no imported C++ exceptions - # to deal with. - - # code to generate: - # - # try - # { - # myDiv(4, 9); - # } catch (NimExceptionType1&) { - # body - # } catch (NimExceptionType2&) { - # finallyPart() - # raise; - # } - # catch(...) { - # general_handler_body - # } - # finallyPart(); - - template genExceptBranchBody(body: PNode) {.dirty.} = - genRestoreFrameAfterException(p) - expr(p, body, d) - - if not isEmptyType(t.typ) and d.k == locNone: - d = getTemp(p, t.typ) - genLineDir(p, t) - cgsym(p.module, "popCurrentExceptionEx") - let fin = if t[^1].kind == nkFinally: t[^1] else: nil - p.nestedTryStmts.add((fin, false, t.kind == nkHiddenTryStmt, 0.Natural)) - startBlockWith(p): - p.s(cpsStmts).add("try {\n") - expr(p, t.firstSon, d) - endBlockWith(p): - p.s(cpsStmts).add("}\n") - - var catchAllPresent = false - - p.nestedTryStmts[^1].inExcept = true - for i in 1.. 0: if optDocRaw in d.conf.globalOptions: diff --git a/compiler/docgen2.nim b/compiler/docgen2.nim index 7fb11a3bd7..1d5434879c 100644 --- a/compiler/docgen2.nim +++ b/compiler/docgen2.nim @@ -29,7 +29,6 @@ proc shouldProcess(g: PGen): bool = template closeImpl(body: untyped) {.dirty.} = var g = PGen(p) let useWarning = sfMainModule notin g.module.flags - let groupedToc = true if shouldProcess(g): finishGenerateDoc(g.doc) body @@ -41,7 +40,7 @@ template closeImpl(body: untyped) {.dirty.} = proc closeDoc*(graph: ModuleGraph; p: PPassContext, n: PNode): PNode = result = nil closeImpl: - writeOutput(g.doc, useWarning, groupedToc) + writeOutput(g.doc, useWarning, true) proc closeJson*(graph: ModuleGraph; p: PPassContext, n: PNode): PNode = result = nil diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 37969dfd31..bc99008a0d 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -173,7 +173,6 @@ template hasDestructorOrAsgn(c: var Con, typ: PType): bool = proc isLastRead(n: PNode; c: var Con; s: var Scope): bool = if not hasDestructorOrAsgn(c, n.typ): return true - let m = skipConvDfa(n) result = isLastReadImpl(n, c, s) proc isFirstWrite(n: PNode; c: var Con): bool = diff --git a/compiler/int128.nim b/compiler/int128.nim index cc253fb682..4b1f7f3a7a 100644 --- a/compiler/int128.nim +++ b/compiler/int128.nim @@ -340,9 +340,6 @@ proc `*`*(a: Int128, b: int32): Int128 = if b < 0: result = -result -proc `*=`(a: var Int128, b: int32) = - a = a * b - proc makeInt128(high, low: uint64): Int128 = result = Zero result.udata[0] = cast[uint32](low) diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index a04c8e8f95..963c147fac 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -148,11 +148,6 @@ proc newGlobals(): PGlobals = typeInfoGenerated: initIntSet() ) -proc initCompRes(): TCompRes = - result = TCompRes(address: "", res: "", - tmpLoc: "", typ: etyNone, kind: resNone - ) - proc rdLoc(a: TCompRes): Rope {.inline.} = if a.typ != etyBaseIndex: result = a.res @@ -594,15 +589,6 @@ proc binaryUintExpr(p: PProc, n: PNode, r: var TCompRes, op: string, r.res = "(($1 $2 $3) $4)" % [x.rdLoc, rope op, y.rdLoc, trimmer] r.kind = resExpr -template ternaryExpr(p: PProc, n: PNode, r: var TCompRes, magic, frmt: string) = - var x, y, z: TCompRes - useMagic(p, magic) - gen(p, n[1], x) - gen(p, n[2], y) - gen(p, n[3], z) - r.res = frmt % [x.rdLoc, y.rdLoc, z.rdLoc] - r.kind = resExpr - template unaryExpr(p: PProc, n: PNode, r: var TCompRes, magic, frmt: string) = # $1 binds to n[1], if $2 is present it will be substituted to a tmp of $1 useMagic(p, magic) @@ -1182,7 +1168,6 @@ proc genAsmOrEmitStmt(p: PProc, n: PNode; isAsmStmt = false) = of nkStrLit..nkTripleStrLit: p.body.add(it.strVal) of nkSym: - let v = it.sym # for backwards compatibility we don't deref syms here :-( if false: discard @@ -1255,17 +1240,6 @@ proc generateHeader(p: PProc, prc: PSym): Rope = result.add(name) result.add("_Idx") -proc countJsParams(typ: PType): int = - result = 0 - for i in 1.. 1: initList.add(", ") var it = n[i] diff --git a/compiler/lambdalifting.nim b/compiler/lambdalifting.nim index 21571de254..c1994a962d 100644 --- a/compiler/lambdalifting.nim +++ b/compiler/lambdalifting.nim @@ -126,11 +126,6 @@ const paramName* = ":envP" envName* = ":env" -proc newCall(a: PSym, b: PNode): PNode = - result = newNodeI(nkCall, a.info) - result.add newSymNode(a) - result.add b - proc createClosureIterStateType*(g: ModuleGraph; iter: PSym; idgen: IdGenerator): PType = var n = newNodeI(nkRange, iter.info) n.add newIntNode(nkIntLit, -1) @@ -288,7 +283,6 @@ proc liftIterSym*(g: ModuleGraph; n: PNode; idgen: IdGenerator; owner: PSym): PN addVar(v, env) result.add(v) # add 'new' statement: - #result.add newCall(getSysSym(g, n.info, "internalNew"), env) result.add genCreateEnv(env) createTypeBoundOpsLL(g, env.typ, n.info, idgen, owner) result.add makeClosure(g, idgen, iter, env, n.info) diff --git a/compiler/lexer.nim b/compiler/lexer.nim index bc94542cc2..b05041ef1a 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -735,17 +735,11 @@ proc getEscapedChar(L: var Lexer, tok: var Token) = else: lexMessage(L, errGenerated, "invalid character constant") proc handleCRLF(L: var Lexer, pos: int): int = - template registerLine = - let col = L.getColNumber(pos) - - case L.buf[pos] - of CR: - registerLine() - result = nimlexbase.handleCR(L, pos) - of LF: - registerLine() - result = nimlexbase.handleLF(L, pos) - else: result = pos + result = + case L.buf[pos] + of CR: nimlexbase.handleCR(L, pos) + of LF: nimlexbase.handleLF(L, pos) + else: pos type StringMode = enum diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index 032a4623f2..caba4b2600 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -596,12 +596,6 @@ proc newSeqCall(c: var TLiftCtx; x, y: PNode): PNode = lenCall.typ = getSysType(c.g, x.info, tyInt) result.add lenCall -proc setLenStrCall(c: var TLiftCtx; x, y: PNode): PNode = - let lenCall = genBuiltin(c, mLengthStr, "len", y) - lenCall.typ = getSysType(c.g, x.info, tyInt) - result = genBuiltin(c, mSetLengthStr, "setLen", x) # genAddr(g, x)) - result.add lenCall - proc setLenSeqCall(c: var TLiftCtx; t: PType; x, y: PNode; noinit = false): PNode = let lenCall = genBuiltin(c, mLengthSeq, "len", y) lenCall.typ = getSysType(c.g, x.info, tyInt) diff --git a/compiler/main.nim b/compiler/main.nim index e27960f589..0365eba486 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -209,22 +209,6 @@ proc commandInteractive(graph: ModuleGraph) = let s = llStreamOpenStdIn(onPrompt = proc() = flushDot(graph.config)) discard processPipelineModule(graph, m, idgen, s) -proc commandScan(cache: IdentCache, config: ConfigRef) = - var f = addFileExt(AbsoluteFile mainCommandArg(config), NimExt) - var stream = llStreamOpen(f, fmRead) - if stream != nil: - var - L: Lexer = default(Lexer) - tok: Token = default(Token) - openLexer(L, f, stream, cache, config) - while true: - rawGetTok(L, tok) - printTok(config, tok) - if tok.tokType == tkEof: break - closeLexer(L) - else: - rawMessage(config, errGenerated, "cannot open file: " & f.string) - const PrintRopeCacheStats = false diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim index 7b975268cd..6e8715c837 100644 --- a/compiler/modulegraphs.nim +++ b/compiler/modulegraphs.nim @@ -432,10 +432,6 @@ proc addDispatchers*(g: ModuleGraph, value: PSym) = # TODO: add it for packed modules g.dispatchers.add value -iterator resolveLazySymSeq(g: ModuleGraph, list: var seq[PSym]): PSym = - for it in list.mitems: - yield it - proc setMethodsPerType*(g: ModuleGraph; id: ItemId, methods: seq[PSym]) = # TODO: add it for packed modules g.methodsPerType[id] = methods @@ -668,10 +664,6 @@ proc hash*(u: SigHash): Hash = proc hash*(x: FileIndex): Hash {.borrow.} -template getPContext(): untyped = - when c is PContext: c - else: c.c - when defined(nimsuggest): template onUse*(info: TLineInfo; s: PSym; isGenericInstance = false) = discard template onDefResolveForward*(info: TLineInfo; s: PSym) = discard diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 8c3ef55423..cb9195bec8 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -24,10 +24,6 @@ template instLoc*(): InstantiationInfo = instantiationInfo(-2, fullPaths = true) template toStdOrrKind(stdOrr): untyped = if stdOrr == stdout: stdOrrStdout else: stdOrrStderr -proc toLowerAscii(a: var string) {.inline.} = - for c in mitems(a): - if isUpperAscii(c): c = char(uint8(c) xor 0b0010_0000'u8) - proc flushDot*(conf: ConfigRef) = ## safe to call multiple times let stdOrr = if optStdout in conf.globalOptions: stdout else: stderr @@ -83,7 +79,8 @@ proc canonicalCase(path: var string) {.inline.} = ## the idea is to only use this for checking whether a path is already in ## the table but otherwise keep the original case when FileSystemCaseSensitive: discard - else: toLowerAscii(path) + else: + for c in mitems(path): c = toLowerAscii(c) proc fileInfoKnown*(conf: ConfigRef; filename: AbsoluteFile): bool = var diff --git a/compiler/packages.nim b/compiler/packages.nim index 95c42151b0..ceb3b3ae32 100644 --- a/compiler/packages.nim +++ b/compiler/packages.nim @@ -27,7 +27,6 @@ proc getPackage*(conf: ConfigRef; cache: IdentCache; fileIdx: FileIndex): PSym = ## * `modulegraphs.getPackage` let filename = AbsoluteFile toFullPath(conf, fileIdx) - name = getIdent(cache, splitFile(filename).name) info = newLineInfo(fileIdx, 1, 1) pkgName = getPackageName(conf, filename.string) pkgIdent = getIdent(cache, pkgName) diff --git a/compiler/pipelineutils.nim b/compiler/pipelineutils.nim index b29d513060..eadd48467e 100644 --- a/compiler/pipelineutils.nim +++ b/compiler/pipelineutils.nim @@ -1,4 +1,3 @@ -import std/intsets import ast, options, lineinfos, pathutils, msgs, modulegraphs, packages proc skipCodegen*(config: ConfigRef; n: PNode): bool {.inline.} = diff --git a/compiler/procfind.nim b/compiler/procfind.nim index c2cc6e71fa..eedf1542cd 100644 --- a/compiler/procfind.nim +++ b/compiler/procfind.nim @@ -11,25 +11,10 @@ # This is needed for proper handling of forward declarations. import - ast, astalgo, msgs, semdata, types, trees, lookups + ast, astalgo, msgs, semdata, types, lookups import std/strutils -proc equalGenericParams(procA, procB: PNode): bool = - if procA.len != procB.len: return false - for i in 0..= 0 or (g.tokens.len > 0 and - g.tokens[^1].kind == tkSpaces) - proc putNL(g: var TSrcGen) = putNL(g, g.indent) @@ -646,28 +642,6 @@ proc maxLineLength(s: string): int = inc(lineLen) inc(i) -proc putRawStr(g: var TSrcGen, kind: TokType, s: string) = - var i = 0 - let hi = s.len - 1 - var str = "" - while i <= hi: - case s[i] - of '\r': - put(g, kind, str) - str = "" - inc(i) - if i <= hi and s[i] == '\n': inc(i) - optNL(g, 0) - of '\n': - put(g, kind, str) - str = "" - inc(i) - optNL(g, 0) - else: - str.add(s[i]) - inc(i) - put(g, kind, str) - proc containsNL(s: string): bool = for i in 0..", nodecl, varargs.} - - -when not declared(signbit): - proc c_signbit(x: SomeFloat): cint {.importc: "signbit", header: "".} - proc signbit*(x: SomeFloat): bool {.inline.} = - result = c_signbit(x) != 0 - import std/formatfloat proc toStrMaxPrecision*(f: BiggestFloat | float32): string = diff --git a/compiler/sem.nim b/compiler/sem.nim index a689e2626f..c3c2b82491 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -332,7 +332,6 @@ proc typeAllowedCheck(c: PContext; info: TLineInfo; typ: PType; kind: TSymKind; proc paramsTypeCheck(c: PContext, typ: PType) {.inline.} = typeAllowedCheck(c, typ.n.info, typ, skProc) -proc expectMacroOrTemplateCall(c: PContext, n: PNode): PSym proc semDirectOp(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType = nil): PNode proc semWhen(c: PContext, n: PNode, semCheck: bool = true): PNode proc semTemplateExpr(c: PContext, n: PNode, s: PSym, diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 38b88ee7d2..26c459f6d8 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -689,7 +689,7 @@ proc bracketNotFoundError(c: PContext; n: PNode; flags: TExprFlags) = baseFilter + {skIterator} else: baseFilter # this will add the errors: - var r = resolveOverloads(c, n, n, filter, flags, errors, true) + discard resolveOverloads(c, n, n, filter, flags, errors, true) if errors.len == 0: localError(c.config, n.info, "could not resolve: " & $n) else: @@ -926,15 +926,6 @@ proc semResolvedCall(c: PContext, x: var TCandidate, result.typ = finalCallee.typ.returnType updateDefaultParams(c, result) -proc canDeref(n: PNode): bool {.inline.} = - result = n.len >= 2 and (let t = n[1].typ; - t != nil and t.skipTypes({tyGenericInst, tyAlias, tySink}).kind in {tyPtr, tyRef}) - -proc tryDeref(n: PNode): PNode = - result = newNodeI(nkHiddenDeref, n.info) - result.typ = n.typ.skipTypes(abstractInst)[0] - result.add n - proc semOverloadedCall(c: PContext, n, nOrig: PNode, filter: TSymKinds, flags: TExprFlags; expectedType: PType = nil): PNode = diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index d4539f7fa2..5361f57724 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -22,7 +22,6 @@ const errNamedExprExpected = "named expression expected" errNamedExprNotAllowed = "named expression not allowed here" errFieldInitTwice = "field initialized twice: '$1'" - errUndeclaredFieldX = "undeclared field: '$1'" proc semTemplateExpr(c: PContext, n: PNode, s: PSym, flags: TExprFlags = {}; expectedType: PType = nil): PNode = @@ -770,17 +769,6 @@ proc changeType(c: PContext; n: PNode, newType: PType, check: bool) = n.typ = newType -proc arrayConstrType(c: PContext, n: PNode): PType = - var typ = newTypeS(tyArray, c) - rawAddSon(typ, nil) # index type - if n.len == 0: - rawAddSon(typ, newTypeS(tyEmpty, c)) # needs an empty basetype! - else: - var t = skipTypes(n[0].typ, {tyGenericInst, tyVar, tyLent, tyOrdinal, tyAlias, tySink}) - addSonSkipIntLit(typ, t, c.idgen) - typ.setIndexType makeRangeType(c, 0, n.len - 1, n.info) - result = typ - proc semArrayConstr(c: PContext, n: PNode, flags: TExprFlags; expectedType: PType = nil): PNode = result = newNodeI(nkBracket, n.info) # nkBracket nodes can also be produced by the VM as seq constant nodes @@ -1339,7 +1327,6 @@ proc lookupInRecordAndBuildCheck(c: PContext, n, r: PNode, field: PIdent, else: illFormedAst(n, c.config) const - tyTypeParamsHolders = {tyGenericInst, tyCompositeTypeClass} tyDotOpTransparent = {tyVar, tyLent, tyPtr, tyRef, tyOwned, tyAlias, tySink} proc readTypeParameter(c: PContext, typ: PType, @@ -2326,24 +2313,6 @@ proc semDeclared(c: PContext, n: PNode, onlyCurrentScope: bool): PNode = result.info = n.info result.typ = getSysType(c.graph, n.info, tyBool) -proc expectMacroOrTemplateCall(c: PContext, n: PNode): PSym = - ## The argument to the proc should be nkCall(...) or similar - ## Returns the macro/template symbol - if isCallExpr(n): - var expandedSym = qualifiedLookUp(c, n[0], {checkUndeclared}) - if expandedSym == nil: - errorUndeclaredIdentifier(c, n.info, n[0].renderTree) - return errorSym(c, n[0]) - - if expandedSym.kind notin {skMacro, skTemplate}: - localError(c.config, n.info, "'$1' is not a macro or template" % expandedSym.name.s) - return errorSym(c, n[0]) - - result = expandedSym - else: - localError(c.config, n.info, "'$1' is not a macro or template" % n.renderTree) - result = errorSym(c, n) - proc expectString(c: PContext, n: PNode): string = var n = semConstExpr(c, n) if n.kind in nkStrKinds: @@ -2358,14 +2327,6 @@ proc newAnonSym(c: PContext; kind: TSymKind, info: TLineInfo): PSym = proc semExpandToAst(c: PContext, n: PNode): PNode = let macroCall = n[1] - when false: - let expandedSym = expectMacroOrTemplateCall(c, macroCall) - if expandedSym.kind == skError: return n - - macroCall[0] = newSymNode(expandedSym, macroCall.info) - markUsed(c, n.info, expandedSym) - onUse(n.info, expandedSym) - if isCallExpr(macroCall): for i in 1.. lastFloat(n.typ): - localError(g.config, n.info, "cannot convert " & $value & - " to " & typeToString(n.typ)) - proc foldConv(n, a: PNode; idgen: IdGenerator; g: ModuleGraph; check = false): PNode = let dstTyp = skipTypes(n.typ, abstractRange - {tyTypeDesc}) let srcTyp = skipTypes(a.typ, abstractRange - {tyTypeDesc}) diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index 91a834078d..da9b1c187c 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -233,7 +233,7 @@ proc fuzzyLookup(c: PContext, n: PNode, flags: TSemGenericFlags, if s.kind == skType: # don't put types in sym choice var ambig = false if candidates.len > 1: - let s2 = searchInScopes(c, ident, ambig) + discard searchInScopes(c, ident, ambig) result = newDot(result, semGenericStmtSymbol(c, n, s, ctx, flags, isAmbiguous = ambig, fromDotExpr = true)) else: diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim index 769f88b6f2..bb6dbe4144 100644 --- a/compiler/semobjconstr.nim +++ b/compiler/semobjconstr.nim @@ -440,7 +440,7 @@ proc initConstrContext(t: PType, initExpr: PNode): ObjConstrContext = proc computeRequiresInit(c: PContext, t: PType): bool = assert t.kind == tyObject var constrCtx = initConstrContext(t, newNode(nkObjConstr)) - let initResult = semConstructTypeAux(c, constrCtx, {efWantNoDefaults}) + discard semConstructTypeAux(c, constrCtx, {efWantNoDefaults}) constrCtx.missingFields.len > 0 proc defaultConstructionError(c: PContext, t: PType, info: TLineInfo) = @@ -450,7 +450,7 @@ proc defaultConstructionError(c: PContext, t: PType, info: TLineInfo) = assert objType != nil if objType.kind == tyObject: var constrCtx = initConstrContext(objType, newNodeI(nkObjConstr, info)) - let initResult = semConstructTypeAux(c, constrCtx, {efIgnoreDefaults}) + discard semConstructTypeAux(c, constrCtx, {efIgnoreDefaults}) if constrCtx.missingFields.len > 0: localError(c.config, info, "The $1 type doesn't have a default value. The following fields must be initialized: $2." % [typeToString(t), listSymbolNames(constrCtx.missingFields)]) diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 2d1a42cd86..1bc5bac628 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -1006,7 +1006,6 @@ proc trackIf(tracked: PEffects, n: PNode) = proc trackBlock(tracked: PEffects, n: PNode; typ: PType) = if n.kind in {nkStmtList, nkStmtListExpr}: - let myBlock = tracked.currentBlock var oldState = -1 for i in 0..