overloading.dcl 1.72 KB
Newer Older
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
1
2
3
definition module overloading

import StdEnv
Sjaak Smetsers's avatar
Sjaak Smetsers committed
4
import syntax, check, typesupport
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

::	InstanceTree = IT_Node !(Global Index) !InstanceTree !InstanceTree | IT_Empty 

::	ClassInstanceInfo :== {# {! .InstanceTree}}

::	ArrayInstance =
	{	ai_record		:: !TypeSymbIdent
	,	ai_members		:: !{# DefinedSymbol}
	}

::	GlobalTCInstance =
	{	gtci_type		:: !GlobalTCType
	,	gtci_index		:: !Index
	}

::	SpecialInstances =
21
22
23
24
	{	si_next_array_member_index			:: !Index
	,	si_array_instances					:: ![ArrayInstance]
	,	si_list_instances					:: ![ArrayInstance]
	,	si_tail_strict_list_instances		:: ![ArrayInstance]
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
25
26
27
28
29
30
	}
	
::	OverloadingState =
	{	os_type_heaps			:: !.TypeHeaps
	,	os_var_heap				:: !.VarHeap
	,	os_symbol_heap			:: !.ExpressionHeap
31
	,	os_generic_heap			:: !.GenericHeap
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
32
33
34
35
36
37
	,	os_predef_symbols		:: !.PredefinedSymbols
	,	os_special_instances	:: !.SpecialInstances
	,	os_error				:: !.ErrorAdmin				
	}

::	LocalTypePatternVariable
Sjaak Smetsers's avatar
Sjaak Smetsers committed
38
::	DictionaryTypes :== [(Index, [ExprInfoPtr])]
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
39

40
tryToSolveOverloading :: ![(Optional [TypeContext], [ExprInfoPtr], IdentPos, Index)] !Int !{# CommonDefs } !ClassInstanceInfo !*Coercions !*OverloadingState !{# DclModule}
Sjaak Smetsers's avatar
Sjaak Smetsers committed
41
	-> (![TypeContext], !*Coercions, ![LocalTypePatternVariable], DictionaryTypes, !*OverloadingState)
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
42
43

::	TypeCodeInfo =
44
	{	tci_type_var_heap					:: !.TypeVarHeap
45
	,	tci_attr_var_heap					:: !.AttrVarHeap
46
	,	tci_dcl_modules						:: !{# DclModule}
47
	,	tci_common_defs						:: !{# CommonDefs }
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
48
49
	}

50
removeOverloadedFunctions :: ![Index] ![LocalTypePatternVariable] !Int !*{#FunDef} !*{! FunctionType} !*ExpressionHeap
51
52
	!*TypeCodeInfo !*VarHeap !*ErrorAdmin !*{#PredefinedSymbol} //!*{#PredefinedSymbol}
		-> (!*{#FunDef}, !*{! FunctionType}, !*ExpressionHeap, !*TypeCodeInfo, !*VarHeap, !*ErrorAdmin, !*{#PredefinedSymbol})