src/language/JSUtils.js
function _shouldGetFromCache(fileInfo) {
        var result = new $.Deferred(),
            isChanged = _changedDocumentTracker.isPathChanged(fileInfo.fullPath);

        if (isChanged && fileInfo.JSUtils) {
            // See if it's dirty and in the working set first
            var doc = DocumentManager.getOpenDocumentForPath(fileInfo.fullPath);

            if (doc && doc.isDirty) {
                result.resolve(false);
            } else {
                // If a cache exists, check the timestamp on disk
                var file = FileSystem.getFileForPath(fileInfo.fullPath);

                file.stat(function (err, stat) {
                    if (!err) {
                        result.resolve(fileInfo.JSUtils.timestamp.getTime() === stat.mtime.getTime());
                    } else {
                        result.reject(err);
                    }
                });
            }
        } else {
            // Use the cache if the file did not change and the cache exists
            result.resolve(!isChanged && fileInfo.JSUtils);
        }

        return result.promise();
    }
function _shouldGetFromCache(fileInfo) {
        var result = new $.Deferred(),
            isChanged = _changedDocumentTracker.isPathChanged(fileInfo.fullPath);

        if (isChanged && fileInfo.JSUtils) {
            // See if it's dirty and in the working set first
            var doc = DocumentManager.getOpenDocumentForPath(fileInfo.fullPath);

            if (doc && doc.isDirty) {
                result.resolve(false);
            } else {
                // If a cache exists, check the timestamp on disk
                var file = FileSystem.getFileForPath(fileInfo.fullPath);

                file.stat(function (err, stat) {
                    if (!err) {
                        result.resolve(fileInfo.JSUtils.timestamp.getTime() === stat.mtime.getTime());
                    } else {
                        result.reject(err);
                    }
                });
            }
        } else {
            // Use the cache if the file did not change and the cache exists
            result.resolve(!isChanged && fileInfo.JSUtils);
        }

        return result.promise();
    }
function _shouldGetFromCache ( fileInfo ) { var result = new $ . Deferred ( ) , isChanged = _changedDocumentTracker . isPathChanged ( fileInfo . fullPath ) ; if ( isChanged && fileInfo . JSUtils ) { // See if it's dirty and in the working set first var doc = DocumentManager . getOpenDocumentForPath ( fileInfo . fullPath ) ; if ( doc && doc . isDirty ) { result . resolve ( false ) ; } else { // If a cache exists, check the timestamp on disk var file = FileSystem . getFileForPath ( fileInfo . fullPath ) ; file . stat ( function ( err , stat ) { if ( ! err ) { result . resolve ( fileInfo . JSUtils . timestamp . getTime ( ) === stat . mtime . getTime ( ) ) ; } else { result . reject ( err ) ; } } ) ; } } else { // Use the cache if the file did not change and the cache exists result . resolve ( ! isChanged && fileInfo . JSUtils ) ; } return result . promise ( ) ; }
Determines if the document function cache is up to date.
@param {FileInfo} fileInfo
@return {$.Promise} A promise resolved with true with true when a function cache is available for the document. Resolves
with false when there is no cache or the cache is stale.
Determines if the document function cache is up to date .