Skip to content

Commit

Permalink
Merge pull request #90 from mint-lang/development
Browse files Browse the repository at this point in the history
0.3.0
  • Loading branch information
gdotdesign authored Sep 9, 2018
2 parents 9b646ed + be210d9 commit 66277c0
Show file tree
Hide file tree
Showing 222 changed files with 4,824 additions and 1,115 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mint
version: 0.2.1
version: 0.3.0

targets:
mint:
Expand Down
61 changes: 61 additions & 0 deletions spec/compilers/case_with_enum_destructuring
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
enum A(a) {
B(a)
}

enum C(a) {
D(A(a))
}

module Test {
fun a (b : C(a)) : a {
case (b) {
C::D a =>
case (a) {
A::B c =>
c
}
}
}
}
--------------------------------------------------------------------------------
class $$A_B extends Enum {
constructor(_0) {
super()

this._0 = _0

this.length = 1
}
};

class $$C_D extends Enum {
constructor(_0) {
super()

this._0 = _0

this.length = 1
}
};

const $Test = new(class {
a(b) {
return (() => {
let __condition = b

if (__condition instanceof $$C_D) {
const a = __condition._0

return (() => {
let __condition = a

if (__condition instanceof $$A_B) {
const c = __condition._0

return c
}
})()
}
})()
}
})
19 changes: 12 additions & 7 deletions spec/compilers/catch
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module Promise {
}

component Do {
fun test : Void {
do {
fun test : Promise(Never, Void) {
sequence {
greeting =
Promise.reject("hello")

Expand All @@ -30,25 +30,30 @@ const $Promise = new(class {
class $Do extends Component {
test() {
return (async () => {
let _result = null;

try {
let greeting = await (async () => {
try {
return await $Promise.reject(`hello`)
} catch (_error) {
let a = _error;
null

throw new DoError
_result = null

throw new DoError()
}
})()

await null
_result = await null
} catch (_error) {
if (_error instanceof DoError) {} else {
console.warn(`Unhandled error in do statement`)
console.log(_error)
console.warn(`Unhandled error in sequence expression:`)
console.warn(_error)
}
}

return _result
})()
}

Expand Down
60 changes: 0 additions & 60 deletions spec/compilers/do_with_catch

This file was deleted.

83 changes: 78 additions & 5 deletions spec/compilers/enum
Original file line number Diff line number Diff line change
@@ -1,19 +1,92 @@
enum Test {
enum Test(a) {
X
Y
Z(Result(a, Number))
}

enum Result(error, value) {
Error(error)
Ok(value)
Other(error, value)
}

module X {
fun a : Test {
fun a : Test(a) {
Test::X
}

fun b : Result(String, String) {
Result::Other("", "")
}

fun c : Test(String) {
Test::Z(Result::Error(""))
}
}
--------------------------------------------------------------------------------
$Test_X = Symbol.for(`Test_X`)
$Test_Y = Symbol.for(`Test_Y`)
class $$Test_X extends Enum {
constructor() {
super()

this.length = 0
}
};
class $$Test_Y extends Enum {
constructor() {
super()

this.length = 0
}
};
class $$Test_Z extends Enum {
constructor(_0) {
super()

this._0 = _0

this.length = 1
}
};

class $$Result_Error extends Enum {
constructor(_0) {
super()

this._0 = _0

this.length = 1
}
};
class $$Result_Ok extends Enum {
constructor(_0) {
super()

this._0 = _0

this.length = 1
}
};
class $$Result_Other extends Enum {
constructor(_0, _1) {
super()

this._0 = _0
this._1 = _1

this.length = 2
}
};

const $X = new(class {
a() {
return $Test_X
return new $$Test_X()
}

b() {
return new $$Result_Other(``, ``)
}

c() {
return new $$Test_Z(new $$Result_Error(``))
}
})
14 changes: 9 additions & 5 deletions spec/compilers/finally
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
component Do {
fun test : Void {
do {
fun test : Promise(Never, Void) {
sequence {
void
} finally {
void
Expand All @@ -15,16 +15,20 @@ component Do {
class $Do extends Component {
test() {
return (async () => {
let _result = null;

try {
await null
_result = await null
} catch (_error) {
if (_error instanceof DoError) {} else {
console.warn(`Unhandled error in do statement`)
console.log(_error)
console.warn(`Unhandled error in sequence expression:`)
console.warn(_error)
}
} finally {
null
}

return _result
})()
}

Expand Down
2 changes: 1 addition & 1 deletion spec/compilers/next_call
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ component Test {
state name : String = "Joe"
state age : Number = 24

fun test : Void {
fun test : Promise(Never, Void) {
next
{
name = "Hello",
Expand Down
52 changes: 52 additions & 0 deletions spec/compilers/parallel_simple
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
component Parallel {
fun test : Promise(Never, String) {
parallel {
a = "Hello"
b = "World"
} then {
a + b
}
}

fun render : Html {
<div/>
}
}
--------------------------------------------------------------------------------
class $Parallel extends Component {
test() {
return (async () => {
let _result = null;

try {
let a = null;
let b = null;

await Promise.all([
(async () => {
a = await `Hello`
})(),

(async () => {
b = await `World`
})()
])

_result = a + b
} catch (_error) {
if (_error instanceof DoError) {} else {
console.warn(`Unhandled error in parallel expression:`)
console.warn(_error)
}
}

return _result
})()
}

render() {
return _createElement("div", {})
}
}

$Parallel.displayName = "Parallel"
Loading

0 comments on commit 66277c0

Please sign in to comment.