Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/typebuilder.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 35 | public: | |||
---|---|---|---|---|---|
47 | 47 | | |||
48 | /** | 48 | /** | ||
49 | * When building named types we often have IdentifierAst instead of TypeNameAst, | 49 | * When building named types we often have IdentifierAst instead of TypeNameAst, | ||
50 | * so it makes sense to have this convenience function | 50 | * so it makes sense to have this convenience function | ||
51 | **/ | 51 | **/ | ||
52 | void buildTypeName(go::IdentifierAst* typeName, go::IdentifierAst* fullName = 0); | 52 | void buildTypeName(go::IdentifierAst* typeName, go::IdentifierAst* fullName = 0); | ||
53 | 53 | | |||
54 | /** | 54 | /** | ||
55 | * A shortcut for ExpressionVisitor to build function type | | |||
56 | **/ | | |||
57 | void buildFunction(go::SignatureAst* node, go::BlockAst* block=0); | | |||
58 | | ||||
59 | /** | | |||
60 | * Used by external classes like ExpressionVisitor after building a type. | 55 | * Used by external classes like ExpressionVisitor after building a type. | ||
61 | */ | 56 | */ | ||
62 | AbstractType::Ptr getLastType() { return lastType(); } | 57 | AbstractType::Ptr getLastType() { return lastType(); } | ||
63 | 58 | | |||
64 | protected: | 59 | protected: | ||
65 | 60 | | |||
66 | //when building some types we need to open declarations | 61 | //when building some types we need to open declarations | ||
67 | //so next methods are placeholders for that, which will be implemented in DeclarationBuilder | 62 | //so next methods are placeholders for that, which will be implemented in DeclarationBuilder | ||
68 | //that way we can keep type building logic in TypeBuilder | 63 | //that way we can keep type building logic in TypeBuilder | ||
69 | 64 | | |||
70 | /** | 65 | /** | ||
71 | * declared here as pure virtual so we can use that when building functions, structs and interfaces. | 66 | * declared here as pure virtual so we can use that when building functions, structs and interfaces. | ||
72 | **/ | 67 | **/ | ||
73 | virtual void declareVariable(go::IdentifierAst* id, const KDevelop::AbstractType::Ptr& type) = 0; | 68 | virtual void declareVariable(go::IdentifierAst* id, const KDevelop::AbstractType::Ptr& type) = 0; | ||
74 | 69 | | |||
75 | /** | 70 | /** | ||
76 | * declared here as pure virtual so we can use that when building functions | 71 | * declared here as pure virtual so we can use that when building functions | ||
77 | **/ | 72 | **/ | ||
78 | virtual GoFunctionDeclaration* declareFunction(go::IdentifierAst* id, const GoFunctionType::Ptr& type, | 73 | virtual GoFunctionDeclaration* declareFunction(go::IdentifierAst* id, const GoFunctionType::Ptr& type, | ||
79 | DUContext* paramContext, DUContext* retparamContext, const QByteArray& comment=QByteArray()) = 0; | 74 | DUContext* paramContext, DUContext* retparamContext, const QByteArray& comment=QByteArray(), DUContext* bodyContext = nullptr) = 0; | ||
80 | | ||||
81 | | ||||
82 | 75 | | |||
83 | /** | 76 | /** | ||
84 | * opens GoFunctionType, parses it's parameters and return declaration if @param declareParameters is true. | 77 | * opens GoFunctionType, parses it's parameters and return declaration if @param declareParameters is true. | ||
85 | **/ | 78 | **/ | ||
86 | go::GoFunctionDeclaration* parseSignature(go::SignatureAst* node, bool declareParameters, go::IdentifierAst* name=0, const QByteArray& comment=QByteArray()); | 79 | go::GoFunctionDeclaration* parseSignature(go::SignatureAst* node, bool declareParameters, DUContext* bodyContext = nullptr, go::IdentifierAst* name=0, const QByteArray& comment=QByteArray()); | ||
87 | 80 | | |||
88 | /** | 81 | /** | ||
89 | * Convenience function that parses function parameters. | 82 | * Convenience function that parses function parameters. | ||
90 | * @param parseParemeters if true - add parameter to function arguments, otherwise add it to return params | 83 | * @param parseParemeters if true - add parameter to function arguments, otherwise add it to return params | ||
91 | * @param declareParameters open parameter declarations if true | 84 | * @param declareParameters open parameter declarations if true | ||
92 | **/ | 85 | **/ | ||
93 | void parseParameters(go::ParametersAst* node, bool parseParameters=true, bool declareParameters=false); | 86 | void parseParameters(go::ParametersAst* node, bool parseParameters=true, bool declareParameters=false); | ||
94 | 87 | | |||
Show All 13 Lines |