Silence many warnings
This commit is contained in:
+102
-102
@@ -21,8 +21,8 @@ pub mod opcodes {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct QuickJSBinary {
|
pub struct QuickJSBinary {
|
||||||
pub version: u8,
|
pub _version: u8,
|
||||||
pub checksum: u32,
|
pub _checksum: u32,
|
||||||
pub atoms: Vec<Atom>,
|
pub atoms: Vec<Atom>,
|
||||||
pub root_mod: Module,
|
pub root_mod: Module,
|
||||||
}
|
}
|
||||||
@@ -42,8 +42,8 @@ impl QuickJSBinary {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
QuickJSBinary {
|
QuickJSBinary {
|
||||||
version,
|
_version: version,
|
||||||
checksum,
|
_checksum: checksum,
|
||||||
atoms,
|
atoms,
|
||||||
root_mod,
|
root_mod,
|
||||||
},
|
},
|
||||||
@@ -164,8 +164,8 @@ pub enum JsValue {
|
|||||||
/// array body; `raw` is the extra trailing value stored as `.raw`
|
/// array body; `raw` is the extra trailing value stored as `.raw`
|
||||||
/// (`Undefined` when the template has no raw form).
|
/// (`Undefined` when the template has no raw form).
|
||||||
TemplateObject {
|
TemplateObject {
|
||||||
cooked: Vec<JsValue>,
|
_cooked: Vec<JsValue>,
|
||||||
raw: Box<JsValue>,
|
_raw: Box<JsValue>,
|
||||||
},
|
},
|
||||||
Function(Function),
|
Function(Function),
|
||||||
FnById(usize),
|
FnById(usize),
|
||||||
@@ -240,8 +240,8 @@ impl JsValue {
|
|||||||
(
|
(
|
||||||
bin,
|
bin,
|
||||||
Self::TemplateObject {
|
Self::TemplateObject {
|
||||||
cooked,
|
_cooked: cooked,
|
||||||
raw: Box::new(raw),
|
_raw: Box::new(raw),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -271,16 +271,16 @@ pub enum FuncKind {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FunctionFlags {
|
pub struct FunctionFlags {
|
||||||
pub has_prototype: bool,
|
pub _has_prototype: bool,
|
||||||
pub has_simple_param_list: bool,
|
pub _has_simple_param_list: bool,
|
||||||
pub is_derived_class_constructor: bool,
|
pub _is_derived_class_constructor: bool,
|
||||||
pub need_home_object: bool,
|
pub _need_home_object: bool,
|
||||||
pub func_kind: FuncKind,
|
pub _func_kind: FuncKind,
|
||||||
pub new_target_allowed: bool,
|
pub _new_target_allowed: bool,
|
||||||
pub super_call_allowed: bool,
|
pub _super_call_allowed: bool,
|
||||||
pub super_allowed: bool,
|
pub _super_allowed: bool,
|
||||||
pub arguments_allowed: bool,
|
pub _arguments_allowed: bool,
|
||||||
pub backtrace_barrier: bool,
|
pub _backtrace_barrier: bool,
|
||||||
pub has_debug: bool,
|
pub has_debug: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,16 +291,16 @@ impl FunctionFlags {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
has_prototype: raw & (1 << 0) != 0,
|
_has_prototype: raw & (1 << 0) != 0,
|
||||||
has_simple_param_list: raw & (1 << 1) != 0,
|
_has_simple_param_list: raw & (1 << 1) != 0,
|
||||||
is_derived_class_constructor: raw & (1 << 2) != 0,
|
_is_derived_class_constructor: raw & (1 << 2) != 0,
|
||||||
need_home_object: raw & (1 << 3) != 0,
|
_need_home_object: raw & (1 << 3) != 0,
|
||||||
func_kind: FuncKind::try_from_primitive((raw >> 4) & 0b11).unwrap(),
|
_func_kind: FuncKind::try_from_primitive((raw >> 4) & 0b11).unwrap(),
|
||||||
new_target_allowed: raw & (1 << 6) != 0,
|
_new_target_allowed: raw & (1 << 6) != 0,
|
||||||
super_call_allowed: raw & (1 << 7) != 0,
|
_super_call_allowed: raw & (1 << 7) != 0,
|
||||||
super_allowed: raw & (1 << 8) != 0,
|
_super_allowed: raw & (1 << 8) != 0,
|
||||||
arguments_allowed: raw & (1 << 9) != 0,
|
_arguments_allowed: raw & (1 << 9) != 0,
|
||||||
backtrace_barrier: raw & (1 << 10) != 0,
|
_backtrace_barrier: raw & (1 << 10) != 0,
|
||||||
has_debug: raw & (1 << 11) != 0,
|
has_debug: raw & (1 << 11) != 0,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
@@ -326,9 +326,9 @@ pub enum VarKind {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct VarDefFlags {
|
pub struct VarDefFlags {
|
||||||
pub kind: VarKind,
|
pub _kind: VarKind,
|
||||||
pub is_const: bool,
|
pub _is_const: bool,
|
||||||
pub is_lexical: bool,
|
pub _is_lexical: bool,
|
||||||
pub is_captured: bool,
|
pub is_captured: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,9 +344,9 @@ impl VarDefFlags {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
kind,
|
_kind: kind,
|
||||||
is_const,
|
_is_const: is_const,
|
||||||
is_lexical,
|
_is_lexical: is_lexical,
|
||||||
is_captured,
|
is_captured,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
@@ -355,11 +355,11 @@ impl VarDefFlags {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct VarDef {
|
pub struct VarDef {
|
||||||
pub name: AtomRef,
|
pub _name: AtomRef,
|
||||||
pub scope_level: usize,
|
pub _scope_level: usize,
|
||||||
pub scope_next_plus_1: usize,
|
pub _scope_next_plus_1: usize,
|
||||||
pub flags: VarDefFlags,
|
pub _flags: VarDefFlags,
|
||||||
pub var_ref_idx: Option<usize>,
|
pub _var_ref_idx: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VarDef {
|
impl VarDef {
|
||||||
@@ -379,11 +379,11 @@ impl VarDef {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
name,
|
_name: name,
|
||||||
scope_level,
|
_scope_level: scope_level,
|
||||||
scope_next_plus_1,
|
_scope_next_plus_1: scope_next_plus_1,
|
||||||
flags,
|
_flags: flags,
|
||||||
var_ref_idx,
|
_var_ref_idx: var_ref_idx,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -405,9 +405,9 @@ pub enum ClosureKind {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ClosureVarFlags {
|
pub struct ClosureVarFlags {
|
||||||
pub closure_kind: ClosureKind,
|
pub closure_kind: ClosureKind,
|
||||||
pub is_const: bool,
|
pub _is_const: bool,
|
||||||
pub is_lexical: bool,
|
pub is_lexical: bool,
|
||||||
pub var_kind: VarKind,
|
pub _var_kind: VarKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClosureVarFlags {
|
impl ClosureVarFlags {
|
||||||
@@ -424,9 +424,9 @@ impl ClosureVarFlags {
|
|||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
closure_kind,
|
closure_kind,
|
||||||
is_const,
|
_is_const: is_const,
|
||||||
is_lexical,
|
is_lexical,
|
||||||
var_kind,
|
_var_kind: var_kind,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -434,7 +434,7 @@ impl ClosureVarFlags {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ClosureVar {
|
pub struct ClosureVar {
|
||||||
pub name: AtomRef,
|
pub _name: AtomRef,
|
||||||
pub var_idx: usize,
|
pub var_idx: usize,
|
||||||
pub flags: ClosureVarFlags,
|
pub flags: ClosureVarFlags,
|
||||||
}
|
}
|
||||||
@@ -448,7 +448,7 @@ impl ClosureVar {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
name,
|
_name: name,
|
||||||
var_idx,
|
var_idx,
|
||||||
flags,
|
flags,
|
||||||
},
|
},
|
||||||
@@ -487,7 +487,7 @@ pub enum ImmOperand {
|
|||||||
/// (the scope chain entry point, FORMAT.md §3.3).
|
/// (the scope chain entry point, FORMAT.md §3.3).
|
||||||
NpopU16 {
|
NpopU16 {
|
||||||
npop: u16,
|
npop: u16,
|
||||||
scope: u16,
|
_scope: u16,
|
||||||
},
|
},
|
||||||
/// Jump. The wire value is a signed offset from the operand
|
/// Jump. The wire value is a signed offset from the operand
|
||||||
/// field's own position; `target` is already resolved.
|
/// field's own position; `target` is already resolved.
|
||||||
@@ -501,21 +501,21 @@ pub enum ImmOperand {
|
|||||||
},
|
},
|
||||||
AtomU16 {
|
AtomU16 {
|
||||||
atom: AtomRef,
|
atom: AtomRef,
|
||||||
arg: u16,
|
_arg: u16,
|
||||||
},
|
},
|
||||||
AtomLabelU8 {
|
AtomLabelU8 {
|
||||||
atom: AtomRef,
|
_atom: AtomRef,
|
||||||
target: usize,
|
_target: usize,
|
||||||
arg: u8,
|
_arg: u8,
|
||||||
},
|
},
|
||||||
AtomLabelU16 {
|
AtomLabelU16 {
|
||||||
atom: AtomRef,
|
_atom: AtomRef,
|
||||||
target: usize,
|
_target: usize,
|
||||||
arg: u16,
|
_arg: u16,
|
||||||
},
|
},
|
||||||
LabelU16 {
|
LabelU16 {
|
||||||
target: usize,
|
_target: usize,
|
||||||
arg: u16,
|
_arg: u16,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +618,7 @@ fn parse_bytecode(code: &[u8]) -> IResult<&[u8], Vec<Instr>> {
|
|||||||
opcodes::OpFmt::Npop => ImmOperand::Npop(u16_at(0)),
|
opcodes::OpFmt::Npop => ImmOperand::Npop(u16_at(0)),
|
||||||
opcodes::OpFmt::NpopU16 => ImmOperand::NpopU16 {
|
opcodes::OpFmt::NpopU16 => ImmOperand::NpopU16 {
|
||||||
npop: u16_at(0),
|
npop: u16_at(0),
|
||||||
scope: u16_at(2),
|
_scope: u16_at(2),
|
||||||
},
|
},
|
||||||
opcodes::OpFmt::Loc => ImmOperand::Loc(u16_at(0)),
|
opcodes::OpFmt::Loc => ImmOperand::Loc(u16_at(0)),
|
||||||
opcodes::OpFmt::Arg => ImmOperand::Arg(u16_at(0)),
|
opcodes::OpFmt::Arg => ImmOperand::Arg(u16_at(0)),
|
||||||
@@ -639,21 +639,21 @@ fn parse_bytecode(code: &[u8]) -> IResult<&[u8], Vec<Instr>> {
|
|||||||
},
|
},
|
||||||
opcodes::OpFmt::AtomU16 => ImmOperand::AtomU16 {
|
opcodes::OpFmt::AtomU16 => ImmOperand::AtomU16 {
|
||||||
atom: AtomRef::from_code_u32(u32_at(0)),
|
atom: AtomRef::from_code_u32(u32_at(0)),
|
||||||
arg: u16_at(4),
|
_arg: u16_at(4),
|
||||||
},
|
},
|
||||||
opcodes::OpFmt::AtomLabelU8 => ImmOperand::AtomLabelU8 {
|
opcodes::OpFmt::AtomLabelU8 => ImmOperand::AtomLabelU8 {
|
||||||
atom: AtomRef::from_code_u32(u32_at(0)),
|
_atom: AtomRef::from_code_u32(u32_at(0)),
|
||||||
target: jump(atom_label_base, u32_at(4) as i32 as i64),
|
_target: jump(atom_label_base, u32_at(4) as i32 as i64),
|
||||||
arg: u8_at(8),
|
_arg: u8_at(8),
|
||||||
},
|
},
|
||||||
opcodes::OpFmt::AtomLabelU16 => ImmOperand::AtomLabelU16 {
|
opcodes::OpFmt::AtomLabelU16 => ImmOperand::AtomLabelU16 {
|
||||||
atom: AtomRef::from_code_u32(u32_at(0)),
|
_atom: AtomRef::from_code_u32(u32_at(0)),
|
||||||
target: jump(atom_label_base, u32_at(4) as i32 as i64),
|
_target: jump(atom_label_base, u32_at(4) as i32 as i64),
|
||||||
arg: u16_at(8),
|
_arg: u16_at(8),
|
||||||
},
|
},
|
||||||
opcodes::OpFmt::LabelU16 => ImmOperand::LabelU16 {
|
opcodes::OpFmt::LabelU16 => ImmOperand::LabelU16 {
|
||||||
target: jump(pc + 1, u32_at(0) as i32 as i64),
|
_target: jump(pc + 1, u32_at(0) as i32 as i64),
|
||||||
arg: u16_at(4),
|
_arg: u16_at(4),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -671,18 +671,18 @@ fn parse_bytecode(code: &[u8]) -> IResult<&[u8], Vec<Instr>> {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Function {
|
pub struct Function {
|
||||||
pub flags: FunctionFlags,
|
pub _flags: FunctionFlags,
|
||||||
pub is_strict_mode: bool,
|
pub _is_strict_mode: bool,
|
||||||
pub name: AtomRef,
|
pub name: AtomRef,
|
||||||
pub arg_count: usize,
|
pub arg_count: usize,
|
||||||
/// Num locals
|
/// Num locals
|
||||||
pub var_count: usize,
|
pub var_count: usize,
|
||||||
/// Parameters before the first default or rest, this is Function.prototype.length
|
/// Parameters before the first default or rest, this is Function.prototype.length
|
||||||
pub defined_arg_count: usize,
|
pub _defined_arg_count: usize,
|
||||||
pub stack_size: usize,
|
pub _stack_size: usize,
|
||||||
pub var_ref_count: usize,
|
pub _var_ref_count: usize,
|
||||||
/// arguments first, then locals
|
/// arguments first, then locals
|
||||||
pub var_defs: Vec<VarDef>,
|
pub _var_defs: Vec<VarDef>,
|
||||||
pub closure_vars: Vec<ClosureVar>,
|
pub closure_vars: Vec<ClosureVar>,
|
||||||
pub cpool: Vec<JsValue>,
|
pub cpool: Vec<JsValue>,
|
||||||
/// LLM GENERATED, TENTATIVE
|
/// LLM GENERATED, TENTATIVE
|
||||||
@@ -728,15 +728,15 @@ impl Function {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
flags,
|
_flags: flags,
|
||||||
is_strict_mode: strict_mode == 1,
|
_is_strict_mode: strict_mode == 1,
|
||||||
name,
|
name,
|
||||||
arg_count,
|
arg_count,
|
||||||
var_count,
|
var_count,
|
||||||
defined_arg_count,
|
_defined_arg_count: defined_arg_count,
|
||||||
stack_size,
|
_stack_size: stack_size,
|
||||||
var_ref_count,
|
_var_ref_count: var_ref_count,
|
||||||
var_defs,
|
_var_defs: var_defs,
|
||||||
closure_vars,
|
closure_vars,
|
||||||
cpool,
|
cpool,
|
||||||
byte_code,
|
byte_code,
|
||||||
@@ -747,12 +747,12 @@ impl Function {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Module {
|
pub struct Module {
|
||||||
pub name: AtomRef,
|
pub _name: AtomRef,
|
||||||
pub import_modules: Vec<AtomRef>,
|
pub _import_modules: Vec<AtomRef>,
|
||||||
pub exports: Vec<ExportInfo>,
|
pub _exports: Vec<ExportInfo>,
|
||||||
pub star_exports: Vec<usize>,
|
pub _star_exports: Vec<usize>,
|
||||||
pub imports: Vec<ImportInfo>,
|
pub _imports: Vec<ImportInfo>,
|
||||||
pub has_top_level_await: bool,
|
pub _has_top_level_await: bool,
|
||||||
pub root_fn: Function,
|
pub root_fn: Function,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -780,12 +780,12 @@ impl Module {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
name,
|
_name: name,
|
||||||
import_modules,
|
_import_modules: import_modules,
|
||||||
exports,
|
_exports: exports,
|
||||||
star_exports,
|
_star_exports: star_exports,
|
||||||
imports,
|
_imports: imports,
|
||||||
has_top_level_await: has_tla == 1,
|
_has_top_level_await: has_tla == 1,
|
||||||
root_fn,
|
root_fn,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
@@ -795,7 +795,7 @@ impl Module {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ExportInfo {
|
pub enum ExportInfo {
|
||||||
/// All exports except aliases and star exports
|
/// All exports except aliases and star exports
|
||||||
Local { var_idx: usize, name: AtomRef },
|
Local { _var_idx: usize, _name: AtomRef },
|
||||||
/// Alias exports, has `from`, eg: export { a } from "./dep.js";
|
/// Alias exports, has `from`, eg: export { a } from "./dep.js";
|
||||||
Alias,
|
Alias,
|
||||||
}
|
}
|
||||||
@@ -808,7 +808,7 @@ impl ExportInfo {
|
|||||||
0 => {
|
0 => {
|
||||||
let (bin, var_idx) = leb128(bin)?;
|
let (bin, var_idx) = leb128(bin)?;
|
||||||
let (bin, name) = AtomRef::parse(bin)?;
|
let (bin, name) = AtomRef::parse(bin)?;
|
||||||
(bin, Self::Local { var_idx, name })
|
(bin, Self::Local { _var_idx: var_idx, _name: name })
|
||||||
}
|
}
|
||||||
1 => (bin, Self::Alias),
|
1 => (bin, Self::Alias),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
@@ -820,9 +820,9 @@ impl ExportInfo {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ImportInfo {
|
pub struct ImportInfo {
|
||||||
pub var_idx: usize,
|
pub _var_idx: usize,
|
||||||
pub name: AtomRef,
|
pub _name: AtomRef,
|
||||||
pub req_module_idx: usize,
|
pub _req_module_idx: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ImportInfo {
|
impl ImportInfo {
|
||||||
@@ -834,9 +834,9 @@ impl ImportInfo {
|
|||||||
Ok((
|
Ok((
|
||||||
bin,
|
bin,
|
||||||
Self {
|
Self {
|
||||||
var_idx,
|
_var_idx: var_idx,
|
||||||
name,
|
_name: name,
|
||||||
req_module_idx,
|
_req_module_idx: req_module_idx,
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user