@@ -178,18 +178,6 @@ assert_no_function_scope(_Meta, _Kind, #elixir_scope{function=nil}) -> [];
178
178
assert_no_function_scope (Meta , Kind , S ) ->
179
179
syntax_error (Meta , S # elixir_scope .file , " cannot invoke ~ts inside a function" , [Kind ]).
180
180
181
- assert_no_match_or_guard_scope (Meta , Kind , S ) ->
182
- assert_no_match_scope (Meta , Kind , S ),
183
- assert_no_guard_scope (Meta , Kind , S ).
184
-
185
- assert_no_match_scope (Meta , Kind , # elixir_scope {context = match } = S ) ->
186
- syntax_error (Meta , S # elixir_scope .file , " cannot invoke ~ts inside match clause" , [Kind ]);
187
- assert_no_match_scope (_Meta , _Kind , _S ) -> [].
188
-
189
- assert_no_guard_scope (Meta , Kind , # elixir_scope {context = guard } = S ) ->
190
- syntax_error (Meta , S # elixir_scope .file , " cannot invoke ~ts inside guard" , [Kind ]);
191
- assert_no_guard_scope (_Meta , _Kind , _S ) -> [].
192
-
193
181
assert_module_scope (Meta , Kind , # elixir_scope {module = nil ,file = File }) ->
194
182
syntax_error (Meta , File , " cannot invoke ~ts outside module" , [Kind ]);
195
183
assert_module_scope (_Meta , _Kind , # elixir_scope {module = Module }) -> Module .
@@ -198,6 +186,18 @@ assert_function_scope(Meta, Kind, #elixir_scope{function=nil,file=File}) ->
198
186
syntax_error (Meta , File , " cannot invoke ~ts outside function" , [Kind ]);
199
187
assert_function_scope (_Meta , _Kind , # elixir_scope {function = Function }) -> Function .
200
188
189
+ assert_no_match_or_guard_scope (Meta , Kind , S ) ->
190
+ assert_no_match_scope (Meta , Kind , S ),
191
+ assert_no_guard_scope (Meta , Kind , S ).
192
+
193
+ assert_no_match_scope (Meta , _Kind , # elixir_scope {context = match } = S ) ->
194
+ compile_error (Meta , S # elixir_scope .file , " invalid pattern in match clause" , []);
195
+ assert_no_match_scope (_Meta , _Kind , _S ) -> [].
196
+
197
+ assert_no_guard_scope (Meta , _Kind , # elixir_scope {context = guard } = S ) ->
198
+ compile_error (Meta , S # elixir_scope .file , " invalid pattern in guard" , []);
199
+ assert_no_guard_scope (_Meta , _Kind , _S ) -> [].
200
+
201
201
% % Helpers
202
202
203
203
raise (Meta , File , Kind , Message ) when is_list (Meta ) ->
0 commit comments