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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 Handle<Object> name = factory->LookupSingleCharacterStringFromCode(c0_); | 237 Handle<Object> name = factory->LookupSingleCharacterStringFromCode(c0_); |
238 Handle<FixedArray> element = factory->NewFixedArray(1); | 238 Handle<FixedArray> element = factory->NewFixedArray(1); |
239 element->set(0, *name); | 239 element->set(0, *name); |
240 array = factory->NewJSArrayWithElements(element); | 240 array = factory->NewJSArrayWithElements(element); |
241 break; | 241 break; |
242 } | 242 } |
243 | 243 |
244 MessageLocation location(factory->NewScript(source_), | 244 MessageLocation location(factory->NewScript(source_), |
245 position_, | 245 position_, |
246 position_ + 1); | 246 position_ + 1); |
247 Handle<Object> error = factory->NewSyntaxError(message, array); | 247 Handle<Object> error; |
| 248 ASSIGN_RETURN_ON_EXCEPTION(isolate(), error, |
| 249 factory->NewSyntaxError(message, array), Object); |
248 return isolate()->template Throw<Object>(error, &location); | 250 return isolate()->template Throw<Object>(error, &location); |
249 } | 251 } |
250 return result; | 252 return result; |
251 } | 253 } |
252 | 254 |
253 | 255 |
254 // Parse any JSON value. | 256 // Parse any JSON value. |
255 template <bool seq_ascii> | 257 template <bool seq_ascii> |
256 Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() { | 258 Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() { |
257 StackLimitCheck stack_check(isolate_); | 259 StackLimitCheck stack_check(isolate_); |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 | 784 |
783 DCHECK_EQ('"', c0_); | 785 DCHECK_EQ('"', c0_); |
784 // Advance past the last '"'. | 786 // Advance past the last '"'. |
785 AdvanceSkipWhitespace(); | 787 AdvanceSkipWhitespace(); |
786 return result; | 788 return result; |
787 } | 789 } |
788 | 790 |
789 } } // namespace v8::internal | 791 } } // namespace v8::internal |
790 | 792 |
791 #endif // V8_JSON_PARSER_H_ | 793 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |