Files
langkit/langkit/__init__.py
Pierre-Marie de Rodat 2b9b33d6a0 Remove __future__ imports and adjust stylechecks
TN: T511-017
2020-05-26 12:33:48 +02:00

28 lines
759 B
Python

def reset():
"""
Reset global state in Langkit.
TODO: this is a hack to workaround another hack. At some point in the
future, we should get rid of this global state in Langkit.
"""
import langkit.compile_context
import langkit.compiled_types
import langkit.dsl
import langkit.expressions.base
import langkit.utils
langkit.compiled_types.CompiledTypeRepo.reset()
langkit.compiled_types.create_builtin_types()
langkit.dsl._StructMetaclass.reset()
langkit.dsl._ASTNodeMetaclass.reset()
langkit.dsl._EnumMetaclass.reset()
langkit.expressions.base.Entity.unfreeze()
langkit.expressions.base.Self.unfreeze()
langkit.utils.reset_memoized()
langkit.compile_context.compile_ctx = None