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

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

Issue 899363002: Allow eval and arguments as property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup based on code review Created 5 years, 10 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
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/harmony/class-property-name-eval-arguments.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 5054 matching lines...) Expand 10 before | Expand all | Expand 10 after
5065 TestLanguageMode("var x = 1; \"use strong\"", i::SLOPPY); 5065 TestLanguageMode("var x = 1; \"use strong\"", i::SLOPPY);
5066 5066
5067 // Test that multiple directives ("use strict" / "use strong") put the parser 5067 // Test that multiple directives ("use strict" / "use strong") put the parser
5068 // into the correct mode. 5068 // into the correct mode.
5069 TestLanguageMode("\"use strict\"; \"use strong\";", i::STRONG); 5069 TestLanguageMode("\"use strict\"; \"use strong\";", i::STRONG);
5070 TestLanguageMode("\"use strong\"; \"use strict\";", i::STRONG); 5070 TestLanguageMode("\"use strong\"; \"use strict\";", i::STRONG);
5071 5071
5072 TestLanguageMode("\"use some future directive\"; \"use strict\";", i::STRICT); 5072 TestLanguageMode("\"use some future directive\"; \"use strict\";", i::STRICT);
5073 TestLanguageMode("\"use some future directive\"; \"use strong\";", i::STRONG); 5073 TestLanguageMode("\"use some future directive\"; \"use strong\";", i::STRONG);
5074 } 5074 }
5075
5076
5077 TEST(PropertyNameEvalArguments) {
5078 const char* context_data[][2] = {{"'use strict';", ""},
5079 {"'use strong';", ""},
5080 {NULL, NULL}};
5081
5082 const char* statement_data[] = {
5083 "({eval: 1})",
5084 "({arguments: 1})",
5085 "({eval() {}})",
5086 "({arguments() {}})",
5087 "({*eval() {}})",
5088 "({*arguments() {}})",
5089 "({get eval() {}})",
5090 "({get arguments() {}})",
5091 "({set eval(_) {}})",
5092 "({set arguments(_) {}})",
5093
5094 "class C {eval() {}}",
5095 "class C {arguments() {}}",
5096 "class C {*eval() {}}",
5097 "class C {*arguments() {}}",
5098 "class C {get eval() {}}",
5099 "class C {get arguments() {}}",
5100 "class C {set eval(_) {}}",
5101 "class C {set arguments(_) {}}",
5102
5103 "class C {static eval() {}}",
5104 "class C {static arguments() {}}",
5105 "class C {static *eval() {}}",
5106 "class C {static *arguments() {}}",
5107 "class C {static get eval() {}}",
5108 "class C {static get arguments() {}}",
5109 "class C {static set eval(_) {}}",
5110 "class C {static set arguments(_) {}}",
5111
5112 NULL};
5113
5114 static const ParserFlag always_flags[] = {
5115 kAllowHarmonyClasses, kAllowHarmonyObjectLiterals, kAllowHarmonyScoping,
5116 kAllowStrongMode};
5117 RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
5118 always_flags, arraysize(always_flags));
5119 }
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/harmony/class-property-name-eval-arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698