| 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 #include "vm/service.h" | 5 #include "vm/service.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 static bool HandleClassesFunctionsCoverage( | 1132 static bool HandleClassesFunctionsCoverage( |
| 1133 Isolate* isolate, const Function& func, JSONStream* js) { | 1133 Isolate* isolate, const Function& func, JSONStream* js) { |
| 1134 FunctionCoverageFilter filter(func); | 1134 FunctionCoverageFilter filter(func); |
| 1135 CodeCoverage::PrintJSON(isolate, js, &filter); | 1135 CodeCoverage::PrintJSON(isolate, js, &filter); |
| 1136 return true; | 1136 return true; |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 | 1139 |
| 1140 static bool HandleClassesFunctions(Isolate* isolate, const Class& cls, | 1140 static bool HandleClassesFunctions(Isolate* isolate, const Class& cls, |
| 1141 JSONStream* js) { | 1141 JSONStream* js) { |
| 1142 intptr_t id; | 1142 if (js->num_arguments() != 4 && js->num_arguments() != 5) { |
| 1143 if (js->num_arguments() > 5) { | 1143 PrintError(js, "Command should have 4 or 5 arguments"); |
| 1144 PrintError(js, "Command too long"); | |
| 1145 return true; | 1144 return true; |
| 1146 } | 1145 } |
| 1147 if (!GetIntegerId(js->GetArgument(3), &id)) { | 1146 const char* encoded_id = js->GetArgument(3); |
| 1148 PrintError(js, "Must specify collection object id: functions/id"); | 1147 String& id = String::Handle(isolate, String::New(encoded_id)); |
| 1148 id = String::DecodeIRI(id); |
| 1149 if (id.IsNull()) { |
| 1150 PrintError(js, "Function id %s is malformed", encoded_id); |
| 1149 return true; | 1151 return true; |
| 1150 } | 1152 } |
| 1151 Function& func = Function::Handle(); | 1153 Function& func = Function::Handle(cls.LookupFunction(id)); |
| 1152 func ^= cls.FunctionFromIndex(id); | |
| 1153 if (func.IsNull()) { | 1154 if (func.IsNull()) { |
| 1154 PrintError(js, "Function %" Pd " not found", id); | 1155 PrintError(js, "Function %s not found", encoded_id); |
| 1155 return true; | 1156 return true; |
| 1156 } | 1157 } |
| 1157 if (js->num_arguments() == 4) { | 1158 if (js->num_arguments() == 4) { |
| 1158 func.PrintJSON(js, false); | 1159 func.PrintJSON(js, false); |
| 1159 return true; | 1160 return true; |
| 1160 } else { | 1161 } else { |
| 1161 const char* subcollection = js->GetArgument(4); | 1162 const char* subcollection = js->GetArgument(4); |
| 1162 if (strcmp(subcollection, "coverage") == 0) { | 1163 if (strcmp(subcollection, "coverage") == 0) { |
| 1163 return HandleClassesFunctionsCoverage(isolate, func, js); | 1164 return HandleClassesFunctionsCoverage(isolate, func, js); |
| 1164 } else { | 1165 } else { |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 while (current != NULL) { | 2525 while (current != NULL) { |
| 2525 if (strcmp(name, current->name()) == 0) { | 2526 if (strcmp(name, current->name()) == 0) { |
| 2526 return current; | 2527 return current; |
| 2527 } | 2528 } |
| 2528 current = current->next(); | 2529 current = current->next(); |
| 2529 } | 2530 } |
| 2530 return NULL; | 2531 return NULL; |
| 2531 } | 2532 } |
| 2532 | 2533 |
| 2533 } // namespace dart | 2534 } // namespace dart |
| OLD | NEW |