Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: test/lexer/cornercases/octals.js

Issue 91833002: Experimental scanner: keeping track of octal numbers octal escapes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lexer/lexer_py.re ('k') | test/lexer/cornercases/strings-and-identifiers-with-escapes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/lexer/cornercases/octals.js
diff --git a/src/harmony-math.js b/test/lexer/cornercases/octals.js
similarity index 67%
copy from src/harmony-math.js
copy to test/lexer/cornercases/octals.js
index a4d3f2e8a5e9c5936630571644605402dee1199d..6a81dd68de6c1f7b0b8a5d0617cbabd3ba13f946 100644
--- a/src/harmony-math.js
+++ b/test/lexer/cornercases/octals.js
@@ -25,36 +25,34 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-'use strict';
-
-// ES6 draft 09-27-13, section 20.2.2.28.
-function MathSign(x) {
- x = TO_NUMBER_INLINE(x);
- if (x > 0) return 1;
- if (x < 0) return -1;
- if (x === 0) return x;
- return NAN;
-}
-
-
-// ES6 draft 09-27-13, section 20.2.2.34.
-function MathTrunc(x) {
- x = TO_NUMBER_INLINE(x);
- if (x > 0) return MathFloor(x);
- if (x < 0) return MathCeil(x);
- if (x === 0) return x;
- return NAN;
-}
-
-
-function ExtendMath() {
- %CheckIsBootstrapping();
-
- // Set up the non-enumerable functions on the Math object.
- InstallFunctions($Math, DONT_ENUM, $Array(
- "sign", MathSign,
- "trunc", MathTrunc
- ));
-}
-
-ExtendMath();
+// Octal numbers and octal escapes in strings are not allowed in the strict
+// mode.
+
+var octal_number = 031;
+var not_octal_number = 0;
+var again_not = 019;
+
+"octal inside \01 string"
+"this is not octal \0"
+"this is an octal escape followed by 9: \019"
+"doesn't need to start with 0: \11"
+
+'octal inside \01 string'
+'this is not octal \0'
+'this is an octal escape followed by 9: \01'
+'doesn\'t need to start with 0: \11'
+
+// Even more complicated cases: two octals in one string:
+"foo\00\00"
+'foo\00\00'
+
+// Different lengths of octals:
+"bar\0" // not an octal
+"bar\00"
+"bar\000" // Not an octal according to Ecma
+"bar\0000" // First 3 recognized as octal
+
+'bar\0' // not an octal
+'bar\00'
+'bar\000' // Not an octal according to Ecma
+'bar\0000' // First 3 recognized as octal
« no previous file with comments | « src/lexer/lexer_py.re ('k') | test/lexer/cornercases/strings-and-identifiers-with-escapes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698