private void generate(Node node) {
            try {
                setLineNumber(node.getSourceInfo());
                if (!(node instanceof Expression)) {
                    node.accept(this);
                    return;
                }

                // Expressions require special attention for type conversion.

                Expression expr = (Expression)node;
                List<Conversion> conversions = expr.getConversionChain();

                // Iterate conversion chain backwards at first.
                ListIterator<Conversion> it =
                    conversions.listIterator(conversions.size());

                while (it.hasPrevious()) {
                    typeConvertBegin(it.previous());
                }

                expr.accept(this);

                while (it.hasNext()) {
                    typeConvertEnd(it.next());
                }
            }
            catch (DetailException e) {
                throw e;
            }
            catch (RuntimeException e) {
                throw new DetailException(e, "(near line " + mLastLine + ')');
            }
        }