mirror of
https://github.com/mdgriffith/elm-optimize-level-2.git
synced 2024-12-01 19:35:08 +03:00
add just and cons to stubbed in typevariant information
This commit is contained in:
parent
c26a70f0d7
commit
05b9fea928
@ -10,54 +10,45 @@ elmParser.setLanguage(Elm);
|
||||
// List variants
|
||||
|
||||
const nil: ElmVariant = {
|
||||
typeName: "List",
|
||||
name: "Nil",
|
||||
jsName: "_List_Nil",
|
||||
typeName: 'List',
|
||||
name: 'Nil',
|
||||
jsName: '_List_Nil',
|
||||
index: 0,
|
||||
slots: [],
|
||||
totalTypeSlotCount: 2
|
||||
}
|
||||
|
||||
totalTypeSlotCount: 2,
|
||||
};
|
||||
|
||||
const cons: ElmVariant = {
|
||||
typeName: "List",
|
||||
name: "Cons",
|
||||
jsName: "_List_Nil",
|
||||
typeName: 'List',
|
||||
name: 'Cons',
|
||||
jsName: '_List_Nil',
|
||||
index: 1,
|
||||
slots: [],
|
||||
totalTypeSlotCount: 2
|
||||
}
|
||||
|
||||
|
||||
const listVariants =
|
||||
[nil
|
||||
// , cons
|
||||
]
|
||||
slots: ['a'],
|
||||
totalTypeSlotCount: 2,
|
||||
};
|
||||
|
||||
const listVariants = [nil, cons];
|
||||
|
||||
// Maybe variants
|
||||
|
||||
const nothing: ElmVariant = {
|
||||
typeName: "Maybe",
|
||||
name: "Nothing",
|
||||
jsName: "$elm$core$Maybe$Nothing",
|
||||
typeName: 'Maybe',
|
||||
name: 'Nothing',
|
||||
jsName: '$elm$core$Maybe$Nothing',
|
||||
index: 1,
|
||||
slots: [],
|
||||
totalTypeSlotCount: 1
|
||||
}
|
||||
|
||||
totalTypeSlotCount: 1,
|
||||
};
|
||||
|
||||
const just: ElmVariant = {
|
||||
typeName: "Maybe",
|
||||
name: "Just",
|
||||
jsName: "$elm$core$Maybe$Just",
|
||||
typeName: 'Maybe',
|
||||
name: 'Just',
|
||||
jsName: '$elm$core$Maybe$Just',
|
||||
index: 0,
|
||||
slots: [],
|
||||
totalTypeSlotCount: 1
|
||||
}
|
||||
const maybe = [nothing]
|
||||
|
||||
|
||||
slots: ['a'],
|
||||
totalTypeSlotCount: 1,
|
||||
};
|
||||
const maybe = [nothing, just];
|
||||
|
||||
export const parseElm = ({
|
||||
author,
|
||||
@ -69,7 +60,10 @@ export const parseElm = ({
|
||||
source: string;
|
||||
}): { [id: string]: ElmVariant[] } => {
|
||||
const tree = elmParser.parse(source);
|
||||
const found: { [id: string]: ElmVariant[] } = { "List": listVariants, "Maybe": maybe };
|
||||
const found: { [id: string]: ElmVariant[] } = {
|
||||
List: listVariants,
|
||||
Maybe: maybe,
|
||||
};
|
||||
|
||||
/*
|
||||
A quick reference for using treesitter.
|
||||
|
Loading…
Reference in New Issue
Block a user