| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |