|
15 | 15 |
|
16 | 16 | import { parse } from '@babel/parser' |
17 | 17 | import type { Expression, Node, ObjectExpression, PatternLike } from '@babel/types' |
18 | | -import { childNodes, isMemberAccess, memberName } from '../babel' |
| 18 | +import { childNodes, memberName } from '../babel' |
19 | 19 | import { parseStoredPath } from '../code-files/ref-path' |
20 | 20 | import { toCodeFile } from '../code-files/to-file' |
21 | 21 | import type { BlockKey, CanonicalBlock } from '../model' |
@@ -295,9 +295,8 @@ class Inference { |
295 | 295 | if (BOOLEAN_FUNCTIONS.has(callee.name)) return 'boolean' |
296 | 296 | return undefined |
297 | 297 | } |
298 | | - if (!isMemberAccess(callee)) return undefined |
299 | 298 | const method = memberName(callee) |
300 | | - if (method === null) return undefined |
| 299 | + if (method === null || !('object' in callee)) return undefined |
301 | 300 | if (callee.object.type === 'Identifier') { |
302 | 301 | if (callee.object.name === 'Math') return this.isBuiltin('Math') ? 'number' : undefined |
303 | 302 | const known = STATIC_KINDS[`${callee.object.name}.${method}`] |
@@ -357,9 +356,8 @@ class Inference { |
357 | 356 | private isArray(node: Node, strict = false): boolean { |
358 | 357 | if (node.type === 'ArrayExpression') return true |
359 | 358 | if (node.type === 'CallExpression' || node.type === 'OptionalCallExpression') { |
360 | | - if (!isMemberAccess(node.callee)) return false |
361 | 359 | const method = memberName(node.callee) |
362 | | - if (method === null) return false |
| 360 | + if (method === null || !('object' in node.callee)) return false |
363 | 361 | if (node.callee.object.type === 'Identifier' && node.callee.object.name === 'Object') { |
364 | 362 | return ( |
365 | 363 | this.isBuiltin('Object') && |
|
0 commit comments