Comparing version 0.0.9-24 to 0.0.9-25
@@ -96,3 +96,16 @@ "use strict"; | ||
function generateListValue(list) { | ||
const items = List.map(generateExpression, list.items); | ||
function generator(expression) { | ||
switch (expression.kind) { | ||
case "IfStatement": { | ||
return generateInlineIf(expression); | ||
} | ||
case "CaseStatement": { | ||
return generateInlineCase(expression); | ||
} | ||
default: { | ||
return generateExpression(expression); | ||
} | ||
} | ||
} | ||
const items = List.map(generator, list.items); | ||
switch (items.length) { | ||
@@ -99,0 +112,0 @@ case 0: { |
@@ -471,3 +471,16 @@ "use strict"; | ||
function generateListValue(list) { | ||
const items = List.map(generateExpression, list.items); | ||
function generator(expression) { | ||
switch (expression.kind) { | ||
case "IfStatement": { | ||
return generateInlineIf(expression); | ||
} | ||
case "CaseStatement": { | ||
return generateInlineCase(expression); | ||
} | ||
default: { | ||
return generateExpression(expression); | ||
} | ||
} | ||
} | ||
const items = List.map(generator, list.items); | ||
switch (items.length) { | ||
@@ -474,0 +487,0 @@ case 0: { |
@@ -1,2 +0,2 @@ | ||
import { ArrowToken, CloseBracketToken, IdentifierToken, OpenBracketToken, StringToken } from "./Tokens_derw"; | ||
import { ArrowToken, CloseBracketToken, IdentifierToken, OpenBracketToken, StringToken } from "./Tokens"; | ||
export declare type TypeTokenRaw = IdentifierToken | ArrowToken | OpenBracketToken | CloseBracketToken | StringToken; | ||
@@ -3,0 +3,0 @@ export declare type TypeToken = IdentifierToken | ArrowToken | OpenBracketToken | CloseBracketToken | StringToken | BaseTypeToken | FunctionTypeToken; |
import { Result } from "@eeue56/ts-core/build/main/lib/result"; | ||
import { Block, CaseStatement, Expression, Function, Import, ObjectLiteralType, Type, TypedBlock } from "./types"; | ||
declare type ScopedValues = Record<string, Type>; | ||
export declare function isSameType(first: Type, second: Type, topLevel: boolean): boolean; | ||
export declare function isSameType(first: Type, second: Type, topLevel: boolean, typedBlocks?: TypedBlock[]): boolean; | ||
export declare function inferType(expression: Expression, expectedType: Type, typedBlocks: TypedBlock[], imports: Import[], valuesInScope: ScopedValues): Result<string, Type>; | ||
@@ -6,0 +6,0 @@ export declare function getCasesFromFunction(block: Function): CaseStatement[]; |
{ | ||
"name": "derw", | ||
"version": "0.0.9-24", | ||
"version": "0.0.9-25", | ||
"description": "An Elm-inspired language that transpiles to TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -109,3 +109,16 @@ import { exportTests } from "../Blocks"; | ||
function generateListValue(list: ListValue): string { | ||
const items: string[] = List.map(generateExpression, list.items); | ||
function generator(expression: Expression): string { | ||
switch (expression.kind) { | ||
case "IfStatement": { | ||
return generateInlineIf(expression); | ||
} | ||
case "CaseStatement": { | ||
return generateInlineCase(expression); | ||
} | ||
default: { | ||
return generateExpression(expression); | ||
} | ||
} | ||
} | ||
const items: string[] = List.map(generator, list.items); | ||
switch (items.length) { | ||
@@ -112,0 +125,0 @@ case 0: { |
@@ -473,3 +473,16 @@ import { exportTests } from "../Blocks"; | ||
function generateListValue(list: ListValue): string { | ||
const items: string[] = List.map(generateExpression, list.items); | ||
function generator(expression: Expression): string { | ||
switch (expression.kind) { | ||
case "IfStatement": { | ||
return generateInlineIf(expression); | ||
} | ||
case "CaseStatement": { | ||
return generateInlineCase(expression); | ||
} | ||
default: { | ||
return generateExpression(expression); | ||
} | ||
} | ||
} | ||
const items: string[] = List.map(generator, list.items); | ||
switch (items.length) { | ||
@@ -476,0 +489,0 @@ case 0: { |
@@ -7,3 +7,3 @@ import { | ||
StringToken, | ||
} from "./Tokens_derw"; | ||
} from "./Tokens"; | ||
@@ -10,0 +10,0 @@ export type TypeTokenRaw = |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1417433
31437