Skip to content

Commit b146c21

Browse files
committed
fix primitive extensions
1 parent 613442b commit b146c21

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ let std = { scope: { vars: {
14941494
},
14951495
}}}
14961496

1497-
std['<Number>'] = {
1497+
std.scope.vars['<Number>'] = {
14981498
String: {
14991499
native(number) {
15001500
return {
@@ -1507,40 +1507,40 @@ std['<Number>'] = {
15071507
native(number) {
15081508
return {
15091509
type: '<Boolean>',
1510-
value: number.value === 0
1510+
value: number.value !== 0
15111511
}
15121512
}
15131513
}
15141514
}
15151515

1516-
std['<String>'] = {
1516+
std.scope.vars['<String>'] = {
15171517
Boolean: {
15181518
native(string) {
15191519
return {
15201520
type: '<Boolean>',
1521-
value: string.value === ''
1521+
value: string.value !== ''
15221522
}
15231523
}
15241524
}
15251525
}
15261526

1527-
std['<Array>'] = {
1527+
std.scope.vars['<Array>'] = {
15281528
Boolean: {
15291529
native(array) {
15301530
return {
15311531
type: '<Boolean>',
1532-
value: array.value === []
1532+
value: array.value.length !== 0
15331533
}
15341534
}
15351535
}
15361536
}
15371537

1538-
std['<Object>'] = {
1538+
std.scope.vars['<Object>'] = {
15391539
Boolean: {
15401540
native(object) {
15411541
return {
15421542
type: '<Boolean>',
1543-
value: Object.keys(object.value).length === 0 && object.value.constructor === Object
1543+
value: Object.keys(object.value).length !== 0
15441544
}
15451545
}
15461546
}
@@ -1669,8 +1669,8 @@ function try_search(variable,{type,polytype}) {
16691669
}
16701670
}
16711671
}
1672-
if (scope.vars[`<${type}>`] && scope.vars[`<${type}>`][variable]) {
1673-
return scope.vars[`<${type}>`][variable]
1672+
if (scope.vars[type] && scope.vars[type][variable]) {
1673+
return scope.vars[type][variable]
16741674
}
16751675
if (type == '<Object>' && scope.vars[`<*>`] && scope.vars[`<*>`][variable]) {
16761676
return scope.vars[`<*>`][variable]

0 commit comments

Comments
 (0)