[Dashg-commit] SF.net SVN: dashg:[12] trunk/dashg/src/com/mebigfatguy/dashg
Status: Pre-Alpha
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-10-25 07:26:32
|
Revision: 12
http://dashg.svn.sourceforge.net/dashg/?rev=12&view=rev
Author: dbrosius
Date: 2008-10-25 07:26:30 +0000 (Sat, 25 Oct 2008)
Log Message:
-----------
better byte offset to line calculations
Modified Paths:
--------------
trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java
trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java
Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java
===================================================================
--- trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2008-10-25 07:05:27 UTC (rev 11)
+++ trunk/dashg/src/com/mebigfatguy/dashg/DashGMethodAdapter.java 2008-10-25 07:26:30 UTC (rev 12)
@@ -18,10 +18,8 @@
*/
package com.mebigfatguy.dashg;
-import java.util.Iterator;
import java.util.Map;
-import org.apache.tools.ant.BuildException;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodAdapter;
import org.objectweb.asm.MethodVisitor;
@@ -29,14 +27,12 @@
public class DashGMethodAdapter extends MethodAdapter {
Map<Integer, Integer> lineOffsets;
- Iterator<Integer> lineIt;
String methodName;
public DashGMethodAdapter(MethodVisitor mv, String name, Map<Integer, Integer> offsets) {
super(mv);
lineOffsets = offsets;
methodName = name;
- lineIt = lineOffsets.keySet().iterator();
}
@Override
@@ -116,11 +112,10 @@
}
private void addLine() {
- if (lineIt.hasNext()) {
- Label l = new Label();
- super.visitLabel(l);
- super.visitLineNumber(lineIt.next().intValue(), l);
- } else
- throw new BuildException("Prematurely ran out of line numbers for method " + methodName);
+ Label l = new Label();
+ super.visitLabel(l);
+ Integer srcLine = lineOffsets.get(Integer.valueOf(l.getOffset()));
+ if (srcLine != null)
+ super.visitLineNumber(srcLine.intValue(), l);
}
}
Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java
===================================================================
--- trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-25 07:05:27 UTC (rev 11)
+++ trunk/dashg/src/com/mebigfatguy/dashg/DashGTask.java 2008-10-25 07:26:30 UTC (rev 12)
@@ -116,7 +116,7 @@
PrintWriter pw = null;
Map<Integer, Integer> offsets = null;
- Pattern methodPattern = Pattern.compile("(public|private|protected)?\\s*[a-zA-Z0-9<>?]*\\s*[a-zA-Z0-9]*\\([^\\)]*\\)[^;]*;");
+ Pattern methodPattern = Pattern.compile("(public|private|protected)?\\s*(static\\s*)?[a-zA-Z0-9<>?]*\\s*[a-zA-Z0-9]*\\([^\\)]*\\)[^;]*;");
Pattern linePattern = Pattern.compile("\\s*([0-9]*):.*");
Pattern simpleNameSigPattern = Pattern.compile("\\s([^\\s(]*\\([^)]*\\))");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|