Skip to content

Commit

Permalink
Merge pull request #40 from JuliaDebug/getproperty
Browse files Browse the repository at this point in the history
fix struct definitions with getproperty in them
  • Loading branch information
timholy authored Feb 15, 2019
2 parents 0c9a08a + 8e99f6b commit 64cc800
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/interpret.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ function lookup_or_eval(stack, frame, @nospecialize(node), pc)
return Core.apply_type(ex.args[2:end]...)
elseif f === Core.typeof
return Core.typeof(ex.args[2])
elseif f === Base.getproperty
return Base.getproperty(ex.args[2], ex.args[3])
else
error("unknown call f ", f)
end
Expand Down
1 change: 1 addition & 0 deletions test/toplevel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ module Toplevel end
@test @interpret(Toplevel.paramtype(Vector)) == Toplevel.NoParam
@test @interpret(Toplevel.Inner.g()) == 5
@test @interpret(Toplevel.Inner.InnerInner.g()) == 6
@test @interpret(isdefined(Toplevel, :Beat))

# Check that nested expressions are handled appropriately (module-in-block, internal `using`)
ex = quote
Expand Down
8 changes: 8 additions & 0 deletions test/toplevel_script.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,11 @@ module InnerInner
g() = 6
end
end

module DatesMod
abstract type Period end
end

struct Beat <: DatesMod.Period
value::Int64
end

0 comments on commit 64cc800

Please sign in to comment.