Java Code Examples for jdk.nashorn.internal.ir.LexicalContext#getBlocks()

The following examples show how to use jdk.nashorn.internal.ir.LexicalContext#getBlocks() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FindScopeDepths.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (definedInBlock(b, symbol)) {
            return scopesToStart;
        }
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break; //don't go past body block, but process it
        }
        b = iter.next();
    }
    return -1;
}
 
Example 2
Source File: FindScopeDepths.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break;
        }
        b = iter.next();
    }
    return scopesToStart;
}
 
Example 3
Source File: FindScopeDepths.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break;
        }
        b = iter.next();
    }
    return scopesToStart;
}
 
Example 4
Source File: FindScopeDepths.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (definedInBlock(b, symbol)) {
            return scopesToStart;
        }
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break; //don't go past body block, but process it
        }
        b = iter.next();
    }
    return -1;
}
 
Example 5
Source File: FindScopeDepths.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (definedInBlock(b, symbol)) {
            return scopesToStart;
        }
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break; //don't go past body block, but process it
        }
        b = iter.next();
    }
    return -1;
}
 
Example 6
Source File: FindScopeDepths.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break;
        }
        b = iter.next();
    }
    return scopesToStart;
}
 
Example 7
Source File: FindScopeDepths.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static int findInternalDepth(final LexicalContext lc, final FunctionNode fn, final Block block, final Symbol symbol) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (definedInBlock(b, symbol)) {
            return scopesToStart;
        }
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break; //don't go past body block, but process it
        }
        b = iter.next();
    }
    return -1;
}
 
Example 8
Source File: FindScopeDepths.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static int findScopesToStart(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Block bodyBlock = findBodyBlock(lc, fn, block);
    final Iterator<Block> iter = lc.getBlocks(block);
    Block b = iter.next();
    int scopesToStart = 0;
    while (true) {
        if (b.needsScope()) {
            scopesToStart++;
        }
        if (b == bodyBlock) {
            break;
        }
        b = iter.next();
    }
    return scopesToStart;
}
 
Example 9
Source File: FindScopeDepths.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Block findGlobalBlock(final LexicalContext lc, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    Block globalBlock = null;
    while (iter.hasNext()) {
        globalBlock = iter.next();
    }
    return globalBlock;
}
 
Example 10
Source File: FindScopeDepths.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static Block findBodyBlock(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    while (iter.hasNext()) {
        final Block next = iter.next();
        if (fn.getBody() == next) {
            return next;
        }
    }
    return null;
}
 
Example 11
Source File: FindScopeDepths.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Block findGlobalBlock(final LexicalContext lc, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    Block globalBlock = null;
    while (iter.hasNext()) {
        globalBlock = iter.next();
    }
    return globalBlock;
}
 
Example 12
Source File: FindScopeDepths.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static Block findGlobalBlock(final LexicalContext lc, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    Block globalBlock = null;
    while (iter.hasNext()) {
        globalBlock = iter.next();
    }
    return globalBlock;
}
 
Example 13
Source File: FindScopeDepths.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static Block findBodyBlock(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    while (iter.hasNext()) {
        final Block next = iter.next();
        if (fn.getBody() == next) {
            return next;
        }
    }
    return null;
}
 
Example 14
Source File: FindScopeDepths.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static Block findGlobalBlock(final LexicalContext lc, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    Block globalBlock = null;
    while (iter.hasNext()) {
        globalBlock = iter.next();
    }
    return globalBlock;
}
 
Example 15
Source File: FindScopeDepths.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static Block findBodyBlock(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    while (iter.hasNext()) {
        final Block next = iter.next();
        if (fn.getBody() == next) {
            return next;
        }
    }
    return null;
}
 
Example 16
Source File: FindScopeDepths.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static Block findBodyBlock(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    while (iter.hasNext()) {
        final Block next = iter.next();
        if (fn.getBody() == next) {
            return next;
        }
    }
    return null;
}
 
Example 17
Source File: FindScopeDepths.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static Block findGlobalBlock(final LexicalContext lc, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    Block globalBlock = null;
    while (iter.hasNext()) {
        globalBlock = iter.next();
    }
    return globalBlock;
}
 
Example 18
Source File: FindScopeDepths.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static Block findBodyBlock(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    while (iter.hasNext()) {
        final Block next = iter.next();
        if (fn.getBody() == next) {
            return next;
        }
    }
    return null;
}
 
Example 19
Source File: FindScopeDepths.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Block findGlobalBlock(final LexicalContext lc, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    Block globalBlock = null;
    while (iter.hasNext()) {
        globalBlock = iter.next();
    }
    return globalBlock;
}
 
Example 20
Source File: FindScopeDepths.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static Block findBodyBlock(final LexicalContext lc, final FunctionNode fn, final Block block) {
    final Iterator<Block> iter = lc.getBlocks(block);
    while (iter.hasNext()) {
        final Block next = iter.next();
        if (fn.getBody() == next) {
            return next;
        }
    }
    return null;
}