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

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

Issue 2650863002: [parser] Throw error when there are too many excluded properties (Closed)
Patch Set: fmt Created 3 years, 11 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
« src/parsing/parser-base.h ('K') | « src/parsing/parser-base.h ('k') | no next file » | 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 6953 matching lines...) Expand 10 before | Expand all | Expand 10 after
6964 NULL}; 6964 NULL};
6965 // clang-format on 6965 // clang-format on
6966 RunParserSyncTest(context_data, data, kError); 6966 RunParserSyncTest(context_data, data, kError);
6967 RunParserSyncTest(context_data, rest_data, kError); 6967 RunParserSyncTest(context_data, rest_data, kError);
6968 static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread}; 6968 static const ParserFlag flags[] = {kAllowHarmonyObjectRestSpread};
6969 RunParserSyncTest(context_data, data, kError, NULL, 0, flags, 6969 RunParserSyncTest(context_data, data, kError, NULL, 0, flags,
6970 arraysize(flags)); 6970 arraysize(flags));
6971 RunParserSyncTest(context_data, rest_data, kError, NULL, 0, flags, 6971 RunParserSyncTest(context_data, rest_data, kError, NULL, 0, flags,
6972 arraysize(flags)); 6972 arraysize(flags));
6973 } 6973 }
6974
6975 {
6976 // clang-format off
6977 const char* context_data[][2] = {
6978 {"var { ", " } = { a: 1};"},
6979 { NULL, NULL }
6980 };
6981
6982 using v8::internal::Code;
6983 std::string statement;
6984 for (int i = 0; i < Code::kMaxArguments; ++i) {
6985 statement += std::to_string(i) + " : " + "x, ";
6986 }
6987 statement += "...y";
6988
6989 const char* statement_data[] = {
6990 statement.c_str(),
6991 NULL
6992 };
6993
6994 // clang-format on
6995 // The test is quite slow, so run it with a reduced set of flags.
adamk 2017/01/23 21:47:45 How slow did this end up being? Depending on your
gsathya 2017/01/23 22:22:27 This doubled the run time of the test (13s to 25s)
6996 static const ParserFlag flags[] = {kAllowLazy,
6997 kAllowHarmonyObjectRestSpread};
6998 RunParserSyncTest(context_data, statement_data, kError, NULL, 0, flags,
6999 arraysize(flags));
7000 }
6974 } 7001 }
6975 7002
6976 7003
6977 TEST(DestructuringAssignmentPositiveTests) { 7004 TEST(DestructuringAssignmentPositiveTests) {
6978 const char* context_data[][2] = { 7005 const char* context_data[][2] = {
6979 {"'use strict'; let x, y, z; (", " = {});"}, 7006 {"'use strict'; let x, y, z; (", " = {});"},
6980 {"var x, y, z; (", " = {});"}, 7007 {"var x, y, z; (", " = {});"},
6981 {"'use strict'; let x, y, z; for (x in ", " = {});"}, 7008 {"'use strict'; let x, y, z; for (x in ", " = {});"},
6982 {"'use strict'; let x, y, z; for (x of ", " = {});"}, 7009 {"'use strict'; let x, y, z; for (x of ", " = {});"},
6983 {"var x, y, z; for (x in ", " = {});"}, 7010 {"var x, y, z; for (x in ", " = {});"},
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
8926 DCHECK_NULL(scope->sibling()); 8953 DCHECK_NULL(scope->sibling());
8927 DCHECK(scope->is_function_scope()); 8954 DCHECK(scope->is_function_scope());
8928 const i::AstRawString* var_name = 8955 const i::AstRawString* var_name =
8929 info.ast_value_factory()->GetOneByteString("my_var"); 8956 info.ast_value_factory()->GetOneByteString("my_var");
8930 i::Variable* var = scope->Lookup(var_name); 8957 i::Variable* var = scope->Lookup(var_name);
8931 CHECK_EQ(inners[i].ctxt_allocate, 8958 CHECK_EQ(inners[i].ctxt_allocate,
8932 i::ScopeTestHelper::MustAllocateInContext(var)); 8959 i::ScopeTestHelper::MustAllocateInContext(var));
8933 } 8960 }
8934 } 8961 }
8935 } 8962 }
OLDNEW
« src/parsing/parser-base.h ('K') | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698