`exports.getItems = async (req, res) => {…}` and `module.exports.x =
function () {…}` — the Express controller style — produced no symbol: the
arrow's parent is an assignment, not a declarator, so it stayed anonymous,
its calls attributed to the file, and `node`/`callers` answered "Symbol
not found" for a route-wired handler. Resolve the name from the export
property, mark it exported, in both the wasm walker and the kernel.
Co-authored-by: danusha2345 <ewidusoc498@gmail.com>
Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
90 lines
2.0 KiB
JavaScript
90 lines
2.0 KiB
JavaScript
/**
|
|
* JS-grammar torture fixture (javascript variant: no type machinery, JS class
|
|
* fields use `field_definition` with a `property` field).
|
|
*/
|
|
import { EventEmitter } from 'node:events';
|
|
const { promisify } = require('node:util');
|
|
|
|
/** Legacy prototype-style helper. */
|
|
function legacyHelper(a, b) {
|
|
return a + b;
|
|
}
|
|
|
|
const arrow = (x) => legacyHelper(x, 1);
|
|
|
|
class Widget extends EventEmitter {
|
|
static registry = new Map();
|
|
#privateField = 1;
|
|
label = 'w';
|
|
onTick = () => {
|
|
this.render();
|
|
};
|
|
wrapped = debounce(function () {
|
|
expensive();
|
|
}, 50);
|
|
|
|
constructor(opts) {
|
|
super();
|
|
this.opts = opts;
|
|
register(this.onTick);
|
|
}
|
|
|
|
render() {
|
|
paint(this.label);
|
|
}
|
|
|
|
static create(opts) {
|
|
return new Widget(opts);
|
|
}
|
|
}
|
|
|
|
// AMD-style wrapper — anonymous, but inner functions must still surface.
|
|
(function () {
|
|
function hiddenInner() {
|
|
return 7;
|
|
}
|
|
hiddenInner();
|
|
})();
|
|
|
|
module.exports.makeWidget = function makeWidget(opts) {
|
|
return Widget.create(opts);
|
|
};
|
|
|
|
// Vuex module shape (store-file signals: mutations + actions + getters).
|
|
const mutations = {
|
|
SET_USER(state, user) {
|
|
state.user = user;
|
|
},
|
|
};
|
|
const actions = {
|
|
async loadUser({ commit }, id) {
|
|
const user = await fetchUser(id);
|
|
commit('SET_USER', user);
|
|
},
|
|
};
|
|
export default {
|
|
namespaced: true,
|
|
state: () => ({ user: null }),
|
|
mutations,
|
|
actions,
|
|
getters: {
|
|
userName(state) {
|
|
return state.user?.name;
|
|
},
|
|
},
|
|
};
|
|
|
|
// --- CommonJS export assignments (#1675) -----------------------------------
|
|
exports.getItems = async (req, res) => { res.json(await findItems()); };
|
|
module.exports.deleteItem = function (req, res) { removeItem(req.params.id); res.end(); };
|
|
exports.plain = 42;
|
|
handlers.onSave = () => { persist(); };
|
|
// --- call-expression receivers (#1683) ----------------------------------------
|
|
function bucketChains(d, k, v) {
|
|
d.setdefault(k, []).append(v);
|
|
make().run();
|
|
(0, make)().run();
|
|
arr[0]().go();
|
|
obj.make().run().again();
|
|
}
|