本文整理汇总了C#中IronRuby.Builtins.RubyModule.InitializeConstantsNoLock方法的典型用法代码示例。如果您正苦于以下问题:C# RubyModule.InitializeConstantsNoLock方法的具体用法?C# RubyModule.InitializeConstantsNoLock怎么用?C# RubyModule.InitializeConstantsNoLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Builtins.RubyModule
的用法示例。
在下文中一共展示了RubyModule.InitializeConstantsNoLock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeMembersFrom
internal void InitializeMembersFrom(RubyModule/*!*/ module) {
Context.RequiresClassHierarchyLock();
Mutate();
Assert.NotNull(module);
#if !SILVERLIGHT // missing Clone on Delegate
if (module._namespaceTracker != null && _constants == null) {
#endif
// initialize the module so that we can copy all constants from it:
module.InitializeConstantsNoLock();
// initialize all ancestors of self:
InitializeConstantsNoLock();
#if !SILVERLIGHT
} else {
_constantsInitializer = (module._constantsInitializer != null) ? (Action<RubyModule>)module._constantsInitializer.Clone() : null;
_constantsState = module._constantsState;
}
#endif
_constants = (module._constants != null) ? new Dictionary<string, ConstantStorage>(module._constants) : null;
// copy namespace members:
if (module._namespaceTracker != null) {
Debug.Assert(_constants != null);
foreach (KeyValuePair<SymbolId, object> constant in module._namespaceTracker.SymbolAttributes) {
_constants.Add(SymbolTable.IdToString(constant.Key), new ConstantStorage(constant.Value));
}
}
#if SILVERLIGHT
module.InitializeMethodsNoLock();
InitializeMethodsNoLock();
#else
_methodsInitializer = (module._methodsInitializer != null) ? (Action<RubyModule>)module._methodsInitializer.Clone() : null;
_methodsState = module._methodsState;
#endif
_methods = (module._methods != null) ? new Dictionary<string, RubyMemberInfo>(module._methods) : null;
_classVariables = (module._classVariables != null) ? new Dictionary<string, object>(module._classVariables) : null;
_mixins = ArrayUtils.Copy(module._mixins);
// dependentModules - skip
// tracker - skip, .NET members not copied
// TODO:
// - handle overloads cached in groups
// - version updates
MethodsUpdated("InitializeFrom");
}
示例2: InitializeMembersFrom
internal void InitializeMembersFrom(RubyModule/*!*/ module) {
Context.RequiresClassHierarchyLock();
Mutate();
Assert.NotNull(module);
if (module._namespaceTracker != null && _constants == null) {
// initialize the module so that we can copy all constants from it:
module.InitializeConstantsNoLock();
// initialize all ancestors of self:
InitializeConstantsNoLock();
} else {
_constantsInitializer = Utils.CloneInvocationChain(module._constantsInitializer);
_constantsState = module._constantsState;
}
_constants = (module._constants != null) ? new Dictionary<string, ConstantStorage>(module._constants) : null;
// copy namespace members:
if (module._namespaceTracker != null) {
Debug.Assert(_constants != null);
foreach (KeyValuePair<string, object> constant in module._namespaceTracker) {
_constants.Add(constant.Key, new ConstantStorage(constant.Value));
}
}
_methodsInitializer = Utils.CloneInvocationChain(module._methodsInitializer);
_methodsState = module._methodsState;
if (module._methods != null) {
_methods = new Dictionary<string, RubyMemberInfo>(module._methods.Count);
foreach (var method in module._methods) {
_methods[method.Key] = method.Value.Copy(method.Value.Flags, this);
}
} else {
_methods = null;
}
_classVariables = (module._classVariables != null) ? new Dictionary<string, object>(module._classVariables) : null;
_mixins = ArrayUtils.Copy(module._mixins);
// dependentModules - skip
// tracker - skip, .NET members not copied
// TODO:
// - handle overloads cached in groups
// - version updates
MethodsUpdated("InitializeFrom");
}