mirror of
https://github.com/safishamsi/graphify.git
synced 2026-07-14 03:17:28 +00:00
a129ff2cd6
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.
49 lines
831 B
PowerShell
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
|
|
}
|
|
}
|