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 3140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3151 " {", | 3151 " {", |
3152 " print(v);", | 3152 " print(v);", |
3153 " }", | 3153 " }", |
3154 " var v = 2;", | 3154 " var v = 2;", |
3155 "}", | 3155 "}", |
3156 "print(x) {}")); | 3156 "print(x) {}")); |
3157 resolve(source); | 3157 resolve(source); |
3158 assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION); | 3158 assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION); |
3159 } | 3159 } |
3160 | 3160 |
| 3161 public void test_referencedBeforeDeclaration_inInitializer_closure() throws Ex
ception { |
| 3162 Source source = addSource(createSource(// |
| 3163 "main() {", |
| 3164 " var v = () => v;", |
| 3165 "}")); |
| 3166 resolve(source); |
| 3167 assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION); |
| 3168 } |
| 3169 |
| 3170 public void test_referencedBeforeDeclaration_inInitializer_directly() throws E
xception { |
| 3171 Source source = addSource(createSource(// |
| 3172 "main() {", |
| 3173 " var v = v;", |
| 3174 "}")); |
| 3175 resolve(source); |
| 3176 assertErrors(source, CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION); |
| 3177 } |
| 3178 |
3161 public void test_rethrowOutsideCatch() throws Exception { | 3179 public void test_rethrowOutsideCatch() throws Exception { |
3162 Source source = addSource(createSource(// | 3180 Source source = addSource(createSource(// |
3163 "f() {", | 3181 "f() {", |
3164 " rethrow;", | 3182 " rethrow;", |
3165 "}")); | 3183 "}")); |
3166 resolve(source); | 3184 resolve(source); |
3167 assertErrors(source, CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH); | 3185 assertErrors(source, CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH); |
3168 verify(source); | 3186 verify(source); |
3169 } | 3187 } |
3170 | 3188 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3710 assertErrors(source, CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPE
RATOR); | 3728 assertErrors(source, CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPE
RATOR); |
3711 verify(source); | 3729 verify(source); |
3712 reset(); | 3730 reset(); |
3713 } | 3731 } |
3714 | 3732 |
3715 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { | 3733 private void check_wrongNumberOfParametersForOperator1(String name) throws Exc
eption { |
3716 check_wrongNumberOfParametersForOperator(name, ""); | 3734 check_wrongNumberOfParametersForOperator(name, ""); |
3717 check_wrongNumberOfParametersForOperator(name, "a, b"); | 3735 check_wrongNumberOfParametersForOperator(name, "a, b"); |
3718 } | 3736 } |
3719 } | 3737 } |
OLD | NEW |