@@ -113,10 +113,16 @@ class PagedFunctionDeclaration extends Function {
113113 * level (rather than as joined `where`-clause predicates) lets the optimizer
114114 * materialize a small relation and avoid the full
115115 * `MacroInvocation x MacroInvocation` Cartesian product on large corpora.
116+ *
117+ * Routed through `getStmt()` (which always binds for `PAGED_CODE` /
118+ * `PAGED_CODE_LOCKED`, since they expand to a stmt-form
119+ * `NT_ASSERT_ASSUME`) to avoid the expensive `getAnAffectedElement`
120+ * join used by the stock `MacroInvocation.getEnclosingFunction()`.
116121 */
117122class PagedCodeMacro extends MacroInvocation {
118123 PagedCodeMacro ( ) {
119124 this .getMacroName ( ) = [ "PAGED_CODE" , "PAGED_CODE_LOCKED" ]
125+ and this .getStmt ( ) .getEnclosingFunction ( ) instanceof PagedFunctionDeclaration
120126 }
121127
122128 /**
@@ -125,11 +131,6 @@ class PagedCodeMacro extends MacroInvocation {
125131 * Gets the paged enclosing function for this macro invocation,
126132 * including template instantiations.
127133 *
128- * Routed through `getStmt()` (which always binds for `PAGED_CODE` /
129- * `PAGED_CODE_LOCKED`, since they expand to a stmt-form
130- * `NT_ASSERT_ASSUME`) to avoid the expensive `getAnAffectedElement`
131- * join used by the stock `MacroInvocation.getEnclosingFunction()`.
132- *
133134 * NB: to compare two `PagedCodeMacro` invocations for "same
134135 * source-level function", also require `getFile()` agreement —
135136 * the extractor sometimes consolidates ODR-equivalent template
@@ -138,7 +139,6 @@ class PagedCodeMacro extends MacroInvocation {
138139 * function in another.
139140 */
140141 Function getEnclosingPagedFunction ( ) {
141- result = this .getStmt ( ) .getEnclosingFunction ( ) and
142- result instanceof PagedFunctionDeclaration
142+ result = this .getStmt ( ) .getEnclosingFunction ( )
143143 }
144144}
0 commit comments