280a87df1e
This changes that expression_suite tests to embed the needed source code in the yaml file. Single source and multi sources are supported. When using a single source, the file name is implicitly "main.dart" and the "position" and "entry_point" yaml properties are updated to supports this, meaning that the yaml files should only use file names when using multiple sources. Change-Id: Ia6756eb86a7b72dea2187f72b9f2c75c28783a0b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237680 Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
28 lines
859 B
YAML
28 lines
859 B
YAML
# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
sources: |
|
|
void hasList() {
|
|
List<String> x = ["a", "b", "c"];
|
|
int xCombinedLength = x.fold<int>(
|
|
0, (previousValue, element) => previousValue + element.length);
|
|
print("xCombinedLength = $xCombinedLength");
|
|
}
|
|
extension Foo on String {
|
|
int getFortyTwo() {
|
|
return 42;
|
|
}
|
|
}
|
|
definitions: ["x"]
|
|
# List<String>
|
|
definition_types: ["dart:core", "List", "1", "1", "dart:core", "String", "1", "0"]
|
|
type_definitions: [""]
|
|
type_bounds: []
|
|
type_defaults: []
|
|
method: "hasList"
|
|
# x is List<String> with entries, so x.first is String, String has extension
|
|
# with method getFortyTwo.
|
|
expression: |
|
|
x.first.getFortyTwo()
|