Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obvious bugfixes #446

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/hexer/duplifier.nim
Original file line number Diff line number Diff line change
@@ -286,8 +286,11 @@ proc skipParRi*(n: var Cursor) =
else:
error "expected ')', but got: ", n

proc getHookType(c: var Context; n: Cursor): Cursor =
result = skipModifier(getType(c.typeCache, n.firstSon))

proc trExplicitDestroy(c: var Context; n: var Cursor) =
let typ = getType(c.typeCache, n.firstSon)
let typ = getHookType(c, n)
let info = n.info
let destructor = getDestructor(c.lifter[], typ, info)
if destructor == NoSymId:
@@ -303,7 +306,7 @@ proc trExplicitDestroy(c: var Context; n: var Cursor) =
skipParRi n

proc trExplicitDup(c: var Context; n: var Cursor; e: Expects) =
let typ = getType(c.typeCache, n)
let typ = getHookType(c, n)
let info = n.info
let hookProc = getHook(c.lifter[], attachedDup, typ, info)
if hookProc != NoSymId:
@@ -318,7 +321,7 @@ proc trExplicitDup(c: var Context; n: var Cursor; e: Expects) =
skipParRi n

proc trExplicitCopy(c: var Context; n: var Cursor; op: AttachedOp) =
let typ = getType(c.typeCache, n)
let typ = getHookType(c, n)
let info = n.info
let hookProc = getHook(c.lifter[], op, typ, info)
if hookProc != NoSymId:
@@ -336,7 +339,7 @@ proc trExplicitCopy(c: var Context; n: var Cursor; op: AttachedOp) =
wantParRi c.dest, n

proc trExplicitWasMoved(c: var Context; n: var Cursor) =
let typ = getType(c.typeCache, n)
let typ = getHookType(c, n)
let info = n.info
let hookProc = getHook(c.lifter[], attachedWasMoved, typ, info)
if hookProc != NoSymId:
@@ -346,11 +349,11 @@ proc trExplicitWasMoved(c: var Context; n: var Cursor) =
tr c, n, DontCare
else:
inc n
tr c, n, DontCare
skip n
skipParRi n

proc trExplicitTrace(c: var Context; n: var Cursor) =
let typ = getType(c.typeCache, n)
let typ = getHookType(c, n)
let info = n.info
let hookProc = getHook(c.lifter[], attachedTrace, typ, info)
if hookProc != NoSymId:
@@ -361,8 +364,8 @@ proc trExplicitTrace(c: var Context; n: var Cursor) =
tr c, n, DontCare
else:
inc n
tr c, n, DontCare
tr c, n, DontCare
skip n
skip n
skipParRi n

proc trOnlyEssentials(c: var Context; n: var Cursor) =
8 changes: 8 additions & 0 deletions src/nimony/nimony_model.nim
Original file line number Diff line number Diff line change
@@ -508,3 +508,11 @@ proc hasBuiltinPragma*(n: Cursor; kind: PragmaKind): bool =

proc addSymUse*(dest: var TokenBuf; s: SymId; info: PackedLineInfo) =
dest.add symToken(s, info)

const
TypeModifiers = {MutT, OutT, LentT, SinkT, StaticT}

proc skipModifier*(a: Cursor): Cursor =
result = a
if result.kind == ParLe and result.typeKind in TypeModifiers:
inc result
8 changes: 0 additions & 8 deletions src/nimony/sigmatch.nim
Original file line number Diff line number Diff line change
@@ -412,14 +412,6 @@ proc procTypeMatch(m: var Match; f, a: var Cursor) =
skip f # body
expectParRi m, f

const
TypeModifiers = {MutT, OutT, LentT, SinkT, StaticT}

proc skipModifier*(a: Cursor): Cursor =
result = a
if result.kind == ParLe and result.typeKind in TypeModifiers:
inc result

proc commonType(f, a: Cursor): Cursor =
# XXX Refine
result = a

Unchanged files with check annotations Beta

import std / [formatfloat]
import bitabs, lineinfos, nifreader, nifstreams, nifcursors

Check warning on line 9 in src/lib/nifchecksums.nim

GitHub Actions / linux-amd64-nim-devel (master)

imported and not used: 'lineinfos' [UnusedImport]

Check warning on line 9 in src/lib/nifchecksums.nim

GitHub Actions / linux-amd64-nim-devel (master)

imported and not used: 'lineinfos' [UnusedImport]

Check warning on line 9 in src/lib/nifchecksums.nim

GitHub Actions / macos-amd64-nim-devel (master)

imported and not used: 'lineinfos' [UnusedImport]

Check warning on line 9 in src/lib/nifchecksums.nim

GitHub Actions / macos-amd64-nim-devel (master)

imported and not used: 'lineinfos' [UnusedImport]

Check warning on line 9 in src/lib/nifchecksums.nim

GitHub Actions / windows-amd64-nim-devel (master)

imported and not used: 'lineinfos' [UnusedImport]

Check warning on line 9 in src/lib/nifchecksums.nim

GitHub Actions / windows-amd64-nim-devel (master)

imported and not used: 'lineinfos' [UnusedImport]
#import std / [sha1]
import "$nim"/dist/checksums/src/checksums/sha1
## Create an index file for a NIF file.
import std / [os, tables, assertions, syncio, formatfloat, sets]

Check warning on line 9 in src/lib/nifindexes.nim

GitHub Actions / linux-amd64-nim-devel (master)

imported and not used: 'formatfloat' [UnusedImport]

Check warning on line 9 in src/lib/nifindexes.nim

GitHub Actions / linux-amd64-nim-devel (master)

imported and not used: 'formatfloat' [UnusedImport]

Check warning on line 9 in src/lib/nifindexes.nim

GitHub Actions / macos-amd64-nim-devel (master)

imported and not used: 'formatfloat' [UnusedImport]

Check warning on line 9 in src/lib/nifindexes.nim

GitHub Actions / macos-amd64-nim-devel (master)

imported and not used: 'formatfloat' [UnusedImport]

Check warning on line 9 in src/lib/nifindexes.nim

GitHub Actions / windows-amd64-nim-devel (master)

imported and not used: 'formatfloat' [UnusedImport]

Check warning on line 9 in src/lib/nifindexes.nim

GitHub Actions / windows-amd64-nim-devel (master)

imported and not used: 'formatfloat' [UnusedImport]
import bitabs, lineinfos, nifreader, nifstreams, nifcursors, nifchecksums
#import std / [sha1]