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 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 if (counter != globalCounter) throw 'Using old provider'; | 190 if (counter != globalCounter) throw 'Using old provider'; |
191 printVerbose('fake inputProvider#$counter($uri): $poiCount $count'); | 191 printVerbose('fake inputProvider#$counter($uri): $poiCount $count'); |
192 if (uri == script) { | 192 if (uri == script) { |
193 if (poiCount == count) { | 193 if (poiCount == count) { |
194 cachedFileName = uri.toFilePath(); | 194 cachedFileName = uri.toFilePath(); |
195 if (count != 0) { | 195 if (count != 0) { |
196 cachedFileName = '$cachedFileName.$count.dart'; | 196 cachedFileName = '$cachedFileName.$count.dart'; |
197 } | 197 } |
198 printVerbose('Not using cached version of $cachedFileName'); | 198 printVerbose('Not using cached version of $cachedFileName'); |
199 cache = new io.File(cachedFileName).readAsBytes().then((data) { | 199 cache = new io.File(cachedFileName).readAsBytes().then((data) { |
200 printVerbose('Read file $cachedFileName: ${UTF8.decode(data)}'); | 200 printVerbose( |
| 201 'Read file $cachedFileName: ' |
| 202 '${UTF8.decode(data.sublist(0, 100), allowMalformed: true)}...'); |
201 return data; | 203 return data; |
202 }); | 204 }); |
203 count++; | 205 count++; |
204 } else { | 206 } else { |
205 printVerbose('Using cached version of $cachedFileName'); | 207 printVerbose('Using cached version of $cachedFileName'); |
206 } | 208 } |
207 return cache; | 209 return cache; |
208 } else { | 210 } else { |
209 printVerbose('Using original provider for $uri'); | 211 printVerbose('Using original provider for $uri'); |
210 return inputProvider(uri); | 212 return inputProvider(uri); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 buffer.write('\n'); | 720 buffer.write('\n'); |
719 indented.write('}'); | 721 indented.write('}'); |
720 } | 722 } |
721 } | 723 } |
722 | 724 |
723 modelx.ScopeX localScope(modelx.LibraryElementX element) => element.localScope; | 725 modelx.ScopeX localScope(modelx.LibraryElementX element) => element.localScope; |
724 | 726 |
725 modelx.ImportScope importScope(modelx.LibraryElementX element) { | 727 modelx.ImportScope importScope(modelx.LibraryElementX element) { |
726 return element.importScope; | 728 return element.importScope; |
727 } | 729 } |
OLD | NEW |