From 9242e8bc9b91af3daef31d5da6270b910bdc86d3 Mon Sep 17 00:00:00 2001 From: MURANGWA Pacifique Date: Sun, 3 Mar 2024 17:06:35 +0200 Subject: [PATCH] feat: exiting kin while it's running --- src/runtime/globals.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/runtime/globals.ts b/src/runtime/globals.ts index 8992ce6..b581b6f 100644 --- a/src/runtime/globals.ts +++ b/src/runtime/globals.ts @@ -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(); @@ -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',