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

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

Issue 2874973003: Add more equivalence tests for ElementEnvironment (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'dart:collection' show Queue; 5 import 'dart:collection' show Queue;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 import 'package:kernel/verifier.dart' show CheckParentPointers; 8 import 'package:kernel/verifier.dart' show CheckParentPointers;
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 in supertypesToIr(cls.interfaces.reverse().toList())) { 247 in supertypesToIr(cls.interfaces.reverse().toList())) {
248 if (supertype != classNode.mixedInType) { 248 if (supertype != classNode.mixedInType) {
249 classNode.implementedTypes.add(supertype); 249 classNode.implementedTypes.add(supertype);
250 } 250 }
251 } 251 }
252 addWork(cls, () { 252 addWork(cls, () {
253 addDefaultInstanceFieldInitializers(classNode); 253 addDefaultInstanceFieldInitializers(classNode);
254 }); 254 });
255 }); 255 });
256 addWork(cls.declaration, () { 256 addWork(cls.declaration, () {
257 for (MetadataAnnotation metadata in cls.declaration.metadata) { 257 for (MetadataAnnotation metadata in cls.implementation.metadata) {
258 classNode.addAnnotation( 258 classNode.addAnnotation(
259 const ConstantVisitor().visit(metadata.constant, this)); 259 const ConstantVisitor().visit(metadata.constant, this));
260 } 260 }
261 }); 261 });
262 return classNode; 262 return classNode;
263 }); 263 });
264 } 264 }
265 265
266 /// Adds initializers to instance fields that are have no initializer and are 266 /// Adds initializers to instance fields that are have no initializer and are
267 /// not initialized by all constructors in the class. 267 /// not initialized by all constructors in the class.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 endFactoryScope(function); 469 endFactoryScope(function);
470 irFunction.node.typeParameters 470 irFunction.node.typeParameters
471 .addAll(typeVariablesToIr(function.typeVariables)); 471 .addAll(typeVariablesToIr(function.typeVariables));
472 member.transformerFlags = visitor.transformerFlags; 472 member.transformerFlags = visitor.transformerFlags;
473 assert(() { 473 assert(() {
474 visitor.locals.forEach(checkMember); 474 visitor.locals.forEach(checkMember);
475 return true; 475 return true;
476 }); 476 });
477 }); 477 });
478 addWork(function.declaration, () { 478 addWork(function.declaration, () {
479 for (MetadataAnnotation metadata in function.declaration.metadata) { 479 for (MetadataAnnotation metadata in function.implementation.metadata) {
480 member.addAnnotation( 480 member.addAnnotation(
481 const ConstantVisitor().visit(metadata.constant, this)); 481 const ConstantVisitor().visit(metadata.constant, this));
482 } 482 }
483 }); 483 });
484 return member; 484 return member;
485 }); 485 });
486 } 486 }
487 487
488 /// Adds the type parameters of the enclosing class of [function] to 488 /// Adds the type parameters of the enclosing class of [function] to
489 /// [factoryTypeParameters]. This serves as a local scope for type variables 489 /// [factoryTypeParameters]. This serves as a local scope for type variables
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 KernelVisitor visitor = 545 KernelVisitor visitor =
546 new KernelVisitor(field, field.treeElements, this); 546 new KernelVisitor(field, field.treeElements, this);
547 fieldNode.initializer = visitor.buildInitializer() 547 fieldNode.initializer = visitor.buildInitializer()
548 ..parent = fieldNode; 548 ..parent = fieldNode;
549 } else if (!field.isInstanceMember) { 549 } else if (!field.isInstanceMember) {
550 fieldNode.initializer = new ir.NullLiteral()..parent = fieldNode; 550 fieldNode.initializer = new ir.NullLiteral()..parent = fieldNode;
551 } 551 }
552 } 552 }
553 }); 553 });
554 addWork(field.declaration, () { 554 addWork(field.declaration, () {
555 for (MetadataAnnotation metadata in field.declaration.metadata) { 555 for (MetadataAnnotation metadata in field.implementation.metadata) {
556 fieldNode.addAnnotation( 556 fieldNode.addAnnotation(
557 const ConstantVisitor().visit(metadata.constant, this)); 557 const ConstantVisitor().visit(metadata.constant, this));
558 } 558 }
559 }); 559 });
560 return fieldNode; 560 return fieldNode;
561 }); 561 });
562 } 562 }
563 563
564 ir.TypeParameter typeVariableToIr(TypeVariableElement variable) { 564 ir.TypeParameter typeVariableToIr(TypeVariableElement variable) {
565 variable = variable.declaration; 565 variable = variable.declaration;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 } 781 }
782 782
783 class ConstructorTarget { 783 class ConstructorTarget {
784 final ConstructorElement element; 784 final ConstructorElement element;
785 final ResolutionDartType type; 785 final ResolutionDartType type;
786 786
787 ConstructorTarget(this.element, this.type); 787 ConstructorTarget(this.element, this.type);
788 788
789 String toString() => "ConstructorTarget($element, $type)"; 789 String toString() => "ConstructorTarget($element, $type)";
790 } 790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698