mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-12-01 19:35:08 +03:00
add description of splitting out function definitions
This commit is contained in:
parent
3ca035c206
commit
54de2d1812
@ -1,3 +1,7 @@
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
import ts from 'typescript';
|
||||
|
||||
export type FuncSplit = {
|
||||
@ -10,6 +14,27 @@ const deriveRawLambdaName = (wrappedName: string): string =>
|
||||
|
||||
const wrapperRegex = /F(?<arity>[1-9]+[0-9]*)/;
|
||||
|
||||
/*
|
||||
|
||||
Split out function definitions so that the raw version of the function can be called.
|
||||
|
||||
This only shows benefit with the `createFuncInlineTransformer`, which will detect when an F3 is being called with 3 arguments and skip the F3 call
|
||||
|
||||
initial
|
||||
|
||||
var $elm$core$String$join = F2(function (sep, chunks) {
|
||||
return A2(_String_join, sep, _List_toArray(chunks));
|
||||
});
|
||||
|
||||
|
||||
transformed
|
||||
|
||||
var $elm$core$String$join_raw = function (sep, chunks) {
|
||||
return A2(_String_join, sep, _List_toArray(chunks));
|
||||
}, $elm$core$String$join = F2($elm$core$String$join_raw);
|
||||
|
||||
|
||||
*/
|
||||
export const createSplitFunctionDeclarationsTransformer = (
|
||||
splits: Map<string, FuncSplit>
|
||||
): ts.TransformerFactory<ts.SourceFile> => context => {
|
||||
|
Loading…
Reference in New Issue
Block a user