Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
2c7a9526
Commit
2c7a9526
authored
Feb 18, 2013
by
yoogx
Browse files
* Correct implementation of naming rules for rename declarations
parent
9836f4d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/model/ocarina-analyzer-aadl-names.adb
View file @
2c7a9526
...
...
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with
Ocarina
.
Analyzer
.
Messages
;
with
Ocarina
.
Analyzer
.
AADL
.
Finder
;
with
Ocarina
.
Analyzer
.
AADL
.
Naming_Rules
;
with
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
;
...
...
@@ -40,6 +41,7 @@ with Ocarina.ME_AADL.AADL_Tree.Entities;
package
body
Ocarina
.
Analyzer
.
AADL
.
Names
is
use
Ocarina
.
Analyzer
.
AADL
.
Finder
;
use
Ocarina
.
Analyzer
.
Messages
;
use
Ocarina
.
Analyzer
.
AADL
.
Naming_Rules
;
...
...
@@ -89,8 +91,7 @@ package body Ocarina.Analyzer.AADL.Names is
(
Name_Visibility_Node
:
Node_Id
;
Package_Node
:
Node_Id
)
return
Boolean
;
-- Check if package or property in with sublcause
-- exists in global scope
-- Check if package or property in with sublcause exists in global scope
------------------------------
-- Check_Import_Declaration --
...
...
@@ -127,12 +128,12 @@ package body Ocarina.Analyzer.AADL.Names is
if
Kind
(
Import_Node
)
=
K_Package_Name
then
Identifier
:=
Build_Package_Identifier
(
Import_Node
);
In_Node
:=
Node_Explicitly_In_Scope
(
Identifier
,
Current_Scope
);
else
In_Node
:=
Node_Explicitly_In_Scope
(
Import_Node
,
Current_Scope
);
In_Node
:=
Node_Explicitly_In_Scope
(
Identifier
,
Current_Scope
);
else
In_Node
:=
Node_Explicitly_In_Scope
(
Import_Node
,
Current_Scope
);
end
if
;
if
In_Node
=
No_Node
then
...
...
@@ -185,10 +186,21 @@ package body Ocarina.Analyzer.AADL.Names is
Loc
=>
Loc
(
List_Node
));
else
In_Node
:=
Node_Explicitly_In_Scope
(
Alias
,
Current_Scope
);
In_Node
:=
Node_In_Scope
(
Alias
,
Current_Scope
);
if
No
(
In_Node
)
and
then
Present
(
Corresponding_Entity
(
Alias
))
then
In_Node
:=
Find_Component_Classifier
(
Root
=>
1
,
Package_Identifier
=>
Namespace_Identifier
(
Corresponding_Entity
(
Alias
)),
Component_Identifier
=>
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
.
Identifier
(
Corresponding_Entity
(
Alias
)));
end
if
;
if
In_Node
=
No
_Node
then
if
No
(
In
_Node
)
then
Success
:=
False
;
Display_Analyzer_Error
(
Alias
,
"is not visible"
);
end
if
;
...
...
src/core/model/ocarina-analyzer-aadl-naming_rules.adb
View file @
2c7a9526
...
...
@@ -440,43 +440,55 @@ package body Ocarina.Analyzer.AADL.Naming_Rules is
(
Declarations
(
Entity
));
while
Present
(
List_Node
)
loop
if
Kind
(
List_Node
)
=
K_Name_Visibility_Declaration
then
List_Node_2
:=
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
.
First_Node
(
List_Items
(
List_Node
));
while
Present
(
List_Node_2
)
loop
if
Kind
(
List_Node_2
)
=
K_Alias_Declaration
then
if
Is_All
(
List_Node_2
)
then
List_Node_3
:=
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
.
First_Node
(
Declarations
(
Parent
(
Parent
(
List_Node_2
))));
while
Present
(
List_Node_3
)
loop
if
Name
(
Identifier
(
List_Node_3
))
=
Name
(
Build_Package_Identifier
(
Package_Name
(
List_Node_2
)))
then
Test_Node
:=
Node_In_Scope
(
Name_Of_Identifier
,
Entity_Scope
(
List_Node_3
));
if
Present
(
Test_Node
)
then
First_Node
:=
Test_Node
;
case
Kind
(
List_Node
)
is
when
K_Component_Type
|
K_Component_Implementation
=>
if
Name
(
Identifier
(
List_Node
))
=
Name_Of_Identifier
then
First_Node
:=
List_Node
;
end
if
;
when
K_Name_Visibility_Declaration
=>
List_Node_2
:=
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
.
First_Node
(
List_Items
(
List_Node
));
while
Present
(
List_Node_2
)
loop
if
Kind
(
List_Node_2
)
=
K_Alias_Declaration
then
if
Is_All
(
List_Node_2
)
then
List_Node_3
:=
Ocarina
.
ME_AADL
.
AADL_Tree
.
Nodes
.
First_Node
(
Declarations
(
Parent
(
Parent
(
List_Node_2
))));
while
Present
(
List_Node_3
)
loop
if
Name
(
Identifier
(
List_Node_3
))
=
Name
(
Build_Package_Identifier
(
Package_Name
(
List_Node_2
)))
then
Test_Node
:=
Node_In_Scope
(
Name_Of_Identifier
,
Entity_Scope
(
List_Node_3
));
if
Present
(
Test_Node
)
then
First_Node
:=
Test_Node
;
end
if
;
end
if
;
end
if
;
List_Node_3
:=
Next_Node
(
List_Node_3
)
;
end
loop
;
List_Node_3
:=
Next_Node
(
List_Node_3
);
end
loop
;
end
if
;
end
if
;
end
if
;
List_Node_2
:=
Next_Node
(
List_Node_2
);
end
loop
;
end
if
;
List_Node_2
:=
Next_Node
(
List_Node_2
);
end
loop
;
when
others
=>
null
;
end
case
;
List_Node
:=
Next_Node
(
List_Node
);
end
loop
;
end
;
...
...
@@ -826,8 +838,7 @@ package body Ocarina.Analyzer.AADL.Naming_Rules is
-- Internal_Node_In_Scope --
----------------------------
function
Internal_Node_In_Scope
(
N
:
Name_Id
;
S
:
Node_Id
)
return
Node_Id
is
function
Internal_Node_In_Scope
(
N
:
Name_Id
;
S
:
Node_Id
)
return
Node_Id
is
I_Name
:
constant
Name_Id
:=
Internal_Scope_Name
(
N
,
S
);
begin
return
Node_Id
(
Get_Name_Table_Info
(
I_Name
));
...
...
@@ -857,8 +868,7 @@ package body Ocarina.Analyzer.AADL.Naming_Rules is
-- Internal_Scope_Name --
-------------------------
function
Internal_Scope_Name
(
N
:
Name_Id
;
S
:
Node_Id
)
return
Name_Id
is
function
Internal_Scope_Name
(
N
:
Name_Id
;
S
:
Node_Id
)
return
Name_Id
is
begin
Get_Name_String
(
N
);
Add_Str_To_Name_Buffer
(
"%in_scope%"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment