Browse Source

Merge pull request #955 from rollup/superclass

include superclass when including a class declaration
legacy-quote-reserved-properties
Rich Harris 8 years ago
committed by GitHub
parent
commit
ce93f8e4ba
  1. 3
      src/ast/nodes/ClassDeclaration.js
  2. 4
      test/function/includes-superclass/_config.js
  3. 5
      test/function/includes-superclass/base.js
  4. 6
      test/function/includes-superclass/main.js
  5. 7
      test/function/includes-superclass/thing.js

3
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 );

4
test/function/includes-superclass/_config.js

@ -0,0 +1,4 @@
module.exports = {
description: 'includes superclass (#932)',
buble: true
};

5
test/function/includes-superclass/base.js

@ -0,0 +1,5 @@
export class Base {
foo () {
return true;
}
}

6
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() );

7
test/function/includes-superclass/thing.js

@ -0,0 +1,7 @@
import { Base } from './base.js';
export class Thing extends Base {
bar () {
return true;
}
}
Loading…
Cancel
Save