| 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 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
| 6 | 6 |
| 7 import com.google.common.base.Joiner; | 7 import com.google.common.base.Joiner; |
| 8 import com.google.dart.compiler.DartCompilationError; | 8 import com.google.dart.compiler.DartCompilationError; |
| 9 import com.google.dart.compiler.ErrorCode; | 9 import com.google.dart.compiler.ErrorCode; |
| 10 import com.google.dart.compiler.ast.DartClass; | 10 import com.google.dart.compiler.ast.DartClass; |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 "interface int {}", | 1451 "interface int {}", |
| 1452 "method() {", | 1452 "method() {", |
| 1453 " outer: for(int i = 0; i < 1; i++) {", | 1453 " outer: for(int i = 0; i < 1; i++) {", |
| 1454 " outer();", | 1454 " outer();", |
| 1455 " }", | 1455 " }", |
| 1456 "}"), | 1456 "}"), |
| 1457 errEx(ResolverErrorCode.CANNOT_RESOLVE_METHOD, 5, 5, 5)); | 1457 errEx(ResolverErrorCode.CANNOT_RESOLVE_METHOD, 5, 5, 5)); |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 public void testUndercoreInNamedParameterMethodDefinition() { | 1460 public void testUndercoreInNamedParameterMethodDefinition() { |
| 1461 // TODO(scheglov) |
| 1462 // Language change 4288 adds new syntax for optional named parameters. |
| 1463 // However before "remove old optional parameter syntax" we have to support
old syntax too. |
| 1464 // And this conflicts with "_" handling in optional named parameters. |
| 1465 // |
| 1466 // http://code.google.com/p/dart/issues/detail?id=4539 |
| 1467 // requested to disable this |
| 1461 resolveAndTest(Joiner.on("\n").join( | 1468 resolveAndTest(Joiner.on("\n").join( |
| 1462 "class Object {}", | 1469 "class Object {}", |
| 1463 "method([_foo]) {}", | 1470 "method([_foo]) {}", |
| 1464 "class Foo {", | 1471 "class Foo {", |
| 1465 " var _bar;", | 1472 " var _bar;", |
| 1466 " Foo([this._bar]){}", | 1473 " //Foo([this._bar]){}", |
| 1467 " method([_foo]){}", | 1474 " method([_foo]){}", |
| 1468 "}"), | 1475 "}"), |
| 1469 errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 9,
4), | 1476 errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 9,
4), |
| 1470 errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 5, 8,
9), | 1477 // errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 5, 8
, 9), |
| 1471 errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 6, 11,
4)); | 1478 errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 6, 11,
4)); |
| 1472 } | 1479 } |
| 1473 | 1480 |
| 1474 public void testUndercoreInNamedParameterFunctionDefinition() { | 1481 public void testUndercoreInNamedParameterFunctionDefinition() { |
| 1475 resolveAndTest(Joiner.on("\n").join( | 1482 resolveAndTest(Joiner.on("\n").join( |
| 1476 "class Object {}", | 1483 "class Object {}", |
| 1477 "var f = func([_foo]) {};"), | 1484 "var f = func([_foo]) {};"), |
| 1478 errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 15,
4)); | 1485 errEx(ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER, 2, 15,
4)); |
| 1479 } | 1486 } |
| 1480 | 1487 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 "class Object {}", | 1774 "class Object {}", |
| 1768 "class A {", | 1775 "class A {", |
| 1769 " A(arg) {}", | 1776 " A(arg) {}", |
| 1770 "}", | 1777 "}", |
| 1771 "class B extends A {", | 1778 "class B extends A {", |
| 1772 " B() { }", | 1779 " B() { }", |
| 1773 "}"), | 1780 "}"), |
| 1774 errEx(ResolverErrorCode.TOO_FEW_ARGUMENTS_IN_IMPLICIT_SUPER, 6, 3, 7)); | 1781 errEx(ResolverErrorCode.TOO_FEW_ARGUMENTS_IN_IMPLICIT_SUPER, 6, 3, 7)); |
| 1775 } | 1782 } |
| 1776 } | 1783 } |
| OLD | NEW |