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

Side by Side Diff: pkg/compiler/lib/src/kernel/env.dart

Issue 2994333002: Various redemptions (Closed)
Patch Set: Fix + status updates Created 3 years, 4 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 dart2js.kernel.env; 5 library dart2js.kernel.env;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 import 'package:kernel/clone.dart'; 8 import 'package:kernel/clone.dart';
9 import 'package:kernel/type_algebra.dart'; 9 import 'package:kernel/type_algebra.dart';
10 10
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return _constantConstructor; 556 return _constantConstructor;
557 } 557 }
558 558
559 @override 559 @override
560 ConstructorData copy() { 560 ConstructorData copy() {
561 return new ConstructorDataImpl(node, functionNode, definition); 561 return new ConstructorDataImpl(node, functionNode, definition);
562 } 562 }
563 } 563 }
564 564
565 abstract class FieldData extends MemberData { 565 abstract class FieldData extends MemberData {
566 DartType getFieldType(KernelToElementMap elementMap);
567
566 ConstantExpression getFieldConstant( 568 ConstantExpression getFieldConstant(
567 KernelToElementMapBase elementMap, FieldEntity field); 569 KernelToElementMapBase elementMap, FieldEntity field);
568 } 570 }
569 571
570 class FieldDataImpl extends MemberDataImpl implements FieldData { 572 class FieldDataImpl extends MemberDataImpl implements FieldData {
573 DartType _type;
571 ConstantExpression _constant; 574 ConstantExpression _constant;
572 575
573 FieldDataImpl(ir.Field node, MemberDefinition definition) 576 FieldDataImpl(ir.Field node, MemberDefinition definition)
574 : super(node, definition); 577 : super(node, definition);
575 578
576 ir.Field get node => super.node; 579 ir.Field get node => super.node;
577 580
581 DartType getFieldType(covariant KernelToElementMapBase elementMap) {
582 return _type ??= elementMap.getDartType(node.type);
583 }
584
578 ConstantExpression getFieldConstant( 585 ConstantExpression getFieldConstant(
579 KernelToElementMapBase elementMap, FieldEntity field) { 586 KernelToElementMapBase elementMap, FieldEntity field) {
580 if (_constant == null) { 587 if (_constant == null) {
581 if (node.isConst) { 588 if (node.isConst) {
582 _constant = new Constantifier(elementMap).visit(node.initializer); 589 _constant = new Constantifier(elementMap).visit(node.initializer);
583 } else { 590 } else {
584 failedAt( 591 failedAt(
585 field, 592 field,
586 "Unexpected field $field in " 593 "Unexpected field $field in "
587 "FieldDataImpl.getFieldConstant"); 594 "FieldDataImpl.getFieldConstant");
588 } 595 }
589 } 596 }
590 return _constant; 597 return _constant;
591 } 598 }
592 599
593 @override 600 @override
594 FieldData copy() { 601 FieldData copy() {
595 return new FieldDataImpl(node, definition); 602 return new FieldDataImpl(node, definition);
596 } 603 }
597 } 604 }
598 605
599 class TypedefData { 606 class TypedefData {
600 final ir.Typedef node; 607 final ir.Typedef node;
601 final TypedefEntity element; 608 final TypedefEntity element;
602 final TypedefType rawType; 609 final TypedefType rawType;
603 610
604 TypedefData(this.node, this.element, this.rawType); 611 TypedefData(this.node, this.element, this.rawType);
605 } 612 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map_impl.dart ('k') | pkg/compiler/lib/src/resolution/resolution_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698