Skip to content

Commit

Permalink
allow import() to take a class name as a string (for weird package na…
Browse files Browse the repository at this point in the history
…mes, etc)
  • Loading branch information
jbalint committed Jul 8, 2016
1 parent b047007 commit 3c02b86
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions debuglib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ function bp(method, line_num)
error("Invalid method, must be method declaration of form \"pkg/Class.name()V\" or a jmethod_id object")
end

--b.location = line_num -- TEMP to use raw offset --method_location_for_line_num(b.method_id, b.line_num)
b.location = method_location_for_line_num(b.method_id, b.line_num)
if b.location < 0 then
b.location = 0
Expand Down Expand Up @@ -626,6 +627,9 @@ function import(class)
if type(class) == "table" and class.classname == "jclass" then
_ENV[class.getSimpleName().toString()] = class
return class
elseif type(class) == "string" then
cl = jclass.find(class:gsub("%.", "/"))
return import(cl)
else
error("Not a valid class")
end
Expand Down

0 comments on commit 3c02b86

Please sign in to comment.