1 28 29 package org.jruby.ast.visitor.rewriter.utils; 30 31 public class CallDepth { 32 private int nestedCallDepth; 33 private int savedNestedCallDepth; 34 35 public void enterCall() { 36 nestedCallDepth++; 37 } 38 39 public void leaveCall() { 40 nestedCallDepth--; 41 if (nestedCallDepth < 0) nestedCallDepth = 0; 42 } 43 44 public boolean inCall() { 45 return nestedCallDepth > 0; 46 } 47 48 52 public void disableCallDepth() { 53 savedNestedCallDepth = nestedCallDepth; 54 nestedCallDepth = 0; 55 } 56 57 public void enableCallDepth() { 58 nestedCallDepth = savedNestedCallDepth; 59 } 60 } 61 | Popular Tags |