<commit_before>"use strict";
/* @flow */

const Value = require('../Value');

let serial = 0;

//TODO: We should call this a PropertyDescriptor, not a variable.

class PropertyDescriptor {
	constructor(value) {
		this.value = value;
		this.serial = serial++;
		this.configurable = true;
		this.enumerable = true;
		this.writeable = true;
	}

	set(value) {
		if ( !this.writeable ) return;
		this.value = value;
	}

	*getValue(thiz) {
		thiz = thiz || Value.null;
		if ( this.getter ) {
			return yield * this.getter.call(thiz, []);
		}
		return this.value;
	}

	*setValue(thiz, to) {
		if ( !this.writeable ) return;
		thiz = thiz || Value.null;
		if ( this.getter ) {
			return yield * this.setter.call(thiz, [to]);
		}
		this.value = to;
		return this.value;
	}
}

module.exports = PropertyDescriptor;<commit_msg>Call setter even if object isn't writable.<commit_after>"use strict";
/* @flow */

const Value = require('../Value');

let serial = 0;

//TODO: We should call this a PropertyDescriptor, not a variable.

class PropertyDescriptor {
	constructor(value) {
		this.value = value;
		this.serial = serial++;
		this.configurable = true;
		this.enumerable = true;
		this.writeable = true;
	}

	set(value) {
		if ( !this.writeable ) return;
		this.value = value;
	}

	*getValue(thiz) {
		thiz = thiz || Value.null;
		if ( this.getter ) {
			return yield * this.getter.call(thiz, []);
		}
		return this.value;
	}

	*setValue(thiz, to) {
		thiz = thiz || Value.null;
		if ( this.getter ) {
			return yield * this.setter.call(thiz, [to]);
		}
		if ( !this.writeable ) return this.value;
		this.value = to;
		return this.value;
	}
}

module.exports = PropertyDescriptor;
{'fraction_non_alphanumeric': 0.15269461077844312, 'fraction_numerical': 0.0011976047904191617, 'mean_word_length': 3.2196969696969697, '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': '2342071', 'n_tokens_mistral': 658, 'n_tokens_neox': 605, 'n_words': 144}