mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 00:07:18 +00:00
fix(javascript): preserve semantic uncertainty and lexical ownership
This commit is contained in:
1 parent
9fe54c4073
commit
896696b2e7
16 files changed
+525
-20
No files matched your search
@@ -8,6 +8,28 @@ import {
|
||||
} from "./javascriptSemanticAnalysis.fixture.js";
|
||||
|
||||
describe("JavaScript semantic analysis: calls 1", () => {
|
||||
it("does not assign computed method-name reads to method closures", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
function outer() {
|
||||
const name = "m";
|
||||
const object = { [name]() { return 1; }, ["literal"]() { return 2; } };
|
||||
class Example {
|
||||
[name]() { return 3; }
|
||||
["literal"]() { return 4; }
|
||||
}
|
||||
}
|
||||
`);
|
||||
expect(ir.closureCaptures).toEqual([]);
|
||||
|
||||
const bodyRead = analyzeJavaScriptSemantics(`
|
||||
function outer() {
|
||||
const value = 1;
|
||||
const object = { method() { return value; } };
|
||||
}
|
||||
`);
|
||||
expect(bodyRead.closureCaptures).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("links exact local calls to parameters, returns, and closure captures", () => {
|
||||
const ir = analyzeJavaScriptSemantics(`
|
||||
const prefix = "rea";
|
||||
|
||||
Reference in new issue
Block a user