OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_JSON_PARSER_H_ | 5 #ifndef V8_JSON_PARSER_H_ |
6 #define V8_JSON_PARSER_H_ | 6 #define V8_JSON_PARSER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/char-predicates-inl.h" | 10 #include "src/char-predicates-inl.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } else { | 427 } else { |
428 transitioning = false; | 428 transitioning = false; |
429 } | 429 } |
430 } | 430 } |
431 | 431 |
432 DCHECK(!transitioning); | 432 DCHECK(!transitioning); |
433 | 433 |
434 // Commit the intermediate state to the object and stop transitioning. | 434 // Commit the intermediate state to the object and stop transitioning. |
435 CommitStateToJsonObject(json_object, map, &properties); | 435 CommitStateToJsonObject(json_object, map, &properties); |
436 | 436 |
437 JSObject::DefinePropertyOrElement(json_object, key, value).Check(); | 437 JSObject::DefinePropertyOrElementIgnoreAttributes(json_object, key, value) |
| 438 .Check(); |
438 } while (transitioning && MatchSkipWhiteSpace(',')); | 439 } while (transitioning && MatchSkipWhiteSpace(',')); |
439 | 440 |
440 // If we transitioned until the very end, transition the map now. | 441 // If we transitioned until the very end, transition the map now. |
441 if (transitioning) { | 442 if (transitioning) { |
442 CommitStateToJsonObject(json_object, map, &properties); | 443 CommitStateToJsonObject(json_object, map, &properties); |
443 } else { | 444 } else { |
444 while (MatchSkipWhiteSpace(',')) { | 445 while (MatchSkipWhiteSpace(',')) { |
445 HandleScope local_scope(isolate()); | 446 HandleScope local_scope(isolate()); |
446 if (c0_ != '"') return ReportUnexpectedCharacter(); | 447 if (c0_ != '"') return ReportUnexpectedCharacter(); |
447 | 448 |
(...skipping 15 matching lines...) Expand all Loading... |
463 Handle<String> key; | 464 Handle<String> key; |
464 Handle<Object> value; | 465 Handle<Object> value; |
465 | 466 |
466 key = ParseJsonInternalizedString(); | 467 key = ParseJsonInternalizedString(); |
467 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); | 468 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); |
468 | 469 |
469 AdvanceSkipWhitespace(); | 470 AdvanceSkipWhitespace(); |
470 value = ParseJsonValue(); | 471 value = ParseJsonValue(); |
471 if (value.is_null()) return ReportUnexpectedCharacter(); | 472 if (value.is_null()) return ReportUnexpectedCharacter(); |
472 | 473 |
473 JSObject::DefinePropertyOrElement(json_object, key, value).Check(); | 474 JSObject::DefinePropertyOrElementIgnoreAttributes(json_object, key, |
| 475 value).Check(); |
474 } | 476 } |
475 } | 477 } |
476 | 478 |
477 if (c0_ != '}') { | 479 if (c0_ != '}') { |
478 return ReportUnexpectedCharacter(); | 480 return ReportUnexpectedCharacter(); |
479 } | 481 } |
480 } | 482 } |
481 AdvanceSkipWhitespace(); | 483 AdvanceSkipWhitespace(); |
482 return scope.CloseAndEscape(json_object); | 484 return scope.CloseAndEscape(json_object); |
483 } | 485 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 | 837 |
836 DCHECK_EQ('"', c0_); | 838 DCHECK_EQ('"', c0_); |
837 // Advance past the last '"'. | 839 // Advance past the last '"'. |
838 AdvanceSkipWhitespace(); | 840 AdvanceSkipWhitespace(); |
839 return result; | 841 return result; |
840 } | 842 } |
841 | 843 |
842 } } // namespace v8::internal | 844 } } // namespace v8::internal |
843 | 845 |
844 #endif // V8_JSON_PARSER_H_ | 846 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |