mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
refactor: string_forge 与命名空间绑定常量迁入 oxide_types 中立层
This commit is contained in:
@@ -176,7 +176,7 @@ pub struct CompileCtx {
|
||||
/// 依赖模块规范路径(按 import/export source 字符串索引):再导出来源身份用。
|
||||
pub(crate) module_dep_paths: HashMap<String, String>,
|
||||
/// 非自导入的导入局部名 → (依赖模块规范路径, 导入名)。命名空间导入的导入名为
|
||||
/// `oxide_kernel::MODULE_NAMESPACE_BINDING`;再导出据此重分类为间接导出。
|
||||
/// `oxide_types::MODULE_NAMESPACE_BINDING`;再导出据此重分类为间接导出。
|
||||
pub(crate) module_import_origins: HashMap<String, (String, String)>,
|
||||
/// 依赖 source 字符串 → 依赖模块是否含可重赋导出(`compile_js_dep` 回传;
|
||||
/// Json/Text 数据模块恒 false)。导入方据此把命名/默认导入登记为活读。
|
||||
|
||||
@@ -24,7 +24,7 @@ pub use oxide_parser::{AssignmentOperator, BinaryOperator, Expression, Statement
|
||||
|
||||
/// 编译入口。方法按语法域组织在 `impl Emitter` 中。
|
||||
pub struct Emitter {
|
||||
/// 源码是否为 `oxide_kernel::string_forge::source_escape` 产物
|
||||
/// 源码是否为 `oxide_types::string_forge::source_escape` 产物
|
||||
/// (eval/Function 动态编译):源文本内的孤立 surrogate 单元 / FFFD 以
|
||||
/// `\uXXXX` 转义文本承载(oxc 不可见裸单元——Rust str 无孤立 surrogate,
|
||||
/// 转义文本是唯一注入形态),反斜杠原样透传。正则字面量的源文本切片据此
|
||||
|
||||
@@ -96,7 +96,7 @@ impl Emitter {
|
||||
// 转义文本还原为池键 marker 形态(物化还原原始单元,
|
||||
// `.source` 按原始源返回),用户转义文本逐字透传。
|
||||
let pattern_key = if ctx.source_encoded {
|
||||
oxide_kernel::string_forge::source_escape_to_key(&pattern)
|
||||
oxide_types::string_forge::source_escape_to_key(&pattern)
|
||||
} else {
|
||||
crate::shared::string_pool::pool_key_plain(&pattern)
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ impl Emitter {
|
||||
.collect();
|
||||
|
||||
// 容量提示按单元数口径(键文本经物化解码还原单元序列)。
|
||||
let total_len_hint: usize = quasi_keys.iter().map(|k| oxide_kernel::string_forge::decode_key(k).len()).sum();
|
||||
let total_len_hint: usize = quasi_keys.iter().map(|k| oxide_types::string_forge::decode_key(k).len()).sum();
|
||||
|
||||
let mut parts = Vec::with_capacity(quasi_const_idxs.len() * 2);
|
||||
let mut expr_iter = expr_regs.iter();
|
||||
|
||||
@@ -19,7 +19,7 @@ use oxide_bytecode::opcode::OpCode;
|
||||
use oxide_ir::inst::Inst;
|
||||
use oxide_ir::operand::Operand;
|
||||
use oxide_ir::{IRFunction, ParamLayout};
|
||||
use oxide_kernel::MODULE_NAMESPACE_BINDING;
|
||||
use oxide_types::MODULE_NAMESPACE_BINDING;
|
||||
use oxide_parser::{
|
||||
BindingPattern, Declaration, ExportDefaultDeclarationKind, Expression, ImportAttributeKey,
|
||||
ImportDeclarationSpecifier, ModuleExportName, Statement, VariableDeclarationKind, WithClause,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! 常量池字符串键编码:池统一存无标志键编码(`oxide_kernel::string_forge::encode_key`
|
||||
//! 常量池字符串键编码:池统一存无标志键编码(`oxide_types::string_forge::encode_key`
|
||||
//! 语义),物化侧(perm_string → `decode_key`)是其精确逆变换。
|
||||
//!
|
||||
//! 两类来源文本:
|
||||
@@ -8,8 +8,8 @@
|
||||
//! 须逃逸编码防裸 FFFD 与 surrogate marker 碰撞;
|
||||
//! - 普通文本(标识符 / 数字 / 源文本):非 FFFD 恒等,真实 FFFD 逃逸为 FFFD+"fffd"。
|
||||
|
||||
use oxide_kernel::string_forge::encode_key;
|
||||
use oxide_parser::PropertyKey;
|
||||
use oxide_types::string_forge::encode_key;
|
||||
|
||||
/// 普通文本 → 池键:真实 FFFD 逃逸为 FFFD+"fffd",其余逐单元恒等。
|
||||
pub(crate) fn pool_key_plain(text: &str) -> String {
|
||||
|
||||
Reference in New Issue
Block a user