<commit_before><?php


class Less_Tree_MixinCall extends Less_Tree{

	public $selector;
	public $arguments;
	private $index;
	private $currentFileInfo;

	public $important;

	/**
	 * less.js: tree.mixin.Call
	 *
	 */
	public function __construct($elements, $args, $index, $currentFileInfo, $important = false){
		$this->selector = new Less_Tree_Selector($elements);
		$this->arguments = $args;
		$this->index = $index;
		$this->currentFileInfo = $currentFileInfo;
		$this->important = $important;
	}

	function accept($visitor){
		$this->selector = $visitor->visit($this->selector);
		$this->arguments = $visitor->visit($this->arguments);
	}


	/**
	 * less.js: tree.mixin.Call.prototype()
	 *
	 */
	public function compile($env){

		$rules = array();
		$match = false;
		$isOneFound = false;

		$args = array();
		foreach($this->arguments as $a){
			$args[] = array('name'=> $a['name'], 'value' => $a['value']->compile($env) );
		}

		for($i = 0; $i< count($env->frames); $i++){

			$mixins = $env->frames[$i]->find($this->selector, null, $env);

			if( !$mixins ){
				continue;
			}

			$isOneFound = true;
			for( $m = 0; $m < count($mixins); $m++ ){
				$mixin = $mixins[$m];

				$isRecursive = false;
				foreach($env->frames as $recur_frame){
					if( !($mixin instanceof Less_Tree_MixinDefinition) ){
						if( (isset($recur_frame->originalRuleset) && $mixin === $recur_frame->originalRuleset) || ($mixin === $recur_frame) ){
							$isRecursive = true;
							break;
						}
					}
				}
				if( $isRecursive ){
					continue;
				}

				if ($mixin->matchArgs($args, $env)) {
					if( !Less_Parser::is_method($mixin,'matchCondition') || $mixin->matchCondition($args, $env) ){
						try{

							if( !($mixin instanceof Less_Tree_MixinDefinition) ){
								$mixin = new Less_Tree_MixinDefinition('', array(), $mixin->rules, null, false);
								if( property_exists($mixins[$m],'originalRuleset') && $mixins[$m]->originalRuleset ){
									$mixin->originalRuleset = $mixins[$m]->originalRuleset;
								}else{
									$mixin->originalRuleset = $mixins[$m];
								}
							}
							//if (this.important) {
							//	isImportant = env.isImportant;
							//	env.isImportant = true;
							//}

							$rules = array_merge($rules, $mixin->compile($env, $args, $this->important)->rules);
							//if (this.important) {
							//	env.isImportant = isImportant;
							//}
						} catch (Exception $e) {
							//throw new Less_CompilerException($e->getMessage(), $e->index, null, $this->currentFileInfo['filename']);
							throw new Less_CompilerException($e->getMessage(), null, null, $this->currentFileInfo['filename']);
						}
					}
					$match = true;
				}

			}

			if( $match ){
				if( !$this->currentFileInfo || !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] ){
					for( $i = 0; $i < count($rules); $i++ ){
						$rule = $rules[$i];
						if( Less_Parser::is_method($rule,'markReferenced') ){<commit_msg>foreach() in mixin_call<commit_after><?php


class Less_Tree_MixinCall extends Less_Tree{

	public $selector;
	public $arguments;
	private $index;
	private $currentFileInfo;

	public $important;

	/**
	 * less.js: tree.mixin.Call
	 *
	 */
	public function __construct($elements, $args, $index, $currentFileInfo, $important = false){
		$this->selector = new Less_Tree_Selector($elements);
		$this->arguments = $args;
		$this->index = $index;
		$this->currentFileInfo = $currentFileInfo;
		$this->important = $important;
	}

	function accept($visitor){
		$this->selector = $visitor->visit($this->selector);
		$this->arguments = $visitor->visit($this->arguments);
	}


	/**
	 * less.js: tree.mixin.Call.prototype()
	 *
	 */
	public function compile($env){

		$rules = array();
		$match = false;
		$isOneFound = false;

		$args = array();
		foreach($this->arguments as $a){
			$args[] = array('name'=> $a['name'], 'value' => $a['value']->compile($env) );
		}

		foreach($env->frames as $frame){
			$mixins = $frame->find($this->selector, null, $env);

			if( !$mixins ){
				continue;
			}

			$isOneFound = true;
			for( $m = 0; $m < count($mixins); $m++ ){
				$mixin = $mixins[$m];

				$isRecursive = false;
				foreach($env->frames as $recur_frame){
					if( !($mixin instanceof Less_Tree_MixinDefinition) ){
						if( (isset($recur_frame->originalRuleset) && $mixin === $recur_frame->originalRuleset) || ($mixin === $recur_frame) ){
							$isRecursive = true;
							break;
						}
					}
				}
				if( $isRecursive ){
					continue;
				}

				if ($mixin->matchArgs($args, $env)) {
					if( !Less_Parser::is_method($mixin,'matchCondition') || $mixin->matchCondition($args, $env) ){
						try{

							if( !($mixin instanceof Less_Tree_MixinDefinition) ){
								$mixin = new Less_Tree_MixinDefinition('', array(), $mixin->rules, null, false);
								if( property_exists($mixins[$m],'originalRuleset') && $mixins[$m]->originalRuleset ){
									$mixin->originalRuleset = $mixins[$m]->originalRuleset;
								}else{
									$mixin->originalRuleset = $mixins[$m];
								}
							}
							//if (this.important) {
							//	isImportant = env.isImportant;
							//	env.isImportant = true;
							//}

							$rules = array_merge($rules, $mixin->compile($env, $args, $this->important)->rules);
							//if (this.important) {
							//	env.isImportant = isImportant;
							//}
						} catch (Exception $e) {
							//throw new Less_CompilerException($e->getMessage(), $e->index, null, $this->currentFileInfo['filename']);
							throw new Less_CompilerException($e->getMessage(), null, null, $this->currentFileInfo['filename']);
						}
					}
					$match = true;
				}

			}

			if( $match ){
				if( !$this->currentFileInfo || !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] ){
					foreach($rules as $rule){
						if( Less_Parser::is_method($rule,'markReferenced') ){
{'fraction_non_alphanumeric': 0.19131914893617022, 'fraction_numerical': 0.0006808510638297873, 'mean_word_length': 3.2672476397966594, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 82, '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': '3801713', 'n_tokens_mistral': 2499, 'n_tokens_neox': 1954, 'n_words': 357}