1//
2// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// FunctionLookup.h: Used for storing function calls that have not yet been resolved during parsing.
7//
8
9#ifndef COMPILER_TRANSLATOR_FUNCTIONLOOKUP_H_
10#define COMPILER_TRANSLATOR_FUNCTIONLOOKUP_H_
11
12#include "compiler/translator/ImmutableString.h"
13#include "compiler/translator/IntermNode.h"
14
15namespace sh
16{
17
18// A function look-up.
19class TFunctionLookup : angle::NonCopyable
20{
21 public:
22 POOL_ALLOCATOR_NEW_DELETE
23
24 static TFunctionLookup *CreateConstructor(const TType *type);
25 static TFunctionLookup *CreateFunctionCall(const ImmutableString &name, const TSymbol *symbol);
26
27 const ImmutableString &name() const;
28 ImmutableString getMangledName() const;
29 static ImmutableString GetMangledName(const char *functionName,
30 const TIntermSequence &arguments);
31
32 bool isConstructor() const;
33 const TType &constructorType() const;
34
35 void setThisNode(TIntermTyped *thisNode);
36 TIntermTyped *thisNode() const;
37
38 void addArgument(TIntermTyped *argument);
39 TIntermSequence &arguments();
40
41 // Symbol looked up in the lexical phase using only the name of the function.
42 // This does not necessarily correspond to the correct overloaded function.
43 const TSymbol *symbol() const;
44
45 private:
46 TFunctionLookup(const ImmutableString &name,
47 const TType *constructorType,
48 const TSymbol *symbol);
49
50 const ImmutableString mName;
51 const TType *const mConstructorType;
52 TIntermTyped *mThisNode;
53 TIntermSequence mArguments;
54 const TSymbol *mSymbol;
55};
56
57} // namespace sh
58
59#endif // COMPILER_TRANSLATOR_FUNCTIONLOOKUP_H_
60