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

Side by Side Diff: runtime/lib/string.cc

Issue 10562038: Remove obsolete String + code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « corelib/src/string.dart ('k') | runtime/lib/string.dart » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 111
112 DEFINE_NATIVE_ENTRY(String_concat, 2) { 112 DEFINE_NATIVE_ENTRY(String_concat, 2) {
113 const String& receiver = String::CheckedHandle(arguments->At(0)); 113 const String& receiver = String::CheckedHandle(arguments->At(0));
114 GET_NATIVE_ARGUMENT(String, b, arguments->At(1)); 114 GET_NATIVE_ARGUMENT(String, b, arguments->At(1));
115 const String& result = String::Handle(String::Concat(receiver, b)); 115 const String& result = String::Handle(String::Concat(receiver, b));
116 arguments->SetReturn(result); 116 arguments->SetReturn(result);
117 } 117 }
118 118
119 119
120 // TODO(hausner): Remove obsolete String_plus.
121 DECLARE_FLAG(bool, allow_string_plus);
122 DEFINE_NATIVE_ENTRY(String_plus, 2) {
123 const String& receiver = String::CheckedHandle(arguments->At(0));
124 GET_NATIVE_ARGUMENT(String, b, arguments->At(1));
125 if (!FLAG_allow_string_plus) {
126 // Throw a noSuchMethod exception if operator + is not supported.
127 const String& func_name = String::Handle(String::New("+"));
128 const Array& func_args = Array::Handle(Array::New(1));
129 func_args.SetAt(0, b);
130 GrowableArray<const Object*> dart_arguments(3);
131 dart_arguments.Add(&receiver);
132 dart_arguments.Add(&func_name);
133 dart_arguments.Add(&func_args);
134 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
135 }
136 const String& result = String::Handle(String::Concat(receiver, b));
137 arguments->SetReturn(result);
138 }
139
140
141 DEFINE_NATIVE_ENTRY(String_toLowerCase, 1) { 120 DEFINE_NATIVE_ENTRY(String_toLowerCase, 1) {
142 const String& receiver = String::CheckedHandle(arguments->At(0)); 121 const String& receiver = String::CheckedHandle(arguments->At(0));
143 ASSERT(!receiver.IsNull()); 122 ASSERT(!receiver.IsNull());
144 const String& result = String::Handle(String::ToLowerCase(receiver)); 123 const String& result = String::Handle(String::ToLowerCase(receiver));
145 arguments->SetReturn(result); 124 arguments->SetReturn(result);
146 } 125 }
147 126
148 127
149 DEFINE_NATIVE_ENTRY(String_toUpperCase, 1) { 128 DEFINE_NATIVE_ENTRY(String_toUpperCase, 1) {
150 const String& receiver = String::CheckedHandle(arguments->At(0)); 129 const String& receiver = String::CheckedHandle(arguments->At(0));
(...skipping 18 matching lines...) Expand all
169 GrowableArray<const Object*> args; 148 GrowableArray<const Object*> args;
170 args.Add(&elem); 149 args.Add(&elem);
171 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args); 150 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args);
172 } 151 }
173 } 152 }
174 const String& result = String::Handle(String::ConcatAll(strings)); 153 const String& result = String::Handle(String::ConcatAll(strings));
175 arguments->SetReturn(result); 154 arguments->SetReturn(result);
176 } 155 }
177 156
178 } // namespace dart 157 } // namespace dart
OLDNEW
« no previous file with comments | « corelib/src/string.dart ('k') | runtime/lib/string.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698