<commit_before>package org.metaborg.runtime.task.primitives;

import static org.metaborg.runtime.task.util.ListBuilder.makeList;

import org.metaborg.runtime.task.Task;
import org.metaborg.runtime.task.TaskEngine;
import org.metaborg.runtime.task.TaskManager;
import org.spoofax.interpreter.core.IContext;
import org.spoofax.interpreter.core.InterpreterException;
import org.spoofax.interpreter.library.AbstractPrimitive;
import org.spoofax.interpreter.stratego.Strategy;
import org.spoofax.interpreter.terms.IStrategoTerm;

public class task_api_get_results_0_1 extends AbstractPrimitive {
	public static task_api_get_results_0_1 instance = new task_api_get_results_0_1();

	public task_api_get_results_0_1() {
		super("task_api_get_results", 0, 1);
	}

	@Override
	public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars) throws InterpreterException {
		final TaskEngine taskEngine = TaskManager.getInstance().getCurrent();
		final IStrategoTerm taskID = tvars[0];
		final Task task = taskEngine.getTask(taskID);
		if(!task.hasResults())
			return false;
		env.setCurrent(makeList(env.getFactory(), task.results()));<commit_msg>Fix task_api_get_results failing if task had no results, while this is actually fine.<commit_after>package org.metaborg.runtime.task.primitives;

import static org.metaborg.runtime.task.util.ListBuilder.makeList;

import org.metaborg.runtime.task.Task;
import org.metaborg.runtime.task.TaskEngine;
import org.metaborg.runtime.task.TaskManager;
import org.spoofax.interpreter.core.IContext;
import org.spoofax.interpreter.core.InterpreterException;
import org.spoofax.interpreter.library.AbstractPrimitive;
import org.spoofax.interpreter.stratego.Strategy;
import org.spoofax.interpreter.terms.IStrategoTerm;

public class task_api_get_results_0_1 extends AbstractPrimitive {
	public static task_api_get_results_0_1 instance = new task_api_get_results_0_1();

	public task_api_get_results_0_1() {
		super("task_api_get_results", 0, 1);
	}

	@Override
	public boolean call(IContext env, Strategy[] svars, IStrategoTerm[] tvars) throws InterpreterException {
		final TaskEngine taskEngine = TaskManager.getInstance().getCurrent();
		final IStrategoTerm taskID = tvars[0];
		final Task task = taskEngine.getTask(taskID);
		if(!task.solved())
			return false;
		env.setCurrent(makeList(env.getFactory(), task.results()));
{'fraction_non_alphanumeric': 0.10067681895093063, 'fraction_numerical': 0.009306260575296108, 'mean_word_length': 6.728758169934641, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1571799', 'n_tokens_mistral': 800, 'n_tokens_neox': 779, 'n_words': 141}