mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
metadata, fn_meta -> meta
This commit is contained in:
@@ -46,7 +46,7 @@ pub enum BytecodeType {
|
||||
BigInt = 0x13,
|
||||
GeneratorFunction = 0x14,
|
||||
// ExportStar = 0x15,
|
||||
// FnMeta = 0x16,
|
||||
// Meta = 0x16,
|
||||
Unrecognized = 0xff,
|
||||
}
|
||||
|
||||
@@ -284,11 +284,11 @@ impl BytecodeDecoder {
|
||||
}
|
||||
|
||||
pub fn decode_function(&mut self, is_generator: bool) -> Val {
|
||||
let metadata_pos = if self.decode_byte() == 0 {
|
||||
let meta_pos = if self.decode_byte() == 0 {
|
||||
None
|
||||
} else {
|
||||
if self.decode_type() != BytecodeType::Pointer {
|
||||
panic!("Unexpected non-pointer function metadata");
|
||||
panic!("Unexpected non-pointer function meta");
|
||||
}
|
||||
|
||||
Some(self.decode_pos())
|
||||
@@ -300,7 +300,7 @@ impl BytecodeDecoder {
|
||||
|
||||
VsFunction {
|
||||
bytecode: self.bytecode.clone(),
|
||||
metadata_pos,
|
||||
meta_pos,
|
||||
is_generator,
|
||||
register_count,
|
||||
parameter_count,
|
||||
|
||||
@@ -13,7 +13,7 @@ use super::vs_value::Val;
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VsFunction {
|
||||
pub bytecode: Rc<Bytecode>,
|
||||
pub metadata_pos: Option<usize>,
|
||||
pub meta_pos: Option<usize>,
|
||||
pub is_generator: bool,
|
||||
pub register_count: usize,
|
||||
pub parameter_count: usize,
|
||||
@@ -31,7 +31,7 @@ impl VsFunction {
|
||||
|
||||
VsFunction {
|
||||
bytecode: self.bytecode.clone(),
|
||||
metadata_pos: self.metadata_pos,
|
||||
meta_pos: self.meta_pos,
|
||||
is_generator: self.is_generator,
|
||||
register_count: self.register_count,
|
||||
parameter_count: self.parameter_count,
|
||||
@@ -41,9 +41,9 @@ impl VsFunction {
|
||||
}
|
||||
|
||||
pub fn content_hash(&self) -> Result<[u8; 32], Val> {
|
||||
match self.metadata_pos {
|
||||
match self.meta_pos {
|
||||
Some(p) => self.bytecode.decoder(p).decode_content_hash(),
|
||||
None => Err("Can't get content_hash without metadata_pos".to_internal_error()),
|
||||
None => Err("Can't get content_hash without meta_pos".to_internal_error()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user