Skip to content

Commit

Permalink
Remove set generation methods from Scope
Browse files Browse the repository at this point in the history
Prior to this change, we had replaced all callers with the query
equivalents. This provides a considerable performance improvement when
compiling large files, as we are no longer repeatedly creating new sets.

This change removes the unused methods which generated the sets as they
are no longer needed (and are a footgun).
  • Loading branch information
leamingrad committed May 26, 2024
1 parent 72442eb commit a9d5d69
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/fluent_compiler/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ def __init__(self, parent_scope=None):
self._properties = {}
self._assignments = {}

def names_in_use(self):
names = self.names
if self.parent_scope is not None:
names = names | self.parent_scope.names_in_use()
return names

def is_name_in_use(self, name: str) -> bool:
if name in self.names:
return True
Expand All @@ -131,12 +125,6 @@ def is_name_in_use(self, name: str) -> bool:

return self.parent_scope.is_name_in_use(name)

def function_arg_reserved_names(self):
names = self._function_arg_reserved_names
if self.parent_scope is not None:
names = names | self.parent_scope.function_arg_reserved_names()
return names

def is_name_reserved_function_arg(self, name: str) -> bool:
if name in self._function_arg_reserved_names:
return True
Expand All @@ -146,9 +134,6 @@ def is_name_reserved_function_arg(self, name: str) -> bool:

return self.parent_scope.is_name_reserved_function_arg(name)

def all_reserved_names(self):
return self.names_in_use() | self.function_arg_reserved_names()

def is_name_reserved(self, name: str) -> bool:
return self.is_name_in_use(name) or self.is_name_reserved_function_arg(name)

Expand Down

0 comments on commit a9d5d69

Please sign in to comment.