Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Conversation

@matanlurey
Copy link
Contributor

Closes dart-lang/tools#902
Closes dart-lang/tools#903

Sorry for the extra breaking changes - but even while updating the tests I found these confusing - and would rather fix now before we have too many users in a stable branch:

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 name: :
expect(
  reference('Foo').newInstance([], name: '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)
  '''),
);

CHANGELOG.md Outdated

```dart
expect(
reference('Foo').newInstance([], name: 'other'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about 'constructor' instead of 'name' for the argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Liked it! Done.

Copy link
Contributor

@natebosch natebosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matanlurey matanlurey merged commit 3aaf168 into dart-archive:master Jan 31, 2017
@matanlurey matanlurey deleted the generics_and_cast branch January 31, 2017 21:35
mosuem pushed a commit to dart-lang/tools that referenced this pull request Oct 25, 2024
…code_builder#70)

* Add support for generic types and as cast

* Update CHANGELOG and pubspec.

* Rename name: to constructor:
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add support for gerneric type parameters for method invocation Add support for as SomeType

3 participants