Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/duchaintestbase.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 104 | { | |||
---|---|---|---|---|---|
114 | } | 114 | } | ||
115 | return false; | 115 | return false; | ||
116 | } | 116 | } | ||
117 | 117 | | |||
118 | TopDUContext* DUChainTestBase::parseAdditionalFile(const IndexedString& fileName, const QByteArray& contents) | 118 | TopDUContext* DUChainTestBase::parseAdditionalFile(const IndexedString& fileName, const QByteArray& contents) | ||
119 | { | 119 | { | ||
120 | ParseSession session; | 120 | ParseSession session; | ||
121 | session.setContents(contents); | 121 | session.setContents(contents); | ||
122 | StartAst* ast = 0; | 122 | StartAst* ast = nullptr; | ||
123 | if (!session.parse(&ast)) qFatal("can't parse"); | 123 | if (!session.parse(&ast)) qFatal("can't parse"); | ||
124 | 124 | | |||
125 | EditorIntegrator editor(&session); | 125 | EditorIntegrator editor(&session); | ||
126 | session.setCurrentDocument(fileName); | 126 | session.setCurrentDocument(fileName); | ||
127 | DeclarationBuilder declarationBuilder(&editor); | 127 | DeclarationBuilder declarationBuilder(&editor); | ||
128 | TopDUContext* top = declarationBuilder.build(fileName, ast); | 128 | TopDUContext* top = declarationBuilder.build(fileName, ast); | ||
129 | 129 | | |||
130 | if ( fileName != internalFunctionFile() ) { | 130 | if ( fileName != internalFunctionFile() ) { | ||
Show All 14 Lines | |||||
145 | TopDUContext* DUChainTestBase::parse(const QByteArray& unit, DumpAreas dump, | 145 | TopDUContext* DUChainTestBase::parse(const QByteArray& unit, DumpAreas dump, | ||
146 | QUrl url, TopDUContext* update) | 146 | QUrl url, TopDUContext* update) | ||
147 | { | 147 | { | ||
148 | if (dump) | 148 | if (dump) | ||
149 | qDebug() << "==== Beginning new test case...:" << endl << unit; | 149 | qDebug() << "==== Beginning new test case...:" << endl << unit; | ||
150 | 150 | | |||
151 | ParseSession session; | 151 | ParseSession session; | ||
152 | session.setContents(unit); | 152 | session.setContents(unit); | ||
153 | StartAst* ast = 0; | 153 | StartAst* ast = nullptr; | ||
154 | if (!session.parse(&ast)) { | 154 | if (!session.parse(&ast)) { | ||
155 | qDebug() << "Parse failed"; | 155 | qDebug() << "Parse failed"; | ||
156 | return 0; | 156 | return nullptr; | ||
157 | } | 157 | } | ||
158 | 158 | | |||
159 | if (dump & DumpAST) { | 159 | if (dump & DumpAST) { | ||
160 | qDebug() << "===== AST:"; | 160 | qDebug() << "===== AST:"; | ||
161 | DebugVisitor debugVisitor(session.tokenStream(), session.contents()); | 161 | DebugVisitor debugVisitor(session.tokenStream(), session.contents()); | ||
162 | debugVisitor.visitNode(ast); | 162 | debugVisitor.visitNode(ast); | ||
163 | } | 163 | } | ||
164 | 164 | | |||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |