Esempio n. 1
0
  protected void checkFeatureCallEffect(FeatureCall call) {
    if (!(call.getFeature() instanceof Operation)) {
      if (call.getFeature() instanceof Property) {
        error(
            "Access to property '" + call.getFeature().getName() + "' has no effect.",
            call,
            StextPackage.Literals.FEATURE_CALL__FEATURE,
            0);
      } else if (call.getFeature() instanceof Event) {
        error(
            "Access to event '" + call.getFeature().getName() + "' has no effect.",
            call,
            StextPackage.Literals.FEATURE_CALL__FEATURE,
            0);
      } else {
        error(
            "Access to feature '" + call.getFeature().getName() + "' has no effect.",
            call,
            StextPackage.Literals.FEATURE_CALL__FEATURE,
            0);
      }

      if (call.getOwner() != null) {
        if (call.getOwner() instanceof FeatureCall)
          checkFeatureCallEffect((FeatureCall) call.getOwner());
        else if (call.getOwner() instanceof TypedElementReferenceExpression)
          checkTypedElementReferenceEffect((TypedElementReferenceExpression) call.getOwner());
      }
    }
  }
Esempio n. 2
0
 @Check(CheckType.FAST)
 public void checkOperationArguments_FeatureCall(final FeatureCall call) {
   if (call.getFeature() instanceof Operation) {
     Operation operation = (Operation) call.getFeature();
     EList<Parameter> parameters = operation.getParameters();
     EList<Expression> args = call.getArgs();
     if (parameters.size() != args.size()) {
       error("Wrong number of arguments, expected " + parameters, null);
     }
   }
 }
Esempio n. 3
0
 protected void checkFeatureCallEffect(FeatureCall call) {
   if (call.getFeature() != null
       && call.getFeature() instanceof Feature
       && !(call.getFeature() instanceof Operation)) {
     if (call.getFeature() instanceof Property) {
       error(
           "Access to property '"
               + nameProvider.getFullyQualifiedName(call.getFeature())
               + "' has no effect.",
           call,
           StextPackage.Literals.FEATURE_CALL__FEATURE,
           INSIGNIFICANT_INDEX,
           FEATURE_CALL_HAS_NO_EFFECT);
     } else if (call.getFeature() instanceof Event) {
       error(
           "Access to event '"
               + nameProvider.getFullyQualifiedName(call.getFeature())
               + "' has no effect.",
           call,
           StextPackage.Literals.FEATURE_CALL__FEATURE,
           INSIGNIFICANT_INDEX,
           FEATURE_CALL_HAS_NO_EFFECT);
     } else {
       error(
           "Access to feature '"
               + nameProvider.getFullyQualifiedName(call.getFeature())
               + "' has no effect.",
           call,
           StextPackage.Literals.FEATURE_CALL__FEATURE,
           INSIGNIFICANT_INDEX,
           FEATURE_CALL_HAS_NO_EFFECT);
     }
   }
 }
Esempio n. 4
0
 @Check(CheckType.FAST)
 public void checkFeatureCall(FeatureCall call) {
   if (call.eContainer() instanceof FeatureCall) {
     return;
   }
   if (call.getFeature() instanceof Scope) {
     error(
         "A variable, event or operation is required",
         StextPackage.Literals.FEATURE_CALL__FEATURE,
         INSIGNIFICANT_INDEX,
         FEATURE_CALL_TO_SCOPE);
   }
 }