You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/10/30 18:16:14 UTC
[1/3] git commit: [flex-falcon]
[refs/heads/feature-autobuild/closure-classpath-sources] - allow
[Embed(source="filename",
mimeType="text/plain")] to initialize a string variable to the contents of a
text file
Repository: flex-falcon
Updated Branches:
refs/heads/feature-autobuild/closure-classpath-sources 43595eacd -> d5d45600c
allow [Embed(source="filename",mimeType="text/plain")] to initialize a string variable to the contents of a text file
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f56565d6
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f56565d6
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f56565d6
Branch: refs/heads/feature-autobuild/closure-classpath-sources
Commit: f56565d61e77c141eae1f71d50f51a737d65167a
Parents: 9694d69
Author: Alex Harui <ah...@apache.org>
Authored: Fri Oct 28 14:47:25 2016 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Oct 28 14:47:37 2016 -0700
----------------------------------------------------------------------
.../flex/compiler/codegen/as/IASEmitter.java | 3 +
.../internal/codegen/as/ASBlockWalker.java | 2 +-
.../compiler/internal/codegen/as/ASEmitter.java | 6 ++
.../codegen/js/flexjs/JSFlexJSEmitter.java | 64 ++++++++++++++++++++
.../compiler/internal/embedding/EmbedData.java | 3 +
.../internal/embedding/EmbedMIMEType.java | 2 +
.../compiler/internal/tree/as/EmbedNode.java | 36 +++++++++++
7 files changed, 115 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f56565d6/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
index 2fe9eea..928259b 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/codegen/as/IASEmitter.java
@@ -32,6 +32,7 @@ import org.apache.flex.compiler.tree.as.ICatchNode;
import org.apache.flex.compiler.tree.as.IClassNode;
import org.apache.flex.compiler.tree.as.IContainerNode;
import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IEmbedNode;
import org.apache.flex.compiler.tree.as.IForLoopNode;
import org.apache.flex.compiler.tree.as.IFunctionCallNode;
import org.apache.flex.compiler.tree.as.IFunctionNode;
@@ -360,6 +361,8 @@ public interface IASEmitter extends IEmitter
void emitMetaTag(IMetaTagNode node);
+ void emitEmbed(IEmbedNode node);
+
void emitContainer(IContainerNode node);
void emitE4XFilter(IMemberAccessExpressionNode node);
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f56565d6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
index aa29f4d..5247583 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASBlockWalker.java
@@ -595,7 +595,7 @@ public class ASBlockWalker implements IASBlockVisitor, IASBlockWalker
public void visitEmbed(IEmbedNode node)
{
debug("visitEmbed(" + node.getAttributes()[0].getValue() + ")");
- // TODO (mschmalle) visitEmbed()
+ emitter.emitEmbed(node);
}
@Override
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f56565d6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
index f25d6c9..0320d6a 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/as/ASEmitter.java
@@ -54,6 +54,7 @@ import org.apache.flex.compiler.tree.as.IContainerNode;
import org.apache.flex.compiler.tree.as.IContainerNode.ContainerType;
import org.apache.flex.compiler.tree.as.IDefinitionNode;
import org.apache.flex.compiler.tree.as.IDynamicAccessNode;
+import org.apache.flex.compiler.tree.as.IEmbedNode;
import org.apache.flex.compiler.tree.as.IExpressionNode;
import org.apache.flex.compiler.tree.as.IForLoopNode;
import org.apache.flex.compiler.tree.as.IFunctionCallNode;
@@ -1511,6 +1512,11 @@ public class ASEmitter implements IASEmitter, IEmitter
}
@Override
+ public void emitEmbed(IEmbedNode node)
+ {
+ }
+
+ @Override
public void emitContainer(IContainerNode node)
{
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f56565d6/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
index a74b346..a7c0184 100644
--- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
+++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/flexjs/JSFlexJSEmitter.java
@@ -19,10 +19,13 @@
package org.apache.flex.compiler.internal.codegen.js.flexjs;
+import java.io.File;
import java.io.FilterWriter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.io.FileUtils;
import org.apache.flex.compiler.codegen.js.flexjs.IJSFlexJSEmitter;
import org.apache.flex.compiler.codegen.js.goog.IJSGoogDocEmitter;
import org.apache.flex.compiler.constants.IASKeywordConstants;
@@ -33,6 +36,7 @@ import org.apache.flex.compiler.definitions.IDefinition;
import org.apache.flex.compiler.definitions.INamespaceDefinition;
import org.apache.flex.compiler.definitions.IPackageDefinition;
import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.definitions.metadata.IMetaTagAttribute;
import org.apache.flex.compiler.internal.codegen.as.ASEmitterTokens;
import org.apache.flex.compiler.internal.codegen.js.JSSessionModel.ImplicitBindableImplementation;
import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitter;
@@ -61,6 +65,10 @@ import org.apache.flex.compiler.internal.codegen.js.utils.EmitterUtils;
import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitter;
import org.apache.flex.compiler.internal.definitions.AccessorDefinition;
import org.apache.flex.compiler.internal.definitions.FunctionDefinition;
+import org.apache.flex.compiler.internal.embedding.EmbedAttribute;
+import org.apache.flex.compiler.internal.embedding.EmbedData;
+import org.apache.flex.compiler.internal.embedding.EmbedMIMEType;
+import org.apache.flex.compiler.internal.projects.CompilerProject;
import org.apache.flex.compiler.internal.projects.FlexJSProject;
import org.apache.flex.compiler.internal.projects.FlexProject;
import org.apache.flex.compiler.internal.tree.as.BinaryOperatorAsNode;
@@ -72,6 +80,7 @@ import org.apache.flex.compiler.internal.tree.as.IdentifierNode;
import org.apache.flex.compiler.internal.tree.as.LabeledStatementNode;
import org.apache.flex.compiler.internal.tree.as.MemberAccessExpressionNode;
import org.apache.flex.compiler.internal.tree.as.NumericLiteralNode;
+import org.apache.flex.compiler.problems.EmbedUnableToReadSourceProblem;
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.as.IASNode;
@@ -80,6 +89,7 @@ import org.apache.flex.compiler.tree.as.IBinaryOperatorNode;
import org.apache.flex.compiler.tree.as.IClassNode;
import org.apache.flex.compiler.tree.as.IContainerNode;
import org.apache.flex.compiler.tree.as.IDefinitionNode;
+import org.apache.flex.compiler.tree.as.IEmbedNode;
import org.apache.flex.compiler.tree.as.IExpressionNode;
import org.apache.flex.compiler.tree.as.IFileNode;
import org.apache.flex.compiler.tree.as.IForLoopNode;
@@ -102,6 +112,7 @@ import org.apache.flex.compiler.utils.ASNodeUtils;
import com.google.common.base.Joiner;
import org.apache.flex.compiler.utils.NativeUtils;
+import org.apache.flex.utils.FilenameNormalization;
/**
* Concrete implementation of the 'FlexJS' JavaScript production.
@@ -799,6 +810,59 @@ public class JSFlexJSEmitter extends JSGoogEmitter implements IJSFlexJSEmitter
literalEmitter.emit(node);
}
+ @Override
+ public void emitEmbed(IEmbedNode node)
+ {
+ // if the embed is text/plain, return the actual text from the file.
+ // this assumes the variable being initialized is of type String.
+ // Embed node seems to not have location, so use parent.
+ EmbedData data = new EmbedData(node.getParent().getSourcePath(), null);
+ boolean hadError = false;
+ for (IMetaTagAttribute attribute : node.getAttributes())
+ {
+ String key = attribute.getKey();
+ String value = attribute.getValue();
+ if (data.addAttribute((CompilerProject) project, node.getParent(), key, value, getProblems()))
+ {
+ hadError = true;
+ }
+ }
+ if (hadError)
+ {
+ write("");
+ return;
+ }
+ String source = (String) data.getAttribute(EmbedAttribute.SOURCE);
+ EmbedMIMEType mimeType = (EmbedMIMEType) data.getAttribute(EmbedAttribute.MIME_TYPE);
+ if (mimeType != null && mimeType.toString().equals(EmbedMIMEType.TEXT.toString()) && source != null)
+ {
+ File file = new File(FilenameNormalization.normalize(source));
+ try {
+ String newlineReplacement = "\\\\n";
+ String s = FileUtils.readFileToString(file);
+ s = s.replaceAll("\n", "__NEWLINE_PLACEHOLDER__");
+ s = s.replaceAll("\r", "__CR_PLACEHOLDER__");
+ s = s.replaceAll("\t", "__TAB_PLACEHOLDER__");
+ s = s.replaceAll("\f", "__FORMFEED_PLACEHOLDER__");
+ s = s.replaceAll("\b", "__BACKSPACE_PLACEHOLDER__");
+ s = s.replaceAll("\\\\", "__ESCAPE_PLACEHOLDER__");
+ s = s.replaceAll("\\\\\"", "__QUOTE_PLACEHOLDER__");
+ s = s.replaceAll("\"", "\\\\\"");
+ s = s.replaceAll("__QUOTE_PLACEHOLDER__", "\\\\\"");
+ s = s.replaceAll("__ESCAPE_PLACEHOLDER__", "\\\\\\\\");
+ s = s.replaceAll("__BACKSPACE_PLACEHOLDER__", "\\\\b");
+ s = s.replaceAll("__FORMFEED_PLACEHOLDER__", "\\\\f");
+ s = s.replaceAll("__TAB_PLACEHOLDER__", "\\\\t");
+ s = s.replaceAll("__CR_PLACEHOLDER__", "\\\\r");
+ s = s.replaceAll("__NEWLINE_PLACEHOLDER__", newlineReplacement);
+ write("\"" + s + "\"");
+ } catch (IOException e) {
+ getProblems().add(new EmbedUnableToReadSourceProblem(e, file.getPath()));
+ }
+ }
+ }
+
+
//--------------------------------------------------------------------------
// Specific
//--------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f56565d6/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java b/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
index 0df0482..4835e24 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedData.java
@@ -471,6 +471,9 @@ public class EmbedData
transcoder = null;
break;
}
+ case TEXT:
+ case PROPERTIES:
+ break; // don't need transcoder for text
default:
{
problems.add(new EmbedUnknownMimeTypeProblem(location, mimeType));
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f56565d6/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedMIMEType.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedMIMEType.java b/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedMIMEType.java
index d7aa356..59aaa33 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedMIMEType.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/embedding/EmbedMIMEType.java
@@ -30,6 +30,8 @@ public enum EmbedMIMEType
GIF("image/gif", ".gif"),
MP3("audio/mpeg", ".mp3"),
FLASH("application/x-shockwave-flash", ".swf"),
+ TEXT("text/plain", ".txt"),
+ PROPERTIES("text/plain", ".properties"),
XML("text/xml", ".xml"),
PBJ("application/x-pbj", ".pbj"),
OCT_STRM("application/octet-stream"),
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f56565d6/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/EmbedNode.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/EmbedNode.java b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/EmbedNode.java
index bd062c0..14b67c7 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/EmbedNode.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/internal/tree/as/EmbedNode.java
@@ -19,15 +19,23 @@
package org.apache.flex.compiler.internal.tree.as;
+import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import org.apache.commons.io.FileUtils;
import org.apache.flex.compiler.common.IEmbedResolver;
+import org.apache.flex.compiler.common.ISourceLocation;
import org.apache.flex.compiler.definitions.ITypeDefinition;
import org.apache.flex.compiler.definitions.metadata.IMetaTagAttribute;
+import org.apache.flex.compiler.internal.embedding.EmbedAttribute;
+import org.apache.flex.compiler.internal.embedding.EmbedData;
+import org.apache.flex.compiler.internal.embedding.EmbedMIMEType;
import org.apache.flex.compiler.internal.projects.CompilerProject;
import org.apache.flex.compiler.internal.units.EmbedCompilationUnit;
import org.apache.flex.compiler.internal.units.EmbedCompilationUnitFactory;
+import org.apache.flex.compiler.problems.EmbedUnableToReadSourceProblem;
import org.apache.flex.compiler.problems.ICompilerProblem;
import org.apache.flex.compiler.projects.ICompilerProject;
import org.apache.flex.compiler.tree.ASTNodeID;
@@ -132,6 +140,34 @@ public class EmbedNode extends ExpressionNodeBase implements IEmbedNode, IEmbedR
public String getName(ICompilerProject project, Collection<ICompilerProblem> problems)
throws InterruptedException
{
+ // if the embed is text/plain, return the actual text from the file.
+ // this assumes the variable being initialized is of type String.
+ EmbedData data = new EmbedData(containingSourceFilename, null);
+ boolean hadError = false;
+ for (IMetaTagAttribute attribute : getAttributes())
+ {
+ String key = attribute.getKey();
+ String value = attribute.getValue();
+ if (data.addAttribute((CompilerProject) project, this, key, value, problems))
+ {
+ hadError = true;
+ }
+ }
+ if (hadError)
+ return new String();
+ String source = (String) data.getAttribute(EmbedAttribute.SOURCE);
+ EmbedMIMEType mimeType = (EmbedMIMEType) data.getAttribute(EmbedAttribute.MIME_TYPE);
+ if (mimeType != null && mimeType.toString().equals(EmbedMIMEType.TEXT.toString()) && source != null)
+ {
+ File file = new File(FilenameNormalization.normalize(source));
+ try {
+ String string = FileUtils.readFileToString(file);
+ return string;
+ } catch (IOException e) {
+ problems.add(new EmbedUnableToReadSourceProblem(e, file.getPath()));
+ }
+
+ }
EmbedCompilationUnit cu = resolveCompilationUnit(project, problems);
// If there was an error resolving the compilation unit, just return an empty string.
if (cu == null)
[3/3] git commit: [flex-falcon]
[refs/heads/feature-autobuild/closure-classpath-sources] - Merge branches
'develop' and 'feature-autobuild/closure-classpath-sources' of
https://git-wip-us.apache.org/repos/asf/flex-falcon into
feature-autobuild/closure-cl
Posted by cd...@apache.org.
Merge branches 'develop' and 'feature-autobuild/closure-classpath-sources' of https://git-wip-us.apache.org/repos/asf/flex-falcon into feature-autobuild/closure-classpath-sources
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/d5d45600
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/d5d45600
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/d5d45600
Branch: refs/heads/feature-autobuild/closure-classpath-sources
Commit: d5d45600c53bca911e62b31482ccc0bebdadc3f8
Parents: 43595ea f7dc953
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Sun Oct 30 19:15:54 2016 +0100
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Sun Oct 30 19:15:54 2016 +0100
----------------------------------------------------------------------
.../flex/compiler/codegen/as/IASEmitter.java | 3 +
.../internal/codegen/as/ASBlockWalker.java | 2 +-
.../compiler/internal/codegen/as/ASEmitter.java | 6 ++
.../codegen/js/flexjs/JSFlexJSEmitter.java | 64 ++++++++++++++++++++
.../compiler/internal/embedding/EmbedData.java | 3 +
.../internal/embedding/EmbedMIMEType.java | 2 +
.../compiler/internal/tree/as/EmbedNode.java | 36 +++++++++++
.../flex/compiler/problems/CompilerProblem.java | 59 +++++++++++++++---
8 files changed, 166 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: [flex-falcon]
[refs/heads/feature-autobuild/closure-classpath-sources] - 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)
Posted by cd...@apache.org.
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/closure-classpath-sources
Commit: f7dc95309c544e0ccf4811626a06aba551e8fd09
Parents: f56565d
Author: Josh Tynjala <jo...@gmail.com>
Authored: Fri Oct 28 17:27:21 2016 -0700
Committer: Josh Tynjala <jo...@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