Permalink
Browse files

Fixing bug where constants would not propagate more than one level of…

… nesting in ConstantScope.
  • Loading branch information...
1 parent 646df6f commit c77d5ad976e1de47a61d5c083380032b10302cc0 @jcoglan jcoglan committed Aug 30, 2008
Showing with 8 additions and 3 deletions.
  1. +1 −2 source/constant_scope.js
  2. +7 −1 test/test.html
View
@@ -38,9 +38,8 @@ JS.ConstantScope = new JS.Module({
delete inclusions[key];
if (object.isA && object.isA(JS.Module)) {
- object.include(base.__consts__);
- object.extend(base.__consts__);
object.include(this);
+ object.__consts__.include(base.__consts__);
}
}
return constants;
View
@@ -1320,11 +1320,16 @@
testConstants: function() { with(this) {
var Foo = new JS.Class({
include: JS.ConstantScope,
+ CONST: 45,
Item: new JS.Class({NAME: 'Outer'}),
Inner: new JS.Class({
- Item: new JS.Class({NAME: 'Inner'}),
+ Item: new JS.Class({NAME: 'Inner',
+ talk: function() {
+ return this.CONST;
+ }
+ }),
extend: {
get: function() {
@@ -1337,6 +1342,7 @@
assert(Foo.Item.NAME === Foo.Item.prototype.NAME);
assertEqual('Outer', Foo.Item.NAME);
assertEqual('Inner', Foo.Inner.get());
+ assertEqual(45, (new Foo.Inner.Item).talk());
}},
testDecorator: function() { with(this) {

0 comments on commit c77d5ad

Please sign in to comment.