| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 Accessor parentFieldAccessor = | 80 Accessor parentFieldAccessor = |
| 81 new ThisPropertyAccessor(parentField.name, parentField, parentField); | 81 new ThisPropertyAccessor(parentField.name, parentField, parentField); |
| 82 | 82 |
| 83 List<Field> fields = <Field>[listField, parentField]; | 83 List<Field> fields = <Field>[listField, parentField]; |
| 84 | 84 |
| 85 /// Context(int i) : list = new List(i); | 85 /// Context(int i) : list = new List(i); |
| 86 VariableDeclaration iParameter = new VariableDeclaration("i", | 86 VariableDeclaration iParameter = new VariableDeclaration("i", |
| 87 type: coreTypes.intClass.rawType, isFinal: true); | 87 type: coreTypes.intClass.rawType, isFinal: true); |
| 88 | 88 |
| 89 // TODO(karlklose): use the default factory when it is exposed again. | 89 // TODO(karlklose): use the default factory when it is exposed again. |
| 90 Procedure listConstructor = coreTypes.listClass.procedures.firstWhere( | 90 Procedure listConstructor = coreTypes.listClass.procedures |
| 91 (Procedure p) => p.name.name == 'filled'); | 91 .firstWhere((Procedure p) => p.name.name == 'filled'); |
| 92 | 92 |
| 93 Constructor constructor = new Constructor( | 93 Constructor constructor = new Constructor( |
| 94 new FunctionNode(new EmptyStatement(), | 94 new FunctionNode(new EmptyStatement(), |
| 95 positionalParameters: <VariableDeclaration>[iParameter]), | 95 positionalParameters: <VariableDeclaration>[iParameter]), |
| 96 name: new Name(""), | 96 name: new Name(""), |
| 97 initializers: <Initializer>[ | 97 initializers: <Initializer>[ |
| 98 new FieldInitializer( | 98 new FieldInitializer( |
| 99 listField, | 99 listField, |
| 100 new StaticInvocation( | 100 new StaticInvocation( |
| 101 listConstructor, | 101 listConstructor, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 fields: fields, | 187 fields: fields, |
| 188 procedures: procedures, | 188 procedures: procedures, |
| 189 fileUri: fileUri); | 189 fileUri: fileUri); |
| 190 Library mock = new Library(Uri.parse(fileUri), | 190 Library mock = new Library(Uri.parse(fileUri), |
| 191 name: "mock", classes: [contextClass])..fileUri = fileUri; | 191 name: "mock", classes: [contextClass])..fileUri = fileUri; |
| 192 program.libraries.add(mock); | 192 program.libraries.add(mock); |
| 193 mock.parent = program; | 193 mock.parent = program; |
| 194 program.uriToSource[mock.fileUri] = new Source(<int>[0], ""); | 194 program.uriToSource[mock.fileUri] = new Source(<int>[0], ""); |
| 195 return contextClass; | 195 return contextClass; |
| 196 } | 196 } |
| OLD | NEW |