| OLD | NEW |
| 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 library input.transformer.instrumentation; | 5 library input.transformer.instrumentation; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/instrumentation/instrumentation.dart'; | 9 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 10 import 'package:analyzer/src/generated/java_engine.dart'; | 10 import 'package:analyzer/src/generated/java_engine.dart'; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 if (codesSeen.add(opCode)) { | 90 if (codesSeen.add(opCode)) { |
| 91 logger.log( | 91 logger.log( |
| 92 Level.WARNING, 'Ignored instrumentation op code: $opCode\n $line'); | 92 Level.WARNING, 'Ignored instrumentation op code: $opCode\n $line'); |
| 93 } | 93 } |
| 94 return null; | 94 return null; |
| 95 } | 95 } |
| 96 | 96 |
| 97 Map<String, dynamic> decodeJson(String line, String text) { | 97 Map<String, dynamic> decodeJson(String line, String text) { |
| 98 try { | 98 try { |
| 99 return JSON.decode(text); | 99 return asMap(JSON.decode(text)); |
| 100 } catch (e, s) { | 100 } catch (e, s) { |
| 101 throw new AnalysisException( | 101 throw new AnalysisException( |
| 102 'Failed to decode JSON: $text\n$line', new CaughtException(e, s)); | 102 'Failed to decode JSON: $text\n$line', new CaughtException(e, s)); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 /** | 106 /** |
| 107 * Determine if the given line is from an instrumentation file. | 107 * Determine if the given line is from an instrumentation file. |
| 108 * For example: | 108 * For example: |
| 109 * `1433175833005:Ver:1421765742287333878467:org.dartlang.dartplugin:0.0.0:1.6
.2:1.11.0-edge.131698` | 109 * `1433175833005:Ver:1421765742287333878467:org.dartlang.dartplugin:0.0.0:1.6
.2:1.11.0-edge.131698` |
| (...skipping 29 matching lines...) Expand all Loading... |
| 139 sb.writeCharCode(code); | 139 sb.writeCharCode(code); |
| 140 } | 140 } |
| 141 ++index; | 141 ++index; |
| 142 } | 142 } |
| 143 if (sb.isNotEmpty) { | 143 if (sb.isNotEmpty) { |
| 144 fields.add(sb.toString()); | 144 fields.add(sb.toString()); |
| 145 } | 145 } |
| 146 return fields; | 146 return fields; |
| 147 } | 147 } |
| 148 } | 148 } |
| OLD | NEW |