blob: eaa3141e42a0646b4c0b06d005560da8b9c5231d [file] [log] [blame]
Andreas Huber1aec3972016-08-26 09:26:32 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Andreas Huberc9410c72016-07-28 12:18:40 -070017#include "AST.h"
18
Andreas Huber5345ec22016-07-29 13:33:27 -070019#include "Coordinator.h"
Yifan Hongf24fa852016-09-23 11:03:15 -070020#include "EnumType.h"
Andreas Huber84f89de2016-07-28 15:39:51 -070021#include "FQName.h"
Andreas Hubereb1081f2016-07-28 13:13:24 -070022#include "HandleType.h"
Andreas Huberbfd76212016-08-09 11:12:16 -070023#include "Interface.h"
Yifan Honga4b53d02016-10-31 17:29:10 -070024#include "Location.h"
Andreas Huber4b2cf352016-08-31 13:58:19 -070025#include "PredefinedType.h"
Andreas Huberc9410c72016-07-28 12:18:40 -070026#include "Scope.h"
Andreas Huber8d3ac0c2016-08-04 14:49:23 -070027#include "TypeDef.h"
Andreas Huberc9410c72016-07-28 12:18:40 -070028
Iliyan Malcheva72e0d22016-09-09 11:03:08 -070029#include <hidl-util/Formatter.h>
Andreas Hubereb1081f2016-07-28 13:13:24 -070030#include <android-base/logging.h>
Andreas Huber39fa7182016-08-19 14:27:33 -070031#include <iostream>
Andreas Huberc9410c72016-07-28 12:18:40 -070032#include <stdlib.h>
33
Andreas Huberc9410c72016-07-28 12:18:40 -070034namespace android {
35
Andreas Huber0d0f9a22016-08-17 10:26:11 -070036AST::AST(Coordinator *coordinator, const std::string &path)
Andreas Huber5345ec22016-07-29 13:33:27 -070037 : mCoordinator(coordinator),
Andreas Huber0d0f9a22016-08-17 10:26:11 -070038 mPath(path),
Andreas Huber5345ec22016-07-29 13:33:27 -070039 mScanner(NULL),
Yifan Honga4b53d02016-10-31 17:29:10 -070040 mRootScope(new Scope("" /* localName */, Location::startOf(path))) {
Andreas Huberc9410c72016-07-28 12:18:40 -070041 enterScope(mRootScope);
42}
43
44AST::~AST() {
Andreas Huberc9410c72016-07-28 12:18:40 -070045 delete mRootScope;
Yifan Hong1977ea32016-10-05 12:49:08 -070046 mRootScope = nullptr;
Andreas Huberc9410c72016-07-28 12:18:40 -070047
Andreas Hubereb1081f2016-07-28 13:13:24 -070048 CHECK(mScanner == NULL);
Andreas Huberc9410c72016-07-28 12:18:40 -070049
Andreas Huber5345ec22016-07-29 13:33:27 -070050 // Ownership of "coordinator" was NOT transferred.
Andreas Huberc9410c72016-07-28 12:18:40 -070051}
52
Yifan Hongbe627b32016-10-28 18:38:56 -070053// used by the parser.
54void AST::addSyntaxError() {
55 mSyntaxErrors++;
56}
57
58size_t AST::syntaxErrors() const {
59 return mSyntaxErrors;
60}
61
Andreas Huberc9410c72016-07-28 12:18:40 -070062void *AST::scanner() {
63 return mScanner;
64}
65
66void AST::setScanner(void *scanner) {
67 mScanner = scanner;
68}
69
Andreas Huber0d0f9a22016-08-17 10:26:11 -070070const std::string &AST::getFilename() const {
71 return mPath;
72}
73
Andreas Huber84f89de2016-07-28 15:39:51 -070074bool AST::setPackage(const char *package) {
Andreas Huberda51b8e2016-07-28 16:00:57 -070075 mPackage.setTo(package);
76 CHECK(mPackage.isValid());
Andreas Huber84f89de2016-07-28 15:39:51 -070077
Andreas Huberda51b8e2016-07-28 16:00:57 -070078 if (mPackage.package().empty()
79 || mPackage.version().empty()
80 || !mPackage.name().empty()) {
Andreas Huber84f89de2016-07-28 15:39:51 -070081 return false;
82 }
83
Andreas Huber84f89de2016-07-28 15:39:51 -070084 return true;
Andreas Hubereb1081f2016-07-28 13:13:24 -070085}
86
Andreas Hubera2723d22016-07-29 15:36:07 -070087FQName AST::package() const {
88 return mPackage;
89}
90
91bool AST::isInterface(std::string *ifaceName) const {
92 return mRootScope->containsSingleInterface(ifaceName);
93}
94
Andreas Huber7c5ddfb2016-09-29 13:45:22 -070095bool AST::containsInterfaces() const {
96 return mRootScope->containsInterfaces();
97}
98
Andreas Huber5345ec22016-07-29 13:33:27 -070099bool AST::addImport(const char *import) {
100 FQName fqName(import);
101 CHECK(fqName.isValid());
Andreas Hubereb1081f2016-07-28 13:13:24 -0700102
Andreas Huber5345ec22016-07-29 13:33:27 -0700103 fqName.applyDefaults(mPackage.package(), mPackage.version());
104
Andreas Huber68f24592016-07-29 14:53:48 -0700105 // LOG(INFO) << "importing " << fqName.string();
Andreas Huber5345ec22016-07-29 13:33:27 -0700106
107 if (fqName.name().empty()) {
Yifan Hong1977ea32016-10-05 12:49:08 -0700108 // import a package
Andreas Huberd2943e12016-08-05 11:59:31 -0700109 std::vector<FQName> packageInterfaces;
Andreas Huber68f24592016-07-29 14:53:48 -0700110
Andreas Huberd2943e12016-08-05 11:59:31 -0700111 status_t err =
Steven Morelandaa186832016-09-26 13:51:43 -0700112 mCoordinator->appendPackageInterfacesToVector(fqName,
113 &packageInterfaces);
Andreas Huberd2943e12016-08-05 11:59:31 -0700114
115 if (err != OK) {
Andreas Huber68f24592016-07-29 14:53:48 -0700116 return false;
117 }
118
Andreas Huberd2943e12016-08-05 11:59:31 -0700119 for (const auto &subFQName : packageInterfaces) {
Andreas Huber39fa7182016-08-19 14:27:33 -0700120 AST *ast = mCoordinator->parse(subFQName, &mImportedASTs);
Yifan Hong1977ea32016-10-05 12:49:08 -0700121 if (ast == nullptr) {
Andreas Huber68f24592016-07-29 14:53:48 -0700122 return false;
123 }
Yifan Hong1977ea32016-10-05 12:49:08 -0700124 // all previous single type imports are ignored.
125 mImportedTypes.erase(ast);
Andreas Huber68f24592016-07-29 14:53:48 -0700126 }
127
128 return true;
Andreas Huber5345ec22016-07-29 13:33:27 -0700129 }
130
Yifan Hong1977ea32016-10-05 12:49:08 -0700131 AST *importAST;
Andreas Huber5345ec22016-07-29 13:33:27 -0700132
Yifan Hong1977ea32016-10-05 12:49:08 -0700133 // cases like android.hardware.foo@1.0::IFoo.Internal
134 // android.hardware.foo@1.0::Abc.Internal
135
136 // assume it is an interface, and try to import it.
137 const FQName interfaceName = fqName.getTopLevelType();
138 importAST = mCoordinator->parse(interfaceName, &mImportedASTs);
139
140 if (importAST != nullptr) {
141 // cases like android.hardware.foo@1.0::IFoo.Internal
142 // and android.hardware.foo@1.0::IFoo
143 if (fqName == interfaceName) {
144 // import a single file.
145 // all previous single type imports are ignored.
146 // cases like android.hardware.foo@1.0::IFoo
147 // and android.hardware.foo@1.0::types
148 mImportedTypes.erase(importAST);
149 return true;
150 }
151
152 // import a single type from this file
153 // cases like android.hardware.foo@1.0::IFoo.Internal
154 FQName matchingName;
155 Type *match = importAST->findDefinedType(fqName, &matchingName);
156 if (match == nullptr) {
157 return false;
158 }
159 // will automatically create a set if it does not exist
160 mImportedTypes[importAST].insert(match);
161 return true;
Andreas Huber68f24592016-07-29 14:53:48 -0700162 }
Andreas Huber84f89de2016-07-28 15:39:51 -0700163
Yifan Hong1977ea32016-10-05 12:49:08 -0700164 // probably a type in types.hal, like android.hardware.foo@1.0::Abc.Internal
165 FQName typesFQName = fqName.getTypesForPackage();
166 importAST = mCoordinator->parse(typesFQName, &mImportedASTs);
167
168 if (importAST != nullptr) {
169 // Attempt to find Abc.Internal in types.
170 FQName matchingName;
171 Type *match = importAST->findDefinedType(fqName, &matchingName);
172 if (match == nullptr) {
173 return false;
174 }
175 // will automatically create a set if not exist
176 mImportedTypes[importAST].insert(match);
177 return true;
178 }
179
180 // can't find an appropriate AST for fqName.
181 return false;
Andreas Hubereb1081f2016-07-28 13:13:24 -0700182}
183
Andreas Huber39fa7182016-08-19 14:27:33 -0700184void AST::addImportedAST(AST *ast) {
185 mImportedASTs.insert(ast);
186}
187
Andreas Huberc9410c72016-07-28 12:18:40 -0700188void AST::enterScope(Scope *container) {
189 mScopePath.push_back(container);
190}
191
192void AST::leaveScope() {
Steven Morelandd537ab02016-09-12 10:32:01 -0700193 mScopePath.pop_back();
Andreas Huberc9410c72016-07-28 12:18:40 -0700194}
195
196Scope *AST::scope() {
Andreas Hubereb1081f2016-07-28 13:13:24 -0700197 CHECK(!mScopePath.empty());
Steven Morelandd537ab02016-09-12 10:32:01 -0700198 return mScopePath.back();
Andreas Huberc9410c72016-07-28 12:18:40 -0700199}
200
Yifan Honga4b53d02016-10-31 17:29:10 -0700201bool AST::addTypeDef(const char *localName, Type *type, const Location &location,
202 std::string *errorMsg) {
Andreas Huber39fa7182016-08-19 14:27:33 -0700203 // The reason we wrap the given type in a TypeDef is simply to suppress
204 // emitting any type definitions later on, since this is just an alias
205 // to a type defined elsewhere.
206 return addScopedTypeInternal(
Yifan Honga4b53d02016-10-31 17:29:10 -0700207 new TypeDef(localName, location, type), errorMsg);
Andreas Huber39fa7182016-08-19 14:27:33 -0700208}
209
Andreas Huber9ed827c2016-08-22 12:31:13 -0700210bool AST::addScopedType(NamedType *type, std::string *errorMsg) {
Andreas Huber39fa7182016-08-19 14:27:33 -0700211 return addScopedTypeInternal(
Steven Morelandd537ab02016-09-12 10:32:01 -0700212 type, errorMsg);
Andreas Huber39fa7182016-08-19 14:27:33 -0700213}
214
215bool AST::addScopedTypeInternal(
Steven Morelandd537ab02016-09-12 10:32:01 -0700216 NamedType *type,
217 std::string *errorMsg) {
Andreas Huber39fa7182016-08-19 14:27:33 -0700218
Steven Morelandd537ab02016-09-12 10:32:01 -0700219 bool success = scope()->addType(type, errorMsg);
Andreas Huber5a545442016-08-03 10:44:56 -0700220 if (!success) {
221 return false;
222 }
223
Andreas Huber31629bc2016-08-03 09:06:40 -0700224 std::string path;
225 for (size_t i = 1; i < mScopePath.size(); ++i) {
Andreas Huber0e00de42016-08-03 09:56:02 -0700226 path.append(mScopePath[i]->localName());
Andreas Huber31629bc2016-08-03 09:06:40 -0700227 path.append(".");
228 }
Steven Morelandd537ab02016-09-12 10:32:01 -0700229 path.append(type->localName());
Andreas Huber31629bc2016-08-03 09:06:40 -0700230
Andreas Huber31629bc2016-08-03 09:06:40 -0700231 FQName fqName(mPackage.package(), mPackage.version(), path);
Andreas Huber39fa7182016-08-19 14:27:33 -0700232
Steven Morelandd537ab02016-09-12 10:32:01 -0700233 type->setFullName(fqName);
Andreas Huber39fa7182016-08-19 14:27:33 -0700234
Steven Morelandd537ab02016-09-12 10:32:01 -0700235 mDefinedTypesByFullName[fqName] = type;
Andreas Huber31629bc2016-08-03 09:06:40 -0700236
Andreas Huber5a545442016-08-03 10:44:56 -0700237 return true;
Andreas Huber31629bc2016-08-03 09:06:40 -0700238}
239
Yifan Hongf24fa852016-09-23 11:03:15 -0700240EnumValue *AST::lookupEnumValue(const FQName &fqName, std::string *errorMsg) {
241
242 FQName enumTypeName = fqName.typeName();
243 std::string enumValueName = fqName.valueName();
244
245 CHECK(enumTypeName.isValid());
246 CHECK(!enumValueName.empty());
247
248 Type *type = lookupType(enumTypeName);
249 if(type == nullptr) {
250 *errorMsg = "Cannot find type " + enumTypeName.string();
251 return nullptr;
252 }
253 if(!type->isEnum()) {
254 *errorMsg = "Type " + enumTypeName.string() + " is not an enum type";
255 return nullptr;
256 }
257
258 EnumType *enumType = static_cast<EnumType *>(type);
259 EnumValue *v = static_cast<EnumValue *>(enumType->lookupIdentifier(enumValueName));
260 if(v == nullptr) {
261 *errorMsg = "Enum type " + enumTypeName.string() + " does not have " + enumValueName;
262 return nullptr;
263 }
264 return v;
265}
266
Yifan Hongae16eed2016-09-23 13:25:25 -0700267Type *AST::lookupType(const FQName &fqName) {
Andreas Huber84f89de2016-07-28 15:39:51 -0700268 CHECK(fqName.isValid());
269
Andreas Huberda51b8e2016-07-28 16:00:57 -0700270 if (fqName.name().empty()) {
271 // Given a package and version???
Yifan Hong1977ea32016-10-05 12:49:08 -0700272 return nullptr;
Andreas Huberda51b8e2016-07-28 16:00:57 -0700273 }
274
Andreas Huber84f89de2016-07-28 15:39:51 -0700275 if (fqName.package().empty() && fqName.version().empty()) {
276 // This is just a plain identifier, resolve locally first if possible.
277
278 for (size_t i = mScopePath.size(); i-- > 0;) {
Yifan Hongae16eed2016-09-23 13:25:25 -0700279 Type *type = mScopePath[i]->lookupType(fqName);
Andreas Huber84f89de2016-07-28 15:39:51 -0700280
Yifan Hong1977ea32016-10-05 12:49:08 -0700281 if (type != nullptr) {
Andreas Huber8d3ac0c2016-08-04 14:49:23 -0700282 // Resolve typeDefs to the target type.
283 while (type->isTypeDef()) {
284 type = static_cast<TypeDef *>(type)->referencedType();
285 }
286
Steven Morelandbb5c80b2016-10-05 11:07:36 -0700287 return type;
Andreas Huber84f89de2016-07-28 15:39:51 -0700288 }
Andreas Huberc9410c72016-07-28 12:18:40 -0700289 }
290 }
291
Andreas Huber39fa7182016-08-19 14:27:33 -0700292 Type *resolvedType = nullptr;
Iliyan Malchev800273d2016-09-02 15:25:07 -0700293 Type *returnedType = nullptr;
Andreas Huber39fa7182016-08-19 14:27:33 -0700294 FQName resolvedName;
Andreas Huber84f89de2016-07-28 15:39:51 -0700295
Andreas Huber39fa7182016-08-19 14:27:33 -0700296 for (const auto &importedAST : mImportedASTs) {
Yifan Hong1977ea32016-10-05 12:49:08 -0700297 if (mImportedTypes.find(importedAST) != mImportedTypes.end()) {
298 // ignore single type imports
299 continue;
300 }
Andreas Huber39fa7182016-08-19 14:27:33 -0700301 FQName matchingName;
302 Type *match = importedAST->findDefinedType(fqName, &matchingName);
Andreas Huber84f89de2016-07-28 15:39:51 -0700303
Andreas Huber39fa7182016-08-19 14:27:33 -0700304 if (match != nullptr) {
305 if (resolvedType != nullptr) {
306 std::cerr << "ERROR: Unable to resolve type name '"
307 << fqName.string()
308 << "', multiple matches found:\n";
Andreas Huber737080b2016-08-02 15:38:04 -0700309
Andreas Huber39fa7182016-08-19 14:27:33 -0700310 std::cerr << " " << resolvedName.string() << "\n";
311 std::cerr << " " << matchingName.string() << "\n";
312
Yifan Hong1977ea32016-10-05 12:49:08 -0700313 return nullptr;
314 }
315
316 resolvedType = match;
317 returnedType = resolvedType;
318 resolvedName = matchingName;
319
320 // Keep going even after finding a match.
321 }
322 }
323
324 for (const auto &pair : mImportedTypes) {
325 AST *importedAST = pair.first;
326 std::set<Type *> importedTypes = pair.second;
327
328 FQName matchingName;
329 Type *match = importedAST->findDefinedType(fqName, &matchingName);
330 if (match != nullptr &&
331 importedTypes.find(match) != importedTypes.end()) {
332 if (resolvedType != nullptr) {
333 std::cerr << "ERROR: Unable to resolve type name '"
334 << fqName.string()
335 << "', multiple matches found:\n";
336
337 std::cerr << " " << resolvedName.string() << "\n";
338 std::cerr << " " << matchingName.string() << "\n";
339
340 return nullptr;
Andreas Huber39fa7182016-08-19 14:27:33 -0700341 }
342
343 resolvedType = match;
Iliyan Malchev800273d2016-09-02 15:25:07 -0700344 returnedType = resolvedType;
Andreas Huber39fa7182016-08-19 14:27:33 -0700345 resolvedName = matchingName;
346
347 // Keep going even after finding a match.
348 }
349 }
350
351 if (resolvedType) {
352#if 0
353 LOG(INFO) << "found '"
354 << resolvedName.string()
355 << "' after looking for '"
356 << fqName.string()
357 << "'.";
358#endif
359
360 // Resolve typeDefs to the target type.
361 while (resolvedType->isTypeDef()) {
362 resolvedType =
363 static_cast<TypeDef *>(resolvedType)->referencedType();
364 }
365
Iliyan Malchev800273d2016-09-02 15:25:07 -0700366 returnedType = resolvedType;
367
368 // If the resolved type is not an interface, we need to determine
369 // whether it is defined in types.hal, or in some other interface. In
370 // the latter case, we need to emit a dependency for the interface in
371 // which the type is defined.
372 //
373 // Consider the following:
374 // android.hardware.tests.foo@1.0::Record
375 // android.hardware.tests.foo@1.0::IFoo.Folder
376 // android.hardware.tests.foo@1.0::Folder
377 //
378 // If Record is an interface, then we keep track of it for the purpose
379 // of emitting dependencies in the target language (for example #include
380 // in C++). If Record is a UDT, then we assume it is defined in
381 // types.hal in android.hardware.tests.foo@1.0.
382 //
383 // In the case of IFoo.Folder, the same applies. If IFoo is an
384 // interface, we need to track this for the purpose of emitting
385 // dependencies. If not, then it must have been defined in types.hal.
386 //
387 // In the case of just specifying Folder, the resolved type is
388 // android.hardware.tests.foo@1.0::IFoo.Folder, and the same logic as
389 // above applies.
390
391 if (!resolvedType->isInterface()) {
392 FQName ifc(resolvedName.package(),
393 resolvedName.version(),
394 resolvedName.names().at(0));
395 for (const auto &importedAST : mImportedASTs) {
396 FQName matchingName;
397 Type *match = importedAST->findDefinedType(ifc, &matchingName);
398 if (match != nullptr && match->isInterface()) {
399 resolvedType = match;
400 }
401 }
402 }
403
Andreas Huber39fa7182016-08-19 14:27:33 -0700404 if (!resolvedType->isInterface()) {
Andreas Huber0e00de42016-08-03 09:56:02 -0700405 // Non-interface types are declared in the associated types header.
Andreas Huber39fa7182016-08-19 14:27:33 -0700406 FQName typesName(
407 resolvedName.package(), resolvedName.version(), "types");
408
Andreas Huber0e00de42016-08-03 09:56:02 -0700409 mImportedNames.insert(typesName);
Andreas Huber85eabdb2016-08-25 11:24:49 -0700410
Steven Morelandd537ab02016-09-12 10:32:01 -0700411 if (resolvedType->isNamedType() && !resolvedType->isTypeDef()) {
Andreas Huber85eabdb2016-08-25 11:24:49 -0700412 mImportedNamesForJava.insert(
413 static_cast<NamedType *>(resolvedType)->fqName());
414 }
Andreas Huber0e00de42016-08-03 09:56:02 -0700415 } else {
Andreas Huberbfd76212016-08-09 11:12:16 -0700416 // Do _not_ use fqName, i.e. the name we used to look up the type,
417 // but instead use the name of the interface we found.
418 // This is necessary because if fqName pointed to a typedef which
419 // in turn referenced the found interface we'd mistakenly use the
420 // name of the typedef instead of the proper name of the interface.
421
422 mImportedNames.insert(
Andreas Huber39fa7182016-08-19 14:27:33 -0700423 static_cast<Interface *>(resolvedType)->fqName());
Andreas Huber85eabdb2016-08-25 11:24:49 -0700424
425 mImportedNamesForJava.insert(
426 static_cast<Interface *>(resolvedType)->fqName());
Andreas Huber0e00de42016-08-03 09:56:02 -0700427 }
Andreas Huber737080b2016-08-02 15:38:04 -0700428 }
429
Steven Morelandbb5c80b2016-10-05 11:07:36 -0700430 return returnedType;
Andreas Huber5345ec22016-07-29 13:33:27 -0700431}
432
Andreas Huber39fa7182016-08-19 14:27:33 -0700433Type *AST::findDefinedType(const FQName &fqName, FQName *matchingName) const {
Steven Morelandd537ab02016-09-12 10:32:01 -0700434 for (const auto &pair : mDefinedTypesByFullName) {
435 const FQName &key = pair.first;
436 Type* type = pair.second;
Andreas Huber5345ec22016-07-29 13:33:27 -0700437
Andreas Huber39fa7182016-08-19 14:27:33 -0700438 if (key.endsWith(fqName)) {
439 *matchingName = key;
Steven Morelandd537ab02016-09-12 10:32:01 -0700440 return type;
Andreas Huber5345ec22016-07-29 13:33:27 -0700441 }
Andreas Huber5345ec22016-07-29 13:33:27 -0700442 }
Andreas Huber39fa7182016-08-19 14:27:33 -0700443
444 return nullptr;
Andreas Huberc9410c72016-07-28 12:18:40 -0700445}
446
Iliyan Malchev5bb14022016-08-09 15:04:39 -0700447void AST::getImportedPackages(std::set<FQName> *importSet) const {
Andreas Huberd2943e12016-08-05 11:59:31 -0700448 for (const auto &fqName : mImportedNames) {
449 FQName packageName(fqName.package(), fqName.version(), "");
450
451 if (packageName == mPackage) {
452 // We only care about external imports, not our own package.
453 continue;
454 }
455
456 importSet->insert(packageName);
457 }
458}
459
Yifan Hong40a373d2016-11-30 15:16:47 -0800460void AST::getImportedPackagesHierarchy(std::set<FQName> *importSet) const {
461 getImportedPackages(importSet);
462 std::set<FQName> newSet;
463 for (const auto &ast : mImportedASTs) {
464 if (importSet->find(ast->package()) != importSet->end()) {
465 ast->getImportedPackagesHierarchy(&newSet);
466 }
467 }
468 importSet->insert(newSet.begin(), newSet.end());
469}
470
Andreas Huber0fa9e392016-08-31 09:05:44 -0700471bool AST::isJavaCompatible() const {
472 std::string ifaceName;
473 if (!AST::isInterface(&ifaceName)) {
Steven Morelandd537ab02016-09-12 10:32:01 -0700474 for (const auto *type : mRootScope->getSubTypes()) {
Andreas Huber0fa9e392016-08-31 09:05:44 -0700475 if (!type->isJavaCompatible()) {
476 return false;
477 }
478 }
479
480 return true;
481 }
482
483 const Interface *iface = mRootScope->getInterface();
484 return iface->isJavaCompatible();
485}
486
Andreas Huber019d21d2016-10-03 12:59:47 -0700487void AST::appendToExportedTypesVector(
488 std::vector<const Type *> *exportedTypes) const {
489 mRootScope->appendToExportedTypesVector(exportedTypes);
490}
491
Andreas Huberc9410c72016-07-28 12:18:40 -0700492} // namespace android;