protected Expression checkForTypeExpression(Expression expr) {
            // determine if the expression is a variable reference and determine
            // if the variable reference is actually a type reference
            // NOTE: variables take precedence, so ensure no active variable.
            if (expr instanceof VariableRef) {
                String name = ((VariableRef) expr).getName();
                if (mScope.getDeclaredVariable(name) == null) {
                    // determine if variable is a class and return as type expr
                    Class<?> type = lookupType(name, 0, null);
                    if (type != null) {
                        SourceInfo info = expr.getSourceInfo();
                        TypeName typeName = new TypeName(info, type.getName());
                        return new TypeExpression(info, typeName);
                    }

                    // otherwise, fail with unknown variable
                    error("variable.not.declared", name, expr);
                    return null;
                }
            }

            // otherwise, determine if the expression is a series of lookups
            // bound to a variable reference that may be a fully-qualified
            // reference.
            else if (expr instanceof Lookup) {

                // walk each lookup section to determine fully-qualified path
                Expression parent = expr;
                List<Lookup> lookups = new ArrayList<Lookup>(10);
                while (parent instanceof Lookup) {
                    lookups.add(0, (Lookup) parent);
                    parent = ((Lookup) parent).getExpression();
                }

                // first node must be a variable/type reference to be able to
                // convert to a fully-qualified path
                if (parent instanceof VariableRef) {

                    // check if variable is referenced and handle as normal
                    // lookup and do not handle as a type expression as
                    // variables always have precedence
                    String name = ((VariableRef) parent).getName();
                    if (mScope.getDeclaredVariable(name) != null) {
                        return expr;
                    }

                    // otherwise, check if the first token references a class
                    // and handle as a type expression
                    Class<?> type = lookupType(name, 0, null);
                    if (type != null) {
                        SourceInfo info = parent.getSourceInfo();
                        TypeName typeName = new TypeName(info, type.getName());
                        TypeExpression typeExpr =
                            new TypeExpression(info, typeName);
                        lookups.get(0).setExpression(typeExpr);
                        return expr;
                    }

                    // otherwise, check if the first token references a package
                    // and walk the package tree for the static class lookup
                    String fqName = name;
                    int size = lookups.size();
                    for (int i = 0; i < size; i++) {
                        Lookup lookup = lookups.get(i);
                        String section = lookup.getLookupName().getName();
                        fqName = fqName.concat(".".concat(section));

                        // determine if fully-qualified class name and
                        // attempt static field lookup
                        type = lookupType(fqName, 0, null);
                        if (type != null) {
                            SourceInfo info = lookup.getSourceInfo();
                            TypeName typeName = new TypeName(info, type.getName());
                            TypeExpression typeExpr =
                                new TypeExpression(info, typeName);

                            if (i + 1 < size) {
                                lookups.get(i + 1).setExpression(typeExpr);
                                return expr;
                            }
                            else { return typeExpr; }
                        }
                    }

                    // otherwise, fail with unknown variable
                    error("variable.not.declared", name, expr);
                    return null;
                }
            }

            // unhandled, so handle normally
            return expr;
        }