mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Add name_arity as a format_component.
compiler/error_util.m:
As above.
compiler/prog_data.m:
To make this possible, move the existing definitions of name_arity here.
compiler/hlds_defns.m:
compiler/pred_table.m:
Delete two the old copies of that definition.
This commit is contained in:
@@ -508,6 +508,10 @@
|
||||
% The output should contain the string form of the sym_name,
|
||||
% surrounded by `' quotes.
|
||||
|
||||
; name_arity(name_arity)
|
||||
% The output should contain the name, surrounded by `' quotes,
|
||||
% followed by '/' and the arity.
|
||||
|
||||
; qual_sym_name_arity(sym_name_arity)
|
||||
; unqual_sym_name_arity(sym_name_arity)
|
||||
% The output should contain the string form of the sym_name,
|
||||
@@ -2045,6 +2049,10 @@ error_pieces_to_string_2(FirstInMsg, [Component | Components]) = Str :-
|
||||
),
|
||||
Word = sym_name_to_word(SymName),
|
||||
Str = join_string_and_tail(Word, Components, TailStr)
|
||||
;
|
||||
Component = name_arity(NameAndArity),
|
||||
Word = name_arity_to_word(NameAndArity),
|
||||
Str = join_string_and_tail(Word, Components, TailStr)
|
||||
;
|
||||
(
|
||||
Component = qual_sym_name_arity(SymNameAndArity)
|
||||
@@ -2267,6 +2275,10 @@ convert_components_to_paragraphs_acc(FirstInMsg, [Component | Components],
|
||||
SymName = unqualified(unqualify_name(SymName0))
|
||||
),
|
||||
RevWords1 = [plain_word(sym_name_to_word(SymName)) | RevWords0]
|
||||
;
|
||||
Component = name_arity(NameAndArity),
|
||||
Word = name_arity_to_word(NameAndArity),
|
||||
RevWords1 = [plain_word(Word) | RevWords0]
|
||||
;
|
||||
(
|
||||
Component = qual_sym_name_arity(SymNameAndArity)
|
||||
@@ -2461,6 +2473,11 @@ join_prefixes([Head | Tail]) = Strings :-
|
||||
sym_name_to_word(SymName) =
|
||||
add_quotes(sym_name_to_string(SymName)).
|
||||
|
||||
:- func name_arity_to_word(name_arity) = string.
|
||||
|
||||
name_arity_to_word(name_arity(Name, Arity)) =
|
||||
add_quotes(Name) ++ "/" ++ int_to_string(Arity).
|
||||
|
||||
:- func sym_name_arity_to_word(sym_name_arity) = string.
|
||||
|
||||
sym_name_arity_to_word(sym_name_arity(SymName, Arity)) =
|
||||
|
||||
@@ -80,9 +80,6 @@
|
||||
:- import_module string.
|
||||
:- import_module term.
|
||||
|
||||
:- type name_arity
|
||||
---> name_arity(string, arity).
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
|
||||
write_hlds_defns(Stream, ModuleInfo, !IO) :-
|
||||
|
||||
@@ -425,8 +425,6 @@
|
||||
:- type name_index == map(string, list(pred_id)).
|
||||
|
||||
:- type name_arity_index == map(name_arity, list(pred_id)).
|
||||
:- type name_arity
|
||||
---> name_arity(string, arity).
|
||||
|
||||
:- type module_and_name
|
||||
---> module_and_name(module_name, string).
|
||||
|
||||
@@ -1976,6 +1976,9 @@ valid_trace_grade_name(GradeName) :-
|
||||
|
||||
:- interface.
|
||||
|
||||
:- type name_arity
|
||||
---> name_arity(string, arity).
|
||||
|
||||
:- type sym_name_specifier
|
||||
---> sym_name_specifier_name(sym_name)
|
||||
; sym_name_specifier_name_arity(sym_name, arity).
|
||||
|
||||
Reference in New Issue
Block a user