Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: pkg/analyzer/test/generated/static_type_analyzer_test.dart

Issue 2199323002: Initial implementation for lazy compound assignment operators (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/static_type_analyzer_test.dart
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
index 23fac6b9a5fcbe38d929dfc2a73f5eb13ded6ed6..27952361c5494b9b3ce3f403a8e3dbbe398ae379 100644
--- a/pkg/analyzer/test/generated/static_type_analyzer_test.dart
+++ b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
@@ -394,6 +394,19 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
validate(TokenType.TILDE_SLASH_EQ);
}
+ void test_visitAssignmentExpression_compound_lazy() {
+ validate(TokenType operator) {
+ InterfaceType boolType = _typeProvider.boolType;
+ SimpleIdentifier identifier = _resolvedVariable(boolType, "b");
+ AssignmentExpression node = AstFactory.assignmentExpression(
+ identifier, operator, _resolvedBool(true));
+ expect(_analyze(node), same(boolType));
+ _listener.assertNoErrors();
+ }
+ validate(TokenType.AMPERSAND_AMPERSAND_EQ);
+ validate(TokenType.BAR_BAR_EQ);
+ }
+
void test_visitAssignmentExpression_compound_plusID() {
validate(TokenType operator) {
InterfaceType numType = _typeProvider.numType;
@@ -1565,6 +1578,16 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
}
/**
+ * Return a boolean literal with the given [value] that has been resolved to
+ * the correct type.
+ */
+ BooleanLiteral _resolvedBool(bool value) {
+ BooleanLiteral literal = AstFactory.booleanLiteral(value);
+ literal.staticType = _typeProvider.intType;
+ return literal;
+ }
+
+ /**
* Return an integer literal that has been resolved to the correct type.
*
* @param value the value of the literal

Powered by Google App Engine
This is Rietveld 408576698