|
3 | 3 | module Liquid |
4 | 4 | class ParseContext |
5 | 5 | attr_accessor :locale, :line_number, :trim_whitespace, :depth |
6 | | - attr_reader :partial, :warnings, :error_mode, :environment |
| 6 | + attr_reader :partial, :warnings, :environment |
7 | 7 |
|
8 | 8 | def initialize(options = Const::EMPTY_HASH) |
9 | 9 | @environment = options.fetch(:environment, Environment.default) |
@@ -55,25 +55,19 @@ def safe_parse_expression(parser) |
55 | 55 | end |
56 | 56 |
|
57 | 57 | def parse_expression(markup, safe: false) |
58 | | - if !safe && @error_mode == :strict2 |
59 | | - # parse_expression is a widely used API. To maintain backward |
60 | | - # compatibility while raising awareness about strict2 parser standards, |
61 | | - # the safe flag supports API users make a deliberate decision. |
62 | | - # |
63 | | - # In strict2 mode, markup MUST come from a string returned by the parser |
64 | | - # (e.g., parser.expression). We're not calling the parser here to |
65 | | - # prevent redundant parser overhead. |
66 | | - raise Liquid::InternalError, "unsafe parse_expression cannot be used in strict2 mode" |
67 | | - end |
| 58 | + # markup MUST come from a string returned by the parser |
| 59 | + # (e.g., parser.expression). We're not calling the parser here to |
| 60 | + # prevent redundant parser overhead. The `safe` opt-in |
| 61 | + # exists to ensure it is not accidentally still called with |
| 62 | + # the result of a regex. |
| 63 | + raise Liquid::InternalError, "unsafe parse_expression cannot be used" unless safe |
68 | 64 |
|
69 | 65 | Expression.parse(markup, @string_scanner, @expression_cache) |
70 | 66 | end |
71 | 67 |
|
72 | 68 | def partial=(value) |
73 | 69 | @partial = value |
74 | 70 | @options = value ? partial_options : @template_options |
75 | | - |
76 | | - @error_mode = @options[:error_mode] || @environment.error_mode |
77 | 71 | end |
78 | 72 |
|
79 | 73 | def partial_options |
|
0 commit comments