| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 | 7 |
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 if ((metadata != NULL) && (*metadata).IsError()) { | 912 if ((metadata != NULL) && (*metadata).IsError()) { |
| 913 return metadata->raw(); // Error evaluating the metadata. | 913 return metadata->raw(); // Error evaluating the metadata. |
| 914 } | 914 } |
| 915 param_descriptor.SetAt(j + kParameterMetadataOffset, | 915 param_descriptor.SetAt(j + kParameterMetadataOffset, |
| 916 (param[i].metadata == NULL) ? Object::null_instance() : | 916 (param[i].metadata == NULL) ? Object::null_instance() : |
| 917 *(param[i].metadata)); | 917 *(param[i].metadata)); |
| 918 } | 918 } |
| 919 return param_descriptor.raw(); | 919 return param_descriptor.raw(); |
| 920 } else { | 920 } else { |
| 921 Thread* thread = Thread::Current(); | 921 Thread* thread = Thread::Current(); |
| 922 Isolate* isolate = thread->isolate(); | |
| 923 Error& error = Error::Handle(); | 922 Error& error = Error::Handle(); |
| 924 error = isolate->object_store()->sticky_error(); | 923 error = thread->sticky_error(); |
| 925 isolate->object_store()->clear_sticky_error(); | 924 thread->clear_sticky_error(); |
| 926 return error.raw(); | 925 return error.raw(); |
| 927 } | 926 } |
| 928 UNREACHABLE(); | 927 UNREACHABLE(); |
| 929 return Object::null(); | 928 return Object::null(); |
| 930 } | 929 } |
| 931 | 930 |
| 932 | 931 |
| 933 bool Parser::ParseFormalParameters(const Function& func, ParamList* params) { | 932 bool Parser::ParseFormalParameters(const Function& func, ParamList* params) { |
| 934 ASSERT(!func.IsNull()); | 933 ASSERT(!func.IsNull()); |
| 935 // This is currently only used for constructors. To handle all kinds | 934 // This is currently only used for constructors. To handle all kinds |
| (...skipping 10 matching lines...) Expand all Loading... |
| 946 const Script& script = Script::Handle(func.script()); | 945 const Script& script = Script::Handle(func.script()); |
| 947 const Class& owner = Class::Handle(func.Owner()); | 946 const Class& owner = Class::Handle(func.Owner()); |
| 948 ASSERT(!owner.IsNull()); | 947 ASSERT(!owner.IsNull()); |
| 949 ParsedFunction* parsed_function = | 948 ParsedFunction* parsed_function = |
| 950 new ParsedFunction(Thread::Current(), Function::ZoneHandle(func.raw())); | 949 new ParsedFunction(Thread::Current(), Function::ZoneHandle(func.raw())); |
| 951 Parser parser(script, parsed_function, func.token_pos()); | 950 Parser parser(script, parsed_function, func.token_pos()); |
| 952 parser.SkipFunctionPreamble(); | 951 parser.SkipFunctionPreamble(); |
| 953 parser.ParseFormalParameterList(true, true, params); | 952 parser.ParseFormalParameterList(true, true, params); |
| 954 return true; | 953 return true; |
| 955 } else { | 954 } else { |
| 956 Thread::Current()->isolate()->object_store()->clear_sticky_error(); | 955 Thread::Current()->clear_sticky_error(); |
| 957 params->Clear(); | 956 params->Clear(); |
| 958 return false; | 957 return false; |
| 959 } | 958 } |
| 960 UNREACHABLE(); | 959 UNREACHABLE(); |
| 961 return false; | 960 return false; |
| 962 } | 961 } |
| 963 | 962 |
| 964 | 963 |
| 965 void Parser::ParseFunction(ParsedFunction* parsed_function) { | 964 void Parser::ParseFunction(ParsedFunction* parsed_function) { |
| 966 Thread* thread = parsed_function->thread(); | 965 Thread* thread = parsed_function->thread(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 ParsedFunction* parsed_function = | 1093 ParsedFunction* parsed_function = |
| 1095 new ParsedFunction(thread, fake_function); | 1094 new ParsedFunction(thread, fake_function); |
| 1096 Parser parser(script, parsed_function, token_pos); | 1095 Parser parser(script, parsed_function, token_pos); |
| 1097 parser.set_current_class(owner_class); | 1096 parser.set_current_class(owner_class); |
| 1098 parser.OpenFunctionBlock(fake_function); | 1097 parser.OpenFunctionBlock(fake_function); |
| 1099 | 1098 |
| 1100 RawObject* metadata = parser.EvaluateMetadata(); | 1099 RawObject* metadata = parser.EvaluateMetadata(); |
| 1101 return metadata; | 1100 return metadata; |
| 1102 } else { | 1101 } else { |
| 1103 Thread* thread = Thread::Current(); | 1102 Thread* thread = Thread::Current(); |
| 1104 Isolate* isolate = thread->isolate(); | |
| 1105 StackZone stack_zone(thread); | 1103 StackZone stack_zone(thread); |
| 1106 Zone* zone = stack_zone.GetZone(); | 1104 Zone* zone = stack_zone.GetZone(); |
| 1107 Error& error = Error::Handle(zone); | 1105 Error& error = Error::Handle(zone); |
| 1108 error = isolate->object_store()->sticky_error(); | 1106 error = thread->sticky_error(); |
| 1109 isolate->object_store()->clear_sticky_error(); | 1107 thread->clear_sticky_error(); |
| 1110 return error.raw(); | 1108 return error.raw(); |
| 1111 } | 1109 } |
| 1112 UNREACHABLE(); | 1110 UNREACHABLE(); |
| 1113 return Object::null(); | 1111 return Object::null(); |
| 1114 } | 1112 } |
| 1115 | 1113 |
| 1116 | 1114 |
| 1117 RawArray* Parser::EvaluateMetadata() { | 1115 RawArray* Parser::EvaluateMetadata() { |
| 1118 CheckToken(Token::kAT, "Metadata character '@' expected"); | 1116 CheckToken(Token::kAT, "Metadata character '@' expected"); |
| 1119 GrowableObjectArray& meta_values = | 1117 GrowableObjectArray& meta_values = |
| (...skipping 13288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14408 const ArgumentListNode& function_args, | 14406 const ArgumentListNode& function_args, |
| 14409 const LocalVariable* temp_for_last_arg, | 14407 const LocalVariable* temp_for_last_arg, |
| 14410 bool is_super_invocation) { | 14408 bool is_super_invocation) { |
| 14411 UNREACHABLE(); | 14409 UNREACHABLE(); |
| 14412 return NULL; | 14410 return NULL; |
| 14413 } | 14411 } |
| 14414 | 14412 |
| 14415 } // namespace dart | 14413 } // namespace dart |
| 14416 | 14414 |
| 14417 #endif // DART_PRECOMPILED_RUNTIME | 14415 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |