OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |