@@ -18,14 +18,19 @@ const SET_CLASS_METADATA_NAME = 'ɵsetClassMetadata';
1818 */
1919const SET_CLASS_METADATA_ASYNC_NAME = 'ɵsetClassMetadataAsync' ;
2020
21+ /**
22+ * Name of the function that sets debug information on classes.
23+ */
24+ const SET_CLASS_DEBUG_INFO_NAME = 'ɵsetClassDebugInfo' ;
25+
2126/**
2227 * Provides one or more keywords that if found within the content of a source file indicate
2328 * that this plugin should be used with a source file.
2429 *
2530 * @returns An a string iterable containing one or more keywords.
2631 */
2732export function getKeywords ( ) : Iterable < string > {
28- return [ SET_CLASS_METADATA_NAME , SET_CLASS_METADATA_ASYNC_NAME ] ;
33+ return [ SET_CLASS_METADATA_NAME , SET_CLASS_METADATA_ASYNC_NAME , SET_CLASS_DEBUG_INFO_NAME ] ;
2934}
3035
3136/**
@@ -51,7 +56,8 @@ export default function (): PluginObj {
5156 if (
5257 calleeName !== undefined &&
5358 ( isRemoveClassMetadataCall ( calleeName , callArguments ) ||
54- isRemoveClassmetadataAsyncCall ( calleeName , callArguments ) )
59+ isRemoveClassmetadataAsyncCall ( calleeName , callArguments ) ||
60+ isSetClassDebugInfoCall ( calleeName , callArguments ) )
5561 ) {
5662 // The metadata function is always emitted inside a function expression
5763 const parent = path . getFunctionParent ( ) ;
@@ -98,6 +104,16 @@ function isRemoveClassmetadataAsyncCall(
98104 ) ;
99105}
100106
107+ /** Determines if a function call is a call to `setClassDebugInfo`. */
108+ function isSetClassDebugInfoCall ( name : string , args : types . CallExpression [ 'arguments' ] ) : boolean {
109+ return (
110+ name === SET_CLASS_DEBUG_INFO_NAME &&
111+ args . length === 2 &&
112+ types . isIdentifier ( args [ 0 ] ) &&
113+ types . isObjectExpression ( args [ 1 ] )
114+ ) ;
115+ }
116+
101117/** Determines if a node is an inline function expression. */
102118function isInlineFunction ( node : types . Node ) : boolean {
103119 return types . isFunctionExpression ( node ) || types . isArrowFunctionExpression ( node ) ;
0 commit comments