| Index: runtime/vm/scopes.cc
|
| diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
|
| index ed69838d920514df63e8d4d533f6190c64df2a27..d0f72d670b034519237fe656523434f1f211b7df 100644
|
| --- a/runtime/vm/scopes.cc
|
| +++ b/runtime/vm/scopes.cc
|
| @@ -22,7 +22,6 @@ int SourceLabel::FunctionLevel() const {
|
| return owner()->function_level();
|
| }
|
|
|
| -
|
| LocalScope::LocalScope(LocalScope* parent, int function_level, int loop_level)
|
| : parent_(parent),
|
| child_(NULL),
|
| @@ -45,7 +44,6 @@ LocalScope::LocalScope(LocalScope* parent, int function_level, int loop_level)
|
| }
|
| }
|
|
|
| -
|
| bool LocalScope::IsNestedWithin(LocalScope* scope) const {
|
| const LocalScope* current_scope = this;
|
| while (current_scope != NULL) {
|
| @@ -57,7 +55,6 @@ bool LocalScope::IsNestedWithin(LocalScope* scope) const {
|
| return false;
|
| }
|
|
|
| -
|
| bool LocalScope::AddVariable(LocalVariable* variable) {
|
| ASSERT(variable != NULL);
|
| if (LocalLookupVariable(variable->name()) != NULL) {
|
| @@ -72,7 +69,6 @@ bool LocalScope::AddVariable(LocalVariable* variable) {
|
| return true;
|
| }
|
|
|
| -
|
| bool LocalScope::InsertParameterAt(intptr_t pos, LocalVariable* parameter) {
|
| ASSERT(parameter != NULL);
|
| if (LocalLookupVariable(parameter->name()) != NULL) {
|
| @@ -85,7 +81,6 @@ bool LocalScope::InsertParameterAt(intptr_t pos, LocalVariable* parameter) {
|
| return true;
|
| }
|
|
|
| -
|
| bool LocalScope::AddLabel(SourceLabel* label) {
|
| if (LocalLookupLabel(label->name()) != NULL) {
|
| return false;
|
| @@ -99,7 +94,6 @@ bool LocalScope::AddLabel(SourceLabel* label) {
|
| return true;
|
| }
|
|
|
| -
|
| void LocalScope::MoveLabel(SourceLabel* label) {
|
| ASSERT(LocalLookupLabel(label->name()) == NULL);
|
| ASSERT(label->kind() == SourceLabel::kForward);
|
| @@ -107,7 +101,6 @@ void LocalScope::MoveLabel(SourceLabel* label) {
|
| label->set_owner(this);
|
| }
|
|
|
| -
|
| NameReference* LocalScope::FindReference(const String& name) const {
|
| ASSERT(name.IsSymbol());
|
| intptr_t num_references = referenced_.length();
|
| @@ -119,7 +112,6 @@ NameReference* LocalScope::FindReference(const String& name) const {
|
| return NULL;
|
| }
|
|
|
| -
|
| void LocalScope::AddReferencedName(TokenPosition token_pos,
|
| const String& name) {
|
| if (LocalLookupVariable(name) != NULL) {
|
| @@ -141,7 +133,6 @@ void LocalScope::AddReferencedName(TokenPosition token_pos,
|
| }
|
| }
|
|
|
| -
|
| TokenPosition LocalScope::PreviousReferencePos(const String& name) const {
|
| NameReference* ref = FindReference(name);
|
| if (ref != NULL) {
|
| @@ -150,7 +141,6 @@ TokenPosition LocalScope::PreviousReferencePos(const String& name) const {
|
| return TokenPosition::kNoSource;
|
| }
|
|
|
| -
|
| void LocalScope::AllocateContextVariable(LocalVariable* variable,
|
| LocalScope** context_owner) {
|
| ASSERT(variable->is_captured());
|
| @@ -191,7 +181,6 @@ void LocalScope::AllocateContextVariable(LocalVariable* variable,
|
| variable->set_index((*context_owner)->num_context_variables_++);
|
| }
|
|
|
| -
|
| int LocalScope::AllocateVariables(int first_parameter_index,
|
| int num_parameters,
|
| int first_frame_index,
|
| @@ -266,7 +255,6 @@ int LocalScope::AllocateVariables(int first_parameter_index,
|
| return min_frame_index;
|
| }
|
|
|
| -
|
| // The parser creates internal variables that start with ":"
|
| static bool IsFilteredIdentifier(const String& str) {
|
| ASSERT(str.Length() > 0);
|
| @@ -293,7 +281,6 @@ static bool IsFilteredIdentifier(const String& str) {
|
| return str.CharAt(0) == ':';
|
| }
|
|
|
| -
|
| RawLocalVarDescriptors* LocalScope::GetVarDescriptors(
|
| const Function& func,
|
| ZoneGrowableArray<intptr_t>* context_level_array) {
|
| @@ -371,7 +358,6 @@ RawLocalVarDescriptors* LocalScope::GetVarDescriptors(
|
| return var_desc.raw();
|
| }
|
|
|
| -
|
| // Add visible variables that are declared in this scope to vars, then
|
| // collect visible variables of children, followed by siblings.
|
| void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars,
|
| @@ -420,7 +406,6 @@ void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars,
|
| }
|
| }
|
|
|
| -
|
| SourceLabel* LocalScope::LocalLookupLabel(const String& name) const {
|
| ASSERT(name.IsSymbol());
|
| for (intptr_t i = 0; i < labels_.length(); i++) {
|
| @@ -432,7 +417,6 @@ SourceLabel* LocalScope::LocalLookupLabel(const String& name) const {
|
| return NULL;
|
| }
|
|
|
| -
|
| LocalVariable* LocalScope::LocalLookupVariable(const String& name) const {
|
| ASSERT(name.IsSymbol());
|
| for (intptr_t i = 0; i < variables_.length(); i++) {
|
| @@ -445,7 +429,6 @@ LocalVariable* LocalScope::LocalLookupVariable(const String& name) const {
|
| return NULL;
|
| }
|
|
|
| -
|
| LocalVariable* LocalScope::LookupVariable(const String& name, bool test_only) {
|
| LocalScope* current_scope = this;
|
| while (current_scope != NULL) {
|
| @@ -462,7 +445,6 @@ LocalVariable* LocalScope::LookupVariable(const String& name, bool test_only) {
|
| return NULL;
|
| }
|
|
|
| -
|
| void LocalScope::CaptureVariable(LocalVariable* variable) {
|
| ASSERT(variable != NULL);
|
| // The variable must exist in an enclosing scope, not necessarily in this one.
|
| @@ -488,7 +470,6 @@ void LocalScope::CaptureVariable(LocalVariable* variable) {
|
| }
|
| }
|
|
|
| -
|
| SourceLabel* LocalScope::LookupLabel(const String& name) {
|
| LocalScope* current_scope = this;
|
| while (current_scope != NULL) {
|
| @@ -501,7 +482,6 @@ SourceLabel* LocalScope::LookupLabel(const String& name) {
|
| return NULL;
|
| }
|
|
|
| -
|
| SourceLabel* LocalScope::LookupInnermostLabel(Token::Kind jump_kind) {
|
| ASSERT((jump_kind == Token::kCONTINUE) || (jump_kind == Token::kBREAK));
|
| LocalScope* current_scope = this;
|
| @@ -521,7 +501,6 @@ SourceLabel* LocalScope::LookupInnermostLabel(Token::Kind jump_kind) {
|
| return NULL;
|
| }
|
|
|
| -
|
| LocalScope* LocalScope::LookupSwitchScope() {
|
| LocalScope* current_scope = this->parent();
|
| int this_level = this->function_level();
|
| @@ -541,7 +520,6 @@ LocalScope* LocalScope::LookupSwitchScope() {
|
| return NULL;
|
| }
|
|
|
| -
|
| SourceLabel* LocalScope::CheckUnresolvedLabels() {
|
| for (int i = 0; i < this->labels_.length(); i++) {
|
| SourceLabel* label = this->labels_[i];
|
| @@ -557,7 +535,6 @@ SourceLabel* LocalScope::CheckUnresolvedLabels() {
|
| return NULL;
|
| }
|
|
|
| -
|
| int LocalScope::NumCapturedVariables() const {
|
| // It is not necessary to traverse parent scopes, since we are only interested
|
| // in the captured variables referenced in this scope. If this scope is the
|
| @@ -582,7 +559,6 @@ int LocalScope::NumCapturedVariables() const {
|
| return num_captured;
|
| }
|
|
|
| -
|
| RawContextScope* LocalScope::PreserveOuterScope(
|
| int current_context_level) const {
|
| // Since code generation for nested functions is postponed until first
|
| @@ -628,7 +604,6 @@ RawContextScope* LocalScope::PreserveOuterScope(
|
| return context_scope.raw();
|
| }
|
|
|
| -
|
| LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) {
|
| // The function level of the outer scope is one less than the function level
|
| // of the current function, which is 0.
|
| @@ -667,7 +642,6 @@ LocalScope* LocalScope::RestoreOuterScope(const ContextScope& context_scope) {
|
| return outer_scope;
|
| }
|
|
|
| -
|
| void LocalScope::CaptureLocalVariables(LocalScope* top_scope) {
|
| ASSERT(top_scope->function_level() == function_level());
|
| LocalScope* scope = this;
|
| @@ -688,7 +662,6 @@ void LocalScope::CaptureLocalVariables(LocalScope* top_scope) {
|
| }
|
| }
|
|
|
| -
|
| RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) {
|
| static const intptr_t kNumCapturedVars = 1;
|
|
|
| @@ -710,7 +683,6 @@ RawContextScope* LocalScope::CreateImplicitClosureScope(const Function& func) {
|
| return context_scope.raw();
|
| }
|
|
|
| -
|
| bool LocalVariable::Equals(const LocalVariable& other) const {
|
| if (HasIndex() && other.HasIndex() && (index() == other.index())) {
|
| if (is_captured() == other.is_captured()) {
|
| @@ -725,7 +697,6 @@ bool LocalVariable::Equals(const LocalVariable& other) const {
|
| return false;
|
| }
|
|
|
| -
|
| int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const {
|
| ASSERT(!is_captured());
|
| // Parameters have positive indexes with the lowest index being
|
| @@ -741,5 +712,4 @@ int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const {
|
| }
|
| }
|
|
|
| -
|
| } // namespace dart
|
|
|