blob: 7abff28457869d10cf1e750b9375fe183eb08e1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from dataclasses import dataclass, field
from typing import Set
from .base import *
@dataclass(frozen=True,eq=True)
class ReferenceType(Type):
of: Type
def __hash__(self):
return hash(("reference", self.of))
def type(self,
specialize_templates: bool = False,
without_template: bool = False) -> str:
return f"{self.of.type(specialize_templates=specialize_templates,without_template=without_template)}&"
def traverse(self, callback, depth):
should_exit = callback(self, depth)
if not should_exit:
self.of.traverse(callback, depth + 1)
|