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.type; | 4 package com.google.dart.compiler.type; |
5 | 5 |
6 import com.google.common.base.Joiner; | 6 import com.google.common.base.Joiner; |
7 import com.google.common.collect.Iterables; | 7 import com.google.common.collect.Iterables; |
8 import com.google.common.collect.Lists; | 8 import com.google.common.collect.Lists; |
9 import com.google.common.collect.Maps; | 9 import com.google.common.collect.Maps; |
10 import com.google.common.collect.Sets; | 10 import com.google.common.collect.Sets; |
(...skipping 4776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4787 Type type = typeNode.getType(); | 4787 Type type = typeNode.getType(); |
4788 assertSame(typeA, type); | 4788 assertSame(typeA, type); |
4789 // .named | 4789 // .named |
4790 DartIdentifier nameNode = findNode(DartIdentifier.class, "named;"); | 4790 DartIdentifier nameNode = findNode(DartIdentifier.class, "named;"); |
4791 NodeElement nameElement = nameNode.getElement(); | 4791 NodeElement nameElement = nameNode.getElement(); |
4792 assertNotNull(nameElement); | 4792 assertNotNull(nameElement); |
4793 assertSame(elementA.lookupConstructor("named"), nameElement); | 4793 assertSame(elementA.lookupConstructor("named"), nameElement); |
4794 } | 4794 } |
4795 } | 4795 } |
4796 | 4796 |
| 4797 public void test_redirectingFactoryConstructor_cycle() throws Exception { |
| 4798 AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode( |
| 4799 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 4800 "class A {", |
| 4801 " factory A.nameA() = C.nameC;", |
| 4802 "}", |
| 4803 "class B {", |
| 4804 " factory B.nameB() = A.nameA;", |
| 4805 "}", |
| 4806 "class C {", |
| 4807 " factory C.nameC() = B.nameB;", |
| 4808 "}", |
| 4809 "")); |
| 4810 assertErrors( |
| 4811 libraryResult.getErrors(), |
| 4812 errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_CYCLE, 3, 11, 7), |
| 4813 errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_CYCLE, 6, 11, 7), |
| 4814 errEx(ResolverErrorCode.REDIRECTION_CONSTRUCTOR_CYCLE, 9, 11, 7)); |
| 4815 } |
| 4816 |
4797 public void test_redirectingFactoryConstructor_notConst_fromConst() throws Exc
eption { | 4817 public void test_redirectingFactoryConstructor_notConst_fromConst() throws Exc
eption { |
4798 AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode( | 4818 AnalyzeLibraryResult libraryResult = analyzeLibrary(makeCode( |
4799 "// filler filler filler filler filler filler filler filler filler fille
r", | 4819 "// filler filler filler filler filler filler filler filler filler fille
r", |
4800 "class A {", | 4820 "class A {", |
4801 " A.named() {}", | 4821 " A.named() {}", |
4802 "}", | 4822 "}", |
4803 "", | 4823 "", |
4804 "class B {", | 4824 "class B {", |
4805 " const factory B.bar() = A.named;", | 4825 " const factory B.bar() = A.named;", |
4806 "}", | 4826 "}", |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5314 && index < sourceInfo.getEnd() | 5334 && index < sourceInfo.getEnd() |
5315 && clazz.isInstance(node)) { | 5335 && clazz.isInstance(node)) { |
5316 result.set((T) node); | 5336 result.set((T) node); |
5317 } | 5337 } |
5318 return super.visitNode(node); | 5338 return super.visitNode(node); |
5319 } | 5339 } |
5320 }); | 5340 }); |
5321 return result.get(); | 5341 return result.get(); |
5322 } | 5342 } |
5323 } | 5343 } |
OLD | NEW |