src/NameBinding.cpp
author David Anderson <danderson@mozilla.com>
Wed Jul 25 01:30:33 2012 -0700 (2012-07-25)
changeset 92 e3974e7360e9
parent 86 32ad0523b309
child 137 be919b22085b
permissions -rw-r--r--
Add GCC/Linux support.
dvander@0
     1
/*
dvander@0
     2
 * Copyright (C) 2012 David Anderson
dvander@0
     3
 *
dvander@0
     4
 * This file is part of JITCraft.
dvander@0
     5
 *
dvander@0
     6
 * JITCraft is free software: you can redistribute it and/or modify it under
dvander@0
     7
 * the terms of the GNU General Public License as published by the Free
dvander@0
     8
 * Software Foundation, either version 3 of the License, or (at your option)
dvander@0
     9
 * any later version.
dvander@0
    10
 * 
dvander@0
    11
 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
dvander@0
    12
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@0
    13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
dvander@0
    14
 *
dvander@0
    15
 * You should have received a copy of the GNU General Public License along with
dvander@0
    16
 * JITCraft. If not, see http://www.gnu.org/licenses/.
dvander@0
    17
 */
dvander@0
    18
#include "NameBinding.h"
dvander@54
    19
#include "Strings.h"
dvander@47
    20
#include "Zone.h"
dvander@85
    21
#include "Scopes.h"
danderson@92
    22
#include "Spaces-inl.h"
danderson@92
    23
#include "Heap-inl.h"
dvander@0
    24
dvander@59
    25
using namespace ke;
dvander@0
    26
dvander@54
    27
BoundName::BoundName(Scope *scope, Handle<String> name, const SourcePosition &pos)
dvander@0
    28
  : scope_(scope),
dvander@21
    29
    name_(name),
dvander@25
    30
    type_(NULL),
dvander@25
    31
    pos_(pos)
dvander@0
    32
{
dvander@0
    33
}
dvander@0
    34
dvander@63
    35
NamedFunction::NamedFunction(Scope *scope, Handle<String> name, const SourcePosition &pos,
dvander@63
    36
                             TokenKind token)
dvander@63
    37
  : BoundName(scope, name, pos),
dvander@68
    38
    token_(token),
dvander@68
    39
    isVariadicNative_(false)
dvander@0
    40
{
dvander@0
    41
}
dvander@0
    42
dvander@54
    43
Variable::Variable(Scope *scope, Handle<String> name, const SourcePosition &pos)
dvander@25
    44
  : BoundName(scope, name, pos),
dvander@0
    45
    location_(UNALLOCATED)
dvander@0
    46
{
dvander@0
    47
}
dvander@85
    48
dvander@85
    49
bool
dvander@85
    50
Variable::needsHeapAllocation()
dvander@85
    51
{
dvander@85
    52
    return scope()->kind() == Scope::GLOBAL;
dvander@85
    53
}