Fixed: Use semicolon on last line in #included files. The new preprocessor might think that the statement will continue on the next line.

Due to Javascript don’t need to have semicolon at end of statement there are times when the parser thinks the line continues on the next line.

For example we have a file.js:
var f = function(x)
{
	return x + x;
}

Now in another file we do:
#include file.js
(function(exports) {
a = 42;
})(exports.b)

There will be two different behaviors if the ’file.js’ has a semicolon at the end of the last line. This commit make sure we have the right behavior.
This commit is contained in:
Martin Carlberg committed 2017-06-26 15:45:02 +02:00
1 parent 024c0a3186
commit 6456809a72
8 files changed
+9 -9

No files matched your search

+1 -1
View File
@@ -184,4 +184,4 @@ GLOBAL(objj_import) = function()
{
CPLog.warn("objj_import is deprecated, use objj_importFile instead");
objj_importFile.apply(this, arguments);
}
};
+1 -1
View File
@@ -914,4 +914,4 @@ GLOBAL(CFCopyLocalizedStringWithDefaultValue) = function (key, tableName, bundle
GLOBAL(CFBundleGetMainBundle) = function ()
{
return CFBundle.mainBundle();
}
};
+2 -2
View File
@@ -597,7 +597,7 @@ CFPropertyList.propertyListFromXML = function(/*String | XMLNode*/ aStringOrXMLN
object = decodeHTMLComponent(FIRST_CHILD(XMLNode) ? TEXT_CONTENT(XMLNode) : "");
break;
case PLIST_DATE: var timestamp = Date.parseISO8601(TEXT_CONTENT(XMLNode));
object = isNaN(timestamp) ? new Date() : new Date(timestamp);
break;
@@ -667,4 +667,4 @@ GLOBAL(CPPropertyListCreateFromData) = function(/*CFData*/ data, /*Format*/ aFor
GLOBAL(CPPropertyListCreateData) = function(/*PropertyList*/ aPropertyList, /*Format*/ aFormat)
{
return CFPropertyList.dataFromPropertyList(aPropertyList, aFormat);
}
};
+1 -1
View File
@@ -275,4 +275,4 @@ GLOBAL(objj_debug_typecheck) = function(expectedType, object)
actualType = typeof object;
throw ("expected=" + expectedType + ", actual=" + actualType);
}
};
+1 -1
View File
@@ -81,4 +81,4 @@ EventDispatcher.prototype.dispatchEvent = function(/*Event*/ anEvent)
if (manual)
manual(anEvent);
}
};
+1 -1
View File
@@ -49,4 +49,4 @@ FileDependency.prototype.toMarkedString = function()
FileDependency.prototype.toString = function()
{
return (this.isLocal() ? "LOCAL: " : "STD: ") + this.URL();
}
};
+1 -1
View File
@@ -1011,4 +1011,4 @@ Preprocessor.prototype.error_message = function(errorMessage)
return errorMessage + " <Context File: "+ this._URL +
(this._currentClass ? " Class: "+this._currentClass : "") +
(this._currentSelector ? " Method: "+this._currentSelector : "") +">";
}
};
+1 -1
View File
@@ -198,4 +198,4 @@ function justify(sign, prefix, string, suffix, width, leftJustify, padZeros)
function pad(n, ch)
{
return Array(MAX(0,n)+1).join(ch);
}
};