diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-04-21 15:26:48 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-04-21 15:26:48 +0800 |
| commit | 3af701f4f06d09e45eb65ff4eb9a591bc7ca4a3a (patch) | |
| tree | ab31d51f94baa8f79907bd8c4c04ed06959ec2d2 /src/MoonP/stacktraceplus.h | |
| parent | e513c1e9da47bc03a8d5296d69c019639469c42d (diff) | |
| download | yuescript-3af701f4f06d09e45eb65ff4eb9a591bc7ca4a3a.tar.gz yuescript-3af701f4f06d09e45eb65ff4eb9a591bc7ca4a3a.tar.bz2 yuescript-3af701f4f06d09e45eb65ff4eb9a591bc7ca4a3a.zip | |
allow implicit return block macro, fix compiled Lua codes searching issue.
Diffstat (limited to 'src/MoonP/stacktraceplus.h')
| -rw-r--r-- | src/MoonP/stacktraceplus.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/MoonP/stacktraceplus.h b/src/MoonP/stacktraceplus.h index ea53885..3d32322 100644 --- a/src/MoonP/stacktraceplus.h +++ b/src/MoonP/stacktraceplus.h | |||
| @@ -324,8 +324,17 @@ local function getMoonLineNumber(fname, line) | |||
| 324 | source = moonCompiled["@="..fname] | 324 | source = moonCompiled["@="..fname] |
| 325 | end | 325 | end |
| 326 | if not source then | 326 | if not source then |
| 327 | if moonp.file_exist(fname) then | 327 | local name_path = fname:gsub("%.", moonp.dirsep) |
| 328 | local codes = moonp.read_file(fname) | 328 | local file_exist, file_path |
| 329 | for path in package.path:gmatch("[^;]+") do | ||
| 330 | file_path = path:gsub("?", name_path) | ||
| 331 | file_exist = moonp.file_exist(file_path) | ||
| 332 | if file_exist then | ||
| 333 | break | ||
| 334 | end | ||
| 335 | end | ||
| 336 | if file_exist then | ||
| 337 | local codes = moonp.read_file(file_path) | ||
| 329 | local moonFile = codes:match("^%s*--%s*%[moon%]:%s*([^\n]*)") | 338 | local moonFile = codes:match("^%s*--%s*%[moon%]:%s*([^\n]*)") |
| 330 | if moonFile then | 339 | if moonFile then |
| 331 | fname = moonFile:gsub("^%s*(.-)%s*$", "%1") | 340 | fname = moonFile:gsub("^%s*(.-)%s*$", "%1") |
