-
-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
This is part of #71.
In general I think the "nice" style of builder API is along the lines of
Builder::new()
.add_something()
.add_more()
[…]
.build()
By contrast, SourceMapBuilder
has a bunch of of get
and set
methods. Unfortunately the "flow" style won't work for e.g. add_source
because it needs to return the source ID.
I would advocate for getting rid at least of the following methods:
get_file
get_source_root
get_source
,set_source
get_source_contents
strip_prefixes
(just do that before adding the sources)
I'm not entirely sure about set_source_contents
and load_local_source_contents
. Being able to set source contents after the fact might come in handy. But there's also something to be said for only setting everything once.
add
/add_with_id
/add_raw
/add_token
should probably condensed and/or cleaned up—it's not easy to understand the difference between them and why e.g. add
takes both a source
and a source_id
parameter.
stefnotch