Jens-G opened a new pull request, #3905:
URL: https://github.com/apache/thrift/pull/3905
The JavaScript generator keys the struct methods by symbol:
```js
Simple.prototype[Symbol.for("read")] = function(input) { ... };
Simple.prototype[Symbol.for("write")] = function(output) { ... };
```
and generated code calls them the same way, for example in
`gen-js/ThriftTest_types.js`:
```js
this.struct_thing[Symbol.for("read")](input);
this.struct_thing[Symbol.for("write")](output);
```
Four call sites in the browser tests still use plain property access, and
fail with
`TypeError: data.write is not a function` / `xtruct3.read is not a function`:
| File | Line | Call |
|---|---|---|
| `lib/js/test/deep-constructor.test.js` | 24 | `data.write(protocol)` |
| `lib/js/test/deep-constructor.test.js` | 35 | `data.read(protocol)` |
| `lib/js/test/test.js` | 244 | `xtruct3.read(input)` |
| `lib/js/test/phantom-client.js` | 268 | `xtruct3.read(input)` |
That is every site: a sweep of the browser test code for both spellings
finds no others, and
nothing in the library or the generated code uses plain access.
`phantom-client.js` is not dead
code — `test/tests.json` lists it as a cross-test client.
These tests have not been running. `check-local` is guarded by `HAVE_NPM`,
which `configure.ac`
only sets inside the `--with-nodejs` blocks, so `make -C lib/js check`
reports "Nothing to be
done" and exits 0 in most configurations. THRIFT-6319 corrects that, which
is what brought this
failure to light; THRIFT-6321 corrects the lint levels that would otherwise
stop the run before
the tests.
The failure is not caused by the generator changes in THRIFT-6317 and
THRIFT-6318: it reproduces
identically with those reverted.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]