aba932aefa
* Commonjs module:create synthetic exports symbol Previously, the `module` identifier in commonjs modules got a synthetic type with a single property `exports`. The exports property reused the file's symbol, which, for a module file, gives the correct exported properties. However, the name of this symbol was still the filename of the file, not `exports`. This PR creates a synthetic symbol for `exports` by copying in a similar way to esModuleInterop's `default` symbol in `resolveESModuleSymbol` (although the intent there is to strip off signatures from the symbol). * correct parent of synthetic symbol
92 lines
3.3 KiB
Plaintext
92 lines
3.3 KiB
Plaintext
=== tests/cases/conformance/jsdoc/declarations/test.js ===
|
|
const {Render} = require("./index");
|
|
>Render : Symbol(Render, Decl(test.js, 0, 7))
|
|
>require : Symbol(require)
|
|
>"./index" : Symbol("tests/cases/conformance/jsdoc/declarations/index", Decl(index.js, 0, 0))
|
|
|
|
let render = new Render();
|
|
>render : Symbol(render, Decl(test.js, 1, 3))
|
|
>Render : Symbol(Render, Decl(test.js, 0, 7))
|
|
|
|
render.addRectangle();
|
|
>render.addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5))
|
|
>render : Symbol(render, Decl(test.js, 1, 3))
|
|
>addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5))
|
|
|
|
console.log("Objects", render.objects);
|
|
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
|
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
|
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
|
>render.objects : Symbol(Render.objects, Decl(index.js, 3, 19))
|
|
>render : Symbol(render, Decl(test.js, 1, 3))
|
|
>objects : Symbol(Render.objects, Decl(index.js, 3, 19))
|
|
|
|
=== tests/cases/conformance/jsdoc/declarations/rectangle.js ===
|
|
class Rectangle {
|
|
>Rectangle : Symbol(Rectangle, Decl(rectangle.js, 0, 0))
|
|
|
|
constructor() {
|
|
console.log("I'm a rectangle!");
|
|
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
|
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
|
|
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
|
|
}
|
|
}
|
|
|
|
module.exports = { Rectangle };
|
|
>module.exports : Symbol(module.exports, Decl(rectangle.js, 0, 0))
|
|
>module : Symbol(module, Decl(rectangle.js, 4, 1))
|
|
>exports : Symbol(module.exports, Decl(rectangle.js, 0, 0))
|
|
>Rectangle : Symbol(Rectangle, Decl(rectangle.js, 6, 18))
|
|
|
|
=== tests/cases/conformance/jsdoc/declarations/index.js ===
|
|
const {Rectangle} = require('./rectangle');
|
|
>Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7))
|
|
>require : Symbol(require)
|
|
>'./rectangle' : Symbol("tests/cases/conformance/jsdoc/declarations/rectangle", Decl(rectangle.js, 0, 0))
|
|
|
|
class Render {
|
|
>Render : Symbol(Render, Decl(index.js, 0, 43))
|
|
|
|
constructor() {
|
|
/**
|
|
* Object list
|
|
* @type {Rectangle[]}
|
|
*/
|
|
this.objects = [];
|
|
>this.objects : Symbol(Render.objects, Decl(index.js, 3, 19))
|
|
>this : Symbol(Render, Decl(index.js, 0, 43))
|
|
>objects : Symbol(Render.objects, Decl(index.js, 3, 19))
|
|
}
|
|
/**
|
|
* Adds a rectangle
|
|
*
|
|
* @returns {Rectangle} the rect
|
|
*/
|
|
addRectangle() {
|
|
>addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5))
|
|
|
|
const obj = new Rectangle();
|
|
>obj : Symbol(obj, Decl(index.js, 16, 13))
|
|
>Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7))
|
|
|
|
this.objects.push(obj);
|
|
>this.objects.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
|
>this.objects : Symbol(Render.objects, Decl(index.js, 3, 19))
|
|
>this : Symbol(Render, Decl(index.js, 0, 43))
|
|
>objects : Symbol(Render.objects, Decl(index.js, 3, 19))
|
|
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
|
|
>obj : Symbol(obj, Decl(index.js, 16, 13))
|
|
|
|
return obj;
|
|
>obj : Symbol(obj, Decl(index.js, 16, 13))
|
|
}
|
|
}
|
|
|
|
module.exports = { Render };
|
|
>module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
|
|
>module : Symbol(module, Decl(index.js, 20, 1))
|
|
>exports : Symbol(module.exports, Decl(index.js, 0, 0))
|
|
>Render : Symbol(Render, Decl(index.js, 22, 18))
|
|
|