-
Notifications
You must be signed in to change notification settings - Fork 62
Add support for is, is! expressions
#111
Conversation
…ded a .gitignore rule to exclude the `.idea` directory, for convenience's sake.
.gitignore
Outdated
| pubspec.lock | ||
|
|
||
| # Avoid IntelliJ adding junk files to the repo | ||
| .idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, don't. These should be ignored in a user's global git ignore.
The number machine and IDE-specific files could grow forever...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad . Didn't realize.
|
@kevmoo Fixed |
|
@matanlurey should actually help w/ content – my ovly value is making sure |
lib/src/builders/expression.dart
Outdated
| ExpressionBuilder isInstanceOf(TypeBuilder type) => | ||
| new _IsInstanceOfExpression(this, type); | ||
|
|
||
| @override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There already is a negate expression, no reason to add this.
lib/src/builders/expression.dart
Outdated
| /// Returns as an [ExpressionBuilder] indicating whether this expression is an instance of [type], using the `is` operator. | ||
| ExpressionBuilder isInstanceOf(TypeBuilder type); | ||
|
|
||
| /// Returns as an [ExpressionBuilder] indicating whether this expression is not an instance of [type], using the `is!` operator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, remove.
| } | ||
| } | ||
|
|
||
| class _IsNotInstanceOfExpression extends AbstractExpressionMixin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto remove.
| expect(reference('foo').isInstanceOf(_barType), equalsSource('foo is Bar')); | ||
| }); | ||
|
|
||
| test('should emit an `is!` expression', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK to keep this test, just use negate instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, give me one minute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, got preoccupied. Fixed now!
|
Woohoo! 🎉 |
* FieldBuilders now works to-level * Ran dartfmt * asThrow on ExpressionBuilder * Removed asThrow * Added isInstanceOf, isNotInstanceOf, and corresponding tests. Also added a .gitignore rule to exclude the `.idea` directory, for convenience's sake. * Undo .gitignore change * Undo .gitignore change, remove IntelliJ metadata * Removed isNotInstanceOf
Should take care of dart-lang/tools#925. 😄