Skip to content

Commit

Permalink
Fix properties from dojo/_base/declare superclass not showing up in o…
Browse files Browse the repository at this point in the history
…utput,

and fix default values coming from global scope not showing up in output.
  • Loading branch information
csnover committed May 31, 2012
1 parent 52e7015 commit e606a02
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/callHandler/dojo.js
Expand Up @@ -149,8 +149,11 @@ define([
prototype.setProperty('prototype', new Value({ type: Value.TYPE_INSTANCE, value: mixins[0] }));
}

// All subsequent mixins have their properties copied over to the new constructor’s prototype
for (var i = 1, mixin; (mixin = mixins[i]); ++i) {
// All mixins have their properties copied over to the new constructor’s prototype
// TODO: It seems that dojo/_base/declare copies over all properties, including those from the superclass,
// but this doesn’t seem like the correct thing to do since as a superclass, those properties should come
// through the prototype chain.
for (var i = 0, mixin; (mixin = mixins[i]); ++i) {
mixin = mixin.getProperty('prototype');

if (!mixin) {
Expand Down
9 changes: 8 additions & 1 deletion lib/esprimaParser.js
Expand Up @@ -629,7 +629,14 @@ define([
// key might be a Literal or an Identifier
propertyValue = read(property.value);
propertyValue.evaluate && propertyValue.evaluate();
value.properties[property.key.value || property.key.name] = propertyValue;

// If someone does something like foo: Infinity, it picks up Infinity from the global, but it is
// actually “defined” from the current file, so use a delegate instead of the original Value since
// otherwise the origin information is wrong
// TODO: Hopefully this does not break pass-by-reference in the case where someone wants to modify the
// Value directly with new properties; it shouldn’t since all touchable objects (properties, metadata)
// are shared, but I don’t feel like I have thought about the ramifications of this enough perhaps.
value.properties[property.key.value || property.key.name] = lang.delegate(propertyValue, { file: env.file });

attachMetadata(propertyValue, property, value, expression);
}
Expand Down

0 comments on commit e606a02

Please sign in to comment.