Пример #1
0
        public void GetInnerMostBlockOrMethodScope(out RubyBlockScope blockScope, out RubyMethodScope methodScope)
        {
            methodScope = null;
            blockScope  = null;
            RubyScope scope = this;

            while (scope != null)
            {
                switch (scope.Kind)
                {
                case ScopeKind.Block:
                case ScopeKind.BlockMethod:
                case ScopeKind.BlockModule:
                    blockScope = (RubyBlockScope)scope;
                    return;

                case ScopeKind.Method:
                    methodScope = (RubyMethodScope)scope;
                    return;
                }

                scope = scope.Parent;
            }
        }
Пример #2
0
        public void GetInnerMostBlockOrMethodScope(out RubyBlockScope blockScope, out RubyMethodScope methodScope) {
            methodScope = null;
            blockScope = null;
            RubyScope scope = this;
            while (scope != null) {
                switch (scope.Kind) {
                    case ScopeKind.Block:
                        blockScope = (RubyBlockScope)scope;
                        return;

                    case ScopeKind.Method:
                        methodScope = (RubyMethodScope)scope;
                        return;
                }

                scope = scope.Parent;
            }
        }
Пример #3
0
 public static void LeaveBlockFrame(RubyBlockScope/*!*/ scope) {
     
 }
Пример #4
0
 public static void TraceBlockReturn(RubyBlockScope/*!*/ scope, BlockParam/*!*/ block, string fileName, int lineNumber) {
     if (block.IsMethod) {
         scope.RubyContext.ReportTraceEvent("return", scope, block.MethodLookupModule, block.MethodName, fileName, lineNumber);
     }
 }
Пример #5
0
        public static RubyBlockScope/*!*/ CreateBlockScope(LocalsDictionary/*!*/ locals, RubyScope/*!*/ parent,
            BlockParam/*!*/ blockParam, object selfObject, InterpretedFrame interpretedFrame) {
            Assert.NotNull(locals, parent, blockParam);

            RubyBlockScope scope = new RubyBlockScope(parent, parent.RuntimeFlowControl, blockParam, selfObject);
            scope.MethodAttributes = RubyMethodAttributes.PublicInstance;
            scope.Frame = locals;
            scope.InterpretedFrame = interpretedFrame;
            return scope;
        }
Пример #6
0
 public static void TraceBlockReturn(RubyBlockScope/*!*/ scope, BlockParam/*!*/ block, string fileName, int lineNumber) {
     if (block.ModuleDeclaration != null && block.SuperMethodName != null) {
         scope.RubyContext.ReportTraceEvent("return", scope, block.ModuleDeclaration, block.SuperMethodName, fileName, lineNumber);
     }
 }
Пример #7
0
        public static RubyBlockScope/*!*/ CreateBlockScope(LocalsDictionary/*!*/ locals, RubyScope/*!*/ parent, 
            BlockParam/*!*/ blockParam, object selfObject) {
            Assert.NotNull(locals, parent, blockParam);

            RubyBlockScope scope = new RubyBlockScope(parent, locals);
            // TODO: used to inherit parent.MethodAttributes
            scope.Initialize(parent.RuntimeFlowControl, RubyMethodAttributes.PublicInstance, selfObject); 
            scope.BlockParameter = blockParam;

            return scope;
        }