| Index: runtime/vm/coverage.cc
|
| diff --git a/runtime/vm/coverage.cc b/runtime/vm/coverage.cc
|
| index 9c38d8b4db214a43942cd862f9cc447896dbc3bd..8fede5858b11ee2cc3a40efc1c8ecef18e299105 100644
|
| --- a/runtime/vm/coverage.cc
|
| +++ b/runtime/vm/coverage.cc
|
| @@ -191,41 +191,43 @@ void CodeCoverage::PrintClass(const Library& lib,
|
| }
|
| }
|
|
|
| - GrowableObjectArray& closures =
|
| - GrowableObjectArray::Handle(cls.closures());
|
| - if (!closures.IsNull()) {
|
| - i = 0;
|
| - pos_to_line.Clear();
|
| - // We need to keep rechecking the length of the closures array, as handling
|
| - // a closure potentially adds new entries to the end.
|
| + const GrowableObjectArray& closures = GrowableObjectArray::Handle(
|
| + thread->isolate()->object_store()->closure_functions());
|
| + pos_to_line.Clear();
|
| + // We need to keep rechecking the length of the closures array, as handling
|
| + // a closure potentially adds new entries to the end.
|
| + i = 0;
|
| + while (i < closures.Length()) {
|
| + HANDLESCOPE(thread);
|
| + function ^= closures.At(i);
|
| + if (function.Owner() != cls.raw()) {
|
| + i++;
|
| + continue;
|
| + }
|
| + script = function.script();
|
| + saved_url = script.url();
|
| + if (!filter->ShouldOutputCoverageFor(lib, script, cls, function)) {
|
| + i++;
|
| + continue;
|
| + }
|
| + ComputeTokenPosToLineNumberMap(script, &pos_to_line);
|
| + JSONObject jsobj(&jsarr);
|
| + jsobj.AddProperty("source", saved_url.ToCString());
|
| + jsobj.AddProperty("script", script);
|
| + JSONArray hits_or_sites(&jsobj, as_call_sites ? "callSites" : "hits");
|
| +
|
| + // We stay within this loop while we are seeing functions from the same
|
| + // source URI.
|
| while (i < closures.Length()) {
|
| - HANDLESCOPE(thread);
|
| function ^= closures.At(i);
|
| script = function.script();
|
| - saved_url = script.url();
|
| - if (!filter->ShouldOutputCoverageFor(lib, script, cls, function)) {
|
| - i++;
|
| - continue;
|
| - }
|
| - ComputeTokenPosToLineNumberMap(script, &pos_to_line);
|
| - JSONObject jsobj(&jsarr);
|
| - jsobj.AddProperty("source", saved_url.ToCString());
|
| - jsobj.AddProperty("script", script);
|
| - JSONArray hits_or_sites(&jsobj, as_call_sites ? "callSites" : "hits");
|
| -
|
| - // We stay within this loop while we are seeing functions from the same
|
| - // source URI.
|
| - while (i < closures.Length()) {
|
| - function ^= closures.At(i);
|
| - script = function.script();
|
| - url = script.url();
|
| - if (!url.Equals(saved_url)) {
|
| - pos_to_line.Clear();
|
| - break;
|
| - }
|
| - CompileAndAdd(function, hits_or_sites, pos_to_line, as_call_sites);
|
| - i++;
|
| + url = script.url();
|
| + if (!url.Equals(saved_url)) {
|
| + pos_to_line.Clear();
|
| + break;
|
| }
|
| + CompileAndAdd(function, hits_or_sites, pos_to_line, as_call_sites);
|
| + i++;
|
| }
|
| }
|
| }
|
|
|