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

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

Issue 1050203002: Begin making copies of AST nodes for constants during resolution. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments and switch to using mixins. 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
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.all_the_rest_test; 8 library engine.all_the_rest_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 924
925 List<InstanceCreationExpression> _findConstructorInvocations() { 925 List<InstanceCreationExpression> _findConstructorInvocations() {
926 ConstantFinder finder = new ConstantFinder(); 926 ConstantFinder finder = new ConstantFinder();
927 _node.accept(finder); 927 _node.accept(finder);
928 List<InstanceCreationExpression> constructorInvocations = 928 List<InstanceCreationExpression> constructorInvocations =
929 finder.constructorInvocations; 929 finder.constructorInvocations;
930 expect(constructorInvocations, isNotNull); 930 expect(constructorInvocations, isNotNull);
931 return constructorInvocations; 931 return constructorInvocations;
932 } 932 }
933 933
934 Map<VariableElement, VariableDeclaration> _findVariableDeclarations() { 934 Map<PotentiallyConstVariableElement, VariableDeclaration> _findVariableDeclara tions() {
935 ConstantFinder finder = new ConstantFinder(); 935 ConstantFinder finder = new ConstantFinder();
936 _node.accept(finder); 936 _node.accept(finder);
937 Map<VariableElement, VariableDeclaration> variableMap = finder.variableMap; 937 Map<PotentiallyConstVariableElement, VariableDeclaration> variableMap =
938 finder.variableMap;
938 expect(variableMap, isNotNull); 939 expect(variableMap, isNotNull);
939 return variableMap; 940 return variableMap;
940 } 941 }
941 942
942 ConstructorElement _setupConstructorDeclaration(String name, bool isConst) { 943 ConstructorElement _setupConstructorDeclaration(String name, bool isConst) {
943 Keyword constKeyword = isConst ? Keyword.CONST : null; 944 Keyword constKeyword = isConst ? Keyword.CONST : null;
944 ConstructorDeclaration constructorDeclaration = AstFactory 945 ConstructorDeclaration constructorDeclaration = AstFactory
945 .constructorDeclaration2(constKeyword, null, null, name, 946 .constructorDeclaration2(constKeyword, null, null, name,
946 AstFactory.formalParameterList(), null, 947 AstFactory.formalParameterList(), null,
947 AstFactory.blockFunctionBody2()); 948 AstFactory.blockFunctionBody2());
(...skipping 6893 matching lines...) Expand 10 before | Expand all | Expand 10 after
7841 @override 7842 @override
7842 SdkLibrary getSdkLibrary(String dartUri) => null; 7843 SdkLibrary getSdkLibrary(String dartUri) => null;
7843 7844
7844 @override 7845 @override
7845 Source mapDartUri(String dartUri) => null; 7846 Source mapDartUri(String dartUri) => null;
7846 } 7847 }
7847 7848
7848 @reflectiveTest 7849 @reflectiveTest
7849 class ReferenceFinderTest extends EngineTestCase { 7850 class ReferenceFinderTest extends EngineTestCase {
7850 DirectedGraph<AstNode> _referenceGraph; 7851 DirectedGraph<AstNode> _referenceGraph;
7851 Map<VariableElement, VariableDeclaration> _variableDeclarationMap; 7852 Map<PotentiallyConstVariableElement, VariableDeclaration> _variableDeclaration Map;
7852 Map<ConstructorElement, ConstructorDeclaration> _constructorDeclarationMap; 7853 Map<ConstructorElement, ConstructorDeclaration> _constructorDeclarationMap;
7853 VariableDeclaration _head; 7854 VariableDeclaration _head;
7854 AstNode _tail; 7855 AstNode _tail;
7855 @override 7856 @override
7856 void setUp() { 7857 void setUp() {
7857 _referenceGraph = new DirectedGraph<AstNode>(); 7858 _referenceGraph = new DirectedGraph<AstNode>();
7858 _variableDeclarationMap = 7859 _variableDeclarationMap =
7859 new HashMap<VariableElement, VariableDeclaration>(); 7860 new HashMap<PotentiallyConstVariableElement, VariableDeclaration>();
7860 _constructorDeclarationMap = 7861 _constructorDeclarationMap =
7861 new HashMap<ConstructorElement, ConstructorDeclaration>(); 7862 new HashMap<ConstructorElement, ConstructorDeclaration>();
7862 _head = AstFactory.variableDeclaration("v1"); 7863 _head = AstFactory.variableDeclaration("v1");
7863 } 7864 }
7864 void test_visitInstanceCreationExpression_const() { 7865 void test_visitInstanceCreationExpression_const() {
7865 _visitNode(_makeTailConstructor("A", true, true, true)); 7866 _visitNode(_makeTailConstructor("A", true, true, true));
7866 _assertOneArc(_tail); 7867 _assertOneArc(_tail);
7867 } 7868 }
7868 void test_visitInstanceCreationExpression_nonConstDeclaration() { 7869 void test_visitInstanceCreationExpression_nonConstDeclaration() {
7869 // In the source: 7870 // In the source:
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
7972 if (inMap) { 7973 if (inMap) {
7973 _constructorDeclarationMap[constructorElement] = constructorDeclaration; 7974 _constructorDeclarationMap[constructorElement] = constructorDeclaration;
7974 } 7975 }
7975 superConstructorInvocation.staticElement = constructorElement; 7976 superConstructorInvocation.staticElement = constructorElement;
7976 return superConstructorInvocation; 7977 return superConstructorInvocation;
7977 } 7978 }
7978 SimpleIdentifier _makeTailVariable(String name, bool isConst, bool inMap) { 7979 SimpleIdentifier _makeTailVariable(String name, bool isConst, bool inMap) {
7979 VariableDeclaration variableDeclaration = 7980 VariableDeclaration variableDeclaration =
7980 AstFactory.variableDeclaration(name); 7981 AstFactory.variableDeclaration(name);
7981 _tail = variableDeclaration; 7982 _tail = variableDeclaration;
7982 VariableElementImpl variableElement = 7983 ConstLocalVariableElementImpl variableElement =
7983 ElementFactory.localVariableElement2(name); 7984 ElementFactory.constLocalVariableElement(name);
7984 variableElement.const3 = isConst; 7985 variableElement.const3 = isConst;
7985 AstFactory.variableDeclarationList2( 7986 AstFactory.variableDeclarationList2(
7986 isConst ? Keyword.CONST : Keyword.VAR, [variableDeclaration]); 7987 isConst ? Keyword.CONST : Keyword.VAR, [variableDeclaration]);
7987 if (inMap) { 7988 if (inMap) {
7988 _variableDeclarationMap[variableElement] = variableDeclaration; 7989 _variableDeclarationMap[variableElement] = variableDeclaration;
7989 } 7990 }
7990 SimpleIdentifier identifier = AstFactory.identifier3(name); 7991 SimpleIdentifier identifier = AstFactory.identifier3(name);
7991 identifier.staticElement = variableElement; 7992 identifier.staticElement = variableElement;
7992 return identifier; 7993 return identifier;
7993 } 7994 }
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
8620 if (_expectedExternalScriptName == null) { 8621 if (_expectedExternalScriptName == null) {
8621 expect(scriptSource, isNull, reason: "script $scriptIndex"); 8622 expect(scriptSource, isNull, reason: "script $scriptIndex");
8622 } else { 8623 } else {
8623 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); 8624 expect(scriptSource, isNotNull, reason: "script $scriptIndex");
8624 String actualExternalScriptName = scriptSource.shortName; 8625 String actualExternalScriptName = scriptSource.shortName;
8625 expect(actualExternalScriptName, _expectedExternalScriptName, 8626 expect(actualExternalScriptName, _expectedExternalScriptName,
8626 reason: "script $scriptIndex"); 8627 reason: "script $scriptIndex");
8627 } 8628 }
8628 } 8629 }
8629 } 8630 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698