| 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 package com.google.dart.compiler.parser; | 4 package com.google.dart.compiler.parser; |
| 5 | 5 |
| 6 import com.google.common.base.Joiner; | 6 import com.google.common.base.Joiner; |
| 7 import com.google.dart.compiler.CompilerTestCase; | 7 import com.google.dart.compiler.CompilerTestCase; |
| 8 import com.google.dart.compiler.ast.DartClass; | 8 import com.google.dart.compiler.ast.DartClass; |
| 9 import com.google.dart.compiler.ast.DartIdentifier; | 9 import com.google.dart.compiler.ast.DartIdentifier; |
| 10 import com.google.dart.compiler.ast.DartMethodDefinition; | 10 import com.google.dart.compiler.ast.DartMethodDefinition; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 "class A {void f(void cb(int a, [int b = 12345, int c])) {}}", | 174 "class A {void f(void cb(int a, [int b = 12345, int c])) {}}", |
| 175 errEx(ParserErrorCode.DEFAULT_VALUE_CAN_NOT_BE_SPECIFIED_IN_CLOSURE, 1,
41, 5)); | 175 errEx(ParserErrorCode.DEFAULT_VALUE_CAN_NOT_BE_SPECIFIED_IN_CLOSURE, 1,
41, 5)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 public void test_namedParameterValue_inSetter() { | 178 public void test_namedParameterValue_inSetter() { |
| 179 parseExpectErrors( | 179 parseExpectErrors( |
| 180 "class A { set f([int b]); }", | 180 "class A { set f([int b]); }", |
| 181 errEx(ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED, 1, 18, 5)); | 181 errEx(ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED, 1, 18, 5)); |
| 182 } | 182 } |
| 183 | 183 |
| 184 public void test_missingEndOfOptionalParameters() { |
| 185 parseExpectErrors( |
| 186 "class A {void m(var p1, [var p2 = const []) {} }", |
| 187 errEx(ParserErrorCode.MISSING_NAMED_PARAMETER_END, 1, 43, 1)); |
| 188 } |
| 189 |
| 184 public void test_namedParameterValue_inOperator() { | 190 public void test_namedParameterValue_inOperator() { |
| 185 parseExpectErrors( | 191 parseExpectErrors( |
| 186 "class A { operator []=(int a, [int b]); }", | 192 "class A { operator []=(int a, [int b]); }", |
| 187 errEx(ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED, 1, 32, 5)); | 193 errEx(ParserErrorCode.NAMED_PARAMETER_NOT_ALLOWED, 1, 32, 5)); |
| 188 } | 194 } |
| 189 | 195 |
| 190 /** | 196 /** |
| 191 * If keyword "extends" is mistyped in type parameters declaration, we should
report about this | 197 * If keyword "extends" is mistyped in type parameters declaration, we should
report about this |
| 192 * and then recover correctly. | 198 * and then recover correctly. |
| 193 * <p> | 199 * <p> |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 public void test_qualifiedType_inForIn() { | 1025 public void test_qualifiedType_inForIn() { |
| 1020 parseExpectErrors(Joiner.on("\n").join( | 1026 parseExpectErrors(Joiner.on("\n").join( |
| 1021 "// filler filler filler filler filler filler filler filler filler fille
r", | 1027 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 1022 "foo() {", | 1028 "foo() {", |
| 1023 " for (pref.A a in elements) {", | 1029 " for (pref.A a in elements) {", |
| 1024 " }", | 1030 " }", |
| 1025 "}", | 1031 "}", |
| 1026 "")); | 1032 "")); |
| 1027 } | 1033 } |
| 1028 } | 1034 } |
| OLD | NEW |