@@ -109,12 +109,12 @@ namespace ts {
109
109
export function createLiteral ( value : string | number | boolean , location ?: TextRange ) : PrimaryExpression ;
110
110
export function createLiteral ( value : string | number | boolean | StringLiteral | Identifier , location ?: TextRange ) : PrimaryExpression {
111
111
if ( typeof value === "number" ) {
112
- const node = < LiteralExpression > createNode ( SyntaxKind . NumericLiteral , location , /*flags*/ undefined ) ;
112
+ const node = < NumericLiteral > createNode ( SyntaxKind . NumericLiteral , location , /*flags*/ undefined ) ;
113
113
node . text = value . toString ( ) ;
114
114
return node ;
115
115
}
116
116
else if ( typeof value === "boolean" ) {
117
- return < PrimaryExpression > createNode ( value ? SyntaxKind . TrueKeyword : SyntaxKind . FalseKeyword , location , /*flags*/ undefined ) ;
117
+ return < BooleanLiteral > createNode ( value ? SyntaxKind . TrueKeyword : SyntaxKind . FalseKeyword , location , /*flags*/ undefined ) ;
118
118
}
119
119
else if ( typeof value === "string" ) {
120
120
const node = < StringLiteral > createNode ( SyntaxKind . StringLiteral , location , /*flags*/ undefined ) ;
@@ -226,20 +226,7 @@ namespace ts {
226
226
227
227
// Signature elements
228
228
229
- export function createParameter ( name : string | Identifier | BindingPattern , initializer ?: Expression , location ?: TextRange ) {
230
- return createParameterDeclaration (
231
- /*decorators*/ undefined ,
232
- /*modifiers*/ undefined ,
233
- /*dotDotDotToken*/ undefined ,
234
- name ,
235
- /*questionToken*/ undefined ,
236
- /*type*/ undefined ,
237
- initializer ,
238
- location
239
- ) ;
240
- }
241
-
242
- export function createParameterDeclaration ( decorators : Decorator [ ] , modifiers : Modifier [ ] , dotDotDotToken : DotDotDotToken , name : string | Identifier | BindingPattern , questionToken : QuestionToken , type : TypeNode , initializer : Expression , location ?: TextRange , flags ?: NodeFlags ) {
229
+ export function createParameter ( decorators : Decorator [ ] , modifiers : Modifier [ ] , dotDotDotToken : DotDotDotToken , name : string | Identifier | BindingPattern , questionToken ?: QuestionToken , type ?: TypeNode , initializer ?: Expression , location ?: TextRange , flags ?: NodeFlags ) {
243
230
const node = < ParameterDeclaration > createNode ( SyntaxKind . Parameter , location , flags ) ;
244
231
node . decorators = decorators ? createNodeArray ( decorators ) : undefined ;
245
232
node . modifiers = modifiers ? createNodeArray ( modifiers ) : undefined ;
@@ -251,9 +238,9 @@ namespace ts {
251
238
return node ;
252
239
}
253
240
254
- export function updateParameterDeclaration ( node : ParameterDeclaration , decorators : Decorator [ ] , modifiers : Modifier [ ] , name : BindingName , type : TypeNode , initializer : Expression ) {
241
+ export function updateParameter ( node : ParameterDeclaration , decorators : Decorator [ ] , modifiers : Modifier [ ] , name : BindingName , type : TypeNode , initializer : Expression ) {
255
242
if ( node . decorators !== decorators || node . modifiers !== modifiers || node . name !== name || node . type !== type || node . initializer !== initializer ) {
256
- return updateNode ( createParameterDeclaration ( decorators , modifiers , node . dotDotDotToken , name , node . questionToken , type , initializer , /*location*/ node , /*flags*/ node . flags ) , node ) ;
243
+ return updateNode ( createParameter ( decorators , modifiers , node . dotDotDotToken , name , node . questionToken , type , initializer , /*location*/ node , /*flags*/ node . flags ) , node ) ;
257
244
}
258
245
259
246
return node ;
@@ -1557,18 +1544,6 @@ namespace ts {
1557
1544
}
1558
1545
}
1559
1546
1560
- export function createRestParameter ( name : string | Identifier ) {
1561
- return createParameterDeclaration (
1562
- /*decorators*/ undefined ,
1563
- /*modifiers*/ undefined ,
1564
- createToken ( SyntaxKind . DotDotDotToken ) ,
1565
- name ,
1566
- /*questionToken*/ undefined ,
1567
- /*type*/ undefined ,
1568
- /*initializer*/ undefined
1569
- ) ;
1570
- }
1571
-
1572
1547
export function createFunctionCall ( func : Expression , thisArg : Expression , argumentsList : Expression [ ] , location ?: TextRange ) {
1573
1548
return createCall (
1574
1549
createPropertyAccess ( func , "call" ) ,
@@ -1781,13 +1756,10 @@ namespace ts {
1781
1756
return createArrowFunction (
1782
1757
/*modifiers*/ undefined ,
1783
1758
/*typeParameters*/ undefined ,
1784
- [ createParameter ( "name" ) ] ,
1759
+ [ createParameter ( /*decorators*/ undefined , /*modifiers*/ undefined , /*dotDotDotToken*/ undefined , "name" ) ] ,
1785
1760
/*type*/ undefined ,
1786
- /*equalsGreaterThanToken*/ undefined ,
1787
- createElementAccess (
1788
- target ,
1789
- createIdentifier ( "name" )
1790
- )
1761
+ createToken ( SyntaxKind . EqualsGreaterThanToken ) ,
1762
+ createElementAccess ( target , createIdentifier ( "name" ) )
1791
1763
) ;
1792
1764
}
1793
1765
@@ -1797,11 +1769,11 @@ namespace ts {
1797
1769
/*modifiers*/ undefined ,
1798
1770
/*typeParameters*/ undefined ,
1799
1771
[
1800
- createParameter ( "name" ) ,
1801
- createParameter ( "value" )
1772
+ createParameter ( /*decorators*/ undefined , /*modifiers*/ undefined , /*dotDotDotToken*/ undefined , "name" ) ,
1773
+ createParameter ( /*decorators*/ undefined , /*modifiers*/ undefined , /*dotDotDotToken*/ undefined , "value" )
1802
1774
] ,
1803
1775
/*type*/ undefined ,
1804
- /*equalsGreaterThanToken*/ undefined ,
1776
+ createToken ( SyntaxKind . EqualsGreaterThanToken ) ,
1805
1777
createAssignment (
1806
1778
createElementAccess (
1807
1779
target ,
@@ -1853,7 +1825,7 @@ namespace ts {
1853
1825
/*decorators*/ undefined ,
1854
1826
/*modifiers*/ undefined ,
1855
1827
"value" ,
1856
- [ createParameter ( "v" ) ] ,
1828
+ [ createParameter ( /*decorators*/ undefined , /*modifiers*/ undefined , /*dotDotDotToken*/ undefined , "v" ) ] ,
1857
1829
createBlock ( [
1858
1830
createStatement (
1859
1831
createCall (
@@ -1873,9 +1845,9 @@ namespace ts {
1873
1845
createArrowFunction (
1874
1846
/*modifiers*/ undefined ,
1875
1847
/*typeParameters*/ undefined ,
1876
- [ createParameter ( "name" ) ] ,
1848
+ [ createParameter ( /*decorators*/ undefined , /*modifiers*/ undefined , /*dotDotDotToken*/ undefined , "name" ) ] ,
1877
1849
/*type*/ undefined ,
1878
- /*equalsGreaterThanToken*/ undefined ,
1850
+ createToken ( SyntaxKind . EqualsGreaterThanToken ) ,
1879
1851
createLogicalOr (
1880
1852
createElementAccess (
1881
1853
createIdentifier ( "cache" ) ,
@@ -1915,8 +1887,8 @@ namespace ts {
1915
1887
/*name*/ undefined ,
1916
1888
/*typeParameters*/ undefined ,
1917
1889
[
1918
- createParameter ( "geti" ) ,
1919
- createParameter ( "seti" )
1890
+ createParameter ( /*decorators*/ undefined , /*modifiers*/ undefined , /*dotDotDotToken*/ undefined , "geti" ) ,
1891
+ createParameter ( /*decorators*/ undefined , /*modifiers*/ undefined , /*dotDotDotToken*/ undefined , "seti" )
1920
1892
] ,
1921
1893
/*type*/ undefined ,
1922
1894
createBlock ( [
@@ -2246,7 +2218,7 @@ namespace ts {
2246
2218
2247
2219
/**
2248
2220
* Ensures "use strict" directive is added
2249
- *
2221
+ *
2250
2222
* @param node source file
2251
2223
*/
2252
2224
export function ensureUseStrict ( node : SourceFile ) : SourceFile {
0 commit comments