Skip to content

Commit a9555c5

Browse files
committed
Add disallowscalar macro.
1 parent a550d64 commit a9555c5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/indexing.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ macro allowscalar(ex)
1919
end
2020
end
2121

22+
macro disallowscalar(ex)
23+
quote
24+
local prev = _allowscalar[]
25+
_allowscalar[] = false
26+
local ret = $(esc(ex))
27+
_allowscalar[] = prev
28+
ret
29+
end
30+
end
31+
2232

2333
# basic indexing
2434

0 commit comments

Comments
 (0)