|
| 1 | +=== tests/cases/compiler/index.js === |
| 2 | +var Person = function (firstNameOrPojo, lastName) { |
| 3 | +>Person : Symbol(Person, Decl(index.js, 0, 3)) |
| 4 | +>firstNameOrPojo : Symbol(firstNameOrPojo, Decl(index.js, 0, 23)) |
| 5 | +>lastName : Symbol(lastName, Decl(index.js, 0, 39)) |
| 6 | + |
| 7 | + if (typeof firstNameOrPojo === "string") { |
| 8 | +>firstNameOrPojo : Symbol(firstNameOrPojo, Decl(index.js, 0, 23)) |
| 9 | + |
| 10 | + this.firstName = firstNameOrPojo; |
| 11 | +>firstName : Symbol(Person.firstName, Decl(index.js, 2, 46)) |
| 12 | +>firstNameOrPojo : Symbol(firstNameOrPojo, Decl(index.js, 0, 23)) |
| 13 | + |
| 14 | + this.lastName = lastName; |
| 15 | +>lastName : Symbol(Person.lastName, Decl(index.js, 3, 41)) |
| 16 | +>lastName : Symbol(lastName, Decl(index.js, 0, 39)) |
| 17 | + |
| 18 | + } else { |
| 19 | + return new Person(firstNameOrPojo.firstName, firstNameOrPojo.lastName); |
| 20 | +>Person : Symbol(Person, Decl(index.js, 0, 3)) |
| 21 | +>firstNameOrPojo : Symbol(firstNameOrPojo, Decl(index.js, 0, 23)) |
| 22 | +>firstNameOrPojo : Symbol(firstNameOrPojo, Decl(index.js, 0, 23)) |
| 23 | + } |
| 24 | +}; |
| 25 | + |
| 26 | +Person.prototype.greet = function greet() { |
| 27 | +>Person.prototype : Symbol(Person.greet, Decl(index.js, 8, 2)) |
| 28 | +>Person : Symbol(Person, Decl(index.js, 0, 3)) |
| 29 | +>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) |
| 30 | +>greet : Symbol(Person.greet, Decl(index.js, 8, 2)) |
| 31 | +>greet : Symbol(greet, Decl(index.js, 10, 24)) |
| 32 | + |
| 33 | + return `Hello, I am ${this.firstName} ${this.lastName}.`; |
| 34 | +>this.firstName : Symbol(Person.firstName, Decl(index.js, 2, 46)) |
| 35 | +>this : Symbol(Person, Decl(index.js, 0, 12)) |
| 36 | +>firstName : Symbol(Person.firstName, Decl(index.js, 2, 46)) |
| 37 | +>this.lastName : Symbol(Person.lastName, Decl(index.js, 3, 41)) |
| 38 | +>this : Symbol(Person, Decl(index.js, 0, 12)) |
| 39 | +>lastName : Symbol(Person.lastName, Decl(index.js, 3, 41)) |
| 40 | + |
| 41 | +}; |
| 42 | + |
| 43 | +var fred = new Person({ firstName: "Fred", lastName: "Flintstone" }); |
| 44 | +>fred : Symbol(fred, Decl(index.js, 14, 3)) |
| 45 | +>Person : Symbol(Person, Decl(index.js, 0, 3)) |
| 46 | +>firstName : Symbol(firstName, Decl(index.js, 14, 23)) |
| 47 | +>lastName : Symbol(lastName, Decl(index.js, 14, 42)) |
| 48 | + |
| 49 | +console.log(fred.greet()); |
| 50 | +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) |
| 51 | +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) |
| 52 | +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) |
| 53 | +>fred.greet : Symbol(Person.greet, Decl(index.js, 8, 2)) |
| 54 | +>fred : Symbol(fred, Decl(index.js, 14, 3)) |
| 55 | +>greet : Symbol(Person.greet, Decl(index.js, 8, 2)) |
| 56 | + |
0 commit comments