mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-28 10:13:56 +00:00
Resolve merge conflicts with devel branch refactoring (#25423)
The PR branch had merge conflicts with `devel` due to a major compiler refactoring that extracted type definitions from `compiler/ast.nim` into a new `compiler/astdef.nim` file. ## Changes - Resolved conflict in `compiler/ast.nim` by accepting `devel`'s refactored structure - Merged 763 commits from `devel` branch (commit range: `ce6a345..b3273e7`) - Preserved original PR changes removing deprecated symbols from `lib/core/macros.nim` The core PR functionality (removal of deprecated macros API since v0.18.1) remains intact while incorporating the upstream AST refactoring. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
@@ -29,18 +29,23 @@ const
|
||||
# doAssert res == digits100
|
||||
# ```
|
||||
|
||||
proc utoa2Digits*(buf: var openArray[char]; pos: int; digits: uint32) {.inline.} =
|
||||
{.push checks: off, stackTrace: off.}
|
||||
|
||||
when not defined(nimHasEnforceNoRaises):
|
||||
{.pragma: enforceNoRaises.}
|
||||
|
||||
proc utoa2Digits*(buf: var openArray[char]; pos: int; digits: uint32) {.inline, enforceNoRaises.} =
|
||||
buf[pos] = digits100[2 * digits]
|
||||
buf[pos+1] = digits100[2 * digits + 1]
|
||||
#copyMem(buf, unsafeAddr(digits100[2 * digits]), 2 * sizeof((char)))
|
||||
|
||||
proc trailingZeros2Digits*(digits: uint32): int {.inline.} =
|
||||
proc trailingZeros2Digits*(digits: uint32): int {.inline, enforceNoRaises.} =
|
||||
trailingZeros100[digits]
|
||||
|
||||
when defined(js):
|
||||
proc numToString(a: SomeInteger): cstring {.importjs: "((#) + \"\")".}
|
||||
|
||||
func addChars[T](result: var string, x: T, start: int, n: int) {.inline.} =
|
||||
func addChars[T](result: var string, x: T, start: int, n: int) {.inline, enforceNoRaises.} =
|
||||
let old = result.len
|
||||
result.setLen old + n
|
||||
template impl =
|
||||
@@ -52,10 +57,10 @@ func addChars[T](result: var string, x: T, start: int, n: int) {.inline.} =
|
||||
{.noSideEffect.}:
|
||||
copyMem result[old].addr, x[start].unsafeAddr, n
|
||||
|
||||
func addChars[T](result: var string, x: T) {.inline.} =
|
||||
func addChars[T](result: var string, x: T) {.inline, enforceNoRaises.} =
|
||||
addChars(result, x, 0, x.len)
|
||||
|
||||
func addIntImpl(result: var string, x: uint64) {.inline.} =
|
||||
func addIntImpl(result: var string, x: uint64) {.inline, enforceNoRaises.} =
|
||||
var tmp {.noinit.}: array[24, char]
|
||||
var num = x
|
||||
var next = tmp.len - 1
|
||||
@@ -79,8 +84,6 @@ func addIntImpl(result: var string, x: uint64) {.inline.} =
|
||||
dec next
|
||||
addChars(result, tmp, next, tmp.len - next)
|
||||
|
||||
when not defined(nimHasEnforceNoRaises):
|
||||
{.pragma: enforceNoRaises.}
|
||||
|
||||
func addInt*(result: var string, x: uint64) {.enforceNoRaises.} =
|
||||
when nimvm: addIntImpl(result, x)
|
||||
@@ -114,3 +117,5 @@ proc addInt*(result: var string; x: int64) {.enforceNoRaises.} =
|
||||
|
||||
proc addInt*(result: var string; x: int) {.inline, enforceNoRaises.} =
|
||||
addInt(result, int64(x))
|
||||
|
||||
{.pop.}
|
||||
|
||||
@@ -4,7 +4,13 @@ template toLocation*(result: var string, file: string | cstring, line: int, col:
|
||||
## avoids spurious allocations
|
||||
# Hopefully this can be re-used everywhere so that if a user needs to customize,
|
||||
# it can be done in a single place.
|
||||
result.add file
|
||||
when file is cstring:
|
||||
var i = 0
|
||||
while file[i] != '\0':
|
||||
add(result, file[i])
|
||||
inc i
|
||||
else:
|
||||
result.add file
|
||||
if line > 0:
|
||||
result.add "("
|
||||
addInt(result, line)
|
||||
|
||||
@@ -41,7 +41,7 @@ proc normalizePathAux(path: var string){.inline, raises: [], noSideEffect.}
|
||||
import std/private/osseps
|
||||
export osseps
|
||||
|
||||
proc absolutePathInternal(path: string): string {.gcsafe.}
|
||||
proc absolutePathInternal(path: string): string {.gcsafe, raises: [ValueError, OSerror].}
|
||||
|
||||
proc normalizePathEnd*(path: var string, trailingSep = false) =
|
||||
## Ensures ``path`` has exactly 0 or 1 trailing `DirSep`, depending on
|
||||
|
||||
Reference in New Issue
Block a user