| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 798 |
| 799 | 799 |
| 800 void Parser::ReportMessageAt(Scanner::Location source_location, | 800 void Parser::ReportMessageAt(Scanner::Location source_location, |
| 801 const char* type, | 801 const char* type, |
| 802 Vector<const char*> args) { | 802 Vector<const char*> args) { |
| 803 MessageLocation location(script_, | 803 MessageLocation location(script_, |
| 804 source_location.beg_pos, | 804 source_location.beg_pos, |
| 805 source_location.end_pos); | 805 source_location.end_pos); |
| 806 Handle<JSArray> array = Factory::NewJSArray(args.length()); | 806 Handle<JSArray> array = Factory::NewJSArray(args.length()); |
| 807 for (int i = 0; i < args.length(); i++) { | 807 for (int i = 0; i < args.length(); i++) { |
| 808 SetElement(array, i, Factory::NewStringFromUtf8(CStrVector(args[i]))); | 808 SetElement(array, i, |
| 809 Factory::NewStringFromUtf8(CStrVector(args[i])), |
| 810 kNonStrictMode); |
| 809 } | 811 } |
| 810 Handle<Object> result = Factory::NewSyntaxError(type, array); | 812 Handle<Object> result = Factory::NewSyntaxError(type, array); |
| 811 Top::Throw(*result, &location); | 813 Top::Throw(*result, &location); |
| 812 } | 814 } |
| 813 | 815 |
| 814 | 816 |
| 815 void Parser::ReportMessageAt(Scanner::Location source_location, | 817 void Parser::ReportMessageAt(Scanner::Location source_location, |
| 816 const char* type, | 818 const char* type, |
| 817 Vector<Handle<String> > args) { | 819 Vector<Handle<String> > args) { |
| 818 MessageLocation location(script_, | 820 MessageLocation location(script_, |
| 819 source_location.beg_pos, | 821 source_location.beg_pos, |
| 820 source_location.end_pos); | 822 source_location.end_pos); |
| 821 Handle<JSArray> array = Factory::NewJSArray(args.length()); | 823 Handle<JSArray> array = Factory::NewJSArray(args.length()); |
| 822 for (int i = 0; i < args.length(); i++) { | 824 for (int i = 0; i < args.length(); i++) { |
| 823 SetElement(array, i, args[i]); | 825 SetElement(array, i, args[i], kNonStrictMode); |
| 824 } | 826 } |
| 825 Handle<Object> result = Factory::NewSyntaxError(type, array); | 827 Handle<Object> result = Factory::NewSyntaxError(type, array); |
| 826 Top::Throw(*result, &location); | 828 Top::Throw(*result, &location); |
| 827 } | 829 } |
| 828 | 830 |
| 829 | 831 |
| 830 // Base class containing common code for the different finder classes used by | 832 // Base class containing common code for the different finder classes used by |
| 831 // the parser. | 833 // the parser. |
| 832 class ParserFinder { | 834 class ParserFinder { |
| 833 protected: | 835 protected: |
| (...skipping 3199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4033 | 4035 |
| 4034 Scanner::Location source_location = scanner_.location(); | 4036 Scanner::Location source_location = scanner_.location(); |
| 4035 MessageLocation location(Factory::NewScript(script), | 4037 MessageLocation location(Factory::NewScript(script), |
| 4036 source_location.beg_pos, | 4038 source_location.beg_pos, |
| 4037 source_location.end_pos); | 4039 source_location.end_pos); |
| 4038 int argc = (name_opt == NULL) ? 0 : 1; | 4040 int argc = (name_opt == NULL) ? 0 : 1; |
| 4039 Handle<JSArray> array = Factory::NewJSArray(argc); | 4041 Handle<JSArray> array = Factory::NewJSArray(argc); |
| 4040 if (name_opt != NULL) { | 4042 if (name_opt != NULL) { |
| 4041 SetElement(array, | 4043 SetElement(array, |
| 4042 0, | 4044 0, |
| 4043 Factory::NewStringFromUtf8(CStrVector(name_opt))); | 4045 Factory::NewStringFromUtf8(CStrVector(name_opt)), |
| 4046 kNonStrictMode); |
| 4044 } | 4047 } |
| 4045 Handle<Object> result = Factory::NewSyntaxError(message, array); | 4048 Handle<Object> result = Factory::NewSyntaxError(message, array); |
| 4046 Top::Throw(*result, &location); | 4049 Top::Throw(*result, &location); |
| 4047 return Handle<Object>::null(); | 4050 return Handle<Object>::null(); |
| 4048 } | 4051 } |
| 4049 } | 4052 } |
| 4050 return result; | 4053 return result; |
| 4051 } | 4054 } |
| 4052 | 4055 |
| 4053 | 4056 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4105 return ReportUnexpectedToken(); | 4108 return ReportUnexpectedToken(); |
| 4106 } | 4109 } |
| 4107 Handle<String> key = GetString(); | 4110 Handle<String> key = GetString(); |
| 4108 if (scanner_.Next() != Token::COLON) { | 4111 if (scanner_.Next() != Token::COLON) { |
| 4109 return ReportUnexpectedToken(); | 4112 return ReportUnexpectedToken(); |
| 4110 } | 4113 } |
| 4111 Handle<Object> value = ParseJsonValue(); | 4114 Handle<Object> value = ParseJsonValue(); |
| 4112 if (value.is_null()) return Handle<Object>::null(); | 4115 if (value.is_null()) return Handle<Object>::null(); |
| 4113 uint32_t index; | 4116 uint32_t index; |
| 4114 if (key->AsArrayIndex(&index)) { | 4117 if (key->AsArrayIndex(&index)) { |
| 4115 SetOwnElement(json_object, index, value); | 4118 SetOwnElement(json_object, index, value, kNonStrictMode); |
| 4116 } else if (key->Equals(Heap::Proto_symbol())) { | 4119 } else if (key->Equals(Heap::Proto_symbol())) { |
| 4117 // We can't remove the __proto__ accessor since it's hardcoded | 4120 // We can't remove the __proto__ accessor since it's hardcoded |
| 4118 // in several places. Instead go along and add the value as | 4121 // in several places. Instead go along and add the value as |
| 4119 // the prototype of the created object if possible. | 4122 // the prototype of the created object if possible. |
| 4120 SetPrototype(json_object, value); | 4123 SetPrototype(json_object, value); |
| 4121 } else { | 4124 } else { |
| 4122 SetLocalPropertyIgnoreAttributes(json_object, key, value, NONE); | 4125 SetLocalPropertyIgnoreAttributes(json_object, key, value, NONE); |
| 4123 } | 4126 } |
| 4124 } while (scanner_.Next() == Token::COMMA); | 4127 } while (scanner_.Next() == Token::COMMA); |
| 4125 if (scanner_.current_token() != Token::RBRACE) { | 4128 if (scanner_.current_token() != Token::RBRACE) { |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5156 info->is_global(), | 5159 info->is_global(), |
| 5157 info->StrictMode()); | 5160 info->StrictMode()); |
| 5158 } | 5161 } |
| 5159 } | 5162 } |
| 5160 | 5163 |
| 5161 info->SetFunction(result); | 5164 info->SetFunction(result); |
| 5162 return (result != NULL); | 5165 return (result != NULL); |
| 5163 } | 5166 } |
| 5164 | 5167 |
| 5165 } } // namespace v8::internal | 5168 } } // namespace v8::internal |
| OLD | NEW |