Skip to content

Fix invalid array termination for null and undefined #38

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

Merged
merged 2 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ test("Array Iterator") {
let prop_4 = getJSValue(this: globalObject1Ref, name: "prop_4")
let array = try expectArray(prop_4)
let expectedProp_4: [JSValue] = [
.number(3), .number(4), .string("str_elm_1"), .number(5),
.number(3), .number(4), .string("str_elm_1"), .null, .undefined, .number(5),
]
try expectEqual(Array(array), expectedProp_4)
}
Expand Down
4 changes: 2 additions & 2 deletions IntegrationTests/bin/primary-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ global.globalObject1 = {
"prop_2": 2,
"prop_3": true,
"prop_4": [
3, 4, "str_elm_1", 5,
3, 4, "str_elm_1", null, undefined, 5,
],
"prop_5": {
"func1": function () { return },
Expand Down Expand Up @@ -41,4 +41,4 @@ const { startWasiTask } = require("../lib")

startWasiTask("./dist/PrimaryTests.wasm").catch(err => {
console.log(err)
});
});
2 changes: 1 addition & 1 deletion Sources/JavaScriptKit/JSArrayRef.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension JSArrayRef: RandomAccessCollection {
return nil
}
let value = ref[index]
return value.isNull ? nil : value
return value
}
}

Expand Down