コード例 #1
0
 private static void assignDependencies(
     final Statement stm,
     final String keyword,
     final ISyntacticElement elt,
     final Set<Diagnostic> errors) {
   // COMPATIBILITY with the definition of environment
   // if ( !SymbolProto.nonTypeStatements.contains(keyword) ) {
   if (!DescriptionFactory.isStatementProto(keyword)) {
     Set<String> s = varDependenciesOf(stm);
     if (s != null && !s.isEmpty()) {
       elt.setFacet(DEPENDS_ON, new StringListExpressionDescription(s));
     }
     // 25/01/14: this test is cancelled for the moment, as the facet type is now defined earlier
     // when dealing
     // with type var_name;
     // if ( !(stm instanceof S_Var) ) {
     // IExpressionDescription type = elt.getExpressionAt(TYPE);
     // if ( type != null ) {
     // if ( type.toString().equals(keyword) ) {
     // addWarning("Duplicate declaration of type", stm, errors);
     // } else {
     // addWarning("Conflicting declaration of type (" + type + " and " + keyword +
     // "), only the last one will be considered", stm, errors);
     // }
     // }
     // }
   }
 }
コード例 #2
0
 private static void addWarning(
     final String message, final EObject object, final Set<Diagnostic> errors) {
   if (!GamaPreferences.WARNINGS_ENABLED.getValue()) {
     return;
   }
   Diagnostic d = new EObjectDiagnosticImpl(Severity.WARNING, "", message, object, null, 0, null);
   errors.add(d);
 }
コード例 #3
0
 private static final Set<String> varDependenciesOf(final Statement s) {
   Set<String> list = new HashSet();
   for (Facet facet : EGaml.getFacetsOf(s)) {
     Expression expr = facet.getExpr();
     if (expr != null) {
       if (expr instanceof VariableRef) {
         list.add(EGaml.getKey.caseVariableRef((VariableRef) expr));
       } else {
         for (TreeIterator<EObject> tree = expr.eAllContents(); tree.hasNext(); ) {
           EObject obj = tree.next();
           if (obj instanceof VariableRef) {
             list.add(EGaml.getKey.caseVariableRef((VariableRef) obj));
           }
         }
       }
     }
   }
   if (list.isEmpty()) {
     return null;
   }
   return list;
 }
コード例 #4
0
 private static void addInfo(
     final String message, final EObject object, final Set<Diagnostic> errors) {
   Diagnostic d = new EObjectDiagnosticImpl(Severity.INFO, "", message, object, null, 0, null);
   errors.add(d);
 }