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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 // exercises a path in eval where a library may have no top-level anonymous | 2009 // exercises a path in eval where a library may have no top-level anonymous |
2010 // classes. | 2010 // classes. |
2011 const char* kScriptChars = | 2011 const char* kScriptChars = |
2012 "import 'dart:math'; \n" | 2012 "import 'dart:math'; \n" |
2013 "class Point { \n" | 2013 "class Point { \n" |
2014 " var x, y; \n" | 2014 " var x, y; \n" |
2015 " Point(this.x, this.y); \n" | 2015 " Point(this.x, this.y); \n" |
2016 " get r => sqrt(x*x + y*y); \n" | 2016 " get r => sqrt(x*x + y*y); \n" |
2017 "} \n"; | 2017 "} \n"; |
2018 LoadScript(kScriptChars); | 2018 LoadScript(kScriptChars); |
2019 Dart_FinalizeLoading(); | 2019 Dart_FinalizeLoading(false); |
2020 | 2020 |
2021 Dart_SetExceptionThrownHandler(&EvaluateInActivationOfEvaluateHandler); | 2021 Dart_SetExceptionThrownHandler(&EvaluateInActivationOfEvaluateHandler); |
2022 Dart_SetExceptionPauseInfo(kPauseOnAllExceptions); | 2022 Dart_SetExceptionPauseInfo(kPauseOnAllExceptions); |
2023 breakpoint_hit_counter = 0; | 2023 breakpoint_hit_counter = 0; |
2024 | 2024 |
2025 Dart_Handle result = Dart_EvaluateExpr(script_lib, NewString( | 2025 Dart_Handle result = Dart_EvaluateExpr(script_lib, NewString( |
2026 "() { var p = new Point(3, 4); throw p; } ())")); | 2026 "() { var p = new Point(3, 4); throw p; } ())")); |
2027 EXPECT(Dart_IsError(result)); | 2027 EXPECT(Dart_IsError(result)); |
2028 EXPECT_EQ(1, breakpoint_hit_counter); | 2028 EXPECT_EQ(1, breakpoint_hit_counter); |
2029 } | 2029 } |
(...skipping 13 matching lines...) Expand all Loading... |
2043 "main() { \n" | 2043 "main() { \n" |
2044 " try { \n" | 2044 " try { \n" |
2045 " throw 'broccoli'; \n" | 2045 " throw 'broccoli'; \n" |
2046 " } catch (e) { \n" | 2046 " } catch (e) { \n" |
2047 " return 'carrots'; \n" | 2047 " return 'carrots'; \n" |
2048 " } \n" | 2048 " } \n" |
2049 " return 'zucchini'; \n" | 2049 " return 'zucchini'; \n" |
2050 "} \n"; | 2050 "} \n"; |
2051 | 2051 |
2052 LoadScript(kScriptChars); | 2052 LoadScript(kScriptChars); |
2053 Dart_FinalizeLoading(); | 2053 Dart_FinalizeLoading(false); |
2054 Dart_SetExceptionThrownHandler(&UnhandledExceptionHandler); | 2054 Dart_SetExceptionThrownHandler(&UnhandledExceptionHandler); |
2055 breakpoint_hit_counter = 0; | 2055 breakpoint_hit_counter = 0; |
2056 | 2056 |
2057 // Check that the debugger is not called since the exception | 2057 // Check that the debugger is not called since the exception |
2058 // is handled. | 2058 // is handled. |
2059 Dart_SetExceptionPauseInfo(kPauseOnUnhandledExceptions); | 2059 Dart_SetExceptionPauseInfo(kPauseOnUnhandledExceptions); |
2060 Dart_Handle res = Invoke("main"); | 2060 Dart_Handle res = Invoke("main"); |
2061 EXPECT_VALID(res); | 2061 EXPECT_VALID(res); |
2062 EXPECT(Dart_IsString(res)); | 2062 EXPECT(Dart_IsString(res)); |
2063 EXPECT_STREQ("carrots", ToCString(res)); | 2063 EXPECT_STREQ("carrots", ToCString(res)); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," | 2305 " null, 3, 7, 1, 8, 6, 9, 10, 10, 11, 11, 13," |
2306 " null, 4, 13, 3, 14, 10," | 2306 " null, 4, 13, 3, 14, 10," |
2307 " null, 5, 17, 5, 18, 9, 19, 12," | 2307 " null, 5, 17, 5, 18, 9, 19, 12," |
2308 " null, 6, 21, 1," | 2308 " null, 6, 21, 1," |
2309 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," | 2309 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," |
2310 " null, 9, 29, 1]", | 2310 " null, 9, 29, 1]", |
2311 tokens_cstr); | 2311 tokens_cstr); |
2312 } | 2312 } |
2313 | 2313 |
2314 } // namespace dart | 2314 } // namespace dart |
OLD | NEW |