private static int getSources(CodeBlock block, List<CodeBlockReference> blockRefQueue, TaskMonitor monitor) throws CancelledException {
    	
    	if (block == null || block.getMinAddress() == null) {
            return 0;
        }

        int count = 0;

		CodeBlockModel model = block.getModel();

        // Iterate over all basic blocks within specified block
        CodeBlockIterator bblockIter = (model.getBasicBlockModel()).getCodeBlocksContaining(block, monitor);
        while (bblockIter.hasNext()) {

			// Get next basic block
			CodeBlock bblock = bblockIter.next();
			
			// Get basic block sources
			CodeBlockReferenceIterator bbSrcIter = bblock.getSources(monitor);
			while (bbSrcIter.hasNext()) {
				CodeBlockReference bbSrcRef = bbSrcIter.next();
				FlowType refFlowType = bbSrcRef.getFlowType();
				
				if (refFlowType.isCall()) 
                {
					// Add all forward CALL references to queue
					count += queueSrcReferences(blockRefQueue,
						block, 
						bbSrcRef.getReference(), 
						bbSrcRef.getReferent(), 
						refFlowType,
						monitor);
                }
                else if (refFlowType.isJump() || refFlowType.isFallthrough()) 
                {		
                	// Add external JUMP and FALL-THROUGH references to queue
                	Address srcAddr = bbSrcRef.getReferent();
                	if (!block.contains(srcAddr) && model.getFirstCodeBlockContaining(srcAddr, monitor) != null) {
                		count += queueSrcReferences(blockRefQueue, 
                			block,
                			bbSrcRef.getReference(), 
                			srcAddr, 
                			refFlowType,
                			monitor);
                    }
                }
			}			
        }
		return count;
    }
Count and queue all source references flowing from this subroutine (block).
All Calls to this block, and all external FlowType block references
to this block are counted.

@param block code block to get the number of source references to.
@param blockRefQueue the CodeBlockReference queue, may be null
@param monitor task monitor which allows user to cancel operation.
@throws CancelledException if the monitor cancels the operation.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/block/SubroutineSourceReferenceIterator.java