<commit_before>/// <reference path="../definitions/definitions.d.ts"/>
/// <reference path="../definitions/api.d.ts"/>

export class Token<T> {
	surrogate: T;
	
	static getDebugName(): string {		
		return this.name;
	}
}

function createInlineToken<T>(): Syringe.IToken<T> {
	// Until TypeScript allows class expressions
	
	function InlineToken() {
		Token.apply(this, arguments);
	}
	
	InlineToken.prototype = Object.create(Token.prototype);
	
	return <any>InlineToken;
}

export function Lazy<T>(token: Syringe.IToken<T>): Syringe.IToken<Syringe.ILazy<T>> {
	if (!token['___lazyToken']) {
		token['___lazyToken'] = createInlineToken<Syringe.ILazy<T>>();
	}
	
	return token['___lazyToken'];
}<commit_msg>adds fallback token name for envs lacking Function#name<commit_after>/// <reference path="../definitions/definitions.d.ts"/>
/// <reference path="../definitions/api.d.ts"/>

// For envs that lack Function#name
const FALLBACK_TOKEN_DEBUG_NAME = 'Token';

export class Token<T> {
	surrogate: T;
	
	static getDebugName(): string {		
		return this.name || FALLBACK_TOKEN_DEBUG_NAME;
	}
}

function createInlineToken<T>(): Syringe.IToken<T> {
	// Until TypeScript allows class expressions
	
	function InlineToken() {
		Token.apply(this, arguments);
	}
	
	InlineToken.prototype = Object.create(Token.prototype);
	
	return <any>InlineToken;
}

export function Lazy<T>(token: Syringe.IToken<T>): Syringe.IToken<Syringe.ILazy<T>> {
	if (!token['___lazyToken']) {
		token['___lazyToken'] = createInlineToken<Syringe.ILazy<T>>();
	}
	
	return token['___lazyToken'];
}
{'fraction_non_alphanumeric': 0.16143497757847533, 'fraction_numerical': 0.0, 'mean_word_length': 4.8943396226415095, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '3250309', 'n_tokens_mistral': 551, 'n_tokens_neox': 529, 'n_words': 100}