Skip to content

Commit 2ec16d6

Browse files
committed
Registration of variable redefinitions
1 parent 6d89efd commit 2ec16d6

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

src/languagePlugins/php/exportResolver/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe("PHP Export resolver", () => {
1515
const mynamespace = namespaces.get("My\\Namespace")!;
1616
expect(mynamespace.name).toBe("My\\Namespace");
1717
const symbols = mynamespace.symbols;
18-
expect(symbols.length).toBe(66);
18+
expect((new Set(symbols.map((s) => s.name))).size).toBe(66);
1919
});
2020

2121
test("resolves nested.php", () => {

src/languagePlugins/php/exportResolver/index.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import type Parser from "tree-sitter";
2-
import {
3-
type ExportedNamespace,
4-
type ExportedSymbol,
5-
PHP_VARIABLE,
6-
} from "./types.ts";
2+
import type { ExportedNamespace, ExportedSymbol } from "./types.ts";
73
import { INTERESTING_NODES, PHP_IDNODE_QUERY } from "./queries.ts";
84

95
export class PHPExportResolver {
@@ -41,12 +37,6 @@ export class PHPExportResolver {
4137
continue; // Root out false positives for variables and constants
4238
}
4339
const symType = INTERESTING_NODES.get(child.type)!;
44-
if (
45-
symType === PHP_VARIABLE &&
46-
exports.find((e) => e.name === idNode.node.text)
47-
) {
48-
continue; // No duplicate variables
49-
}
5040
exports.push({
5141
name: idNode.node.text,
5242
type: symType,

0 commit comments

Comments
 (0)