OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 "class A {", | 442 "class A {", |
443 " const A();", | 443 " const A();", |
444 " set x(value) {}", | 444 " set x(value) {}", |
445 " get x {return 0;}", | 445 " get x {return 0;}", |
446 "}")); | 446 "}")); |
447 resolve(source); | 447 resolve(source); |
448 assertNoErrors(source); | 448 assertNoErrors(source); |
449 verify(source); | 449 verify(source); |
450 } | 450 } |
451 | 451 |
| 452 public void test_constEval_functionTypeLiteral() throws Exception { |
| 453 Source source = addSource(createSource(// |
| 454 "typedef F();", |
| 455 "const C = F;")); |
| 456 resolve(source); |
| 457 assertNoErrors(source); |
| 458 verify(source); |
| 459 } |
| 460 |
452 public void test_constEval_propertyExtraction_fieldStatic_targetType() throws
Exception { | 461 public void test_constEval_propertyExtraction_fieldStatic_targetType() throws
Exception { |
453 addSource("/math.dart", createSource(// | 462 addSource("/math.dart", createSource(// |
454 "library math;", | 463 "library math;", |
455 "const PI = 3.14;")); | 464 "const PI = 3.14;")); |
456 Source source = addSource(createSource(// | 465 Source source = addSource(createSource(// |
457 "import 'math.dart' as math;", | 466 "import 'math.dart' as math;", |
458 "const C = math.PI;")); | 467 "const C = math.PI;")); |
459 resolve(source); | 468 resolve(source); |
460 assertNoErrors(source); | 469 assertNoErrors(source); |
461 verify(source); | 470 verify(source); |
(...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 " }", | 2006 " }", |
1998 " f(x);", | 2007 " f(x);", |
1999 " return 0;", | 2008 " return 0;", |
2000 " }", | 2009 " }", |
2001 "}")); | 2010 "}")); |
2002 resolve(source); | 2011 resolve(source); |
2003 assertNoErrors(source); | 2012 assertNoErrors(source); |
2004 verify(source); | 2013 verify(source); |
2005 } | 2014 } |
2006 | 2015 |
| 2016 public void test_mixedReturnTypes_ignoreImplicit() throws Exception { |
| 2017 Source source = addSource(createSource(// |
| 2018 "f(bool p) {", |
| 2019 " if (p) return 42;", |
| 2020 " // implicit 'return;' is ignored", |
| 2021 "}")); |
| 2022 resolve(source); |
| 2023 assertNoErrors(source); |
| 2024 verify(source); |
| 2025 } |
| 2026 |
| 2027 public void test_mixedReturnTypes_ignoreImplicit2() throws Exception { |
| 2028 Source source = addSource(createSource(// |
| 2029 "f(bool p) {", |
| 2030 " if (p) {", |
| 2031 " return 42;", |
| 2032 " } else {", |
| 2033 " return 42;", |
| 2034 " }", |
| 2035 " // implicit 'return;' is ignored", |
| 2036 "}")); |
| 2037 resolve(source); |
| 2038 assertNoErrors(source); |
| 2039 verify(source); |
| 2040 } |
| 2041 |
2007 public void test_mixedReturnTypes_sameKind() throws Exception { | 2042 public void test_mixedReturnTypes_sameKind() throws Exception { |
2008 Source source = addSource(createSource(// | 2043 Source source = addSource(createSource(// |
2009 "class C {", | 2044 "class C {", |
2010 " m(int x) {", | 2045 " m(int x) {", |
2011 " if (x < 0) {", | 2046 " if (x < 0) {", |
2012 " return 1;", | 2047 " return 1;", |
2013 " }", | 2048 " }", |
2014 " return 0;", | 2049 " return 0;", |
2015 " }", | 2050 " }", |
2016 "}")); | 2051 "}")); |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3697 resolve(source); | 3732 resolve(source); |
3698 assertNoErrors(source); | 3733 assertNoErrors(source); |
3699 verify(source); | 3734 verify(source); |
3700 reset(); | 3735 reset(); |
3701 } | 3736 } |
3702 | 3737 |
3703 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { | 3738 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { |
3704 check_wrongNumberOfParametersForOperator(name, "a"); | 3739 check_wrongNumberOfParametersForOperator(name, "a"); |
3705 } | 3740 } |
3706 } | 3741 } |
OLD | NEW |