Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
14269639
Commit
14269639
authored
Oct 23, 2017
by
John van Groningen
Browse files
rename function getBelongingSymbolsFromID to getBelongingSymbolsFromImportDeclaration,
add some function types
parent
a59ac7b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/explicitimports.icl
View file @
14269639
...
...
@@ -119,11 +119,11 @@ imp_decl_to_string (ID_Record {ii_ident={id_name}} _) = "ID_Record "+++toString
imp_decl_to_string (ID_Instance {ii_ident={id_name}} _ _ ) = "ID_Instance "+++toString id_name
*/
getBelongingSymbolsFromI
D
::
!
ImportDeclaration
->
Optional
[
Ident
]
getBelongingSymbolsFromI
D
(
ID_Class
_
x
)
=
x
getBelongingSymbolsFromI
D
(
ID_Type
_
x
)
=
x
getBelongingSymbolsFromI
D
(
ID_Record
_
x
)
=
x
getBelongingSymbolsFromI
D
_
=
No
getBelongingSymbolsFromI
mportDeclaration
::
!
ImportDeclaration
->
Optional
[
Ident
]
getBelongingSymbolsFromI
mportDeclaration
(
ID_Class
_
x
)
=
x
getBelongingSymbolsFromI
mportDeclaration
(
ID_Type
_
x
)
=
x
getBelongingSymbolsFromI
mportDeclaration
(
ID_Record
_
x
)
=
x
getBelongingSymbolsFromI
mportDeclaration
_
=
No
solveExplicitImports
::
!(
IntKeyHashtable
[
ExplicitImport
])
!{#
Int
}
!
Index
!*(!
v
:{#
DclModule
},!*{#
Int
},!{!*
ExplImpInfo
},!*
CheckState
)
...
...
@@ -196,7 +196,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
solve_belonging
position
expl_imp_indices_ikh
modules_in_component_set
path
(
decl
,
{
ini_symbol_nr
,
ini_imp_decl
},
imported_mod
)
(
decls_accu
,
dcl_modules
,
visited_modules
,
expl_imp_info
,
cs
=:{
cs_error
,
cs_symbol_table
})
#
(
Yes
belongs
)
=
getBelongingSymbolsFromI
D
ini_imp_decl
#
(
Yes
belongs
)
=
getBelongingSymbolsFromI
mportDeclaration
ini_imp_decl
(
all_belongs
,
dcl_modules
)
=
get_all_belongs
decl
dcl_modules
(
ExplImpInfo
eii_ident
eii_declaring_modules
,
expl_imp_info
)
=
expl_imp_info
![
ini_symbol_nr
]
(
need_all
,
belongs_set
,
cs_error
,
cs_symbol_table
)
...
...
@@ -251,6 +251,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
=
abort
"sanity check failed in module explicitimports"
=
eii_declaring_modules
get_nth_belonging_decl
::
Position
Int
Declaration
v
:{#
DclModule
}
->
(
Declaration
,
v
:{#
DclModule
});
get_nth_belonging_decl
position
belong_nr
decl
=:(
Declaration
{
decl_kind
})
dcl_modules
#
(
STE_Imported
_
def_mod_index
)
=
decl_kind
(
belongin_symbols
,
dcl_modules
)
=
getBelongingSymbols
decl
dcl_modules
...
...
@@ -273,6 +274,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
decl_kind
=
STE_Imported
STE_Member
def_mod_index
,
decl_index
=
ds_index
},
dcl_modules
)
get_all_belongs
::
Declaration
v
:{#
DclModule
}
->
(![
Ident
],!
v
:{#
DclModule
})
get_all_belongs
decl
=:(
Declaration
{
decl_kind
,
decl_index
})
dcl_modules
#
(
belonging_symbols
,
dcl_modules
)
=
getBelongingSymbols
decl
dcl_modules
=
case
belonging_symbols
of
...
...
@@ -347,12 +349,12 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
is_not_STE_member
STE_Member
=
False
is_not_STE_member
_
=
True
update_declaring_modules
::
Declaration
!
[
Int
]
!
*
DeclaringModulesSet
->
*
DeclaringModulesSet
update_declaring_modules
::
Declaration
[
Int
]
*
DeclaringModulesSet
->
*
DeclaringModulesSet
update_declaring_modules
di_decl
path
eii_declaring_modules
=
foldSt
(\
mod_index
eei_dm
->
ikhInsert`
False
mod_index
{
di_decl
=
di_decl
,
di_belonging
=
EndNumbers
}
eei_dm
)
path
eii_declaring_modules
update_belonging_accu
di_decl
ini
imported_mod
belonging_accu
=
case
getBelongingSymbolsFromI
D
ini
.
ini_imp_decl
of
=
case
getBelongingSymbolsFromI
mportDeclaration
ini
.
ini_imp_decl
of
No
->
belonging_accu
Yes
_
->
[(
di_decl
,
ini
,
imported_mod
):
belonging_accu
]
...
...
@@ -416,7 +418,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
=
(
False
,
No
)
search_imported_symbol
imported_symbol
[{
ini_symbol_nr
,
ini_imp_decl
}:
t
]
|
imported_symbol
==
ini_symbol_nr
=
(
True
,
getBelongingSymbolsFromI
D
ini_imp_decl
)
=
(
True
,
getBelongingSymbolsFromI
mportDeclaration
ini_imp_decl
)
=
search_imported_symbol
imported_symbol
t
belong_ident_found
::
!
Ident
!(
Optional
[
Ident
])
->
Bool
...
...
@@ -451,6 +453,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
report_not_exported_symbol_errors
[]
position
expl_imp_info
imported_mod
dcl_modules
cs_error
=
(
expl_imp_info
,
dcl_modules
,
cs_error
)
impDeclToNameSpaceString
::
!
ImportDeclaration
->
{#
Char
}
impDeclToNameSpaceString
(
ID_Function
_)
=
"function/macro"
impDeclToNameSpaceString
(
ID_Class
_
_)
=
"class"
impDeclToNameSpaceString
(
ID_Type
_
_)
=
"type"
...
...
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