-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parent_basic_decl on a generic's body should return the instantiation.
- Loading branch information
Showing
11 changed files
with
196 additions
and
31 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
30 changes: 30 additions & 0 deletions
30
testsuite/tests/properties/fully_qualified_name_8/test.adb
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,30 @@ | ||
procedure Test is | ||
generic | ||
package Gen is | ||
procedure Visible; | ||
end Gen; | ||
|
||
package body Gen is | ||
procedure Inner is | ||
begin | ||
null; | ||
end Inner; | ||
|
||
procedure Visible is | ||
begin | ||
Inner; | ||
end Visible; | ||
|
||
end Gen; | ||
|
||
package Inst is new Gen; | ||
--% gen_body = node.p_designated_generic_decl.p_body_part | ||
--% gen_body.p_fully_qualified_name | ||
--% inner = gen_body.findall(lal.SubpBody)[0] | ||
--% visible = gen_body.findall(lal.SubpBody)[1] | ||
--% inner.p_fully_qualified_name | ||
--% visible.p_fully_qualified_name | ||
begin | ||
Inst.Visible; | ||
end Test; | ||
|
20 changes: 20 additions & 0 deletions
20
testsuite/tests/properties/fully_qualified_name_8/test.out
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 @@ | ||
Working on node <GenericPackageInstantiation ["Inst"] test.adb:20:4-20:28> | ||
========================================================================== | ||
|
||
Set 'gen_body' to 'node.p_designated_generic_decl.p_body_part' | ||
Result: <| PackageBody ["Gen"] test.adb:7:4-18:12 [test.adb:20:4] |> | ||
|
||
Eval 'gen_body.p_fully_qualified_name' | ||
Result: 'Test.Inst' | ||
|
||
Set 'inner' to 'gen_body.findall(lal.SubpBody)[0]' | ||
Result: <| SubpBody ["Inner"] test.adb:8:7-11:17 [test.adb:20:4] |> | ||
|
||
Set 'visible' to 'gen_body.findall(lal.SubpBody)[1]' | ||
Result: <| SubpBody ["Visible"] test.adb:13:7-16:19 [test.adb:20:4] |> | ||
|
||
Eval 'inner.p_fully_qualified_name' | ||
Result: 'Test.Inst.Inner' | ||
|
||
Eval 'visible.p_fully_qualified_name' | ||
Result: 'Test.Inst.Visible' |
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,2 @@ | ||
driver: inline-playground | ||
input_sources: [test.adb] |
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
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
37 changes: 37 additions & 0 deletions
37
testsuite/tests/properties/parent_basic_decl_generic_body/test.adb
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,37 @@ | ||
procedure Test is | ||
generic | ||
package Pkg is | ||
procedure Foo; | ||
--% node.p_parent_basic_decl | ||
--% node.p_parent_basic_decl.p_parent_basic_decl | ||
end Pkg; | ||
|
||
package body Pkg is | ||
procedure Foo is null; | ||
--% node.p_parent_basic_decl | ||
--% node.p_parent_basic_decl.p_parent_basic_decl | ||
end Pkg; | ||
|
||
package My_Pkg is new Pkg; | ||
--% pkg_spec = node.p_designated_generic_decl | ||
--% pkg_body = pkg_spec.p_body_part | ||
--% pkg_spec.p_parent_basic_decl | ||
--% pkg_body.p_parent_basic_decl | ||
--% foo_spec = pkg_spec.find(lal.SubpDecl) | ||
--% foo_spec.p_parent_basic_decl | ||
--% foo_body = pkg_body.find(lal.NullSubpDecl) | ||
--% foo_body.p_parent_basic_decl | ||
|
||
generic | ||
procedure Bar; | ||
|
||
procedure Bar is null; | ||
|
||
procedure My_Bar is new Bar; | ||
--% bar_decl = node.p_designated_generic_decl | ||
--% bar_decl.p_parent_basic_decl | ||
--% bar_body = bar_decl.p_body_part() | ||
--% bar_body.p_parent_basic_decl | ||
begin | ||
null; | ||
end Test; |
59 changes: 59 additions & 0 deletions
59
testsuite/tests/properties/parent_basic_decl_generic_body/test.out
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,59 @@ | ||
Working on node <SubpDecl ["Foo"] test.adb:4:7-4:21> | ||
==================================================== | ||
|
||
Eval 'node.p_parent_basic_decl' | ||
Result: <GenericPackageDecl ["Pkg"] test.adb:2:4-7:12> | ||
|
||
Eval 'node.p_parent_basic_decl.p_parent_basic_decl' | ||
Result: <SubpBody ["Test"] test.adb:1:1-37:10> | ||
|
||
Working on node <NullSubpDecl ["Foo"] test.adb:10:7-10:29> | ||
========================================================== | ||
|
||
Eval 'node.p_parent_basic_decl' | ||
Result: <PackageBody ["Pkg"] test.adb:9:4-13:12> | ||
|
||
Eval 'node.p_parent_basic_decl.p_parent_basic_decl' | ||
Result: <SubpBody ["Test"] test.adb:1:1-37:10> | ||
|
||
Working on node <GenericPackageInstantiation ["My_Pkg"] test.adb:15:4-15:30> | ||
============================================================================ | ||
|
||
Set 'pkg_spec' to 'node.p_designated_generic_decl' | ||
Result: <| GenericPackageDecl ["Pkg"] test.adb:2:4-7:12 [test.adb:15:4] |> | ||
|
||
Set 'pkg_body' to 'pkg_spec.p_body_part' | ||
Result: <| PackageBody ["Pkg"] test.adb:9:4-13:12 [test.adb:15:4] |> | ||
|
||
Eval 'pkg_spec.p_parent_basic_decl' | ||
Result: <GenericPackageInstantiation ["My_Pkg"] test.adb:15:4-15:30> | ||
|
||
Eval 'pkg_body.p_parent_basic_decl' | ||
Result: <GenericPackageInstantiation ["My_Pkg"] test.adb:15:4-15:30> | ||
|
||
Set 'foo_spec' to 'pkg_spec.find(lal.SubpDecl)' | ||
Result: <| SubpDecl ["Foo"] test.adb:4:7-4:21 [test.adb:15:4] |> | ||
|
||
Eval 'foo_spec.p_parent_basic_decl' | ||
Result: <| GenericPackageDecl ["Pkg"] test.adb:2:4-7:12 [test.adb:15:4] |> | ||
|
||
Set 'foo_body' to 'pkg_body.find(lal.NullSubpDecl)' | ||
Result: <| NullSubpDecl ["Foo"] test.adb:10:7-10:29 [test.adb:15:4] |> | ||
|
||
Eval 'foo_body.p_parent_basic_decl' | ||
Result: <| PackageBody ["Pkg"] test.adb:9:4-13:12 [test.adb:15:4] |> | ||
|
||
Working on node <GenericSubpInstantiation ["My_Bar"] test.adb:30:4-30:32> | ||
========================================================================= | ||
|
||
Set 'bar_decl' to 'node.p_designated_generic_decl' | ||
Result: <| GenericSubpDecl ["Bar"] test.adb:25:4-26:18 [test.adb:30:4] |> | ||
|
||
Eval 'bar_decl.p_parent_basic_decl' | ||
Result: <GenericSubpInstantiation ["My_Bar"] test.adb:30:4-30:32> | ||
|
||
Set 'bar_body' to 'bar_decl.p_body_part()' | ||
Result: <| NullSubpDecl ["Bar"] test.adb:28:4-28:26 [test.adb:30:4] |> | ||
|
||
Eval 'bar_body.p_parent_basic_decl' | ||
Result: <GenericSubpInstantiation ["My_Bar"] test.adb:30:4-30:32> |
2 changes: 2 additions & 0 deletions
2
testsuite/tests/properties/parent_basic_decl_generic_body/test.yaml
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,2 @@ | ||
driver: inline-playground | ||
input_sources: [test.adb] |