Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3aa3ba4
Apply "./frb_internal precommit --mode fast"
TrackerSB Jan 17, 2026
eaae3c3
Precise enum name Naive with NaiveDateTime
TrackerSB Jan 17, 2026
929e79b
Precise conversion method name
TrackerSB Jan 17, 2026
ddf3065
Precise variable name
TrackerSB Jan 17, 2026
be0734c
Introduce MirTypeDelegateTime::NaiveDate
TrackerSB Jan 17, 2026
ff285d1
Apply "./frb_internal generate-internal-frb-example-pure-dart && ./fr…
TrackerSB Jan 17, 2026
00321f9
Precise member name
TrackerSB Jan 17, 2026
1760962
Introduce script for running re-generation and precommit fast
TrackerSB Jan 17, 2026
d39e97e
Apply doIt.sh
TrackerSB Jan 17, 2026
0651ef9
Introduce reading test
TrackerSB Jan 17, 2026
92923dc
Implement IntoDart and IntoIntoDart for NaiveDate
TrackerSB Jan 17, 2026
cc29bb6
Apply doIt
TrackerSB Jan 17, 2026
6a43696
Extend tests of TestChronoTwinNormal
TrackerSB Jan 17, 2026
e3d469a
Apply doIt
TrackerSB Jan 17, 2026
2247624
Extend FeatureChronoTwinNormal
TrackerSB Jan 17, 2026
90c9927
Apply doIt
TrackerSB Jan 17, 2026
a02f325
Merge branch 'fzyzcjy:master' into master
TrackerSB Feb 20, 2026
33d9f39
Apply doIt
TrackerSB Feb 20, 2026
62398d4
Apply ./frb_internal generate-run-frb-codegen-command-generate --pack…
TrackerSB Feb 20, 2026
448b25f
Remove doIt.sh
TrackerSB Feb 20, 2026
d95922d
Apply ./frb_internal generate-run-frb-codegen-command-generate --pack…
TrackerSB Feb 20, 2026
776160e
Apply ./frb_internal generate-run-frb-codegen-command-generate --pack…
TrackerSB Feb 20, 2026
42b44b8
Fix test
TrackerSB Feb 20, 2026
4e79e4a
Apply CI changes
TrackerSB Feb 20, 2026
9730be4
Apply CI changes
TrackerSB Feb 20, 2026
c1d31d7
Apply CI changes
TrackerSB Feb 20, 2026
d23df42
Merge remote-tracking branch 'forkBase/master'
TrackerSB Apr 17, 2026
6c422f6
Automatically updated cargokit
TrackerSB Apr 17, 2026
d337e91
Apply ./frb_internal generate-run-frb-codegen-command-generate --pack…
TrackerSB Apr 17, 2026
ff149d9
Apply ./frb_internal generate-run-frb-codegen-command-generate --pack…
TrackerSB Apr 17, 2026
485bf69
Apply ./frb_internal generate-run-frb-codegen-command-generate --pack…
TrackerSB Apr 17, 2026
98a006f
Apply failing command ./frb_internal
TrackerSB Apr 17, 2026
8a76276
Apply ./frb_internal precommit --mode fast
TrackerSB Apr 17, 2026
eaf057c
Update cargokit using cargo update
TrackerSB Apr 17, 2026
c0d6039
Remove unrelated drift from NaiveDate PR
fzyzcjy May 10, 2026
f29add8
Merge origin/master into NaiveDate PR cleanup
fzyzcjy May 10, 2026
f2f201d
Restore cargokit submodule pointers
fzyzcjy May 10, 2026
47732fe
Regenerate pure Dart bindings
fzyzcjy May 10, 2026
00e3214
Fix NaiveDate DCO encoding
fzyzcjy May 10, 2026
ef59ea8
Add NaiveDate SSE tests
fzyzcjy May 10, 2026
7bd5ecf
Regenerate chrono twin tests
fzyzcjy May 10, 2026
fe5308c
Format valgrind entrypoints
fzyzcjy May 10, 2026
99c4b4d
Format generated valgrind entrypoints
fzyzcjy May 10, 2026
e5009ac
Match generated valgrind formatting
fzyzcjy May 10, 2026
0b3a8fb
Merge origin/master into NaiveDate PR
fzyzcjy May 16, 2026
c8d1208
Merge origin/master into NaiveDate PR
fzyzcjy May 16, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ impl ApiDartGeneratorInfoTrait for DelegateApiDartGenerator<'_> {
MirTypeDelegate::Time(mir) => match mir {
MirTypeDelegateTime::Local
| MirTypeDelegateTime::Utc
| MirTypeDelegateTime::Naive => "DateTime".to_string(),
| MirTypeDelegateTime::NaiveDate
| MirTypeDelegateTime::NaiveDateTime => "DateTime".to_string(),
MirTypeDelegateTime::Duration => "Duration".to_string(),
},
// MirTypeDelegate::TimeList(
Expand Down
23 changes: 16 additions & 7 deletions frb_codegen/src/library/codegen/generator/codec/sse/ty/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ impl CodecSseTyTrait for DelegateCodecSseTy<'_> {
MirTypeDelegate::Time(mir) => match mir {
MirTypeDelegateTime::Utc
| MirTypeDelegateTime::Local
| MirTypeDelegateTime::Naive => {
| MirTypeDelegateTime::NaiveDate
| MirTypeDelegateTime::NaiveDateTime => {
"PlatformInt64Util.from(self.microsecondsSinceEpoch)".to_owned()
}
MirTypeDelegateTime::Duration => {
Expand Down Expand Up @@ -97,7 +98,12 @@ impl CodecSseTyTrait for DelegateCodecSseTy<'_> {
MirTypeDelegateTime::Utc | MirTypeDelegateTime::Local => {
"self.timestamp_micros()".to_owned()
}
MirTypeDelegateTime::Naive => "self.and_utc().timestamp_micros()".to_owned(),
MirTypeDelegateTime::NaiveDate => {
"self.and_hms_opt(0, 0, 0).expect(\"Out of range time\").and_utc().timestamp_micros()".to_owned()
}
MirTypeDelegateTime::NaiveDateTime => {
"self.and_utc().timestamp_micros()".to_owned()
}
MirTypeDelegateTime::Duration => {
r#"self.num_microseconds().expect("cannot get microseconds from time")"#
.to_owned()
Expand Down Expand Up @@ -161,11 +167,12 @@ impl CodecSseTyTrait for DelegateCodecSseTy<'_> {
MirTypeDelegate::Time(mir) => match mir {
MirTypeDelegateTime::Utc
| MirTypeDelegateTime::Local
| MirTypeDelegateTime::Naive => {
| MirTypeDelegateTime::NaiveDate
| MirTypeDelegateTime::NaiveDateTime => {
format!(
"DateTime.fromMicrosecondsSinceEpoch(inner.toInt(), isUtc: {is_utc})",
is_utc =
matches!(mir, MirTypeDelegateTime::Naive | MirTypeDelegateTime::Utc),
matches!(mir, MirTypeDelegateTime::NaiveDateTime | MirTypeDelegateTime::NaiveDate | MirTypeDelegateTime::Utc),
)
}
MirTypeDelegateTime::Duration => {
Expand Down Expand Up @@ -209,10 +216,12 @@ impl CodecSseTyTrait for DelegateCodecSseTy<'_> {
MirTypeDelegate::Map(_) => "inner.into_iter().collect()".to_owned(),
MirTypeDelegate::Set(_) => "inner.into_iter().collect()".to_owned(),
MirTypeDelegate::Time(mir) => {
let naive = "chrono::DateTime::from_timestamp_micros(inner).expect(\"invalid or out-of-range datetime\").naive_utc()";
let utc = format!("chrono::DateTime::<chrono::Utc>::from_naive_utc_and_offset({naive}, chrono::Utc)");
let naive_date_time = "chrono::DateTime::from_timestamp_micros(inner).expect(\"invalid or out-of-range datetime\").naive_utc()";
let naive_date = format!("{naive_date_time}.date()");
let utc = format!("chrono::DateTime::<chrono::Utc>::from_naive_utc_and_offset({naive_date_time}, chrono::Utc)");
match mir {
MirTypeDelegateTime::Naive => naive.to_owned(),
MirTypeDelegateTime::NaiveDate => naive_date.to_owned(),
MirTypeDelegateTime::NaiveDateTime => naive_date_time.to_owned(),
MirTypeDelegateTime::Utc => utc,
MirTypeDelegateTime::Local => {
format!("chrono::DateTime::<chrono::Local>::from({utc})")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ impl WireDartCodecCstGeneratorEncoderTrait for DelegateWireDartCodecCstGenerator
MirTypeDelegate::Time(mir) => match mir {
MirTypeDelegateTime::Utc
| MirTypeDelegateTime::Local
| MirTypeDelegateTime::Naive => Acc {
| MirTypeDelegateTime::NaiveDate
| MirTypeDelegateTime::NaiveDateTime => Acc {
io: Some("return cst_encode_i_64(raw.microsecondsSinceEpoch);".into()),
web: Some(
"return cst_encode_i_64(BigInt.from(raw.millisecondsSinceEpoch));".into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl WireDartCodecDcoGeneratorDecoderTrait for DelegateWireDartCodecDcoGenerator
} else {
format!(
"return dcoDecodeTimestamp(ts: dco_decode_i_64(raw).toInt(), isUtc: {is_utc});",
is_utc = matches!(mir, MirTypeDelegateTime::Naive | MirTypeDelegateTime::Utc)
is_utc = matches!(mir, MirTypeDelegateTime::NaiveDateTime | MirTypeDelegateTime::NaiveDate | MirTypeDelegateTime::Utc)
)
}
}
Expand Down Expand Up @@ -91,9 +91,9 @@ impl WireDartCodecDcoGeneratorDecoderTrait for DelegateWireDartCodecDcoGenerator
MirTypeDelegate::RustAutoOpaqueExplicit(mir) => format!(r"return dco_decode_{}(raw);", mir.inner.safe_ident()),
MirTypeDelegate::CustomSerDes(inner) => {
let body = inner.info.rust2dart.dart_code.replace(
"{}",
"{}",
&format!(
"dco_decode_{}(raw)",
"dco_decode_{}(raw)",
inner.info.inner_type.safe_ident()
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@ impl WireRustCodecCstGeneratorDecoderTrait for DelegateWireRustCodecCstGenerator
};
}
let codegen_timestamp = "let flutter_rust_bridge::for_generated::Timestamp { s, ns } = flutter_rust_bridge::for_generated::decode_timestamp(self);";
let codegen_naive =
let codegen_naive_date_time =
"chrono::DateTime::from_timestamp(s, ns).expect(\"invalid or out-of-range datetime\").naive_utc()";
let codegen_utc = format!("chrono::DateTime::<chrono::Utc>::from_naive_utc_and_offset({codegen_naive}, chrono::Utc)");
let codegen_naive_date =
format!("{codegen_naive_date_time}.date()");
let codegen_utc = format!("chrono::DateTime::<chrono::Utc>::from_naive_utc_and_offset({codegen_naive_date_time}, chrono::Utc)");
let codegen_local = format!("chrono::DateTime::<chrono::Local>::from({codegen_utc})");
let codegen_conversion = match mir {
MirTypeDelegateTime::Naive => codegen_naive,
MirTypeDelegateTime::NaiveDate => codegen_naive_date.as_str(),
MirTypeDelegateTime::NaiveDateTime => codegen_naive_date_time,
MirTypeDelegateTime::Utc => codegen_utc.as_str(),
MirTypeDelegateTime::Local => codegen_local.as_str(),
// frb-coverage:ignore-start
Expand Down
6 changes: 4 additions & 2 deletions frb_codegen/src/library/codegen/ir/mir/ty/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ pub struct MirTypeDelegatePrimitiveEnum {
pub enum MirTypeDelegateTime {
Local,
Utc,
Naive,
NaiveDate,
NaiveDateTime,
Duration,
}

Expand Down Expand Up @@ -250,7 +251,8 @@ impl MirTypeTrait for MirTypeDelegate {
mir.rust_api_type()
}
MirTypeDelegate::Time(mir) => match mir {
MirTypeDelegateTime::Naive => "chrono::NaiveDateTime",
MirTypeDelegateTime::NaiveDate => "chrono::NaiveDate",
MirTypeDelegateTime::NaiveDateTime => "chrono::NaiveDateTime",
MirTypeDelegateTime::Local => "chrono::DateTime::<chrono::Local>",
MirTypeDelegateTime::Utc => "chrono::DateTime::<chrono::Utc>",
MirTypeDelegateTime::Duration => "chrono::Duration",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ impl TypeParserWithContext<'_, '_, '_> {
("Self", []) => self.parse_type_self()?,

("Duration", []) if check_prefix("chrono") => Delegate(MirTypeDelegate::Time(MirTypeDelegateTime::Duration)),
("NaiveDateTime", []) if check_prefix("chrono") => Delegate(MirTypeDelegate::Time(MirTypeDelegateTime::Naive)),
("NaiveDate", []) if check_prefix("chrono") => Delegate(MirTypeDelegate::Time(MirTypeDelegateTime::NaiveDate)),
("NaiveDateTime", []) if check_prefix("chrono") => Delegate(MirTypeDelegate::Time(MirTypeDelegateTime::NaiveDateTime)),
("DateTime", args) if check_prefix("chrono") => self.parse_datetime(args)?,

("Uuid", []) if check_prefix("uuid") => Delegate(MirTypeDelegate::Uuid),
Expand Down
Loading
Loading