mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Fix for building sequence of identifiers and several tests.
R=brianwilkerson@google.com, paulberry@google.com Bug: https://github.com/dart-lang/sdk/issues/32525 Change-Id: Iddc0a4825e98bf186e6c3da0fd24c81a95b96522 Reviewed-on: https://dart-review.googlesource.com/48501 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
6a84638d7a
commit
0e8457c8c8
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
@ -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'''
|
||||
|
@ -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'");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue