@@ -18,14 +18,19 @@ const SET_CLASS_METADATA_NAME = 'ɵsetClassMetadata';
18
18
*/
19
19
const SET_CLASS_METADATA_ASYNC_NAME = 'ɵsetClassMetadataAsync' ;
20
20
21
+ /**
22
+ * Name of the function that sets debug information on classes.
23
+ */
24
+ const SET_CLASS_DEBUG_INFO_NAME = 'ɵsetClassDebugInfo' ;
25
+
21
26
/**
22
27
* Provides one or more keywords that if found within the content of a source file indicate
23
28
* that this plugin should be used with a source file.
24
29
*
25
30
* @returns An a string iterable containing one or more keywords.
26
31
*/
27
32
export 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 ] ;
29
34
}
30
35
31
36
/**
@@ -51,7 +56,8 @@ export default function (): PluginObj {
51
56
if (
52
57
calleeName !== undefined &&
53
58
( isRemoveClassMetadataCall ( calleeName , callArguments ) ||
54
- isRemoveClassmetadataAsyncCall ( calleeName , callArguments ) )
59
+ isRemoveClassmetadataAsyncCall ( calleeName , callArguments ) ||
60
+ isSetClassDebugInfoCall ( calleeName , callArguments ) )
55
61
) {
56
62
// The metadata function is always emitted inside a function expression
57
63
const parent = path . getFunctionParent ( ) ;
@@ -98,6 +104,16 @@ function isRemoveClassmetadataAsyncCall(
98
104
) ;
99
105
}
100
106
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
+
101
117
/** Determines if a node is an inline function expression. */
102
118
function isInlineFunction ( node : types . Node ) : boolean {
103
119
return types . isFunctionExpression ( node ) || types . isArrowFunctionExpression ( node ) ;
0 commit comments