当前位置: 首页>>代码示例>>C#>>正文


C# RubyModule.EnsureInitialized方法代码示例

本文整理汇总了C#中IronRuby.Builtins.RubyModule.EnsureInitialized方法的典型用法代码示例。如果您正苦于以下问题:C# RubyModule.EnsureInitialized方法的具体用法?C# RubyModule.EnsureInitialized怎么用?C# RubyModule.EnsureInitialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IronRuby.Builtins.RubyModule的用法示例。


在下文中一共展示了RubyModule.EnsureInitialized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeMembersFrom

        internal void InitializeMembersFrom(RubyModule/*!*/ module) {
            ContractUtils.RequiresNotNull(module, "module");

#if !SILVERLIGHT // missing Clone on Delegate
            if (module.DeclaresGlobalConstants || module._clrConstants != null && _constants == null) {
#endif
                EnsureInitialized();
                module.EnsureInitialized();
#if !SILVERLIGHT
            } else {
                _state = module._state;
                _initializer = (module._initializer != null) ? (Action<RubyModule>)module._initializer.Clone() : null;
            }
#endif

            if (module.DeclaresGlobalConstants) {
                Debug.Assert(module._constants == null && module._clrConstants == null);
                Debug.Assert(_constants != null);
                _constants.Clear();
                foreach (KeyValuePair<SymbolId, object> constant in _context.TopGlobalScope.Items) {
                    _constants.Add(SymbolTable.IdToString(constant.Key), constant.Value);
                }
            } else {
                _constants = (module._constants != null) ? new Dictionary<string, object>(module._constants) : null;

                // copy namespace members:
                if (module._clrConstants != null) {
                    Debug.Assert(_constants != null);
                    foreach (KeyValuePair<SymbolId, object> constant in module._clrConstants.SymbolAttributes) {
                        _constants.Add(SymbolTable.IdToString(constant.Key), constant.Value);
                    }
                }
            }

            _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

            Updated("InitializeFrom");
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:43,代码来源:RubyModule.cs

示例2: AddFullVersionTest

        internal void AddFullVersionTest(RubyModule/*!*/ module, RubyContext/*!*/ context, Expression/*!*/ contextExpression) {
            Assert.NotNull(module, context, contextExpression);
            module.EnsureInitialized(); // Initialization changes the version number, so ensure that the module is initialized

            // check for runtime (note that the module's runtime could be different from the call-site runtime):
            AddRestriction(Ast.Equal(contextExpression, Ast.Constant(context)));

            // check for version:
            AddCondition(Ast.Equal(Ast.Property(Ast.Constant(module), RubyModule.VersionProperty), Ast.Constant(module.Version)));
        }
开发者ID:joshholmes,项目名称:ironruby,代码行数:10,代码来源:MetaObjectBuilder.cs


注:本文中的IronRuby.Builtins.RubyModule.EnsureInitialized方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。