Constant Expressions have same tree structure as Type

Makes constant expressions tree structures and type signatures
be similar to AST (type declarations and references).

This change is useful for making same structure for calling
constant expressions evaluation and lookup (they depend on local
identifiers).

Bug: 31827278

Test: mma

Change-Id: I901284009d8b845358788b8c9e3de083a2f63f3f
diff --git a/Interface.cpp b/Interface.cpp
index 79824ae..10fb89d 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -475,6 +475,15 @@
     return ret;
 }
 
+std::vector<ConstantExpression*> Interface::getConstantExpressions() const {
+    std::vector<ConstantExpression*> ret;
+    for (const auto* method : methods()) {
+        const auto& retMethod = method->getConstantExpressions();
+        ret.insert(ret.end(), retMethod.begin(), retMethod.end());
+    }
+    return ret;
+}
+
 status_t Interface::resolveInheritance() {
     size_t serial = FIRST_CALL_TRANSACTION;
     for (const auto* ancestor : superTypeChain()) {
@@ -496,15 +505,6 @@
     return Scope::resolveInheritance();
 }
 
-status_t Interface::evaluate() {
-    for (auto* method : methods()) {
-        status_t err = method->evaluate();
-        if (err != OK) return err;
-    }
-
-    return Scope::evaluate();
-}
-
 status_t Interface::validate() const {
     CHECK(isIBase() == mSuperType.isEmptyReference());
 
@@ -513,11 +513,6 @@
         return UNKNOWN_ERROR;
     }
 
-    for (const auto* method : methods()) {
-        status_t err = method->validate();
-        if (err != OK) return err;
-    }
-
     status_t err = validateUniqueNames();
     if (err != OK) return err;