| 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 | 8 #ifndef DART_PRECOMPILED |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "vm/isolate.h" | 23 #include "vm/isolate.h" |
| 24 #include "vm/longjump.h" | 24 #include "vm/longjump.h" |
| 25 #include "vm/native_arguments.h" | 25 #include "vm/native_arguments.h" |
| 26 #include "vm/native_entry.h" | 26 #include "vm/native_entry.h" |
| 27 #include "vm/object.h" | 27 #include "vm/object.h" |
| 28 #include "vm/object_store.h" | 28 #include "vm/object_store.h" |
| 29 #include "vm/os.h" | 29 #include "vm/os.h" |
| 30 #include "vm/regexp_assembler.h" | 30 #include "vm/regexp_assembler.h" |
| 31 #include "vm/report.h" | 31 #include "vm/report.h" |
| 32 #include "vm/resolver.h" | 32 #include "vm/resolver.h" |
| 33 #include "vm/safepoint.h" |
| 33 #include "vm/scanner.h" | 34 #include "vm/scanner.h" |
| 34 #include "vm/scopes.h" | 35 #include "vm/scopes.h" |
| 35 #include "vm/stack_frame.h" | 36 #include "vm/stack_frame.h" |
| 36 #include "vm/symbols.h" | 37 #include "vm/symbols.h" |
| 37 #include "vm/tags.h" | 38 #include "vm/tags.h" |
| 38 #include "vm/timer.h" | 39 #include "vm/timer.h" |
| 39 #include "vm/zone.h" | 40 #include "vm/zone.h" |
| 40 | 41 |
| 41 namespace dart { | 42 namespace dart { |
| 42 | 43 |
| (...skipping 5835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5878 if (tag == Dart_kCanonicalizeUrl) { | 5879 if (tag == Dart_kCanonicalizeUrl) { |
| 5879 return url.raw(); | 5880 return url.raw(); |
| 5880 } | 5881 } |
| 5881 return Object::null(); | 5882 return Object::null(); |
| 5882 } | 5883 } |
| 5883 ReportError(token_pos, "no library handler registered"); | 5884 ReportError(token_pos, "no library handler registered"); |
| 5884 } | 5885 } |
| 5885 // Block class finalization attempts when calling into the library | 5886 // Block class finalization attempts when calling into the library |
| 5886 // tag handler. | 5887 // tag handler. |
| 5887 I->BlockClassFinalization(); | 5888 I->BlockClassFinalization(); |
| 5888 Api::Scope api_scope(T); | 5889 Object& result = Object::Handle(Z); |
| 5889 Dart_Handle result = handler(tag, | 5890 { |
| 5890 Api::NewHandle(T, library_.raw()), | 5891 TransitionVMToNative transition(T); |
| 5891 Api::NewHandle(T, url.raw())); | 5892 Api::Scope api_scope(T); |
| 5893 Dart_Handle retval = handler(tag, |
| 5894 Api::NewHandle(T, library_.raw()), |
| 5895 Api::NewHandle(T, url.raw())); |
| 5896 result = Api::UnwrapHandle(retval); |
| 5897 } |
| 5892 I->UnblockClassFinalization(); | 5898 I->UnblockClassFinalization(); |
| 5893 if (Dart_IsError(result)) { | 5899 if (result.IsError()) { |
| 5894 // In case of an error we append an explanatory error message to the | 5900 // In case of an error we append an explanatory error message to the |
| 5895 // error obtained from the library tag handler. | 5901 // error obtained from the library tag handler. |
| 5896 Error& prev_error = Error::Handle(Z); | 5902 const Error& prev_error = Error::Cast(result); |
| 5897 prev_error ^= Api::UnwrapHandle(result); | |
| 5898 Report::LongJumpF(prev_error, script_, token_pos, "library handler failed"); | 5903 Report::LongJumpF(prev_error, script_, token_pos, "library handler failed"); |
| 5899 } | 5904 } |
| 5900 if (tag == Dart_kCanonicalizeUrl) { | 5905 if (tag == Dart_kCanonicalizeUrl) { |
| 5901 if (!Dart_IsString(result)) { | 5906 if (!result.IsString()) { |
| 5902 ReportError(token_pos, "library handler failed URI canonicalization"); | 5907 ReportError(token_pos, "library handler failed URI canonicalization"); |
| 5903 } | 5908 } |
| 5904 } | 5909 } |
| 5905 return Api::UnwrapHandle(result); | 5910 return result.raw(); |
| 5906 } | 5911 } |
| 5907 | 5912 |
| 5908 | 5913 |
| 5909 void Parser::ParseLibraryName() { | 5914 void Parser::ParseLibraryName() { |
| 5910 ASSERT(CurrentToken() == Token::kLIBRARY); | 5915 ASSERT(CurrentToken() == Token::kLIBRARY); |
| 5911 ConsumeToken(); | 5916 ConsumeToken(); |
| 5912 String& lib_name = *ExpectIdentifier("library name expected"); | 5917 String& lib_name = *ExpectIdentifier("library name expected"); |
| 5913 if (CurrentToken() == Token::kPERIOD) { | 5918 if (CurrentToken() == Token::kPERIOD) { |
| 5914 GrowableHandlePtrArray<const String> pieces(Z, 3); | 5919 GrowableHandlePtrArray<const String> pieces(Z, 3); |
| 5915 pieces.Add(lib_name); | 5920 pieces.Add(lib_name); |
| (...skipping 8661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14577 const ArgumentListNode& function_args, | 14582 const ArgumentListNode& function_args, |
| 14578 const LocalVariable* temp_for_last_arg, | 14583 const LocalVariable* temp_for_last_arg, |
| 14579 bool is_super_invocation) { | 14584 bool is_super_invocation) { |
| 14580 UNREACHABLE(); | 14585 UNREACHABLE(); |
| 14581 return NULL; | 14586 return NULL; |
| 14582 } | 14587 } |
| 14583 | 14588 |
| 14584 } // namespace dart | 14589 } // namespace dart |
| 14585 | 14590 |
| 14586 #endif // DART_PRECOMPILED | 14591 #endif // DART_PRECOMPILED |
| OLD | NEW |