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

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

Issue 8761011: Renaming type classes as discussed: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/object.h" 8 #include "vm/object.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 365
366 366
367 LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) { 367 LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) {
368 LocalScope* outer_scope = new LocalScope(NULL, 0, 0); 368 LocalScope* outer_scope = new LocalScope(NULL, 0, 0);
369 // Add all variables as aliases to the outer scope. 369 // Add all variables as aliases to the outer scope.
370 for (int i = 0; i < context_scope.num_variables(); i++) { 370 for (int i = 0; i < context_scope.num_variables(); i++) {
371 LocalVariable* variable = 371 LocalVariable* variable =
372 new LocalVariable(context_scope.TokenIndexAt(i), 372 new LocalVariable(context_scope.TokenIndexAt(i),
373 String::ZoneHandle(context_scope.NameAt(i)), 373 String::ZoneHandle(context_scope.NameAt(i)),
374 Type::ZoneHandle(context_scope.TypeAt(i))); 374 AbstractType::ZoneHandle(context_scope.TypeAt(i)));
375 variable->set_is_captured(); 375 variable->set_is_captured();
376 variable->set_index(context_scope.ContextIndexAt(i)); 376 variable->set_index(context_scope.ContextIndexAt(i));
377 if (context_scope.IsFinalAt(i)) { 377 if (context_scope.IsFinalAt(i)) {
378 variable->set_is_final(); 378 variable->set_is_final();
379 } 379 }
380 // Create a fake owner scope describing the index and context level of the 380 // Create a fake owner scope describing the index and context level of the
381 // variable. Function level and loop level are unused (set to 0), since 381 // variable. Function level and loop level are unused (set to 0), since
382 // context level has already been assigned. 382 // context level has already been assigned.
383 LocalScope* owner_scope = new LocalScope(NULL, 0, 0); 383 LocalScope* owner_scope = new LocalScope(NULL, 0, 0);
384 owner_scope->set_context_level(context_scope.ContextLevelAt(i)); 384 owner_scope->set_context_level(context_scope.ContextLevelAt(i));
(...skipping 10 matching lines...) Expand all
395 395
396 // Create a ContextScope with space for kNumCapturedVars descriptors. 396 // Create a ContextScope with space for kNumCapturedVars descriptors.
397 const ContextScope& context_scope = 397 const ContextScope& context_scope =
398 ContextScope::Handle(ContextScope::New(kNumCapturedVars)); 398 ContextScope::Handle(ContextScope::New(kNumCapturedVars));
399 399
400 // Create a descriptor for 'this' variable. 400 // Create a descriptor for 'this' variable.
401 const String& name = String::Handle(String::NewSymbol("this")); 401 const String& name = String::Handle(String::NewSymbol("this"));
402 context_scope.SetTokenIndexAt(0, func.token_index()); 402 context_scope.SetTokenIndexAt(0, func.token_index());
403 context_scope.SetNameAt(0, name); 403 context_scope.SetNameAt(0, name);
404 context_scope.SetIsFinalAt(0, true); 404 context_scope.SetIsFinalAt(0, true);
405 const Type& type = Type::Handle(func.ParameterTypeAt(0)); 405 const AbstractType& type = AbstractType::Handle(func.ParameterTypeAt(0));
406 context_scope.SetTypeAt(0, type); 406 context_scope.SetTypeAt(0, type);
407 context_scope.SetContextIndexAt(0, 0); 407 context_scope.SetContextIndexAt(0, 0);
408 context_scope.SetContextLevelAt(0, 0); 408 context_scope.SetContextLevelAt(0, 0);
409 ASSERT(context_scope.num_variables() == kNumCapturedVars); // Verify count. 409 ASSERT(context_scope.num_variables() == kNumCapturedVars); // Verify count.
410 return context_scope.raw(); 410 return context_scope.raw();
411 } 411 }
412 412
413 } // namespace dart 413 } // namespace dart
OLDNEW
« runtime/vm/raw_object.h ('K') | « runtime/vm/scopes.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698