diff options
author | aclement <aclement> | 2004-12-10 15:40:59 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-12-10 15:40:59 +0000 |
commit | 1575a175b511eadbae03fc760b0cd20edde6ae4e (patch) | |
tree | a135e948e9e293df3849b9ab45582125a3dd1590 /org.aspectj.ajdt.core | |
parent | 379eb69126a1d904c2f4a6a63a97c138a7712791 (diff) | |
download | aspectj-1575a175b511eadbae03fc760b0cd20edde6ae4e.tar.gz aspectj-1575a175b511eadbae03fc760b0cd20edde6ae4e.zip |
Support for 'offset' in source locations - enabling AJDT improvements. Not perfect - really the whole ISourceLocation thing needs sorting out ...
Diffstat (limited to 'org.aspectj.ajdt.core')
3 files changed, 15 insertions, 5 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java index ad43d9ee9..523fea5a6 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AsmInterTypeRelationshipProvider.java @@ -50,12 +50,14 @@ public class AsmInterTypeRelationshipProvider { String sourceHandle = ProgramElement.createHandleIdentifier( munger.getSourceLocation().getSourceFile(), munger.getSourceLocation().getLine(), - munger.getSourceLocation().getColumn()); + munger.getSourceLocation().getColumn(), + munger.getSourceLocation().getOffset()); String targetHandle = ProgramElement.createHandleIdentifier( onType.getSourceLocation().getSourceFile(), onType.getSourceLocation().getLine(), - onType.getSourceLocation().getColumn()); + onType.getSourceLocation().getColumn(), + onType.getSourceLocation().getOffset()); IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap(); if (sourceHandle != null && targetHandle != null) { diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java index 65df2f306..6b395c6e0 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java @@ -44,6 +44,10 @@ public class EclipseSourceLocation implements ISourceLocation { return result; } + public int getOffset() { + return startPos; + } + public int getStartPos() { return startPos; } @@ -123,6 +127,7 @@ public class EclipseSourceLocation implements ISourceLocation { if (getColumn() != 0) { sb.append(":" + getColumn()); } + if (getOffset()>=0) { sb.append("::").append(getOffset()); } return sb.toString(); } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java index 8687cf957..04a44d059 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java @@ -106,8 +106,9 @@ public class AsmHierarchyBuilder extends ASTVisitor { // AMC - use the source start and end from the compilation unit decl int startLine = getStartLine(unit); int endLine = getEndLine(unit); - ISourceLocation sourceLocation + SourceLocation sourceLocation = new SourceLocation(file, startLine, endLine); + sourceLocation.setOffset(unit.sourceStart); cuNode = new ProgramElement( new String(file.getName()), IProgramElement.Kind.FILE_JAVA, @@ -716,12 +717,14 @@ public class AsmHierarchyBuilder extends ASTVisitor { // AMC - different strategies based on node kind int startLine = getStartLine(node); int endLine = getEndLine(node); - ISourceLocation loc = null; + SourceLocation loc = null; if ( startLine <= endLine ) { // found a valid end line for this node... - loc = new SourceLocation(new File(fileName), startLine, endLine); + loc = new SourceLocation(new File(fileName), startLine, endLine); + loc.setOffset(node.sourceStart); } else { loc = new SourceLocation(new File(fileName), startLine); + loc.setOffset(node.sourceStart); } return loc; } |