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

Unified Diff: runtime/vm/parser.cc

Issue 1034203003: Allow metadata on local functions (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | « runtime/vm/object.cc ('k') | tests/language/metadata_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 44714)
+++ runtime/vm/parser.cc (working copy)
@@ -7306,10 +7306,12 @@
result_type = Type::DynamicType();
const intptr_t function_pos = TokenPos();
+ intptr_t metadata_pos = -1;
if (is_literal) {
ASSERT(CurrentToken() == Token::kLPAREN);
function_name = &Symbols::AnonymousClosure();
} else {
+ metadata_pos = SkipMetadata();
if (CurrentToken() == Token::kVOID) {
ConsumeToken();
result_type = Type::VoidType();
@@ -7359,6 +7361,9 @@
innermost_function(),
function_pos);
function.set_result_type(result_type);
+ if (metadata_pos >= 0) {
+ library_.AddFunctionMetadata(function, metadata_pos);
+ }
}
// The function type needs to be finalized at compile time, since the closure
@@ -7722,6 +7727,7 @@
bool Parser::IsFunctionDeclaration() {
const intptr_t saved_pos = TokenPos();
bool is_external = false;
+ SkipMetadata();
if (is_top_level_) {
if (is_patch_source() &&
(CurrentToken() == Token::kIDENT) &&
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/metadata_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698