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

Side by Side Diff: bin/code_deps.dart

Issue 1411523003: add a JsonInfoCodec class (Closed) Base URL: git@github.com:dart-lang/dart2js_info.git@master
Patch Set: Created 5 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
« no previous file with comments | « README.md ('k') | bin/debug_info.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) 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 /// Command-line tool to query for code dependencies. Currently this tool only 5 /// Command-line tool to query for code dependencies. Currently this tool only
6 /// supports the `some_path` query, which gives you the shortest path for how 6 /// supports the `some_path` query, which gives you the shortest path for how
7 /// one function depends on another. 7 /// one function depends on another.
8 /// 8 ///
9 /// You can run this tool as follows: 9 /// You can run this tool as follows:
10 /// ```bash 10 /// ```bash
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 exit(1); 42 exit(1);
43 } 43 }
44 44
45 var json; 45 var json;
46 try { 46 try {
47 json = JSON.decode(new File(args[0]).readAsStringSync()); 47 json = JSON.decode(new File(args[0]).readAsStringSync());
48 } catch (e) { 48 } catch (e) {
49 print('error: could not read ${args[0]}'); 49 print('error: could not read ${args[0]}');
50 exit(1); 50 exit(1);
51 } 51 }
52 var info = new AllInfo.fromJson(json); 52 var info = new AllInfoJsonCodec().decode(json);
53 var graph = graphFromInfo(info); 53 var graph = graphFromInfo(info);
54 54
55 var queryName = args[1]; 55 var queryName = args[1];
56 if (queryName == 'some_path') { 56 if (queryName == 'some_path') {
57 if (args.length < 4) { 57 if (args.length < 4) {
58 print('missing arguments for `some_path`'); 58 print('missing arguments for `some_path`');
59 exit(1); 59 exit(1);
60 } 60 }
61 var source = info.functions 61 var source = info.functions
62 .firstWhere(_longNameMatcher(new RegExp(args[2])), orElse: () => null); 62 .firstWhere(_longNameMatcher(new RegExp(args[2])), orElse: () => null);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (seen.containsKey(neighbor)) continue; 120 if (seen.containsKey(neighbor)) continue;
121 seen[neighbor] = node; 121 seen[neighbor] = node;
122 queue.addLast(neighbor); 122 queue.addLast(neighbor);
123 } 123 }
124 } 124 }
125 return []; 125 return [];
126 } 126 }
127 } 127 }
128 128
129 _longNameMatcher(RegExp regexp) => (e) => regexp.hasMatch(longName(e)); 129 _longNameMatcher(RegExp regexp) => (e) => regexp.hasMatch(longName(e));
OLDNEW
« no previous file with comments | « README.md ('k') | bin/debug_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698