Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Unified Diff: runtime/vm/source_report.cc

Issue 1916243002: Fix getSourceReport's forceCompile option for unused classes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/source_report_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/source_report.cc
diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc
index 1d3e818521487593de3d2a3e67e7f0fac3a30126..1e901afec171d7a6dd67eb872d7f7ab5afa23b3a 100644
--- a/runtime/vm/source_report.cc
+++ b/runtime/vm/source_report.cc
@@ -393,9 +393,31 @@ void SourceReport::VisitLibrary(JSONArray* jsarr, const Library& lib) {
Class& cls = Class::Handle(zone());
Array& functions = Array::Handle(zone());
Function& func = Function::Handle(zone());
+ Script& script = Script::Handle(zone());
ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
while (it.HasNext()) {
cls = it.GetNextClass();
+ if (!cls.is_finalized()) {
+ if (compile_mode_ == kForceCompile) {
+ const Error& err = Error::Handle(cls.EnsureIsFinalized(thread()));
+ if (!err.IsNull()) {
+ // This class will get an error when finalized. Skip it.
rmacnak 2016/04/25 23:28:34 We don't report errors with kForceCompile? If we r
+ continue;
+ }
+ } else {
+ // Emit one range for the whole uncompiled class.
+ script = cls.script();
+ const TokenPosition begin_pos = cls.token_pos();
+ const TokenPosition end_pos = cls.ComputeEndTokenPos();
+
+ JSONObject range(jsarr);
+ range.AddProperty("scriptIndex", GetScriptIndex(script));
+ range.AddProperty("startPos", begin_pos);
+ range.AddProperty("endPos", end_pos);
+ range.AddProperty("compiled", false);
+ }
+ }
+
functions = cls.functions();
for (int i = 0; i < functions.Length(); i++) {
func ^= functions.At(i);
« no previous file with comments | « no previous file | runtime/vm/source_report_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698