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

Unified Diff: src/scopes.h

Issue 1083193005: WIP: new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix return from new func Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 409fa2f2523f58c492670ca4b3188d6e31167dd5..af8e878565ebac18a48e0c78d23ac06509dd9284 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -142,14 +142,15 @@ class Scope: public ZoneObject {
// Create a new unresolved variable.
VariableProxy* NewUnresolved(AstNodeFactory* factory,
const AstRawString* name,
+ Variable::Kind kind = Variable::NORMAL,
int start_position = RelocInfo::kNoPosition,
int end_position = RelocInfo::kNoPosition) {
// Note that we must not share the unresolved variables with
// the same name because they may be removed selectively via
// RemoveUnresolved().
DCHECK(!already_resolved());
- VariableProxy* proxy = factory->NewVariableProxy(
- name, Variable::NORMAL, start_position, end_position);
+ VariableProxy* proxy =
+ factory->NewVariableProxy(name, kind, start_position, end_position);
unresolved_.Add(proxy, zone_);
return proxy;
}
@@ -218,6 +219,9 @@ class Scope: public ZoneObject {
// Inform the scope that the corresponding code uses "this".
void RecordThisUsage() { scope_uses_this_ = true; }
+ // Inform the scope that the corresponding code uses "new.target".
+ void RecordNewTargetUsage() { scope_uses_new_target_ = true; }
+
// Set the language mode flag (unless disabled by a global flag).
void SetLanguageMode(LanguageMode language_mode) {
language_mode_ = language_mode;
@@ -325,6 +329,13 @@ class Scope: public ZoneObject {
bool uses_this() const { return scope_uses_this_; }
// Does any inner scope access "this".
bool inner_uses_this() const { return inner_scope_uses_this_; }
+ // Does this scope access "new.target".
+ bool uses_new_target() const {
+ return scope_uses_new_target_ || inner_scope_uses_new_target_;
+ }
+ // Does any inner scope access "new.target".
+ bool inner_uses_new_target() const { return inner_scope_uses_new_target_; }
+
const Scope* NearestOuterEvalScope() const {
if (is_eval_scope()) return this;
@@ -568,6 +579,8 @@ class Scope: public ZoneObject {
bool scope_uses_super_property_;
// This scope uses "this".
bool scope_uses_this_;
+ // This scope uses "new.target".
+ bool scope_uses_new_target_;
// This scope contains an "use asm" annotation.
bool asm_module_;
// This scope's outer context is an asm module.
@@ -584,6 +597,7 @@ class Scope: public ZoneObject {
bool inner_scope_uses_arguments_;
bool inner_scope_uses_super_property_;
bool inner_scope_uses_this_;
+ bool inner_scope_uses_new_target_;
bool force_eager_compilation_;
bool force_context_allocation_;
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698