Skip to content

Commit

Permalink
Fix build and tests for 5.7 toolchain (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun authored Jun 25, 2022
1 parent c4717d5 commit 5e6fe2d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ jobs:
ls -la Bundle
ls -lh Bundle/*.wasm | awk '{printf "::warning file=Sources/TokamakDemo/main.swift,line=1,col=1::TokamakDemo Wasm is %s.",$5}'
swiftwasm_test_5_6:
swiftwasm_test:
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
include:
- { toolchain: wasm-5.6.0-RELEASE }
- { toolchain: wasm-5.7-SNAPSHOT-2022-06-01-a }
- { toolchain: wasm-DEVELOPMENT-SNAPSHOT-2022-06-23-a }

steps:
- uses: actions/checkout@v2
- run: echo "${{ matrix.toolchain }}" > .swift-version
- uses: swiftwasm/swiftwasm-action@v5.6
with:
shell-action: carton test --environment node
Expand Down
4 changes: 3 additions & 1 deletion Sources/TokamakCore/Reflection/Pointers/MetadataOffset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ struct MetadataOffset<Pointee> {
let offset: Int32

func apply(to ptr: UnsafeRawPointer) -> UnsafePointer<Pointee> {
#if arch(wasm32)
// Data pointers in constant metadata are absolute until SwiftWasm 5.6
// Since SwiftWasm 5.7, they are relative as well as other platforms.
#if arch(wasm32) && !compiler(>=5.7)
return UnsafePointer<Pointee>(bitPattern: Int(offset))!
#else
return ptr.advanced(by: numericCast(offset)).assumingMemoryBound(to: Pointee.self)
Expand Down
2 changes: 1 addition & 1 deletion Sources/TokamakDOM/Storage/WebStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ extension WebStorage {
}

public func read(key: String) -> String? {
getItem(key: key, String.init)
getItem(key: key, { $0 })
}
}

0 comments on commit 5e6fe2d

Please sign in to comment.