-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from Stephanevg/dev
Dev
- Loading branch information
Showing
54 changed files
with
2,725 additions
and
696 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
PSClassUtils/Functions/Private/Out-CUPSGraph.1.ps1 | ||
Tests/woop.ps1 | ||
Tests/test_graph.ps1 | ||
PSClassUtils/Classes/Private/00_CUClassParameter.psm1 | ||
Tests/plop.ps1 | ||
Tests/wap.psm1 | ||
.vscode/launch.json | ||
PSClassUtils/Functions/Private/Out-CUPSGraph.ps1 | ||
Tests/woop.png | ||
PSClassUtils/Functions/Private/Out-CUPSGraph.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Class CUClassParameter { | ||
[String]$Name | ||
[String]$Type | ||
hidden $Raw | ||
|
||
CUClassParameter([String]$Name,[String]$Type){ | ||
|
||
$this.Name = $Name | ||
$This.Type = $Type | ||
|
||
} | ||
|
||
CUClassParameter([String]$Name,[String]$Type,$Raw){ | ||
|
||
$this.Name = $Name | ||
$This.Type = $Type | ||
$this.Raw = $Raw | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Class CUClassProperty { | ||
[String]$ClassName | ||
[String]$Name | ||
[String]$Type | ||
[string]$Visibility | ||
Hidden $Raw | ||
|
||
CUClassProperty([String]$ClassName,[String]$Name,[String]$Type){ | ||
|
||
$this.ClassName = $ClassName | ||
$this.Name = $Name | ||
$this.Type = $Type | ||
|
||
} | ||
|
||
CUClassProperty([String]$ClassName,[String]$Name,[String]$Type,[String]$Visibility){ | ||
|
||
$this.ClassName = $ClassName | ||
$this.Name = $Name | ||
$this.Type = $Type | ||
$this.Visibility = $Visibility | ||
|
||
} | ||
|
||
CUClassProperty([String]$ClassName,[String]$Name,[String]$Type,[String]$Visibility,$Raw){ | ||
|
||
$this.ClassName = $ClassName | ||
$this.Name = $Name | ||
$this.Type = $Type | ||
$this.Visibility = $Visibility | ||
$this.Raw = $Raw | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Class CUClassMethod { | ||
[String]$ClassName | ||
[String]$Name | ||
[String]$ReturnType | ||
[CUClassParameter[]]$Parameter | ||
hidden $Raw | ||
#hidden $Extent | ||
|
||
CUClassMethod([String]$ClassName,[String]$Name,[String]$ReturnType,[CUClassParameter[]]$Parameter){ | ||
$this.ClassName = $ClassName | ||
$this.Name = $Name | ||
$This.ReturnType = $ReturnType | ||
$This.Parameter = $Parameter | ||
} | ||
|
||
CUClassMethod([String]$ClassName,[String]$Name,[String]$ReturnType,[CUClassParameter[]]$Parameter,$Raw){ | ||
$this.ClassName = $ClassName | ||
$this.Name = $Name | ||
$This.ReturnType = $ReturnType | ||
$This.Parameter = $Parameter | ||
$This.Raw = $Raw | ||
#$This.Extent = $Raw.Extent.Text | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Class CUClassConstructor { | ||
[String]$ClassName | ||
[String]$Name | ||
[CUClassParameter[]]$Parameter | ||
hidden $Raw | ||
#hidden $Extent | ||
|
||
CUClassConstructor([String]$ClassName,[String]$Name,[CUClassParameter[]]$Parameter){ | ||
$this.ClassName = $ClassName | ||
$this.Name = $Name | ||
$This.Parameter = $Parameter | ||
} | ||
|
||
CUClassConstructor([String]$ClassName,[String]$Name,[CUClassParameter[]]$Parameter,$Raw){ | ||
$this.ClassName = $ClassName | ||
$this.Name = $Name | ||
$This.Parameter = $Parameter | ||
$This.Raw = $Raw | ||
#$This.Extent = $Raw.Extent.Text | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Class ASTDocument { | ||
[System.Management.Automation.Language.StatementAst[]]$Classes | ||
[System.Management.Automation.Language.StatementAst[]]$Enums | ||
$Source | ||
$ClassName | ||
Hidden $Raw | ||
|
||
ASTDocument ([System.Management.Automation.Language.StatementAst[]]$Classes,[System.Management.Automation.Language.StatementAst[]]$Enums,$Source){ | ||
$This.Classes = $Classes | ||
$This.Enums = $Enums | ||
$This.Source = $Source | ||
$This.ClassName = $Classes.Name | ||
} | ||
|
||
ASTDocument([System.Management.Automation.Language.StatementAst[]]$Classes,[System.Management.Automation.Language.StatementAst[]]$Enums,$Source,[System.Management.Automation.Language.ScriptBlockAst]$RawAST){ | ||
$This.Classes = $Classes | ||
$This.Enums = $Enums | ||
$This.Source = $Source | ||
$This.ClassName = $Classes.Name | ||
$This.Raw = $RawAST | ||
} | ||
} |
7 changes: 2 additions & 5 deletions
7
...assUtils/Classes/Private/05_ClassEnum.ps1 → ...assUtils/Classes/Private/05_ClassEnum.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
Class CUClass { | ||
[String]$Name | ||
[CUClassProperty[]]$Property | ||
[CUClassConstructor[]]$Constructor | ||
[CUClassMethod[]]$Method | ||
[Bool]$IsInherited = $False | ||
[String]$ParentClassName | ||
[System.IO.FileInfo]$Path | ||
Hidden $Raw | ||
#Hidden $Ast | ||
|
||
CUClass($AST){ | ||
|
||
#$this.Raw = $RawAST | ||
$this.Raw = $AST | ||
$This.SetPropertiesFromAST() | ||
|
||
} | ||
|
||
CUClass ($Name,$Property,$Constructor,$Method){ | ||
|
||
$This.Name = $Name | ||
$This.Property = $Property | ||
$This.Constructor = $Constructor | ||
$This.Method = $Method | ||
|
||
} | ||
|
||
CUClass ($Name,$Property,$Constructor,$Method,$AST){ | ||
|
||
$This.Name = $Name | ||
$This.Property = $Property | ||
$This.Constructor = $Constructor | ||
$This.Method = $Method | ||
$This.Raw = $AST | ||
|
||
} | ||
|
||
|
||
## Set Name, and call Other Set | ||
[void] SetPropertiesFromAST(){ | ||
|
||
$This.Name = $This.Raw.Name | ||
$This.Path = [System.IO.FileInfo]::new($This.Raw.Extent.File) | ||
$This.SetConstructorFromAST() | ||
$This.SetPropertyFromAST() | ||
$This.SetMethodFromAST() | ||
|
||
## Inheritence Check | ||
If ( $This.Raw.BaseTypes ) { | ||
$This.IsInherited = $True | ||
$This.ParentClassName = $This.Raw.BaseTypes.TypeName.Name | ||
} | ||
|
||
} | ||
|
||
## Find Constructors for the current Class | ||
[void] SetConstructorFromAST(){ | ||
|
||
$Constructors = $null | ||
$Constructors = $This.Raw.Members | Where-Object {$_.IsConstructor -eq $True} | ||
|
||
Foreach ( $Constructor in $Constructors ) { | ||
|
||
$Parameters = $null | ||
$Parameters = $Constructor.Parameters | ||
[CUClassParameter[]]$Paras = @() | ||
|
||
If ( $Parameters ) { | ||
|
||
Foreach ( $Parameter in $Parameters ) { | ||
|
||
$Type = $null | ||
# couldn't find another place where the returntype was located. | ||
# If you know a better place, please update this! I'll pay you beer. | ||
$Type = $Parameter.Extent.Text.Split("$")[0] | ||
$Paras += [CUClassParameter]::New($Parameter.Name.VariablePath.UserPath, $Type) | ||
|
||
} | ||
|
||
} | ||
|
||
$This.Constructor += [CUClassConstructor]::New($This.name,$Constructor.Name, $Paras,$Constructor) | ||
} | ||
|
||
} | ||
|
||
## Find Methods for the current Class | ||
[void] SetMethodFromAST(){ | ||
|
||
$Methods = $null | ||
$Methods = $This.Raw.Members | Where-Object {$_.IsConstructor -eq $False} | ||
|
||
Foreach ( $Method in $Methods ) { | ||
|
||
$Parameters = $null | ||
$Parameters = $Method.Parameters | ||
[CUClassParameter[]]$Paras = @() | ||
|
||
If ( $Parameters ) { | ||
|
||
Foreach ( $Parameter in $Parameters ) { | ||
|
||
$Type = $null | ||
# couldn't find another place where the returntype was located. | ||
# If you know a better place, please update this! I'll pay you beer. | ||
$Type = $Parameter.Extent.Text.Split("$")[0] | ||
$Paras += [CUClassParameter]::New($Parameter.Name.VariablePath.UserPath, $Type) | ||
|
||
} | ||
|
||
} | ||
|
||
$This.Method += [CUClassMethod]::New($This.Name,$Method.Name, $Method.ReturnType, $Paras,$Method) | ||
} | ||
|
||
} | ||
|
||
## Find Properties for the current Class | ||
[void] SetPropertyFromAST(){ | ||
|
||
$Properties = $This.Raw.Members | Where-Object {$_ -is [System.Management.Automation.Language.PropertyMemberAst]} | ||
|
||
If ($Properties) { | ||
|
||
Foreach ( $Pro in $Properties ) { | ||
|
||
If ( $Pro.IsHidden ) { | ||
$Visibility = "Hidden" | ||
} Else { | ||
$visibility = "public" | ||
} | ||
|
||
$This.Property += [CUClassProperty]::New($This.Name,$pro.Name, $pro.PropertyType.TypeName.Name, $Visibility,$Pro) | ||
} | ||
} | ||
|
||
} | ||
|
||
## Return the content of Constructor | ||
[CUClassConstructor[]]GetCUClassConstructor(){ | ||
|
||
return $This.Constructor | ||
|
||
} | ||
|
||
## Return the content of Method | ||
[CUClassMethod[]]GetCUClassMethod(){ | ||
|
||
return $This.Method | ||
|
||
} | ||
|
||
## Return the content of Property | ||
[CUClassProperty[]]GetCUClassProperty(){ | ||
|
||
return $This.Property | ||
|
||
} | ||
|
||
} |
File renamed without changes.
Oops, something went wrong.