1#!/bin/bash 2 3set -euo pipefail 4 5BUILTIN_NAME="$1" 6 7if ! which rg >/dev/null ; then 8 echo >&2 "This tool requires 'rg', install it with 'sudo apt install ripgrep'" 9 exit 1 10fi 11 12TOOLS_DIRNAME="$(dirname "$0")" 13V8_DIRNAME="$(dirname "$TOOLS_DIRNAME")" 14 15if rg --type-add 'tq:*.tq' --type tq --with-filename --line-number "\bbuiltin $BUILTIN_NAME\b" "$V8_DIRNAME" | rg -v '\bextern builtin\b' | cut -f1-2 -d: ; then 16 exit 0 17fi 18 19if rg --type cpp --with-filename --line-number "\b(TF_BUILTIN\(|::Generate_?)$BUILTIN_NAME\b" "$V8_DIRNAME" | cut -f1-2 -d: ; then 20 exit 0 21fi 22 23echo >&2 "Builtin '$BUILTIN_NAME' not found" 24exit 1