예제 #1
0
 private boolean checkHasSubtype() {
   boolean subtypeValid;
   if (externalType.hasSubType()) {
     subtypeValid = externalTypeBinding.getStereotype() != null;
   } else {
     problemRequestor.acceptProblem(
         externalType.getName(),
         IProblemRequestor.PART_DEFINITION_REQUIRES_TYPE_CLAUSE,
         new String[] {externalType.getName().getCanonicalName()});
     subtypeValid = false;
   }
   return subtypeValid;
 }
예제 #2
0
  @Override
  public boolean visit(ExternalType externalType) {
    this.externalType = externalType;
    EGLNameValidator.validate(
        externalType.getName(), EGLNameValidator.HANDLER, problemRequestor, compilerOptions);
    new AnnotationValidator(problemRequestor, compilerOptions)
        .validateAnnotationTarget(externalType);

    if (checkHasSubtype()) {
      checkExtendedTypes(externalTypeBinding.getStereotype().getEClass());
      checkCycles();
    }
    return true;
  }
예제 #3
0
  private void checkParameters(List parameters) {

    Stereotype subtype = externalTypeBinding.getStereotype();
    if (subtype != null) {
      // do not validate the parms for NativeType
      EClass clazz = subtype.getEClass();
      if (clazz != null
          && NameUtile.equals(
              clazz.getName(), NameUtile.getAsName(IEGLConstants.PROPERTY_NATIVETYPE))
          && NameUtile.equals(clazz.getPackageName(), NameUtile.getAsName("eglx.lang"))) {
        return;
      }
    }

    for (Iterator iter = parameters.iterator(); iter.hasNext(); ) {
      FunctionParameter parm = (FunctionParameter) iter.next();
      if (parm.isParmConst()) {
        problemRequestor.acceptProblem(
            parm,
            IProblemRequestor.EXTERNALTYPE_PARM_CANNOT_BE_CONST,
            new String[] {parm.getName().getCanonicalName()});
      }
    }
  }