File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010# ----------------------------------------------------------------------
1111
1212
13- class __Singleton (object ):
14- pass
13+ class Counter :
14+ """ Implements a counter each time it's invoked
15+ """
16+ def __init__ (self , start : int = 0 , step : int = 1 ):
17+ self ._count = start
18+ self ._step = step
19+
20+ def __call__ (self ) -> int :
21+ result = self ._count
22+ self ._count += self ._step
23+
24+ return result
1525
1626
17- singleton = __Singleton ()
18- singleton .table = {}
19- singleton .count = 0
27+ _COUNTER = Counter ()
2028
2129
22- class OpcodesTemps ( object ) :
30+ class OpcodesTemps :
2331 """ Manages a table of Tn temporal values.
2432 This should be a SINGLETON container
2533 """
26- def __init__ (self ):
27- self .data = singleton
34+ def __init__ (self , prefix : str = "t" ):
35+ self ._prefix = prefix
2836
2937 def new_t (self ):
3038 """ Returns a new t-value name
3139 """
32- self .data .count += 1
33- return 't%i' % (self .data .count - 1 )
40+ return f"{ self ._prefix } { _COUNTER ()} "
You can’t perform that action at this time.
0 commit comments