Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 print("Tests that creating instances from classes and functions will have the co rrect inferred name."); | |
| 6 | |
| 7 var functionKeywordInstance = "var f1 = function(){}; var o1 = new f1();"; | |
| 8 var namespacedFunctionInstance = "var obj = {}; obj.functionClass = function(){} ; var o2 = new obj.functionClass()"; | |
| 9 var classKeywordInstance = "var f2 = class(){}; var o3 = new f2();"; | |
| 10 var namespacedClassInstance = "obj.classClass = class(){}; var o4 = new obj.clas sClass()"; | |
| 11 | |
|
marja
2016/11/14 19:40:07
What's up with this duplication? What are these st
luoe
2016/11/14 19:51:37
My fault here, I thought I removed these duplicate
| |
| 12 Protocol.Runtime.enable(); | |
| 13 | |
| 14 InspectorTest.runTestSuite([ | |
| 15 function functionKeywordInstance(next) { | |
| 16 Protocol.Runtime.evaluate({ expression: "var f1 = function(){}; new f1();" } ).then(dumpResults).then(next); | |
| 17 }, | |
| 18 function namespacedFunctionInstance(next) { | |
| 19 Protocol.Runtime.evaluate({ expression: "var obj = {}; obj.functionClass = f unction(){}; new obj.functionClass()" }).then(dumpResults).then(next); | |
| 20 }, | |
| 21 function classKeywordInstance(next) { | |
| 22 Protocol.Runtime.evaluate({ expression: "var f2 = class{}; new f2();" }).the n(dumpResults).then(next); | |
| 23 }, | |
| 24 function namespacedClassInstance(next) { | |
| 25 Protocol.Runtime.evaluate({ expression: "var obj = {}; obj.classClass = clas s{}; new obj.classClass()" }).then(dumpResults).then(next); | |
| 26 }, | |
| 27 | |
| 28 ]); | |
| 29 | |
| 30 function dumpResults(response) { | |
| 31 InspectorTest.log(response.result.result.className); | |
| 32 } | |
| OLD | NEW |