Skip to content

Commit 0e8457c

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Fix for building sequence of identifiers and several tests.
[email protected], [email protected] Bug: #32525 Change-Id: Iddc0a4825e98bf186e6c3da0fd24c81a95b96522 Reviewed-on: https://dart-review.googlesource.com/48501 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 6a84638 commit 0e8457c

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

pkg/analyzer/lib/src/summary/expr_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class ExprBuilder {
333333
..staticElement = element;
334334
return AstTestFactory.identifier(enclosing, identifier);
335335
}
336-
if (element == null) {
336+
if (requireValidConst && element == null) {
337337
throw const _InvalidConstantException();
338338
}
339339
SimpleIdentifier property = AstTestFactory.identifier3(info.name)

pkg/analyzer/test/src/summary/expr_builder_test.dart

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,14 @@ class C {
322322
requireValidConst: true);
323323
}
324324

325+
void test_invokeConstructor_generic_hasTypeArguments() {
326+
checkSimpleExpression('new Map<int, List<String>>()');
327+
}
328+
329+
void test_invokeConstructor_generic_noTypeArguments() {
330+
checkSimpleExpression('new Map()');
331+
}
332+
325333
void test_invokeMethod() {
326334
checkSimpleExpression('new C().foo(1, 2)', extraDeclarations: r'''
327335
class C {
@@ -330,6 +338,14 @@ class C {
330338
''');
331339
}
332340

341+
void test_invokeMethod_namedArguments() {
342+
checkSimpleExpression('new C().foo(a: 1, c: 3)', extraDeclarations: r'''
343+
class C {
344+
int foo({int a, int b, int c}) => 0;
345+
}
346+
''');
347+
}
348+
333349
void test_invokeMethod_typeArguments() {
334350
checkSimpleExpression('new C().foo<int, double>(1, 2.3)',
335351
extraDeclarations: r'''
@@ -445,6 +461,18 @@ class C {
445461
checkSimpleExpression('int');
446462
}
447463

464+
void test_pushReference_sequence() {
465+
checkSimpleExpression('a.b.f', extraDeclarations: r'''
466+
var a = new A();
467+
class A {
468+
B b = new B();
469+
}
470+
class B {
471+
int f = 0;
472+
}
473+
''');
474+
}
475+
448476
void test_pushString() {
449477
checkSimpleExpression("'foo'");
450478
}

0 commit comments

Comments
 (0)