goby-lang / goby

Goby - Yet another programming language written in Go
MIT License
3.49k stars 171 forks source link

Support Array.new(args) #832

Closed st0012 closed 4 years ago

st0012 commented 4 years ago

This PR supports multiple ways to initialize an Array:

Array.new(3) #=> [nil, nil, nil]
Array.new(3, true) #=> [true, true, true]
Array.new(3) do |i|
  i * 2
end #=> [0, 2, 4]

Closes #831

codecov[bot] commented 4 years ago

Codecov Report

Merging #832 into master will increase coverage by 0.05%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #832      +/-   ##
=========================================
+ Coverage   80.85%   80.9%   +0.05%     
=========================================
  Files          54      54              
  Lines        7405    7425      +20     
=========================================
+ Hits         5987    6007      +20     
  Misses       1193    1193              
  Partials      225     225
Impacted Files Coverage Δ
vm/array.go 96.34% <100%> (+0.11%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4c2bd49...7c4cff3. Read the comment docs.

st0012 commented 4 years ago

@hachi8833 thanks 👍