Skip to content

Commit b32547d

Browse files
committed
Refactor UI import to std.ui and fix Window Main keyword conflict
1 parent 9fe628d commit b32547d

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.15)
2-
project(ProXPL VERSION 1.3.0 LANGUAGES C CXX)
2+
project(ProXPL VERSION 1.2.0 LANGUAGES C CXX)
33

44
# Enable C and C++
55
enable_language(C CXX)

examples/testui/src/main.prox

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use UI;
1+
use std.ui;
22

33
App MyLibraryApp {
44
State count = 0;
@@ -7,7 +7,7 @@ App MyLibraryApp {
77
count = count + 1;
88
}
99

10-
Window Main {
10+
Window MainWindow {
1111
Container(className: "hero") {
1212
Text(value: "Welcome to ProXPL UI");
1313
Button(onClick: increment) {

src/compiler/parser/parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ static Stmt *useDecl(Parser *p) {
619619
}
620620

621621
appendString(modules, path);
622-
if (strcmp(path, "UI") == 0) p->uiEnabled = true;
622+
if (strcmp(path, "std.ui") == 0) p->uiEnabled = true;
623623
} while (match(p, 1, TOKEN_COMMA));
624624

625625
consume(p, TOKEN_SEMICOLON, "Expect ';'.");

src/stdlib/stdlib_core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ void registerStdLib(VM* vm) {
159159
registerModule(vm, "std.reflect", reflectMod);
160160

161161
registerModule(vm, "std.core", create_std_core_module());
162+
163+
ObjModule* uiMod = create_empty_module(vm, "UI");
164+
registerModule(vm, "std.native.ui", uiMod);
165+
registerModule(vm, "std.ui", uiMod);
162166

163167
// Legacy
164168
register_convert_natives(vm);

0 commit comments

Comments
 (0)