示例#1
0
 private void checkExtendedTypes(EClass expectedSubtype) {
   for (Iterator iter = externalType.getExtendedTypes().iterator(); iter.hasNext(); ) {
     Name nameAST = (Name) iter.next();
     Type extendedType = nameAST.resolveType();
     if (extendedType != null && !BindingUtil.isEClassProxy(extendedType)) {
       if (!(extendedType instanceof org.eclipse.edt.mof.egl.ExternalType)) {
         problemRequestor.acceptProblem(
             nameAST,
             IProblemRequestor.EXTERNALTYPE_MUST_EXTEND_EXTERNALTYPE,
             new String[] {extendedType.getTypeSignature()});
       } else {
         // Super type must have the same subtype.
         Stereotype superSubtype =
             ((org.eclipse.edt.mof.egl.ExternalType) extendedType).getStereotype();
         if (superSubtype == null
             || (!expectedSubtype.equals(superSubtype.getEClass())
                 && !isMofClass((org.eclipse.edt.mof.egl.ExternalType) extendedType))) {
           problemRequestor.acceptProblem(
               nameAST,
               IProblemRequestor.EXTERNAL_TYPE_SUPER_SUBTYPE_MISMATCH,
               new String[] {extendedType.getTypeSignature()});
         }
       }
     }
   }
 }
示例#2
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()});
      }
    }
  }