Chromium Code Reviews| Index: src/ast.cc |
| diff --git a/src/ast.cc b/src/ast.cc |
| index fa01be016c038714976af27bb8c532ef39576bb5..15f9a0ea6c983df35a7b217717a7059eb47a38da 100644 |
| --- a/src/ast.cc |
| +++ b/src/ast.cc |
| @@ -239,16 +239,18 @@ void ObjectLiteral::CalculateEmitStore() { |
| HashMap* table; |
| void* key; |
| uint32_t index; |
| - if (handle->IsSymbol()) { |
| + |
| + // Check for array index first because symbol may still be an array index: |
| + // var y = {get "1234"() {return 42; }}; |
| + if (handle->ToArrayIndex(&index)) { |
|
Lasse Reichstein
2011/01/25 11:19:03
I already committed a patch for this case.
During
Martin Maly
2011/01/25 18:29:23
Thanks, I reverted this part of my change.
|
| + key = handle.location(); |
| + hash = index; |
| + table = &elements; |
| + } else if (handle->IsSymbol()) { |
| Handle<String> name(String::cast(*handle)); |
| - ASSERT(!name->AsArrayIndex(&index)); |
| key = name.location(); |
| hash = name->Hash(); |
| table = &properties; |
| - } else if (handle->ToArrayIndex(&index)) { |
| - key = handle.location(); |
| - hash = index; |
| - table = &elements; |
| } else { |
| ASSERT(handle->IsNumber()); |
| double num = handle->Number(); |