Class Es6NormalizeClasses

java.lang.Object
com.google.javascript.jscomp.Es6NormalizeClasses
All Implemented Interfaces:
CompilerPass, NodeTraversal.Callback, NodeTraversal.ScopedCallback

public final class Es6NormalizeClasses extends Object implements NodeTraversal.ScopedCallback, CompilerPass
Normalizes ES6 classes to a simpler form for easier optimization.

This pass handles four main transformations which are performed when needed:

  1. Extracts class extends expressions into variables.
  2. Extracts classes into variables.
  3. Rewrites static class field initializers and static blocks into a static initialization method that is called after class definition.
  4. If transpilation of FeatureSet.Feature.PUBLIC_CLASS_FIELDS is needed, rewrites public class instance fields into assignments in the constructor and removes static field declarations.

These transformations must be done before passes like Es6RewriteClass and Es6ConvertSuper, which only handle classes in simpler forms.