Skip to content

Commit

Permalink
revert prev commit & add missing impl & regen tests
Browse files Browse the repository at this point in the history
  • Loading branch information
notV4l committed Jan 17, 2024
1 parent 6f5abed commit 2f11ca3
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 60 deletions.
4 changes: 4 additions & 0 deletions crates/dojo-core/src/world.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ trait IWorldProvider<T> {
fn world(self: @T) -> IWorldDispatcher;
}

#[starknet::interface]
trait IDojoResourceProvider<T> {
fn dojo_resource(self: @T) -> felt252;
}

#[starknet::contract]
mod world {
Expand Down
7 changes: 5 additions & 2 deletions crates/dojo-lang/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ impl DojoContract {
use dojo::world::IWorldDispatcher;
use dojo::world::IWorldDispatcherTrait;
use dojo::world::IWorldProvider;
use dojo::world::IDojoResourceProvider;
component!(path: dojo::components::upgradeable::upgradeable, storage: \
upgradeable, event: UpgradeableEvent);
#[abi(embed_v0)]
fn dojo_resource(self: @ContractState) -> felt252 {
'$name$'
impl DojoResourceProviderImpl of IDojoResourceProvider<ContractState> {
fn dojo_resource(self: @ContractState) -> felt252 {
'$name$'
}
}
#[abi(embed_v0)]
Expand Down
24 changes: 23 additions & 1 deletion crates/dojo-lang/src/manifest_test_data/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,30 @@ test_manifest_file
{
"name": "dojo_examples::actions::actions",
"address": null,
"class_hash": "0x2d0b29efea4f6ba1c3ad62e1031c3e388173e5b3961b0d946b88e9c4d583e91",
"class_hash": "0x52d3920cfb6eef13c2bcd2c04eb1d7b7123325da7f16bbeeb0f83b8b33c00f",
"abi": [
{
"type": "impl",
"name": "DojoResourceProviderImpl",
"interface_name": "dojo::world::IDojoResourceProvider"
},
{
"type": "interface",
"name": "dojo::world::IDojoResourceProvider",
"items": [
{
"type": "function",
"name": "dojo_resource",
"inputs": [],
"outputs": [
{
"type": "core::felt252"
}
],
"state_mutability": "view"
}
]
},
{
"type": "impl",
"name": "WorldProviderImpl",
Expand Down
117 changes: 66 additions & 51 deletions crates/dojo-lang/src/plugin_test_data/system
Original file line number Diff line number Diff line change
Expand Up @@ -241,207 +241,207 @@ error: Unsupported attribute.
^********^

error: Unknown inline item macro: 'component'.
--> test_src/lib.cairo[spawn]:9:21
--> test_src/lib.cairo[spawn]:10:21
component!(path: dojo::components::upgradeable::upgradeable, storage: upgradeable, event: UpgradeableEvent);
^**********************************************************************************************************^

error: Unsupported attribute.
--> test_src/lib.cairo[spawn]:11:21
--> test_src/lib.cairo[spawn]:12:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[spawn]:16:21
--> test_src/lib.cairo[spawn]:19:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[spawn]:23:21
--> test_src/lib.cairo[spawn]:26:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[spawn]:33:13
--> test_src/lib.cairo[spawn]:36:13
#[event]
^******^

error: Unsupported attribute.
--> test_src/lib.cairo[spawn]:39:13
--> test_src/lib.cairo[spawn]:42:13
#[storage]
^********^

error: Unsupported attribute.
--> test_src/lib.cairo[spawn]:42:17
--> test_src/lib.cairo[spawn]:45:17
#[substorage(v0)]
^***************^

error: Unknown inline item macro: 'component'.
--> test_src/lib.cairo[proxy]:9:21
--> test_src/lib.cairo[proxy]:10:21
component!(path: dojo::components::upgradeable::upgradeable, storage: upgradeable, event: UpgradeableEvent);
^**********************************************************************************************************^

error: Unsupported attribute.
--> test_src/lib.cairo[proxy]:11:21
--> test_src/lib.cairo[proxy]:12:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[proxy]:16:21
--> test_src/lib.cairo[proxy]:19:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[proxy]:23:21
--> test_src/lib.cairo[proxy]:26:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[proxy]:30:13
--> test_src/lib.cairo[proxy]:33:13
#[event]
^******^

error: Unsupported attribute.
--> test_src/lib.cairo[proxy]:36:13
--> test_src/lib.cairo[proxy]:39:13
#[storage]
^********^

error: Unsupported attribute.
--> test_src/lib.cairo[proxy]:39:17
--> test_src/lib.cairo[proxy]:42:17
#[substorage(v0)]
^***************^

error: Unknown inline item macro: 'component'.
--> test_src/lib.cairo[ctxnamed]:9:21
--> test_src/lib.cairo[ctxnamed]:10:21
component!(path: dojo::components::upgradeable::upgradeable, storage: upgradeable, event: UpgradeableEvent);
^**********************************************************************************************************^

error: Unsupported attribute.
--> test_src/lib.cairo[ctxnamed]:11:21
--> test_src/lib.cairo[ctxnamed]:12:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[ctxnamed]:16:21
--> test_src/lib.cairo[ctxnamed]:19:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[ctxnamed]:23:21
--> test_src/lib.cairo[ctxnamed]:26:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[ctxnamed]:33:13
--> test_src/lib.cairo[ctxnamed]:36:13
#[event]
^******^

error: Unsupported attribute.
--> test_src/lib.cairo[ctxnamed]:39:13
--> test_src/lib.cairo[ctxnamed]:42:13
#[storage]
^********^

error: Unsupported attribute.
--> test_src/lib.cairo[ctxnamed]:42:17
--> test_src/lib.cairo[ctxnamed]:45:17
#[substorage(v0)]
^***************^

error: Unknown inline item macro: 'component'.
--> test_src/lib.cairo[withevent]:9:21
--> test_src/lib.cairo[withevent]:10:21
component!(path: dojo::components::upgradeable::upgradeable, storage: upgradeable, event: UpgradeableEvent);
^**********************************************************************************************************^

error: Unsupported attribute.
--> test_src/lib.cairo[withevent]:11:21
--> test_src/lib.cairo[withevent]:12:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[withevent]:16:21
--> test_src/lib.cairo[withevent]:19:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[withevent]:23:21
--> test_src/lib.cairo[withevent]:26:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[withevent]:27:13
--> test_src/lib.cairo[withevent]:30:13
#[event]
^******^

error: Unsupported attribute.
--> test_src/lib.cairo[withevent]:39:5
--> test_src/lib.cairo[withevent]:42:5
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[withevent]:44:13
--> test_src/lib.cairo[withevent]:47:13
#[storage]
^********^

error: Unsupported attribute.
--> test_src/lib.cairo[withevent]:47:17
--> test_src/lib.cairo[withevent]:50:17
#[substorage(v0)]
^***************^

error: Unknown inline item macro: 'component'.
--> test_src/lib.cairo[withcomponent]:9:21
--> test_src/lib.cairo[withcomponent]:10:21
component!(path: dojo::components::upgradeable::upgradeable, storage: upgradeable, event: UpgradeableEvent);
^**********************************************************************************************************^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:11:21
--> test_src/lib.cairo[withcomponent]:12:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:16:21
--> test_src/lib.cairo[withcomponent]:19:21
#[abi(embed_v0)]
^**************^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:23:21
--> test_src/lib.cairo[withcomponent]:26:21
#[abi(embed_v0)]
^**************^

error: Unknown inline item macro: 'component'.
--> test_src/lib.cairo[withcomponent]:27:5
--> test_src/lib.cairo[withcomponent]:30:5
component!(path: testcomponent1, storage: testcomponent1_storage, event: testcomponent1_event);
^*********************************************************************************************^

error: Unknown inline item macro: 'component'.
--> test_src/lib.cairo[withcomponent]:28:5
--> test_src/lib.cairo[withcomponent]:31:5
component!(path: testcomponent2, storage: testcomponent2_storage, event: testcomponent2_event);
^*********************************************************************************************^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:30:13
--> test_src/lib.cairo[withcomponent]:33:13
#[storage]
^********^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:33:17
--> test_src/lib.cairo[withcomponent]:36:17
#[substorage(v0)]
^***************^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:35:25
--> test_src/lib.cairo[withcomponent]:38:25
#[substorage(v0)]
^***************^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:37:9
--> test_src/lib.cairo[withcomponent]:40:9
#[substorage(v0)]
^***************^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:41:13
--> test_src/lib.cairo[withcomponent]:44:13
#[event]
^******^

error: Unsupported attribute.
--> test_src/lib.cairo[withcomponent]:45:25
--> test_src/lib.cairo[withcomponent]:48:25
#[flat]
^*****^

Expand All @@ -464,10 +464,13 @@ mod testcomponent2 {
use dojo::world::IWorldDispatcher;
use dojo::world::IWorldDispatcherTrait;
use dojo::world::IWorldProvider;
use dojo::world::IDojoResourceProvider;

#[abi(embed_v0)]
fn dojo_resource(self: @ContractState) -> felt252 {
'spawn'
impl DojoResourceProviderImpl of IDojoResourceProvider<ContractState> {
fn dojo_resource(self: @ContractState) -> felt252 {
'spawn'
}
}

#[abi(embed_v0)]
Expand Down Expand Up @@ -509,10 +512,13 @@ impl EventDrop of core::traits::Drop::<Event>;
use dojo::world::IWorldDispatcher;
use dojo::world::IWorldDispatcherTrait;
use dojo::world::IWorldProvider;
use dojo::world::IDojoResourceProvider;

#[abi(embed_v0)]
fn dojo_resource(self: @ContractState) -> felt252 {
'proxy'
impl DojoResourceProviderImpl of IDojoResourceProvider<ContractState> {
fn dojo_resource(self: @ContractState) -> felt252 {
'proxy'
}
}

#[abi(embed_v0)]
Expand Down Expand Up @@ -551,10 +557,13 @@ impl EventDrop of core::traits::Drop::<Event>;
use dojo::world::IWorldDispatcher;
use dojo::world::IWorldDispatcherTrait;
use dojo::world::IWorldProvider;
use dojo::world::IDojoResourceProvider;

#[abi(embed_v0)]
fn dojo_resource(self: @ContractState) -> felt252 {
'ctxnamed'
impl DojoResourceProviderImpl of IDojoResourceProvider<ContractState> {
fn dojo_resource(self: @ContractState) -> felt252 {
'ctxnamed'
}
}

#[abi(embed_v0)]
Expand Down Expand Up @@ -596,10 +605,13 @@ impl EventDrop of core::traits::Drop::<Event>;
use dojo::world::IWorldDispatcher;
use dojo::world::IWorldDispatcherTrait;
use dojo::world::IWorldProvider;
use dojo::world::IDojoResourceProvider;

#[abi(embed_v0)]
fn dojo_resource(self: @ContractState) -> felt252 {
'withevent'
impl DojoResourceProviderImpl of IDojoResourceProvider<ContractState> {
fn dojo_resource(self: @ContractState) -> felt252 {
'withevent'
}
}

#[abi(embed_v0)]
Expand Down Expand Up @@ -647,10 +659,13 @@ impl TestEventDrop of core::traits::Drop::<TestEvent>;
use dojo::world::IWorldDispatcher;
use dojo::world::IWorldDispatcherTrait;
use dojo::world::IWorldProvider;
use dojo::world::IDojoResourceProvider;

#[abi(embed_v0)]
fn dojo_resource(self: @ContractState) -> felt252 {
'withcomponent'
impl DojoResourceProviderImpl of IDojoResourceProvider<ContractState> {
fn dojo_resource(self: @ContractState) -> felt252 {
'withcomponent'
}
}

#[abi(embed_v0)]
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-lang/src/semantics/test_data/get
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ Block(
),
Type(
TypeId(
328,
462,
),
),
],
Expand Down
Loading

0 comments on commit 2f11ca3

Please sign in to comment.