public int getLineNumber(ASTNode node) {
        if (!hasLineNumbers()) return -1;
        
        while (node.getBeginIndex() == Integer.MAX_VALUE && node.getPreviousSibling() != null) {
            node = node.getPreviousSibling();
        }
        
        int pc = node.getBeginIndex();
        L: if (pc > lineNumbers[index].getStartPC()) {
            do {
                if (index+1 == length) break L;
                index ++;
            } while (pc >= lineNumbers[index].getStartPC());
            index --;
        } else if (pc < lineNumbers[index].getStartPC()) {
            do {
                if (index == 0) break L;
                index --;
            } while (pc <= lineNumbers[index].getStartPC());
            index ++;
        }

        return lineNumbers[index].getLineNumber();
    }