コード例 #1
0
  protected void process(ConstructorCall n) {
    SetConditionsAbsVal scs = autil.constructorCall(n.constructorInstance(), n);
    Set<AbstractLocation> setConds = scs.setConditions();

    if (n.kind().equals(ConstructorCall.SUPER)) {
      SetConditionsAbsVal t = null;
      try {
        // Add in the results from all of the initializers
        for (SetConditionsAbsVal v :
            autil.analyzeInitializers(SetConditionsAbsVal.EMPTY).allItems()) {
          t = (t == null) ? v : t.upperBound(v);
        }
      } catch (SemanticException e) {
        throw new InternalCompilerError(e);
      }

      if (!t.setConditions().isEmpty()) {
        setConds = new LinkedHashSet<AbstractLocation>();
        setConds.addAll(scs.setConditions());
        setConds.addAll(t.setConditions());
      }
    }

    this.setConds.addAll(setConds);

    CEProcedureCallExt ext = (CEProcedureCallExt) CEExt_c.ext(n);
    ext.recordSetConditionsResults(this.autil.currentContext(), setConds);
  }
コード例 #2
0
  @Override
  public Node leave(Node old, Node n, NodeVisitor v) {
    if (CEExt_c.ext(n).isConditionSet()) {
      // it's a set condition!
      Call c = (Call) n;
      if (c.target() instanceof Local) {
        // ignore local conditions, we're only interested in fields
      } else if (c.target() instanceof Field) {
        Field f = (Field) c.target();
        this.setConds.addAll(autil.abstractLocations(f));
      } else {
        throw new InternalCompilerError("Can't handle " + n);
      }
    }

    if (n instanceof Call) {
      process((Call) n);
    } else if (n instanceof New) {
      process((New) n);
    } else if (n instanceof ConstructorCall) {
      process((ConstructorCall) n);
    }

    return n;
  }
コード例 #3
0
 protected void process(Call n) {
   CEProcedureCallExt ext = (CEProcedureCallExt) CEExt_c.ext(n);
   MethodInstance mi = n.methodInstance();
   SetConditionsAbsVal scs = autil.call(mi, n);
   this.setConds.addAll(scs.setConditions());
   ext.recordSetConditionsResults(this.autil.currentContext(), scs.setConditions());
 }
コード例 #4
0
 protected void process(New n) {
   SetConditionsAbsVal scs = autil.call(n.constructorInstance(), n);
   this.setConds.addAll(scs.setConditions());
   CEProcedureCallExt ext = (CEProcedureCallExt) CEExt_c.ext(n);
   ext.recordSetConditionsResults(this.autil.currentContext(), scs.setConditions());
 }