MCPcopy Create free account
hub / github.com/nodejs/node / addRule

Function addRule

test/fixtures/snapshot/typescript.js:146927–146936  ·  view source on GitHub ↗
(rules, rule, specificTokens, constructionState, rulesBucketIndex)

Source from the content-addressed store, hash-verified

146925 // In order to insert a rule to the end of sub-bucket (3), we get the index by adding
146926 // the values in the bitmap segments 3rd, 2nd, and 1st.
146927 function addRule(rules, rule, specificTokens, constructionState, rulesBucketIndex) {
146928 var position = rule.action & 3 /* RuleAction.StopAction */ ?
146929 specificTokens ? RulesPosition.StopRulesSpecific : RulesPosition.StopRulesAny :
146930 rule.context !== formatting.anyContext ?
146931 specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny :
146932 specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny;
146933 var state = constructionState[rulesBucketIndex] || 0;
146934 rules.splice(getInsertionIndex(state, position), 0, rule);
146935 constructionState[rulesBucketIndex] = increaseInsertionIndex(state, position);
146936 }
146937 function getInsertionIndex(indexBitmap, maskPosition) {
146938 var index = 0;
146939 for (var pos = 0; pos <= maskPosition; pos += maskBitSize) {

Callers 1

buildMapFunction · 0.85

Calls 2

getInsertionIndexFunction · 0.85
increaseInsertionIndexFunction · 0.85

Tested by

no test coverage detected