diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-08-30 22:13:22 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-08-30 22:13:22 -0700 |
commit | 2eab85b3a43316a391aed3564a1a75a97504a5ca (patch) | |
tree | b7701085d29e8d10dd0725ff4a931b1637db399a | |
parent | 4639ef6149176445cb014feea9885c3ea7b36d2b (diff) | |
download | mu-2eab85b3a43316a391aed3564a1a75a97504a5ca.tar.gz |
2115
Merging in unnecessary '0/empty' fields was a pain, and also made me do some additional debugging in the last commit.
-rw-r--r-- | 033exclusive_container.cc | 36 | ||||
-rw-r--r-- | edit.mu | 6 |
2 files changed, 39 insertions, 3 deletions
diff --git a/033exclusive_container.cc b/033exclusive_container.cc index 42993231..58276b9a 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -148,3 +148,39 @@ recipe main [ +mem: storing 34 in location 3 +mem: storing 1 in location 4 +mem: storing 34 in location 5 + +//: Since the different variants of an exclusive-container might have +//: different sizes, relax the size mismatch check for 'merge' instructions. +:(before "End size_mismatch(x) Cases") +if (current_instruction().operation == MERGE + && !current_instruction().products.empty() + && !current_instruction().products.at(0).types.empty()) { + reagent x = canonize(current_instruction().products.at(0)); + if (Type[x.types.at(0)].kind == exclusive_container) { + return size_of(x) < SIZE(data); + } +} + +:(scenario merge_exclusive_container_with_mismatched_sizes) +container foo [ + x:number + y:number +] + +exclusive-container bar [ + x:number + y:foo +] + +recipe main [ + 1:number <- copy 34 + 2:number <- copy 35 + 3:bar <- merge 0/x, 1:number + 6:bar <- merge 1/foo, 1:number, 2:number +] ++mem: storing 0 in location 3 ++mem: storing 34 in location 4 +# bar is always 3 large so location 5 is skipped ++mem: storing 1 in location 6 ++mem: storing 34 in location 7 ++mem: storing 35 in location 8 diff --git a/edit.mu b/edit.mu index a133504a..0508e29c 100644 --- a/edit.mu +++ b/edit.mu @@ -6746,7 +6746,7 @@ after +insert-enter-start [ ] after +insert-enter-end [ top-after:address:duplex-list <- get *editor, top-of-screen:offset - # never merge + # never coalesce insert-from:address:duplex-list <- next-duplex cursor-before insert-to:address:duplex-list <- next-duplex *before-cursor op:address:operation <- new operation:type @@ -7281,7 +7281,7 @@ before +move-cursor-end [ { break-unless undo-coalesce-tag # if previous operation was also a move, and also had the same coalesce - # tag, merge with it + # tag, coalesce with it undo:address:address:list <- get-address *editor, undo:offset break-unless *undo op:address:operation <- first *undo @@ -7299,7 +7299,7 @@ before +move-cursor-end [ break +done-adding-move-operation:label } op:address:operation <- new operation:type - *op <- merge 1/move-operation, before-cursor-row, before-cursor-column, before-top-of-screen, after-cursor-row, after-cursor-column, after-top-of-screen, undo-coalesce-tag, 0/empty, 0/empty + *op <- merge 1/move-operation, before-cursor-row, before-cursor-column, before-top-of-screen, after-cursor-row, after-cursor-column, after-top-of-screen, undo-coalesce-tag editor <- add-operation editor, op +done-adding-move-operation ] |