Bug 433529: Part 7 - Name functions whose field in an object literal is a PNK_STRING node. r=jimb

This commit is contained in:
Alex Crichton 2012-08-21 15:57:54 -07:00
parent f6fd736dd3
commit acc10ae0ea
2 changed files with 11 additions and 4 deletions

View File

@ -192,10 +192,14 @@ class NameResolver
ParseNode *node = toName[pos];
if (node->isKind(PNK_COLON)) {
if (!node->pn_left->isKind(PNK_NAME))
continue;
/* special atoms are skipped, but others are dot-appended */
if (!special(node->pn_left->pn_atom)) {
if (node->pn_left->isKind(PNK_NAME)) {
/* special atoms are skipped, but others are dot-appended */
if (!special(node->pn_left->pn_atom)) {
if (!buf.append(".") || !buf.append(node->pn_left->pn_atom))
return NULL;
}
} else if (node->pn_left->isKind(PNK_STRING)) {
/* If a string is explicitly specified, don't see if its special */
if (!buf.append(".") || !buf.append(node->pn_left->pn_atom))
return NULL;
}

View File

@ -114,3 +114,6 @@ function f(g) {
}
var x = f(function () { return function() {}; });
assertName(x, 'x</<');
var a = {'b': function(){}};
assertName(a.b, 'a.b');