Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address most of the review remarks
  • Loading branch information
erlend-aasland committed May 21, 2023
commit ddf973e6c6ef179f412806dc190b0b2f57edd1eb
19 changes: 10 additions & 9 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,8 +1913,6 @@ def dump(self):
return "".join(texts)


DestinationDict = dict[str, "Destination"]

class Destination:
def __init__(self, name, type, clinic, *args):
self.name = name
Expand Down Expand Up @@ -2000,6 +1998,11 @@ def write_file(filename: str, new_contents: str):
raise


ClassDict = dict[str, "Class"]
DestinationDict = dict[str, Destination]
ModuleDict = dict[str, "Module"]
ParserDict = dict[str, "DSLParser"]

clinic = None
class Clinic:

Expand Down Expand Up @@ -2090,10 +2093,13 @@ def __init__(
'impl_definition': d('block'),
}

self.destination_buffers_stack: list[Any] = []
DestBufferType = dict[str, Callable[..., Any]]
DestBufferList = list[DestBufferType]

self.destination_buffers_stack: DestBufferList = []
self.ifndef_symbols: set[str] = set()

self.presets: dict[str, Any] = {}
self.presets: dict[str, dict[Any, Any]] = {}
preset = None
for line in self.presets_text.strip().split('\n'):
line = line.strip()
Expand Down Expand Up @@ -2302,8 +2308,6 @@ def parse(self, block: Block) -> None:
block.output = s.getvalue()


ModuleDict = dict[str, "Module"]

class Module:
def __init__(
self,
Expand All @@ -2321,8 +2325,6 @@ def __repr__(self) -> str:
return "<clinic.Module " + repr(self.name) + " at " + str(id(self)) + ">"


ClassDict = dict[str, "Class"]

class Class:
def __init__(
self,
Expand Down Expand Up @@ -4219,7 +4221,6 @@ def dedent(self, line):
return line[indent:]


ParserDict = dict[str, "DSLParser"]
StateKeeper = Callable[[str | None], None]

class DSLParser:
Expand Down