[m-rev.] for review: Add --trans-opt-deps-spec option.

Peter Wang novalazy at gmail.com
Fri Jan 13 11:40:23 AEDT 2023


On Fri, 13 Jan 2023 02:10:24 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> 2023-01-12 16:57 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:
> >> > +    % TODO: report errors using error specs
> >> > +    % TODO: report multiple errors
> >> 
> >> If you want, I can do these after you commit.
> >> 
> > 
> > That will be helpful, thanks.
> 
> The attached diff does this. For your post-commit review.

> +:- pred parse_trans_opt_deps_spec_module_names(varset::in, list(term)::in,
> +    cord(pair(term_context, module_name))::in,
> +    cord(pair(term_context, module_name))::out,
> +    list(error_spec)::in, list(error_spec)::out) is det.
> +
> +parse_trans_opt_deps_spec_module_names(_VarSet, [], !ModuleNameCord, !Specs).
> +parse_trans_opt_deps_spec_module_names(VarSet, [Term | Terms],
> +        !ModuleNameCord, !Specs) :-
> +    ( if try_parse_symbol_name(Term, ModuleName) then
> +        cord.snoc(get_term_context(Term) - ModuleName, !ModuleNameCord),
> +        parse_trans_opt_deps_spec_module_names(VarSet, Terms,
> +            !ModuleNameCord, !Specs)

I've deleted this recursive call.

> +    else
> +        TermStr = describe_error_term(VarSet, Term),
> +        Pieces = [words("Error: expected a module name, got"),
> +            quote(TermStr), suffix("."), nl],
> +        Spec = simplest_spec($pred, severity_error, phase_read_files,
> +            get_term_context(Term), Pieces),
> +        !:Specs = [Spec | !.Specs]
> +    ),
> +    parse_trans_opt_deps_spec_module_names(VarSet, Terms,
> +        !ModuleNameCord, !Specs).

The rest looks fine, thanks.

Peter


More information about the reviews mailing list