code: @Nullable
    private static String getQualifiedNameThroughCast(Node node) {
      if (node.isName()) {
        String name = node.getString();
        return name.isEmpty() ? null : name;
      } else if (node.isGetProp()) {
        String left = getQualifiedNameThroughCast(node.getFirstChild());
        if (left == null) {
          return null;
        }
        String right = node.getLastChild().getString();
        return left + "." + right;
      } else if (node.isCast()) {
        return getQualifiedNameThroughCast(node.getFirstChild());
      }
      return null;
    }
docs: Similar to {@link Node#getQualifiedName} but also handles CAST nodes. For example, given a
  GETPROP representing "(/** @type {?} *\/ (x)).y.z" returns "x.y.z". Returns null if node is
  not a NAME, GETPROP, or CAST. See b/64389806 for Polymer-specific context.