@@ -70,77 +70,3 @@ let get_exp (key : Lam_compile_env.key) : J.expression =
70
70
71
71
72
72
73
- (* TODO: how nested module call would behave,
74
- In the future, we should keep in track of if
75
- it is fully applied from [Lapply]
76
- Seems that the module dependency is tricky..
77
- should we depend on [Pervasives] or not?
78
-
79
- we can not do this correctly for the return value,
80
- however we can inline the definition in Pervasives
81
- TODO:
82
- [Pervasives.print_endline]
83
- [Pervasives.prerr_endline]
84
- *)
85
-
86
- let get_exp_with_args (id : Ident.t ) (pos : int ) env (args : J.expression list ) : J.expression =
87
-
88
- Lam_compile_env. find_and_add_if_not_exist (id,pos) env ~not_found: (fun id ->
89
- (* * This can not happen since this id should be already consulted by type checker
90
- Worst case
91
- {[
92
- E.index m (pos + 1)
93
- ]}
94
- shift by one (due to module encoding)
95
- *)
96
- E. str ~pure: false (Printf. sprintf " Err %s %d %d"
97
- id.name
98
- id.flags
99
- pos
100
- ))
101
-
102
- ~found: (fun {id; name;arity; _} ->
103
- match id, name, args with
104
- | {name = "Pervasives" ; _} , "^" , [ e0 ; e1] ->
105
- E. string_append e0 e1
106
- | {name = " Pervasives" ; _}, " string_of_int" , [e]
107
- -> E. int_to_string e
108
- | {name = "Pervasives" ; _} , "print_endline" , ([ _ ] as args ) ->
109
- E. seq (E. dump Log args) (E. unit () )
110
- | {name = "Pervasives" ; _} , "prerr_endline" , ([ _ ] as args ) ->
111
- E. seq (E. dump Error args) (E. unit () )
112
- | {name = "CamlinternalMod" ; _} , x , args ->
113
- E. runtime_call Js_config. internalMod x args
114
-
115
- | _ ->
116
-
117
-
118
- let rec aux (acc : J.expression )
119
- (arity : Lam_stats.function_arities ) args (len : int ) =
120
- match arity, len with
121
- | _ , 0 ->
122
- acc (* * All arguments consumed so far *)
123
- | Determin (a , (x ,_ ) :: rest , b ), len ->
124
- let x =
125
- if x = 0
126
- then 1
127
- else x in (* Relax when x = 0 *)
128
- if len > = x
129
- then
130
- let first_part, continue = (Ext_list. take x args) in
131
- aux
132
- (E. call ~info: {arity= Full } acc first_part)
133
- (Determin (a, rest, b))
134
- continue (len - x)
135
- else acc
136
- (* alpha conversion now? --
137
- Since we did an alpha conversion before so it is not here
138
- *)
139
- | Determin (a , [] , b ), _ ->
140
- (* can not happen, unless it's an exception ? *)
141
- E. call acc args
142
- | NA , _ ->
143
- E. call acc args
144
- in
145
- aux (E. ml_var_dot id name) arity args (List. length args )
146
- )
0 commit comments