Skip to content

Commit 9d1933b

Browse files
committed
Use attributes field to compute behaviours
1 parent 57de6ea commit 9d1933b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/elixir/lib/module/parallel_checker.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ defmodule Module.ParallelChecker do
217217
file: file,
218218
compile_opts: compile_opts,
219219
definitions: definitions,
220-
uses_behaviours: uses_behaviours,
220+
attributes: attributes,
221221
impls: impls
222222
} = module_map
223223

@@ -228,6 +228,8 @@ defmodule Module.ParallelChecker do
228228
%{line: line} -> line
229229
end
230230

231+
behaviours = for {:behaviour, module} <- attributes, do: module
232+
231233
no_warn_undefined =
232234
compile_opts
233235
|> extract_no_warn_undefined()
@@ -238,7 +240,7 @@ defmodule Module.ParallelChecker do
238240
module,
239241
file,
240242
line,
241-
uses_behaviours,
243+
behaviours,
242244
impls,
243245
definitions
244246
)

lib/elixir/src/elixir_erl.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ extra_chunks_opts([], Opts) -> Opts;
502502
extra_chunks_opts(Chunks, Opts) -> [{extra_chunks, Chunks} | Opts].
503503

504504
docs_chunk(Map, Set, Module, Anno, Def, Defmacro, Types, Callbacks) ->
505-
#{file := File, uses_behaviours := UsesBehaviours} = Map,
505+
#{file := File, attributes := Attributes} = Map,
506506

507507
case elixir_config:get(docs) of
508508
true ->
@@ -516,7 +516,7 @@ docs_chunk(Map, Set, Module, Anno, Def, Defmacro, Types, Callbacks) ->
516516
ModuleMeta = ModuleDocMeta#{
517517
source_path => File,
518518
source_annos => [Anno],
519-
behaviours => UsesBehaviours
519+
behaviours => [Mod || {behaviour, Mod} <- Attributes]
520520
},
521521

522522
DocsChunkData = term_to_binary({docs_v1,

lib/elixir/src/elixir_module.erl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ compile(Meta, Module, ModuleAsCharlist, Block, Vars, Prune, E) ->
161161

162162
RawCompileOpts = bag_lookup_element(DataBag, {accumulate, compile}, 2),
163163
CompileOpts = validate_compile_opts(RawCompileOpts, AllDefinitions, Unreachable, Line, E),
164-
UsesBehaviours = bag_lookup_element(DataBag, {accumulate, behaviour}, 2),
165164
Impls = bag_lookup_element(DataBag, impls, 2),
166165

167166
AfterVerify = bag_lookup_element(DataBag, {accumulate, after_verify}, 2),
@@ -181,7 +180,6 @@ compile(Meta, Module, ModuleAsCharlist, Block, Vars, Prune, E) ->
181180
compile_opts => CompileOpts,
182181
deprecated => get_deprecated(DataBag),
183182
defines_behaviour => defines_behaviour(DataBag),
184-
uses_behaviours => UsesBehaviours,
185183
impls => Impls
186184
},
187185

0 commit comments

Comments
 (0)