| 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.end2end.inc; | 4 package com.google.dart.compiler.end2end.inc; |
| 5 | 5 |
| 6 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; | 6 import static com.google.dart.compiler.DartCompiler.EXTENSION_DEPS; |
| 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP; | 7 import static com.google.dart.compiler.DartCompiler.EXTENSION_TIMESTAMP; |
| 8 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; | 8 import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; |
| 9 import static com.google.dart.compiler.common.ErrorExpectation.errEx; | 9 import static com.google.dart.compiler.common.ErrorExpectation.errEx; |
| 10 | 10 |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 "#import('A.dart');", | 743 "#import('A.dart');", |
| 744 "class B extends A {", | 744 "class B extends A {", |
| 745 " test1() {", | 745 " test1() {", |
| 746 " _method();", | 746 " _method();", |
| 747 " }", | 747 " }", |
| 748 " test2() {", | 748 " test2() {", |
| 749 " super._method();", | 749 " super._method();", |
| 750 " }", | 750 " }", |
| 751 "}", | 751 "}", |
| 752 "")); | 752 "")); |
| 753 // do compile, no errors expected | 753 // do compile, check errors |
| 754 compile(); | 754 compile(); |
| 755 assertErrors( | 755 assertErrors( |
| 756 errors, | 756 errors, |
| 757 errEx(ResolverErrorCode.CANNOT_ACCESS_METHOD, 6, 5, 7), | 757 errEx(ResolverErrorCode.CANNOT_ACCESS_METHOD, 6, 5, 7), |
| 758 errEx(ResolverErrorCode.CANNOT_ACCESS_METHOD, 9, 11, 7)); | 758 errEx(ResolverErrorCode.CANNOT_ACCESS_METHOD, 9, 11, 7)); |
| 759 } | 759 } |
| 760 |
| 761 /** |
| 762 * When we resolve factory constructors, we should check if "lib" is library p
refix, it is not |
| 763 * always have to be name of type. |
| 764 * <p> |
| 765 * http://code.google.com/p/dart/issues/detail?id=2478 |
| 766 */ |
| 767 public void test_factoryClass_fromPrefixImportedLibrary() throws Exception { |
| 768 appSource.setContent( |
| 769 "A.dart", |
| 770 makeCode( |
| 771 "// filler filler filler filler filler filler filler filler filler f
iller filler", |
| 772 "#library('A');", |
| 773 "#import('" + APP + "');", |
| 774 "interface I default A {", |
| 775 " I();", |
| 776 " I.named();", |
| 777 "}", |
| 778 "")); |
| 779 appSource.setContent( |
| 780 APP, |
| 781 makeCode( |
| 782 "// filler filler filler filler filler filler filler filler filler f
iller filler", |
| 783 "#library('application');", |
| 784 "#import('A.dart', prefix: 'lib');", |
| 785 "class A {", |
| 786 " factory lib.I() {}", |
| 787 " factory lib.I.named() {}", |
| 788 "}", |
| 789 "")); |
| 790 // do compile, no errors expected |
| 791 compile(); |
| 792 assertErrors(errors); |
| 793 } |
| 760 | 794 |
| 761 /** | 795 /** |
| 762 * <p> | 796 * <p> |
| 763 * http://code.google.com/p/dart/issues/detail?id=3340 | 797 * http://code.google.com/p/dart/issues/detail?id=3340 |
| 764 */ | 798 */ |
| 765 public void test_useImportPrefix_asVariableName() throws Exception { | 799 public void test_useImportPrefix_asVariableName() throws Exception { |
| 766 appSource.setContent( | 800 appSource.setContent( |
| 767 "A.dart", | 801 "A.dart", |
| 768 makeCode( | 802 makeCode( |
| 769 "// filler filler filler filler filler filler filler filler filler f
iller filler", | 803 "// filler filler filler filler filler filler filler filler filler f
iller filler", |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 private void didWrite(String sourceName, String extension) { | 917 private void didWrite(String sourceName, String extension) { |
| 884 String spec = sourceName + "/" + extension; | 918 String spec = sourceName + "/" + extension; |
| 885 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); | 919 assertTrue("Expected write: " + spec, provider.writes.contains(spec)); |
| 886 } | 920 } |
| 887 | 921 |
| 888 private void didNotWrite(String sourceName, String extension) { | 922 private void didNotWrite(String sourceName, String extension) { |
| 889 String spec = sourceName + "/" + extension; | 923 String spec = sourceName + "/" + extension; |
| 890 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); | 924 assertFalse("Didn't expect write: " + spec, provider.writes.contains(spec)); |
| 891 } | 925 } |
| 892 } | 926 } |
| OLD | NEW |