<commit_before><?php


class Less_Tree_Selector extends Less_Tree{

	public $elements;
	public $extendList = array();
	private $_css;
	public $index;

	public function __construct($elements, $extendList=array() , $condition = null, $index=null, $currentFileInfo=array(), $isReferenced=null ){
		$this->elements = $elements;
		$this->extendList = $extendList;
		$this->condition = $condition;
		$this->currentFileInfo = $currentFileInfo;
		$this->isReferenced = $isReferenced;
		if( !$condition ){
			$this->evaldCondition = true;
		}
	}

	function accept($visitor) {
		$this->elements = $visitor->visit($this->elements);
		$this->extendList = $visitor->visit($this->extendList);
		$this->condition = $visitor->visit($this->condition);
	}

	function createDerived( $elements, $extendList, $evaldCondition ){
		$evaldCondition = $evaldCondition != null ? $evaldCondition : $this->evaldCondition;
		$newSelector = new Less_Tree_Selector( $elements, ($extendList ? $extendList : $this->extendList), $this->condition, $this->index, $this->currentFileInfo, $this->isReferenced);
		$newSelector->evaldCondition = $evaldCondition;
		return $newSelector;
	}

	public function match($other) {
		global $debug;
		$len   = count($this->elements);

		$olen = $offset = 0;
		if( $other && count($other->elements) ){

			if( $other->elements[0]->value === "&" ){
				$offset = 1;
			}
			$olen = count($other->elements) - $offset;
		}

		if( $olen === 0 || $len < $olen ){
			return 0;
		}

		$max = min($len, $olen);

		for ($i = 0; $i < $max; $i ++) {
			if ($this->elements[$i]->value !== $other->elements[$i + $offset]->value) {
				return 0;
			}
		}

		return $max; // return number of matched selectors
	}

	public function compile($env) {

		$elements = array();
		for( $i = 0, $len = count($this->elements); $i < $len; $i++){
			$elements[] = $this->elements[$i]->compile($env);
		}

		$extendList = array();
		for($i = 0, $len = count($this->extendList); $i < $len; $i++){
			$extendList[] = $this->extendList[$i]->compile($this->extendList[$i]);
		}

		$evaldCondition = false;
		if( $this->condition ){
			$evaldCondition = $this->condition->compile($env);
		}

		return $this->createDerived( $elements, $extendList, $evaldCondition );
	}

	function genCSS( $env, &$strs ){

		if( (!$env || !property_exists($env,'firstSelector') || !$env->firstSelector) && $this->elements[0]->combinator->value === "" ){
			self::OutputAdd( $strs, ' ', $this->currentFileInfo, $this->index );
		}
		if( !$this->_css ){
			//TODO caching? speed comparison?
			for($i = 0; $i < count($this->elements); $i++ ){
				$element = $this->elements[$i];
				$element->genCSS( $env, $strs );
			}
		}
	}

	function markReferenced(){
		$this->isReferenced = true;
	}

	function getIsReferenced(){
		return !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] || $this->isReferenced;
	}

	function getIsOutput(){
		return $this->evaldCondition;
	}

}
<commit_msg>createDerived() argument defaults<commit_after><?php


class Less_Tree_Selector extends Less_Tree{

	public $elements;
	public $extendList = array();
	private $_css;
	public $index;

	public function __construct($elements, $extendList=array() , $condition = null, $index=null, $currentFileInfo=array(), $isReferenced=null ){
		$this->elements = $elements;
		$this->extendList = $extendList;
		$this->condition = $condition;
		$this->currentFileInfo = $currentFileInfo;
		$this->isReferenced = $isReferenced;
		if( !$condition ){
			$this->evaldCondition = true;
		}
	}

	function accept($visitor) {
		$this->elements = $visitor->visit($this->elements);
		$this->extendList = $visitor->visit($this->extendList);
		$this->condition = $visitor->visit($this->condition);
	}

	function createDerived( $elements, $extendList = null, $evaldCondition = null ){
		$evaldCondition = $evaldCondition != null ? $evaldCondition : $this->evaldCondition;
		$newSelector = new Less_Tree_Selector( $elements, ($extendList ? $extendList : $this->extendList), $this->condition, $this->index, $this->currentFileInfo, $this->isReferenced);
		$newSelector->evaldCondition = $evaldCondition;
		return $newSelector;
	}

	public function match($other) {
		global $debug;
		$len   = count($this->elements);

		$olen = $offset = 0;
		if( $other && count($other->elements) ){

			if( $other->elements[0]->value === "&" ){
				$offset = 1;
			}
			$olen = count($other->elements) - $offset;
		}

		if( $olen === 0 || $len < $olen ){
			return 0;
		}

		$max = min($len, $olen);

		for ($i = 0; $i < $max; $i ++) {
			if ($this->elements[$i]->value !== $other->elements[$i + $offset]->value) {
				return 0;
			}
		}

		return $max; // return number of matched selectors
	}

	public function compile($env) {

		$elements = array();
		for( $i = 0, $len = count($this->elements); $i < $len; $i++){
			$elements[] = $this->elements[$i]->compile($env);
		}

		$extendList = array();
		for($i = 0, $len = count($this->extendList); $i < $len; $i++){
			$extendList[] = $this->extendList[$i]->compile($this->extendList[$i]);
		}

		$evaldCondition = false;
		if( $this->condition ){
			$evaldCondition = $this->condition->compile($env);
		}

		return $this->createDerived( $elements, $extendList, $evaldCondition );
	}

	function genCSS( $env, &$strs ){

		if( (!$env || !property_exists($env,'firstSelector') || !$env->firstSelector) && $this->elements[0]->combinator->value === "" ){
			self::OutputAdd( $strs, ' ', $this->currentFileInfo, $this->index );
		}
		if( !$this->_css ){
			//TODO caching? speed comparison?
			for($i = 0; $i < count($this->elements); $i++ ){
				$element = $this->elements[$i];
				$element->genCSS( $env, $strs );
			}
		}
	}

	function markReferenced(){
		$this->isReferenced = true;
	}

	function getIsReferenced(){
		return !isset($this->currentFileInfo['reference']) || !$this->currentFileInfo['reference'] || $this->isReferenced;
	}

	function getIsOutput(){
		return $this->evaldCondition;
	}

}

{'fraction_non_alphanumeric': 0.20302013422818793, 'fraction_numerical': 0.003691275167785235, 'mean_word_length': 4.327077747989276, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 117, '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': '3919575', 'n_tokens_mistral': 2256, 'n_tokens_neox': 2006, 'n_words': 402}