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 "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
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 |
11 #include "lib/regexp_jsc.h" | 11 #include "lib/regexp_jsc.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_factory, 4) { | 15 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_factory, 4) { |
16 ASSERT(AbstractTypeArguments::CheckedHandle( | 16 ASSERT(AbstractTypeArguments::CheckedHandle( |
17 arguments->NativeArgAt(0)).IsNull()); | 17 arguments->NativeArgAt(0)).IsNull()); |
18 GET_NATIVE_ARGUMENT(String, pattern, arguments->NativeArgAt(1)); | 18 GET_NON_NULL_NATIVE_ARGUMENT(String, pattern, arguments->NativeArgAt(1)); |
19 GET_NATIVE_ARGUMENT(Instance, handle_multi_line, arguments->NativeArgAt(2)); | 19 GET_NON_NULL_NATIVE_ARGUMENT( |
20 GET_NATIVE_ARGUMENT(Instance, handle_ignore_case, arguments->NativeArgAt(3)); | 20 Instance, handle_multi_line, arguments->NativeArgAt(2)); |
| 21 GET_NON_NULL_NATIVE_ARGUMENT( |
| 22 Instance, handle_ignore_case, arguments->NativeArgAt(3)); |
21 bool ignore_case = handle_ignore_case.raw() == Bool::True(); | 23 bool ignore_case = handle_ignore_case.raw() == Bool::True(); |
22 bool multi_line = handle_multi_line.raw() == Bool::True(); | 24 bool multi_line = handle_multi_line.raw() == Bool::True(); |
23 return Jscre::Compile(pattern, multi_line, ignore_case); | 25 return Jscre::Compile(pattern, multi_line, ignore_case); |
24 } | 26 } |
25 | 27 |
26 | 28 |
27 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_getPattern, 1) { | 29 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_getPattern, 1) { |
28 const JSRegExp& regexp = JSRegExp::CheckedHandle(arguments->NativeArgAt(0)); | 30 const JSRegExp& regexp = JSRegExp::CheckedHandle(arguments->NativeArgAt(0)); |
29 ASSERT(!regexp.IsNull()); | 31 ASSERT(!regexp.IsNull()); |
30 return regexp.pattern(); | 32 return regexp.pattern(); |
(...skipping 27 matching lines...) Expand all Loading... |
58 args.Add(&pattern); | 60 args.Add(&pattern); |
59 args.Add(&errmsg); | 61 args.Add(&errmsg); |
60 Exceptions::ThrowByType(Exceptions::kIllegalJSRegExp, args); | 62 Exceptions::ThrowByType(Exceptions::kIllegalJSRegExp, args); |
61 return Object::null(); | 63 return Object::null(); |
62 } | 64 } |
63 | 65 |
64 | 66 |
65 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_ExecuteMatch, 3) { | 67 DEFINE_NATIVE_ENTRY(JSSyntaxRegExp_ExecuteMatch, 3) { |
66 const JSRegExp& regexp = JSRegExp::CheckedHandle(arguments->NativeArgAt(0)); | 68 const JSRegExp& regexp = JSRegExp::CheckedHandle(arguments->NativeArgAt(0)); |
67 ASSERT(!regexp.IsNull()); | 69 ASSERT(!regexp.IsNull()); |
68 GET_NATIVE_ARGUMENT(String, str, arguments->NativeArgAt(1)); | 70 GET_NON_NULL_NATIVE_ARGUMENT(String, str, arguments->NativeArgAt(1)); |
69 GET_NATIVE_ARGUMENT(Smi, start_index, arguments->NativeArgAt(2)); | 71 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_index, arguments->NativeArgAt(2)); |
70 return Jscre::Execute(regexp, str, start_index.Value()); | 72 return Jscre::Execute(regexp, str, start_index.Value()); |
71 } | 73 } |
72 | 74 |
73 } // namespace dart | 75 } // namespace dart |
OLD | NEW |