From dd456e3ad52de2ffbeca9866f02d0f0f09c56ab8 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Enter strict mode. Re-reads the next token to please pedantic tests ("use strict"; 010; -- should fail).
function setStrict(strct) {
strict = strct;
- tokPos = lastEnd;
+ tokPos = tokStart;
if (options.locations) {
while (tokPos < tokLineStart) {
tokLineStart = input.lastIndexOf("\n", tokLineStart - 2) + 1;
diff --git a/test/tests.js b/test/tests.js
index c9a080eef0..efce0b4122 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -26956,3 +26956,10 @@ testFail("throw\n10;", "Illegal newline after throw (1:5)");
}
);
})();
+
+(function() {
+ var comments = 0;
+ testAssert("\nfunction plop() {\n'use strict';\n/* Comment */\n}", function() {
+ if (comments != 1) return "Comment after strict counted twice.";
+ }, {onComment: function() {++comments;}});
+})();