Issue #860. Nested classes.
This commit is contained in:
parent
1254efaddb
commit
4afa6a2887
|
@ -977,6 +977,9 @@
|
|||
Class.prototype.walkBody = function(name) {
|
||||
return this.traverseChildren(false, __bind(function(child) {
|
||||
var exps, i, node, _len, _ref;
|
||||
if (child instanceof Class) {
|
||||
return false;
|
||||
}
|
||||
if (child instanceof Expressions) {
|
||||
_ref = exps = child.expressions;
|
||||
for (i = 0, _len = _ref.length; i < _len; i++) {
|
||||
|
|
|
@ -786,6 +786,7 @@ exports.Class = class Class extends Base
|
|||
# Walk the body of the class, looking for prototype properties to be converted.
|
||||
walkBody: (name) ->
|
||||
@traverseChildren false, (child) =>
|
||||
return false if child instanceof Class
|
||||
if child instanceof Expressions
|
||||
for node, i in exps = child.expressions
|
||||
if node instanceof Value and node.isObject(true)
|
||||
|
|
|
@ -318,3 +318,16 @@ class two.Klass
|
|||
eq typeof Klass, 'undefined'
|
||||
eq one.Klass.label, 'one'
|
||||
eq two.Klass.label, 'two'
|
||||
|
||||
|
||||
# Nested classes.
|
||||
class Outer
|
||||
constructor: ->
|
||||
@label = 'outer'
|
||||
|
||||
class @Inner
|
||||
constructor: ->
|
||||
@label = 'inner'
|
||||
|
||||
eq (new Outer).label, 'outer'
|
||||
eq (new Outer.Inner).label, 'inner'
|
||||
|
|
Loading…
Reference in New Issue