OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library kernel.transformations.closure.mock; | 5 library kernel.transformations.closure.mock; |
6 | 6 |
7 import '../../ast.dart' | 7 import '../../ast.dart' |
8 show | 8 show |
9 Arguments, | 9 Arguments, |
10 Block, | 10 Block, |
(...skipping 29 matching lines...) Expand all Loading... |
40 import '../../core_types.dart' show CoreTypes; | 40 import '../../core_types.dart' show CoreTypes; |
41 | 41 |
42 import '../../frontend/accessors.dart' | 42 import '../../frontend/accessors.dart' |
43 show | 43 show |
44 Accessor, | 44 Accessor, |
45 IndexAccessor, | 45 IndexAccessor, |
46 PropertyAccessor, | 46 PropertyAccessor, |
47 ThisPropertyAccessor, | 47 ThisPropertyAccessor, |
48 VariableAccessor; | 48 VariableAccessor; |
49 | 49 |
| 50 /// TODO(dmitryas): make the "[]=" operator return the value. |
50 /// Extend the program with this mock: | 51 /// Extend the program with this mock: |
51 /// | 52 /// |
52 /// class Context { | 53 /// class Context { |
53 /// final List list; | 54 /// final List list; |
54 /// var parent; | 55 /// var parent; |
55 /// Context(int i) : list = new List(i); | 56 /// Context(int i) : list = new List(i); |
56 /// operator[] (int i) => list[i]; | 57 /// operator[] (int i) => list[i]; |
57 /// operator[]= (int i, value) { | 58 /// operator[]= (int i, value) { |
58 /// list[i] = value; | 59 /// list[i] = value; |
59 /// } | 60 /// } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 fields: fields, | 188 fields: fields, |
188 procedures: procedures, | 189 procedures: procedures, |
189 fileUri: fileUri); | 190 fileUri: fileUri); |
190 Library mock = new Library(Uri.parse(fileUri), | 191 Library mock = new Library(Uri.parse(fileUri), |
191 name: "mock", classes: [contextClass])..fileUri = fileUri; | 192 name: "mock", classes: [contextClass])..fileUri = fileUri; |
192 program.libraries.add(mock); | 193 program.libraries.add(mock); |
193 mock.parent = program; | 194 mock.parent = program; |
194 program.uriToSource[mock.fileUri] = new Source(<int>[0], const <int>[]); | 195 program.uriToSource[mock.fileUri] = new Source(<int>[0], const <int>[]); |
195 return contextClass; | 196 return contextClass; |
196 } | 197 } |
OLD | NEW |