Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Unified Diff: lib/facade_converter.ts

Issue 2434903002: Fix crash generating facades for loasd. Fix bug in how we handle TypePredicates. Add test for TypeP… (Closed)
Patch Set: Fix crash generating facades for loasd. Fix bug in how we handle TypePredicates. Add test for TypeP… Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/declaration.ts ('k') | lib/merge.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/facade_converter.ts
diff --git a/lib/facade_converter.ts b/lib/facade_converter.ts
index 60b6eab54823033c2eb91fa0f2ecf164e6efca55..b72affc6800cac429b768bc339eb96dd2307f2f0 100644
--- a/lib/facade_converter.ts
+++ b/lib/facade_converter.ts
@@ -355,8 +355,12 @@ export class FacadeConverter extends base.TranspilerBase {
// let query = <ts.TypeQueryNode>node;
// name += '/* TypeQuery: typeof ' + base.ident(query.exprName) + ' */';
break;
- case ts.SyntaxKind.TypePredicate:
- return this.generateDartTypeName((node as ts.TypePredicateNode).type, options);
+ case ts.SyntaxKind.TypePredicate: {
+ let predicate = node as ts.TypePredicateNode;
+ name = 'bool';
+ comment = base.ident(predicate.parameterName) + ' is ' +
+ this.generateDartTypeName(predicate.type, addInsideComment(options));
+ } break;
case ts.SyntaxKind.TupleType:
let tuple = <ts.TupleTypeNode>node;
name = 'List<';
@@ -778,6 +782,8 @@ export class FacadeConverter extends base.TranspilerBase {
// TODO(jacobr): property need to prefix the name better.
referenceType.typeName = this.createEntityName(symbol);
referenceType.typeName.parent = referenceType;
+ let decl = this.getSymbolDeclaration(symbol);
+ base.copyLocation(decl, referenceType);
return referenceType;
}
@@ -823,6 +829,7 @@ export class FacadeConverter extends base.TranspilerBase {
let refB = nodeB as ts.TypeReferenceNode;
if (base.ident(refA.typeName) === base.ident(refB.typeName)) {
let merge = <ts.TypeReferenceNode>ts.createNode(ts.SyntaxKind.TypeReference);
+ base.copyLocation(refA, merge);
merge.typeName = refA.typeName;
return merge;
}
« no previous file with comments | « lib/declaration.ts ('k') | lib/merge.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698