]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/errors/ErrorLog.java
Implemented GraphPropertyRelation with the new CHR implementation
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / errors / ErrorLog.java
index 2287f919bbea59a99d55f123e46d107bff31e076..f2e648b0089ea022021c815f98cf5e52d5d4228c 100644 (file)
@@ -7,7 +7,7 @@ import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
 
 public class ErrorLog {
     ArrayList<CompilationError> errors = new ArrayList<CompilationError>(); 
-    long exceptionPosition;
+    long exceptionPosition = Locations.NO_LOCATION;
     
     public void log(String message) {
         errors.add(new CompilationError(message));
@@ -22,10 +22,12 @@ public class ErrorLog {
     }
 
     public void log(Exception e) {
+        long location = Locations.NO_LOCATION;
         if(e instanceof InternalCompilerError)
-            log(((InternalCompilerError)e).location, e);
-        else
-            log(new CompilationError(e));
+            location = ((InternalCompilerError)e).location;
+        if(location == Locations.NO_LOCATION)
+            location = exceptionPosition;
+        log(new CompilationError(location, e));
     }
     
     public void log(long location, Exception e) {
@@ -45,10 +47,6 @@ public class ErrorLog {
         if(this.exceptionPosition == Locations.NO_LOCATION)
             this.exceptionPosition = exceptionPosition;
     }
-    
-    public long getExceptionPosition() {
-        return exceptionPosition;
-    }
 
     public String getErrorsAsString() {
         StringBuilder b = new StringBuilder();