@@ -78,7 +78,8 @@ let emitFromLoc ~loc ~type_ emitter =
78
78
let posStart, posEnd = locToPositions loc in
79
79
emitter |> emitFromPos posStart posEnd ~type_
80
80
81
- let emitLongident ?(backwards = false ) ?(jsx = false ) ~pos ~lid ~debug emitter =
81
+ let emitLongident ?(backwards = false ) ?(jsx = false )
82
+ ?(moduleToken = Token. Module ) ~pos ~lid ~debug emitter =
82
83
let rec flatten acc lid =
83
84
match lid with
84
85
| Longident. Lident txt -> txt :: acc
@@ -94,14 +95,14 @@ let emitLongident ?(backwards = false) ?(jsx = false) ~pos ~lid ~debug emitter =
94
95
emitter
95
96
|> emitFromPos pos
96
97
(fst pos, snd pos + String. length id)
97
- ~type_: (if isUppercaseId id then Module else Token. Variable )
98
+ ~type_: (if isUppercaseId id then moduleToken else Variable )
98
99
| id :: segments when isUppercaseId id || isLowercaseId id ->
99
100
if debug then Printf. printf " Ldot: %s %s\n " id (posToString pos);
100
101
let length = String. length id in
101
102
emitter
102
103
|> emitFromPos pos
103
104
(fst pos, snd pos + length)
104
- ~type_: (if isUppercaseId id then Module else Token. Variable );
105
+ ~type_: (if isUppercaseId id then moduleToken else Variable );
105
106
loop (fst pos, snd pos + length + 1 ) segments
106
107
| _ -> ()
107
108
in
@@ -232,14 +233,16 @@ let parser ~debug ~emitter ~path =
232
233
match mt.pmty_desc with
233
234
| Pmty_ident {txt = lid ; loc} ->
234
235
emitter
235
- |> emitLongident ~pos: (Utils. tupleOfLexing loc.loc_start) ~lid ~debug ;
236
+ |> emitLongident ~module Token:Token. Type
237
+ ~pos: (Utils. tupleOfLexing loc.loc_start)
238
+ ~lid ~debug ;
236
239
Ast_mapper. default_mapper.module_type mapper mt
237
240
| _ -> Ast_mapper. default_mapper.module_type mapper mt
238
241
in
239
242
let module_type_declaration (mapper : Ast_mapper.mapper )
240
243
(mtd : Parsetree.module_type_declaration ) =
241
244
emitter
242
- |> emitLongident
245
+ |> emitLongident ~module Token: Token. Type
243
246
~pos: (Utils. tupleOfLexing mtd.pmtd_name.loc.loc_start)
244
247
~lid: (Longident. Lident mtd.pmtd_name.txt) ~debug ;
245
248
Ast_mapper. default_mapper.module_type_declaration mapper mtd
0 commit comments