X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ferrors%2FErrorLog.java;fp=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ferrors%2FErrorLog.java;h=f2e648b0089ea022021c815f98cf5e52d5d4228c;hp=2287f919bbea59a99d55f123e46d107bff31e076;hb=b2c6aed4003ef264fb48eed9ac9f2d0f6c2d5b13;hpb=8561e498009a25473db94b0e667866aa79de90b1 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/errors/ErrorLog.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/errors/ErrorLog.java index 2287f919b..f2e648b00 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/errors/ErrorLog.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/errors/ErrorLog.java @@ -7,7 +7,7 @@ import org.simantics.scl.compiler.common.exceptions.InternalCompilerError; public class ErrorLog { ArrayList errors = new ArrayList(); - 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();