Exemplo n.º 1
0
 @Check(CheckType.FAST)
 public void checkTimeEventSpecValueExpression(TimeEventSpec spec) {
   try {
     InferenceResult result = typeInferrer.inferType(spec.getValue());
     if (result.getType() == null || !typeSystem.isIntegerType(result.getType())) {
       error(TIME_EXPRESSION, null);
     }
     report(result, StextPackage.Literals.TIME_EVENT_SPEC__VALUE);
   } catch (IllegalArgumentException e) {
     // ignore unknown literals here, as this also happens when a
     // linking problem occurred, which is handled in other locations
   }
 }
Exemplo n.º 2
0
 @Check(CheckType.FAST)
 public void checkVariableDefinition(final VariableDefinition definition) {
   try {
     InferenceResult result = typeInferrer.inferType(definition);
     if (result.getType() != null && typeSystem.isVoidType(result.getType())) {
       error(VARIABLE_VOID_TYPE, null);
     } else {
       report(result, null);
     }
   } catch (IllegalArgumentException e) {
     // ignore unknown literals here, as this also happens when a
     // linking problem occurred, which is handled in other locations
   }
 }
Exemplo n.º 3
0
 @Check(CheckType.FAST)
 public void checkGuardExpression(ReactionTrigger trigger) {
   if (trigger.getGuardExpression() == null) {
     return;
   }
   try {
     InferenceResult result = typeInferrer.inferType(trigger.getGuardExpression());
     if (result.getType() == null || !typeSystem.isBooleanType(result.getType())) {
       error(GUARD_EXPRESSION, StextPackage.Literals.REACTION_TRIGGER__GUARD_EXPRESSION);
     }
     report(result, null);
   } catch (IllegalArgumentException e) {
     // ignore unknown literals here, as this also happens when a
     // linking problem occurred, which is handled in other locations
   }
 }
Exemplo n.º 4
0
 protected void report(InferenceResult result, EStructuralFeature feature) {
   if (result.getIssues().isEmpty()) return;
   // TODO: Sort issues by severity and evaluate severity
   InferenceIssue error = Iterables.getLast(result.getIssues());
   error(error.getMessage(), feature);
 }