refactor: remove AidlConstantReference::SetRefType

A constant reference is composed of <type>.<field>. But when <type> is
missing, <field> is looked up from the defining type (the current
scope).

e.g. enum Enum { A = 0, B = A }; // the second "A" refers to "Enum.A"

Previously, when <type> is missing, we create AidlTypeSpecifer for the
current scope type and set it as AidlConstantReference's type.
However, the purpose of AidlTypeSpecifier is to resolve it to a
AidlDefinedType to look up <field> from it.

In the above example, AidlTypeSpecifier("Enum") is created and resolved
to "Enum" type.

Because we already know the scope type, creating AidlTypeSpecifier and
resolve it again is meaningless.

When traversing AST, these manually created nodes should be skipped with
additional flags. (e.g. user_defined_xxx). Let's avoid creating AST
nodes manually.

Bug: none
Test: m aidl_unittests
Change-Id: I3965e571875c6b6a1c7c237f0b4628d362958d46
4 files changed