mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-18 17:31:29 +00:00
Try parsing signatures only if node is callable, see #149; Minor refactoring
This commit is contained in:
22
src/ast.ts
22
src/ast.ts
@ -9,7 +9,7 @@ import {
|
||||
STATIC_DELIMITER,
|
||||
INSTANCE_DELIMITER,
|
||||
LIBRARY_PREFIX
|
||||
} from "./program";
|
||||
} from "./common";
|
||||
|
||||
import {
|
||||
Token,
|
||||
@ -110,6 +110,26 @@ export function nodeIsConstantValue(kind: NodeKind): bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Checks if a node might be callable. */
|
||||
export function nodeIsCallable(kind: NodeKind): bool {
|
||||
switch (kind) {
|
||||
case NodeKind.IDENTIFIER:
|
||||
case NodeKind.CALL:
|
||||
case NodeKind.ELEMENTACCESS:
|
||||
case NodeKind.PROPERTYACCESS: return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Checks if a node might be callable with generic arguments. */
|
||||
export function nodeIsGenericCallable(kind: NodeKind): bool {
|
||||
switch (kind) {
|
||||
case NodeKind.IDENTIFIER:
|
||||
case NodeKind.PROPERTYACCESS: return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Base class of all nodes. */
|
||||
export abstract class Node {
|
||||
|
||||
|
Reference in New Issue
Block a user