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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 19300002: ES6: Add support for explicit octal and binary integer literals (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix long lines Created 7 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-conversions.cc ('k') | test/mjsunit/harmony/numeric-literals.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 } 1079 }
1080 1080
1081 1081
1082 enum ParserFlag { 1082 enum ParserFlag {
1083 kAllowLazy, 1083 kAllowLazy,
1084 kAllowNativesSyntax, 1084 kAllowNativesSyntax,
1085 kAllowHarmonyScoping, 1085 kAllowHarmonyScoping,
1086 kAllowModules, 1086 kAllowModules,
1087 kAllowGenerators, 1087 kAllowGenerators,
1088 kAllowForOf, 1088 kAllowForOf,
1089 kAllowHarmonyNumericLiterals,
1089 kParserFlagCount 1090 kParserFlagCount
1090 }; 1091 };
1091 1092
1092 1093
1093 static bool checkParserFlag(unsigned flags, ParserFlag flag) { 1094 static bool checkParserFlag(unsigned flags, ParserFlag flag) {
1094 return flags & (1 << flag); 1095 return flags & (1 << flag);
1095 } 1096 }
1096 1097
1097 1098
1098 #define SET_PARSER_FLAGS(parser, flags) \ 1099 #define SET_PARSER_FLAGS(parser, flags) \
1099 parser.set_allow_lazy(checkParserFlag(flags, kAllowLazy)); \ 1100 parser.set_allow_lazy(checkParserFlag(flags, kAllowLazy)); \
1100 parser.set_allow_natives_syntax(checkParserFlag(flags, \ 1101 parser.set_allow_natives_syntax(checkParserFlag(flags, \
1101 kAllowNativesSyntax)); \ 1102 kAllowNativesSyntax)); \
1102 parser.set_allow_harmony_scoping(checkParserFlag(flags, \ 1103 parser.set_allow_harmony_scoping(checkParserFlag(flags, \
1103 kAllowHarmonyScoping)); \ 1104 kAllowHarmonyScoping)); \
1104 parser.set_allow_modules(checkParserFlag(flags, kAllowModules)); \ 1105 parser.set_allow_modules(checkParserFlag(flags, kAllowModules)); \
1105 parser.set_allow_generators(checkParserFlag(flags, kAllowGenerators)); \ 1106 parser.set_allow_generators(checkParserFlag(flags, kAllowGenerators)); \
1106 parser.set_allow_for_of(checkParserFlag(flags, kAllowForOf)); 1107 parser.set_allow_for_of(checkParserFlag(flags, kAllowForOf)); \
1108 parser.set_allow_harmony_numeric_literals( \
1109 checkParserFlag(flags, kAllowHarmonyNumericLiterals));
1107 1110
1108 void TestParserSyncWithFlags(i::Handle<i::String> source, unsigned flags) { 1111 void TestParserSyncWithFlags(i::Handle<i::String> source, unsigned flags) {
1109 i::Isolate* isolate = i::Isolate::Current(); 1112 i::Isolate* isolate = i::Isolate::Current();
1110 i::Factory* factory = isolate->factory(); 1113 i::Factory* factory = isolate->factory();
1111 1114
1112 uintptr_t stack_limit = isolate->stack_guard()->real_climit(); 1115 uintptr_t stack_limit = isolate->stack_guard()->real_climit();
1113 1116
1114 // Preparse the data. 1117 // Preparse the data.
1115 i::CompleteParserRecorder log; 1118 i::CompleteParserRecorder log;
1116 { 1119 {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 " b = function() { \n" 1321 " b = function() { \n"
1319 " 01; \n" 1322 " 01; \n"
1320 " }; \n" 1323 " }; \n"
1321 "}; \n"; 1324 "}; \n";
1322 v8::Script::Compile(v8::String::New(script)); 1325 v8::Script::Compile(v8::String::New(script));
1323 CHECK(try_catch.HasCaught()); 1326 CHECK(try_catch.HasCaught());
1324 v8::String::Utf8Value exception(try_catch.Exception()); 1327 v8::String::Utf8Value exception(try_catch.Exception());
1325 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", 1328 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.",
1326 *exception); 1329 *exception);
1327 } 1330 }
OLDNEW
« no previous file with comments | « test/cctest/test-conversions.cc ('k') | test/mjsunit/harmony/numeric-literals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698