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

Remove uuid macro #560

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions crates/dojo-lang/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ use self::execute::ExecuteCommand;
use self::find::FindCommand;
use self::get::GetCommand;
use self::set::SetCommand;
use self::uuid::UUIDCommand;

pub mod execute;
pub mod find;
pub mod get;
mod helpers;
pub mod set;
pub mod uuid;

const CAIRO_ERR_MSG_LEN: usize = 31;

Expand All @@ -38,6 +36,7 @@ impl CommandData {
CommandData { rewrite_nodes: vec![], diagnostics: vec![] }
}
}

pub struct Command {
pub rewrite_nodes: Vec<RewriteNode>,
pub diagnostics: Vec<PluginDiagnostic>,
Expand Down Expand Up @@ -68,7 +67,6 @@ impl Command {
match segment {
ast::PathSegment::Simple(segment_simple) => {
match segment_simple.ident(db).text(db).as_str() {
"uuid" => Some(UUIDCommand::from_ast(db, let_pattern, macro_ast).into()),
"set" => Some(SetCommand::from_ast(db, let_pattern, macro_ast).into()),
"get" | "try_get" => {
Some(GetCommand::from_ast(db, let_pattern, macro_ast).into())
Expand Down
37 changes: 0 additions & 37 deletions crates/dojo-lang/src/commands/uuid.rs

This file was deleted.

23 changes: 10 additions & 13 deletions crates/dojo-lang/src/plugin_test_data/system
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ mod Spawn {
use super::Position;
use super::Player;

fn execute(name: felt252) {
let uuid = uuid!();
set !(ctx, (420, (69, uuid)).into_partitioned(), (
fn execute(ctx: Context, name: felt252) {
set !(ctx, (420, (69, ctx.world.uuid())).into_partitioned(), (
Player { name: name },
Position { x: 0, y: 0 },
));
Expand Down Expand Up @@ -299,8 +298,6 @@ mod Spawn {

#[external(v0)]
fn execute(self: @ContractState, ctx: Context, name: felt252) {
let uuid = ctx.world.uuid();

{
let mut calldata = array::ArrayTrait::new();
serde::Serde::serialize(@Player { name: name }, ref calldata);
Expand All @@ -309,7 +306,7 @@ mod Spawn {
.set_entity(
ctx,
'Player',
(420, (69, uuid)).into_partitioned(),
(420, (69, ctx.world.uuid())).into_partitioned(),
0_u8,
array::ArrayTrait::span(@calldata)
);
Expand All @@ -323,7 +320,7 @@ mod Spawn {
.set_entity(
ctx,
'Position',
(420, (69, uuid)).into_partitioned(),
(420, (69, ctx.world.uuid())).into_partitioned(),
0_u8,
array::ArrayTrait::span(@calldata)
);
Expand Down Expand Up @@ -1004,21 +1001,21 @@ mod Proxy {

//! > expected_diagnostics
error: Plugin diagnostic: Invalid arguments. Expected "(context, query, (components,))"
--> lib.cairo:45:14
--> lib.cairo:44:14
set !(ctx, (
^*****^

error: Plugin diagnostic: Component types cannot be empty
--> lib.cairo:136:19
--> lib.cairo:135:19
let err = get!(ctx, player_id.into(), ());
^*****************************^

error: Plugin diagnostic: Unexpected argument type. Expected: "dojo_core::database::query::Query", found: "(?77, ?78, ?79, ?80, ?81)".
--> lib.cairo:50:20
error: Plugin diagnostic: Unexpected argument type. Expected: "dojo_core::database::query::Query", found: "(?78, ?79, ?80, ?81, ?82)".
--> lib.cairo:49:20
set !(ctx, (0, 0, 0, 0, 0), (
^*************^

error: Plugin diagnostic: Unexpected argument type. Expected: "dojo_core::database::query::Query", found: "(?89, ?90, ?91, ?92, ?93)".
--> lib.cairo:50:20
error: Plugin diagnostic: Unexpected argument type. Expected: "dojo_core::database::query::Query", found: "(?90, ?91, ?92, ?93, ?94)".
--> lib.cairo:49:20
set !(ctx, (0, 0, 0, 0, 0), (
^*************^