| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.testing.element_factory; | 8 library engine.testing.element_factory; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| 11 | 11 |
| 12 import 'package:analyzer/src/generated/ast.dart'; | 12 import 'package:analyzer/src/generated/ast.dart'; |
| 13 import 'package:analyzer/src/generated/constant.dart'; | 13 import 'package:analyzer/src/generated/constant.dart'; |
| 14 import 'package:analyzer/src/generated/element.dart'; | 14 import 'package:analyzer/src/generated/element.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/java_core.dart'; | 16 import 'package:analyzer/src/generated/java_core.dart'; |
| 17 import 'package:analyzer/src/generated/resolver.dart'; | 17 import 'package:analyzer/src/generated/resolver.dart'; |
| 18 import 'package:analyzer/src/generated/source.dart'; | 18 import 'package:analyzer/src/generated/source.dart'; |
| 19 import 'package:analyzer/src/generated/utilities_dart.dart'; | 19 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 20 import 'package:path/path.dart'; |
| 20 | 21 |
| 21 /** | 22 /** |
| 22 * The class `ElementFactory` defines utility methods used to create elements fo
r testing | 23 * The class `ElementFactory` defines utility methods used to create elements fo
r testing |
| 23 * purposes. The elements that are created are complete in the sense that as muc
h of the element | 24 * purposes. The elements that are created are complete in the sense that as muc
h of the element |
| 24 * model as can be created, given the provided information, has been created. | 25 * model as can be created, given the provided information, has been created. |
| 25 */ | 26 */ |
| 26 class ElementFactory { | 27 class ElementFactory { |
| 27 /** | 28 /** |
| 28 * The element representing the class 'Object'. | 29 * The element representing the class 'Object'. |
| 29 */ | 30 */ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 element.typedef = true; | 78 element.typedef = true; |
| 78 return element; | 79 return element; |
| 79 } | 80 } |
| 80 | 81 |
| 81 static ClassElementImpl classTypeAlias2(String typeName, | 82 static ClassElementImpl classTypeAlias2(String typeName, |
| 82 [List<String> parameterNames]) => | 83 [List<String> parameterNames]) => |
| 83 classTypeAlias(typeName, objectType, parameterNames); | 84 classTypeAlias(typeName, objectType, parameterNames); |
| 84 | 85 |
| 85 static CompilationUnitElementImpl compilationUnit(String fileName, | 86 static CompilationUnitElementImpl compilationUnit(String fileName, |
| 86 [Source librarySource]) { | 87 [Source librarySource]) { |
| 87 Source source = new NonExistingSource(fileName, UriKind.FILE_URI); | 88 Source source = |
| 89 new NonExistingSource(fileName, toUri(fileName), UriKind.FILE_URI); |
| 88 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); | 90 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); |
| 89 unit.source = source; | 91 unit.source = source; |
| 90 if (librarySource == null) { | 92 if (librarySource == null) { |
| 91 librarySource = source; | 93 librarySource = source; |
| 92 } | 94 } |
| 93 unit.librarySource = librarySource; | 95 unit.librarySource = librarySource; |
| 94 return unit; | 96 return unit; |
| 95 } | 97 } |
| 96 | 98 |
| 97 static ConstLocalVariableElementImpl constLocalVariableElement(String name) => | 99 static ConstLocalVariableElementImpl constLocalVariableElement(String name) => |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 getter.getter = true; | 357 getter.getter = true; |
| 356 getter.variable = field; | 358 getter.variable = field; |
| 357 getter.returnType = type; | 359 getter.returnType = type; |
| 358 field.getter = getter; | 360 field.getter = getter; |
| 359 FunctionTypeImpl getterType = new FunctionTypeImpl(getter); | 361 FunctionTypeImpl getterType = new FunctionTypeImpl(getter); |
| 360 getter.type = getterType; | 362 getter.type = getterType; |
| 361 return getter; | 363 return getter; |
| 362 } | 364 } |
| 363 | 365 |
| 364 static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) { | 366 static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) { |
| 365 Source source = new NonExistingSource(fileName, UriKind.FILE_URI); | 367 Source source = |
| 368 new NonExistingSource(fileName, toUri(fileName), UriKind.FILE_URI); |
| 366 HtmlElementImpl unit = new HtmlElementImpl(context, fileName); | 369 HtmlElementImpl unit = new HtmlElementImpl(context, fileName); |
| 367 unit.source = source; | 370 unit.source = source; |
| 368 return unit; | 371 return unit; |
| 369 } | 372 } |
| 370 | 373 |
| 371 static ImportElementImpl importFor( | 374 static ImportElementImpl importFor( |
| 372 LibraryElement importedLibrary, PrefixElement prefix, | 375 LibraryElement importedLibrary, PrefixElement prefix, |
| 373 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST])
{ | 376 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST])
{ |
| 374 ImportElementImpl spec = new ImportElementImpl(0); | 377 ImportElementImpl spec = new ImportElementImpl(0); |
| 375 spec.importedLibrary = importedLibrary; | 378 spec.importedLibrary = importedLibrary; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 setter.variable = variable; | 531 setter.variable = variable; |
| 529 setter.parameters = | 532 setter.parameters = |
| 530 <ParameterElement>[requiredParameter2("_$name", type)]; | 533 <ParameterElement>[requiredParameter2("_$name", type)]; |
| 531 setter.returnType = VoidTypeImpl.instance; | 534 setter.returnType = VoidTypeImpl.instance; |
| 532 setter.type = new FunctionTypeImpl(setter); | 535 setter.type = new FunctionTypeImpl(setter); |
| 533 variable.setter = setter; | 536 variable.setter = setter; |
| 534 } | 537 } |
| 535 return variable; | 538 return variable; |
| 536 } | 539 } |
| 537 } | 540 } |
| OLD | NEW |