@Override
 protected void checkValidLabeledStatement(final LabeledStatement labelDeclaration) {
   if (!(labelDeclaration.getStatement() instanceof LoopStatement)) {
     throw Jooc.error(
         this, "label '" + getOptLabel().getName() + "' does not reference a loop statement");
   }
 }
Пример #2
0
 @Override
 public void analyze(AstNode parentNode) {
   super.analyze(parentNode);
   if (getOptTypeRelation() != null) {
     getOptTypeRelation().analyze(this);
     if (isRest() && !"Array".equals(getOptTypeRelation().getType().getSymbol().getText())) {
       // todo replace that condition with real Array definition lookup
       throw Jooc.error(getOptTypeRelation().getSymbol(), "Rest parameter must have Array type.");
     }
   }
   if (getOptInitializer() != null) {
     getOptInitializer().analyze(this);
     if (!getOptInitializer().getValue().isCompileTimeConstant()) {
       throw Jooc.error(
           getOptInitializer().getSymbol(),
           "Parameter initializer must be compile-time constant.");
     }
   }
 }