| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 observatory_element; | 5 library observatory_element; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'package:observatory/app.dart'; | 9 import 'package:observatory/app.dart'; |
| 10 import 'package:polymer/polymer.dart'; | 10 import 'package:polymer/polymer.dart'; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 String formatSize(int bytes) => Utils.formatSize(bytes); | 105 String formatSize(int bytes) => Utils.formatSize(bytes); |
| 106 | 106 |
| 107 String fileAndLine(Map frame) { | 107 String fileAndLine(Map frame) { |
| 108 var file = frame['script'].name; | 108 var file = frame['script'].name; |
| 109 var shortFile = file.substring(file.lastIndexOf('/') + 1); | 109 var shortFile = file.substring(file.lastIndexOf('/') + 1); |
| 110 return "${shortFile}:${frame['line']}"; | 110 return "${shortFile}:${frame['line']}"; |
| 111 } | 111 } |
| 112 | 112 |
| 113 int parseInt(String value) => int.parse(value); | 113 int parseInt(String value) => int.parse(value); |
| 114 |
| 115 bool isNull(ref) { |
| 116 return ref != null && ref.serviceType == 'Null'; |
| 117 } |
| 118 |
| 119 bool isSentinel(ref) { |
| 120 return ref != null && ref.serviceType == 'Sentinel'; |
| 121 } |
| 122 |
| 123 bool isError(ref) { |
| 124 return ref != null && ref.serviceType == 'Error'; |
| 125 } |
| 126 |
| 127 bool isInt(ref) { |
| 128 return ref != null && (ref.serviceType == 'Smi' || |
| 129 ref.serviceType == 'Mint' || |
| 130 ref.serviceType == 'Bigint'); |
| 131 } |
| 132 |
| 133 bool isBool(ref) { |
| 134 return ref != null && ref.serviceType == 'Bool'; |
| 135 } |
| 136 |
| 137 bool isString(ref) { |
| 138 return ref != null && ref.serviceType == 'String'; |
| 139 } |
| 140 |
| 141 bool isInstance(ref) { |
| 142 return ref != null && ref.serviceType == 'Instance'; |
| 143 } |
| 144 |
| 145 bool isDouble(ref) { |
| 146 return ref != null && ref.serviceType == 'Double'; |
| 147 } |
| 148 |
| 149 bool isList(ref) { |
| 150 return ref != null && (ref.serviceType == 'GrowableObjectArray' || |
| 151 ref.serviceType == 'Array'); |
| 152 } |
| 153 |
| 154 bool isType(ref) { |
| 155 return ref != null && (ref.serviceType == 'Type'); |
| 156 } |
| 157 |
| 158 bool isUnexpected(ref) { |
| 159 if (ref == null) return false; |
| 160 return (!['Null', |
| 161 'Sentinel', |
| 162 'Smi', |
| 163 'Mint', |
| 164 'Bigint', |
| 165 'Bool', |
| 166 'String', |
| 167 'Double', |
| 168 'Instance', |
| 169 'GrowableObjectArray', |
| 170 'Array', |
| 171 'Type', |
| 172 'Error'].contains(ref.serviceType)); |
| 173 } |
| 114 } | 174 } |
| OLD | NEW |