+ (should (funcall predicate (js2-get-defining-scope scope variable)))))
+
+(js2-deftest for-node-is-declaration-scope "for (let i = 0; i; ++i) {};"
+ (js2-mode)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "i" 0 #'js2-for-node-p))
+
+(js2-deftest const-scope-sloppy-script "{const a;} a;"
+ (js2-mode)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 0 #'js2-script-node-p)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 1 #'js2-script-node-p))
+
+(js2-deftest const-scope-strict-script "'use strict'; { const a; } a;"
+ (js2-mode)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 0 #'js2-block-node-p)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 1 #'null))
+
+(js2-deftest const-scope-sloppy-function "function f() { { const a; } a; }"
+ (js2-mode)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 0 #'js2-function-node-p)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 1 #'js2-function-node-p))
+
+(js2-deftest const-scope-strict-function "function f() { 'use strict'; { const a; } a; }"
+ (js2-mode)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 0 #'js2-block-node-p)
+ (js2-test-scope-of-nth-variable-satisifies-predicate "a" 1 #'null))