Skip to content

Commit fcfcc09

Browse files
committed
defaults threads on
typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 disable fragments (#19341) The original repo has moved to Rust, while the package path stay unchanged. And it causes troubles to #19338 prefer importCompilerProc fix #19343 (#19344) [backport] Ensure HttpClient onProgress is called once per second Ensure that reported speed is accurate stylecheck usages part two: stdlib cleanup (#19338) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 * prefer importCompilerProc added filemode docs (#19346) fix stylecheck error with asyncdispatch it is a partial regression since #12842 add tests don't use echo in tests Fix `remove` on last node of singly-linked list [backport:1.6] (#19353) fix stylecheck error with asyncdispatch (#19350) * stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since #12842 * add tests * don't use echo in tests remove spaces between an identifier and a star (#19355) It makes search easier by searching `+`* instead of `+` which filter lots of unexported versions. Follow #18681 defaults threads on
1 parent c7d5b8c commit fcfcc09

File tree

14 files changed

+82
-26
lines changed

14 files changed

+82
-26
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- `macros.parseExpr` and `macros.parseStmt` now accept an optional
2323
filename argument for more informative errors.
2424
- Module `colors` expanded with missing colors from the CSS color standard.
25+
- Fixed `lists.SinglyLinkedList` being broken after removing the last node ([#19353](https://github.com/nim-lang/Nim/pull/19353)).
2526

2627
## `std/smtp`
2728

compiler/semtempl.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
270270
# Issue #12832
271271
when defined(nimsuggest):
272272
suggestSym(c.graph, n.info, s, c.graph.usageSym, false)
273-
if {optStyleHint, optStyleError} * c.config.globalOptions != {}:
273+
# field access (dot expr) will be handled by builtinFieldAccess
274+
if not isField and {optStyleHint, optStyleError} * c.config.globalOptions != {}:
274275
styleCheckUse(c.config, n.info, s)
275276

276277
proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode =

compiler/wordrecg.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type
4141
wImmediate = "immediate", wConstructor = "constructor", wDestructor = "destructor",
4242
wDelegator = "delegator", wOverride = "override", wImportCpp = "importcpp",
4343
wCppNonPod = "cppNonPod",
44-
wImportObjC = "importobjc", wImportCompilerProc = "importcompilerproc",
44+
wImportObjC = "importobjc", wImportCompilerProc = "importCompilerProc",
4545
wImportc = "importc", wImportJs = "importjs", wExportc = "exportc", wExportCpp = "exportcpp",
4646
wExportNims = "exportnims",
4747
wIncompleteStruct = "incompleteStruct", # deprecated

config/nim.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ cc = gcc
1616
hint[LineTooLong]=off
1717
#hint[XDeclaredButNotUsed]=off
1818

19+
threads:on
20+
1921
# Examples of how to setup a cross-compiler:
2022

2123
# Cross-compiling for Raspberry Pi.

lib/impure/nre.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ proc matchesCrLf(pattern: Regex): bool =
281281
let newlineFlags = flags and (pcre.NEWLINE_CRLF or
282282
pcre.NEWLINE_ANY or
283283
pcre.NEWLINE_ANYCRLF)
284-
if newLineFlags > 0u32:
284+
if newlineFlags > 0u32:
285285
return true
286286

287287
# get flags from build config

lib/js/jsffi.nim

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,28 +163,28 @@ macro jsFromAst*(n: untyped): untyped =
163163
proc `&`*(a, b: cstring): cstring {.importjs: "(# + #)".}
164164
## Concatenation operator for JavaScript strings.
165165

166-
proc `+` *(x, y: JsObject): JsObject {.importjs: "(# + #)".}
167-
proc `-` *(x, y: JsObject): JsObject {.importjs: "(# - #)".}
168-
proc `*` *(x, y: JsObject): JsObject {.importjs: "(# * #)".}
169-
proc `/` *(x, y: JsObject): JsObject {.importjs: "(# / #)".}
170-
proc `%` *(x, y: JsObject): JsObject {.importjs: "(# % #)".}
171-
proc `+=` *(x, y: JsObject): JsObject {.importjs: "(# += #)", discardable.}
172-
proc `-=` *(x, y: JsObject): JsObject {.importjs: "(# -= #)", discardable.}
173-
proc `*=` *(x, y: JsObject): JsObject {.importjs: "(# *= #)", discardable.}
174-
proc `/=` *(x, y: JsObject): JsObject {.importjs: "(# /= #)", discardable.}
175-
proc `%=` *(x, y: JsObject): JsObject {.importjs: "(# %= #)", discardable.}
176-
proc `++` *(x: JsObject): JsObject {.importjs: "(++#)".}
177-
proc `--` *(x: JsObject): JsObject {.importjs: "(--#)".}
178-
proc `>` *(x, y: JsObject): JsObject {.importjs: "(# > #)".}
179-
proc `<` *(x, y: JsObject): JsObject {.importjs: "(# < #)".}
180-
proc `>=` *(x, y: JsObject): JsObject {.importjs: "(# >= #)".}
181-
proc `<=` *(x, y: JsObject): JsObject {.importjs: "(# <= #)".}
182-
proc `**` *(x, y: JsObject): JsObject {.importjs: "((#) ** #)".}
166+
proc `+`*(x, y: JsObject): JsObject {.importjs: "(# + #)".}
167+
proc `-`*(x, y: JsObject): JsObject {.importjs: "(# - #)".}
168+
proc `*`*(x, y: JsObject): JsObject {.importjs: "(# * #)".}
169+
proc `/`*(x, y: JsObject): JsObject {.importjs: "(# / #)".}
170+
proc `%`*(x, y: JsObject): JsObject {.importjs: "(# % #)".}
171+
proc `+=`*(x, y: JsObject): JsObject {.importjs: "(# += #)", discardable.}
172+
proc `-=`*(x, y: JsObject): JsObject {.importjs: "(# -= #)", discardable.}
173+
proc `*=`*(x, y: JsObject): JsObject {.importjs: "(# *= #)", discardable.}
174+
proc `/=`*(x, y: JsObject): JsObject {.importjs: "(# /= #)", discardable.}
175+
proc `%=`*(x, y: JsObject): JsObject {.importjs: "(# %= #)", discardable.}
176+
proc `++`*(x: JsObject): JsObject {.importjs: "(++#)".}
177+
proc `--`*(x: JsObject): JsObject {.importjs: "(--#)".}
178+
proc `>`*(x, y: JsObject): JsObject {.importjs: "(# > #)".}
179+
proc `<`*(x, y: JsObject): JsObject {.importjs: "(# < #)".}
180+
proc `>=`*(x, y: JsObject): JsObject {.importjs: "(# >= #)".}
181+
proc `<=`*(x, y: JsObject): JsObject {.importjs: "(# <= #)".}
182+
proc `**`*(x, y: JsObject): JsObject {.importjs: "((#) ** #)".}
183183
# (#) needed, refs https://github.com/nim-lang/Nim/pull/16409#issuecomment-760550812
184184
proc `and`*(x, y: JsObject): JsObject {.importjs: "(# && #)".}
185-
proc `or` *(x, y: JsObject): JsObject {.importjs: "(# || #)".}
185+
proc `or`*(x, y: JsObject): JsObject {.importjs: "(# || #)".}
186186
proc `not`*(x: JsObject): JsObject {.importjs: "(!#)".}
187-
proc `in` *(x, y: JsObject): JsObject {.importjs: "(# in #)".}
187+
proc `in`*(x, y: JsObject): JsObject {.importjs: "(# in #)".}
188188

189189
proc `[]`*(obj: JsObject, field: cstring): JsObject {.importjs: getImpl.}
190190
## Returns the value of a property of name `field` from a JsObject `obj`.

lib/pure/collections/lists.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,8 @@ proc remove*[T](L: var SinglyLinkedList[T], n: SinglyLinkedNode[T]): bool {.disc
739739
if prev.next == nil:
740740
return false
741741
prev.next = n.next
742+
if L.tail == n:
743+
L.tail = prev # update tail if we removed the last node
742744
true
743745

744746
proc remove*[T](L: var DoublyLinkedList[T], n: DoublyLinkedNode[T]) =

lib/pure/httpclient.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ proc reportProgress(client: HttpClient | AsyncHttpClient,
673673
progress: BiggestInt) {.multisync.} =
674674
client.contentProgress += progress
675675
client.oneSecondProgress += progress
676-
if (getMonoTime() - client.lastProgressReport).inSeconds > 1:
676+
if (getMonoTime() - client.lastProgressReport).inSeconds >= 1:
677677
if not client.onProgressChanged.isNil:
678678
await client.onProgressChanged(client.contentTotal,
679679
client.contentProgress,

lib/pure/os.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2888,7 +2888,7 @@ when defined(nimdoc):
28882888

28892889
elif defined(nimscript): discard
28902890
elif defined(nodejs):
2891-
type Argv = object of JSRoot
2891+
type Argv = object of JsRoot
28922892
let argv {.importjs: "process.argv".} : Argv
28932893
proc len(argv: Argv): int {.importjs: "#.length".}
28942894
proc `[]`(argv: Argv, i: int): cstring {.importjs: "#[#]".}

lib/system/io.nim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type
2222

2323
FileMode* = enum ## The file mode when opening a file.
2424
fmRead, ## Open the file for read access only.
25+
## If the file does not exist, it will not
26+
## be created.
2527
fmWrite, ## Open the file for write access only.
2628
## If the file does not exist, it will be
2729
## created. Existing files will be cleared!
@@ -32,7 +34,8 @@ type
3234
## If the file does not exist, it will not be
3335
## created. The existing file will not be cleared.
3436
fmAppend ## Open the file for writing only; append data
35-
## at the end.
37+
## at the end. If the file does not exist, it
38+
## will be created.
3639

3740
FileHandle* = cint ## type that represents an OS file handle; this is
3841
## useful for low-level file access

0 commit comments

Comments
 (0)