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

Unified Diff: runtime/vm/parser.cc

Issue 23038010: Fix Function.end_token_pos() and implement MethodMirror.source getter (Closed) Base URL: https://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
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 247fbc7f70c8acc5bb4ed2b4059c983d954c397c..3aef333809cd50808c0413c0289c75a881294a2a 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -2698,14 +2698,17 @@ SequenceNode* Parser::ParseFunc(const Function& func,
ConsumeToken();
ParseStatementSequence();
ExpectToken(Token::kRBRACE);
+ func.set_end_token_pos(TokenPos() - 1);
hausner 2013/08/20 17:49:44 Read the closing brace after setting the end token
Michael Lippautz (Google) 2013/08/21 16:50:03 Done.
} else if (CurrentToken() == Token::kARROW) {
ConsumeToken();
const intptr_t expr_pos = TokenPos();
AstNode* expr = ParseExpr(kAllowConst, kConsumeCascades);
ASSERT(expr != NULL);
current_block_->statements->Add(new ReturnNode(expr_pos, expr));
+ func.set_end_token_pos(TokenPos());
} else if (IsLiteral("native")) {
ParseNativeFunctionBlock(&params, func);
hausner 2013/08/20 17:49:44 Can you refactor the code so that ParseNativeFunct
Michael Lippautz (Google) 2013/08/21 16:50:03 Done.
+ func.set_end_token_pos(TokenPos() - 1);
} else if (func.is_external()) {
// Body of an external method contains a single throw.
const String& function_name = String::ZoneHandle(func.name());
@@ -5308,8 +5311,6 @@ AstNode* Parser::ParseFunctionStatement(bool is_literal) {
Array& default_parameter_values = Array::Handle();
SequenceNode* statements = Parser::ParseFunc(function,
default_parameter_values);
- ASSERT(is_new_closure || (function.end_token_pos() == (TokenPos() - 1)));
- function.set_end_token_pos(TokenPos() - 1);
// Now that the local function has formal parameters, lookup the signature
// class in the current library (but not in its imports) and only create a new

Powered by Google App Engine
This is Rietveld 408576698