-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for ClassExpression. fixes #359
- Loading branch information
1 parent
f103c24
commit 857d72e
Showing
5 changed files
with
112 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var foo = class Foo extends Bar { | ||
constructor (properties, name = 'lorem', ...extra) | ||
{ | ||
this.properties = properties; | ||
this.name = name; | ||
this.extra = extra; | ||
} | ||
static | ||
log ( msg , level = 'log' ) { | ||
console[level](msg); | ||
} toObject () { return this.properties; } } | ||
let bar = class Foo extends Bar { | ||
// empty lines in between the MethodDefinition are valid/kept | ||
|
||
constructor(properties) { | ||
this.properties = properties; | ||
} | ||
|
||
get prop() { | ||
return 'getter'; | ||
} | ||
|
||
set prop(val) { | ||
Foo.log('setting: ', val) | ||
} | ||
|
||
static log(msg, level = 'log') { | ||
console[level]('[Foo]', msg); | ||
} | ||
|
||
toObject() { | ||
return this.properties; | ||
} | ||
|
||
} | ||
|
||
// Multi line declaration | ||
let dolor = class | ||
Foo | ||
extends | ||
Bar | ||
{ | ||
} | ||
// The value to be extended can be produced by an arbitrary expression. | ||
var amet = class Foo extends BarNamespace.Bar{} | ||
let ipsum = class Foo extends BarNamespace['Bar'].Bar["Bar"]('bar').Bar("bar", "bar"){} | ||
const ullamcor = class Foo extends(BarNamespace.bar)(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var foo = class Foo extends Bar { | ||
constructor(properties, name = 'lorem', ...extra) { | ||
this.properties = properties; | ||
this.name = name; | ||
this.extra = extra; | ||
} | ||
static log(msg, level = 'log') { | ||
console[level](msg); | ||
} | ||
toObject() { | ||
return this.properties; | ||
} | ||
} | ||
let bar = class Foo extends Bar { | ||
// empty lines in between the MethodDefinition are valid/kept | ||
|
||
constructor(properties) { | ||
this.properties = properties; | ||
} | ||
|
||
get prop() { | ||
return 'getter'; | ||
} | ||
|
||
set prop(val) { | ||
Foo.log('setting: ', val) | ||
} | ||
|
||
static log(msg, level = 'log') { | ||
console[level]('[Foo]', msg); | ||
} | ||
|
||
toObject() { | ||
return this.properties; | ||
} | ||
|
||
} | ||
|
||
// Multi line declaration | ||
let dolor = class Foo extends Bar { | ||
} | ||
// The value to be extended can be produced by an arbitrary expression. | ||
var amet = class Foo extends BarNamespace.Bar { | ||
} | ||
let ipsum = class Foo extends BarNamespace['Bar'].Bar["Bar"]('bar').Bar("bar", "bar") { | ||
} | ||
const ullamcor = class Foo extends (BarNamespace.bar)() { | ||
} |