Created
January 23, 2023 08:44
-
-
Save MarioAriasC/e721ac0c0b098cb9559d3e6375334df0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function eval_1($this, expression, env) { | |
var tmp0_subject = expression; | |
var tmp; | |
if (tmp0_subject instanceof Identifier) { | |
var value = env.te(expression.za_1); | |
var tmp_0; | |
if (value == null) { | |
var builtin = get_builtins().a2(expression.za_1); | |
tmp_0 = builtin == null ? new MError('identifier not found: ' + expression.za_1) : builtin; | |
} else { | |
tmp_0 = value; | |
} | |
tmp = tmp_0; | |
} else { | |
if (tmp0_subject instanceof IntegerLiteral) { | |
tmp = new MInteger(expression.mb_1); | |
} else { | |
if (tmp0_subject instanceof InfixExpression) { | |
var tmp_1 = eval_1($this, expression.rb_1, env); | |
tmp = ifNotError(tmp_1, $this, Evaluator$eval$lambda(expression, env)); | |
} else { | |
if (tmp0_subject instanceof BlockStatement) { | |
tmp = evalBlockStatement($this, expression, env); | |
} else { | |
if (tmp0_subject instanceof ExpressionStatement) { | |
tmp = eval_1($this, expression.bb_1, env); | |
} else { | |
if (tmp0_subject instanceof IfExpression) { | |
var tmp_2 = eval_1($this, expression.xb_1, env); | |
tmp = ifNotError(tmp_2, $this, Evaluator$eval$lambda_0(expression, env)); | |
} else { | |
if (tmp0_subject instanceof CallExpression) { | |
var tmp_3 = eval_1($this, expression.bc_1, env); | |
tmp = ifNotError(tmp_3, $this, Evaluator$eval$lambda_1(expression, env)); | |
} else { | |
if (tmp0_subject instanceof ReturnStatement) { | |
var tmp_4 = eval_1($this, expression.db_1, env); | |
tmp = ifNotError(tmp_4, $this, Evaluator$eval$lambda_2); | |
} else { | |
if (tmp0_subject instanceof PrefixExpression) { | |
var tmp_5 = eval_1($this, expression.pb_1, env); | |
tmp = ifNotError(tmp_5, $this, Evaluator$eval$lambda_3(expression)); | |
} else { | |
if (tmp0_subject instanceof BooleanLiteral) { | |
tmp = toMonkey(expression.mb_1, $this); | |
} else { | |
if (tmp0_subject instanceof LetStatement) { | |
var tmp_6 = eval_1($this, expression.kb_1, env); | |
tmp = ifNotError(tmp_6, $this, Evaluator$eval$lambda_4(env, expression)); | |
} else { | |
if (tmp0_subject instanceof FunctionLiteral) { | |
tmp = new MFunction(expression.fb_1, expression.gb_1, env); | |
} else { | |
if (tmp0_subject instanceof StringLiteral) { | |
tmp = new MString(expression.za_1); | |
} else { | |
if (tmp0_subject instanceof ArrayLiteral) { | |
var elements = evalExpressions($this, expression.xa_1, env); | |
var tmp_7; | |
if (elements.i() === 1 ? isError(first(elements), $this) : false) { | |
tmp_7 = first(elements); | |
} else { | |
tmp_7 = new MArray(elements); | |
} | |
tmp = tmp_7; | |
} else { | |
if (tmp0_subject instanceof IndexExpression) { | |
tmp = eval_0($this, expression, env); | |
} else { | |
if (tmp0_subject instanceof HashLiteral) { | |
var tmp$ret$0; | |
// Inline function 'kotlin.collections.mutableMapOf' call | |
tmp$ret$0 = LinkedHashMap_init_$Create$(); | |
var pairs = tmp$ret$0; | |
// Inline function 'kotlin.collections.forEach' call | |
var tmp0_forEach = expression.sa_1; | |
var tmp$ret$1; | |
// Inline function 'kotlin.collections.iterator' call | |
tmp$ret$1 = tmp0_forEach.m1().q(); | |
var tmp0_iterator = tmp$ret$1; | |
while (tmp0_iterator.k()) { | |
var element = tmp0_iterator.l(); | |
// Inline function 'org.marioarias.monkey.evaluator.Evaluator.eval.<anonymous>' call | |
var tmp$ret$2; | |
// Inline function 'kotlin.collections.component1' call | |
tmp$ret$2 = element.j1(); | |
var keyNode = tmp$ret$2; | |
var tmp$ret$3; | |
// Inline function 'kotlin.collections.component2' call | |
tmp$ret$3 = element.l1(); | |
var valueNode = tmp$ret$3; | |
var key = eval_1(Evaluator_getInstance(), keyNode, env); | |
if (isError(key, Evaluator_getInstance())) { | |
return key; | |
} | |
var tmp0_subject_0 = key; | |
if (!(tmp0_subject_0 == null) ? isInterface(tmp0_subject_0, Hashable) : false) { | |
var value_0 = eval_1(Evaluator_getInstance(), valueNode, env); | |
if (isError(value_0, Evaluator_getInstance())) { | |
return value_0; | |
} | |
// Inline function 'kotlin.collections.set' call | |
var tmp0_set = key.ue(); | |
var tmp1_set = new HashPair(key, ensureNotNull(value_0)); | |
pairs.p2(tmp0_set, tmp1_set); | |
} else { | |
return new MError('unusable as hash key: ' + typeDesc(key)); | |
} | |
} | |
tmp = new MHash(pairs); | |
} else { | |
tmp = null; | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
return tmp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment