summaryrefslogtreecommitdiff
path: root/tools/libdol2asm/types/const.py
blob: b379b3de62f9b59f5f8653e2b585986f1b828d20 (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 ConstType(Type):
    of: Type

    def __hash__(self):
        return hash(("const", 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)} const"

    def traverse(self, callback, depth):
        should_exit = callback(self, depth)
        if not should_exit:
            self.of.traverse(callback, depth + 1)