motoko 3.0.0-beta6 → 3.0.0-beta7
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/ast.d.ts +7 -1
- package/lib/ast.d.ts.map +1 -1
- package/lib/ast.js +5 -5
- package/lib/ast.js.map +1 -1
- package/package.json +1 -1
- package/packages/latest/base.json +1 -1
- package/src/ast.ts +13 -6
- package/versions/latest/moc.min.js +1 -1
- package/versions/latest/moc_interpreter.min.js +1 -1
package/src/ast.ts
CHANGED
@@ -9,12 +9,19 @@ export interface CompilerNode {
|
|
9
9
|
export type Span = [number, number];
|
10
10
|
export type AST = AST[] | Node | string | null;
|
11
11
|
|
12
|
-
export interface
|
12
|
+
export interface Source {
|
13
|
+
file?: string;
|
14
|
+
start?: Span;
|
15
|
+
end?: Span;
|
16
|
+
}
|
17
|
+
|
18
|
+
export interface Node extends Source {
|
13
19
|
name: string;
|
14
20
|
file?: string;
|
15
21
|
start?: Span;
|
16
22
|
end?: Span;
|
17
23
|
type?: Node;
|
24
|
+
declaration?: Source;
|
18
25
|
args?: AST[];
|
19
26
|
}
|
20
27
|
|
@@ -51,12 +58,12 @@ export function simplifyAST(ast: CompilerAST): AST {
|
|
51
58
|
};
|
52
59
|
}
|
53
60
|
if (ast.name === ':') {
|
54
|
-
const [
|
55
|
-
// console.log(
|
61
|
+
const [typeAst, type] = ast.args as [CompilerAST, CompilerNode];
|
62
|
+
// console.log(typeAst); ////
|
56
63
|
return {
|
57
|
-
...(typeof
|
58
|
-
? { name:
|
59
|
-
: simplifyAST(
|
64
|
+
...(typeof typeAst === 'string'
|
65
|
+
? { name: typeAst }
|
66
|
+
: simplifyAST(typeAst)),
|
60
67
|
type: simplifyAST(type),
|
61
68
|
};
|
62
69
|
}
|