Skip to content

Commit

Permalink
Merge pull request #9731 from JuliaLang/jn/boot_new
Browse files Browse the repository at this point in the history
optimize primary constructors of Core types
  • Loading branch information
vtjnash committed Jan 13, 2015
2 parents 96c69aa + 96a3810 commit a9f526e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,13 @@ TypeConstructor(p::ANY, t::ANY) = ccall(:jl_new_type_constructor, Any, (Any, Any

Expr(args::ANY...) = _expr(args...)

LineNumberNode(n::Int) = ccall(:jl_new_struct, Any, (Any,Any...), LineNumberNode, n)::LineNumberNode
LabelNode(n::Int) = ccall(:jl_new_struct, Any, (Any,Any...), LabelNode, n)::LabelNode
GotoNode(n::Int) = ccall(:jl_new_struct, Any, (Any,Any...), GotoNode, n)::GotoNode
QuoteNode(x::ANY) = ccall(:jl_new_struct, Any, (Any,Any...), QuoteNode, x)::QuoteNode
NewvarNode(s::Symbol) = ccall(:jl_new_struct, Any, (Any,Any...), NewvarNode, s)::NewvarNode
TopNode(s::Symbol) = ccall(:jl_new_struct, Any, (Any,Any...), TopNode, s)::TopNode
_new(typ::Symbol, argty::Symbol) = eval(:(Core.call(::$(Expr(:call, :(Core.apply_type), :Type, typ)), n::$argty) = $(Expr(:new, typ, :n))))
_new(:LineNumberNode, :Int)
_new(:LabelNode, :Int)
_new(:GotoNode, :Int)
_new(:TopNode, :Symbol)
_new(:NewvarNode, :Symbol)
_new(:QuoteNode, :ANY)

Module(name::Symbol) = ccall(:jl_f_new_module, Any, (Any,), name)::Module
Module() = Module(:anonymous)
Expand Down

0 comments on commit a9f526e

Please sign in to comment.