Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Releases: dart-archive/code_builder

2.0.0-alpha+1

14 Jul 21:22
Compare
Choose a tag to compare
2.0.0-alpha+1 Pre-release
Pre-release

2.0.0-alpha+1

  • Removed Reference.localScope. Just use Reference(symbol) now.
  • Allow Reference instead of an explicit TypeReference in most APIs.
    • toType() is performed for you as part the emitter process
final animal = new Class((b) => b
  ..name = 'Animal'
  // Used to need a suffix of .toType().
  ..extend = const Reference('Organism')
  ..methods.add(new Method.returnsVoid((b) => b
    ..name = 'eat'
    ..lambda = true
    ..body = new Code((b) => b..code = 'print(\'Yum\')'))));
  • We now support the Dart 2.0 pre-release SDKs (<2.0.0-dev.infinity)
  • Removed the ability to treat Class as a TypeReference.
    • Was required for compilation to dart2js, which is now tested on travis.

2.0.0-alpha

14 Jul 19:48
Compare
Choose a tag to compare
2.0.0-alpha Pre-release
Pre-release

2.0.0-alpha

  • Complete re-write to not use package:analyzer.
  • Code generation now properly uses the builder pattern (via built_value).
  • See examples and tests for details.

1.0.4

16 Jun 15:48
Compare
Choose a tag to compare

1.0.4

  • Added isInstanceOf to ExpressionBuilder, which performs an is check:
expect(
  reference('foo').isInstanceOf(_barType), 
  equalsSource('foo is Bar'),
);

1.0.1

05 Apr 02:53
Compare
Choose a tag to compare

1.0.1

  • Support the latest version of package:dart_style.

1.0.0 - First final release :D

31 Mar 00:41
Compare
Choose a tag to compare

1.0.0

First full release. At this point all changes until 2.0.0 will be backwards
compatible (new features) or bug fixes that are not breaking. This doesn't mean
that the entire Dart language is buildable with our API, though.

Contributions are welcome.

  • Exposed uri in ImportBuilder, ExportBuilder, and Part[Of]Builder.

1.0.0-beta+7

29 Mar 20:29
Compare
Choose a tag to compare

1.0.0-beta+7

  • Added ExpressionBuilder#ternary.

1.0.0-beta+6

16 Mar 03:51
Compare
Choose a tag to compare

1.0.0-beta+6

  • Added TypeDefBuilder.
  • Added FunctionParameterBuilder.
  • Added asAbstract to various MethodBuilder constructors.

1.0.0-beta+5

  • Re-published the package without merge conflicts.

1.0.0-beta+4

01 Mar 04:01
Compare
Choose a tag to compare

Lots of changes in this release. Getting close to a release candidate.

1.0.0-beta+4

  • Renamed PartBuilder to PartOfBuilder.
  • Added a new class, PartBuilder, to represent part '...dart' directives.
  • Added the HasAnnotations interface to all library/part/directive builders.
  • Added asFactory and asConst to ConstructorBuilder.
  • Added ConstructorBuilder.redirectTo for a redirecting factory constructor.
  • Added a name getter to ReferenceBuilder.
  • Supplying an empty constructor name ('') is equivalent to null (default).
  • Automatically encodes string literals with multiple lines as '''.
  • Added asThrow to ExpressionBuilder.
  • Fixed a bug that prevented FieldBuilder from being used at the top-level.

1.0.0-beta+3

31 Jan 21:40
Compare
Choose a tag to compare

1.0.0-beta+3

  • Added support for genericTypes parameter for ExpressionBuilder#invoke:
expect(
  explicitThis.invoke('doThing', [literal(true)], genericTypes: [
    lib$core.bool,
  ]),
  equalsSource(r'''
    this.doThing<bool>(true)
  '''),
);
  • Added a castAs method to ExpressionBuilder:
expect(
  literal(1.0).castAs(lib$core.num),
  equalsSource(r'''
    1.0 as num
  '''),
);

BREAKING CHANGES

  • Removed namedNewInstance and namedConstInstance, replaced with constructor::
expect(
  reference('Foo').newInstance([], constructor: 'other'),
  equalsSource(r'''
    new Foo.other()
  '''),
);
  • Renamed named parameter to namedArguments:
expect(
  reference('doThing').call(
    [literal(true)],
    namedArguments: {
      'otherFlag': literal(false),
    },
  ),
  equalsSource(r'''
    doThing(true, otherFlag: false)
  '''),
);

1.0.0-beta+1

11 Jan 18:16
Compare
Choose a tag to compare

1.0.0-beta+1

  • Add support for switch statements
  • Add support for a raw expression and statement
    • new ExpressionBuilder.raw(...)
    • new StatemnetBuilder.raw(...)

This should help cover any cases not covered with builders today.

  • Allow referring to a ClassBuilder and TypeBuilder as an expression
  • Add support for accessing the index [] operator on an expression

BREAKING CHANGES

  • Changed ExpressionBuilder.asAssign to always take an ExpressionBuilder as
    target and removed the value property. Most changes are pretty simple, and
    involve just using reference(...). For example:
literal(true).asAssign(reference('flag'))

... emits flag = true.