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


C# RubyScope.GetInnerMostMethodScope方法代码示例

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


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

示例1: HasBlock

 public static bool HasBlock(RubyScope/*!*/ scope, object self) {
     var methodScope = scope.GetInnerMostMethodScope();
     return methodScope != null && methodScope.BlockParameter != null;
 }
开发者ID:aceptra,项目名称:ironruby,代码行数:4,代码来源:KernelOps.cs

示例2: CreateNew

        public static Proc/*!*/ CreateNew(CallSiteStorage<Func<CallSite, Proc, Proc, object>>/*!*/ storage, 
            RubyScope/*!*/ scope, RubyClass/*!*/ self) {

            RubyMethodScope methodScope = scope.GetInnerMostMethodScope();
            if (methodScope == null || methodScope.BlockParameter == null) {
                throw RubyExceptions.CreateArgumentError("tried to create Proc object without a block");
            }

            return CreateNew(storage, self, methodScope.BlockParameter);
        }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:10,代码来源:ProcOps.cs

示例3: Evaluate

        public static object Evaluate(MutableString/*!*/ code, RubyScope/*!*/ targetScope, object self, RubyModule module, MutableString file, int line) {
            Assert.NotNull(code, targetScope);

            RubyContext context = targetScope.RubyContext;
            RubyMethodScope methodScope = targetScope.GetInnerMostMethodScope();

            Utils.Log(Interlocked.Increment(ref _stringEvalCounter).ToString(), "EVAL");

            // we want to create a new top-level local scope:
            var options = CreateCompilerOptionsForEval(targetScope, methodScope, module != null, line);

            SourceUnit source = context.CreateSnippet(code.ConvertToString(), file != null ? file.ConvertToString() : "(eval)", SourceCodeKind.Statements);
            Expression<EvalEntryPointDelegate> lambda;
            try {
                lambda = context.ParseSourceCode<EvalEntryPointDelegate>(source, options, context.RuntimeErrorSink);
            } catch (SyntaxError e) {
                Utils.Log(e.Message, "EVAL_ERROR");
                Utils.Log(new String('-', 50), "EVAL_ERROR");
                Utils.Log(source.GetCode(), "EVAL_ERROR");
                Utils.Log(new String('-', 50), "EVAL_ERROR");
                throw;
            }
            Debug.Assert(lambda != null);

            Proc blockParameter;
            RubyMethodInfo methodDefinition;
            if (methodScope != null) {
                blockParameter = methodScope.BlockParameter;
                methodDefinition = methodScope.Method;
            } else {
                blockParameter = null;
                methodDefinition = null;
            }

            if (context.Options.InterpretedMode) {
                return Interpreter.TopLevelExecute(new InterpretedScriptCode(lambda, source),
                    targetScope,
                    self,
                    module,
                    blockParameter,
                    methodDefinition,
                    targetScope.RuntimeFlowControl
                );
            } else {
                return lambda.Compile(source.EmitDebugSymbols)(
                    targetScope,
                    self,
                    module,
                    blockParameter,
                    methodDefinition,
                    targetScope.RuntimeFlowControl
                );
            }
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:54,代码来源:RubyUtils.cs

示例4: CreateNew

        public static Proc/*!*/ CreateNew(CallSiteStorage<Func<CallSite, object, object>>/*!*/ storage, 
            RubyScope/*!*/ scope, RubyClass/*!*/ self) {

            RubyMethodScope methodScope = scope.GetInnerMostMethodScope();
            if (methodScope == null || methodScope.BlockParameter == null) {
                throw RubyExceptions.CreateArgumentError("tried to create Proc object without a block");
            }

            var proc = methodScope.BlockParameter;

            // an instance of Proc class, the identity is preserved:
            if (self.GetUnderlyingSystemType() == typeof(Proc)) {
                return proc;
            }

            // an instance of a Proc subclass:
            var result = new Proc.Subclass(self, proc);

            var initialize = storage.GetCallSite("initialize", new RubyCallSignature(0, RubyCallFlags.HasImplicitSelf));
            initialize.Target(initialize, result);

            return result;
        }
开发者ID:kevinkeeney,项目名称:ironruby,代码行数:23,代码来源:ProcOps.cs

示例5: CreateCompilerOptionsForEval

 public static RubyCompilerOptions/*!*/ CreateCompilerOptionsForEval(RubyScope/*!*/ targetScope, int line) {
     return CreateCompilerOptionsForEval(targetScope, targetScope.GetInnerMostMethodScope(), false, line);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:3,代码来源:RubyUtils.cs


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