mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-10 21:22:33 +00:00
Issue #302 AS3 goto local variable declaration
Ant upload release/nightly task
This commit is contained in:
@@ -36,7 +36,9 @@ import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.helpers.Cache;
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import javax.swing.SwingUtilities;
|
||||
@@ -113,7 +115,7 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
}
|
||||
|
||||
List<Highlighting> allh = new ArrayList<>();
|
||||
for (Highlighting h : traitHighlights) {
|
||||
for (Highlighting h : traitHighlights) {
|
||||
if (h.getPropertyString("index").equals("" + lastTraitIndex)) {
|
||||
for (Highlighting sh : specialHighlights) {
|
||||
if (sh.startPos >= h.startPos && (sh.startPos + sh.len < h.startPos + h.len)) {
|
||||
@@ -229,6 +231,45 @@ public class DecompiledEditorPane extends LineMarkedEditorPane implements CaretL
|
||||
return getMultinameAtPos(getCaretPosition());
|
||||
}
|
||||
|
||||
public int getLocalDeclarationOfPos(int pos) {
|
||||
Highlighting sh=Highlighting.search(specialHighlights,pos);
|
||||
Highlighting h=Highlighting.search(highlights,pos);
|
||||
Highlighting tm = Highlighting.search(methodHighlights, pos);
|
||||
if (tm == null) {
|
||||
return -1;
|
||||
}
|
||||
List<Highlighting> tms= Highlighting.searchAll(methodHighlights, -1, "index", tm.getPropertyString("index"), -1, -1);
|
||||
if(h==null){
|
||||
return -1;
|
||||
}
|
||||
//is it already declaration?
|
||||
if("true".equals(h.getPropertyString("declaration")) || (sh!=null && "true".equals(sh.getPropertyString("declaration")))){
|
||||
return -1; //no jump
|
||||
}
|
||||
|
||||
Map<String,String> search=h.getProperties();
|
||||
search.remove("index");
|
||||
search.remove("subtype");
|
||||
search.remove("offset");
|
||||
if(search.isEmpty()){
|
||||
return -1;
|
||||
}
|
||||
search.put("declaration", "true");
|
||||
|
||||
for(Highlighting tm1:tms)
|
||||
{
|
||||
Highlighting rh= Highlighting.search(highlights, search, tm1.startPos, tm1.startPos+tm1.len);
|
||||
if(rh==null){
|
||||
rh=Highlighting.search(specialHighlights, search, tm1.startPos, tm1.startPos+tm1.len);
|
||||
}
|
||||
if(rh!=null){
|
||||
return rh.startPos;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getMultinameAtPos(int pos) {
|
||||
Highlighting tm = Highlighting.search(methodHighlights, pos);
|
||||
if (tm == null) {
|
||||
|
||||
Reference in New Issue
Block a user