| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 class DartConstantTask extends ConstantCompilerTask | 402 class DartConstantTask extends ConstantCompilerTask |
| 403 implements BackendConstantEnvironment { | 403 implements BackendConstantEnvironment { |
| 404 final DartConstantCompiler constantCompiler; | 404 final DartConstantCompiler constantCompiler; |
| 405 | 405 |
| 406 DartConstantTask(Compiler compiler) | 406 DartConstantTask(Compiler compiler) |
| 407 : this.constantCompiler = new DartConstantCompiler(compiler), | 407 : this.constantCompiler = new DartConstantCompiler(compiler), |
| 408 super(compiler); | 408 super(compiler); |
| 409 | 409 |
| 410 String get name => 'ConstantHandler'; | 410 String get name => 'ConstantHandler'; |
| 411 | 411 |
| 412 Constant getConstantForVariable(VariableElement element) { | 412 ConstExp getConstantForVariable(VariableElement element) { |
| 413 return constantCompiler.getConstantForVariable(element); | 413 return constantCompiler.getConstantForVariable(element); |
| 414 } | 414 } |
| 415 | 415 |
| 416 Constant getConstantForNode(Node node, TreeElements elements) { | 416 ConstExp getConstantForNode(Node node, TreeElements elements) { |
| 417 return constantCompiler.getConstantForNode(node, elements); | 417 return constantCompiler.getConstantForNode(node, elements); |
| 418 } | 418 } |
| 419 | 419 |
| 420 Constant getConstantForMetadata(MetadataAnnotation metadata) { | 420 ConstExp getConstantForMetadata(MetadataAnnotation metadata) { |
| 421 return metadata.value; | 421 return metadata.constant; |
| 422 } | 422 } |
| 423 | 423 |
| 424 Constant compileConstant(VariableElement element) { | 424 ConstExp compileConstant(VariableElement element) { |
| 425 return measure(() { | 425 return measure(() { |
| 426 return constantCompiler.compileConstant(element); | 426 return constantCompiler.compileConstant(element); |
| 427 }); | 427 }); |
| 428 } | 428 } |
| 429 | 429 |
| 430 void compileVariable(VariableElement element) { | 430 void compileVariable(VariableElement element) { |
| 431 measure(() { | 431 measure(() { |
| 432 constantCompiler.compileVariable(element); | 432 constantCompiler.compileVariable(element); |
| 433 }); | 433 }); |
| 434 } | 434 } |
| 435 | 435 |
| 436 Constant compileNode(Node node, TreeElements elements) { | 436 ConstExp compileNode(Node node, TreeElements elements) { |
| 437 return measure(() { | 437 return measure(() { |
| 438 return constantCompiler.compileNodeWithDefinitions(node, elements); | 438 return constantCompiler.compileNodeWithDefinitions(node, elements); |
| 439 }); | 439 }); |
| 440 } | 440 } |
| 441 | 441 |
| 442 Constant compileMetadata(MetadataAnnotation metadata, | 442 ConstExp compileMetadata(MetadataAnnotation metadata, |
| 443 Node node, | 443 Node node, |
| 444 TreeElements elements) { | 444 TreeElements elements) { |
| 445 return measure(() { | 445 return measure(() { |
| 446 return constantCompiler.compileMetadata(metadata, node, elements); | 446 return constantCompiler.compileMetadata(metadata, node, elements); |
| 447 }); | 447 }); |
| 448 } | 448 } |
| 449 } | 449 } |
| OLD | NEW |