|
@@ -360,7 +360,7 @@ func (r *Runtime) arrayproto_sort(call FunctionCall) Value {
|
|
for i := int64(0); i < length; i++ {
|
|
for i := int64(0); i < length; i++ {
|
|
idx := valueInt(i)
|
|
idx := valueInt(i)
|
|
if o.self.hasPropertyIdx(idx) {
|
|
if o.self.hasPropertyIdx(idx) {
|
|
- a = append(a, o.self.getIdx(idx, nil))
|
|
|
|
|
|
+ a = append(a, nilSafe(o.self.getIdx(idx, nil)))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ar := r.newArrayValues(a)
|
|
ar := r.newArrayValues(a)
|
|
@@ -436,7 +436,7 @@ func (r *Runtime) arrayproto_splice(call FunctionCall) Value {
|
|
for k := int64(0); k < actualDeleteCount; k++ {
|
|
for k := int64(0); k < actualDeleteCount; k++ {
|
|
from := valueInt(k + actualStart)
|
|
from := valueInt(k + actualStart)
|
|
if o.self.hasPropertyIdx(from) {
|
|
if o.self.hasPropertyIdx(from) {
|
|
- createDataPropertyOrThrow(a, valueInt(k), o.self.getIdx(from, nil))
|
|
|
|
|
|
+ createDataPropertyOrThrow(a, valueInt(k), nilSafe(o.self.getIdx(from, nil)))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -445,7 +445,7 @@ func (r *Runtime) arrayproto_splice(call FunctionCall) Value {
|
|
from := valueInt(k + actualDeleteCount)
|
|
from := valueInt(k + actualDeleteCount)
|
|
to := valueInt(k + itemCount)
|
|
to := valueInt(k + itemCount)
|
|
if o.self.hasPropertyIdx(from) {
|
|
if o.self.hasPropertyIdx(from) {
|
|
- o.self.setOwnIdx(to, o.self.getIdx(from, nil), true)
|
|
|
|
|
|
+ o.self.setOwnIdx(to, nilSafe(o.self.getIdx(from, nil)), true)
|
|
} else {
|
|
} else {
|
|
o.self.deleteIdx(to, true)
|
|
o.self.deleteIdx(to, true)
|
|
}
|
|
}
|
|
@@ -459,7 +459,7 @@ func (r *Runtime) arrayproto_splice(call FunctionCall) Value {
|
|
from := valueInt(k + actualDeleteCount - 1)
|
|
from := valueInt(k + actualDeleteCount - 1)
|
|
to := valueInt(k + itemCount - 1)
|
|
to := valueInt(k + itemCount - 1)
|
|
if o.self.hasPropertyIdx(from) {
|
|
if o.self.hasPropertyIdx(from) {
|
|
- o.self.setOwnIdx(to, o.self.getIdx(from, nil), true)
|
|
|
|
|
|
+ o.self.setOwnIdx(to, nilSafe(o.self.getIdx(from, nil)), true)
|
|
} else {
|
|
} else {
|
|
o.self.deleteIdx(to, true)
|
|
o.self.deleteIdx(to, true)
|
|
}
|
|
}
|
|
@@ -500,7 +500,7 @@ func (r *Runtime) arrayproto_unshift(call FunctionCall) Value {
|
|
from := valueInt(k)
|
|
from := valueInt(k)
|
|
to := valueInt(k + argCount)
|
|
to := valueInt(k + argCount)
|
|
if o.self.hasPropertyIdx(from) {
|
|
if o.self.hasPropertyIdx(from) {
|
|
- o.self.setOwnIdx(to, o.self.getIdx(from, nil), true)
|
|
|
|
|
|
+ o.self.setOwnIdx(to, nilSafe(o.self.getIdx(from, nil)), true)
|
|
} else {
|
|
} else {
|
|
o.self.deleteIdx(to, true)
|
|
o.self.deleteIdx(to, true)
|
|
}
|
|
}
|
|
@@ -987,7 +987,7 @@ func (r *Runtime) arrayproto_copyWithin(call FunctionCall) Value {
|
|
}
|
|
}
|
|
for count > 0 {
|
|
for count > 0 {
|
|
if o.self.hasPropertyIdx(valueInt(from)) {
|
|
if o.self.hasPropertyIdx(valueInt(from)) {
|
|
- o.self.setOwnIdx(valueInt(to), o.self.getIdx(valueInt(from), nil), true)
|
|
|
|
|
|
+ o.self.setOwnIdx(valueInt(to), nilSafe(o.self.getIdx(valueInt(from), nil)), true)
|
|
} else {
|
|
} else {
|
|
o.self.deleteIdx(valueInt(to), true)
|
|
o.self.deleteIdx(valueInt(to), true)
|
|
}
|
|
}
|
|
@@ -1084,7 +1084,7 @@ func (r *Runtime) flattenIntoArray(target, source *Object, sourceLen, start, dep
|
|
for sourceIndex < sourceLen {
|
|
for sourceIndex < sourceLen {
|
|
p := intToValue(sourceIndex)
|
|
p := intToValue(sourceIndex)
|
|
if source.hasProperty(p.toString()) {
|
|
if source.hasProperty(p.toString()) {
|
|
- element := source.get(p, source)
|
|
|
|
|
|
+ element := nilSafe(source.get(p, source))
|
|
if mapperFunction != nil {
|
|
if mapperFunction != nil {
|
|
element = mapperFunction(FunctionCall{
|
|
element = mapperFunction(FunctionCall{
|
|
This: thisArg,
|
|
This: thisArg,
|