@@ -99,10 +99,11 @@ phases. The current list of phases is specified in class [Compiler] as follows:
99
99
protected def frontendPhases : List [List [Phase ]] =
100
100
List (new FrontEnd ) :: // Compiler frontend: scanner, parser, namer, typer
101
101
List (new YCheckPositions ) :: // YCheck positions
102
- List (new Staging ) :: // Check PCP, heal quoted types and expand macros
103
102
List (new sbt.ExtractDependencies ) :: // Sends information on classes' dependencies to sbt via callbacks
104
103
List (new semanticdb.ExtractSemanticDB ) :: // Extract info into .semanticdb files
105
104
List (new PostTyper ) :: // Additional checks and cleanups after type checking
105
+ List (new sjs.PrepJSInterop ) :: // Additional checks and transformations for Scala.js (Scala.js only)
106
+ List (new Staging ) :: // Check PCP, heal quoted types and expand macros
106
107
List (new sbt.ExtractAPI ) :: // Sends a representation of the API of classes to sbt via callbacks
107
108
List (new SetRootTree ) :: // Set the `rootTreeOrProvider` on class symbols
108
109
Nil
@@ -119,74 +120,79 @@ phases. The current list of phases is specified in class [Compiler] as follows:
119
120
new CheckReentrant , // Internal use only: Check that compiled program has no data races involving global vars
120
121
new ElimPackagePrefixes , // Eliminate references to package prefixes in Select nodes
121
122
new CookComments , // Cook the comments: expand variables, doc, etc.
122
- new CompleteJavaEnums ) :: // Fill in constructors for Java enums
123
- List (new CheckStatic , // Check restrictions that apply to @static members
124
- new ElimRepeated , // Rewrite vararg parameters and arguments
123
+ new CheckStatic , // Check restrictions that apply to @static members
124
+ new BetaReduce , // Reduce closure applications
125
+ new init.Checker ) :: // Check initialization of objects
126
+ List (new ElimRepeated , // Rewrite vararg parameters and arguments
125
127
new ExpandSAMs , // Expand single abstract method closures to anonymous classes
126
128
new ProtectedAccessors , // Add accessors for protected members
127
129
new ExtensionMethods , // Expand methods of value classes with extension methods
128
- new CacheAliasImplicits , // Cache RHS of parameterless alias implicits
129
- new ShortcutImplicits , // Allow implicit functions without creating closures
130
+ new UncacheGivenAliases , // Avoid caching RHS of simple parameterless given aliases
130
131
new ByNameClosures , // Expand arguments to by-name parameters to closures
131
132
new HoistSuperArgs , // Hoist complex arguments of supercalls to enclosing scope
132
- new ClassOf , // Expand `Predef.classOf` calls.
133
+ new SpecializeApplyMethods , // Adds specialized methods to FunctionN
133
134
new RefChecks ) :: // Various checks mostly related to abstract members and overriding
134
135
List (new ElimOpaque , // Turn opaque into normal aliases
135
136
new TryCatchPatterns , // Compile cases in try/catch
136
137
new PatternMatcher , // Compile pattern matches
138
+ new sjs.ExplicitJSClasses , // Make all JS classes explicit (Scala.js only)
137
139
new ExplicitOuter , // Add accessors to outer classes from nested ones.
138
140
new ExplicitSelf , // Make references to non-trivial self types explicit as casts
139
- new StringInterpolatorOpt , // Optimizes raw and s string interpolators by rewriting them to string concatentations
140
- new CrossCastAnd ) :: // Normalize selections involving intersection types.
141
+ new ElimByName , // Expand by-name parameter references
142
+ new StringInterpolatorOpt ) :: // Optimizes raw and s string interpolators by rewriting them to string concatentations
141
143
List (new PruneErasedDefs , // Drop erased definitions from scopes and simplify erased expressions
144
+ new InlinePatterns , // Remove placeholders of inlined patterns
142
145
new VCInlineMethods , // Inlines calls to value class methods
143
146
new SeqLiterals , // Express vararg arguments as arrays
144
147
new InterceptedMethods , // Special handling of `==`, `|=`, `getClass` methods
145
148
new Getters , // Replace non-private vals and vars with getter defs (fields are added later)
146
- new ElimByName , // Expand by-name parameter references
149
+ new SpecializeFunctions , // Specialized Function{0,1,2} by replacing super with specialized super
150
+ new LiftTry , // Put try expressions that might execute on non-empty stacks into their own methods
147
151
new CollectNullableFields , // Collect fields that can be nulled out after use in lazy initialization
148
152
new ElimOuterSelect , // Expand outer selections
149
- new AugmentScala2Traits , // Augments Scala2 traits so that super accessors are made non-private
150
153
new ResolveSuper , // Implement super accessors
151
154
new FunctionXXLForwarders , // Add forwarders for FunctionXXL apply method
155
+ new ParamForwarding , // Add forwarders for aliases of superclass parameters
152
156
new TupleOptimizations , // Optimize generic operations on tuples
157
+ new LetOverApply , // Lift blocks from receivers of applications
153
158
new ArrayConstructors ) :: // Intercept creation of (non-generic) arrays and intrinsify.
154
159
List (new Erasure ) :: // Rewrite types to JVM model, erasing all type parameters, abstract types and refinements.
155
160
List (new ElimErasedValueType , // Expand erased value types to their underlying implmementation types
161
+ new PureStats , // Remove pure stats from blocks
156
162
new VCElideAllocations , // Peep-hole optimization to eliminate unnecessary value class allocations
157
163
new ArrayApply , // Optimize `scala.Array.apply([....])` and `scala.Array.apply(..., [....])` into `[...]`
164
+ new sjs.AddLocalJSFakeNews , // Adds fake new invocations to local JS classes in calls to `createLocalJSClass`
158
165
new ElimPolyFunction , // Rewrite PolyFunction subclasses to FunctionN subclasses
159
166
new TailRec , // Rewrite tail recursion to loops
167
+ new CompleteJavaEnums , // Fill in constructors for Java enums
160
168
new Mixin , // Expand trait fields and trait initializers
161
169
new LazyVals , // Expand lazy vals
162
170
new Memoize , // Add private fields to getters and setters
163
171
new NonLocalReturns , // Expand non-local returns
164
172
new CapturedVars ) :: // Represent vars captured by closures as heap objects
165
173
List (new Constructors , // Collect initialization code in primary constructors
166
174
// Note: constructors changes decls in transformTemplate, no InfoTransformers should be added after it
167
- new FunctionalInterfaces , // Rewrites closures to implement @specialized types of Functions.
168
- new Instrumentation , // Count closure allocations under -Yinstrument-closures
169
- new GetClass , // Rewrites getClass calls on primitive types.
170
- new LiftTry ) :: // Put try expressions that might execute on non-empty stacks into their own methods their implementations
175
+ new Instrumentation ) :: // Count calls and allocations under -Yinstrument
171
176
List (new LambdaLift , // Lifts out nested functions to class scope, storing free variables in environments
172
- // Note: in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
173
- new ElimStaticThis ) :: // Replace `this` references to static objects by global identifiers
174
- List (new Flatten , // Lift all inner classes to package scope
177
+ // Note: in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
178
+ new ElimStaticThis , // Replace `this` references to static objects by global identifiers
179
+ new CountOuterAccesses ) :: // Identify outer accessors that can be dropped
180
+ List (new DropOuterAccessors , // Drop unused outer accessors
181
+ new Flatten , // Lift all inner classes to package scope
175
182
new RenameLifted , // Renames lifted classes to local numbering scheme
176
183
new TransformWildcards , // Replace wildcards with default values
177
184
new MoveStatics , // Move static methods from companion to the class itself
178
185
new ExpandPrivate , // Widen private definitions accessed from nested classes
179
186
new RestoreScopes , // Repair scopes rendered invalid by moving definitions in prior phases of the group
180
187
new SelectStatic , // get rid of selects that would be compiled into GetStatic
181
188
new sjs.JUnitBootstrappers , // Generate JUnit-specific bootstrapper classes for Scala.js (not enabled by default)
182
- new CollectEntryPoints , // Find classes with main methods
183
189
new CollectSuperCalls ) :: // Find classes that are called with super
184
190
Nil
185
191
186
192
/** Generate the output of the compilation */
187
193
protected def backendPhases : List [List [Phase ]] =
188
- List (new sjs.GenSJSIR ) :: // Generate .sjsir files for Scala.js (not enabled by default)
189
- List (new GenBCode ) :: // Generate JVM bytecode
194
+ List (new backend. sjs.GenSJSIR ) :: // Generate .sjsir files for Scala.js (not enabled by default)
195
+ List (new GenBCode ) :: // Generate JVM bytecode
190
196
Nil
191
197
```
192
198
0 commit comments