rename declarationKinds to bindingKinds in scope tracker
This commit is contained in:
parent
70eb641530
commit
d37bf292a1
@ -135,7 +135,7 @@ Scope.prototype.generateTempBasedOnNode = function (node) {
|
||||
};
|
||||
|
||||
Scope.prototype.checkBlockScopedCollisions = function (key, id) {
|
||||
if (this.declarationKinds["let"][key] || this.declarationKinds["const"][key]) {
|
||||
if (this.bindingKinds["let"][key] || this.bindingKinds["const"][key]) {
|
||||
throw this.file.errorWithNode(id, "Duplicate declaration " + key, TypeError);
|
||||
}
|
||||
};
|
||||
@ -201,7 +201,7 @@ Scope.prototype.register = function (node, reference, kind) {
|
||||
this.bindings[key] = id;
|
||||
}
|
||||
|
||||
var kinds = this.declarationKinds[kind];
|
||||
var kinds = this.bindingKinds[kind];
|
||||
if (kinds) extend(kinds, ids);
|
||||
};
|
||||
|
||||
@ -271,7 +271,7 @@ Scope.prototype.crawl = function () {
|
||||
}
|
||||
|
||||
info = block._scopeInfo = {
|
||||
declarationKinds: {
|
||||
bindingKinds: {
|
||||
"const": object(),
|
||||
"var": object(),
|
||||
"let": object()
|
||||
@ -400,7 +400,7 @@ Scope.prototype.addDeclarationToFunctionScope = function (kind, node) {
|
||||
|
||||
// this ignores the duplicate declaration logic specified in `getInfo`
|
||||
// but it doesn't really matter
|
||||
extend(scope.declarationKinds[kind], ids);
|
||||
extend(scope.bindingKinds[kind], ids);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -446,7 +446,7 @@ Scope.prototype.getAllDeclarationsOfKind = function (kind) {
|
||||
|
||||
var scope = this;
|
||||
do {
|
||||
defaults(ids, scope.declarationKinds[kind]);
|
||||
defaults(ids, scope.bindingKinds[kind]);
|
||||
scope = scope.parent;
|
||||
} while (scope);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user