mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-26 13:45:13 -07:00
Merge pull request #1141 from ashmaroli/reduce-context-constructor-allocations
Reduce allocations from `Liquid::Context.new`
This commit is contained in:
@@ -21,8 +21,10 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false, resource_limits = nil, static_registers = {}, static_environments = {})
|
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false, resource_limits = nil, static_registers = {}, static_environments = {})
|
||||||
@environments = [environments].flatten
|
@environments = [environments]
|
||||||
@static_environments = [static_environments].flatten.map(&:freeze).freeze
|
@environments.flatten!
|
||||||
|
|
||||||
|
@static_environments = [static_environments].flat_map(&:freeze).freeze
|
||||||
@scopes = [(outer_scope || {})]
|
@scopes = [(outer_scope || {})]
|
||||||
@registers = registers
|
@registers = registers
|
||||||
@static_registers = static_registers.freeze
|
@static_registers = static_registers.freeze
|
||||||
|
|||||||
Reference in New Issue
Block a user