MCPcopy Index your code
hub / github.com/beanshell/beanshell / evalBlock

Method evalBlock

src/bsh/BSHBlock.java:79–135  ·  view source on GitHub ↗
( 
		CallStack callstack, Interpreter interpreter, 
		boolean overrideNamespace, NodeFilter nodeFilter )

Source from the content-addressed store, hash-verified

77 }
78
79 Object evalBlock(
80 CallStack callstack, Interpreter interpreter,
81 boolean overrideNamespace, NodeFilter nodeFilter )
82 throws EvalError
83 {
84 Object ret = Primitive.VOID;
85 NameSpace enclosingNameSpace = null;
86 if ( !overrideNamespace )
87 {
88 enclosingNameSpace= callstack.top();
89 BlockNameSpace bodyNameSpace =
90 new BlockNameSpace( enclosingNameSpace );
91
92 callstack.swap( bodyNameSpace );
93 }
94
95 int startChild = isSynchronized ? 1 : 0;
96 int numChildren = jjtGetNumChildren();
97
98 try {
99 /*
100 Evaluate block in two passes:
101 First do class declarations then do everything else.
102 */
103 for(int i=startChild; i<numChildren; i++)
104 {
105 SimpleNode node = ((SimpleNode)jjtGetChild(i));
106
107 if ( nodeFilter != null && !nodeFilter.isVisible( node ) )
108 continue;
109
110 if ( node instanceof BSHClassDeclaration )
111 node.eval( callstack, interpreter );
112 }
113 for(int i=startChild; i<numChildren; i++)
114 {
115 SimpleNode node = ((SimpleNode)jjtGetChild(i));
116 if ( node instanceof BSHClassDeclaration )
117 continue;
118
119 // filter nodes
120 if ( nodeFilter != null && !nodeFilter.isVisible( node ) )
121 continue;
122
123 ret = node.eval( callstack, interpreter );
124
125 // statement or embedded block evaluated a return statement
126 if ( ret instanceof ReturnControl )
127 break;
128 }
129 } finally {
130 // make sure we put the namespace back when we leave.
131 if ( !overrideNamespace )
132 callstack.swap( enclosingNameSpace );
133 }
134 return ret;
135 }
136

Callers 3

initInstanceMethod · 0.95
evalMethod · 0.95
generateClassImplMethod · 0.80

Calls 6

evalMethod · 0.95
topMethod · 0.80
swapMethod · 0.80
jjtGetNumChildrenMethod · 0.65
jjtGetChildMethod · 0.65
isVisibleMethod · 0.65

Tested by

no test coverage detected