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

Side by Side Diff: test/cctest/test-func-name-inference.cc

Issue 2488193003: Generate inferred names for es6 class functions (Closed)
Patch Set: git cl format Created 4 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 unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 v8::Local<v8::Script> script = 134 v8::Local<v8::Script> script =
135 Compile(CcTest::isolate(), 135 Compile(CcTest::isolate(),
136 "function outer() {\n" 136 "function outer() {\n"
137 " var fun1 = function() { return 1; }\n" 137 " var fun1 = function() { return 1; }\n"
138 " var fun2 = function() { return 2; }\n" 138 " var fun2 = function() { return 2; }\n"
139 "}"); 139 "}");
140 CheckFunctionName(script, "return 1", "fun1"); 140 CheckFunctionName(script, "return 1", "fun1");
141 CheckFunctionName(script, "return 2", "fun2"); 141 CheckFunctionName(script, "return 2", "fun2");
142 } 142 }
143 143
144 TEST(ObjectProperty) {
145 CcTest::InitializeVM();
146 v8::HandleScope scope(CcTest::isolate());
147
148 v8::Local<v8::Script> script =
149 Compile(CcTest::isolate(),
150 "var obj = {\n"
151 " fun1: function() { return 1; },\n"
152 " fun2: class { constructor() { return 2; } }\n"
153 "}");
154 CheckFunctionName(script, "return 1", "obj.fun1");
155 CheckFunctionName(script, "return 2", "obj.fun2");
156 }
144 157
145 TEST(InConstructor) { 158 TEST(InConstructor) {
146 CcTest::InitializeVM(); 159 CcTest::InitializeVM();
147 v8::HandleScope scope(CcTest::isolate()); 160 v8::HandleScope scope(CcTest::isolate());
148 161
149 v8::Local<v8::Script> script = 162 v8::Local<v8::Script> script =
150 Compile(CcTest::isolate(), 163 Compile(CcTest::isolate(),
151 "function MyClass() {\n" 164 "function MyClass() {\n"
152 " this.method1 = function() { return 1; }\n" 165 " this.method1 = function() { return 1; }\n"
153 " this.method2 = function() { return 2; }\n" 166 " this.method2 = function() { return 2; }\n"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 " };\n" 547 " };\n"
535 " var foo = 10;\n" 548 " var foo = 10;\n"
536 " function f() {\n" 549 " function f() {\n"
537 " return wrapCode();\n" 550 " return wrapCode();\n"
538 " }\n" 551 " }\n"
539 " this.ref = f;\n" 552 " this.ref = f;\n"
540 "})()"); 553 "})()");
541 script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked(); 554 script->Run(CcTest::isolate()->GetCurrentContext()).ToLocalChecked();
542 CheckFunctionName(script, "return 2012", ""); 555 CheckFunctionName(script, "return 2012", "");
543 } 556 }
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698