Package net.jangaroo.jooc

Examples of net.jangaroo.jooc.CompilerError


    }

    private void detectExtConfigAnnotation(Annotation annotation) {
      if (EXT_CONFIG_META_NAME.equals(annotation.getMetaName())) {
        if (configClass.getComponentClassName() != null) {
          throw new CompilerError(annotation.getSymbol(), "Only one [" + EXT_CONFIG_META_NAME + "] annotation may be given.");
        }

        CommaSeparatedList<AnnotationParameter> annotationParameters = annotation.getOptAnnotationParameters();
        while (annotationParameters != null) {
          AnnotationParameter annotationParameter = annotationParameters.getHead();
          Ide optNameIde = annotationParameter.getOptName();
          if (optNameIde != null) {
            String parameterName = optNameIde.getName();
            LiteralExpr annotationParameterValue = annotationParameter.getValue();
            String parameterValue = null;
            if (annotationParameterValue != null) {
              JooSymbol symbol = annotationParameterValue.getSymbol();
              if (symbol.sym != sym.STRING_LITERAL) {
                throw new CompilerError(symbol, "The " + parameterName + " parameter of an [" + EXT_CONFIG_META_NAME + "] annotation must be a string literal.");
              }
              parameterValue = (String) symbol.getJooValue();
            }
            if (TARGET_ANNOTATION_PARAMETER_NAME.equals(parameterName)) {
              if (parameterValue == null) {
                throw new CompilerError(optNameIde.getSymbol(), "The " + parameterName + " parameter of an [" + EXT_CONFIG_META_NAME + "] annotation must have a value.");
              }
              configClass.setComponentClassName(parameterValue);
            } else {
              try {
                configClass.setType(ConfigClassType.fromExtConfigAttribute(parameterName));
              } catch (IllegalArgumentException e) {
                throw new CompilerError(optNameIde.getSymbol(), "'" + parameterName + "' is not a valid parameter of an [" + EXT_CONFIG_META_NAME + "] annotation (only 'xtype', 'ptype', 'type', 'gctype' are allowed).", e);
              }
              configClass.setTypeValue(parameterValue);
            }
          }
          annotationParameters = annotationParameters.getTail();
        }
        if (configClass.getComponentClassName() == null) {
          throw new CompilerError(annotation.getSymbol(), "A " + TARGET_ANNOTATION_PARAMETER_NAME + " parameter must be provided for an [" + EXT_CONFIG_META_NAME + "] annotation.");
        }
      }
    }
View Full Code Here


      getValue().analyze(this);
      String metaName = parentAnnotation.getMetaName();
      if ("Embed".equals(metaName) && getOptName() != null && "source".equals(getOptName().getName())) {
        JooSymbol valueSymbol = getValue().getSymbol();
        if (valueSymbol.sym != sym.STRING_LITERAL) {
          throw new CompilerError(valueSymbol, "The source parameter of an [Embed] annotation must be a string literal");
        }
        String text = valueSymbol.getText();
        String quote = text.substring(0, 1);
        String source = (String) valueSymbol.getJooValue();
        String absoluteSource = compilationUnit.addResourceDependency(source);
View Full Code Here

  }

  private IdeDeclaration resolvePropertyDeclaration1(String ide, ClassDeclaration classDecl, Set<ClassDeclaration> visited, Deque<ClassDeclaration> chain) {
    if (visited.contains(classDecl)) {
      if (chain.contains(classDecl)) {
        throw new CompilerError(classDecl.getSymbol(), "cyclic superclass chain");
      }
      return null;
    }
    visited.add(classDecl);
    final int chainSize = chain.size();
View Full Code Here

                                                final Deque<ClassDeclaration> chain,
                                                final Ide superIde) {
    IdeDeclaration superClassDecl = superIde.getDeclaration(false);
    if (superClassDecl != null) {
      if (!(superClassDecl instanceof ClassDeclaration)) {
        throw new CompilerError(classDecl.getOptExtends().getSuperClass().getSymbol(), "expected class identifier");
      }
      return resolvePropertyDeclaration1(ide, (ClassDeclaration) superClassDecl, visited, chain);
    }
    return null;
  }
View Full Code Here

    if ("Object".equals(superType.getIde().getQualifiedNameStr())) {
      return 1;
    }
    IdeDeclaration superClassDecl = superType.getIde().getDeclaration();
    if (!(superClassDecl instanceof ClassDeclaration)) {
      throw new CompilerError(getOptExtends().getSuperClass().getSymbol(), "expected class identifier");
    }
    return 1 + ((ClassDeclaration) superClassDecl).getInheritanceLevel();
  }
View Full Code Here

      declaration = getScope().lookupDeclaration(this);
      if (declaration == null) {
        declaration = NULL_DECL; // prevent multiple lookups when called with !errorIfUndeclared multiple times
      } else if (declaration.getClassDeclaration() != getScope().getClassDeclaration()) {
        if (declaration.isPrivate()) {
          throw new CompilerError(this.getSymbol(), "private member access");
        }
        if (declaration.isProtected() && !getScope().getClassDeclaration().isSubclassOf(declaration.getClassDeclaration())) {
          throw new CompilerError(this.getSymbol(), "protected member access of non-superclass");
        }
      }
    }
    final IdeDeclaration result = declaration == NULL_DECL ? null : declaration; // NOSONAR no equals here
    if (result == null && errorIfUndeclared) {
View Full Code Here

  @Override
  public void analyze(AstNode parentNode) {
    super.analyze(parentNode);
    if (!(getSuperClass().getDeclaration() instanceof ClassDeclaration)) {
      throw new CompilerError(getSuperClass().getSymbol(), "identifier in extends clause must denote a class");
    }
    getSuperClass().analyze(this);
    getSuperClass().analyzeAsExpr(this, null);
    getSuperClass().addExternalUsage();
    getSuperClass().addPublicApiDependency();
View Full Code Here

TOP

Related Classes of net.jangaroo.jooc.CompilerError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.