refactor: tidy
This commit is contained in:
@@ -57,7 +57,7 @@ pub(crate) fn compile_scoped(expr: &Ir, ctx: &impl CodegenContext) -> String {
|
||||
buf.into_string()
|
||||
}
|
||||
|
||||
pub(crate) struct CodeBuffer {
|
||||
struct CodeBuffer {
|
||||
buf: String,
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ impl Context {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct Ctx {
|
||||
struct Ctx {
|
||||
symbols: DefaultStringInterner,
|
||||
global: HashMap<SymId, Ir<'static>>,
|
||||
sources: Vec<Source>,
|
||||
@@ -307,7 +307,7 @@ impl Ctx {
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn get_current_dir(&self) -> &Path {
|
||||
fn get_current_dir(&self) -> &Path {
|
||||
self.sources
|
||||
.last()
|
||||
.as_ref()
|
||||
@@ -315,17 +315,13 @@ impl Ctx {
|
||||
.get_dir()
|
||||
}
|
||||
|
||||
pub(crate) fn get_current_source(&self) -> Source {
|
||||
fn get_current_source(&self) -> Source {
|
||||
self.sources
|
||||
.last()
|
||||
.expect("current_source is not set")
|
||||
.clone()
|
||||
}
|
||||
|
||||
pub(crate) fn get_source(&self, id: usize) -> Source {
|
||||
self.sources.get(id).expect("source not found").clone()
|
||||
}
|
||||
|
||||
fn downgrade<'ctx>(
|
||||
&'ctx mut self,
|
||||
source: Source,
|
||||
@@ -363,7 +359,7 @@ impl Ctx {
|
||||
Ok(code)
|
||||
}
|
||||
|
||||
pub(crate) fn compile_scoped(&mut self, source: Source, scope: Vec<String>) -> Result<String> {
|
||||
fn compile_scoped(&mut self, source: Source, scope: Vec<String>) -> Result<String> {
|
||||
let scope = Scope::ScopedImport(
|
||||
scope
|
||||
.into_iter()
|
||||
@@ -419,7 +415,7 @@ impl RuntimeContext for Ctx {
|
||||
self.compile_scoped(source, scope)
|
||||
}
|
||||
fn get_source(&self, id: usize) -> Source {
|
||||
self.get_source(id)
|
||||
self.sources.get(id).expect("source not found").clone()
|
||||
}
|
||||
fn get_store(&self) -> &DaemonStore {
|
||||
&self.store
|
||||
@@ -454,7 +450,7 @@ impl<'ir, 'ctx> ScopeGuard<'_, 'ctx, 'ir> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DowngradeCtx<'ctx, 'ir> {
|
||||
struct DowngradeCtx<'ctx, 'ir> {
|
||||
bump: &'ir Bump,
|
||||
symbols: &'ctx mut DefaultStringInterner,
|
||||
source: Source,
|
||||
|
||||
@@ -91,7 +91,7 @@ fn runtime_extension<Ctx: RuntimeContext>() -> Extension {
|
||||
mod private {
|
||||
use deno_error::js_error_wrapper;
|
||||
#[derive(Debug)]
|
||||
pub struct SimpleErrorWrapper(pub(crate) String);
|
||||
pub struct SimpleErrorWrapper(String);
|
||||
impl std::fmt::Display for SimpleErrorWrapper {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(&self.0, f)
|
||||
|
||||
@@ -60,7 +60,7 @@ where
|
||||
|
||||
#[derive(Embed)]
|
||||
#[folder = "src/runtime/corepkgs"]
|
||||
pub(crate) struct CorePkgs;
|
||||
struct CorePkgs;
|
||||
|
||||
fn new_simple_jserror(msg: String) -> Box<JsError> {
|
||||
JsError {
|
||||
|
||||
Reference in New Issue
Block a user