diff --git a/History.md b/History.md index 2bb2bbb3..8fd6ef37 100644 --- a/History.md +++ b/History.md @@ -22,11 +22,12 @@ * e.g. `(a or b) and c` ### Breaking changes -* We are removing the Environment's `error_mode` option. +* The Environment's `error_mode` option has been removed. * `:warn` is no longer supported * `:lax` and `lax_parse` is no longer supported * `:strict` and `strict_parse` is no longer supported * `strict2_parse` is renamed to `parse_markup` +* The `warnings` system has been removed. ### Migrating from `^5.11.0` - In custom tags that include `ParserSwitching`, rename `strict2_parse` to `parse_markup` diff --git a/lib/liquid/context.rb b/lib/liquid/context.rb index 433b6d00..1db6bb66 100644 --- a/lib/liquid/context.rb +++ b/lib/liquid/context.rb @@ -60,10 +60,6 @@ module Liquid end # rubocop:enable Metrics/ParameterLists - def warnings - @warnings ||= [] - end - def strainer @strainer ||= @environment.create_strainer(self, @filters) end @@ -157,7 +153,6 @@ module Liquid subcontext.filters = @filters subcontext.strainer = nil subcontext.errors = errors - subcontext.warnings = warnings subcontext.disabled_tags = @disabled_tags end end @@ -244,7 +239,7 @@ module Liquid protected - attr_writer :base_scope_depth, :warnings, :errors, :strainer, :filters, :disabled_tags + attr_writer :base_scope_depth, :errors, :strainer, :filters, :disabled_tags private diff --git a/lib/liquid/parse_context.rb b/lib/liquid/parse_context.rb index 8161a036..96413eb6 100644 --- a/lib/liquid/parse_context.rb +++ b/lib/liquid/parse_context.rb @@ -3,14 +3,13 @@ module Liquid class ParseContext attr_accessor :locale, :line_number, :trim_whitespace, :depth - attr_reader :partial, :warnings, :environment + attr_reader :partial, :environment def initialize(options = Const::EMPTY_HASH) @environment = options.fetch(:environment, Environment.default) @template_options = options ? options.dup : {} - @locale = @template_options[:locale] ||= I18n.new - @warnings = [] + @locale = @template_options[:locale] ||= I18n.new # constructing new StringScanner in Lexer, Tokenizer, etc is expensive # This StringScanner will be shared by all of them diff --git a/lib/liquid/template.rb b/lib/liquid/template.rb index e638a01d..a81fec42 100644 --- a/lib/liquid/template.rb +++ b/lib/liquid/template.rb @@ -16,7 +16,7 @@ module Liquid # class Template attr_accessor :root, :name - attr_reader :resource_limits, :warnings + attr_reader :resource_limits attr_reader :profiler @@ -209,7 +209,6 @@ module Liquid ParseContext.new(opts) end - @warnings = parse_context.warnings parse_context end diff --git a/test/integration/template_test.rb b/test/integration/template_test.rb index d5c83cd0..b286adae 100644 --- a/test/integration/template_test.rb +++ b/test/integration/template_test.rb @@ -44,16 +44,6 @@ class TemplateTest < Minitest::Test assert_equal('from instance assigns', t.parse("{{ foo }}").render!) end - def test_warnings_is_not_exponential_time - str = "false" - 100.times do - str = "{% if true %}true{% else %}#{str}{% endif %}" - end - - t = Template.parse(str) - assert_equal([], Timeout.timeout(1) { t.warnings }) - end - def test_instance_assigns_persist_on_same_template_parsing_between_renders t = Template.new.parse("{{ foo }}{% assign foo = 'foo' %}{{ foo }}") assert_equal('foo', t.render!)