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

Side by Side Diff: lib/declaration.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 unified diff | Download patch
« no previous file with comments | « lib/base.ts ('k') | lib/facade_converter.ts » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import * as ts from 'typescript'; 1 import * as ts from 'typescript';
2 2
3 import * as base from './base'; 3 import * as base from './base';
4 import {FacadeConverter} from './facade_converter'; 4 import {FacadeConverter} from './facade_converter';
5 import {Transpiler} from './main'; 5 import {Transpiler} from './main';
6 import {MergedParameter, MergedType, MergedTypeParameters} from './merge'; 6 import {MergedParameter, MergedType, MergedTypeParameters} from './merge';
7 7
8 export function isFunctionLikeProperty( 8 export function isFunctionLikeProperty(
9 decl: ts.PropertyDeclaration|ts.ParameterDeclaration, tc: ts.TypeChecker): b oolean { 9 decl: ts.PropertyDeclaration|ts.ParameterDeclaration, tc: ts.TypeChecker): b oolean {
10 if (!decl.type) return false; 10 if (!decl.type) return false;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 459
460 if (paramDecl.dotDotDotToken) { 460 if (paramDecl.dotDotDotToken) {
461 // Weak support of varargs that works ok if you have 5 of fewer args. 461 // Weak support of varargs that works ok if you have 5 of fewer args.
462 let paramType: ts.TypeNode; 462 let paramType: ts.TypeNode;
463 let type = paramDecl.type; 463 let type = paramDecl.type;
464 if (type) { 464 if (type) {
465 if (type.kind === ts.SyntaxKind.ArrayType) { 465 if (type.kind === ts.SyntaxKind.ArrayType) {
466 let arrayType = <ts.ArrayTypeNode>type; 466 let arrayType = <ts.ArrayTypeNode>type;
467 paramType = arrayType.elementType; 467 paramType = arrayType.elementType;
468 } else if (type.kind !== ts.SyntaxKind.AnyKeyword) { 468 } else if (type.kind !== ts.SyntaxKind.AnyKeyword) {
469 console.log('Warning: falling back to dynamic for varArgs type: ' + type.getText()); 469 console.error('Warning: falling back to dynamic for varArgs type: ' + type.getText());
470 } 470 }
471 } 471 }
472 472
473 for (let i = 1; i <= DeclarationTranspiler.NUM_FAKE_REST_PARAMETERS; + +i) { 473 for (let i = 1; i <= DeclarationTranspiler.NUM_FAKE_REST_PARAMETERS; + +i) {
474 if (i > 1) { 474 if (i > 1) {
475 this.emitNoSpace(','); 475 this.emitNoSpace(',');
476 } 476 }
477 this.visit(paramType); 477 this.visit(paramType);
478 this.emit(base.ident(paramDecl.name) + i); 478 this.emit(base.ident(paramDecl.name) + i);
479 } 479 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 this.emitNoSpace('<'); 889 this.emitNoSpace('<');
890 this.enterTypeArguments(); 890 this.enterTypeArguments();
891 this.visitList(typeParameters); 891 this.visitList(typeParameters);
892 this.exitTypeArguments(); 892 this.exitTypeArguments();
893 this.emitNoSpace('>'); 893 this.emitNoSpace('>');
894 } 894 }
895 this.visitParameters(signature.parameters); 895 this.visitParameters(signature.parameters);
896 this.emitNoSpace(';'); 896 this.emitNoSpace(';');
897 } 897 }
898 } 898 }
OLDNEW
« no previous file with comments | « lib/base.ts ('k') | lib/facade_converter.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698