Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore elm types #267

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
conditional types
  • Loading branch information
csenn committed Mar 14, 2022
commit cbee81778327ea479b83a21256cae00df84fadae
7 changes: 4 additions & 3 deletions src/elm/conditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { Expression } from './expression';
import { build } from './builder';
import { equals } from '../util/comparison';
import { Context } from '../runtime/context';
import ELM from '../types/elm';

// TODO: Spec lists "Conditional", but it's "If" in the XSD
export class If extends Expression {
condition: any;
th: any;
els: any;

constructor(json: any) {
constructor(json: ELM.If) {
super(json);
this.condition = build(json.condition);
this.th = build(json.then);
Expand All @@ -29,7 +30,7 @@ export class CaseItem {
when: any;
then: any;

constructor(json: any) {
constructor(json: ELM.CaseItem) {
this.when = build(json.when);
this.then = build(json.then);
}
Expand All @@ -40,7 +41,7 @@ export class Case extends Expression {
caseItems: CaseItem[];
els: any;

constructor(json: any) {
constructor(json: ELM.Case) {
super(json);
this.comparand = build(json.comparand);
this.caseItems = json.caseItem.map((ci: any) => new CaseItem(ci));
Expand Down