@Override
  public List<PDefinition> defaultSClassDefinition(SClassDefinition node) throws AnalysisException {
    List<PDefinition> all = new Vector<PDefinition>();

    all.addAll(node.getAllInheritedDefinitions());
    all.addAll(af.createPDefinitionListAssistant().singleDefinitions(node.getDefinitions()));

    return all;
  }
Exemple #2
0
  @Override
  public SStmCG caseACallObjectStm(ACallObjectStm node, IRInfo question) throws AnalysisException {
    PType type = node.getType();
    PObjectDesignator objectDesignator = node.getDesignator();
    ILexNameToken field = node.getField();
    LinkedList<PExp> args = node.getArgs();

    STypeCG typeCg = type.apply(question.getTypeVisitor(), question);
    SObjectDesignatorCG objectDesignatorCg =
        objectDesignator.apply(question.getObjectDesignatorVisitor(), question);

    if (node.getExplicit()) {
      SClassDefinition enclosingClass = node.getAncestor(SClassDefinition.class);

      if (enclosingClass != null) {
        if (!field.getModule().equals(enclosingClass.getName().getName())) {
          // A quoted method call is only supported if the explicit
          // module name is equal to that of the enclosing class. Say A
          // is a sub class of S and 'a' is an instance of A then a.A`op();
          //  is allowed (although it is the same as a.op()). However,
          // a.S`op(); is not allowed.
          question.addUnsupportedNode(
              node,
              "A quoted object call statement is only supported if the explicit module name is equal to that of the enclosing class");
        }
      } else {
        Logger.getLog()
            .printErrorln(
                "Could not find enclosing the statement of call a call object statement.");
      }
    }

    String fieldNameCg = field.getName();

    ACallObjectStmCG callObject = new ACallObjectStmCG();
    callObject.setType(typeCg);
    callObject.setDesignator(objectDesignatorCg);
    callObject.setFieldName(fieldNameCg);

    for (PExp arg : args) {
      SExpCG argCg = arg.apply(question.getExpVisitor(), question);

      if (argCg != null) {
        callObject.getArgs().add(argCg);
      } else {
        return null;
      }
    }

    return callObject;
  }
  public void run(
      String moduleName, String traceName, Interpreter interpreter, TraceXmlWrapper store)
      throws Exception {
    this.interpreter = interpreter;

    List<PDefinition> definitions = null;

    if (interpreter instanceof ModuleInterpreter) {
      for (AModuleModules module : ((ModuleInterpreter) interpreter).modules) {
        if (module.getName().getName().equals(moduleName)) {
          definitions = module.getDefs();
        }
      }
    } else {
      for (SClassDefinition classDefinition : ((ClassInterpreter) interpreter).getClasses()) {
        if (classDefinition.getName().getName().equals(moduleName)) {
          definitions =
              assistantFactory.createPDefinitionAssistant().getDefinitions(classDefinition);
        }
      }
    }

    processTraces(definitions, moduleName, traceName, store);
  }