From d46b51fa9a469eb1be941bdc7e8fe237d77e840a Mon Sep 17 00:00:00 2001 From: Martin Carlberg Date: Mon, 26 Jun 2017 17:58:13 +0200 Subject: [PATCH] Fixed: In Rhino a function must be declared before it is used even if it is in the same scope. --- Objective-J/FileExecutable.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Objective-J/FileExecutable.js b/Objective-J/FileExecutable.js index ba110eacf..2fd4d88ac 100644 --- a/Objective-J/FileExecutable.js +++ b/Objective-J/FileExecutable.js @@ -79,16 +79,6 @@ var compile = function(self, fileContents, aURL, compilerOptions, aFilenameTrans var isAbsoluteURL = (includeURL instanceof CFURL) && includeURL.scheme(), compileWhenCompleted = NO; - if (isQuoted || isAbsoluteURL) - { - if (!isAbsoluteURL) - includeURL = new CFURL(includeURL, new CFURL((aFilenameTranslateDictionary[aURL.lastPathComponent()] || "."), referenceURL)); - - StaticResource.resolveResourceAtURL(includeURL, NO, completed); - } - else - StaticResource.resolveResourceAtURLSearchingIncludeURLs(includeURL, completed); - function completed(/*StaticResource*/ aStaticResource) { var includeString = aStaticResource && aStaticResource.contents(), lastCharacter = includeString && includeString.charCodeAt(includeString.length - 1); @@ -107,6 +97,16 @@ var compile = function(self, fileContents, aURL, compilerOptions, aFilenameTrans compile(self, fileContents, aURL, compilerOptions, aFilenameTranslateDictionary); } + if (isQuoted || isAbsoluteURL) + { + if (!isAbsoluteURL) + includeURL = new CFURL(includeURL, new CFURL((aFilenameTranslateDictionary[aURL.lastPathComponent()] || "."), referenceURL)); + + StaticResource.resolveResourceAtURL(includeURL, NO, completed); + } + else + StaticResource.resolveResourceAtURLSearchingIncludeURLs(includeURL, completed); + // Now we try to get the cached result again. If we get it then the completed function has already // executed and we can return the include dictionary. cachedResult = self.cachedIncludeFileSearchResultsContent[cacheUID];