Skip to content
Permalink
Browse files

fix(measurements): Actually deprecate old constructors

This should have been done when the code was reorganized, but it was
hard enough to test everything at once without warnings cluttering up
the output, so I waited and then forgot about it. The shims were already
in place, all this does is actually throw warnings on the deprecated
usages.
  • Loading branch information
alerque committed Oct 18, 2019
1 parent 7397f4f commit bfdb1b86986968e3f9d132fae1e4cb01b9623d9d
Showing with 8 additions and 8 deletions.
  1. +5 −5 core/length.lua
  2. +3 −3 core/measurement.lua
@@ -55,27 +55,27 @@ return pl.class({
end,

new = function (spec)
-- SU.warn("Function SILE.length.new() is deprecated, just call SILE.length(...)")
SU.deprecated("SILE.length.new", "SILE.length", "0.10.0")
return SILE.length(spec)
end,

make = function (spec)
-- SU.warn("Function SILE.length.make() is deprecated, just call SILE.length(...)")
SU.deprecated("SILE.length.make", "SILE.length", "0.10.0")
return SILE.length(spec)
end,

parse = function (spec)
-- SU.warn("Function SILE.length.parse() is deprecated, just call SILE.length(...)")
SU.deprecated("SILE.length.parse", "SILE.length", "0.10.0")
return SILE.length(spec)
end,

fromLengthOrNumber = function (_, spec)
-- SU.warn("Function SILE.length.fromLengthOrNumber() is deprecated, just call SILE.length(...)")
SU.deprecated("SILE.length.fromLengthOrNumber", "SILE.length", "0.10.0")
return SILE.length(spec)
end,

__index = function (_, key) -- luacheck: ignore
-- SU.warn("Length method " .. key .. " is deprecated, just call SILE.length(...)")
SU.deprecated("SILE.length." .. key, "SILE.length", "0.10.0")
return SILE.length()
end,

@@ -183,17 +183,17 @@ local measurement = pl.class({


SILE.toPoints = function (factor, unit)
-- SU.warn("Function toPoints(...) is deprecated, please use measurement(...):tonumber()")
SU.deprecated("SILE.toPoints", "SILE.measurement():tonumber", "0.10.0")
return measurement(factor, unit):tonumber()
end

SILE.toMeasurement = function (amount, unit)
-- SU.warn("Please use SILE.measurement() class instead of toMeasurement function")
SU.deprecated("SILE.toMeasurement", "SILE.measurement", "0.10.0")
return measurement(amount, unit)
end

SILE.toAbsoluteMeasurement = function (amount, unit)
-- SU.warn("Please use SILE.measurement() class with :absolute() instead of toAbsoluteMeasurement function")
SU.deprecated("SILE.toAbsoluteMeasurement", "SILE.measurement():absolute", "0.10.0")
return measurement(amount, unit):absolute()
end

0 comments on commit bfdb1b8

Please sign in to comment.
You can’t perform that action at this time.