-module(graded@internal@typeinfo). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/graded/internal/typeinfo.gleam"). -export([none/0, from_modules/2, for_module/2, fn_typed_for_module/2, fn_typed_params/2, receiver_type/3]). -export_type([type_info/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(false). -type type_info() :: {type_info, gleam@dict:dict(binary(), gleam@dict:dict({integer(), integer()}, girard@types:type())), gleam@dict:dict(binary(), gleam@dict:dict(binary(), gleam@set:set(binary())))}. -file("src/graded/internal/typeinfo.gleam", 34). ?DOC(false). -spec none() -> type_info(). none() -> {type_info, maps:new(), maps:new()}. -file("src/graded/internal/typeinfo.gleam", 40). ?DOC(false). -spec from_modules( list({binary(), gleam@dict:dict({integer(), integer()}, girard@types:type())}), list({binary(), gleam@dict:dict(binary(), gleam@set:set(binary()))}) ) -> type_info(). from_modules(Types_modules, Fn_typed_modules) -> {type_info, maps:from_list(Types_modules), maps:from_list(Fn_typed_modules)}. -file("src/graded/internal/typeinfo.gleam", 52). ?DOC(false). -spec for_module(type_info(), binary()) -> gleam@dict:dict({integer(), integer()}, girard@types:type()). for_module(Info, Module_path) -> case gleam_stdlib:map_get(erlang:element(2, Info), Module_path) of {ok, Module_types} -> Module_types; {error, nil} -> maps:new() end. -file("src/graded/internal/typeinfo.gleam", 63). ?DOC(false). -spec fn_typed_for_module(type_info(), binary()) -> gleam@dict:dict(binary(), gleam@set:set(binary())). fn_typed_for_module(Info, Module_path) -> case gleam_stdlib:map_get(erlang:element(3, Info), Module_path) of {ok, Module_fn_typed} -> Module_fn_typed; {error, nil} -> maps:new() end. -file("src/graded/internal/typeinfo.gleam", 75). ?DOC(false). -spec fn_typed_params( gleam@dict:dict(binary(), gleam@set:set(binary())), binary() ) -> gleam@set:set(binary()). fn_typed_params(Module_fn_typed, Function) -> case gleam_stdlib:map_get(Module_fn_typed, Function) of {ok, Names} -> Names; {error, nil} -> gleam@set:new() end. -file("src/graded/internal/typeinfo.gleam", 91). ?DOC(false). -spec receiver_type( gleam@dict:dict({integer(), integer()}, girard@types:type()), integer(), integer() ) -> gleam@option:option({binary(), binary()}). receiver_type(Module_types, Start, End) -> case gleam_stdlib:map_get(Module_types, {Start, End}) of {ok, {named, Module, Name, _}} -> {some, {Module, Name}}; _ -> none end.