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

Side by Side Diff: pkg/dart_messages/bin/publish.dart

Issue 1706033002: More shared messages. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:convert'; 5 import 'dart:convert';
6 import 'dart:io' as io; 6 import 'dart:io' as io;
7 7
8 import '../lib/shared_messages.dart'; 8 import '../lib/shared_messages.dart';
9 9
10 const String jsonPath = '../lib/generated/shared_messages.json'; 10 const String jsonPath = '../lib/generated/shared_messages.json';
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 String convertToAnalyzerTemplate(String template, holeOrder) { 149 String convertToAnalyzerTemplate(String template, holeOrder) {
150 var holeMap; 150 var holeMap;
151 if (holeOrder != null) { 151 if (holeOrder != null) {
152 holeMap = {}; 152 holeMap = {};
153 for (int i = 0; i < holeOrder.length; i++) { 153 for (int i = 0; i < holeOrder.length; i++) {
154 holeMap[holeOrder[i]] = i; 154 holeMap[holeOrder[i]] = i;
155 } 155 }
156 } 156 }
157 int seenHoles = 0; 157 int seenHoles = 0;
158 return template.replaceAllMapped(new RegExp(r"#\w+"), (Match match) { 158 return template.replaceAllMapped(new RegExp(r"#\w+|#{\w+}"), (Match match) {
159 if (holeMap != null) { 159 if (holeMap != null) {
160 String holeName = match[0].substring(1); 160 String matchedString = match[0];
161 String holeName = matchedString.startsWith("#{")
162 ? matchedString.substring(2, matchedString.length - 1)
163 : matchedString.substring(1);
161 int index = holeMap[holeName]; 164 int index = holeMap[holeName];
162 if (index == null) { 165 if (index == null) {
163 throw "Couldn't find hole-position for $holeName $holeMap"; 166 throw "Couldn't find hole-position for $holeName $holeMap";
164 } 167 }
165 return "{$index}"; 168 return "{$index}";
166 } else { 169 } else {
167 return "{${seenHoles++}}"; 170 return "{${seenHoles++}}";
168 } 171 }
169 }); 172 });
170 } 173 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 /// Translates the shared messages in `../lib/shared_messages.dart` to JSON, 224 /// Translates the shared messages in `../lib/shared_messages.dart` to JSON,
222 /// dart2js, and analyzer formats. 225 /// dart2js, and analyzer formats.
223 /// 226 ///
224 /// Emits the json-output to [jsonPath], the dart2js-output to [dart2jsPath], 227 /// Emits the json-output to [jsonPath], the dart2js-output to [dart2jsPath],
225 /// and the analyzer-output to [analyzerPath]. 228 /// and the analyzer-output to [analyzerPath].
226 void main() { 229 void main() {
227 emitJson(); 230 emitJson();
228 emitDart2js(); 231 emitDart2js();
229 emitAnalyzer(); 232 emitAnalyzer();
230 } 233 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/dart_messages/lib/generated/shared_messages.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698