CompilerProblem: exposes end line and end column, similar to nodes, so that 
IDEs can work with proper range (previously returned line and column, so length 
was 0)


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f7dc9530
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f7dc9530
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f7dc9530

Branch: refs/heads/feature-autobuild/example-maven-dirs
Commit: f7dc95309c544e0ccf4811626a06aba551e8fd09
Parents: f56565d
Author: Josh Tynjala <joshtynj...@gmail.com>
Authored: Fri Oct 28 17:27:21 2016 -0700
Committer: Josh Tynjala <joshtynj...@gmail.com>
Committed: Fri Oct 28 17:27:21 2016 -0700

----------------------------------------------------------------------
 .../flex/compiler/problems/CompilerProblem.java | 59 +++++++++++++++++---
 1 file changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f7dc9530/compiler/src/main/java/org/apache/flex/compiler/problems/CompilerProblem.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/problems/CompilerProblem.java 
b/compiler/src/main/java/org/apache/flex/compiler/problems/CompilerProblem.java
index d2e9366..d92d672 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/problems/CompilerProblem.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/problems/CompilerProblem.java
@@ -51,26 +51,47 @@ public abstract class CompilerProblem implements 
ICompilerProblem
 {
     /**
      * Constructor.
-     * 
+     *
      * @param sourcePath The path of the file in which the problem occurred.
      * @param start The offset within the source buffer at which the problem 
starts.
      * @param end The offset within the source buffer at which the problem 
ends.
      * @param line The line number within the source buffer at which the 
problem starts.
      * @param column The column number within the source buffer at which the 
problem starts.
+     * @param endLine The line number within the source buffer at which the 
problem ends.
+     * @param endColumn The column number within the source buffer at which 
the problem ends.
      * @param normalizeFilePath true if the path can be normalized. This is 
needed 
      * by configuration problems that have the "command line" as there source.
      */
-    public CompilerProblem(String sourcePath, int start, int end, int line, 
int column, 
+    public CompilerProblem(String sourcePath, int start, int end,
+                           int line, int column, int endLine, int endColumn,
                            boolean normalizeFilePath)
     {
         if (sourcePath != null && normalizeFilePath)
             sourcePath = FilenameNormalization.normalize(sourcePath);
 
-        this.sourcePath = sourcePath; 
+        this.sourcePath = sourcePath;
         this.start = start;
         this.end = end;
         this.line = line;
         this.column = column;
+        this.endLine = endLine;
+        this.endColumn = endColumn;
+    }
+    /**
+     * Constructor.
+     * 
+     * @param sourcePath The path of the file in which the problem occurred.
+     * @param start The offset within the source buffer at which the problem 
starts.
+     * @param end The offset within the source buffer at which the problem 
ends.
+     * @param line The line number within the source buffer at which the 
problem starts.
+     * @param column The column number within the source buffer at which the 
problem starts.
+     * @param normalizeFilePath true if the path can be normalized. This is 
needed 
+     * by configuration problems that have the "command line" as there source.
+     */
+    public CompilerProblem(String sourcePath, int start, int end, int line, 
int column, 
+                           boolean normalizeFilePath)
+    {
+        this(sourcePath, start, end, line, column, line, column, 
normalizeFilePath);
     }
         
     /**
@@ -86,6 +107,22 @@ public abstract class CompilerProblem implements 
ICompilerProblem
     {
         this(sourcePath, start, end, line, column, true);
     }
+
+    /**
+     * Constructor.
+     *
+     * @param sourcePath The normalized path of the file in which the problem 
occurred.
+     * @param start The offset within the source buffer at which the problem 
starts.
+     * @param end The offset within the source buffer at which the problem 
ends.
+     * @param line The line number within the source buffer at which the 
problem starts.
+     * @param column The column number within the source buffer at which the 
problem starts.
+     * @param endLine The line number within the source buffer at which the 
problem ends.
+     * @param endColumn The column number within the source buffer at which 
the problem ends.
+     */
+    public CompilerProblem(String sourcePath, int start, int end, int line, 
int column, int endLine, int endColumn)
+    {
+        this(sourcePath, start, end, line, column, endLine, endColumn, true);
+    }
     
     /**
      * Constructor for a problem whose only source-location information
@@ -117,7 +154,8 @@ public abstract class CompilerProblem implements 
ICompilerProblem
     {
         this(site.getSourcePath(),
              site.getStart(), site.getEnd(),
-             site.getLine(), site.getColumn());
+             site.getLine(), site.getColumn(),
+             site.getEndLine(), site.getEndColumn());
     }
     
     /**
@@ -129,7 +167,9 @@ public abstract class CompilerProblem implements 
ICompilerProblem
     {
         this(site.getSourcePath(),
              site.getNameStart(), site.getNameEnd(),
-             site.getNameLine(), site.getNameColumn());
+             site.getNameLine(), site.getNameColumn(),
+             site.getNameLine(),
+             site.getNameColumn() + site.getNameEnd() - site.getNameStart());
     }
 
     /**
@@ -141,7 +181,8 @@ public abstract class CompilerProblem implements 
ICompilerProblem
     {
         this(site.getSourcePath(),
              site.getLocalStart(), site.getLocalEnd(),
-             site.getLine(), site.getColumn());
+             site.getLine(), site.getColumn(),
+             site.getEndLine(), site.getEndColumn());
     }
 
     private final String sourcePath;
@@ -149,6 +190,8 @@ public abstract class CompilerProblem implements 
ICompilerProblem
     private final int end;
     private final int line;
     private final int column;
+    private final int endLine;
+    private final int endColumn;
     
     @Override
     public String getID()
@@ -191,13 +234,13 @@ public abstract class CompilerProblem implements 
ICompilerProblem
     @Override
     public int getEndLine()
     {
-        return line;
+        return endLine;
     }
 
     @Override
     public int getEndColumn()
     {
-        return column;
+        return endColumn;
     }
 
     @Override

Reply via email to