| 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.element_test; | 8 library engine.element_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } else { | 274 } else { |
| 275 JUnitTestCase.assertSame(prefixB, prefixes[0]); | 275 JUnitTestCase.assertSame(prefixB, prefixes[0]); |
| 276 JUnitTestCase.assertSame(prefixA, prefixes[1]); | 276 JUnitTestCase.assertSame(prefixA, prefixes[1]); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 | 279 |
| 280 void test_getUnits() { | 280 void test_getUnits() { |
| 281 AnalysisContext context = createAnalysisContext(); | 281 AnalysisContext context = createAnalysisContext(); |
| 282 LibraryElementImpl library = ElementFactory.library(context, "test"); | 282 LibraryElementImpl library = ElementFactory.library(context, "test"); |
| 283 CompilationUnitElement unitLib = library.definingCompilationUnit; | 283 CompilationUnitElement unitLib = library.definingCompilationUnit; |
| 284 CompilationUnitElementImpl unitA = ElementFactory.compilationUnit(context, "
unit_a.dart"); | 284 CompilationUnitElementImpl unitA = ElementFactory.compilationUnit("unit_a.da
rt"); |
| 285 CompilationUnitElementImpl unitB = ElementFactory.compilationUnit(context, "
unit_b.dart"); | 285 CompilationUnitElementImpl unitB = ElementFactory.compilationUnit("unit_b.da
rt"); |
| 286 library.parts = <CompilationUnitElement> [unitA, unitB]; | 286 library.parts = <CompilationUnitElement> [unitA, unitB]; |
| 287 EngineTestCase.assertEqualsIgnoreOrder(<CompilationUnitElement> [unitLib, un
itA, unitB], library.units); | 287 EngineTestCase.assertEqualsIgnoreOrder(<CompilationUnitElement> [unitLib, un
itA, unitB], library.units); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void test_getVisibleLibraries_cycle() { | 290 void test_getVisibleLibraries_cycle() { |
| 291 AnalysisContext context = createAnalysisContext(); | 291 AnalysisContext context = createAnalysisContext(); |
| 292 LibraryElementImpl library = ElementFactory.library(context, "app"); | 292 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 293 LibraryElementImpl libraryA = ElementFactory.library(context, "A"); | 293 LibraryElementImpl libraryA = ElementFactory.library(context, "A"); |
| 294 libraryA.imports = <ImportElementImpl> [ElementFactory.importFor(library, nu
ll, [])]; | 294 libraryA.imports = <ImportElementImpl> [ElementFactory.importFor(library, nu
ll, [])]; |
| 295 library.imports = <ImportElementImpl> [ElementFactory.importFor(libraryA, nu
ll, [])]; | 295 library.imports = <ImportElementImpl> [ElementFactory.importFor(libraryA, nu
ll, [])]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } | 341 } |
| 342 | 342 |
| 343 void test_getVisibleLibraries_noImports() { | 343 void test_getVisibleLibraries_noImports() { |
| 344 AnalysisContext context = createAnalysisContext(); | 344 AnalysisContext context = createAnalysisContext(); |
| 345 LibraryElementImpl library = ElementFactory.library(context, "app"); | 345 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 346 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], library.v
isibleLibraries); | 346 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], library.v
isibleLibraries); |
| 347 } | 347 } |
| 348 | 348 |
| 349 void test_isUpToDate() { | 349 void test_isUpToDate() { |
| 350 AnalysisContext context = createAnalysisContext(); | 350 AnalysisContext context = createAnalysisContext(); |
| 351 context.sourceFactory = new SourceFactory.con2([]); | 351 context.sourceFactory = new SourceFactory([]); |
| 352 LibraryElement library = ElementFactory.library(context, "foo"); | 352 LibraryElement library = ElementFactory.library(context, "foo"); |
| 353 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); | 353 context.setContents(library.definingCompilationUnit.source, "sdfsdff"); |
| 354 // Assert that we are not up to date if the target has an old time stamp. | 354 // Assert that we are not up to date if the target has an old time stamp. |
| 355 JUnitTestCase.assertFalse(library.isUpToDate2(0)); | 355 JUnitTestCase.assertFalse(library.isUpToDate2(0)); |
| 356 // Assert that we are up to date with a target modification time in the futu
re. | 356 // Assert that we are up to date with a target modification time in the futu
re. |
| 357 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); | 357 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void test_setImports() { | 360 void test_setImports() { |
| 361 AnalysisContext context = createAnalysisContext(); | 361 AnalysisContext context = createAnalysisContext(); |
| 362 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); | 362 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); |
| 363 List<ImportElementImpl> expectedImports = [ | 363 List<ImportElementImpl> expectedImports = [ |
| (...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 typeParameter.type = typeParameterTypes[i]; | 2479 typeParameter.type = typeParameterTypes[i]; |
| 2480 } | 2480 } |
| 2481 element.typeParameters = typeParameters; | 2481 element.typeParameters = typeParameters; |
| 2482 type.typeArguments = typeParameterTypes; | 2482 type.typeArguments = typeParameterTypes; |
| 2483 } | 2483 } |
| 2484 return element; | 2484 return element; |
| 2485 } | 2485 } |
| 2486 | 2486 |
| 2487 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); | 2487 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); |
| 2488 | 2488 |
| 2489 static CompilationUnitElementImpl compilationUnit(AnalysisContext context, Str
ing fileName) { | 2489 static CompilationUnitElementImpl compilationUnit(String fileName) { |
| 2490 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont
entCache, FileUtilities2.createFile(fileName)); | 2490 FileBasedSource source = new FileBasedSource.con1(FileUtilities2.createFile(
fileName)); |
| 2491 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); | 2491 CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName); |
| 2492 unit.source = source; | 2492 unit.source = source; |
| 2493 return unit; | 2493 return unit; |
| 2494 } | 2494 } |
| 2495 | 2495 |
| 2496 static ConstructorElementImpl constructorElement(ClassElement definingClass, S
tring name, bool isConst, List<Type2> argumentTypes) { | 2496 static ConstructorElementImpl constructorElement(ClassElement definingClass, S
tring name, bool isConst, List<Type2> argumentTypes) { |
| 2497 Type2 type = definingClass.type; | 2497 Type2 type = definingClass.type; |
| 2498 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null : ASTFactory.identifier3(name)); | 2498 ConstructorElementImpl constructor = new ConstructorElementImpl.con1(name ==
null ? null : ASTFactory.identifier3(name)); |
| 2499 constructor.const2 = isConst; | 2499 constructor.const2 = isConst; |
| 2500 int count = argumentTypes.length; | 2500 int count = argumentTypes.length; |
| 2501 List<ParameterElement> parameters = new List<ParameterElement>(count); | 2501 List<ParameterElement> parameters = new List<ParameterElement>(count); |
| 2502 for (int i = 0; i < count; i++) { | 2502 for (int i = 0; i < count; i++) { |
| 2503 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); | 2503 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); |
| 2504 parameter.type = argumentTypes[i]; | 2504 parameter.type = argumentTypes[i]; |
| 2505 parameter.parameterKind = ParameterKind.REQUIRED; | 2505 parameter.parameterKind = ParameterKind.REQUIRED; |
| 2506 parameters[i] = parameter; | 2506 parameters[i] = parameter; |
| 2507 } | 2507 } |
| 2508 constructor.parameters = parameters; | 2508 constructor.parameters = parameters; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2647 getter.static = isStatic; | 2647 getter.static = isStatic; |
| 2648 getter.variable = field; | 2648 getter.variable = field; |
| 2649 getter.returnType = type; | 2649 getter.returnType = type; |
| 2650 field.getter = getter; | 2650 field.getter = getter; |
| 2651 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 2651 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
| 2652 getter.type = getterType; | 2652 getter.type = getterType; |
| 2653 return getter; | 2653 return getter; |
| 2654 } | 2654 } |
| 2655 | 2655 |
| 2656 static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) { | 2656 static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) { |
| 2657 FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.cont
entCache, FileUtilities2.createFile(fileName)); | 2657 FileBasedSource source = new FileBasedSource.con1(FileUtilities2.createFile(
fileName)); |
| 2658 HtmlElementImpl unit = new HtmlElementImpl(context, fileName); | 2658 HtmlElementImpl unit = new HtmlElementImpl(context, fileName); |
| 2659 unit.source = source; | 2659 unit.source = source; |
| 2660 return unit; | 2660 return unit; |
| 2661 } | 2661 } |
| 2662 | 2662 |
| 2663 static ImportElementImpl importFor(LibraryElement importedLibrary, PrefixEleme
nt prefix, List<NamespaceCombinator> combinators) { | 2663 static ImportElementImpl importFor(LibraryElement importedLibrary, PrefixEleme
nt prefix, List<NamespaceCombinator> combinators) { |
| 2664 ImportElementImpl spec = new ImportElementImpl(0); | 2664 ImportElementImpl spec = new ImportElementImpl(0); |
| 2665 spec.importedLibrary = importedLibrary; | 2665 spec.importedLibrary = importedLibrary; |
| 2666 spec.prefix = prefix; | 2666 spec.prefix = prefix; |
| 2667 spec.combinators = combinators; | 2667 spec.combinators = combinators; |
| 2668 return spec; | 2668 return spec; |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 static LibraryElementImpl library(AnalysisContext context, String libraryName)
{ | 2671 static LibraryElementImpl library(AnalysisContext context, String libraryName)
{ |
| 2672 String fileName = "/${libraryName}.dart"; | 2672 String fileName = "/${libraryName}.dart"; |
| 2673 CompilationUnitElementImpl unit = compilationUnit(context, fileName); | 2673 CompilationUnitElementImpl unit = compilationUnit(fileName); |
| 2674 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2([libraryName])); | 2674 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2([libraryName])); |
| 2675 library.definingCompilationUnit = unit; | 2675 library.definingCompilationUnit = unit; |
| 2676 return library; | 2676 return library; |
| 2677 } | 2677 } |
| 2678 | 2678 |
| 2679 static LocalVariableElementImpl localVariableElement(Identifier name) => new L
ocalVariableElementImpl(name); | 2679 static LocalVariableElementImpl localVariableElement(Identifier name) => new L
ocalVariableElementImpl(name); |
| 2680 | 2680 |
| 2681 static LocalVariableElementImpl localVariableElement2(String name) => new Loca
lVariableElementImpl(ASTFactory.identifier3(name)); | 2681 static LocalVariableElementImpl localVariableElement2(String name) => new Loca
lVariableElementImpl(ASTFactory.identifier3(name)); |
| 2682 | 2682 |
| 2683 static MethodElementImpl methodElement(String methodName, Type2 returnType, Li
st<Type2> argumentTypes) { | 2683 static MethodElementImpl methodElement(String methodName, Type2 returnType, Li
st<Type2> argumentTypes) { |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3987 InterfaceTypeImplTest.dartSuite(); | 3987 InterfaceTypeImplTest.dartSuite(); |
| 3988 TypeParameterTypeImplTest.dartSuite(); | 3988 TypeParameterTypeImplTest.dartSuite(); |
| 3989 VoidTypeImplTest.dartSuite(); | 3989 VoidTypeImplTest.dartSuite(); |
| 3990 ClassElementImplTest.dartSuite(); | 3990 ClassElementImplTest.dartSuite(); |
| 3991 ElementLocationImplTest.dartSuite(); | 3991 ElementLocationImplTest.dartSuite(); |
| 3992 ElementImplTest.dartSuite(); | 3992 ElementImplTest.dartSuite(); |
| 3993 HtmlElementImplTest.dartSuite(); | 3993 HtmlElementImplTest.dartSuite(); |
| 3994 LibraryElementImplTest.dartSuite(); | 3994 LibraryElementImplTest.dartSuite(); |
| 3995 MultiplyDefinedElementImplTest.dartSuite(); | 3995 MultiplyDefinedElementImplTest.dartSuite(); |
| 3996 } | 3996 } |
| OLD | NEW |