Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Commit

Permalink
Renamed Value.ToPrimitiveString() to ToString() which matches a metho…
Browse files Browse the repository at this point in the history
…d that existed in the master.
  • Loading branch information
dop251 committed Jul 26, 2020
1 parent bc10261 commit f197596
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion builtin_array.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (r *Runtime) writeItemLocaleString(item Value, buf *strings.Builder) {
strVal := c(FunctionCall{
This: item,
})
buf.WriteString(strVal.ToPrimitiveString().String())
buf.WriteString(strVal.ToString().String())
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ func createDataPropertyOrThrow(o *Object, p Value, v Value) {
}

func toPropertyKey(key Value) Value {
return key.ToPrimitiveString()
return key.ToString()
}

func (r *Runtime) getVStr(v Value, p unistring.String) Value {
Expand Down
2 changes: 1 addition & 1 deletion string_ascii.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (s asciiString) toString() valueString {
return s
}

func (s asciiString) ToPrimitiveString() Value {
func (s asciiString) ToString() Value {
return s
}

Expand Down
2 changes: 1 addition & 1 deletion string_unicode.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (s unicodeString) toString() valueString {
return s
}

func (s unicodeString) ToPrimitiveString() Value {
func (s unicodeString) ToString() Value {
return s
}

Expand Down
22 changes: 11 additions & 11 deletions value.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Value interface {
ToInteger() int64
toString() valueString
string() unistring.String
ToPrimitiveString() Value
ToString() Value
String() string
ToFloat() float64
ToNumber() Value
Expand Down Expand Up @@ -155,7 +155,7 @@ func (i valueInt) string() unistring.String {
return unistring.String(i.String())
}

func (i valueInt) ToPrimitiveString() Value {
func (i valueInt) ToString() Value {
return i
}

Expand Down Expand Up @@ -241,7 +241,7 @@ func (b valueBool) toString() valueString {
return stringFalse
}

func (b valueBool) ToPrimitiveString() Value {
func (b valueBool) ToString() Value {
return b
}

Expand Down Expand Up @@ -337,7 +337,7 @@ func (n valueNull) string() unistring.String {
return stringNull.string()
}

func (n valueNull) ToPrimitiveString() Value {
func (n valueNull) ToString() Value {
return n
}

Expand All @@ -349,7 +349,7 @@ func (u valueUndefined) toString() valueString {
return stringUndefined
}

func (u valueUndefined) ToPrimitiveString() Value {
func (u valueUndefined) ToString() Value {
return u
}

Expand Down Expand Up @@ -447,7 +447,7 @@ func (p *valueProperty) string() unistring.String {
return ""
}

func (p *valueProperty) ToPrimitiveString() Value {
func (p *valueProperty) ToString() Value {
return _undefined
}

Expand Down Expand Up @@ -556,7 +556,7 @@ func (f valueFloat) string() unistring.String {
return unistring.String(f.String())
}

func (f valueFloat) ToPrimitiveString() Value {
func (f valueFloat) ToString() Value {
return f
}

Expand Down Expand Up @@ -663,8 +663,8 @@ func (o *Object) string() unistring.String {
return o.toPrimitiveString().string()
}

func (o *Object) ToPrimitiveString() Value {
return o.toPrimitiveString().ToPrimitiveString()
func (o *Object) ToString() Value {
return o.toPrimitiveString().ToString()
}

func (o *Object) String() string {
Expand Down Expand Up @@ -819,7 +819,7 @@ func (o valueUnresolved) string() unistring.String {
return ""
}

func (o valueUnresolved) ToPrimitiveString() Value {
func (o valueUnresolved) ToString() Value {
o.throw()
return nil
}
Expand Down Expand Up @@ -892,7 +892,7 @@ func (s *valueSymbol) toString() valueString {
panic(typeError("Cannot convert a Symbol value to a string"))
}

func (s *valueSymbol) ToPrimitiveString() Value {
func (s *valueSymbol) ToString() Value {
return s
}

Expand Down

0 comments on commit f197596

Please sign in to comment.