docs: function buildPropsTreeBranches(
  	recordTypes, topPropDesc, clause, baseValueExprCtx, scopePropPath,
  	propPatterns, options) {
  
  	// create the branching tree top node
  	const topNode = PropertyTreeNode.createTopNode(
  		recordTypes, topPropDesc, baseValueExprCtx, clause);
  
  	// add direct patterns
  	const valuePropsTrees = new Map();
  	const excludedPaths = new Set();
  	let wcPatterns = (!(options && options.noWildcards) && new Array());
  	for (let propPattern of propPatterns) {
  		if (propPattern.startsWith('-'))
  			excludedPaths.add(propPattern.substring(1));
  		else
  			addProperty(
  				topNode, scopePropPath, propPattern, clause, options,
  				valuePropsTrees, wcPatterns);
  	}
  
  	// add wildcard patterns
  	while (wcPatterns && (wcPatterns.length > 0)) {
  		const wcPatterns2 = new Array();
  		wcPatterns.forEach(propPattern => {
  			if (!excludedPaths.has(propPattern))
  				addProperty(
  					topNode, scopePropPath, propPattern, clause, options,
  					valuePropsTrees, wcPatterns2);
  		});
  		wcPatterns = wcPatterns2;
  	}
  
  	// add scope if requested
  	if (options && options.includeScopeProp && scopePropPath &&
  		!topNode.includesProp(scopePropPath)) {
  		const scopeOptions = Object.create(options);
  		scopeOptions.includeScopeProp = false;
  		scopeOptions.noCalculated = true;
  		scopeOptions.allowLeafObjects = true;
  		addProperty(topNode, null, scopePropPath, clause, scopeOptions);
  	}
  
  	// de-branch the tree and merge in the value trees
  	const assertSingleBranch = (branches, enable) => {
  		if (enable && (branches.length > 1))
  			throw new Error('Internal X2 error: unexpected multiple branches.');
  		return branches;
  	};
  	const valuePropsTreesArray = Array.from(valuePropsTrees.entries());
  	return assertSingleBranch(topNode.debranch().map(
  		branch => valuePropsTreesArray.reduce((res, pair) => {
  			const valuePropPath = pair[0];
  			const valuePropsTree = pair[1];
  			if (!res.includesProp(valuePropPath))
  				return res;
  			return res.combine(valuePropsTree);
  		}, branch)
  	), scopePropPath);
  }