diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2016-04-18 21:29:41 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2016-06-07 14:18:27 +0200 |
commit | 27846bb2ba8519decbfe4a152460805e591ec98b (patch) | |
tree | cc47f2808d14453dcecc157e1c560024b34e163b /src/dotty/tools/dotc/Compiler.scala | |
parent | 4ce8ab06470db959aed3527f013a261bc4c3c9a0 (diff) | |
download | dotty-27846bb2ba8519decbfe4a152460805e591ec98b.tar.gz dotty-27846bb2ba8519decbfe4a152460805e591ec98b.tar.bz2 dotty-27846bb2ba8519decbfe4a152460805e591ec98b.zip |
MoveStatic: Move static methods & fields into companion class
As a funny side-effect this allows to execute arbitrary code in static
initialisers:
@static val a: Unit = {println("loaded")}
Diffstat (limited to 'src/dotty/tools/dotc/Compiler.scala')
-rw-r--r-- | src/dotty/tools/dotc/Compiler.scala | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index 2ddd81718..3844f42a7 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -91,6 +91,7 @@ class Compiler { new RestoreScopes), // Repair scopes rendered invalid by moving definitions in prior phases of the group List(new ExpandPrivate, // Widen private definitions accessed from nested classes new CollectEntryPoints, // Find classes with main methods + new MoveStatics, // Move static methods to companion classes new LabelDefs), // Converts calls to labels to jumps List(new GenSJSIR), // Generate .js code List(new GenBCode) // Generate JVM bytecode |