add bindingEquals, typeEquals, referenceEquals helper methods to Scope
This commit is contained in:
parent
399d835285
commit
a6d1a5a724
@ -24,8 +24,8 @@ var visitor = {
|
||||
// constant so we can just ignore it
|
||||
if (id === constant) continue;
|
||||
|
||||
var localBinding = scope.getBinding(key);
|
||||
if (localBinding !== constant) continue;
|
||||
// check if there's been a local binding that shadows this constant
|
||||
if (scope.bindingEquals(key, constant)) continue;
|
||||
|
||||
throw state.file.errorWithNode(id, key + " is read-only");
|
||||
}
|
||||
|
||||
@ -492,6 +492,10 @@ each({
|
||||
binding: "Binding",
|
||||
type: "Type"
|
||||
}, function (title, type) {
|
||||
Scope.prototype[type + "Equals"] = function (id, node) {
|
||||
return this["get" + title](id) === node;
|
||||
};
|
||||
|
||||
each([
|
||||
"get",
|
||||
"has",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user