-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathmap.ts
More file actions
22 lines (20 loc) · 877 Bytes
/
map.ts
File metadata and controls
22 lines (20 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as lua from "../../LuaAST";
import * as ts from "typescript";
import { TransformationContext } from "../context";
import { unsupportedProperty } from "../utils/diagnostics";
import { transformArguments } from "../visitors/call";
import { LuaLibFeature, transformLuaLibFunction } from "../utils/lualib";
export function transformMapConstructorCall(
context: TransformationContext,
node: ts.CallExpression,
calledMethod: ts.PropertyAccessExpression
): lua.Expression | undefined {
const args = transformArguments(context, node.arguments);
const methodName = calledMethod.name.text;
switch (methodName) {
case "groupBy":
return transformLuaLibFunction(context, LuaLibFeature.MapGroupBy, node, ...args);
default:
context.diagnostics.push(unsupportedProperty(calledMethod.name, "Map", methodName));
}
}