diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-11-07 00:56:42 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-11-07 00:56:42 -0800 |
commit | 0c62881a6f7adc4dfbeca243e44b585dc4cb40fe (patch) | |
tree | ec23369bc85215ddebf5b1acfd6dce5bf96510e3 | |
parent | e4821af3f8da05be6d631e2116d03abcc1a6e6cf (diff) | |
download | mu-0c62881a6f7adc4dfbeca243e44b585dc4cb40fe.tar.gz |
246
-rw-r--r-- | mu.arc | 13 | ||||
-rw-r--r-- | mu.arc.t | 10 |
2 files changed, 17 insertions, 6 deletions
diff --git a/mu.arc b/mu.arc index dca953e9..12202995 100644 --- a/mu.arc +++ b/mu.arc @@ -709,12 +709,13 @@ (assert basetype!address "@args.0 requests deref, but it's not an address of a record") (= basetype (types* basetype!elem))) (when (isa field 'sym) - (assert (~offset field) "field @args.1 is also a variable") - (assert basetype!fields "no field names available for @instr") - (iflet idx (pos field basetype!fields) - (do (set isa-field.field) - (= offset.field idx)) - (assert nil "couldn't find field in @instr")))) + (assert (or (~offset field) isa-field.field) "field @args.1 is also a variable") + (when (~offset field) + (assert basetype!fields "no field names available for @instr") + (iflet idx (pos field basetype!fields) + (do (set isa-field.field) + (= offset.field idx)) + (assert nil "couldn't find field in @instr"))))) (each arg args (assert (~isa-field v.arg) "arg @arg is also a field name") (when (maybe-add arg offset idx) diff --git a/mu.arc.t b/mu.arc.t index 53a91d8b..2a18fd86 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -1358,6 +1358,16 @@ '(((1 integer) <- get (34 integer-boolean-pair-address deref) (1 offset)))) (prn "F - convert-names replaces field offsets for record addresses")) +(reset) +;? (new-trace "convert-names-record-fields-multiple") +(if (~iso (convert-names + '(((2 boolean) <- get (1 integer-boolean-pair) (bool offset)) + ((3 boolean) <- get (1 integer-boolean-pair) (bool offset)))) + '(((2 boolean) <- get (1 integer-boolean-pair) (1 offset)) + ((3 boolean) <- get (1 integer-boolean-pair) (1 offset)))) + (prn "F - convert-names replaces field offsets with multiple mentions")) +;? (quit) + ; A rudimentary memory allocator. Eventually we want to write this in mu. ; ; No deallocation yet; let's see how much code we can build in mu before we |