Skip to content

Commit a45c5c4

Browse files
committed
Remove process_template!
1 parent b510c79 commit a45c5c4

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

src/analysis/flattening.jl

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -169,40 +169,6 @@ function flatten_parameter!(𝕃, compact, argtypes, ntharg, line, settings)
169169
return @insert_instruction_here(compact, line, settings, tuple(_flatten_parameter!(𝕃, compact, argtypes, ntharg, line, settings)...)::Tuple)
170170
end
171171

172-
# Needs to match flatten_arguments!
173-
function process_template_arg!(𝕃, coeffs, eq_mapping, applied_scopes, argt, template_argt, offset=0, eqoffset=0)::Pair{Int, Int}
174-
if isa(template_argt, Const)
175-
@assert isa(argt, Const) && argt.val === template_argt.val
176-
return Pair{Int, Int}(offset, eqoffset)
177-
elseif Base.issingletontype(template_argt)
178-
@assert isa(template_argt, Type) && argt.instance === template_argt.instance
179-
return Pair{Int, Int}(offset, eqoffset)
180-
elseif Base.isprimitivetype(template_argt)
181-
coeffs[offset+1] = argt
182-
return Pair{Int, Int}(offset + 1, eqoffset)
183-
elseif template_argt === equation
184-
eq_mapping[eqoffset+1] = argt.id
185-
return Pair{Int, Int}(offset, eqoffset + 1)
186-
elseif isabstracttype(template_argt) || ismutabletype(template_argt) || (!isa(template_argt, DataType) && !isa(template_argt, PartialStruct))
187-
return Pair{Int, Int}(offset, eqoffset)
188-
else
189-
if !isa(template_argt, PartialStruct) && Base.datatype_fieldcount(template_argt) === nothing
190-
return Pair{Int, Int}(offset, eqoffset)
191-
end
192-
template_fields = isa(template_argt, PartialStruct) ? template_argt.fields : collect(fieldtypes(template_argt))
193-
return process_template!(𝕃, coeffs, eq_mapping, applied_scopes, Any[Compiler.getfield_tfunc(𝕃, argt, Const(i)) for i = 1:length(template_fields)], template_fields, offset)
194-
end
195-
end
196-
197-
function process_template!(𝕃, coeffs, eq_mapping, applied_scopes, argtypes, template_argtypes, offset=0, eqoffset=0)
198-
@assert length(argtypes) == length(template_argtypes)
199-
for (i, template_arg) in enumerate(template_argtypes)
200-
(offset, eqoffset) = process_template_arg!(𝕃, coeffs, eq_mapping, applied_scopes, argtypes[i], template_arg, offset)
201-
end
202-
return Pair{Int, Int}(offset, eqoffset)
203-
end
204-
205-
206172
remove_variable_and_equation_annotations(argtypes) = Any[widenconst(T) for T in argtypes]
207173

208174
function annotate_variables_and_equations(argtypes::Vector{Any}, map::ArgumentMap)

0 commit comments

Comments
 (0)