| 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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 ReportMessageAt(source_location, type, args); | 796 ReportMessageAt(source_location, type, args); |
| 797 } | 797 } |
| 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<FixedArray> elements = Factory::NewFixedArray(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 Handle<String> arg_string = Factory::NewStringFromUtf8(CStrVector(args[i])); |
| 809 elements->set(i, *arg_string); |
| 809 } | 810 } |
| 811 Handle<JSArray> array = Factory::NewJSArrayWithElements(elements); |
| 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<FixedArray> elements = Factory::NewFixedArray(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 elements->set(i, *args[i]); |
| 824 } | 826 } |
| 827 Handle<JSArray> array = Factory::NewJSArrayWithElements(elements); |
| 825 Handle<Object> result = Factory::NewSyntaxError(type, array); | 828 Handle<Object> result = Factory::NewSyntaxError(type, array); |
| 826 Top::Throw(*result, &location); | 829 Top::Throw(*result, &location); |
| 827 } | 830 } |
| 828 | 831 |
| 829 | 832 |
| 830 // Base class containing common code for the different finder classes used by | 833 // Base class containing common code for the different finder classes used by |
| 831 // the parser. | 834 // the parser. |
| 832 class ParserFinder { | 835 class ParserFinder { |
| 833 protected: | 836 protected: |
| 834 ParserFinder() {} | 837 ParserFinder() {} |
| (...skipping 4321 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 |