@typed_pos_args('subdir', str)
@typed_kwargs('subdir', KwargInfo('if_found', ContainerTypeInfo(list, object), validator=(lambda a: ('Objects must have a found() method' if (not all((hasattr(x, 'found') for x in a))) else None)), since='0.44.0', default=[], listify=True))
def func_subdir(self, node: mparser.BaseNode, args: T.Tuple[str], kwargs: 'kwargs.Subdir') -> None:
    mesonlib.check_direntry_issues(args)
    if ('..' in args[0]):
        raise InvalidArguments('Subdir contains ..')
    if ((self.subdir == '') and (args[0] == self.subproject_dir)):
        raise InvalidArguments('Must not go into subprojects dir with subdir(), use subproject() instead.')
    if ((self.subdir == '') and args[0].startswith('meson-')):
        raise InvalidArguments('The "meson-" prefix is reserved and cannot be used for top-level subdir().')
    if (args[0] == ''):
        raise InvalidArguments("The argument given to subdir() is the empty string ''. This is prohibited.")
    for i in kwargs['if_found']:
        if (not i.found()):
            return
    prev_subdir = self.subdir
    subdir = os.path.join(prev_subdir, args[0])
    if os.path.isabs(subdir):
        raise InvalidArguments('Subdir argument must be a relative path.')
    absdir = os.path.join(self.environment.get_source_dir(), subdir)
    symlinkless_dir = os.path.realpath(absdir)
    build_file = os.path.join(symlinkless_dir, 'meson.build')
    if (build_file in self.processed_buildfiles):
        raise InvalidArguments(f'Tried to enter directory "{subdir}", which has already been visited.')
    self.processed_buildfiles.add(build_file)
    self.subdir = subdir
    os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True)
    buildfilename = os.path.join(self.subdir, environment.build_filename)
    self.build_def_files.add(buildfilename)
    absname = os.path.join(self.environment.get_source_dir(), buildfilename)
    if (not os.path.isfile(absname)):
        self.subdir = prev_subdir
        raise InterpreterException(f"Non-existent build file '{buildfilename!s}'")
    with open(absname, encoding='utf-8') as f:
        code = f.read()
    assert isinstance(code, str)
    try:
        codeblock = mparser.Parser(code, absname).parse()
    except mesonlib.MesonException as me:
        me.file = absname
        raise me
    try:
        self.evaluate_codeblock(codeblock)
    except SubdirDoneRequest:
        pass
    self.subdir = prev_subdir
@typed_pos_args('subdir', str)
@typed_kwargs('subdir', KwargInfo('if_found', ContainerTypeInfo(list, object), validator=(lambda a: ('Objects must have a found() method' if (not all((hasattr(x, 'found') for x in a))) else None)), since='0.44.0', default=[], listify=True))
def func_subdir(self, node: mparser.BaseNode, args: T.Tuple[str], kwargs: 'kwargs.Subdir') -> None:
    mesonlib.check_direntry_issues(args)
    if ('..' in args[0]):
        raise InvalidArguments('Subdir contains ..')
    if ((self.subdir == ) and (args[0] == self.subproject_dir)):
        raise InvalidArguments('Must not go into subprojects dir with subdir(), use subproject() instead.')
    if ((self.subdir == ) and args[0].startswith('meson-')):
        raise InvalidArguments('The "meson-" prefix is reserved and cannot be used for top-level subdir().')
    if (args[0] == ):
        raise InvalidArguments("The argument given to subdir() is the empty string . This is prohibited.")
    for i in kwargs['if_found']:
        if (not i.found()):
            return
    prev_subdir = self.subdir
    subdir = os.path.join(prev_subdir, args[0])
    if os.path.isabs(subdir):
        raise InvalidArguments('Subdir argument must be a relative path.')
    absdir = os.path.join(self.environment.get_source_dir(), subdir)
    symlinkless_dir = os.path.realpath(absdir)
    build_file = os.path.join(symlinkless_dir, 'meson.build')
    if (build_file in self.processed_buildfiles):
        raise InvalidArguments(f'Tried to enter directory "{subdir}", which has already been visited.')
    self.processed_buildfiles.add(build_file)
    self.subdir = subdir
    os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True)
    buildfilename = os.path.join(self.subdir, environment.build_filename)
    self.build_def_files.add(buildfilename)
    absname = os.path.join(self.environment.get_source_dir(), buildfilename)
    if (not os.path.isfile(absname)):
        self.subdir = prev_subdir
        raise InterpreterException(f"Non-existent build file '{buildfilename!s}'")
    with open(absname, encoding='utf-8') as f:
        code = f.read()
    assert isinstance(code, str)
    try:
        codeblock = mparser.Parser(code, absname).parse()
    except mesonlib.MesonException as me:
        me.file = absname
        raise me
    try:
        self.evaluate_codeblock(codeblock)
    except SubdirDoneRequest:
        pass
    self.subdir = prev_subdir