handle library=None

This commit is contained in:
Jan Petykiewicz 2023-01-23 22:35:15 -08:00 committed by jan
parent 0368cf7a00
commit a1073eca6b

View File

@ -196,7 +196,7 @@ class Ref(
raise PatternError('as_pattern() must be given a pattern or library.') raise PatternError('as_pattern() must be given a pattern or library.')
if pattern is None and self.target is None: if pattern is None and self.target is None:
return None return None
if self.target not in library: if library is not None and self.target not in library:
raise PatternError(f'get_bounds() called on dangling reference to "{self.target}"') raise PatternError(f'get_bounds() called on dangling reference to "{self.target}"')
return self.as_pattern(pattern=pattern, library=library).get_bounds() return self.as_pattern(pattern=pattern, library=library).get_bounds()