Make AST_Class inherit AST_Scope instead of AST_Object
This is one of those days I'd love to use multiple inheritance. An AST_Class has lots of common with AST_Object, but unfortunately `instanceof AST_Scope` is used very, very much, and a class has its name inside its own special pocket scope. This compels me to make AST_Class inherit Scope instead. It looks like, although there is much in common with AST_Object, `instanceof AST_Object` seldom are made, perhaps because it is less often necessary to traverse an object than a scope.
This commit is contained in:
@@ -502,12 +502,6 @@ function OutputStream(options) {
|
||||
return first_in_statement(output);
|
||||
});
|
||||
|
||||
// Not a class, though. It can be alone in a statement although
|
||||
// it extends from AST_Object.
|
||||
PARENS(AST_Class, function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
PARENS([ AST_Unary, AST_Undefined ], function(output){
|
||||
var p = output.parent();
|
||||
return p instanceof AST_PropAccess && p.expression === this;
|
||||
|
||||
Reference in New Issue
Block a user