From aa146613ac61d8288da40fff752d00994284eee3 Mon Sep 17 00:00:00 2001 From: tlrobinson Date: Mon, 27 Apr 2009 19:31:36 -0700 Subject: [PATCH] Added missing "var"s to various parts of Objective-J --- Objective-J/constants.js | 8 +++----- Objective-J/evaluate.js | 1 + Objective-J/file.js | 21 +++++++++++---------- Objective-J/plist.js | 14 +++++++------- Objective-J/preprocess.js | 8 ++++---- Objective-J/runtime.js | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Objective-J/constants.js b/Objective-J/constants.js index cb7e1204c..dbaa46078 100644 --- a/Objective-J/constants.js +++ b/Objective-J/constants.js @@ -106,12 +106,10 @@ function objj_printf(string) } #if RHINO - -warning_stream = function (aString) { Packages.java.lang.System.out.println(aString) }; - +var warning_stream = function (aString) { Packages.java.lang.System.out.println(aString) }; #else if (window.console && window.console.warn) - warning_stream = function(aString) { window.console.warn(aString); } + var warning_stream = function(aString) { window.console.warn(aString); } else - warning_stream = function(){}; + var warning_stream = function(){}; #endif diff --git a/Objective-J/evaluate.js b/Objective-J/evaluate.js index 5834c7836..931b87e32 100644 --- a/Objective-J/evaluate.js +++ b/Objective-J/evaluate.js @@ -158,6 +158,7 @@ function fragment_evaluate_code(aFragment) try { #if RHINO + //compiled = eval("function(){"+GET_CODE(aFragment)+"}"); compiled = Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, "function(){"+GET_CODE(aFragment)+"}", GET_FILE(aFragment).path, 0, null); #else compiled = new Function(GET_CODE(aFragment)); diff --git a/Objective-J/file.js b/Objective-J/file.js index 78f58af4d..3b7ec863b 100644 --- a/Objective-J/file.js +++ b/Objective-J/file.js @@ -27,11 +27,11 @@ // Look inside bundleResponseCallback. -OBJJ_PLATFORMS = PLATFORMS +var OBJJ_PLATFORMS = PLATFORMS; #define DIRECTORY(aPath) (aPath).substr(0, (aPath).lastIndexOf('/') + 1) -OBJJFileNotFoundException = "OBJJFileNotFoundException"; -OBJJExecutableNotFoundException = "OBJJExecutableNotFoundException"; +var OBJJFileNotFoundException = "OBJJFileNotFoundException", + OBJJExecutableNotFoundException = "OBJJExecutableNotFoundException"; var objj_files = { }, objj_bundles = { }, @@ -169,7 +169,7 @@ objj_search.prototype.attemptNextSearchPath = function() // Before we kick off our ajax requests, see whether this directory already has // a bundle associated with it. - var infoPath = objj_standardize_path(DIRECTORY(searchPath) + "Info.plist") + var infoPath = objj_standardize_path(DIRECTORY(searchPath) + "Info.plist"), bundle = objj_bundles[infoPath]; // If there is, then simply look for the file in question. @@ -502,7 +502,7 @@ function objj_standardize_path(aPath) IF (ACTIVE_X) -objj_standardize_xml = function(aRequest) +var objj_standardize_xml = function(aRequest) { var XMLData = new ActiveXObject("Microsoft.XMLDOM"); XMLData.loadXML(aRequest.responseText.substr(aRequest.responseText.indexOf(".dtd\">") + 6)); @@ -512,7 +512,7 @@ objj_standardize_xml = function(aRequest) ELSE -objj_standardize_xml = function(aRequest) +var objj_standardize_xml = function(aRequest) { return aRequest.responseXML; } @@ -534,7 +534,7 @@ function objj_response_xmlhttp() IF (NATIVE_XMLHTTPREQUEST) -objj_request_xmlhttp = function() +var objj_request_xmlhttp = function() { return new XMLHttpRequest(); } @@ -563,7 +563,7 @@ var MSXML_XMLHTTP = MSXML_XMLHTTP_OBJECTS[index]; delete index; delete MSXML_XMLHTTP_OBJECTS; -objj_request_xmlhttp = function() +var objj_request_xmlhttp = function() { return new ActiveXObject(MSXML_XMLHTTP); } @@ -571,7 +571,7 @@ objj_request_xmlhttp = function() ENDIF -OBJJUnrecognizedFormatException = "OBJJUnrecognizedFormatException"; +var OBJJUnrecognizedFormatException = "OBJJUnrecognizedFormatException"; var STATIC_MAGIC_NUMBER = "@STATIC", MARKER_PATH = "p", @@ -594,7 +594,8 @@ function objj_decompile(aString, bundle) objj_exception_throw(new objj_exception(OBJJUnrecognizedFormatException, "*** Could not recognize executable code format.")); var file = NULL, - files = []; + files = [], + marker; while (marker = stream.getMarker()) { diff --git a/Objective-J/plist.js b/Objective-J/plist.js index d330bfc14..3ce708476 100644 --- a/Objective-J/plist.js +++ b/Objective-J/plist.js @@ -20,13 +20,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -kCFPropertyListOpenStepFormat = 1; -kCFPropertyListXMLFormat_v1_0 = 100; -kCFPropertyListBinaryFormat_v1_0 = 200; -kCFPropertyList280NorthFormat_v1_0 = -1000; +var kCFPropertyListOpenStepFormat = 1, + kCFPropertyListXMLFormat_v1_0 = 100, + kCFPropertyListBinaryFormat_v1_0 = 200, + kCFPropertyList280NorthFormat_v1_0 = -1000; -OBJJPlistParseException = "OBJJPlistParseException"; -OBJJPlistSerializeException = "OBJJPlistSerializeException"; +var OBJJPlistParseException = "OBJJPlistParseException", + OBJJPlistSerializeException = "OBJJPlistSerializeException"; var kCFPropertyList280NorthMagicNumber = "280NPLIST"; @@ -191,7 +191,7 @@ var XML_XML = "xml", PLIST_BOOLEAN_TRUE = "true", PLIST_BOOLEAN_FALSE = "false", PLIST_NUMBER_REAL = "real", - PLIST_NUMBER_INTEGER = "integer"; + PLIST_NUMBER_INTEGER = "integer", PLIST_DATA = "data"; diff --git a/Objective-J/preprocess.js b/Objective-J/preprocess.js index 31fa9487e..0032ed203 100644 --- a/Objective-J/preprocess.js +++ b/Objective-J/preprocess.js @@ -20,13 +20,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -OBJJ_PREPROCESSOR_DEBUG_SYMBOLS = 1 << 0; +var OBJJ_PREPROCESSOR_DEBUG_SYMBOLS = 1 << 0; function objj_preprocess(/*String*/ aString, /*objj_bundle*/ aBundle, /*objj_file*/ aSourceFile, /*unsigned*/ flags) { try { - return new objj_preprocessor(aString, aSourceFile, aBundle, flags).fragments(); + return new objj_preprocessor(aString.replace(/^#[^\n]+\n/, "\n"), aSourceFile, aBundle, flags).fragments(); } catch (anException) { @@ -36,8 +36,8 @@ function objj_preprocess(/*String*/ aString, /*objj_bundle*/ aBundle, /*objj_fil return []; } -OBJJParseException = "OBJJParseException"; -OBJJClassNotFoundException = "OBJJClassNotFoundException"; +var OBJJParseException = "OBJJParseException", + OBJJClassNotFoundException = "OBJJClassNotFoundException"; var TOKEN_ACCESSORS = "accessors", TOKEN_CLASS = "class", diff --git a/Objective-J/runtime.js b/Objective-J/runtime.js index 4e097689a..cdc5df84f 100644 --- a/Objective-J/runtime.js +++ b/Objective-J/runtime.js @@ -296,7 +296,7 @@ function class_getMethodImplementation(/*Class*/ aClass, /*SEL*/ aSelector) // Adding Classes -var GLOBAL_NAMESPACE = this, +var GLOBAL_NAMESPACE = window, REGISTERED_CLASSES = {}; function objj_allocateClassPair(/*Class*/ superclass, /*String*/ aName)