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

Unified Diff: runtime/vm/parser.cc

Issue 23019013: Mark private methods of core libraries as invisible in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 26585)
+++ runtime/vm/parser.cc (working copy)
@@ -762,12 +762,27 @@
}
+static bool IsInvisible(const Function& func) {
+ if (!Library::IsPrivate(String::Handle(func.name()))) return false;
+ // Check for private function in the core libraries.
+ const Class& cls = Class::Handle(func.Owner());
+ const Library& library = Library::Handle(cls.library());
+ if (library.raw() == Library::CoreLibrary()) return true;
+ if (library.raw() == Library::CollectionLibrary()) return true;
+ if (library.raw() == Library::TypedDataLibrary()) return true;
+ if (library.raw() == Library::MathLibrary()) return true;
+ return false;
+}
+
+
void Parser::ParseFunction(ParsedFunction* parsed_function) {
TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer);
Isolate* isolate = Isolate::Current();
ASSERT(isolate->long_jump_base()->IsSafeToJump());
ASSERT(parsed_function != NULL);
const Function& func = parsed_function->function();
+ // Mark private core library functions as invisible by default.
+ if (IsInvisible(func)) func.set_is_visible(false);
const Script& script = Script::Handle(isolate, func.script());
Parser parser(script, parsed_function, func.token_pos());
SequenceNode* node_sequence = NULL;

Powered by Google App Engine
This is Rietveld 408576698