diff --git a/src/ast/nodes/ClassDeclaration.js b/src/ast/nodes/ClassDeclaration.js index f67c87d..f1a1daa 100644 --- a/src/ast/nodes/ClassDeclaration.js +++ b/src/ast/nodes/ClassDeclaration.js @@ -6,6 +6,7 @@ export default class ClassDeclaration extends Node { if ( this.activated ) return; this.activated = true; + if ( this.superClass ) this.superClass.run( this.scope ); this.body.run(); } @@ -26,6 +27,8 @@ export default class ClassDeclaration extends Node { } initialise ( scope ) { + this.scope = scope; + this.name = this.id.name; scope.addDeclaration( this.name, this, false, false ); diff --git a/test/function/includes-superclass/_config.js b/test/function/includes-superclass/_config.js new file mode 100644 index 0000000..e226472 --- /dev/null +++ b/test/function/includes-superclass/_config.js @@ -0,0 +1,4 @@ +module.exports = { + description: 'includes superclass (#932)', + buble: true +}; diff --git a/test/function/includes-superclass/base.js b/test/function/includes-superclass/base.js new file mode 100644 index 0000000..c374794 --- /dev/null +++ b/test/function/includes-superclass/base.js @@ -0,0 +1,5 @@ +export class Base { + foo () { + return true; + } +} diff --git a/test/function/includes-superclass/main.js b/test/function/includes-superclass/main.js new file mode 100644 index 0000000..bfb78e8 --- /dev/null +++ b/test/function/includes-superclass/main.js @@ -0,0 +1,6 @@ +import { Thing } from './thing'; + +const thing = new Thing(); + +assert.ok( thing.foo() ); +assert.ok( thing.bar() ); diff --git a/test/function/includes-superclass/thing.js b/test/function/includes-superclass/thing.js new file mode 100644 index 0000000..97b3be8 --- /dev/null +++ b/test/function/includes-superclass/thing.js @@ -0,0 +1,7 @@ +import { Base } from './base.js'; + +export class Thing extends Base { + bar () { + return true; + } +}