<commit_before>/*
 *  Global built-ins
 */

#include "duk_internal.h"

int duk_builtin_global_object_eval(duk_context *ctx) {
	duk_hthread *thr = (duk_hthread *) ctx;
	duk_hstring *h;
	duk_activation *act;
	duk_hcompiledfunction *func;
	duk_hobject *outer_lex_env;
	duk_hobject *outer_var_env;

	DUK_ASSERT(duk_get_top(ctx) == 1);
	DUK_ASSERT(thr->callstack_top >= 1);

	h = duk_get_hstring(ctx, 0);
	if (!h) {
		return 1;  /* return arg as-is */
	}

	/* FIXME: uses internal API */
	duk_js_compile_program(thr, 1 /*is_eval*/);
	func = (duk_hcompiledfunction *) duk_get_hobject(ctx, -1);
	DUK_ASSERT(func != NULL);
	DUK_ASSERT(DUK_HOBJECT_IS_COMPILEDFUNCTION((duk_hobject *) func));

	DUK_ASSERT(thr->callstack_top >= 1);
	act = thr->callstack + thr->callstack_top - 1;
	if (act->flags & DUK_ACT_FLAG_DIRECT_EVAL) {
		is_direct_eval = 1;
		if (DUK_HOBJECT_HAS_STRICT((duk_hobject *) func)) {
			DUK_DDDPRINT("direct eval call to a strict function");
		} else {
			DUK_DDDPRINT("direct eval call to a non-strict function");
		}

		/* FIXME: env handling is incorrect, fix */

		DUK_DDDPRINT("FIXME: no direct eval call handling now - behave like indirect eval");
		outer_lex_env = thr->builtins[DUK_BIDX_GLOBAL_ENV];
		outer_var_env = thr->builtins[DUK_BIDX_GLOBAL_ENV];
	} else {
		DUK_DDDPRINT("indirect eval call");<commit_msg>trivial compile fix (remove unnecessary assignment)<commit_after>/*
 *  Global built-ins
 */

#include "duk_internal.h"

int duk_builtin_global_object_eval(duk_context *ctx) {
	duk_hthread *thr = (duk_hthread *) ctx;
	duk_hstring *h;
	duk_activation *act;
	duk_hcompiledfunction *func;
	duk_hobject *outer_lex_env;
	duk_hobject *outer_var_env;

	DUK_ASSERT(duk_get_top(ctx) == 1);
	DUK_ASSERT(thr->callstack_top >= 1);

	h = duk_get_hstring(ctx, 0);
	if (!h) {
		return 1;  /* return arg as-is */
	}

	/* FIXME: uses internal API */
	duk_js_compile_program(thr, 1 /*is_eval*/);
	func = (duk_hcompiledfunction *) duk_get_hobject(ctx, -1);
	DUK_ASSERT(func != NULL);
	DUK_ASSERT(DUK_HOBJECT_IS_COMPILEDFUNCTION((duk_hobject *) func));

	DUK_ASSERT(thr->callstack_top >= 1);
	act = thr->callstack + thr->callstack_top - 1;
	if (act->flags & DUK_ACT_FLAG_DIRECT_EVAL) {
		if (DUK_HOBJECT_HAS_STRICT((duk_hobject *) func)) {
			DUK_DDDPRINT("direct eval call to a strict function");
		} else {
			DUK_DDDPRINT("direct eval call to a non-strict function");
		}

		/* FIXME: env handling is incorrect, fix */

		DUK_DDDPRINT("FIXME: no direct eval call handling now - behave like indirect eval");
		outer_lex_env = thr->builtins[DUK_BIDX_GLOBAL_ENV];
		outer_var_env = thr->builtins[DUK_BIDX_GLOBAL_ENV];
	} else {
		DUK_DDDPRINT("indirect eval call");
{'fraction_non_alphanumeric': 0.13089005235602094, 'fraction_numerical': 0.006357516828721017, 'mean_word_length': 4.984340044742729, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3592703', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1078, 'n_words': 212}