[Dashg-commit] SF.net SVN: dashg:[36] trunk/dashg/src/com/mebigfatguy/dashg
Status: Pre-Alpha
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-10-28 21:59:11
|
Revision: 36 http://dashg.svn.sourceforge.net/dashg/?rev=36&view=rev Author: dbrosius Date: 2008-10-28 21:59:05 +0000 (Tue, 28 Oct 2008) Log Message: ----------- fix parm names Modified Paths: -------------- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 21:50:10 UTC (rev 35) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGClassSourcePrintingVisitor.java 2008-10-28 21:59:05 UTC (rev 36) @@ -27,6 +27,7 @@ import org.objectweb.asm.ClassWriter; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; public class DashGClassSourcePrintingVisitor implements ClassVisitor, DashGLineNumberer { @@ -125,12 +126,14 @@ pw.print(name); List<String> args = DashGUtils.getArguments(desc); String comma = "("; + int parmNum = ((access & Opcodes.ACC_STATIC) != 0) ? 0 : 1; for (String a : args) { pw.print(comma); comma = ", "; pw.print(a); pw.print(' '); - pw.print('x'); + pw.print(DashGUtils.parmName(a, parmNum)); + parmNum += DashGUtils.typeSize(a); } pw.print(") "); Modified: trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java =================================================================== --- trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2008-10-28 21:50:10 UTC (rev 35) +++ trunk/dashg/src/com/mebigfatguy/dashg/DashGUtils.java 2008-10-28 21:59:05 UTC (rev 36) @@ -111,4 +111,18 @@ return type.substring(1); } + + public static String parmName(String type, int parmNum) { + int dotPos = type.lastIndexOf('.'); + if (dotPos >= 0) + type = type.substring(dotPos+1); + int lBracketPos = type.indexOf('['); + if (lBracketPos >= 0) + type = type.substring(0, lBracketPos) + 's'; + return type.toLowerCase() + parmNum; + } + + public static int typeSize(String typeName) { + return ("long".equals(typeName) || "double".equals(typeName)) ? 2 : 1; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |