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

Side by Side Diff: runtime/vm/parser.cc

Issue 117723002: Allow the native resolver to setup whether it needs the Dart API scope to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 5299 matching lines...) Expand 10 before | Expand all | Expand 10 after
5310 const Class& cls = Class::Handle(func.Owner()); 5310 const Class& cls = Class::Handle(func.Owner());
5311 const Library& library = Library::Handle(cls.library()); 5311 const Library& library = Library::Handle(cls.library());
5312 ASSERT(func.NumParameters() == params->parameters->length()); 5312 ASSERT(func.NumParameters() == params->parameters->length());
5313 5313
5314 // Parse the function name out. 5314 // Parse the function name out.
5315 const intptr_t native_pos = TokenPos(); 5315 const intptr_t native_pos = TokenPos();
5316 const String& native_name = ParseNativeDeclaration(); 5316 const String& native_name = ParseNativeDeclaration();
5317 5317
5318 // Now resolve the native function to the corresponding native entrypoint. 5318 // Now resolve the native function to the corresponding native entrypoint.
5319 const int num_params = NativeArguments::ParameterCountForResolution(func); 5319 const int num_params = NativeArguments::ParameterCountForResolution(func);
5320 bool auto_setup_scope = true;
5320 NativeFunction native_function = NativeEntry::ResolveNative( 5321 NativeFunction native_function = NativeEntry::ResolveNative(
5321 library, native_name, num_params); 5322 library, native_name, num_params, &auto_setup_scope);
5322 if (native_function == NULL) { 5323 if (native_function == NULL) {
5323 ErrorMsg(native_pos, "native function '%s' cannot be found", 5324 ErrorMsg(native_pos, "native function '%s' cannot be found",
5324 native_name.ToCString()); 5325 native_name.ToCString());
5325 } 5326 }
5327 func.SetIsNativeAutoSetupScope(auto_setup_scope);
5326 5328
5327 // Now add the NativeBodyNode and return statement. 5329 // Now add the NativeBodyNode and return statement.
5328 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 5330 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
5329 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 5331 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
5330 current_block_->statements->Add( 5332 current_block_->statements->Add(
5331 new ReturnNode(TokenPos(), 5333 new ReturnNode(TokenPos(),
5332 new NativeBodyNode(TokenPos(), 5334 new NativeBodyNode(TokenPos(),
5333 Function::ZoneHandle(func.raw()), 5335 Function::ZoneHandle(func.raw()),
5334 native_name, 5336 native_name,
5335 native_function, 5337 native_function,
(...skipping 5415 matching lines...) Expand 10 before | Expand all | Expand 10 after
10751 void Parser::SkipQualIdent() { 10753 void Parser::SkipQualIdent() {
10752 ASSERT(IsIdentifier()); 10754 ASSERT(IsIdentifier());
10753 ConsumeToken(); 10755 ConsumeToken();
10754 if (CurrentToken() == Token::kPERIOD) { 10756 if (CurrentToken() == Token::kPERIOD) {
10755 ConsumeToken(); // Consume the kPERIOD token. 10757 ConsumeToken(); // Consume the kPERIOD token.
10756 ExpectIdentifier("identifier expected after '.'"); 10758 ExpectIdentifier("identifier expected after '.'");
10757 } 10759 }
10758 } 10760 }
10759 10761
10760 } // namespace dart 10762 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698