Browse Source

include superclass when including a class declaration (#932)

legacy-quote-reserved-properties
Rich-Harris 8 years ago
parent
commit
b26917bff6
  1. 3
      src/ast/nodes/ClassDeclaration.js
  2. 3
      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 );

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

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

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