build/lib/layersChecker.ts/checkFile
function checkFile(program: ts.Program, sourceFile: ts.SourceFile, rule: IRule) {
	checkNode(sourceFile);

	function checkNode(node: ts.Node): void {
		if (node.kind !== ts.SyntaxKind.Identifier) {
			return ts.forEachChild(node, checkNode); // recurse down
		}

		const checker = program.getTypeChecker();
		const symbol = checker.getSymbolAtLocation(node);

		if (!symbol) {
			return;
		}

		let _parentSymbol: any = symbol;

		while (_parentSymbol.parent) {
			_parentSymbol = _parentSymbol.parent;
		}

		const parentSymbol = _parentSymbol as ts.Symbol;
		const text = parentSymbol.getName();

		if (rule.allowedTypes?.some(allowed => allowed === text)) {
			return; // override
		}

		if (rule.disallowedTypes?.some(disallowed => disallowed === text)) {
			const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
			console.log(`[build/lib/layersChecker.ts]: Reference to type '${text}' violates layer '${rule.target}' (${sourceFile.fileName} (${line + 1},${character + 1}). Learn more about our source code organization at https://github.com/microsoft/vscode/wiki/Source-Code-Organization.`);

			hasErrors = true;
			return;
		}

		const declarations = symbol.declarations;
		if (Array.isArray(declarations)) {
			DeclarationLoop: for (const declaration of declarations) {
				if (declaration) {
					const parent = declaration.parent;
					if (parent) {
						const parentSourceFile = parent.getSourceFile();
						if (parentSourceFile) {
							const definitionFileName = parentSourceFile.fileName;
							if (rule.allowedDefinitions) {
								for (const allowedDefinition of rule.allowedDefinitions) {
									if (definitionFileName.indexOf(allowedDefinition) >= 0) {
										continue DeclarationLoop;
									}
								}
							}
							if (rule.disallowedDefinitions) {
								for (const disallowedDefinition of rule.disallowedDefinitions) {
									if (definitionFileName.indexOf(disallowedDefinition) >= 0) {
										const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());

										console.log(`[build/lib/layersChecker.ts]: Reference to symbol '${text}' from '${disallowedDefinition}' violates layer '${rule.target}' (${sourceFile.fileName} (${line + 1},${character + 1}) Learn more about our source code organization at https://github.com/microsoft/vscode/wiki/Source-Code-Organization.`);

										hasErrors = true;
										return;
									}
								}
							}
						}
					}
				}
			}
		}
	}
}