Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: pkg/compiler/lib/src/dart_backend/backend.dart

Issue 1919143002: Store constant variable initializers in elements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/inline.dart ('k') | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 ConstantValue getConstantValue(ConstantExpression expression) { 466 ConstantValue getConstantValue(ConstantExpression expression) {
467 return constantCompiler.getConstantValue(expression); 467 return constantCompiler.getConstantValue(expression);
468 } 468 }
469 469
470 @override 470 @override
471 ConstantValue getConstantValueForVariable(VariableElement element) { 471 ConstantValue getConstantValueForVariable(VariableElement element) {
472 return constantCompiler.getConstantValueForVariable(element); 472 return constantCompiler.getConstantValueForVariable(element);
473 } 473 }
474 474
475 @override 475 @override
476 ConstantExpression getConstantForVariable(VariableElement element) {
477 return constantCompiler.getConstantForVariable(element);
478 }
479
480 @override
481 ConstantExpression getConstantForNode(Node node, TreeElements elements) { 476 ConstantExpression getConstantForNode(Node node, TreeElements elements) {
482 return constantCompiler.getConstantForNode(node, elements); 477 return constantCompiler.getConstantForNode(node, elements);
483 } 478 }
484 479
485 @override 480 @override
486 ConstantValue getConstantValueForNode(Node node, TreeElements elements) { 481 ConstantValue getConstantValueForNode(Node node, TreeElements elements) {
487 return getConstantValue( 482 return getConstantValue(
488 constantCompiler.getConstantForNode(node, elements)); 483 constantCompiler.getConstantForNode(node, elements));
489 } 484 }
490 485
491 @override 486 @override
492 ConstantValue getConstantValueForMetadata(MetadataAnnotation metadata) { 487 ConstantValue getConstantValueForMetadata(MetadataAnnotation metadata) {
493 return getConstantValue(metadata.constant); 488 return getConstantValue(metadata.constant);
494 } 489 }
495 490
496 @override 491 @override
497 ConstantExpression compileConstant(VariableElement element) { 492 ConstantExpression compileConstant(VariableElement element) {
498 return measure(() { 493 return measure(() {
499 return constantCompiler.compileConstant(element); 494 return constantCompiler.compileConstant(element);
500 }); 495 });
501 } 496 }
502 497
503 @override 498 @override
504 void evaluate(ConstantExpression constant) { 499 void evaluate(ConstantExpression constant) {
505 return measure(() { 500 return measure(() {
506 return constantCompiler.evaluate(constant); 501 return constantCompiler.evaluate(constant);
507 }); 502 });
508 } 503 }
509 504
510 void compileVariable(VariableElement element) { 505 @override
511 measure(() { 506 ConstantExpression compileVariable(VariableElement element) {
512 constantCompiler.compileVariable(element); 507 return measure(() {
508 return constantCompiler.compileVariable(element);
513 }); 509 });
514 } 510 }
515 511
516 @override 512 @override
517 ConstantExpression compileNode(Node node, TreeElements elements, 513 ConstantExpression compileNode(Node node, TreeElements elements,
518 {bool enforceConst: true}) { 514 {bool enforceConst: true}) {
519 return measure(() { 515 return measure(() {
520 return constantCompiler.compileNodeWithDefinitions(node, elements, 516 return constantCompiler.compileNodeWithDefinitions(node, elements,
521 isConst: enforceConst); 517 isConst: enforceConst);
522 }); 518 });
523 } 519 }
524 520
525 @override 521 @override
526 ConstantExpression compileMetadata( 522 ConstantExpression compileMetadata(
527 MetadataAnnotation metadata, Node node, TreeElements elements) { 523 MetadataAnnotation metadata, Node node, TreeElements elements) {
528 return measure(() { 524 return measure(() {
529 return constantCompiler.compileMetadata(metadata, node, elements); 525 return constantCompiler.compileMetadata(metadata, node, elements);
530 }); 526 });
531 } 527 }
532 528
533 // TODO(johnniwinther): Remove this when values are computed from the 529 // TODO(johnniwinther): Remove this when values are computed from the
534 // expressions. 530 // expressions.
535 @override 531 @override
536 void copyConstantValues(DartConstantTask task) { 532 void copyConstantValues(DartConstantTask task) {
537 constantCompiler.constantValueMap 533 constantCompiler.constantValueMap
538 .addAll(task.constantCompiler.constantValueMap); 534 .addAll(task.constantCompiler.constantValueMap);
539 } 535 }
540 } 536 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/inline.dart ('k') | pkg/compiler/lib/src/dump_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698