OLD | NEW |
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 <ctype.h> // isspace. | 5 #include <ctype.h> // isspace. |
6 | 6 |
7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
8 | 8 |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } else { | 117 } else { |
118 String& temp = String::Handle(); | 118 String& temp = String::Handle(); |
119 temp = String::Concat(String::Handle(Symbols::New("-")), | 119 temp = String::Concat(String::Handle(Symbols::New("-")), |
120 *int_string); | 120 *int_string); |
121 result = Integer::New(temp); | 121 result = Integer::New(temp); |
122 } | 122 } |
123 arguments->SetReturn(result); | 123 arguments->SetReturn(result); |
124 } else { | 124 } else { |
125 GrowableArray<const Object*> args; | 125 GrowableArray<const Object*> args; |
126 args.Add(&value); | 126 args.Add(&value); |
127 Exceptions::ThrowByType(Exceptions::kBadNumberFormat, args); | 127 Exceptions::ThrowByType(Exceptions::kFormat, args); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 DEFINE_NATIVE_ENTRY(MathNatives_parseDouble, 1) { | 132 DEFINE_NATIVE_ENTRY(MathNatives_parseDouble, 1) { |
133 GET_NATIVE_ARGUMENT(String, value, arguments->At(0)); | 133 GET_NATIVE_ARGUMENT(String, value, arguments->At(0)); |
134 Scanner scanner(value, String::Handle()); | 134 Scanner scanner(value, String::Handle()); |
135 const Scanner::GrowableTokenStream& tokens = scanner.GetStream(); | 135 const Scanner::GrowableTokenStream& tokens = scanner.GetStream(); |
136 String* number_string; | 136 String* number_string; |
137 bool is_positive; | 137 bool is_positive; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 arguments->SetReturn(Double::Handle(Double::New(INFINITY))); | 169 arguments->SetReturn(Double::Handle(Double::New(INFINITY))); |
170 } else { | 170 } else { |
171 arguments->SetReturn(Double::Handle(Double::New(-INFINITY))); | 171 arguments->SetReturn(Double::Handle(Double::New(-INFINITY))); |
172 } | 172 } |
173 return; | 173 return; |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 GrowableArray<const Object*> args; | 177 GrowableArray<const Object*> args; |
178 args.Add(&value); | 178 args.Add(&value); |
179 Exceptions::ThrowByType(Exceptions::kBadNumberFormat, args); | 179 Exceptions::ThrowByType(Exceptions::kFormat, args); |
180 } | 180 } |
181 | 181 |
182 } // namespace dart | 182 } // namespace dart |
OLD | NEW |