Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void main() {

* Added `nullSafeProperty` to `Expression` to access properties with `?.`
* Added `conditional` to `Expression` to use the ternary operator `? : `
* Methods taking `positionalArguments` accept `Iterable<Expression>`

## 2.2.0

Expand Down
14 changes: 7 additions & 7 deletions lib/src/specs/expression.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ abstract class Expression implements Spec {

/// Call this expression as a method.
Expression call(
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression._(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
);
Expand Down Expand Up @@ -193,7 +193,7 @@ abstract class Expression implements Spec {
/// Returns an annotation as a result of calling this constructor.
@Deprecated('Use "call" instead. Will be removed in 3.0.0.')
Expression annotation([
List<Expression> positionalArguments,
Iterable<Expression> positionalArguments,
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
Expand All @@ -205,7 +205,7 @@ abstract class Expression implements Spec {
return new Annotation((b) {
b.code = new InvokeExpression._(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
)
Expand All @@ -217,14 +217,14 @@ abstract class Expression implements Spec {
@Deprecated('Use a combination of "property" and "call". Removing in 3.0.0.')
Expression annotationNamed(
String name,
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
// ignore: deprecated_member_use
return new Annotation((b) => b
..code = new InvokeExpression._(
this, positionalArguments, namedArguments, typeArguments, name)
..code = new InvokeExpression._(this, positionalArguments.toList(),
namedArguments, typeArguments, name)
.code);
}

Expand Down
16 changes: 8 additions & 8 deletions lib/src/specs/reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class Reference extends Expression implements Spec {

/// Returns a new instance of this expression.
Expression newInstance(
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.newOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
null,
Expand All @@ -67,13 +67,13 @@ class Reference extends Expression implements Spec {
/// Returns a new instance of this expression with a named constructor.
Expression newInstanceNamed(
String name,
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.newOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
name,
Expand All @@ -82,13 +82,13 @@ class Reference extends Expression implements Spec {

/// Returns a const instance of this expression.
Expression constInstance(
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.constOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
null,
Expand All @@ -98,13 +98,13 @@ class Reference extends Expression implements Spec {
/// Returns a const instance of this expression with a named constructor.
Expression constInstanceNamed(
String name,
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.constOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
name,
Expand Down
8 changes: 4 additions & 4 deletions lib/src/specs/type_function.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ abstract class FunctionType extends Expression

@override
Expression newInstance(
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) =>
Expand All @@ -71,15 +71,15 @@ abstract class FunctionType extends Expression
@override
Expression newInstanceNamed(
String name,
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) =>
throw new UnsupportedError('Cannot "new" a function type.');

@override
Expression constInstance(
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) =>
Expand All @@ -88,7 +88,7 @@ abstract class FunctionType extends Expression
@override
Expression constInstanceNamed(
String name,
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) =>
Expand Down
16 changes: 8 additions & 8 deletions lib/src/specs/type_reference.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ abstract class TypeReference extends Expression

@override
Expression newInstance(
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.newOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
null,
Expand All @@ -74,13 +74,13 @@ abstract class TypeReference extends Expression
@override
Expression newInstanceNamed(
String name,
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.newOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
name,
Expand All @@ -89,13 +89,13 @@ abstract class TypeReference extends Expression

@override
Expression constInstance(
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.constOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
null,
Expand All @@ -105,13 +105,13 @@ abstract class TypeReference extends Expression
@override
Expression constInstanceNamed(
String name,
List<Expression> positionalArguments, [
Iterable<Expression> positionalArguments, [
Map<String, Expression> namedArguments = const {},
List<Reference> typeArguments = const [],
]) {
return new InvokeExpression.constOf(
this,
positionalArguments,
positionalArguments.toList(),
namedArguments,
typeArguments,
name,
Expand Down