OLD | NEW |
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 trydart.poi; | 5 library trydart.poi; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Completer, | 8 Completer, |
9 Future, | 9 Future, |
10 Stream; | 10 Stream; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 ScopeContainerElement; | 48 ScopeContainerElement; |
49 | 49 |
50 import 'package:compiler/implementation/scanner/scannerlib.dart' show | 50 import 'package:compiler/implementation/scanner/scannerlib.dart' show |
51 EOF_TOKEN, | 51 EOF_TOKEN, |
52 IDENTIFIER_TOKEN, | 52 IDENTIFIER_TOKEN, |
53 KEYWORD_TOKEN, | 53 KEYWORD_TOKEN, |
54 PartialClassElement, | 54 PartialClassElement, |
55 PartialElement, | 55 PartialElement, |
56 Token; | 56 Token; |
57 | 57 |
58 import 'package:compiler/implementation/util/uri_extras.dart' show | |
59 relativize; | |
60 | |
61 /// Controls if this program should be querying Dart Mind. Used by tests. | 58 /// Controls if this program should be querying Dart Mind. Used by tests. |
62 bool enableDartMind = true; | 59 bool enableDartMind = true; |
63 | 60 |
64 /// Iterator over lines from standard input (or the argument array). | 61 /// Iterator over lines from standard input (or the argument array). |
65 Iterator<String> stdin; | 62 Iterator<String> stdin; |
66 | 63 |
67 /// Iterator for reading lines from [io.stdin]. | 64 /// Iterator for reading lines from [io.stdin]. |
68 class StdinIterator implements Iterator<String> { | 65 class StdinIterator implements Iterator<String> { |
69 String current; | 66 String current; |
70 | 67 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 StringBuffer get indented => buffer..write(indentation); | 325 StringBuffer get indented => buffer..write(indentation); |
329 | 326 |
330 void visitElement(Element e) { | 327 void visitElement(Element e) { |
331 serialize(e, omitEnclosing: false); | 328 serialize(e, omitEnclosing: false); |
332 } | 329 } |
333 | 330 |
334 void visitLibraryElement(LibraryElement e) { | 331 void visitLibraryElement(LibraryElement e) { |
335 bool isFirst = true; | 332 bool isFirst = true; |
336 serialize( | 333 serialize( |
337 e, omitEnclosing: true, | 334 e, omitEnclosing: true, |
338 name: relativize(Uri.base, e.canonicalUri, false), | 335 name: e.getLibraryName(), |
339 serializeMembers: () { | 336 serializeMembers: () { |
340 // TODO(ahe): Include imported elements in libraries. | 337 // TODO(ahe): Include imported elements in libraries. |
341 e.forEachLocalMember((Element member) { | 338 e.forEachLocalMember((Element member) { |
342 if (!isFirst) { | 339 if (!isFirst) { |
343 buffer.write(','); | 340 buffer.write(','); |
344 } | 341 } |
345 buffer.write('\n'); | 342 buffer.write('\n'); |
346 indented; | 343 indented; |
347 serialize(member); | 344 serialize(member); |
348 isFirst = false; | 345 isFirst = false; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 if (!omitEnclosing) { | 398 if (!omitEnclosing) { |
402 buffer.write(',\n'); | 399 buffer.write(',\n'); |
403 indented.write('"enclosing": '); | 400 indented.write('"enclosing": '); |
404 element.enclosingElement.accept(this); | 401 element.enclosingElement.accept(this); |
405 } | 402 } |
406 indentationLevel--; | 403 indentationLevel--; |
407 buffer.write('\n'); | 404 buffer.write('\n'); |
408 indented.write('}'); | 405 indented.write('}'); |
409 } | 406 } |
410 } | 407 } |
OLD | NEW |