MCPcopy Create free account
hub / github.com/chibash/stone / eval

Method eval

src/chap10/ArrayEvaluator.java:28–36  ·  view source on GitHub ↗
(Environment env, Object value)

Source from the content-addressed store, hash-verified

26 @Reviser public static class ArrayRefEx extends ArrayRef {
27 public ArrayRefEx(List<ASTree> c) { super(c); }
28 public Object eval(Environment env, Object value) {
29 if (value instanceof Object[]) {
30 Object index = ((ASTreeEx)index()).eval(env);
31 if (index instanceof Integer)
32 return ((Object[])value)[(Integer)index];
33 }
34
35 throw new StoneException("bad array access", this);
36 }
37 }
38 @Reviser public static class AssignEx extends BasicEvaluator.BinaryEx {
39 public AssignEx(List<ASTree> c) { super(c); }

Callers

nothing calls this directly

Calls 2

indexMethod · 0.80
evalMethod · 0.45

Tested by

no test coverage detected