Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ history.

## Unreleased

- `fjs/djs/parser`'s `proof` covers `endObject`'s defensive non-object-top
guard directly, the same way it already covers `pushKey` and `endArray`'s
equivalent unreachable branches
[#1525](https://github.com/functionalscript/functionalscript/pull/1525)
- `fjs/text/ascii` owns the hex-digit codec: `hexDigitValue`,
`hexDigitCodePoint`, and the `a-f` / `A-F` ranges. The JSON serializer and
both tokenizers use it instead of rederiving the offsets; the DJS tokenizer
Expand Down
18 changes: 18 additions & 0 deletions fjs/djs/parser/module.f.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -544,4 +544,22 @@ export const proof = {
assertEq(result.state, 'result')
},
},
endObject: {
// `endObject` is only ever invoked while `state.top` is an object
// (the `'{'`/`'{k'`/`'{:'`/`'{v'`/`'{,'` value-states guarantee it),
// so its non-object guard is a defensive branch unreachable through
// `parseFromTokens`. Call it directly to cover that branch.
nonObjectTop: () => {
/** @type {_ParseValueState} */
const state = {
state: 'exportValue',
module: { refs: null, modules: null, consts: null },
valueState: '{,',
top: null,
stack: null,
}
const result = endObject(state)
assertEq(result.state, 'result')
},
},
}
Loading