mirror of
https://github.com/react/react-native.git
synced 2026-09-28 13:23:09 +08:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56085 Changelog: [Internal] Moves the logic responsible for generating a string view of the scope's body to the base class to reduce duplication. Similarly, moves the logic responsible for qualifying template arguments to the `Extensible` class. Reviewed By: cipolleschi Differential Revision: D96455746 fbshipit-source-id: 1d800c7992080e02831f61fee4aaa9cb31f8fc9a
29 lines
849 B
Python
29 lines
849 B
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from .base_scope_kind import ScopeKind
|
|
from .extendable import Extendable
|
|
|
|
if TYPE_CHECKING:
|
|
from .scope import Scope
|
|
|
|
|
|
class InterfaceScopeKind(ScopeKind, Extendable):
|
|
def __init__(self) -> None:
|
|
ScopeKind.__init__(self, "interface")
|
|
Extendable.__init__(self)
|
|
|
|
def close(self, scope: Scope) -> None:
|
|
self.qualify_base_classes(scope)
|
|
|
|
def to_string(self, scope: Scope) -> str:
|
|
inheritance = self.get_inheritance_string()
|
|
header = f"{self.name} {scope.get_qualified_name()}{inheritance} "
|
|
return header + self._format_scope_body(scope)
|