| 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'; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 // | 182 // |
| 183 // Finish building the enum. | 183 // Finish building the enum. |
| 184 // | 184 // |
| 185 enumElement.fields = fields; | 185 enumElement.fields = fields; |
| 186 // Client code isn't allowed to invoke the constructor, so we do not model i
t. | 186 // Client code isn't allowed to invoke the constructor, so we do not model i
t. |
| 187 return enumElement; | 187 return enumElement; |
| 188 } | 188 } |
| 189 | 189 |
| 190 static ExportElementImpl exportFor(LibraryElement exportedLibrary, | 190 static ExportElementImpl exportFor(LibraryElement exportedLibrary, |
| 191 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY])
{ | 191 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST])
{ |
| 192 ExportElementImpl spec = new ExportElementImpl(-1); | 192 ExportElementImpl spec = new ExportElementImpl(-1); |
| 193 spec.exportedLibrary = exportedLibrary; | 193 spec.exportedLibrary = exportedLibrary; |
| 194 spec.combinators = combinators; | 194 spec.combinators = combinators; |
| 195 return spec; | 195 return spec; |
| 196 } | 196 } |
| 197 | 197 |
| 198 static FieldElementImpl fieldElement( | 198 static FieldElementImpl fieldElement( |
| 199 String name, bool isStatic, bool isFinal, bool isConst, DartType type) { | 199 String name, bool isStatic, bool isFinal, bool isConst, DartType type) { |
| 200 FieldElementImpl field = new FieldElementImpl(name, 0); | 200 FieldElementImpl field = new FieldElementImpl(name, 0); |
| 201 field.const3 = isConst; | 201 field.const3 = isConst; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) { | 359 static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) { |
| 360 Source source = new NonExistingSource(fileName, UriKind.FILE_URI); | 360 Source source = new NonExistingSource(fileName, UriKind.FILE_URI); |
| 361 HtmlElementImpl unit = new HtmlElementImpl(context, fileName); | 361 HtmlElementImpl unit = new HtmlElementImpl(context, fileName); |
| 362 unit.source = source; | 362 unit.source = source; |
| 363 return unit; | 363 return unit; |
| 364 } | 364 } |
| 365 | 365 |
| 366 static ImportElementImpl importFor( | 366 static ImportElementImpl importFor( |
| 367 LibraryElement importedLibrary, PrefixElement prefix, | 367 LibraryElement importedLibrary, PrefixElement prefix, |
| 368 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY])
{ | 368 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_LIST])
{ |
| 369 ImportElementImpl spec = new ImportElementImpl(0); | 369 ImportElementImpl spec = new ImportElementImpl(0); |
| 370 spec.importedLibrary = importedLibrary; | 370 spec.importedLibrary = importedLibrary; |
| 371 spec.prefix = prefix; | 371 spec.prefix = prefix; |
| 372 spec.combinators = combinators; | 372 spec.combinators = combinators; |
| 373 return spec; | 373 return spec; |
| 374 } | 374 } |
| 375 | 375 |
| 376 static LibraryElementImpl library( | 376 static LibraryElementImpl library( |
| 377 AnalysisContext context, String libraryName) { | 377 AnalysisContext context, String libraryName) { |
| 378 String fileName = "/$libraryName.dart"; | 378 String fileName = "/$libraryName.dart"; |
| 379 CompilationUnitElementImpl unit = compilationUnit(fileName); | 379 CompilationUnitElementImpl unit = compilationUnit(fileName); |
| 380 LibraryElementImpl library = | 380 LibraryElementImpl library = |
| 381 new LibraryElementImpl(context, libraryName, 0); | 381 new LibraryElementImpl(context, libraryName, 0); |
| 382 library.definingCompilationUnit = unit; | 382 library.definingCompilationUnit = unit; |
| 383 return library; | 383 return library; |
| 384 } | 384 } |
| 385 | 385 |
| 386 static LocalVariableElementImpl localVariableElement(Identifier name) => | 386 static LocalVariableElementImpl localVariableElement(Identifier name) => |
| 387 new LocalVariableElementImpl.forNode(name); | 387 new LocalVariableElementImpl.forNode(name); |
| 388 | 388 |
| 389 static LocalVariableElementImpl localVariableElement2(String name) => | 389 static LocalVariableElementImpl localVariableElement2(String name) => |
| 390 new LocalVariableElementImpl(name, 0); | 390 new LocalVariableElementImpl(name, 0); |
| 391 | 391 |
| 392 static MethodElementImpl methodElement(String methodName, DartType returnType, | 392 static MethodElementImpl methodElement(String methodName, DartType returnType, |
| 393 [List<DartType> argumentTypes]) { | 393 [List<DartType> argumentTypes]) { |
| 394 MethodElementImpl method = new MethodElementImpl(methodName, 0); | 394 MethodElementImpl method = new MethodElementImpl(methodName, 0); |
| 395 if (argumentTypes == null) { | 395 if (argumentTypes == null) { |
| 396 method.parameters = ParameterElementImpl.EMPTY_ARRAY; | 396 method.parameters = ParameterElement.EMPTY_LIST; |
| 397 } else { | 397 } else { |
| 398 int count = argumentTypes.length; | 398 int count = argumentTypes.length; |
| 399 List<ParameterElement> parameters = new List<ParameterElement>(count); | 399 List<ParameterElement> parameters = new List<ParameterElement>(count); |
| 400 for (int i = 0; i < count; i++) { | 400 for (int i = 0; i < count; i++) { |
| 401 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); | 401 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); |
| 402 parameter.type = argumentTypes[i]; | 402 parameter.type = argumentTypes[i]; |
| 403 parameter.parameterKind = ParameterKind.REQUIRED; | 403 parameter.parameterKind = ParameterKind.REQUIRED; |
| 404 parameters[i] = parameter; | 404 parameters[i] = parameter; |
| 405 } | 405 } |
| 406 method.parameters = parameters; | 406 method.parameters = parameters; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 setter.variable = variable; | 523 setter.variable = variable; |
| 524 setter.parameters = | 524 setter.parameters = |
| 525 <ParameterElement>[requiredParameter2("_$name", type)]; | 525 <ParameterElement>[requiredParameter2("_$name", type)]; |
| 526 setter.returnType = VoidTypeImpl.instance; | 526 setter.returnType = VoidTypeImpl.instance; |
| 527 setter.type = new FunctionTypeImpl.con1(setter); | 527 setter.type = new FunctionTypeImpl.con1(setter); |
| 528 variable.setter = setter; | 528 variable.setter = setter; |
| 529 } | 529 } |
| 530 return variable; | 530 return variable; |
| 531 } | 531 } |
| 532 } | 532 } |
| OLD | NEW |