Skip to content

Commit

Permalink
Fix for building sequence of identifiers and several tests.
Browse files Browse the repository at this point in the history
[email protected], [email protected]

Bug: dart-lang/sdk#32525
Change-Id: Iddc0a4825e98bf186e6c3da0fd24c81a95b96522
Reviewed-on: https://dart-review.googlesource.com/48501
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
  • Loading branch information
scheglov authored and [email protected] committed Mar 28, 2018
1 parent 6a84638 commit 0e8457c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/summary/expr_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class ExprBuilder {
..staticElement = element;
return AstTestFactory.identifier(enclosing, identifier);
}
if (element == null) {
if (requireValidConst && element == null) {
throw const _InvalidConstantException();
}
SimpleIdentifier property = AstTestFactory.identifier3(info.name)
Expand Down
28 changes: 28 additions & 0 deletions pkg/analyzer/test/src/summary/expr_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,14 @@ class C {
requireValidConst: true);
}

void test_invokeConstructor_generic_hasTypeArguments() {
checkSimpleExpression('new Map<int, List<String>>()');
}

void test_invokeConstructor_generic_noTypeArguments() {
checkSimpleExpression('new Map()');
}

void test_invokeMethod() {
checkSimpleExpression('new C().foo(1, 2)', extraDeclarations: r'''
class C {
Expand All @@ -330,6 +338,14 @@ class C {
''');
}

void test_invokeMethod_namedArguments() {
checkSimpleExpression('new C().foo(a: 1, c: 3)', extraDeclarations: r'''
class C {
int foo({int a, int b, int c}) => 0;
}
''');
}

void test_invokeMethod_typeArguments() {
checkSimpleExpression('new C().foo<int, double>(1, 2.3)',
extraDeclarations: r'''
Expand Down Expand Up @@ -445,6 +461,18 @@ class C {
checkSimpleExpression('int');
}

void test_pushReference_sequence() {
checkSimpleExpression('a.b.f', extraDeclarations: r'''
var a = new A();
class A {
B b = new B();
}
class B {
int f = 0;
}
''');
}

void test_pushString() {
checkSimpleExpression("'foo'");
}
Expand Down

0 comments on commit 0e8457c

Please sign in to comment.