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

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

Issue 791603003: WIP context-allocation for “this” in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP v3 Created 5 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
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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 {"return function (x) { return this + x }", NONE}, 976 {"return function (x) { return this + x }", NONE},
977 {"return function (x) { return super() + x }", NONE}, 977 {"return function (x) { return super() + x }", NONE},
978 {"var x = function () { this.foo = 42 };", NONE}, 978 {"var x = function () { this.foo = 42 };", NONE},
979 {"var x = function () { super.foo = 42 };", NONE}, 979 {"var x = function () { super.foo = 42 };", NONE},
980 {"if (1) { return function () { while (true) new this() } }", NONE}, 980 {"if (1) { return function () { while (true) new this() } }", NONE},
981 {"if (1) { return function () { while (true) new super() } }", NONE}, 981 {"if (1) { return function () { while (true) new super() } }", NONE},
982 {"return function (x) { return () => this }", NONE}, 982 {"return function (x) { return () => this }", NONE},
983 {"return function (x) { return () => super() }", NONE}, 983 {"return function (x) { return () => super() }", NONE},
984 // Flags must be correctly set when using block scoping. 984 // Flags must be correctly set when using block scoping.
985 {"\"use strict\"; while (true) { let x; this, arguments; }", 985 {"\"use strict\"; while (true) { let x; this, arguments; }",
986 ARGUMENTS | THIS},
987 {"\"use strict\"; while (true) {"
988 " let x; return () => this + arguments;"
989 "}",
986 INNER_ARGUMENTS | INNER_THIS}, 990 INNER_ARGUMENTS | INNER_THIS},
987 {"\"use strict\"; while (true) { let x; this, super(), arguments; }", 991 {"\"use strict\"; while (true) { let x; this, super(), arguments; }",
988 INNER_ARGUMENTS | INNER_SUPER_CONSTRUCTOR_CALL | INNER_THIS}, 992 ARGUMENTS | SUPER_CONSTRUCTOR_CALL | THIS},
989 {"\"use strict\"; if (foo()) { let x; this.f() }", INNER_THIS}, 993 {"\"use strict\"; if (foo()) { let x; this.f() }", THIS},
990 {"\"use strict\"; if (foo()) { let x; super.f() }", 994 {"\"use strict\"; if (foo()) { let x; super.f() }",
991 INNER_SUPER_PROPERTY}, 995 SUPER_PROPERTY},
992 {"\"use strict\"; if (1) {" 996 {"\"use strict\"; if (1) {"
993 " let x; return function () { return this + super() + arguments }" 997 " let x; return function () { return this + super() + arguments }"
994 "}", 998 "}",
995 NONE}, 999 NONE},
996 }; 1000 };
997 1001
998 i::Isolate* isolate = CcTest::i_isolate(); 1002 i::Isolate* isolate = CcTest::i_isolate();
999 i::Factory* factory = isolate->factory(); 1003 i::Factory* factory = isolate->factory();
1000 1004
1001 v8::HandleScope handles(CcTest::isolate()); 1005 v8::HandleScope handles(CcTest::isolate());
(...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after
4575 always_false_flags, arraysize(always_false_flags)); 4579 always_false_flags, arraysize(always_false_flags));
4576 4580
4577 const char* good_data[] = { 4581 const char* good_data[] = {
4578 "let = 1;", 4582 "let = 1;",
4579 "for(let = 1;;){}", 4583 "for(let = 1;;){}",
4580 NULL}; 4584 NULL};
4581 RunParserSyncTest(context_data, good_data, kSuccess, NULL, 0, 4585 RunParserSyncTest(context_data, good_data, kSuccess, NULL, 0,
4582 always_true_flags, arraysize(always_true_flags), 4586 always_true_flags, arraysize(always_true_flags),
4583 always_false_flags, arraysize(always_false_flags)); 4587 always_false_flags, arraysize(always_false_flags));
4584 } 4588 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698