Skip to content

Commit

Permalink
fix(Compile): Move to using strings for hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Aug 31, 2021
1 parent 78371b8 commit 013c513
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions rust/src/methods/compile/mod.rs
Expand Up @@ -2,7 +2,7 @@ use crate::{
documents::DOCUMENTS,
graphs::{relations, resources, Relation, Resource, NULL_RANGE},
traits::ToVecBlockContent,
utils::{hash::str_sha256_bytes, path::merge, uuids},
utils::{hash::str_sha256_hex, path::merge, uuids},
};
use async_trait::async_trait;
use defaults::Defaults;
Expand Down Expand Up @@ -484,9 +484,9 @@ impl Compile for Parameter {
impl Compile for CodeChunk {
async fn compile(&mut self, context: &mut Context) -> Result<()> {
let digest =
str_sha256_bytes(&[self.text.as_str(), self.programming_language.as_str()].concat());
str_sha256_hex(&[self.text.as_str(), self.programming_language.as_str()].concat());

if Some(digest) != self.compile_digest {
if Some(digest.clone()) != self.compile_digest {
let id = identify!(self);
let subject = resources::node(&context.path, &id, &self.type_name());
let relations = code::compile(&context.path, &self.text, &self.programming_language);
Expand All @@ -502,9 +502,9 @@ impl Compile for CodeChunk {
impl Compile for CodeExpression {
async fn compile(&mut self, context: &mut Context) -> Result<()> {
let digest =
str_sha256_bytes(&[self.text.as_str(), self.programming_language.as_str()].concat());
str_sha256_hex(&[self.text.as_str(), self.programming_language.as_str()].concat());

if Some(digest) != self.compile_digest {
if Some(digest.clone()) != self.compile_digest {
let id = identify!(self);
let subject = resources::node(&context.path, &id, &self.type_name());
let relations = code::compile(&context.path, &self.text, &self.programming_language);
Expand All @@ -522,8 +522,7 @@ impl Compile for SoftwareSourceCode {
if let (Some(text), Some(programming_language)) =
(self.text.as_deref(), self.programming_language.as_deref())
{
let _digest =
str_sha256_bytes(&[text.as_str(), programming_language.as_str()].concat());
let _digest = str_sha256_hex(&[text.as_str(), programming_language.as_str()].concat());

let subject = resources::file(&context.path);
let relations = code::compile(&context.path, text, programming_language);
Expand Down

0 comments on commit 013c513

Please sign in to comment.