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

Side by Side Diff: src/scopes.cc

Issue 994043003: [strong] More scoping related errors: object literal methods. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: moar code reviews Created 5 years, 9 months 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/messages.h" 9 #include "src/messages.h"
10 #include "src/parser.h" 10 #include "src/parser.h"
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 ReportMessage(proxy->position(), proxy->end_position(), 1150 ReportMessage(proxy->position(), proxy->end_position(),
1151 "strong_use_before_declaration", proxy->raw_name()); 1151 "strong_use_before_declaration", proxy->raw_name());
1152 return false; 1152 return false;
1153 } 1153 }
1154 return true; 1154 return true;
1155 } 1155 }
1156 1156
1157 1157
1158 Variable* Scope::ClassVariableForMethod() const { 1158 Variable* Scope::ClassVariableForMethod() const {
1159 if (!is_function_scope()) return nullptr; 1159 if (!is_function_scope()) return nullptr;
1160 if (IsInObjectLiteral(function_kind_)) return nullptr;
1160 if (!IsConciseMethod(function_kind_) && !IsConstructor(function_kind_) && 1161 if (!IsConciseMethod(function_kind_) && !IsConstructor(function_kind_) &&
1161 !IsAccessorFunction(function_kind_)) { 1162 !IsAccessorFunction(function_kind_)) {
1162 return nullptr; 1163 return nullptr;
1163 } 1164 }
1164 DCHECK_NOT_NULL(outer_scope_); 1165 DCHECK_NOT_NULL(outer_scope_);
1165 DCHECK(outer_scope_->is_class_scope()); 1166 DCHECK(outer_scope_->is_class_scope());
1166 // The class scope contains at most one variable, the class name. 1167 // The class scope contains at most one variable, the class name.
1167 DCHECK(outer_scope_->variables_.occupancy() <= 1); 1168 DCHECK(outer_scope_->variables_.occupancy() <= 1);
1168 if (outer_scope_->variables_.occupancy() == 0) return nullptr; 1169 if (outer_scope_->variables_.occupancy() == 0) return nullptr;
1169 VariableMap::Entry* p = outer_scope_->variables_.Start(); 1170 VariableMap::Entry* p = outer_scope_->variables_.Start();
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); 1459 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0);
1459 } 1460 }
1460 1461
1461 1462
1462 int Scope::ContextLocalCount() const { 1463 int Scope::ContextLocalCount() const {
1463 if (num_heap_slots() == 0) return 0; 1464 if (num_heap_slots() == 0) return 0;
1464 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 1465 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
1465 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); 1466 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0);
1466 } 1467 }
1467 } } // namespace v8::internal 1468 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698