Skip to content

Commit

Permalink
Refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
gdotdesign committed Sep 18, 2023
1 parent 0150442 commit de0254c
Show file tree
Hide file tree
Showing 1,485 changed files with 18,813 additions and 17,994 deletions.
11 changes: 6 additions & 5 deletions spec/compilers/block_with_early_return
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ enum Test {
A(String)
B(String)
}

component Main {
fun render : String {
let Test::A(a) =
Expand All @@ -11,25 +12,25 @@ component Main {
}
}
--------------------------------------------------------------------------------
class B extends _E {
class A extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class C extends _E {
class B extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class A extends _C {
class C extends _C {
render() {
const b = __match(new B(`Some string...`), _PE(B,[
const b = __match(_n(A)(`Some string...`), _PE(A,[
_PV
]));

Expand All @@ -42,4 +43,4 @@ class A extends _C {
}
};

A.displayName = "Main";
C.displayName = "Main";
10 changes: 5 additions & 5 deletions spec/compilers/block_with_early_return_await
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@ component Main {
}
}
--------------------------------------------------------------------------------
class B extends _E {
class A extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class C extends _E {
class B extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class A extends _C {
class C extends _C {
render() {
(async () => {
const b = __match(await new B(`Some string...`), _PE(B,[
const b = __match(await _n(A)(`Some string...`), _PE(A,[
_PV
]));

Expand All @@ -51,4 +51,4 @@ class A extends _C {
}
};

A.displayName = "Main";
C.displayName = "Main";
87 changes: 0 additions & 87 deletions spec/compilers/case_with_enum_destructuring

This file was deleted.

87 changes: 87 additions & 0 deletions spec/compilers/case_with_type_destructuring
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
enum A(a) {
B(a)
}

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

component Main {
fun test (b : C(a)) : a {
case (b) {
C::X => ""
C::D(a) =>
case (a) {
A::B(c) =>
c
}
}
}

fun render : String {
test(C::D(A::B("")))

""
}
}
--------------------------------------------------------------------------------
class A extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class B extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class C extends _E {
constructor() {
super();
this.length = 0;
}
};

class D extends _C {
a(b) {
return _match(b,[
[
_PE(C,[]),
() => {
return ``
}
],
[
_PE(B,[
_PV
]),
(c) => {
return _match(c,[
[
_PE(A,[
_PV
]),
(d) => {
return d
}
]
])
}
]
]);
}

render() {
this.a(_n(B)(_n(A)(``)));
return ``;
}
};

D.displayName = "Main";
20 changes: 10 additions & 10 deletions spec/compilers/component_instance_access
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ component Main {
}
}
--------------------------------------------------------------------------------
class C extends _E {
class A extends _E {
constructor(_0) {
super();
this._0 = _0;
this.length = 1;
}
};

class D extends _E {
class B extends _E {
constructor() {
super();
this.length = 0;
}
};

class A extends _C {
class C extends _C {
get a() {
return `Instance`
}
Expand All @@ -53,25 +53,25 @@ class A extends _C {
}
};

A.displayName = "Instance";
C.displayName = "Instance";

class B extends _C {
class D extends _C {
get c() {
return (this._instance ? new C(this._instance) : new D);
return (this._instance ? new A(this._instance) : new B);
}

b() {
return _match(this.c,[
[
_PE(C,[
_PE(A,[
_PV
]),
(d) => {
return d.a
}
],
[
_PE(D,[]),
_PE(B,[]),
() => {
return ``
}
Expand All @@ -83,11 +83,11 @@ class B extends _C {
return _h("div", {
"onClick": (event => (this.b)(_normalizeEvent(event)))
}, [
_h(A, {
_h(C, {
ref: (instance) => { this._instance = instance }
})
]);
}
};

B.displayName = "Main";
D.displayName = "Main";
44 changes: 44 additions & 0 deletions spec/compilers/css_with_if_with_interpolation
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
component Main {
style test {
color: yellow;

if (true) {
color: #{"red"};
} else {
color: blue;
}
}

fun render : Html {
<div::test/>
}
}
--------------------------------------------------------------------------------
class A extends _C {
$Main_test() {
const _ = {};

(true ? Object.assign(_, {
[`--a-a`]: `red`
}) : Object.assign(_, {
[`--a-a`]: `blue`
}));

return _;
}

render() {
return _h("div", {
className: `Main_test`,
style: _style([this.$Main_test()])
});
}
};

A.displayName = "Main";

_insertStyles(`
.Main_test {
color: var(--a-a, yellow);
}
`);
Loading

0 comments on commit de0254c

Please sign in to comment.