Move type-related stuff ouside of parsing

3 new passes: resolving inheritance, evaluating constant expressions and
validation.

`resolveInheritance` completes type fields definition which depends on
type base class (so it needs to be looked up before this pass). That
includes interface method serial autofill and enum value autofill.

`evaluate` evaluates constant expressions. This pass depends on the
previous one as enum autofill creates new expressions (+1s).

`validate` proceedes all type-related checks.

`callForReference` is a special way of calling passes for types:
it is used for types that are defined in reference.
Currently that is only array type (size is defined in reference only)
and template type as it could contain an array.
We need such special way to avoid cyclic evaluate call:
struct S { S[42] arr; };

Test: full build, device boot
Test: hidl_test
Test: full build on mac
Test: generated files differ only in constant expression comments

Change-Id: I499e62ae41c52cc86b13d0014eed790454137af6
diff --git a/Scope.h b/Scope.h
index 63bfbfd..f1d5401 100644
--- a/Scope.h
+++ b/Scope.h
@@ -54,6 +54,10 @@
 
     void setAnnotations(std::vector<Annotation*>* annotations);
 
+    virtual status_t resolveInheritance() override;
+    virtual status_t evaluate() override;
+    virtual status_t validate() const override;
+
     status_t emitTypeDeclarations(Formatter &out) const override;
     status_t emitGlobalTypeDeclarations(Formatter &out) const override;
     status_t emitGlobalHwDeclarations(Formatter &out) const override;
@@ -87,6 +91,8 @@
     RootScope(const char* localName, const Location& location, Scope* parent);
     virtual ~RootScope();
 
+    virtual status_t validate() const override;
+
     std::string typeName() const override;
 };
 
@@ -95,6 +101,9 @@
     virtual ~LocalIdentifier();
     virtual bool isEnumValue() const;
 
+    virtual status_t evaluate();
+    virtual status_t validate() const;
+
     virtual ConstantExpression* constExpr() const;
 };