aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoravasseur <avasseur>2005-07-05 11:46:21 +0000
committeravasseur <avasseur>2005-07-05 11:46:21 +0000
commitd8fa51baa77d426bf5a14ab5e9c0f9f3784981b4 (patch)
tree2965e1c012f6e2f795d5d3f84b90ad0d5d2a0358 /org.aspectj.ajdt.core
parent35a7305b31437cc8982de9b71b26eb54a19d2995 (diff)
downloadaspectj-d8fa51baa77d426bf5a14ab5e9c0f9f3784981b4.tar.gz
aspectj-d8fa51baa77d426bf5a14ab5e9c0f9f3784981b4.zip
add offset in MethodDeclarationAttribute for @AJ in AJDT
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjConstructorDeclaration.java2
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java2
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java22
3 files changed, 15 insertions, 11 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjConstructorDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjConstructorDeclaration.java
index 504631c9c..13212dfdd 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjConstructorDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjConstructorDeclaration.java
@@ -53,6 +53,6 @@ public class AjConstructorDeclaration extends ConstructorDeclaration {
}
extraAttributeList.add(
- new EclipseAttributeAdapter(new AjAttribute.MethodDeclarationLineNumberAttribute(declarationStartLine)));
+ new EclipseAttributeAdapter(new AjAttribute.MethodDeclarationLineNumberAttribute(declarationStartLine, this.sourceStart())));
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
index ae91da894..21e009f67 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AjMethodDeclaration.java
@@ -69,6 +69,6 @@ public class AjMethodDeclaration extends MethodDeclaration {
}
extraAttributeList.add(
- new EclipseAttributeAdapter(new AjAttribute.MethodDeclarationLineNumberAttribute(declarationStartLine)));
+ new EclipseAttributeAdapter(new AjAttribute.MethodDeclarationLineNumberAttribute(declarationStartLine, this.sourceStart())));
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java
index b3fc473b4..8cdaa333b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java
@@ -50,18 +50,22 @@ public class EclipseSourceContext implements ISourceContext {
return new EclipseSourceLocation(result, position.getStart(), position.getEnd());
}
- public ISourceLocation makeSourceLocation(int line) {
+ public ISourceLocation makeSourceLocation(int line, int offset) {
SourceLocation sl = new SourceLocation(getSourceFile(), line);
- // compute the offset
- //TODO AV - should we do it lazily?
- int[] offsets = result.lineSeparatorPositions;
- int likelyOffset = 0;
- if (line > 0 && line < offsets.length) {
- //1st char of given line is next char after previous end of line
- likelyOffset = offsets[line-1];
+ if (offset > 0) {
+ sl.setOffset(offset);
+ } else {
+ // compute the offset
+ //TODO AV - should we do it lazily?
+ int[] offsets = result.lineSeparatorPositions;
+ int likelyOffset = 0;
+ if (line > 0 && line < offsets.length) {
+ //1st char of given line is next char after previous end of line
+ likelyOffset = offsets[line-1];//FIXME may be need -2
+ }
+ sl.setOffset(likelyOffset);
}
- sl.setOffset(likelyOffset);
return sl;
}