(StarlarkThread.Frame fr, Statement st)
| 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 |
no test coverage detected