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

Side by Side Diff: pkg/analyzer/lib/src/generated/testing/element_factory.dart

Issue 1164223002: Fix several tests when the new task model is enabled (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
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 // 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/scanner.dart';
18 import 'package:analyzer/src/generated/source.dart'; 19 import 'package:analyzer/src/generated/source.dart';
20 import 'package:analyzer/src/generated/testing/ast_factory.dart';
19 import 'package:analyzer/src/generated/utilities_dart.dart'; 21 import 'package:analyzer/src/generated/utilities_dart.dart';
20 import 'package:path/path.dart'; 22 import 'package:path/path.dart';
21 23
22 /** 24 /**
23 * The class `ElementFactory` defines utility methods used to create elements fo r testing 25 * The class `ElementFactory` defines utility methods used to create elements fo r testing
24 * purposes. The elements that are created are complete in the sense that as muc h of the element 26 * purposes. The elements that are created are complete in the sense that as muc h of the element
25 * model as can be created, given the provided information, has been created. 27 * model as can be created, given the provided information, has been created.
26 */ 28 */
27 class ElementFactory { 29 class ElementFactory {
28 /** 30 /**
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 511 }
510 512
511 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) => 513 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) =>
512 new TopLevelVariableElementImpl.forNode(name); 514 new TopLevelVariableElementImpl.forNode(name);
513 515
514 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => 516 static TopLevelVariableElementImpl topLevelVariableElement2(String name) =>
515 topLevelVariableElement3(name, false, false, null); 517 topLevelVariableElement3(name, false, false, null);
516 518
517 static TopLevelVariableElementImpl topLevelVariableElement3( 519 static TopLevelVariableElementImpl topLevelVariableElement3(
518 String name, bool isConst, bool isFinal, DartType type) { 520 String name, bool isConst, bool isFinal, DartType type) {
519 TopLevelVariableElementImpl variable = 521 TopLevelVariableElementImpl variable;
520 new TopLevelVariableElementImpl(name, -1); 522 if (isConst) {
523 ConstTopLevelVariableElementImpl constant =
524 new ConstTopLevelVariableElementImpl(AstFactory.identifier3(name));
525 constant.constantInitializer = AstFactory.instanceCreationExpression2(
526 Keyword.CONST, AstFactory.typeName(type.element));
527 variable = constant;
528 } else {
529 variable = new TopLevelVariableElementImpl(name, -1);
530 }
521 variable.const3 = isConst; 531 variable.const3 = isConst;
522 variable.final2 = isFinal; 532 variable.final2 = isFinal;
523 variable.synthetic = true; 533 variable.synthetic = true;
524 PropertyAccessorElementImpl getter = 534 PropertyAccessorElementImpl getter =
525 new PropertyAccessorElementImpl.forVariable(variable); 535 new PropertyAccessorElementImpl.forVariable(variable);
526 getter.getter = true; 536 getter.getter = true;
527 getter.synthetic = true; 537 getter.synthetic = true;
528 getter.variable = variable; 538 getter.variable = variable;
529 getter.returnType = type; 539 getter.returnType = type;
530 variable.getter = getter; 540 variable.getter = getter;
(...skipping 11 matching lines...) Expand all
542 setter.returnType = VoidTypeImpl.instance; 552 setter.returnType = VoidTypeImpl.instance;
543 setter.type = new FunctionTypeImpl(setter); 553 setter.type = new FunctionTypeImpl(setter);
544 variable.setter = setter; 554 variable.setter = setter;
545 } 555 }
546 return variable; 556 return variable;
547 } 557 }
548 558
549 static TypeParameterElementImpl typeParameterElement(String name) => 559 static TypeParameterElementImpl typeParameterElement(String name) =>
550 new TypeParameterElementImpl(name, 0); 560 new TypeParameterElementImpl(name, 0);
551 } 561 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/generated/testing/test_type_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698