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 part of dart_backend; | 5 part of dart_backend; |
6 | 6 |
7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
10 class ElementAst { | 10 class ElementAst { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 return constantCompiler.compileConstant(element); | 514 return constantCompiler.compileConstant(element); |
515 }); | 515 }); |
516 } | 516 } |
517 | 517 |
518 void compileVariable(VariableElement element) { | 518 void compileVariable(VariableElement element) { |
519 measure(() { | 519 measure(() { |
520 constantCompiler.compileVariable(element); | 520 constantCompiler.compileVariable(element); |
521 }); | 521 }); |
522 } | 522 } |
523 | 523 |
524 ConstantExpression compileNode(Node node, TreeElements elements) { | 524 ConstantExpression compileNode(Node node, TreeElements elements, |
| 525 {bool enforceConst: true}) { |
525 return measure(() { | 526 return measure(() { |
526 return constantCompiler.compileNodeWithDefinitions(node, elements); | 527 return constantCompiler.compileNodeWithDefinitions(node, elements, |
| 528 isConst: enforceConst); |
527 }); | 529 }); |
528 } | 530 } |
529 | 531 |
530 ConstantExpression compileMetadata(MetadataAnnotation metadata, | 532 ConstantExpression compileMetadata(MetadataAnnotation metadata, |
531 Node node, | 533 Node node, |
532 TreeElements elements) { | 534 TreeElements elements) { |
533 return measure(() { | 535 return measure(() { |
534 return constantCompiler.compileMetadata(metadata, node, elements); | 536 return constantCompiler.compileMetadata(metadata, node, elements); |
535 }); | 537 }); |
536 } | 538 } |
(...skipping 19 matching lines...) Expand all Loading... |
556 } | 558 } |
557 | 559 |
558 void traceGraph(String title, var irObject) { | 560 void traceGraph(String title, var irObject) { |
559 compiler.tracer.traceGraph(title, irObject); | 561 compiler.tracer.traceGraph(title, irObject); |
560 } | 562 } |
561 | 563 |
562 DartTypes get dartTypes => compiler.types; | 564 DartTypes get dartTypes => compiler.types; |
563 | 565 |
564 InternalErrorFunction get internalError => compiler.internalError; | 566 InternalErrorFunction get internalError => compiler.internalError; |
565 } | 567 } |
OLD | NEW |