Files
Synvoya a129ff2cd6 fix(powershell): emit inherits/implements edges for class base types
The `class_statement` handler read only the first `simple_name` child —
the class name — and never inspected the base type(s) after the `:`
token. As a result `class Dog : Animal` dropped the Dog->Animal
inheritance edge entirely; derived classes appeared as isolated nodes.

Walk the class_statement children, and once the `:` token is seen treat
each following `simple_name` as a base type. Matching the C# convention
(PowerShell has no syntactic base-vs-interface split), the first base is
emitted as `inherits` and the rest as `implements`, resolved via
ensure_named_node.

Adds a Shape/Circle inheritance pair to tests/fixtures/sample.ps1 and a
regression test asserting ("Circle","Shape") in the inherits edges.
2026-07-01 16:36:47 +01:00

49 lines
831 B
PowerShell

using namespace System.IO
using module MyModule
function Get-Data {
param(
[string]$Name,
[int]$Count = 10
)
$result = Process-Items -Name $Name -Count $Count
return $result
}
function Process-Items {
param([string]$Name, [int]$Count)
Write-Output "Processing $Count items for $Name"
}
class DataProcessor {
[string]$Source
DataProcessor([string]$source) {
$this.Source = $source
}
[string] Transform([string]$input) {
return $input.ToUpper()
}
[void] Save([string]$path) {
Set-Content -Path $path -Value $this.Source
}
}
class Shape {
[string]$Kind
[double] Area() {
return 0.0
}
}
class Circle : Shape {
[double]$Radius
[double] Area() {
return 3.14159 * $this.Radius * $this.Radius
}
}