Skip to content

Commit

Permalink
feat: in-built exit function (#72)
Browse files Browse the repository at this point in the history
* removed todo.md

* feat: exiting kin while it's running
  • Loading branch information
pacifiquem authored Mar 3, 2024
1 parent f1372ca commit 4a8d9fb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
11 changes: 9 additions & 2 deletions src/runtime/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import {
unlinkSync as deleteFileSync,
} from 'fs';
import path from 'path';
import { Runtime } from 'inspector';
import { NumericLiteral } from '../parser/ast';

export function createGlobalEnv(filename: string): Environment {
const env = new Environment();
Expand Down Expand Up @@ -88,6 +86,15 @@ export function createGlobalEnv(filename: string): Environment {
true,
);

env.declareVar(
'hagarara',
MK_NATIVE_FN((args) => {
const exit_code = (args[0] as NumberVal).value;
process.exit(exit_code);
}),
true,
);

// Kin mathematics utility functions
env.declareVar(
'KIN_IMIBARE',
Expand Down
13 changes: 0 additions & 13 deletions todo.md

This file was deleted.

0 comments on commit 4a8d9fb

Please sign in to comment.