Skip to content

Commit

Permalink
green
Browse files Browse the repository at this point in the history
  • Loading branch information
imaman committed Nov 13, 2024
1 parent 9fb6d6d commit fb814a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/septima-lang/src/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import crypto from 'crypto'

import { AstNode, show, Unit, UnitId } from './ast-node'
import { extractMessage } from './extract-message'
import { failMe } from './fail-me'
Expand Down Expand Up @@ -97,6 +99,7 @@ export class Runtime {
})

const parse = Value.foreign(o => JSON.parse(o.toString()))
const hash = Value.foreign(o => crypto.createHash('sha224').update(JSON.stringify(o.unwrap())).digest('hex'))

let lib = new SymbolFrame('Object', { destination: Value.obj({ keys, entries, fromEntries }) }, empty, 'INTERNAL')
lib = new SymbolFrame('String', { destination: Value.foreign(o => Value.str(o.toString())) }, lib, 'INTERNAL')
Expand All @@ -105,6 +108,7 @@ export class Runtime {
lib = new SymbolFrame('Array', { destination: Value.obj({ isArray }) }, lib, 'INTERNAL')
lib = new SymbolFrame('console', { destination: Value.obj({ log }) }, lib, 'INTERNAL')
lib = new SymbolFrame('JSON', { destination: Value.obj({ parse }) }, lib, 'INTERNAL')
lib = new SymbolFrame('crypto', { destination: Value.obj({ hash }) }, lib, 'INTERNAL')

if (generateTheArgsObject) {
lib = new SymbolFrame('args', { destination: Value.from(this.args) }, lib, 'INTERNAL')
Expand Down

0 comments on commit fb814a0

Please sign in to comment.