Skip to content

Commit d0ccab5

Browse files
committed
Remove warnings system
1 parent ee8c4be commit d0ccab5

5 files changed

Lines changed: 6 additions & 22 deletions

File tree

History.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
* e.g. `(a or b) and c`
2323

2424
### Breaking changes
25-
* We are removing the Environment's `error_mode` option.
25+
* The Environment's `error_mode` option has been removed.
2626
* `:warn` is no longer supported
2727
* `:lax` and `lax_parse` is no longer supported
2828
* `:strict` and `strict_parse` is no longer supported
2929
* `strict2_parse` is renamed to `parse_markup`
30+
* The `warnings` system has been removed.
3031

3132
### Migrating from `^5.11.0`
3233
- In custom tags that include `ParserSwitching`, rename `strict2_parse` to `parse_markup`

lib/liquid/context.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_erro
6060
end
6161
# rubocop:enable Metrics/ParameterLists
6262

63-
def warnings
64-
@warnings ||= []
65-
end
66-
6763
def strainer
6864
@strainer ||= @environment.create_strainer(self, @filters)
6965
end
@@ -157,7 +153,6 @@ def new_isolated_subcontext
157153
subcontext.filters = @filters
158154
subcontext.strainer = nil
159155
subcontext.errors = errors
160-
subcontext.warnings = warnings
161156
subcontext.disabled_tags = @disabled_tags
162157
end
163158
end
@@ -244,7 +239,7 @@ def tag_disabled?(tag_name)
244239

245240
protected
246241

247-
attr_writer :base_scope_depth, :warnings, :errors, :strainer, :filters, :disabled_tags
242+
attr_writer :base_scope_depth, :errors, :strainer, :filters, :disabled_tags
248243

249244
private
250245

lib/liquid/parse_context.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
module Liquid
44
class ParseContext
55
attr_accessor :locale, :line_number, :trim_whitespace, :depth
6-
attr_reader :partial, :warnings, :environment
6+
attr_reader :partial, :environment
77

88
def initialize(options = Const::EMPTY_HASH)
99
@environment = options.fetch(:environment, Environment.default)
1010
@template_options = options ? options.dup : {}
1111

12-
@locale = @template_options[:locale] ||= I18n.new
13-
@warnings = []
12+
@locale = @template_options[:locale] ||= I18n.new
1413

1514
# constructing new StringScanner in Lexer, Tokenizer, etc is expensive
1615
# This StringScanner will be shared by all of them

lib/liquid/template.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module Liquid
1616
#
1717
class Template
1818
attr_accessor :root, :name
19-
attr_reader :resource_limits, :warnings
19+
attr_reader :resource_limits
2020

2121
attr_reader :profiler
2222

@@ -209,7 +209,6 @@ def configure_options(options)
209209
ParseContext.new(opts)
210210
end
211211

212-
@warnings = parse_context.warnings
213212
parse_context
214213
end
215214

test/integration/template_test.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ def test_instance_assigns_persist_on_same_template_object_between_parses
4444
assert_equal('from instance assigns', t.parse("{{ foo }}").render!)
4545
end
4646

47-
def test_warnings_is_not_exponential_time
48-
str = "false"
49-
100.times do
50-
str = "{% if true %}true{% else %}#{str}{% endif %}"
51-
end
52-
53-
t = Template.parse(str)
54-
assert_equal([], Timeout.timeout(1) { t.warnings })
55-
end
56-
5747
def test_instance_assigns_persist_on_same_template_parsing_between_renders
5848
t = Template.new.parse("{{ foo }}{% assign foo = 'foo' %}{{ foo }}")
5949
assert_equal('foo', t.render!)

0 commit comments

Comments
 (0)