Add initial map implementation to tests, see #17

This commit is contained in:
dcodeIO
2018-06-19 04:23:22 +02:00
parent e8c8b20ca4
commit 48e96cbcf5
8 changed files with 3497 additions and 5 deletions

View File

@ -1434,6 +1434,8 @@ export class Source extends Node {
tokenizer: Tokenizer | null = null;
/** Source map index. */
debugInfoIndex: i32 = -1;
/** Re-exported sources. */
exportPaths: Set<string> | null = null;
/** Constructs a new source node. */
constructor(normalizedPath: string, text: string, kind: SourceKind) {

View File

@ -1958,8 +1958,11 @@ export class Parser extends DiagnosticEmitter {
if (tn.skip(Token.STRINGLITERAL)) {
path = Node.createStringLiteralExpression(tn.readString(), tn.range());
let ret = Node.createExportStatement(null, path, flags, tn.range(startPos, tn.pos));
let internalPath = ret.internalPath;
if (internalPath !== null && !this.seenlog.has(internalPath)) {
let internalPath = assert(ret.internalPath);
let source = tn.source;
if (!source.exportPaths) source.exportPaths = new Set();
source.exportPaths.add(internalPath);
if (!this.seenlog.has(internalPath)) {
this.backlog.push(internalPath);
this.seenlog.add(internalPath);
}