Changeset 4049


Ignore:
Timestamp:
Dec 17, 2008, 9:03:08 PM (12 years ago)
Author:
yura
Message:
  • F3 for functions goes to definition, then to declaration, then to definition and so on.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/editor/AstInfo.java

    r3863 r4049  
    77import org.refal.rfpdt.ast.AstDecl;
    88import org.refal.rfpdt.ast.AstFence;
     9import org.refal.rfpdt.ast.AstFuncDecl;
    910import org.refal.rfpdt.ast.AstFuncDef;
    1011import org.refal.rfpdt.ast.AstImplem;
     
    7980        return null;
    8081    }
     82   
     83    private static AstNode getFuncDef (AstDecl astNode) {
     84        if (astNode instanceof AstFuncDecl && ((AstFuncDecl) astNode).funcDef != null)
     85            return ((AstFuncDecl) astNode).funcDef;
     86        else
     87            return getDeclName(astNode);
     88    }
     89
     90    private static AstNode getDeclName (AstDecl astNode) {
     91        return astNode != null ? astNode.name : null;
     92    }
    8193
    8294    /** May return <code>null<code>! */
     
    97109        else if (size > 1 && astNodeList.get(size - 1) instanceof AstName) {
    98110            AstNode astNode = astNodeList.get(size - 2);
    99             AstDecl astDecl = null;
    100111            if (astNode instanceof AstDecl)
    101                 astDecl = (AstDecl) astNode;
     112                return getFuncDef((AstDecl) astNode);
    102113            else if (astNode instanceof AstFuncDef)
    103                 astDecl = ((AstFuncDef) astNode).funcDecl;
     114                return getDeclName(((AstFuncDef) astNode).funcDecl);
    104115            else if (astNode instanceof AstRef)
    105                 astDecl = ((AstRef) astNode).decl;
     116                return getFuncDef(((AstRef) astNode).decl);
    106117            else if (astNode instanceof AstCall)
    107                 astDecl = ((AstCall) astNode).funcDecl;
     118                return getFuncDef(((AstCall) astNode).funcDecl);
    108119            else if (astNode instanceof AstNative)
    109                 astDecl = ((AstNative) astNode).funcDecl;
     120                return getDeclName(((AstNative) astNode).funcDecl);
    110121            else
    111122                return null;
    112             return astDecl != null ? astDecl.name : null;
    113123        }
    114124        return null;
Note: See TracChangeset for help on using the changeset viewer.