From 653b29bfdd091d7e2c069b8ad56f8ca51ad4b244 Mon Sep 17 00:00:00 2001 From: Miguel Garcia Date: Sat, 29 Dec 2012 14:15:45 +0100 Subject: nested closures are flattened by calling supplementErrorMessage() directly A closure C that becomes an argument to the constructor of another closure makes both closures harder to eliminate (either by scalac-optimizer or JIT-compiler) than is the case when C is the argument to an @inline method. --- src/compiler/scala/tools/nsc/Global.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 95da7324aa..20b8265071 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -228,13 +228,15 @@ class Global(var currentSettings: Settings, var reporter: Reporter) // of assert and require (but for now I've reproduced them here, // because there are a million to fix.) @inline final def assert(assertion: Boolean, message: => Any) { - Predef.assert(assertion, supplementErrorMessage("" + message)) + if (!assertion) + throw new java.lang.AssertionError("assertion failed: "+ supplementErrorMessage("" + message)) } @inline final def assert(assertion: Boolean) { assert(assertion, "") } @inline final def require(requirement: Boolean, message: => Any) { - Predef.require(requirement, supplementErrorMessage("" + message)) + if (!requirement) + throw new IllegalArgumentException("requirement failed: "+ supplementErrorMessage("" + message)) } @inline final def require(requirement: Boolean) { require(requirement, "") -- cgit v1.2.3