Skip to content

Commit de9be28

Browse files
authored
Merge pull request #219 from JuliaSymbolics/YingboMa-patch-1
Make metadata a keyword
2 parents 0b9ca0a + db9104b commit de9be28

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/types.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ end
173173

174174
Base.nameof(s::Sym) = s.name
175175

176-
ConstructionBase.constructorof(s::Type{<:Sym{T}}) where {T} = Sym{T}
176+
ConstructionBase.constructorof(s::Type{<:Sym{T}}) where {T} = (n,m) -> Sym{T}(n, metadata=m)
177177

178-
function (::Type{Sym{T}})(name, metadata=NO_METADATA) where {T}
178+
function (::Type{Sym{T}})(name; metadata=NO_METADATA) where {T}
179179
Sym{T, typeof(metadata)}(name, metadata)
180180
end
181181

@@ -327,14 +327,14 @@ function ConstructionBase.constructorof(s::Type{<:Term{T}}) where {T}
327327
end
328328
end
329329

330-
function (::Type{Term{T}})(f, args, metadata=NO_METADATA) where {T}
330+
function (::Type{Term{T}})(f, args; metadata=NO_METADATA) where {T}
331331
Term{T, typeof(metadata)}(f, args, metadata, Ref{UInt}(0))
332332
end
333333

334334
istree(t::Term) = true
335335

336-
function Term(f, args, metadata=NO_METADATA)
337-
Term{_promote_symtype(f, args)}(f, args, metadata)
336+
function Term(f, args; metadata=NO_METADATA)
337+
Term{_promote_symtype(f, args)}(f, args, metadata=metadata)
338338
end
339339

340340
operation(x::Term) = getfield(x, :f)

0 commit comments

Comments
 (0)