@@ -1810,18 +1810,28 @@ namespace ts {
18101810 * @param node The get accessor node.
18111811 */
18121812 function visitGetAccessor ( node : GetAccessorDeclaration ) {
1813- if ( shouldElideFunctionLikeDeclaration ( node ) ) {
1813+ if ( shouldElideAccessorDeclaration ( node ) ) {
18141814 return undefined ;
18151815 }
18161816
18171817 return createGetAccessor (
18181818 visitNodes ( node . modifiers , visitor , isModifier ) ,
18191819 visitPropertyNameOfClassElement ( node ) ,
1820- visitEachChild ( node . body , visitor , context ) ,
1820+ node . body ? visitEachChild ( node . body , visitor , context ) : createBlock ( [ ] ) ,
18211821 node
18221822 ) ;
18231823 }
18241824
1825+ /**
1826+ * Determines whether a function-like declaration should be elided. A declaration should
1827+ * be elided if it is an overload, is abstract, or is an ambient declaration.
1828+ *
1829+ * @param node The declaration node.
1830+ */
1831+ function shouldElideAccessorDeclaration ( node : AccessorDeclaration ) {
1832+ return hasModifier ( node , ModifierFlags . Abstract | ModifierFlags . Ambient ) ;
1833+ }
1834+
18251835 /**
18261836 * Visits a set accessor declaration of a class.
18271837 *
@@ -1832,15 +1842,15 @@ namespace ts {
18321842 * @param node The set accessor node.
18331843 */
18341844 function visitSetAccessor ( node : SetAccessorDeclaration ) {
1835- if ( shouldElideFunctionLikeDeclaration ( node ) ) {
1845+ if ( shouldElideAccessorDeclaration ( node ) ) {
18361846 return undefined ;
18371847 }
18381848
18391849 return createSetAccessor (
18401850 visitNodes ( node . modifiers , visitor , isModifier ) ,
18411851 visitPropertyNameOfClassElement ( node ) ,
18421852 visitNode ( firstOrUndefined ( node . parameters ) , visitor , isParameter ) ,
1843- visitEachChild ( node . body , visitor , context ) ,
1853+ node . body ? visitEachChild ( node . body , visitor , context ) : createBlock ( [ ] ) ,
18441854 node
18451855 ) ;
18461856 }
0 commit comments