File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#!/usr/bin/python
22# -*- coding: utf-8 -*-
3- # vim: ts=4:et:sw=4:
43
54# ----------------------------------------------------------------------
65# Copyleft (K), Jose M. Rodriguez-Rosa (a.k.a. Boriel)
98# the GNU General License
109# ----------------------------------------------------------------------
1110
11+ __all__ = "OpcodesTemps" , "init"
12+
1213
1314class Counter :
1415 """Implements a counter each time it's invoked"""
@@ -38,3 +39,9 @@ def __init__(self, prefix: str = "t"):
3839 def new_t (self ):
3940 """Returns a new t-value name"""
4041 return f"{ self ._prefix } { _COUNTER ()} "
42+
43+
44+ def init ():
45+ """Initializes the global container"""
46+ global _COUNTER
47+ _COUNTER = Counter ()
Original file line number Diff line number Diff line change 2727# Global containers
2828from src .api import errmsg
2929from src .api import global_ as gl
30+ from src .api import opcodestemps
3031from src .api .check import (
3132 check_and_make_label ,
3233 check_class ,
4647from src .api .debug import __DEBUG__
4748from src .api .errmsg import error , warning
4849from src .api .global_ import LoopInfo
49- from src .api .opcodestemps import OpcodesTemps
5050
5151# Compiler API
5252from src .api .symboltable .symboltable import SymbolTable
@@ -135,7 +135,8 @@ def init():
135135
136136 ast = None
137137 data_ast = None # Global Variables AST
138- optemps = OpcodesTemps ()
138+ opcodestemps .init ()
139+ optemps = opcodestemps .OpcodesTemps ()
139140
140141 gl .INITS .clear ()
141142 del gl .FUNCTION_CALLS [:]
@@ -3436,4 +3437,4 @@ def p_error(p):
34363437
34373438ast = None
34383439data_ast = None # Global Variables AST
3439- optemps = OpcodesTemps ()
3440+ optemps = opcodestemps . OpcodesTemps ()
You can’t perform that action at this time.
0 commit comments