@@ -178,6 +178,23 @@ local function verifyBreakpointByLineInfo(src, breakpoints)
178178 end
179179end
180180
181+ -- 降级模式:无 lineinfo 时跳过行号校正,直接标记断点为 verified
182+ local function verifyBreakpointWithoutLineInfo (src , breakpoints )
183+ for _ , bp in ipairs (breakpoints ) do
184+ if bp .unverified ~= nil then
185+ goto continue
186+ end
187+ bp .source = src
188+ bp .verified = true
189+ ev .emit (' breakpoint' , ' changed' , {
190+ id = bp .id ,
191+ line = bp .line ,
192+ verified = true ,
193+ })
194+ :: continue::
195+ end
196+ end
197+
181198function m .find (src , currentline )
182199 local currentBP = currentactive [bpKey (src )]
183200 if not currentBP then
@@ -239,6 +256,7 @@ function m.set_bp(clientsrc, breakpoints, content)
239256 if srcarray then
240257 local ok = false
241258 for _ , src in ipairs (srcarray ) do
259+ src .content = content
242260 if calcLineInfo (src , content ) then
243261 ok = true
244262 end
@@ -248,6 +266,12 @@ function m.set_bp(clientsrc, breakpoints, content)
248266 verifyBreakpointByLineInfo (src , breakpoints )
249267 updateBreakpoint (src , breakpoints )
250268 end
269+ elseif content == false then
270+ -- 降级路径:前端已上报但 sourceContent 为空
271+ for _ , src in ipairs (srcarray ) do
272+ verifyBreakpointWithoutLineInfo (src , breakpoints )
273+ updateBreakpoint (src , breakpoints )
274+ end
251275 else
252276 cantVerifyBreakpoints (breakpoints )
253277 end
@@ -298,10 +322,17 @@ function m.newproto(proto, src, key)
298322 local bpkey = bpClientKey (src )
299323 local wv = waitverify [bpkey ]
300324 if wv then
325+ src .content = wv .content
301326 if not src .content then
302327 waitverify [bpkey ] = nil
303328 end
304329 if not calcLineInfo (src , wv .content ) then
330+ if src .content == false then
331+ -- 降级路径:前端已上报但 sourceContent 为空
332+ verifyBreakpointWithoutLineInfo (src , wv .breakpoints )
333+ updateBreakpoint (src , wv .breakpoints )
334+ return
335+ end
305336 cantVerifyBreakpoints (wv .breakpoints )
306337 return
307338 end
0 commit comments