File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -94,21 +94,25 @@ function _make_frame(mod, arg)
94
94
end
95
95
end
96
96
97
+ _check_is_call (arg) = ! (arg isa Expr && arg. head == :call ) && throw (ArgumentError (" @enter and @run should be applied to a function call" ))
98
+
97
99
macro make_frame (arg)
98
100
_make_frame (__module__, arg)
99
101
end
100
102
101
103
macro enter (arg)
104
+ _check_is_call (arg)
102
105
quote
103
- let frame = $ (_make_frame (__module__,arg))
106
+ let frame = $ (_make_frame (__module__, arg))
104
107
RunDebugger (frame)
105
108
end
106
109
end
107
110
end
108
111
109
112
macro run (arg)
113
+ _check_is_call (arg)
110
114
quote
111
- let frame = $ (_make_frame (__module__,arg))
115
+ let frame = $ (_make_frame (__module__, arg))
112
116
RunDebugger (frame; initial_continue= true )
113
117
end
114
118
end
Original file line number Diff line number Diff line change @@ -86,3 +86,8 @@ import InteractiveUtils
86
86
@test JuliaInterpreter. Variable (@__FILE__ , :file , false ) in locals
87
87
@test JuliaInterpreter. Variable (LINE, :line , false ) in locals
88
88
end
89
+
90
+ # These are LoadError because the error happens at macro expansion
91
+ @test_throws LoadError @macroexpand @enter " foo"
92
+ @test_throws LoadError @macroexpand @enter 1
93
+ @test_throws LoadError @macroexpand @run [1 ,2 ]
You can’t perform that action at this time.
0 commit comments