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

Side by Side Diff: vm/scopes.cc

Issue 11519006: Add read only handles for the following predefined symbols (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | « vm/parser.cc ('k') | vm/stub_code_ia32.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/scopes.h" 5 #include "vm/scopes.h"
6 6
7 #include "vm/ast.h" 7 #include "vm/ast.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/parser.h" 10 #include "vm/parser.h"
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 518
519 519
520 RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) { 520 RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) {
521 static const intptr_t kNumCapturedVars = 1; 521 static const intptr_t kNumCapturedVars = 1;
522 522
523 // Create a ContextScope with space for kNumCapturedVars descriptors. 523 // Create a ContextScope with space for kNumCapturedVars descriptors.
524 const ContextScope& context_scope = 524 const ContextScope& context_scope =
525 ContextScope::Handle(ContextScope::New(kNumCapturedVars)); 525 ContextScope::Handle(ContextScope::New(kNumCapturedVars));
526 526
527 // Create a descriptor for 'this' variable. 527 // Create a descriptor for 'this' variable.
528 const String& name = String::Handle(Symbols::This());
529 context_scope.SetTokenIndexAt(0, func.token_pos()); 528 context_scope.SetTokenIndexAt(0, func.token_pos());
530 context_scope.SetNameAt(0, name); 529 context_scope.SetNameAt(0, Symbols::ThisHandle());
531 context_scope.SetIsFinalAt(0, true); 530 context_scope.SetIsFinalAt(0, true);
532 context_scope.SetIsConstAt(0, false); 531 context_scope.SetIsConstAt(0, false);
533 const AbstractType& type = AbstractType::Handle(func.ParameterTypeAt(0)); 532 const AbstractType& type = AbstractType::Handle(func.ParameterTypeAt(0));
534 context_scope.SetTypeAt(0, type); 533 context_scope.SetTypeAt(0, type);
535 context_scope.SetContextIndexAt(0, 0); 534 context_scope.SetContextIndexAt(0, 0);
536 context_scope.SetContextLevelAt(0, 0); 535 context_scope.SetContextLevelAt(0, 0);
537 ASSERT(context_scope.num_variables() == kNumCapturedVars); // Verify count. 536 ASSERT(context_scope.num_variables() == kNumCapturedVars); // Verify count.
538 return context_scope.raw(); 537 return context_scope.raw();
539 } 538 }
540 539
(...skipping 24 matching lines...) Expand all
565 } else { 564 } else {
566 // Shift negative indexes so that the lowest one is 0 (they are still 565 // Shift negative indexes so that the lowest one is 0 (they are still
567 // non-positive). 566 // non-positive).
568 return fixed_parameter_count - 567 return fixed_parameter_count -
569 (index() - ParsedFunction::kFirstLocalSlotIndex); 568 (index() - ParsedFunction::kFirstLocalSlotIndex);
570 } 569 }
571 } 570 }
572 571
573 572
574 } // namespace dart 573 } // namespace dart
OLDNEW
« no previous file with comments | « vm/parser.cc ('k') | vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698