| 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 4952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4963 } | 4963 } |
| 4964 return !parser.failed(); | 4964 return !parser.failed(); |
| 4965 } | 4965 } |
| 4966 | 4966 |
| 4967 | 4967 |
| 4968 bool ParserApi::Parse(CompilationInfo* info) { | 4968 bool ParserApi::Parse(CompilationInfo* info) { |
| 4969 ASSERT(info->function() == NULL); | 4969 ASSERT(info->function() == NULL); |
| 4970 FunctionLiteral* result = NULL; | 4970 FunctionLiteral* result = NULL; |
| 4971 Handle<Script> script = info->script(); | 4971 Handle<Script> script = info->script(); |
| 4972 if (info->is_lazy()) { | 4972 if (info->is_lazy()) { |
| 4973 Parser parser(script, true, NULL, NULL); | 4973 bool allow_natives_syntax = |
| 4974 FLAG_allow_natives_syntax || |
| 4975 info->is_native(); |
| 4976 Parser parser(script, allow_natives_syntax, NULL, NULL); |
| 4974 result = parser.ParseLazy(info); | 4977 result = parser.ParseLazy(info); |
| 4975 } else { | 4978 } else { |
| 4976 bool allow_natives_syntax = | 4979 bool allow_natives_syntax = |
| 4977 info->allows_natives_syntax() || FLAG_allow_natives_syntax; | 4980 info->is_native() || FLAG_allow_natives_syntax; |
| 4978 ScriptDataImpl* pre_data = info->pre_parse_data(); | 4981 ScriptDataImpl* pre_data = info->pre_parse_data(); |
| 4979 Parser parser(script, allow_natives_syntax, info->extension(), pre_data); | 4982 Parser parser(script, allow_natives_syntax, info->extension(), pre_data); |
| 4980 if (pre_data != NULL && pre_data->has_error()) { | 4983 if (pre_data != NULL && pre_data->has_error()) { |
| 4981 Scanner::Location loc = pre_data->MessageLocation(); | 4984 Scanner::Location loc = pre_data->MessageLocation(); |
| 4982 const char* message = pre_data->BuildMessage(); | 4985 const char* message = pre_data->BuildMessage(); |
| 4983 Vector<const char*> args = pre_data->BuildArgs(); | 4986 Vector<const char*> args = pre_data->BuildArgs(); |
| 4984 parser.ReportMessageAt(loc, message, args); | 4987 parser.ReportMessageAt(loc, message, args); |
| 4985 DeleteArray(message); | 4988 DeleteArray(message); |
| 4986 for (int i = 0; i < args.length(); i++) { | 4989 for (int i = 0; i < args.length(); i++) { |
| 4987 DeleteArray(args[i]); | 4990 DeleteArray(args[i]); |
| 4988 } | 4991 } |
| 4989 DeleteArray(args.start()); | 4992 DeleteArray(args.start()); |
| 4990 ASSERT(info->isolate()->has_pending_exception()); | 4993 ASSERT(info->isolate()->has_pending_exception()); |
| 4991 } else { | 4994 } else { |
| 4992 Handle<String> source = Handle<String>(String::cast(script->source())); | 4995 Handle<String> source = Handle<String>(String::cast(script->source())); |
| 4993 result = parser.ParseProgram(source, | 4996 result = parser.ParseProgram(source, |
| 4994 info->is_global(), | 4997 info->is_global(), |
| 4995 info->StrictMode()); | 4998 info->StrictMode()); |
| 4996 } | 4999 } |
| 4997 } | 5000 } |
| 4998 | 5001 |
| 4999 info->SetFunction(result); | 5002 info->SetFunction(result); |
| 5000 return (result != NULL); | 5003 return (result != NULL); |
| 5001 } | 5004 } |
| 5002 | 5005 |
| 5003 } } // namespace v8::internal | 5006 } } // namespace v8::internal |
| OLD | NEW |