Skip to content

VitTransform 2.0.1

Latest

Choose a tag to compare

@Geoff-Robinson Geoff-Robinson released this 24 Nov 21:43

What this release is

A release of minor fixes to 2.0.0. Some of them fix changes that made code that did not compile, or gave a different
answer. Most of the others make the tool leave your code as you wrote it in a few rare cases where a change could
have made it behave differently. Nothing you have to change: the switches, the styles and the rule files work as in
2.0.0.

Code that is now left as you wrote it

  • A method that has the name of a variable. Merging a copy into its source no longer renames another object's
    method that has the copy's name (Counter.buf() stays Counter.buf()), and moving a value into its one read no
    longer takes such a method (Counter.n()) for a read of the variable. Both made code that did not compile. Folding
    a re-split copy, dropping a line buffer and merging two locals leave such a method as written too.
  • A variable that may have a second name. Inlining a value, merging IFs or CASEs, removing an unused assignment,
    the known-ranges clean-up and the loop rewrites leave code alone when what they read could be changed under another
    name: a parameter passed by address while the procedure has another one or uses a global (a caller may pass the
    same variable twice), a global that a reference elsewhere in the file points at, a field of a GROUP,PRE() written
    by its own name, a variable declared OVER another one or with a GROUP type, and a local handed by address to a
    procedure or method that may keep a reference to it. A CASE on a GROUP or on such a variable is not joined with
    the IF after it, cutting to a split leaves alone a cut whose position has such a name, and moving a per-line
    change in front of a split leaves a loop alone whose index has one. Moving a line common to both halves of an IF
    no longer moves a write to a GROUP field above a test that reads the group, or a variable declared OVER it,
    under another name.
  • COMPILE and conditional OMIT blocks. A build may leave such a block out, so a clean-up no longer relies on
    a line inside the block for code outside it. When the line and everything that relies on it are inside the same
    block, or in a block inside it, the clean-ups still make the change. A variable declared differently in the two
    arms of a COMPILE and an OMIT, or declared only inside such a block, is left alone by the clean-ups that move,
    merge or remove code, and a rule that depends on a variable's type does not take a name used outside such a block
    for the variable declared inside it. When a clean-up removes a whole line, an OMIT block just in front of it
    stays.
  • Where an OMIT or COMPILE block ends. A terminator in the directive line's own comment ends the block on
    that line, as the compiler does: OMIT('**end**') ! runs to **end** omits nothing, so the code below it is read
    and changed like any other. This holds in an INCLUDEd file too. A terminator on a row of a statement carried on
    with | ends the block on that row, also when the terminator there is not in a comment, and the terminator is
    not looked for inside the block's condition. A line inside an OMIT block that ends in | does not carry on into
    the first line after the block.
  • A StringTheory copy and its error state. A copy made with getValue() or setValue(<object>) is no longer
    merged into its source when the copy's lastError or winErrorCode is read afterwards, or when the copy is handed
    to a procedure that could read them.
  • A copy read in a loop. A copy is kept when a loop runs an IF or CASE again and the source is changed in one
    branch while the copy is read in another, or when it is handed to a procedure whose local class has a method that
    uses that parameter.
  • Base64 and encoding. The clean-ups that depend on them now also see an object handed to one of your procedures
    that may set them, and removing trailing spaces also looks in a procedure's ROUTINEs, and in the methods of a class
    it declares, for a call that makes the object UTF-16.
  • clip() around a number (NOTBOOL) is kept wherever the answer depends on the type: any compare, any argument
    of choose(), the first argument of assert(), the value a CASE tests or an OF gives, the upper end of an
    OF ... TO range; a value stored in an ANY, an untyped ? parameter or a target whose type the tool cannot
    find, or returned from a procedure that returns ?; an argument whose type can change the answer; and an argument
    of a procedure whose prototype the tool cannot see - one in an INCLUDE it did not read, or, in a MEMBER module
    or a file another one includes, in the program's MAP. A call to a Clarion runtime procedure such as message()
    or putini() is still rewritten.
  • Adding ,AUTO no longer takes a RETURN that also closes an inner IF or LOOP for the end of the outer
    branch, no longer accepts a field of a GROUP, a variable of a GROUP type or declared LIKE one, or a reference
    as the test that proves a variable was set, and does not make a local AUTO when its declaration carries STATIC,
    THREAD or OVER on a second row.
  • An IF marked ! #Possible bug. The code such an IF always ran, every line of it, is left exactly as
    written, so the IF can be put back as it was.
  • Smaller cases: a test is not moved above a store when the next line has a label a GOTO jumps to; a split is
    left alone when it is one arm of an EXECUTE, when a DO follows it on the same line, or when a GOTO below it
    jumps back above it; a split whose clip option is an expression is not taken as one that clips; a method of your own
    class called Append, SetValue or Prepend is not taken for StringTheory's; a StringTheory copy whose length is
    taken by reference is kept; cutting to a split keeps the cut when, inside a loop around it, the object is handed
    above the cut to a call that may read its lines; moving a line common to both halves of an IF matches a prefix
    to the field's own group, so two procedures that use one prefix are not mixed up; a line buffer is kept when its
    next load is in a one-line IF carried over two rows; dropping a line buffer keeps the clip when other code also
    writes the object's lines; the extreme style's
    left() and choose() clean-ups and the known-ranges clean-up keep their test when the length or buffer may be
    changed through another parameter or a module reference; a += on the last line of a file with no line break
    after it is checked before it becomes =; a variable named Map is not read as the start of a MAP; a method of
    a class the procedure declares is seen to use what the routines it calls with DO use; and a field of a local
    GROUP,PRE() after a nested group with its own prefix, or declared LIKE a field, hides a module
    variable of the same name.

Small improvements

  • A variable that only carries a value to the next line is now also moved into a call to a Clarion runtime procedure,
    such as message() or putini(), when the runtime takes that argument by value. This is done in a
    PROGRAM file only: in a MEMBER module, or a file another one includes, the program's own MAP may declare a
    procedure of that name.
  • A line common to both halves of an IF can now move above a test that cannot read it when it writes a field of a
    prefixed GROUP.
  • A never-true IF whose test is carried over two rows is commented out whole.
  • --ignoremarks on the command line now wins over a style profile's ignoremarks=off, and the report says so.
  • Under --ignoremarks, the rules that turn a setValue() into a call that works in place are also made on an object
    given another object's value.

Rule files

  • A new guard, isWhole(): the match is made only of whole numbers. The shipped rules that split a length or a
    position into two parts use it, so a fraction is not dropped once for each part.
  • fold() and isConst() work out numbers only, at any depth of brackets: a call or a piece of text is written as
    it stands. A shipped rule wrote len(clip('ab ')) as len(ab), which did not compile, and val(upper('k')) as
    val(K), a different value; a call such as day(today()) is never replaced by its value on the day the tool ran.
  • A rule whose pattern ends on THEN may carry an option after it, its REVERSE twin loads and fires on the same
    IFs as the rule (so does the twin of a rule ending on ELSE), and a pattern that ends then ;, with blanks or a
    tab before the ;, loads.
  • A field equate such as ?Skip at the end of a replacement is a name, not the SKIP option, and a tab inside a
    quoted literal is kept.
  • Every shipped rule that writes its match beside + or -, or inside fold(), carries noConcat, so a position
    or length holding an & is never regrouped.

VitStyle

  • Apply on the style already in force puts its alignment settings back, also for "(file defaults)".
  • Save... no longer refuses a profiles file another VitStyle window created, and after a profile is saved under a
    shipped style's name, applying it uses the settings the file now holds.
  • A line changed by the automatic declaration check is listed and counted once, and a change the tool refused is not
    listed. The changes of every built-in are listed, the move of a test above a store among them, as changes and not
    as layout rows.

Documentation

  • --ignoremarks is now listed in Appendix B, and its warning names more of the methods that make it unsafe:
    loadFile(), and the ones whose answer depends on the encoding (chars(), equals(), clip()).
  • The plain style, val() of a digit, WHERE isPlain and VitStyle's layout rows are described correctly, and a
    new note in Appendix D says how the tool reads OMIT and COMPILE blocks.