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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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']['user_name']; | 108 var file = frame['script']['user_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 | 114 |
115 bool isNull(String type) { | 115 bool isNull(ref) { |
116 return type == 'Null'; | 116 return ref != null && ref.serviceType == 'Null' && ref.id == 'objects/null'; |
117 } | 117 } |
118 | 118 |
119 bool isError(String type) { | 119 bool isPseduoNull(ref) { |
120 return type == 'Error'; | 120 return ref != null && ref.serviceType == 'Null' && ref.id != 'objects/null'; |
121 } | 121 } |
122 | 122 |
123 bool isInt(String type) { | 123 bool isError(ref) { |
124 return (type == 'Smi' || | 124 return ref != null && ref.serviceType == 'Error'; |
125 type == 'Mint' || | |
126 type == 'Bigint'); | |
127 } | 125 } |
128 | 126 |
129 bool isBool(String type) { | 127 bool isInt(ref) { |
130 return type == 'Bool'; | 128 return ref != null && (ref.serviceType == 'Smi' || |
| 129 ref.serviceType == 'Mint' || |
| 130 ref.serviceType == 'Bigint'); |
131 } | 131 } |
132 | 132 |
133 bool isString(String type) { | 133 bool isBool(ref) { |
134 return type == 'String'; | 134 return ref != null && ref.serviceType == 'Bool'; |
135 } | 135 } |
136 | 136 |
137 bool isInstance(String type) { | 137 bool isString(ref) { |
138 return type == 'Instance'; | 138 return ref != null && ref.serviceType == 'String'; |
139 } | 139 } |
140 | 140 |
141 bool isDouble(String type) { | 141 bool isInstance(ref) { |
142 return type == 'Double'; | 142 return ref != null && ref.serviceType == 'Instance'; |
143 } | 143 } |
144 | 144 |
145 bool isList(String type) { | 145 bool isDouble(ref) { |
146 return (type == 'GrowableObjectArray' || | 146 return ref != null && ref.serviceType == 'Double'; |
147 type == 'Array'); | |
148 } | 147 } |
149 | 148 |
150 bool isType(String type) { | 149 bool isList(ref) { |
151 return (type == 'Type'); | 150 return ref != null && (ref.serviceType == 'GrowableObjectArray' || |
| 151 ref.serviceType == 'Array'); |
152 } | 152 } |
153 | 153 |
154 bool isUnexpected(String type) { | 154 bool isType(ref) { |
| 155 return ref != null && (ref.serviceType == 'Type'); |
| 156 } |
| 157 |
| 158 bool isUnexpected(ref) { |
| 159 if (ref == null) return false; |
155 return (!['Null', | 160 return (!['Null', |
156 'Smi', | 161 'Smi', |
157 'Mint', | 162 'Mint', |
158 'Bigint', | 163 'Bigint', |
159 'Bool', | 164 'Bool', |
160 'String', | 165 'String', |
161 'Double', | 166 'Double', |
162 'Instance', | 167 'Instance', |
163 'GrowableObjectArray', | 168 'GrowableObjectArray', |
164 'Array', | 169 'Array', |
165 'Type', | 170 'Type', |
166 'Error'].contains(type)); | 171 'Error'].contains(ref.serviceType)); |
167 } | 172 } |
168 } | 173 } |
OLD | NEW |