| Index: runtime/vm/parser.cc
|
| diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
|
| index 86e9ae7c16223cd1ea4284fc3438126e02c12a8f..bc3bde2910625794163a1e9876b1930f62d5f3af 100644
|
| --- a/runtime/vm/parser.cc
|
| +++ b/runtime/vm/parser.cc
|
| @@ -3825,6 +3825,7 @@ void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
|
| }
|
|
|
| intptr_t method_end_pos = TokenPos();
|
| + String* native_name = NULL;
|
| if ((CurrentToken() == Token::kLBRACE) ||
|
| (CurrentToken() == Token::kARROW)) {
|
| if (method->has_abstract) {
|
| @@ -3880,7 +3881,7 @@ void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
|
| ReportError(method->name_pos,
|
| "Constructor with redirection may not have a function body");
|
| }
|
| - ParseNativeDeclaration();
|
| + native_name = &ParseNativeDeclaration();
|
| method_end_pos = TokenPos();
|
| ExpectSemicolon();
|
| method->has_native = true;
|
| @@ -3958,6 +3959,9 @@ void Parser::ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method) {
|
| if (method->metadata_pos > 0) {
|
| library_.AddFunctionMetadata(func, method->metadata_pos);
|
| }
|
| + if (method->has_native) {
|
| + func.set_native_name(*native_name);
|
| + }
|
|
|
| // If this method is a redirecting factory, set the redirection information.
|
| if (!redirection_type.IsNull()) {
|
| @@ -5585,6 +5589,7 @@ void Parser::ParseTopLevelFunction(TopLevel* top_level,
|
|
|
| intptr_t function_end_pos = function_pos;
|
| bool is_native = false;
|
| + String* native_name = NULL;
|
| if (is_external) {
|
| function_end_pos = TokenPos();
|
| ExpectSemicolon();
|
| @@ -5604,7 +5609,7 @@ void Parser::ParseTopLevelFunction(TopLevel* top_level,
|
| function_end_pos = TokenPos();
|
| ExpectSemicolon();
|
| } else if (IsSymbol(Symbols::Native())) {
|
| - ParseNativeDeclaration();
|
| + native_name = &ParseNativeDeclaration();
|
| function_end_pos = TokenPos();
|
| ExpectSemicolon();
|
| is_native = true;
|
| @@ -5627,6 +5632,9 @@ void Parser::ParseTopLevelFunction(TopLevel* top_level,
|
| if (library_.is_dart_scheme() && library_.IsPrivate(func_name)) {
|
| func.set_is_reflectable(false);
|
| }
|
| + if (is_native) {
|
| + func.set_native_name(*native_name);
|
| + }
|
| AddFormalParamsToFunction(¶ms, func);
|
| top_level->AddFunction(func);
|
| if (!is_patch) {
|
| @@ -5735,6 +5743,7 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level,
|
|
|
| intptr_t accessor_end_pos = accessor_pos;
|
| bool is_native = false;
|
| + String* native_name = NULL;
|
| if (is_external) {
|
| accessor_end_pos = TokenPos();
|
| ExpectSemicolon();
|
| @@ -5754,7 +5763,7 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level,
|
| accessor_end_pos = TokenPos();
|
| ExpectSemicolon();
|
| } else if (IsSymbol(Symbols::Native())) {
|
| - ParseNativeDeclaration();
|
| + native_name = &ParseNativeDeclaration();
|
| accessor_end_pos = TokenPos();
|
| ExpectSemicolon();
|
| is_native = true;
|
| @@ -5777,6 +5786,7 @@ void Parser::ParseTopLevelAccessor(TopLevel* top_level,
|
| func.set_modifier(func_modifier);
|
| if (is_native) {
|
| func.set_is_debuggable(false);
|
| + func.set_native_name(*native_name);
|
| }
|
| if (library_.is_dart_scheme() && library_.IsPrivate(accessor_name)) {
|
| func.set_is_reflectable(false);
|
|
|