MCPcopy Index your code
hub / github.com/nodejs/node / createRulesMap

Function createRulesMap

test/fixtures/snapshot/typescript.js:146852–146872  ·  view source on GitHub ↗
(rules)

Source from the content-addressed store, hash-verified

146850 return mask;
146851 }
146852 function createRulesMap(rules) {
146853 var map = buildMap(rules);
146854 return function (context) {
146855 var bucket = map[getRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind)];
146856 if (bucket) {
146857 var rules_1 = [];
146858 var ruleActionMask = 0;
146859 for (var _i = 0, bucket_1 = bucket; _i < bucket_1.length; _i++) {
146860 var rule = bucket_1[_i];
146861 var acceptRuleActions = ~getRuleActionExclusion(ruleActionMask);
146862 if (rule.action & acceptRuleActions && ts.every(rule.context, function (c) { return c(context); })) {
146863 rules_1.push(rule);
146864 ruleActionMask |= rule.action;
146865 }
146866 }
146867 if (rules_1.length) {
146868 return rules_1;
146869 }
146870 }
146871 };
146872 }
146873 function buildMap(rules) {
146874 // Map from bucket index to array of rules
146875 var map = new Array(mapRowLength * mapRowLength);

Callers 1

getRulesMapFunction · 0.85

Calls 6

buildMapFunction · 0.85
getRuleBucketIndexFunction · 0.85
getRuleActionExclusionFunction · 0.85
everyMethod · 0.80
cFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected