Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/simplify/simplify.sml
 [diderot] / branches / vis15 / src / compiler / simplify / simplify.sml

# Diff of /branches/vis15/src/compiler/simplify/simplify.sml

revision 3504, Thu Dec 17 23:56:09 2015 UTC revision 3797, Mon May 2 21:10:12 2016 UTC
# Line 336  Line 336
336                    end                    end
337                | AST.E_Slice(e, indices, ty) => let (* tensor slicing *)                | AST.E_Slice(e, indices, ty) => let (* tensor slicing *)
338                    val (stms, x) = simplifyExpToVar (errStrm, e, stms)                    val (stms, x) = simplifyExpToVar (errStrm, e, stms)
339                    fun f ([], ys, stms) = (stms, List.rev ys)                    fun f NONE = NONE
340                      | f (NONE::es, ys, stms) = f (es, NONE::ys, stms)                      | f (SOME(AST.E_Lit(Literal.Int i))) = SOME(Int.fromLarge i)
341                      | f (SOME e::es, ys, stms) = let                      | f _ = raise Fail "expected integer literal in slice"
342                          val (stms, y) = simplifyExpToVar (errStrm, e, stms)                    val indices = List.map f indices
in
f (es, SOME y::ys, stms)
end
val (stms, indices) = f (indices, [], stms)
343                    in                    in
344                      (stms, S.E_Slice(x, indices, cvtTy ty))                      (stms, S.E_Slice(x, indices, cvtTy ty))
345                    end                    end

Legend:
 Removed from v.3504 changed lines Added in v.3797