refactor(compiler): replace CompileIdentifierMap with regular Map

closes #11145

Also rename `CompileIdentifierMetadata.runtime` into `CompileIdentifierMetadata.reference`.

Also remove `CompileIdentifierMetadata.equalsTo` as
now it is enough to just check the `reference` fields for equality.
This commit is contained in:
Tobias Bosch
2016-08-29 08:52:25 -07:00
committed by Victor Berchet
parent 51877ef4ed
commit d7de5c4f8e
27 changed files with 347 additions and 471 deletions

View File

@ -220,7 +220,9 @@ class StatementInterpreter implements o.StatementVisitor, o.ExpressionVisitor {
return new clazz(...args);
}
visitLiteralExpr(ast: o.LiteralExpr, ctx: _ExecutionContext): any { return ast.value; }
visitExternalExpr(ast: o.ExternalExpr, ctx: _ExecutionContext): any { return ast.value.runtime; }
visitExternalExpr(ast: o.ExternalExpr, ctx: _ExecutionContext): any {
return ast.value.reference;
}
visitConditionalExpr(ast: o.ConditionalExpr, ctx: _ExecutionContext): any {
if (ast.condition.visitExpression(this, ctx)) {
return ast.trueCase.visitExpression(this, ctx);

View File

@ -34,7 +34,7 @@ class JitEmitterVisitor extends AbstractJsEmitterVisitor {
}
visitExternalExpr(ast: o.ExternalExpr, ctx: EmitterVisitorContext): any {
var value = ast.value.runtime;
var value = ast.value.reference;
var id = this._evalArgValues.indexOf(value);
if (id === -1) {
id = this._evalArgValues.length;

View File

@ -311,16 +311,18 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
}
ctx.print(`${prefix}.`);
}
ctx.print(value.name);
if (value.reference && value.reference.members) {
ctx.print(value.reference.name);
ctx.print('.');
ctx.print(value.reference.members.join('.'));
} else {
ctx.print(value.name);
}
if (isPresent(typeParams) && typeParams.length > 0) {
ctx.print(`<`);
this.visitAllObjects(
(type: any /** TODO #9100 */) => type.visitType(this, ctx), typeParams, ctx, ',');
ctx.print(`>`);
}
if (value.runtime && value.runtime.members) {
ctx.print('.');
ctx.print(value.runtime.members.join('.'));
}
}
}