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

Side by Side Diff: packages/analyzer/lib/src/generated/sdk.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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 engine.sdk; 5 library engine.sdk;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'ast.dart'; 9 import 'ast.dart';
10 import 'engine.dart' show AnalysisContext; 10 import 'engine.dart' show AnalysisContext;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 /** 138 /**
139 * The name of the optional parameter used to indicate whether the library is 139 * The name of the optional parameter used to indicate whether the library is
140 * documented. 140 * documented.
141 */ 141 */
142 static String _DOCUMENTED = "documented"; 142 static String _DOCUMENTED = "documented";
143 143
144 /** 144 /**
145 * The name of the optional parameter used to specify the category of the 145 * The name of the optional parameter used to specify the category of the
146 * library. 146 * library.
147 */ 147 */
148 static String _CATEGORY = "category"; 148 static String _CATEGORIES = "categories";
149 149
150 /** 150 /**
151 * The name of the optional parameter used to specify the platforms on which 151 * The name of the optional parameter used to specify the platforms on which
152 * the library can be used. 152 * the library can be used.
153 */ 153 */
154 static String _PLATFORMS = "platforms"; 154 static String _PLATFORMS = "platforms";
155 155
156 /** 156 /**
157 * The value of the [PLATFORMS] parameter used to specify that the library can 157 * The value of the [PLATFORMS] parameter used to specify that the library can
158 * be used on the VM. 158 * be used on the VM.
(...skipping 17 matching lines...) Expand all
176 * [_useDart2jsPaths] is `true`. 176 * [_useDart2jsPaths] is `true`.
177 */ 177 */
178 SdkLibrariesReader_LibraryBuilder(this._useDart2jsPaths); 178 SdkLibrariesReader_LibraryBuilder(this._useDart2jsPaths);
179 179
180 /** 180 /**
181 * Return the library map that was populated by visiting the AST structure 181 * Return the library map that was populated by visiting the AST structure
182 * parsed from the contents of the libraries file. 182 * parsed from the contents of the libraries file.
183 */ 183 */
184 LibraryMap get librariesMap => _librariesMap; 184 LibraryMap get librariesMap => _librariesMap;
185 185
186
187 // To be backwards-compatible the new categories field is translated to
188 // an old approximation.
189 String convertCategories(String categories) {
190 switch (categories) {
191 case "": return "Internal";
192 case "Client": return "Client";
193 case "Server": return "Server";
194 case "Client,Server": return "Shared";
195 case "Client,Server,Embedded": return "Shared";
196 }
197 return "Shared";
198 }
199
186 @override 200 @override
187 Object visitMapLiteralEntry(MapLiteralEntry node) { 201 Object visitMapLiteralEntry(MapLiteralEntry node) {
188 String libraryName = null; 202 String libraryName = null;
189 Expression key = node.key; 203 Expression key = node.key;
190 if (key is SimpleStringLiteral) { 204 if (key is SimpleStringLiteral) {
191 libraryName = "$_LIBRARY_PREFIX${key.value}"; 205 libraryName = "$_LIBRARY_PREFIX${key.value}";
192 } 206 }
193 Expression value = node.value; 207 Expression value = node.value;
194 if (value is InstanceCreationExpression) { 208 if (value is InstanceCreationExpression) {
195 SdkLibraryImpl library = new SdkLibraryImpl(libraryName); 209 SdkLibraryImpl library = new SdkLibraryImpl(libraryName);
196 List<Expression> arguments = value.argumentList.arguments; 210 List<Expression> arguments = value.argumentList.arguments;
197 for (Expression argument in arguments) { 211 for (Expression argument in arguments) {
198 if (argument is SimpleStringLiteral) { 212 if (argument is SimpleStringLiteral) {
199 library.path = argument.value; 213 library.path = argument.value;
200 } else if (argument is NamedExpression) { 214 } else if (argument is NamedExpression) {
201 String name = argument.name.label.name; 215 String name = argument.name.label.name;
202 Expression expression = argument.expression; 216 Expression expression = argument.expression;
203 if (name == _CATEGORY) { 217 if (name == _CATEGORIES) {
204 library.category = (expression as SimpleStringLiteral).value; 218 library.category =
219 convertCategories((expression as StringLiteral).stringValue);
205 } else if (name == _IMPLEMENTATION) { 220 } else if (name == _IMPLEMENTATION) {
206 library.implementation = (expression as BooleanLiteral).value; 221 library.implementation = (expression as BooleanLiteral).value;
207 } else if (name == _DOCUMENTED) { 222 } else if (name == _DOCUMENTED) {
208 library.documented = (expression as BooleanLiteral).value; 223 library.documented = (expression as BooleanLiteral).value;
209 } else if (name == _PLATFORMS) { 224 } else if (name == _PLATFORMS) {
210 if (expression is SimpleIdentifier) { 225 if (expression is SimpleIdentifier) {
211 String identifier = expression.name; 226 String identifier = expression.name;
212 if (identifier == _VM_PLATFORM) { 227 if (identifier == _VM_PLATFORM) {
213 library.setVmLibrary(); 228 library.setVmLibrary();
214 } else { 229 } else {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 _platforms |= DART2JS_PLATFORM; 390 _platforms |= DART2JS_PLATFORM;
376 } 391 }
377 392
378 /** 393 /**
379 * Record that this library can be run on the VM. 394 * Record that this library can be run on the VM.
380 */ 395 */
381 void setVmLibrary() { 396 void setVmLibrary() {
382 _platforms |= VM_PLATFORM; 397 _platforms |= VM_PLATFORM;
383 } 398 }
384 } 399 }
OLDNEW
« no previous file with comments | « packages/analyzer/lib/src/generated/resolver.dart ('k') | packages/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698