mirror of
https://github.com/robertkrimen/otto
synced 2025-09-28 18:45:22 +08:00
Have newNumberNode use stringToFloat
This commit is contained in:
parent
1728c036d4
commit
512c48831e
|
@ -2,7 +2,6 @@ package otto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type _arrayNode struct {
|
type _arrayNode struct {
|
||||||
|
@ -384,10 +383,12 @@ func newBooleanNode(text string) *_valueNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newNumberNode(text string) *_valueNode {
|
func newNumberNode(text string) *_valueNode {
|
||||||
value, error := strconv.ParseFloat(text, 64)
|
// TODO Can there be an error here? Is NaN a good catch-all?
|
||||||
if error != nil {
|
value := stringToFloat(text)
|
||||||
throwHereBeDragons(error)
|
//value, err := strconv.ParseFloat(text, 64)
|
||||||
}
|
//if err != nil {
|
||||||
|
// throwHereBeDragons(error)
|
||||||
|
//}
|
||||||
return &_valueNode{
|
return &_valueNode{
|
||||||
_nodeType: nodeValue,
|
_nodeType: nodeValue,
|
||||||
Text: text,
|
Text: text,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user