Example #1
0
  @Override
  public void run() {
    while (running) {
      AbstractAST current = eval.getCurrentAST();
      Environment env = eval.getCurrentEnvt();
      String name = env.getName();

      if (current != null) {
        ISourceLocation stat = current.getLocation();
        if (stat != null) {
          Count currentCount = ast.get(stat);
          if (currentCount == null) {
            ast.put(stat, new Count());
            names.put(stat, name);
          } else {
            currentCount.increment();
          }
        }
        while (env.getParent() != null && !env.getParent().isRootScope()) {
          env = env.getParent();
        }
        if (env != null) {
          Count currentCount = frame.get(env.getLocation());
          if (currentCount == null) {
            frame.put(env.getLocation(), new Count());
            names.put(env.getLocation(), env.getName());
          } else {
            currentCount.increment();
          }
        }
      }
      try {
        sleep(resolution);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
Example #2
0
 /**
  * Make a new Rascal exception.
  *
  * <p>The AbstractAST (if non-null) is used to find the current source location.
  *
  * @param value The Rascal exception value
  * @param ast An AbstractAST, or null
  * @param trace A stack trace, or null
  */
 public Throw(IValue value, AbstractAST ast, StackTrace trace) {
   this(value, ast != null ? ast.getLocation() : null, trace);
 }