lib/packages/core.js
function() {

		if (this._is_refreshing) {
			Lava.logError("ScopeManager: recursive call to ScopeManager#refresh()");
			return;
		}

		var count_refresh_cycles = 0,
			count_levels = this._scope_refresh_queues.length;

		if (count_levels == 0) {

			return;

		}

		this._is_refreshing = true;

		this._has_exceptions = false;
		this._refresh_id++;

		// find the first existent queue
		while (this._min_scope_refresh_level < count_levels) {

			if (this._min_scope_refresh_level in this._scope_refresh_queues) {

				break;

			}

			this._min_scope_refresh_level++;

		}

		if (this._min_scope_refresh_level < count_levels) {

			while (this._scopeRefreshCycle()) {

				count_refresh_cycles++;

			}

		}

		this._scopeMalfunctionCycle();

		if (this._has_exceptions) {

			this._scope_refresh_queues = this._preserveScopeRefreshQueues();

		} else {

			Lava.schema.DEBUG && this.debugVerify();
			this._scope_refresh_queues = [];

		}

		this._scope_refresh_current_indices = [];

		if (this.statistics.max_refresh_cycles < count_refresh_cycles) {

			this.statistics.max_refresh_cycles = count_refresh_cycles;

		}

		this._has_infinite_loop = this._has_exceptions;

		this._is_refreshing = false;

	}
function() {

		if (this._is_refreshing) {
			Lava.logError("ScopeManager: recursive call to ScopeManager#refresh()");
			return;
		}

		var count_refresh_cycles = 0,
			count_levels = this._scope_refresh_queues.length;

		if (count_levels == 0) {

			return;

		}

		this._is_refreshing = true;

		this._has_exceptions = false;
		this._refresh_id++;

		// find the first existent queue
		while (this._min_scope_refresh_level < count_levels) {

			if (this._min_scope_refresh_level in this._scope_refresh_queues) {

				break;

			}

			this._min_scope_refresh_level++;

		}

		if (this._min_scope_refresh_level < count_levels) {

			while (this._scopeRefreshCycle()) {

				count_refresh_cycles++;

			}

		}

		this._scopeMalfunctionCycle();

		if (this._has_exceptions) {

			this._scope_refresh_queues = this._preserveScopeRefreshQueues();

		} else {

			Lava.schema.DEBUG && this.debugVerify();
			this._scope_refresh_queues = [];

		}

		this._scope_refresh_current_indices = [];

		if (this.statistics.max_refresh_cycles < count_refresh_cycles) {

			this.statistics.max_refresh_cycles = count_refresh_cycles;

		}

		this._has_infinite_loop = this._has_exceptions;

		this._is_refreshing = false;

	}
function ( ) { if ( this . _is_refreshing ) { Lava . logError ( "ScopeManager: recursive call to ScopeManager#refresh()" ) ; return ; } var count_refresh_cycles = 0 , count_levels = this . _scope_refresh_queues . length ; if ( count_levels == 0 ) { return ; } this . _is_refreshing = true ; this . _has_exceptions = false ; this . _refresh_id ++ ; // find the first existent queue while ( this . _min_scope_refresh_level < count_levels ) { if ( this . _min_scope_refresh_level in this . _scope_refresh_queues ) { break ; } this . _min_scope_refresh_level ++ ; } if ( this . _min_scope_refresh_level < count_levels ) { while ( this . _scopeRefreshCycle ( ) ) { count_refresh_cycles ++ ; } } this . _scopeMalfunctionCycle ( ) ; if ( this . _has_exceptions ) { this . _scope_refresh_queues = this . _preserveScopeRefreshQueues ( ) ; } else { Lava . schema . DEBUG && this . debugVerify ( ) ; this . _scope_refresh_queues = [ ] ; } this . _scope_refresh_current_indices = [ ] ; if ( this . statistics . max_refresh_cycles < count_refresh_cycles ) { this . statistics . max_refresh_cycles = count_refresh_cycles ; } this . _has_infinite_loop = this . _has_exceptions ; this . _is_refreshing = false ; }
The main refresh loop
The main refresh loop