forked from defunkt/ReefVM
just native, <function>
This commit is contained in:
parent
4d2ae1c9fe
commit
93eff53a76
14
src/value.ts
14
src/value.ts
|
|
@ -20,7 +20,7 @@ export type Value =
|
|||
named: boolean,
|
||||
value: '<function>'
|
||||
}
|
||||
| { type: 'native_function', fn: NativeFunction, value: '<native>' }
|
||||
| { type: 'native', fn: NativeFunction, value: '<function>' }
|
||||
|
||||
export type Dict = Map<string, Value>
|
||||
|
||||
|
|
@ -104,8 +104,8 @@ export function toString(v: Value): string {
|
|||
return 'null'
|
||||
case 'function':
|
||||
return '<function>'
|
||||
case 'native_function':
|
||||
return '<native>'
|
||||
case 'native':
|
||||
return '<function>'
|
||||
case 'array':
|
||||
return `[${v.value.map(toString).join(', ')}]`
|
||||
case 'dict': {
|
||||
|
|
@ -126,9 +126,7 @@ export function isEqual(a: Value, b: Value): boolean {
|
|||
case 'null':
|
||||
return true
|
||||
case 'boolean':
|
||||
return a.value === b.value
|
||||
case 'number':
|
||||
return a.value === b.value
|
||||
case 'string':
|
||||
return a.value === b.value
|
||||
case 'array': {
|
||||
|
|
@ -149,9 +147,8 @@ export function isEqual(a: Value, b: Value): boolean {
|
|||
return String(a.value) === String(b.value)
|
||||
}
|
||||
case 'function':
|
||||
case 'native':
|
||||
return false // functions never equal
|
||||
case 'native_function':
|
||||
return false // native functions never equal
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
@ -174,9 +171,8 @@ export function fromValue(v: Value): any {
|
|||
case 'regex':
|
||||
return v.value
|
||||
case 'function':
|
||||
case 'native':
|
||||
return '<function>'
|
||||
case 'native_function':
|
||||
return '<native>'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user