Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1061993003: Rename EMPTY_ARRAY to EMPTY_LIST in element model (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/testing/element_factory.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 engine.resolver_test; 5 library engine.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 context2dElement, 266 context2dElement,
267 ElementFactory.classElement("DivElement", elementType), 267 ElementFactory.classElement("DivElement", elementType),
268 documentElement, 268 documentElement,
269 elementElement, 269 elementElement,
270 htmlDocumentElement, 270 htmlDocumentElement,
271 ElementFactory.classElement("InputElement", elementType), 271 ElementFactory.classElement("InputElement", elementType),
272 ElementFactory.classElement("SelectElement", elementType) 272 ElementFactory.classElement("SelectElement", elementType)
273 ]; 273 ];
274 htmlUnit.functions = <FunctionElement>[ 274 htmlUnit.functions = <FunctionElement>[
275 ElementFactory.functionElement3("query", elementElement, 275 ElementFactory.functionElement3("query", elementElement,
276 <ClassElement>[provider.stringType.element], 276 <ClassElement>[provider.stringType.element], ClassElement.EMPTY_LIST)
277 ClassElementImpl.EMPTY_ARRAY)
278 ]; 277 ];
279 TopLevelVariableElementImpl document = ElementFactory 278 TopLevelVariableElementImpl document = ElementFactory
280 .topLevelVariableElement3( 279 .topLevelVariableElement3(
281 "document", false, true, htmlDocumentElement.type); 280 "document", false, true, htmlDocumentElement.type);
282 htmlUnit.topLevelVariables = <TopLevelVariableElement>[document]; 281 htmlUnit.topLevelVariables = <TopLevelVariableElement>[document];
283 htmlUnit.accessors = <PropertyAccessorElement>[document.getter]; 282 htmlUnit.accessors = <PropertyAccessorElement>[document.getter];
284 LibraryElementImpl htmlLibrary = new LibraryElementImpl.forNode( 283 LibraryElementImpl htmlLibrary = new LibraryElementImpl.forNode(
285 coreContext, AstFactory.libraryIdentifier2(["dart", "dom", "html"])); 284 coreContext, AstFactory.libraryIdentifier2(["dart", "dom", "html"]));
286 htmlLibrary.definingCompilationUnit = htmlUnit; 285 htmlLibrary.definingCompilationUnit = htmlUnit;
287 // 286 //
288 // dart:math 287 // dart:math
289 // 288 //
290 CompilationUnitElementImpl mathUnit = 289 CompilationUnitElementImpl mathUnit =
291 new CompilationUnitElementImpl("math.dart"); 290 new CompilationUnitElementImpl("math.dart");
292 Source mathSource = sourceFactory.forUri(_DART_MATH); 291 Source mathSource = sourceFactory.forUri(_DART_MATH);
293 coreContext.setContents(mathSource, ""); 292 coreContext.setContents(mathSource, "");
294 mathUnit.source = mathSource; 293 mathUnit.source = mathSource;
295 FunctionElement cosElement = ElementFactory.functionElement3("cos", 294 FunctionElement cosElement = ElementFactory.functionElement3("cos",
296 provider.doubleType.element, <ClassElement>[provider.numType.element], 295 provider.doubleType.element, <ClassElement>[provider.numType.element],
297 ClassElementImpl.EMPTY_ARRAY); 296 ClassElement.EMPTY_LIST);
298 TopLevelVariableElement ln10Element = ElementFactory 297 TopLevelVariableElement ln10Element = ElementFactory
299 .topLevelVariableElement3("LN10", true, false, provider.doubleType); 298 .topLevelVariableElement3("LN10", true, false, provider.doubleType);
300 TopLevelVariableElement piElement = ElementFactory.topLevelVariableElement3( 299 TopLevelVariableElement piElement = ElementFactory.topLevelVariableElement3(
301 "PI", true, false, provider.doubleType); 300 "PI", true, false, provider.doubleType);
302 ClassElementImpl randomElement = ElementFactory.classElement2("Random"); 301 ClassElementImpl randomElement = ElementFactory.classElement2("Random");
303 randomElement.abstract = true; 302 randomElement.abstract = true;
304 ConstructorElementImpl randomConstructor = 303 ConstructorElementImpl randomConstructor =
305 ElementFactory.constructorElement2(randomElement, null); 304 ElementFactory.constructorElement2(randomElement, null);
306 randomConstructor.factory = true; 305 randomConstructor.factory = true;
307 ParameterElementImpl seedParam = new ParameterElementImpl("seed", 0); 306 ParameterElementImpl seedParam = new ParameterElementImpl("seed", 0);
308 seedParam.parameterKind = ParameterKind.POSITIONAL; 307 seedParam.parameterKind = ParameterKind.POSITIONAL;
309 seedParam.type = provider.intType; 308 seedParam.type = provider.intType;
310 randomConstructor.parameters = <ParameterElement>[seedParam]; 309 randomConstructor.parameters = <ParameterElement>[seedParam];
311 randomElement.constructors = <ConstructorElement>[randomConstructor]; 310 randomElement.constructors = <ConstructorElement>[randomConstructor];
312 FunctionElement sinElement = ElementFactory.functionElement3("sin", 311 FunctionElement sinElement = ElementFactory.functionElement3("sin",
313 provider.doubleType.element, <ClassElement>[provider.numType.element], 312 provider.doubleType.element, <ClassElement>[provider.numType.element],
314 ClassElementImpl.EMPTY_ARRAY); 313 ClassElement.EMPTY_LIST);
315 FunctionElement sqrtElement = ElementFactory.functionElement3("sqrt", 314 FunctionElement sqrtElement = ElementFactory.functionElement3("sqrt",
316 provider.doubleType.element, <ClassElement>[provider.numType.element], 315 provider.doubleType.element, <ClassElement>[provider.numType.element],
317 ClassElementImpl.EMPTY_ARRAY); 316 ClassElement.EMPTY_LIST);
318 mathUnit.accessors = <PropertyAccessorElement>[ 317 mathUnit.accessors = <PropertyAccessorElement>[
319 ln10Element.getter, 318 ln10Element.getter,
320 piElement.getter 319 piElement.getter
321 ]; 320 ];
322 mathUnit.functions = <FunctionElement>[cosElement, sinElement, sqrtElement]; 321 mathUnit.functions = <FunctionElement>[cosElement, sinElement, sqrtElement];
323 mathUnit.topLevelVariables = <TopLevelVariableElement>[ 322 mathUnit.topLevelVariables = <TopLevelVariableElement>[
324 ln10Element, 323 ln10Element,
325 piElement 324 piElement
326 ]; 325 ];
327 mathUnit.types = <ClassElement>[randomElement]; 326 mathUnit.types = <ClassElement>[randomElement];
(...skipping 7416 matching lines...) Expand 10 before | Expand all | Expand 10 after
7744 * Create a library element that represents a library with the given name cont aining a single 7743 * Create a library element that represents a library with the given name cont aining a single
7745 * empty compilation unit. 7744 * empty compilation unit.
7746 * 7745 *
7747 * @param libraryName the name of the library to be created 7746 * @param libraryName the name of the library to be created
7748 * @return the library element that was created 7747 * @return the library element that was created
7749 */ 7748 */
7750 LibraryElementImpl createTestLibrary( 7749 LibraryElementImpl createTestLibrary(
7751 AnalysisContext context, String libraryName, [List<String> typeNames]) { 7750 AnalysisContext context, String libraryName, [List<String> typeNames]) {
7752 List<CompilationUnitElement> sourcedCompilationUnits; 7751 List<CompilationUnitElement> sourcedCompilationUnits;
7753 if (typeNames == null) { 7752 if (typeNames == null) {
7754 sourcedCompilationUnits = CompilationUnitElementImpl.EMPTY_ARRAY; 7753 sourcedCompilationUnits = CompilationUnitElement.EMPTY_LIST;
7755 } else { 7754 } else {
7756 int count = typeNames.length; 7755 int count = typeNames.length;
7757 sourcedCompilationUnits = new List<CompilationUnitElement>(count); 7756 sourcedCompilationUnits = new List<CompilationUnitElement>(count);
7758 for (int i = 0; i < count; i++) { 7757 for (int i = 0; i < count; i++) {
7759 String typeName = typeNames[i]; 7758 String typeName = typeNames[i];
7760 ClassElementImpl type = 7759 ClassElementImpl type =
7761 new ClassElementImpl.forNode(AstFactory.identifier3(typeName)); 7760 new ClassElementImpl.forNode(AstFactory.identifier3(typeName));
7762 String fileName = "$typeName.dart"; 7761 String fileName = "$typeName.dart";
7763 CompilationUnitElementImpl compilationUnit = 7762 CompilationUnitElementImpl compilationUnit =
7764 new CompilationUnitElementImpl(fileName); 7763 new CompilationUnitElementImpl(fileName);
(...skipping 5993 matching lines...) Expand 10 before | Expand all | Expand 10 after
13758 // check propagated type 13757 // check propagated type
13759 FunctionType propagatedType = node.propagatedType as FunctionType; 13758 FunctionType propagatedType = node.propagatedType as FunctionType;
13760 expect(propagatedType.returnType, test.typeProvider.stringType); 13759 expect(propagatedType.returnType, test.typeProvider.stringType);
13761 } on AnalysisException catch (e, stackTrace) { 13760 } on AnalysisException catch (e, stackTrace) {
13762 thrownException[0] = new CaughtException(e, stackTrace); 13761 thrownException[0] = new CaughtException(e, stackTrace);
13763 } 13762 }
13764 } 13763 }
13765 return null; 13764 return null;
13766 } 13765 }
13767 } 13766 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/testing/element_factory.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698