(context, func)
| 31886 | return func(); |
| 31887 | } |
| 31888 | function doInsideOfContext(context, func) { |
| 31889 | // contextFlagsToSet will contain only the context flags that |
| 31890 | // are not currently set that we need to temporarily enable. |
| 31891 | // We don't just blindly reset to the previous flags to ensure |
| 31892 | // that we do not mutate cached flags for the incremental |
| 31893 | // parser (ThisNodeHasError, ThisNodeOrAnySubNodesHasError, and |
| 31894 | // HasAggregatedChildData). |
| 31895 | var contextFlagsToSet = context & ~contextFlags; |
| 31896 | if (contextFlagsToSet) { |
| 31897 | // set the requested context flags |
| 31898 | setContextFlag(/*val*/ true, contextFlagsToSet); |
| 31899 | var result = func(); |
| 31900 | // reset the context flags we just set |
| 31901 | setContextFlag(/*val*/ false, contextFlagsToSet); |
| 31902 | return result; |
| 31903 | } |
| 31904 | // no need to do anything special as we are already in all of the requested contexts |
| 31905 | return func(); |
| 31906 | } |
| 31907 | function allowInAnd(func) { |
| 31908 | return doOutsideOfContext(4096 /* NodeFlags.DisallowInContext */, func); |
| 31909 | } |
no test coverage detected