OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 do { | 296 do { |
297 if (c0_ != '"') return ReportUnexpectedCharacter(); | 297 if (c0_ != '"') return ReportUnexpectedCharacter(); |
298 Handle<String> key = ParseJsonSymbol(); | 298 Handle<String> key = ParseJsonSymbol(); |
299 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); | 299 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); |
300 AdvanceSkipWhitespace(); | 300 AdvanceSkipWhitespace(); |
301 Handle<Object> value = ParseJsonValue(); | 301 Handle<Object> value = ParseJsonValue(); |
302 if (value.is_null()) return ReportUnexpectedCharacter(); | 302 if (value.is_null()) return ReportUnexpectedCharacter(); |
303 | 303 |
304 uint32_t index; | 304 uint32_t index; |
305 if (key->AsArrayIndex(&index)) { | 305 if (key->AsArrayIndex(&index)) { |
306 SetOwnElement(json_object, index, value, kNonStrictMode); | 306 JSObject::SetOwnElement(json_object, index, value, kNonStrictMode); |
307 } else if (key->Equals(isolate()->heap()->Proto_symbol())) { | 307 } else if (key->Equals(isolate()->heap()->Proto_symbol())) { |
308 SetPrototype(json_object, value); | 308 SetPrototype(json_object, value); |
309 } else { | 309 } else { |
310 SetLocalPropertyIgnoreAttributes(json_object, key, value, NONE); | 310 JSObject::SetLocalPropertyIgnoreAttributes( |
| 311 json_object, key, value, NONE); |
311 } | 312 } |
312 } while (MatchSkipWhiteSpace(',')); | 313 } while (MatchSkipWhiteSpace(',')); |
313 if (c0_ != '}') { | 314 if (c0_ != '}') { |
314 return ReportUnexpectedCharacter(); | 315 return ReportUnexpectedCharacter(); |
315 } | 316 } |
316 } | 317 } |
317 AdvanceSkipWhitespace(); | 318 AdvanceSkipWhitespace(); |
318 return json_object; | 319 return json_object; |
319 } | 320 } |
320 | 321 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 591 } |
591 ASSERT_EQ('"', c0_); | 592 ASSERT_EQ('"', c0_); |
592 // Advance past the last '"'. | 593 // Advance past the last '"'. |
593 AdvanceSkipWhitespace(); | 594 AdvanceSkipWhitespace(); |
594 return result; | 595 return result; |
595 } | 596 } |
596 | 597 |
597 } } // namespace v8::internal | 598 } } // namespace v8::internal |
598 | 599 |
599 #endif // V8_JSON_PARSER_H_ | 600 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |