OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 mock_compiler; | 5 library mock_compiler; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 | 10 |
11 import 'package:compiler/compiler.dart' as api; | 11 import 'package:compiler/compiler.dart' as api; |
| 12 import 'package:compiler/src/constants/expressions.dart'; |
12 import 'package:compiler/src/elements/elements.dart'; | 13 import 'package:compiler/src/elements/elements.dart'; |
13 import 'package:compiler/src/js_backend/js_backend.dart' | 14 import 'package:compiler/src/js_backend/js_backend.dart' |
14 show JavaScriptBackend; | 15 show JavaScriptBackend; |
15 import 'package:compiler/src/resolution/resolution.dart'; | 16 import 'package:compiler/src/resolution/resolution.dart'; |
16 import 'package:compiler/src/io/source_file.dart'; | 17 import 'package:compiler/src/io/source_file.dart'; |
17 import 'package:compiler/src/tree/tree.dart'; | 18 import 'package:compiler/src/tree/tree.dart'; |
18 import 'package:compiler/src/util/util.dart'; | 19 import 'package:compiler/src/util/util.dart'; |
19 import 'parser_helper.dart'; | 20 import 'parser_helper.dart'; |
20 | 21 |
21 import 'package:compiler/src/elements/modelx.dart' | 22 import 'package:compiler/src/elements/modelx.dart' |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 354 |
354 operator []=(Node node, Element element) { | 355 operator []=(Node node, Element element) { |
355 map[node] = element; | 356 map[node] = element; |
356 } | 357 } |
357 | 358 |
358 operator [](Node node) => map[node]; | 359 operator [](Node node) => map[node]; |
359 | 360 |
360 void remove(Node node) { | 361 void remove(Node node) { |
361 map.remove(node); | 362 map.remove(node); |
362 } | 363 } |
| 364 |
| 365 List<ConstantExpression> get constants { |
| 366 List<ConstantExpression> list = <ConstantExpression>[]; |
| 367 forEachConstantNode((_, c) => list.add(c)); |
| 368 return list; |
| 369 } |
363 } | 370 } |
364 | 371 |
365 // The mock compiler does not split the program in output units. | 372 // The mock compiler does not split the program in output units. |
366 class MockDeferredLoadTask extends DeferredLoadTask { | 373 class MockDeferredLoadTask extends DeferredLoadTask { |
367 MockDeferredLoadTask(Compiler compiler) : super(compiler); | 374 MockDeferredLoadTask(Compiler compiler) : super(compiler); |
368 | 375 |
369 OutputUnit getElementOutputUnit(dynamic dependency) { | 376 OutputUnit getElementOutputUnit(dynamic dependency) { |
370 return mainOutputUnit; | 377 return mainOutputUnit; |
371 } | 378 } |
372 } | 379 } |
(...skipping 20 matching lines...) Expand all Loading... |
393 MockElement(Element enclosingElement) | 400 MockElement(Element enclosingElement) |
394 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 401 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
395 enclosingElement); | 402 enclosingElement); |
396 | 403 |
397 get node => null; | 404 get node => null; |
398 | 405 |
399 parseNode(_) => null; | 406 parseNode(_) => null; |
400 | 407 |
401 bool get hasNode => false; | 408 bool get hasNode => false; |
402 } | 409 } |
OLD | NEW |