Exemplo n.º 1
0
 void uncaughtType(Type t, Position pos) throws SemanticException {
   SemanticException e =
       new SemanticException(
           codeType
               + " cannot throw a \""
               + t
               + "\"; the exception must either be caught or declared to be thrown.",
           pos);
   Map<String, Object> map = CollectionFactory.newHashMap();
   map.put(CodedErrorInfo.ERROR_CODE_KEY, CodedErrorInfo.ERROR_CODE_SURROUND_THROW);
   map.put("TYPE", t.toString());
   e.setAttributes(map);
   throw e;
 }
Exemplo n.º 2
0
  public boolean wellFormedRecursions(SJSessionType st) {
    try {
      wellFormedRecursionsAux(
          st,
          new HashSet<SJLabel>(),
          new HashSet<
              SJLabel>()); // Would be enough to just use a hasRecurse boolean? (As in the original
      // implementation.)
    } catch (SemanticException se) {
      se.printStackTrace();

      return false;
    }

    return true;
  }
Exemplo n.º 3
0
 @Override
 public boolean run() {
   String name = goal.typeName();
   try {
     // Try to resolve the type; this may throw a
     // MissingDependencyException on the job to load the file
     // containing the type.
     Named n = ts.systemResolver().find(name);
     if (n instanceof Type) {
       return true;
     }
   } catch (SemanticException e) {
     ErrorQueue eq = ts.extensionInfo().compiler().errorQueue();
     eq.enqueue(ErrorInfo.SEMANTIC_ERROR, e.getMessage(), e.position());
   }
   return false;
 }