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

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

Issue 1602203004: Serialize constant initializers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 library analyzer.test.generated.resolver_test; 5 library analyzer.test.generated.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ElementFactory.functionElement3("identical", provider.boolType.element, 153 ElementFactory.functionElement3("identical", provider.boolType.element,
154 <ClassElement>[objectClassElement, objectClassElement], null), 154 <ClassElement>[objectClassElement, objectClassElement], null),
155 ElementFactory.functionElement3("print", VoidTypeImpl.instance.element, 155 ElementFactory.functionElement3("print", VoidTypeImpl.instance.element,
156 <ClassElement>[objectClassElement], null) 156 <ClassElement>[objectClassElement], null)
157 ]; 157 ];
158 TopLevelVariableElement proxyTopLevelVariableElt = ElementFactory 158 TopLevelVariableElement proxyTopLevelVariableElt = ElementFactory
159 .topLevelVariableElement3("proxy", true, false, proxyClassElement.type); 159 .topLevelVariableElement3("proxy", true, false, proxyClassElement.type);
160 ConstTopLevelVariableElementImpl deprecatedTopLevelVariableElt = 160 ConstTopLevelVariableElementImpl deprecatedTopLevelVariableElt =
161 ElementFactory.topLevelVariableElement3( 161 ElementFactory.topLevelVariableElement3(
162 "deprecated", true, false, provider.deprecatedType); 162 "deprecated", true, false, provider.deprecatedType);
163 deprecatedTopLevelVariableElt.constantInitializer = AstFactory 163 {
164 .instanceCreationExpression2( 164 ClassElement deprecatedElement = provider.deprecatedType.element;
165 Keyword.CONST, 165 InstanceCreationExpression initializer = AstFactory
166 AstFactory.typeName(provider.deprecatedType.element), 166 .instanceCreationExpression2(
167 [AstFactory.string2('next release')]); 167 Keyword.CONST,
168 AstFactory.typeName(deprecatedElement),
169 [AstFactory.string2('next release')]);
170 initializer.staticElement = deprecatedElement.constructors.single;
171 deprecatedTopLevelVariableElt.constantInitializer = initializer;
172 }
168 coreUnit.accessors = <PropertyAccessorElement>[ 173 coreUnit.accessors = <PropertyAccessorElement>[
169 proxyTopLevelVariableElt.getter, 174 proxyTopLevelVariableElt.getter,
170 deprecatedTopLevelVariableElt.getter 175 deprecatedTopLevelVariableElt.getter
171 ]; 176 ];
172 coreUnit.topLevelVariables = <TopLevelVariableElement>[ 177 coreUnit.topLevelVariables = <TopLevelVariableElement>[
173 proxyTopLevelVariableElt, 178 proxyTopLevelVariableElt,
174 deprecatedTopLevelVariableElt 179 deprecatedTopLevelVariableElt
175 ]; 180 ];
176 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode( 181 LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode(
177 coreContext, AstFactory.libraryIdentifier2(["dart", "core"])); 182 coreContext, AstFactory.libraryIdentifier2(["dart", "core"]));
(...skipping 16718 matching lines...) Expand 10 before | Expand all | Expand 10 after
16896 16901
16897 void _resolveTestUnit(String code) { 16902 void _resolveTestUnit(String code) {
16898 testCode = code; 16903 testCode = code;
16899 testSource = addSource(testCode); 16904 testSource = addSource(testCode);
16900 LibraryElement library = resolve2(testSource); 16905 LibraryElement library = resolve2(testSource);
16901 assertNoErrors(testSource); 16906 assertNoErrors(testSource);
16902 verify([testSource]); 16907 verify([testSource]);
16903 testUnit = resolveCompilationUnit(testSource, library); 16908 testUnit = resolveCompilationUnit(testSource, library);
16904 } 16909 }
16905 } 16910 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698