Hash :
b6af22b5
Author :
Date :
2017-12-15T14:05:44
Store TVariable* in TIntermSymbol instead of storing id This is an intermediate step to only storing a TVariable * in TIntermSymbol instead of copying the name. This makes it possible to get a constant value out of a TIntermSymbol without doing a symbol table lookup. BUG=angleproject:2267 TEST=angle_unittests Change-Id: Ibff588241a4ad4ac330063296273288b20a072c9 Reviewed-on: https://chromium-review.googlesource.com/829142 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
//
// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SymbolUniqueId.cpp: Encapsulates a unique id for a symbol.
#include "compiler/translator/SymbolUniqueId.h"
#include "compiler/translator/SymbolTable.h"
namespace sh
{
TSymbolUniqueId::TSymbolUniqueId(TSymbolTable *symbolTable) : mId(symbolTable->nextUniqueIdValue())
{
}
TSymbolUniqueId::TSymbolUniqueId(const TSymbol &symbol) : mId(symbol.uniqueId().get())
{
}
TSymbolUniqueId::TSymbolUniqueId(const TSymbolUniqueId &) = default;
TSymbolUniqueId &TSymbolUniqueId::operator=(const TSymbolUniqueId &) = default;
int TSymbolUniqueId::get() const
{
return mId;
}
bool TSymbolUniqueId::operator==(const TSymbolUniqueId &other) const
{
return mId == other.mId;
}
} // namespace sh