Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: runtime/bin/dartutils.cc

Issue 17261011: Replace uses of Dart_GetClass with Dart_GetType and Dart_InstanceGetClass with Dart_InstanceGetType… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/directory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 int32_t min = 0xc0000000; // -1073741824 754 int32_t min = 0xc0000000; // -1073741824
755 int32_t max = 0x3fffffff; // 1073741823 755 int32_t max = 0x3fffffff; // 1073741823
756 ASSERT(min <= value && value < max); 756 ASSERT(min <= value && value < max);
757 Dart_CObject object; 757 Dart_CObject object;
758 object.type = Dart_CObject_kInt32; 758 object.type = Dart_CObject_kInt32;
759 object.value.as_int32 = value; 759 object.value.as_int32 = value;
760 return Dart_PostCObject(port_id, &object); 760 return Dart_PostCObject(port_id, &object);
761 } 761 }
762 762
763 763
764 Dart_Handle DartUtils::GetDartClass(const char* library_url, 764 Dart_Handle DartUtils::GetDartType(const char* library_url,
765 const char* class_name) { 765 const char* class_name) {
766 return Dart_GetClass(Dart_LookupLibrary(NewString(library_url)), 766 return Dart_GetType(Dart_LookupLibrary(NewString(library_url)),
767 NewString(class_name)); 767 NewString(class_name), 0, NULL);
768 } 768 }
769 769
770 770
771 Dart_Handle DartUtils::NewDartOSError() { 771 Dart_Handle DartUtils::NewDartOSError() {
772 // Extract the current OS error. 772 // Extract the current OS error.
773 OSError os_error; 773 OSError os_error;
774 return NewDartOSError(&os_error); 774 return NewDartOSError(&os_error);
775 } 775 }
776 776
777 777
778 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) { 778 Dart_Handle DartUtils::NewDartOSError(OSError* os_error) {
779 // Create a dart:io OSError object with the information retrieved from the OS. 779 // Create a dart:io OSError object with the information retrieved from the OS.
780 Dart_Handle clazz = GetDartClass(kIOLibURL, "OSError"); 780 Dart_Handle type = GetDartType(kIOLibURL, "OSError");
781 Dart_Handle args[2]; 781 Dart_Handle args[2];
782 args[0] = NewString(os_error->message()); 782 args[0] = NewString(os_error->message());
783 args[1] = Dart_NewInteger(os_error->code()); 783 args[1] = Dart_NewInteger(os_error->code());
784 return Dart_New(clazz, Dart_Null(), 2, args); 784 return Dart_New(type, Dart_Null(), 2, args);
785 } 785 }
786 786
787 787
788 Dart_Handle DartUtils::NewDartSocketException(const char* message, 788 Dart_Handle DartUtils::NewDartSocketException(const char* message,
789 Dart_Handle os_error) { 789 Dart_Handle os_error) {
790 // Create a dart:io SocketException object. 790 // Create a dart:io SocketException object.
791 Dart_Handle clazz = GetDartClass(kIOLibURL, "SocketException"); 791 Dart_Handle type = GetDartType(kIOLibURL, "SocketException");
792 Dart_Handle args[2]; 792 Dart_Handle args[2];
793 args[0] = NewString(message); 793 args[0] = NewString(message);
794 args[1] = os_error; 794 args[1] = os_error;
795 return Dart_New(clazz, Dart_Null(), 2, args); 795 return Dart_New(type, Dart_Null(), 2, args);
796 } 796 }
797 797
798 798
799 Dart_Handle DartUtils::NewDartExceptionWithMessage(const char* library_url, 799 Dart_Handle DartUtils::NewDartExceptionWithMessage(const char* library_url,
800 const char* exception_name, 800 const char* exception_name,
801 const char* message) { 801 const char* message) {
802 // Create a Dart Exception object with a message. 802 // Create a Dart Exception object with a message.
803 Dart_Handle clazz = GetDartClass(library_url, exception_name); 803 Dart_Handle type = GetDartType(library_url, exception_name);
804 if (message != NULL) { 804 if (message != NULL) {
805 Dart_Handle args[1]; 805 Dart_Handle args[1];
806 args[0] = NewString(message); 806 args[0] = NewString(message);
807 return Dart_New(clazz, Dart_Null(), 1, args); 807 return Dart_New(type, Dart_Null(), 1, args);
808 } else { 808 } else {
809 return Dart_New(clazz, Dart_Null(), 0, NULL); 809 return Dart_New(type, Dart_Null(), 0, NULL);
810 } 810 }
811 } 811 }
812 812
813 813
814 Dart_Handle DartUtils::NewDartArgumentError(const char* message) { 814 Dart_Handle DartUtils::NewDartArgumentError(const char* message) {
815 return NewDartExceptionWithMessage(kCoreLibURL, 815 return NewDartExceptionWithMessage(kCoreLibURL,
816 "ArgumentError", 816 "ArgumentError",
817 message); 817 message);
818 } 818 }
819 819
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 new CObjectString(CObject::NewString(os_error->message())); 982 new CObjectString(CObject::NewString(os_error->message()));
983 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 983 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
984 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 984 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
985 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 985 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
986 result->SetAt(2, error_message); 986 result->SetAt(2, error_message);
987 return result; 987 return result;
988 } 988 }
989 989
990 } // namespace bin 990 } // namespace bin
991 } // namespace dart 991 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/directory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698