blob: 0ca6353336eadd5b22d35b0dda64f7d1370cb3f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
from dataclasses import dataclass, field
from typing import Set
from .base import *
@dataclass(frozen=True,eq=True)
class PointerType(Type):
of: Type
def __hash__(self):
return hash(("pointer", 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)
|