Skip to content

Commit

Permalink
fix: inherited variables included class
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg committed Oct 23, 2019
1 parent a068b68 commit 0352ef8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,12 @@ export function emitFile(
) {
return;
}

let symbol = typeChecker.getSymbolAtLocation(item);
if (symbol && symbol.flags === ts.SymbolFlags.Class) {
return;
}

const currentSourceFile = item.getSourceFile();
const symbolOfIdentifier = typeChecker.getSymbolAtLocation(item);
if (!symbolOfIdentifier) {
Expand Down
8 changes: 8 additions & 0 deletions test/features/inheritedVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@
"item" => $item
));
}, $arr);
class mmm {
static function func($num) {
return $num;
}
}
$arr4 = array_map(function ($item) {
return mmm::func($item);
}, $arr);
10 changes: 10 additions & 0 deletions test/features/inheritedVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,14 @@ let arr3 = arr.map(item => {
...a,
item
}
});

class mmm {
static func(num: string) {
return num;
}
}

let arr4 = arr.map(item => {
return mmm.func(item);
});

0 comments on commit 0352ef8

Please sign in to comment.