mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
hash -> srcHash
This commit is contained in:
@@ -16,7 +16,7 @@ use crate::module_compiler::ModuleCompiler;
|
||||
use crate::name_allocator::{NameAllocator, RegAllocator};
|
||||
use crate::scope::{NameId, OwnerId};
|
||||
use crate::scope_analysis::{fn_to_owner_id, Name};
|
||||
use crate::source_hash::source_hash_asm;
|
||||
use crate::src_hash::src_hash_asm;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Functionish {
|
||||
@@ -47,8 +47,8 @@ impl Functionish {
|
||||
),
|
||||
),
|
||||
(
|
||||
Value::String("hash".to_string()),
|
||||
source_hash_asm(source, fn_.span),
|
||||
Value::String("srcHash".to_string()),
|
||||
src_hash_asm(source, fn_.span),
|
||||
),
|
||||
],
|
||||
})),
|
||||
@@ -59,8 +59,8 @@ impl Functionish {
|
||||
Value::String("".to_string()),
|
||||
),
|
||||
(
|
||||
Value::String("hash".to_string()),
|
||||
source_hash_asm(source, arrow.span),
|
||||
Value::String("srcHash".to_string()),
|
||||
src_hash_asm(source, arrow.span),
|
||||
),
|
||||
],
|
||||
})),
|
||||
|
||||
@@ -17,7 +17,7 @@ mod optimization;
|
||||
mod resolve_path;
|
||||
mod scope;
|
||||
mod scope_analysis;
|
||||
mod source_hash;
|
||||
mod src_hash;
|
||||
mod static_expression_compiler;
|
||||
mod target_accessor;
|
||||
mod visit_pointers;
|
||||
|
||||
@@ -3,7 +3,7 @@ use tiny_keccak::{Hasher, Keccak};
|
||||
|
||||
use crate::asm::Value;
|
||||
|
||||
pub fn source_hash(source: &str, span: swc_common::Span) -> [u8; 32] {
|
||||
pub fn src_hash(source: &str, span: swc_common::Span) -> [u8; 32] {
|
||||
let BytePos(start) = span.lo;
|
||||
let BytePos(end) = span.hi;
|
||||
|
||||
@@ -21,11 +21,11 @@ pub fn source_hash(source: &str, span: swc_common::Span) -> [u8; 32] {
|
||||
output
|
||||
}
|
||||
|
||||
pub fn source_hash_asm(source: &str, span: swc_common::Span) -> Value {
|
||||
pub fn src_hash_asm(source: &str, span: swc_common::Span) -> Value {
|
||||
let mut result = String::with_capacity(66);
|
||||
result.push_str("0x");
|
||||
|
||||
for byte in &source_hash(source, span) {
|
||||
for byte in &src_hash(source, span) {
|
||||
result.push_str(&format!("{:02x}", byte));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user