Fix in JavaSourceHighlighter: save full tree in sourceIndex. development
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 03 Oct 2013 20:07:05 +0100
branchdevelopment
changeset 2787 d4914ffbb0cf
parent 2786 241e36a125a9
child 2788 b25c8b9e886a
Fix in JavaSourceHighlighter: save full tree in sourceIndex.
tools/JavaSourceHighlighter.st
--- a/tools/JavaSourceHighlighter.st	Thu Oct 03 17:36:36 2013 +0100
+++ b/tools/JavaSourceHighlighter.st	Thu Oct 03 20:07:05 2013 +0100
@@ -329,7 +329,7 @@
 
 format: source kind: kind in: class
 
-    | scanner marker cacheIt document sourceUnit parser |
+    | scanner marker cacheIt document sourceUnit parser tree |
 
     "Optimization - if full class source is to be formatted,
      consult cache - when browsing the code or debugging, very 
@@ -383,8 +383,12 @@
             indexer := Indexer new.
             indexer index: sourceIndex.
             parser setIndexer: indexer.
+
         ].
-        parser parse: sourceUnit diet: false resolve: true.
+        tree := parser parse: sourceUnit diet: false resolve: true.
+        (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
+            sourceIndex tree: tree. 
+        ]
     ].
     
 
@@ -400,7 +404,7 @@
     ]
 
     "Created: / 17-03-2012 / 14:02:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-09-2013 / 04:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-10-2013 / 18:36:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaSourceHighlighter methodsFor:'queries'!
@@ -839,6 +843,16 @@
 
     element := self add: node from: start to: stop.
     binding := node binding.
+    "/ ProblemBinding, treat is as a local
+    binding problemId ~~ 0 ifTrue:[
+        name := binding name.
+        previous := locals at: name ifAbsent: nil.
+        previous notNil ifTrue:[
+            previous next: element.
+        ].
+        locals at: name put: element.  
+        ^ self.              
+    ].
     (binding kind bitAnd: 2r100) == 2r100 "TYPE" ifTrue:[
         name := binding compoundName asStringWith: $/.
         previous := types at: name ifAbsent: nil.
@@ -876,7 +890,7 @@
     self error: 'Should not happen'
 
     "Created: / 01-10-2013 / 10:33:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 01-10-2013 / 11:46:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-10-2013 / 18:41:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 methodEnter: node