| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.test.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 TestTypeProvider provider = new TestTypeProvider(); | 122 TestTypeProvider provider = new TestTypeProvider(); |
| 123 CompilationUnitElementImpl coreUnit = | 123 CompilationUnitElementImpl coreUnit = |
| 124 new CompilationUnitElementImpl("core.dart"); | 124 new CompilationUnitElementImpl("core.dart"); |
| 125 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 125 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 126 coreContext.setContents(coreSource, ""); | 126 coreContext.setContents(coreSource, ""); |
| 127 coreUnit.librarySource = coreUnit.source = coreSource; | 127 coreUnit.librarySource = coreUnit.source = coreSource; |
| 128 ClassElementImpl proxyClassElement = ElementFactory.classElement2("_Proxy"); | 128 ClassElementImpl proxyClassElement = ElementFactory.classElement2("_Proxy"); |
| 129 proxyClassElement.constructors = <ConstructorElement>[ | 129 proxyClassElement.constructors = <ConstructorElement>[ |
| 130 ElementFactory.constructorElement(proxyClassElement, null, true) | 130 ElementFactory.constructorElement(proxyClassElement, null, true) |
| 131 ..isCycleFree = true | 131 ..isCycleFree = true |
| 132 ..constantInitializers = <ConstructorInitializer>[] |
| 132 ]; | 133 ]; |
| 133 ClassElement objectClassElement = provider.objectType.element; | 134 ClassElement objectClassElement = provider.objectType.element; |
| 134 coreUnit.types = <ClassElement>[ | 135 coreUnit.types = <ClassElement>[ |
| 135 provider.boolType.element, | 136 provider.boolType.element, |
| 136 provider.deprecatedType.element, | 137 provider.deprecatedType.element, |
| 137 provider.doubleType.element, | 138 provider.doubleType.element, |
| 138 provider.functionType.element, | 139 provider.functionType.element, |
| 139 provider.intType.element, | 140 provider.intType.element, |
| 140 provider.iterableType.element, | 141 provider.iterableType.element, |
| 141 provider.iteratorType.element, | 142 provider.iteratorType.element, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 ElementFactory.functionElement3("identical", provider.boolType.element, | 155 ElementFactory.functionElement3("identical", provider.boolType.element, |
| 155 <ClassElement>[objectClassElement, objectClassElement], null), | 156 <ClassElement>[objectClassElement, objectClassElement], null), |
| 156 ElementFactory.functionElement3("print", VoidTypeImpl.instance.element, | 157 ElementFactory.functionElement3("print", VoidTypeImpl.instance.element, |
| 157 <ClassElement>[objectClassElement], null) | 158 <ClassElement>[objectClassElement], null) |
| 158 ]; | 159 ]; |
| 159 TopLevelVariableElement proxyTopLevelVariableElt = ElementFactory | 160 TopLevelVariableElement proxyTopLevelVariableElt = ElementFactory |
| 160 .topLevelVariableElement3("proxy", true, false, proxyClassElement.type); | 161 .topLevelVariableElement3("proxy", true, false, proxyClassElement.type); |
| 161 ConstTopLevelVariableElementImpl deprecatedTopLevelVariableElt = | 162 ConstTopLevelVariableElementImpl deprecatedTopLevelVariableElt = |
| 162 ElementFactory.topLevelVariableElement3( | 163 ElementFactory.topLevelVariableElement3( |
| 163 "deprecated", true, false, provider.deprecatedType); | 164 "deprecated", true, false, provider.deprecatedType); |
| 164 deprecatedTopLevelVariableElt.constantInitializer = AstFactory | 165 { |
| 165 .instanceCreationExpression2( | 166 ClassElement deprecatedElement = provider.deprecatedType.element; |
| 166 Keyword.CONST, | 167 InstanceCreationExpression initializer = AstFactory |
| 167 AstFactory.typeName(provider.deprecatedType.element), | 168 .instanceCreationExpression2( |
| 168 [AstFactory.string2('next release')]); | 169 Keyword.CONST, |
| 170 AstFactory.typeName(deprecatedElement), |
| 171 [AstFactory.string2('next release')]); |
| 172 initializer.staticElement = deprecatedElement.constructors.single; |
| 173 deprecatedTopLevelVariableElt.constantInitializer = initializer; |
| 174 } |
| 169 coreUnit.accessors = <PropertyAccessorElement>[ | 175 coreUnit.accessors = <PropertyAccessorElement>[ |
| 170 proxyTopLevelVariableElt.getter, | 176 proxyTopLevelVariableElt.getter, |
| 171 deprecatedTopLevelVariableElt.getter | 177 deprecatedTopLevelVariableElt.getter |
| 172 ]; | 178 ]; |
| 173 coreUnit.topLevelVariables = <TopLevelVariableElement>[ | 179 coreUnit.topLevelVariables = <TopLevelVariableElement>[ |
| 174 proxyTopLevelVariableElt, | 180 proxyTopLevelVariableElt, |
| 175 deprecatedTopLevelVariableElt | 181 deprecatedTopLevelVariableElt |
| 176 ]; | 182 ]; |
| 177 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode( | 183 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode( |
| 178 coreContext, AstFactory.libraryIdentifier2(["dart", "core"])); | 184 coreContext, AstFactory.libraryIdentifier2(["dart", "core"])); |
| (...skipping 16718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16897 | 16903 |
| 16898 void _resolveTestUnit(String code) { | 16904 void _resolveTestUnit(String code) { |
| 16899 testCode = code; | 16905 testCode = code; |
| 16900 testSource = addSource(testCode); | 16906 testSource = addSource(testCode); |
| 16901 LibraryElement library = resolve2(testSource); | 16907 LibraryElement library = resolve2(testSource); |
| 16902 assertNoErrors(testSource); | 16908 assertNoErrors(testSource); |
| 16903 verify([testSource]); | 16909 verify([testSource]); |
| 16904 testUnit = resolveCompilationUnit(testSource, library); | 16910 testUnit = resolveCompilationUnit(testSource, library); |
| 16905 } | 16911 } |
| 16906 } | 16912 } |
| OLD | NEW |