@Nullable
 public static String checkContract(PsiMethod method, String text) {
   List<MethodContract> contracts;
   try {
     contracts = ControlFlowAnalyzer.parseContract(text);
   } catch (ControlFlowAnalyzer.ParseException e) {
     return e.getMessage();
   }
   int paramCount = method.getParameterList().getParametersCount();
   for (int i = 0; i < contracts.size(); i++) {
     MethodContract contract = contracts.get(i);
     if (contract.arguments.length != paramCount) {
       return "Method takes "
           + paramCount
           + " parameters, while contract clause number "
           + (i + 1)
           + " expects "
           + contract.arguments.length;
     }
   }
   return null;
 }
Esempio n. 2
0
 public void resolveBodies(@NotNull BodiesResolveContext c) {
   resolveBehaviorDeclarationBodies(c);
   controlFlowAnalyzer.process(c);
   declarationsChecker.process(c);
   functionAnalyzerExtension.process(c);
 }