@@ -137,8 +137,18 @@ return {
137137
138138 -- strip module from the name
139139 fn_xform = function (fun )
140- normalise_module (fun )
141- fun .name = fun .name :gsub (" ^" .. fun .module .. " %." , " " , 1 )
140+ if (fun .module ) then
141+ normalise_module (fun )
142+
143+ -- remove the API prefix from the left aligned function name
144+ -- this will cascade into fn_helptag_fmt, which will apply the module prefix anyway
145+ local name , replaced = fun .name :gsub (" ^" .. fun .module .. " %." , " " , 1 )
146+ if (replaced ~= 2 ) then
147+ error (string.format (" \n\n fun.name='%s' does not start with module\n fun=%s" , fun .name , vim .inspect (fun )))
148+ end
149+
150+ fun .name = name
151+ end
142152 end ,
143153 },
144154 -- Classes
@@ -150,14 +160,15 @@ return {
150160 helptag_fmt = function (name ) return src_by_name (name , srcs_class ).helptag end ,
151161
152162 fn_xform = function (fun )
153- -- strip module from name and record the module for the method
154- normalise_module (fun )
163+ if ( fun . module ) then
164+ normalise_module (fun )
155165
156- -- strip the class file from the module
157- fun .module = fun .module :gsub (" %.[^%.]*$" , " " , 1 )
166+ -- strip the class file from the module
167+ fun .module = fun .module :gsub (" %.[^%.]*$" , " " , 1 )
158168
159- -- strip module from name and record the module for the method
160- modules_by_method [fun .classvar .. " :" .. fun .name ] = fun .module
169+ -- record the module for the method
170+ modules_by_method [fun .classvar .. " :" .. fun .name ] = fun .module
171+ end
161172 end ,
162173
163174 -- fn_helptag_fmt_common derived
0 commit comments