private void InitializeConstantTableNoLock() {
if (!ConstantInitializationNeeded) return;
_constants = new Dictionary<string, ConstantStorage>();
_constantsState = MemberTableState.Initializing;
try {
if (_constantsInitializer != EmptyInitializer) {
if (_constantsInitializer != null) {
Utils.Log(_name ?? "<anonymous>", "CT_INIT");
// TODO: use lock-free operations in initializers
_constantsInitializer(this);
} else if (_typeTracker != null && !_typeTracker.Type.IsInterface) {
// Load types eagerly. We do this only for CLR types that have no constant initializer (not builtins) and
// a constant access is performed (otherwise this method wouldn't be called).
//
// Note: Interfaces cannot declare nested types in C#, we follow the suit here.
// We don't currently need this restriction but once we implement generic type overload inheritance properly
// we would need to deal with inheritance from interfaces, which might be too complex.
//
LoadNestedTypes();
}
}
} finally {
_constantsInitializer = null;
_constantsState = MemberTableState.Initialized;
}
}