V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
variables.cc
1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "src/ast/variables.h"
6 
7 #include "src/ast/scopes.h"
8 #include "src/globals.h"
9 #include "src/objects-inl.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 // ----------------------------------------------------------------------------
15 // Implementation Variable.
16 
17 Variable::Variable(Variable* other)
18  : scope_(other->scope_),
19  name_(other->name_),
20  local_if_not_shadowed_(nullptr),
21  next_(nullptr),
22  index_(other->index_),
23  initializer_position_(other->initializer_position_),
24  bit_field_(other->bit_field_) {}
25 
26 bool Variable::IsGlobalObjectProperty() const {
27  // Temporaries are never global, they must always be allocated in the
28  // activation frame.
29  return (IsDynamicVariableMode(mode()) || mode() == VariableMode::kVar) &&
30  scope_ != nullptr && scope_->is_script_scope();
31 }
32 
33 } // namespace internal
34 } // namespace v8
Definition: libplatform.h:13