1
Fork 0

various: translation resources from cg backend

Extend `CodegenBackend` trait with a function returning the translation
resources from the codegen backend, which can be added to the complete
list of resources provided to the emitter.

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood 2022-10-17 14:11:26 +01:00
parent a8e37507f4
commit 26255186e2
23 changed files with 86 additions and 48 deletions

View file

@ -226,10 +226,7 @@ pub struct ParseSess {
impl ParseSess {
/// Used for testing.
pub fn new(
locale_resources: &'static [&'static str],
file_path_mapping: FilePathMapping,
) -> Self {
pub fn new(locale_resources: Vec<&'static str>, file_path_mapping: FilePathMapping) -> Self {
let fallback_bundle = fallback_fluent_bundle(locale_resources, false);
let sm = Lrc::new(SourceMap::new(file_path_mapping));
let handler = Handler::with_tty_emitter(
@ -268,7 +265,7 @@ impl ParseSess {
}
pub fn with_silent_emitter(fatal_note: Option<String>) -> Self {
let fallback_bundle = fallback_fluent_bundle(&[], false);
let fallback_bundle = fallback_fluent_bundle(Vec::new(), false);
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let fatal_handler =
Handler::with_tty_emitter(ColorConfig::Auto, false, None, None, None, fallback_bundle);