From bd500259ab92b35fbffa651af252684cf5a1d455 Mon Sep 17 00:00:00 2001 From: Manindra Moharana Date: Thu, 1 May 2014 04:18:05 +0530 Subject: [PATCH] trying to get to the bottom of parameterized type bug --- .../mode/experimental/ASTGenerator.java | 18 +++++++++--------- .../mode/experimental/ErrorCheckerService.java | 8 +++++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pdex/src/processing/mode/experimental/ASTGenerator.java b/pdex/src/processing/mode/experimental/ASTGenerator.java index ff3709c08..0650e8626 100644 --- a/pdex/src/processing/mode/experimental/ASTGenerator.java +++ b/pdex/src/processing/mode/experimental/ASTGenerator.java @@ -240,7 +240,7 @@ public class ASTGenerator { /** * Toggle AST View window */ - public static final boolean SHOWAST = !true; + public static final boolean SHOWAST = true; protected DefaultMutableTreeNode buildAST(String source, CompilationUnit cu) { if (cu == null) { @@ -1545,7 +1545,7 @@ public class ASTGenerator { public ASTNodeWrapper getASTNodeAt(int lineNumber, String name, int offset, boolean scrollOnly) { - log("----getASTNodeAt----"); + log("----getASTNodeAt---- CU State: " + errorCheckerService.compilationUnitState); if (errorCheckerService != null) { editor = errorCheckerService.getEditor(); int codeIndex = editor.getSketch().getCodeIndex(editor.getCurrentTab()); @@ -1558,10 +1558,10 @@ public class ASTGenerator { } } - log("FLON: " + lineNumber); + log("FLON: Node line number " + lineNumber); ASTNode lineNode = findLineOfNode(compilationUnit, lineNumber, offset, name); - log("+> " + lineNode); + log("Node text +> " + lineNode); ASTNode decl = null; String nodeLabel = null; String nameOfNode = null; // The node name which is to be scrolled to @@ -1581,7 +1581,7 @@ public class ASTGenerator { } } } - log("FLON2: " + lineNumber + " LN spos " + log("FLON2: " + lineNumber + " LN start pos " + lineNode.getStartPosition() + " off " + offset + " alt off" + altOff); /* * Now I need to see if multiple statements exist with this same line number @@ -1617,16 +1617,16 @@ public class ASTGenerator { } } } - log("FLON3 "+lineNode.getStartPosition() + " off " + offset + " alt off" + altOff); + log("FLON3 new alt off: " + altOff); ASTNode simpName = pinpointOnLine(lineNode, altOff, lineNode.getStartPosition(), name); if(simpName == null){ //Added while fixing #51 - log("1+++> " + simpName); + log("pinpointOnLine 1+++> " + simpName); simpName = pinpointOnLine(lineNode.getParent(), altOff, lineNode.getStartPosition(), name); } - log("2+++> " + simpName); + log("pinpointOnLine 2+++> " + simpName); if(simpName == null && lineNode instanceof SimpleName){ switch (lineNode.getParent().getNodeType()) { case ASTNode.TYPE_DECLARATION: @@ -2386,7 +2386,7 @@ public class ASTGenerator { @SuppressWarnings("unchecked") public static ASTNode pinpointOnLine(ASTNode node, int offset, int lineStartOffset, String name) { - + //log("pinpointOnLine node class: " + node.getClass().getSimpleName()); if (node instanceof SimpleName) { SimpleName sn = (SimpleName) node; //log(offset+ "off,pol " + getNodeAsString(sn)); diff --git a/pdex/src/processing/mode/experimental/ErrorCheckerService.java b/pdex/src/processing/mode/experimental/ErrorCheckerService.java index b7fd4be69..5962f8cb5 100644 --- a/pdex/src/processing/mode/experimental/ErrorCheckerService.java +++ b/pdex/src/processing/mode/experimental/ErrorCheckerService.java @@ -409,13 +409,15 @@ public class ErrorCheckerService implements Runnable{ } + public int compilationUnitState = 0; + protected boolean checkCode() { //log("checkCode() " + textModified.get() ); log("checkCode() " + textModified.get()); lastTimeStamp = System.currentTimeMillis(); try { sourceCode = preprocessCode(editor.getSketch().getMainProgram()); - + compilationUnitState = 0; syntaxCheck(); log(editor.getSketch().getName() + "1 MCO " + mainClassOffset); @@ -503,7 +505,7 @@ public class ErrorCheckerService implements Runnable{ cu = (CompilationUnit) parser.createAST(null); } } - + compilationUnitState = 1; synchronized (problemsList) { // Store errors returned by the ast parser @@ -557,7 +559,7 @@ public class ErrorCheckerService implements Runnable{ cu = (CompilationUnit) parser.createAST(null); } } - + compilationUnitState = 2; // Currently (Sept, 2012) I'm using Java's reflection api to load the // CompilationChecker class(from CompilationChecker.jar) that houses the // Eclispe JDT compiler, and call its getErrorsAsObj method to obtain