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

Side by Side Diff: utils/pub/hosted_source.dart

Issue 11090016: Change core lib, dart2js, and more for new optional parameters syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « utils/pub/git_source.dart ('k') | utils/pub/io.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 hosted_source; 5 library hosted_source;
6 6
7 import 'dart:io' as io; 7 import 'dart:io' as io;
8 import 'dart:json'; 8 import 'dart:json';
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 bool descriptionsEqual(description1, description2) => 119 bool descriptionsEqual(description1, description2) =>
120 _parseDescription(description1) == _parseDescription(description2); 120 _parseDescription(description1) == _parseDescription(description2);
121 121
122 /** 122 /**
123 * Ensures that [description] is a valid hosted package description. 123 * Ensures that [description] is a valid hosted package description.
124 * 124 *
125 * There are two valid formats. A plain string refers to a package with the 125 * There are two valid formats. A plain string refers to a package with the
126 * given name from the default host, while a map with keys "name" and "url" 126 * given name from the default host, while a map with keys "name" and "url"
127 * refers to a package with the given name from the host at the given URL. 127 * refers to a package with the given name from the host at the given URL.
128 */ 128 */
129 void validateDescription(description, [bool fromLockFile=false]) { 129 void validateDescription(description, {bool fromLockFile: false}) {
130 _parseDescription(description); 130 _parseDescription(description);
131 } 131 }
132 132
133 /** 133 /**
134 * Parses the description for a package. 134 * Parses the description for a package.
135 * 135 *
136 * If the package parses correctly, this returns a (name, url) pair. If not, 136 * If the package parses correctly, this returns a (name, url) pair. If not,
137 * this throws a descriptive FormatException. 137 * this throws a descriptive FormatException.
138 */ 138 */
139 Pair<String, String> _parseDescription(description) { 139 Pair<String, String> _parseDescription(description) {
(...skipping 13 matching lines...) Expand all
153 153
154 var name = description["name"]; 154 var name = description["name"];
155 if (name is! String) { 155 if (name is! String) {
156 throw new FormatException("The 'name' key must have a string value."); 156 throw new FormatException("The 'name' key must have a string value.");
157 } 157 }
158 158
159 var url = description.containsKey("url") ? description["url"] : defaultUrl; 159 var url = description.containsKey("url") ? description["url"] : defaultUrl;
160 return new Pair<String, String>(name, url); 160 return new Pair<String, String>(name, url);
161 } 161 }
162 } 162 }
OLDNEW
« no previous file with comments | « utils/pub/git_source.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698