lib/compiler/rewriter.js
function(token,i,tokens) {
		
		var type = token._type;
		
		if (!seenSingle && token.fromThen) {
			return true;
		};
		
		var ifelse = type == 'IF' || type == 'UNLESS' || type == 'ELSE';
		
		if (ifelse || type === 'CATCH') {
			seenSingle = true;
		};
		
		if (ifelse || type === 'SWITCH' || type == 'TRY') {
			seenControl = true;
		};
		
		var prev = self.tokenType(i - 1);
		
		if ((type == '.' || type == '?.' || type == '::') && prev === OUTDENT) {
			return true;
		};
		
		if (endCallAtTerminator && (type === INDENT || type === TERMINATOR)) {
			return true;
		};
		
		if ((type == 'WHEN' || type == 'BY') && !seenFor) {
			// console.log "dont close implicit call outside for"
			return false;
		};
		
		var post = (tokens.length > (i + 1)) ? tokens[i + 1] : null;
		var postTyp = post && post._type;
		
		if (token.generated || prev === ',') {
			return false;
		};
		
		var cond1 = (IMPLICIT_END_MAP[type] || (type == INDENT && !seenControl) || (type == 'DOS' && prev != '='));
		
		if (!cond1) {
			return false;
		};
		
		if (type !== INDENT) {
			return true;
		};
		
		if (!IMPLICIT_BLOCK_MAP[prev] && self.tokenType(i - 2) != 'CLASS' && !(post && ((post.generated && postTyp == '{') || IMPLICIT_CALL_MAP[postTyp]))) {
			return true;
		};
		
		return false;
	}
function(token,i,tokens) {
		
		var type = token._type;
		
		if (!seenSingle && token.fromThen) {
			return true;
		};
		
		var ifelse = type == 'IF' || type == 'UNLESS' || type == 'ELSE';
		
		if (ifelse || type === 'CATCH') {
			seenSingle = true;
		};
		
		if (ifelse || type === 'SWITCH' || type == 'TRY') {
			seenControl = true;
		};
		
		var prev = self.tokenType(i - 1);
		
		if ((type == '.' || type == '?.' || type == '::') && prev === OUTDENT) {
			return true;
		};
		
		if (endCallAtTerminator && (type === INDENT || type === TERMINATOR)) {
			return true;
		};
		
		if ((type == 'WHEN' || type == 'BY') && !seenFor) {
			// console.log "dont close implicit call outside for"
			return false;
		};
		
		var post = (tokens.length > (i + 1)) ? tokens[i + 1] : null;
		var postTyp = post && post._type;
		
		if (token.generated || prev === ',') {
			return false;
		};
		
		var cond1 = (IMPLICIT_END_MAP[type] || (type == INDENT && !seenControl) || (type == 'DOS' && prev != '='));
		
		if (!cond1) {
			return false;
		};
		
		if (type !== INDENT) {
			return true;
		};
		
		if (!IMPLICIT_BLOCK_MAP[prev] && self.tokenType(i - 2) != 'CLASS' && !(post && ((post.generated && postTyp == '{') || IMPLICIT_CALL_MAP[postTyp]))) {
			return true;
		};
		
		return false;
	}
function ( token , i , tokens ) { var type = token . _type ; if ( ! seenSingle && token . fromThen ) { return true ; } ; var ifelse = type == 'IF' || type == 'UNLESS' || type == 'ELSE' ; if ( ifelse || type === 'CATCH' ) { seenSingle = true ; } ; if ( ifelse || type === 'SWITCH' || type == 'TRY' ) { seenControl = true ; } ; var prev = self . tokenType ( i - 1 ) ; if ( ( type == '.' || type == '?.' || type == '::' ) && prev === OUTDENT ) { return true ; } ; if ( endCallAtTerminator && ( type === INDENT || type === TERMINATOR ) ) { return true ; } ; if ( ( type == 'WHEN' || type == 'BY' ) && ! seenFor ) { // console.log "dont close implicit call outside for" return false ; } ; var post = ( tokens . length > ( i + 1 ) ) ? tokens [ i + 1 ] : null ; var postTyp = post && post . _type ; if ( token . generated || prev === ',' ) { return false ; } ; var cond1 = ( IMPLICIT_END_MAP [ type ] || ( type == INDENT && ! seenControl ) || ( type == 'DOS' && prev != '=' ) ) ; if ( ! cond1 ) { return false ; } ; if ( type !== INDENT ) { return true ; } ; if ( ! IMPLICIT_BLOCK_MAP [ prev ] && self . tokenType ( i - 2 ) != 'CLASS' && ! ( post && ( ( post . generated && postTyp == '{' ) || IMPLICIT_CALL_MAP [ postTyp ] ) ) ) { return true ; } ; return false ; }
function will not be optimized in single run could tro to move this out
function will not be optimized in single run could tro to move this out