mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
Add ErgConfig::inherit
and remove with_module_path
This commit is contained in:
parent
0e928c758f
commit
b09fce8a86
2 changed files with 10 additions and 11 deletions
|
@ -225,14 +225,6 @@ impl ErgConfig {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn with_module_path(path: PathBuf) -> Self {
|
||||
Self {
|
||||
module: Box::leak(path.to_str().unwrap().to_string().into_boxed_str()),
|
||||
input: Input::File(path),
|
||||
..ErgConfig::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// cloneのエイリアス(実際のcloneコストは低いので)
|
||||
#[inline]
|
||||
pub fn copy(&self) -> Self {
|
||||
|
@ -247,6 +239,14 @@ impl ErgConfig {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn inherit(&self, path: PathBuf) -> Self {
|
||||
Self {
|
||||
module: Box::leak(path.to_str().unwrap().to_string().into_boxed_str()),
|
||||
input: Input::File(path),
|
||||
..self.copy()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse() -> Self {
|
||||
let mut args = env::args();
|
||||
args.next(); // "ergc"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue