Skip to content
GitLab
Menu
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
0b9f6610
Commit
0b9f6610
authored
Apr 05, 2013
by
John van Groningen
Browse files
update derive class for deriving generic functions in class context (from iTask branch)
parent
fe662306
Changes
3
Show whitespace changes
Inline
Side-by-side
frontend/checktypes.dcl
View file @
0b9f6610
...
...
@@ -25,4 +25,7 @@ checkDynamicTypes :: !Index ![ExprInfoPtr] !(Optional SymbolType)
createClassDictionaries
::
!
Bool
!
Index
!
Index
!
Index
!
Index
!*{#
CheckedTypeDef
}
!*{#
SelectorDef
}
!*{#
ConsDef
}
!*{#
ClassDef
}
!*{#
DclModule
}
!*
TypeVarHeap
!*
VarHeap
!*
SymbolTable
->
(![
CheckedTypeDef
],![
SelectorDef
],![
ConsDef
],!
DictionaryInfo
,!*{#
CheckedTypeDef
},!*{#
SelectorDef
},!*{#
ConsDef
},!*{#
ClassDef
},!*{#
DclModule
},!*
TypeVarHeap
,!*
VarHeap
,!*
SymbolTable
)
createMoreClassDictionaries
::
!
Int
!
Index
!
Index
!
Index
!
Index
!*{#
CheckedTypeDef
}
!*{#
SelectorDef
}
!*{#
ConsDef
}
!*{#
ClassDef
}
!*{#
DclModule
}
!*
TypeVarHeap
!*
VarHeap
!*
SymbolTable
->
(![
CheckedTypeDef
],![
SelectorDef
],![
ConsDef
],!*{#
CheckedTypeDef
},!*{#
SelectorDef
},!*{#
ConsDef
},!*{#
ClassDef
},!*{#
DclModule
},!*
TypeVarHeap
,!*
VarHeap
,!*
SymbolTable
)
removeVariablesFromSymbolTable
::
!
Int
![
TypeVar
]
!*
SymbolTable
->
*
SymbolTable
frontend/checktypes.icl
View file @
0b9f6610
...
...
@@ -1660,6 +1660,18 @@ where
=
create_exported_icl_class_dictionaries
mod_index
(
inc
dcl_class_index
)
dcl_class_defs
type_defs
class_defs
modules
rev_dictionary_list
indexes
type_var_heap
var_heap
symbol_table
=
(
type_defs
,
class_defs
,
modules
,
rev_dictionary_list
,
indexes
,
type_var_heap
,
var_heap
,
symbol_table
)
createMoreClassDictionaries
::
!
Int
!
Index
!
Index
!
Index
!
Index
!*{#
CheckedTypeDef
}
!*{#
SelectorDef
}
!*{#
ConsDef
}
!*{#
ClassDef
}
!*{#
DclModule
}
!*
TypeVarHeap
!*
VarHeap
!*
SymbolTable
->
(![
CheckedTypeDef
],![
SelectorDef
],![
ConsDef
],!*{#
CheckedTypeDef
},!*{#
SelectorDef
},!*{#
ConsDef
},!*{#
ClassDef
},!*{#
DclModule
},!*
TypeVarHeap
,!*
VarHeap
,!*
SymbolTable
)
createMoreClassDictionaries
first_new_class_index
mod_index
first_type_index
first_selector_index
first_cons_index
type_defs
selector_defs
cons_defs
class_defs
modules
type_var_heap
var_heap
symbol_table
#
(
class_defs
,
last_type_index_plus1
)
=
number_icl_class_dictionaries
first_new_class_index
class_defs
first_type_index
#
indexes
=
{
index_type
=
first_type_index
,
index_cons
=
first_cons_index
,
index_selector
=
first_selector_index
}
#
(
class_defs
,
modules
,
rev_dictionary_list
,
indexes
,
type_var_heap
,
var_heap
,
symbol_table
)
=
create_icl_class_dictionaries
mod_index
first_new_class_index
last_type_index_plus1
first_type_index
class_defs
modules
[]
indexes
type_var_heap
var_heap
symbol_table
#
(
size_type_defs
,
type_defs
)
=
usize
type_defs
(
type_def_list
,
sel_def_list
,
cons_def_list
,
selector_defs
,
cons_defs
,
symbol_table
)
=
collect_type_defs_in_icl_module
size_type_defs
rev_dictionary_list
selector_defs
cons_defs
symbol_table
=
(
type_def_list
,
sel_def_list
,
cons_def_list
,
type_defs
,
selector_defs
,
cons_defs
,
class_defs
,
modules
,
type_var_heap
,
var_heap
,
symbol_table
)
number_icl_class_dictionaries
class_index
class_defs
index_type
|
class_index
<
size
class_defs
|
class_defs
.[
class_index
].
class_dictionary
.
ds_index
==
NoIndex
...
...
frontend/generics1.icl
View file @
0b9f6610
...
...
@@ -6,7 +6,7 @@ implementation module generics1
import
StdEnv
,
compare_types
import
check
from
checktypes
import
createClassDictionaries
from
checktypes
import
create
More
ClassDictionaries
from
transform
import
::
Group
import
genericsupport
...
...
@@ -1259,13 +1259,15 @@ buildClasses gs=:{gs_main_module}
#!
((
classes
,
members
,
new_num_classes
,
new_num_members
),
gs
)
=
build_modules
0
([],
[],
num_classes
,
num_members
)
gs
#
first_new_class_index
=
size
com_class_defs
// obtain common definitions again because com_gencase_defs are updated
#!
(
common_defs
,
gs
)
=
gs
!
gs_modules
.[
gs_main_module
]
#
common_defs
=
{
common_defs
&
com_class_defs
=
arrayPlusRevList
com_class_defs
classes
,
com_member_defs
=
arrayPlusRevList
com_member_defs
members
}
#!
(
common_defs
,
gs
)
=
build_class_dictionaries
common_defs
gs
=
build_class_dictionaries
first_new_class_index
common_defs
gs
=
{
gs
&
gs_modules
.[
gs_main_module
]
=
common_defs
}
where
...
...
@@ -1409,17 +1411,17 @@ where
#!
gen_classes
=
addGenericClassInfo
class_info
gen_classes
=
writePtr
gen_info_ptr
{
gen_info
&
gen_classes
=
gen_classes
}
gs_genh
build_class_dictionaries
::
!
CommonDefs
!*
GenericState
->
(!
CommonDefs
,
!*
GenericState
)
build_class_dictionaries
common_defs
build_class_dictionaries
::
!
Int
!
CommonDefs
!*
GenericState
->
(!
CommonDefs
,
!*
GenericState
)
build_class_dictionaries
first_new_class_index
common_defs
gs
=:{
gs_varh
,
gs_tvarh
,
gs_main_module
,
gs_symtab
,
gs_dcl_modules
}
#!
class_defs
=
{
x
\\
x
<-:
common_defs
.
com_class_defs
}
// make unique copy
#
type_defs
=
{
x
\\
x
<-:
common_defs
.
com_type_defs
}
// make unique copy
#
cons_defs
=
{
x
\\
x
<-:
common_defs
.
com_cons_defs
}
// make unique copy
#
selector_defs
=
{
x
\\
x
<-:
common_defs
.
com_selector_defs
}
// make unique copy
#
(
size_type_defs
,
type_defs
)
=
usize
type_defs
#!
(
new_type_defs
,
new_selector_defs
,
new_cons_defs
,
_,
type_defs
,
selector_defs
,
cons_defs
,
class_defs
,
gs_dcl_modules
,
gs_tvarh
,
gs_varh
,
gs_symtab
)
=
createClassDictionaries
False
#!
(
new_type_defs
,
new_selector_defs
,
new_cons_defs
,
type_defs
,
selector_defs
,
cons_defs
,
class_defs
,
gs_dcl_modules
,
gs_tvarh
,
gs_varh
,
gs_symtab
)
=
create
More
ClassDictionaries
first_new_class_index
gs_main_module
size_type_defs
(
size
common_defs
.
com_selector_defs
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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