| 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 part of observatory; | 5 part of observatory; |
| 6 | 6 |
| 7 class CodeInstruction extends Observable { | 7 class CodeInstruction extends Observable { |
| 8 @observable final int address; | 8 @observable final int address; |
| 9 @observable final String machine; | 9 @observable final String machine; |
| 10 @observable final String human; | 10 @observable final String human; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 /// Is this a line of executable code? | 295 /// Is this a line of executable code? |
| 296 bool get executable => hits >= 0; | 296 bool get executable => hits >= 0; |
| 297 /// Has this line executed before? | 297 /// Has this line executed before? |
| 298 bool get covered => hits > 0; | 298 bool get covered => hits > 0; |
| 299 ScriptLine(this.line); | 299 ScriptLine(this.line); |
| 300 } | 300 } |
| 301 | 301 |
| 302 class Script extends Observable { | 302 class Script extends Observable { |
| 303 @observable String kind = null; | 303 @observable String kind = null; |
| 304 @observable Map scriptRef = toObservable({}); | 304 @observable Map scriptRef = toObservable({}); |
| 305 @published String shortName; |
| 305 @observable Map libraryRef = toObservable({}); | 306 @observable Map libraryRef = toObservable({}); |
| 306 @observable final List<ScriptLine> lines = | 307 @observable final List<ScriptLine> lines = |
| 307 toObservable(new List<ScriptLine>()); | 308 toObservable(new List<ScriptLine>()); |
| 308 bool _needsSource = true; | 309 bool _needsSource = true; |
| 309 bool get needsSource => _needsSource; | 310 bool get needsSource => _needsSource; |
| 310 Script.fromMap(Map map) { | 311 Script.fromMap(Map map) { |
| 311 scriptRef = toObservable({ | 312 scriptRef = toObservable({ |
| 312 'id': map['id'], | 313 'id': map['id'], |
| 313 'name': map['name'], | 314 'name': map['name'], |
| 314 'user_name': map['user_name'] | 315 'user_name': map['user_name'] |
| 315 }); | 316 }); |
| 317 shortName = map['name'].substring(map['name'].lastIndexOf('/') + 1); |
| 316 libraryRef = toObservable(map['library']); | 318 libraryRef = toObservable(map['library']); |
| 317 kind = map['kind']; | 319 kind = map['kind']; |
| 318 _processSource(map['source']); | 320 _processSource(map['source']); |
| 319 } | 321 } |
| 320 | 322 |
| 321 // Iterable of lines for display. Skips line '0'. | 323 // Iterable of lines for display. Skips line '0'. |
| 322 @observable Iterable get linesForDisplay { | 324 @observable Iterable get linesForDisplay { |
| 323 return lines.skip(1); | 325 return lines.skip(1); |
| 324 } | 326 } |
| 325 | 327 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 if (executableLines == 0) { | 383 if (executableLines == 0) { |
| 382 return 0.0; | 384 return 0.0; |
| 383 } | 385 } |
| 384 return (coveredLines / executableLines) * 100.0; | 386 return (coveredLines / executableLines) * 100.0; |
| 385 } | 387 } |
| 386 | 388 |
| 387 @observable String coveredPercentageFormatted() { | 389 @observable String coveredPercentageFormatted() { |
| 388 return '(' + coveredPercentage().toStringAsFixed(1) + '% covered)'; | 390 return '(' + coveredPercentage().toStringAsFixed(1) + '% covered)'; |
| 389 } | 391 } |
| 390 } | 392 } |
| OLD | NEW |