MCPcopy Index your code
hub / github.com/bazelbuild/bazel / exec

Method exec

src/main/java/net/starlark/java/eval/Eval.java:286–327  ·  view source on GitHub ↗
(StarlarkThread.Frame fr, Statement st)

Source from the content-addressed store, hash-verified

284 }
285
286 private static TokenKind exec(StarlarkThread.Frame fr, Statement st)
287 throws EvalException, InterruptedException {
288 if (fr.dbg != null) {
289 Location loc = st.getStartLocation(); // not very precise
290 fr.setLocation(loc);
291 fr.dbg.before(fr.thread, loc); // location is now redundant since it's in the thread
292 }
293
294 if (++fr.thread.steps >= fr.thread.stepLimit) {
295 throw new EvalException("Starlark computation cancelled: too many steps");
296 }
297
298 switch (st.kind()) {
299 case ASSIGNMENT:
300 execAssignment(fr, (AssignmentStatement) st);
301 return TokenKind.PASS;
302 case EXPRESSION:
303 eval(fr, ((ExpressionStatement) st).getExpression());
304 return TokenKind.PASS;
305 case FLOW:
306 return ((FlowStatement) st).getFlowKind();
307 case FOR:
308 return execFor(fr, (ForStatement) st);
309 case DEF:
310 DefStatement def = (DefStatement) st;
311 StarlarkFunction fn = newFunction(fr, def.getResolvedFunction());
312 assignIdentifier(fr, def.getIdentifier(), fn);
313 return TokenKind.PASS;
314 case IF:
315 return execIf(fr, (IfStatement) st);
316 case LOAD:
317 execLoad(fr, (LoadStatement) st);
318 return TokenKind.PASS;
319 case RETURN:
320 return execReturn(fr, (ReturnStatement) st);
321 case TYPE_ALIAS:
322 return TokenKind.PASS;
323 case VAR:
324 return TokenKind.PASS;
325 }
326 throw new IllegalArgumentException("unexpected statement: " + st.kind());
327 }
328
329 /**
330 * Updates the environment bindings, and possibly mutates objects, so as to assign the given value

Callers 6

execStatementsMethod · 0.95
mainFunction · 0.45
StemmerFunction · 0.45
jquery.jsFile · 0.45
kFunction · 0.45
gaFunction · 0.45

Calls 15

execAssignmentMethod · 0.95
evalMethod · 0.95
execForMethod · 0.95
newFunctionMethod · 0.95
getResolvedFunctionMethod · 0.95
assignIdentifierMethod · 0.95
getIdentifierMethod · 0.95
execIfMethod · 0.95
execLoadMethod · 0.95
execReturnMethod · 0.95
setLocationMethod · 0.80
getExpressionMethod · 0.80

Tested by

no test coverage detected