• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 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 
15 namespace sh
16 {
17 
18 // A function look-up.
19 class 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     std::vector<ImmutableString> getMangledNamesForImplicitConversions() const;
32 
33     bool isConstructor() const;
34     const TType &constructorType() const;
35 
36     void setThisNode(TIntermTyped *thisNode);
37     TIntermTyped *thisNode() const;
38 
39     void addArgument(TIntermTyped *argument);
40     TIntermSequence &arguments();
41 
42     // Symbol looked up in the lexical phase using only the name of the function.
43     // This does not necessarily correspond to the correct overloaded function.
44     const TSymbol *symbol() const;
45 
46   private:
47     TFunctionLookup(const ImmutableString &name,
48                     const TType *constructorType,
49                     const TSymbol *symbol);
50 
51     const ImmutableString mName;
52     const TType *const mConstructorType;
53     TIntermTyped *mThisNode;
54     TIntermSequence mArguments;
55     const TSymbol *mSymbol;
56 };
57 
58 }  // namespace sh
59 
60 #endif  // COMPILER_TRANSLATOR_FUNCTIONLOOKUP_H_
61