Skip to content

Commit

Permalink
fix: ensure paths are normalised in Puya source maps
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-makerx committed Nov 4, 2024
1 parent eb243dd commit 617a10a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/puya/ussemble/debug.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import Mapping, Sequence
from pathlib import Path

from puya.models import DebugEvent, DebugInfo
from puya.parse import SourceLocation
Expand Down Expand Up @@ -28,7 +29,7 @@ def build_debug_info(
pc - pc_offset: node.source_location for pc, node in pc_ops.items() if pc >= pc_offset
}

files = sorted(map(str, {s.file for s in source_map.values() if s and s.file}))
files = sorted(map(_normalize_path, {s.file for s in source_map.values() if s and s.file}))
mappings = _get_src_mappings(source_map, files)

return DebugInfo(
Expand All @@ -40,6 +41,10 @@ def build_debug_info(
)


def _normalize_path(path: Path) -> str:
return str(path).replace("\\", "/")


def _get_src_mappings(
source_map: Mapping[int, SourceLocation | None],
files: Sequence[str],
Expand Down

0 comments on commit 617a10a

Please sign in to comment.