Skip to content

Commit 0fa7196

Browse files
committed
Experimental StorageKey feature
1 parent 31dc809 commit 0fa7196

File tree

55 files changed

+3824
-98
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3824
-98
lines changed

forc-pkg/src/manifest.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ pub struct BuildProfile {
213213
pub include_tests: bool,
214214
pub json_abi_with_callpaths: bool,
215215
pub error_on_warnings: bool,
216+
pub experimental_storage: bool,
216217
}
217218

218219
impl Dependency {
@@ -602,6 +603,7 @@ impl BuildProfile {
602603
include_tests: false,
603604
json_abi_with_callpaths: false,
604605
error_on_warnings: false,
606+
experimental_storage: false,
605607
}
606608
}
607609

@@ -617,6 +619,7 @@ impl BuildProfile {
617619
include_tests: false,
618620
json_abi_with_callpaths: false,
619621
error_on_warnings: false,
622+
experimental_storage: false,
620623
}
621624
}
622625
}

forc-pkg/src/pkg.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ pub struct BuildOpts {
297297
pub tests: bool,
298298
/// The set of options to filter by member project kind.
299299
pub member_filter: MemberFilter,
300+
/// Enable the experimental storage implementation and UI.
301+
pub experimental_storage: bool,
300302
}
301303

302304
/// The set of options to filter type of projects to build in a workspace.
@@ -1510,7 +1512,8 @@ pub fn sway_build_config(
15101512
.print_finalized_asm(build_profile.print_finalized_asm)
15111513
.print_intermediate_asm(build_profile.print_intermediate_asm)
15121514
.print_ir(build_profile.print_ir)
1513-
.include_tests(build_profile.include_tests);
1515+
.include_tests(build_profile.include_tests)
1516+
.experimental_storage(build_profile.experimental_storage);
15141517
Ok(build_config)
15151518
}
15161519

@@ -1952,6 +1955,7 @@ fn build_profile_from_opts(
19521955
time_phases,
19531956
tests,
19541957
error_on_warnings,
1958+
experimental_storage,
19551959
..
19561960
} = build_options;
19571961
let mut selected_build_profile = BuildProfile::DEBUG;
@@ -1997,6 +2001,7 @@ fn build_profile_from_opts(
19972001
profile.include_tests |= tests;
19982002
profile.json_abi_with_callpaths |= pkg.json_abi_with_callpaths;
19992003
profile.error_on_warnings |= error_on_warnings;
2004+
profile.experimental_storage |= experimental_storage;
20002005

20012006
Ok((selected_build_profile.to_string(), profile))
20022007
}

forc-plugins/forc-client/src/op/deploy.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,6 @@ fn build_opts_from_cmd(cmd: &cmd::Deploy) -> pkg::BuildOpts {
177177
build_target: BuildTarget::default(),
178178
tests: false,
179179
member_filter: pkg::MemberFilter::only_contracts(),
180+
experimental_storage: cmd.build_profile.experimental_storage,
180181
}
181182
}

forc-plugins/forc-client/src/op/run.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,5 +173,6 @@ fn build_opts_from_cmd(cmd: &cmd::Run) -> pkg::BuildOpts {
173173
debug_outfile: cmd.build_output.debug_file.clone(),
174174
tests: false,
175175
member_filter: pkg::MemberFilter::only_scripts(),
176+
experimental_storage: cmd.build_profile.experimental_storage,
176177
}
177178
}

forc-test/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ pub struct Opts {
106106
pub error_on_warnings: bool,
107107
/// Output the time elapsed over each part of the compilation process.
108108
pub time_phases: bool,
109+
/// Enable the experimental storage implementation and UI.
110+
pub experimental_storage: bool,
109111
}
110112

111113
/// The set of options provided for controlling logs printed for each test.
@@ -360,6 +362,7 @@ impl Opts {
360362
time_phases: self.time_phases,
361363
tests: true,
362364
member_filter: Default::default(),
365+
experimental_storage: self.experimental_storage,
363366
}
364367
}
365368
}

forc/src/cli/commands/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,6 @@ fn opts_from_cmd(cmd: Command) -> forc_test::Opts {
180180
binary_outfile: cmd.build.output.bin_file,
181181
debug_outfile: cmd.build.output.debug_file,
182182
build_target: cmd.build.build_target,
183+
experimental_storage: cmd.build.profile.experimental_storage,
183184
}
184185
}

forc/src/cli/shared.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ pub struct BuildProfile {
4949
/// Treat warnings as errors.
5050
#[clap(long)]
5151
pub error_on_warnings: bool,
52+
/// Enable the experimental storage implementation and UI.
53+
#[clap(long)]
54+
pub experimental_storage: bool,
5255
}
5356

5457
/// Options related to printing stages of compiler output.

forc/src/ops/forc_build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ fn opts_from_cmd(cmd: BuildCommand) -> pkg::BuildOpts {
3838
build_target: cmd.build.build_target,
3939
tests: cmd.tests,
4040
member_filter: Default::default(),
41+
experimental_storage: cmd.build.profile.experimental_storage,
4142
}
4243
}

sway-ast/src/item/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub enum FnArgs {
7979
self_token: SelfToken,
8080
ref_self: Option<RefToken>,
8181
mutable_self: Option<MutToken>,
82+
ty: Option<(ColonToken, Ty)>,
8283
args_opt: Option<(CommaToken, Punctuated<FnArg, CommaToken>)>,
8384
},
8485
}

sway-core/src/build_config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub struct BuildConfig {
4545
pub(crate) print_finalized_asm: bool,
4646
pub(crate) print_ir: bool,
4747
pub(crate) include_tests: bool,
48+
pub(crate) experimental_storage: bool,
4849
}
4950

5051
impl BuildConfig {
@@ -86,6 +87,7 @@ impl BuildConfig {
8687
print_finalized_asm: false,
8788
print_ir: false,
8889
include_tests: false,
90+
experimental_storage: false,
8991
}
9092
}
9193

@@ -117,6 +119,13 @@ impl BuildConfig {
117119
}
118120
}
119121

122+
pub fn experimental_storage(self, a: bool) -> Self {
123+
Self {
124+
experimental_storage: a,
125+
..self
126+
}
127+
}
128+
120129
/// Whether or not to include test functions in parsing, type-checking and codegen.
121130
///
122131
/// This should be set to `true` by invocations like `forc test` or `forc check --tests`.

0 commit comments

Comments
 (0)