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

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

Issue 2392863002: Roll kernel to latest (Closed)
Patch Set: Reinsert code Created 4 years, 2 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:async'; 5 import 'dart:async';
6 import 'dart:collection' show Queue; 6 import 'dart:collection' show Queue;
7 7
8 import 'package:kernel/ast.dart' as ir; 8 import 'package:kernel/ast.dart' as ir;
9 import 'package:kernel/checks.dart' show CheckParentPointers; 9 import 'package:kernel/checks.dart' show CheckParentPointers;
10 10
11 import '../common.dart';
12 import '../common/names.dart';
11 import '../compiler.dart' show Compiler; 13 import '../compiler.dart' show Compiler;
12 import '../constants/expressions.dart' show TypeConstantExpression; 14 import '../constants/expressions.dart' show TypeConstantExpression;
13 import '../dart_types.dart' 15 import '../dart_types.dart'
14 show DartType, FunctionType, InterfaceType, TypeKind, TypeVariableType; 16 show DartType, FunctionType, InterfaceType, TypeKind, TypeVariableType;
15 import '../diagnostics/messages.dart' show MessageKind; 17 import '../diagnostics/messages.dart' show MessageKind;
16 import '../diagnostics/spannable.dart' show Spannable; 18 import '../diagnostics/spannable.dart' show Spannable;
17 import '../elements/elements.dart' 19 import '../elements/elements.dart'
18 show 20 show
19 ClassElement, 21 ClassElement,
20 ConstructorElement, 22 ConstructorElement,
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 /// method body that is [ir.InvalidStatement]. 586 /// method body that is [ir.InvalidStatement].
585 bool isSyntheticError(Element element) { 587 bool isSyntheticError(Element element) {
586 if (element.isAmbiguous) return true; 588 if (element.isAmbiguous) return true;
587 if (element.isError) return true; 589 if (element.isError) return true;
588 if (element.isField && element is ErroneousFieldElementX) { 590 if (element.isField && element is ErroneousFieldElementX) {
589 return true; 591 return true;
590 } 592 }
591 return false; 593 return false;
592 } 594 }
593 595
596 ir.Constructor getDartCoreConstructor(
597 String className, String constructorName) {
598 LibraryElement library =
599 compiler.libraryLoader.lookupLibrary(Uris.dart_core);
600 ClassElement cls = library.implementation.localLookup(className);
601 assert(invariant(CURRENT_ELEMENT_SPANNABLE, cls != null,
602 message: 'dart:core class $className not found.'));
603 ConstructorElement constructor = cls.lookupConstructor(constructorName);
604 assert(invariant(CURRENT_ELEMENT_SPANNABLE, constructor != null,
605 message: "Constructor '$constructorName' not found "
606 "in class '$className'."));
607 return functionToIr(constructor);
608 }
609
594 ir.Procedure getDartCoreMethod(String name) { 610 ir.Procedure getDartCoreMethod(String name) {
595 LibraryElement library = 611 LibraryElement library =
596 compiler.libraryLoader.lookupLibrary(Uri.parse("dart:core")); 612 compiler.libraryLoader.lookupLibrary(Uris.dart_core);
597 Element function = library.implementation.localLookup(name); 613 Element function = library.implementation.localLookup(name);
614 assert(invariant(CURRENT_ELEMENT_SPANNABLE, function != null,
615 message: "dart:core method '$name' not found."));
598 return functionToIr(function); 616 return functionToIr(function);
599 } 617 }
600 618
601 ir.Procedure getMalformedTypeErrorBuilder() { 619 ir.Procedure getMalformedTypeErrorBuilder() {
602 return getDartCoreMethod('_malformedTypeError'); 620 return getDartCoreMethod('_malformedTypeError');
603 } 621 }
604 622
605 ir.Procedure getUnresolvedConstructorBuilder() { 623 ir.Procedure getUnresolvedConstructorBuilder() {
606 return getDartCoreMethod('_unresolvedConstructorError'); 624 return getDartCoreMethod('_unresolvedConstructorError');
607 } 625 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 657 }
640 658
641 ir.Procedure getUnresolvedSuperMethodBuilder() { 659 ir.Procedure getUnresolvedSuperMethodBuilder() {
642 return getDartCoreMethod('_unresolvedSuperMethodError'); 660 return getDartCoreMethod('_unresolvedSuperMethodError');
643 } 661 }
644 662
645 ir.Procedure getGenericNoSuchMethodBuilder() { 663 ir.Procedure getGenericNoSuchMethodBuilder() {
646 return getDartCoreMethod('_genericNoSuchMethod'); 664 return getDartCoreMethod('_genericNoSuchMethod');
647 } 665 }
648 666
649 ir.Procedure getFallThroughErrorBuilder() { 667 ir.Constructor getFallThroughErrorConstructor() {
650 return getDartCoreMethod('_fallThroughError'); 668 return getDartCoreConstructor('FallThroughError', '');
651 } 669 }
652 } 670 }
653 671
654 class ConstructorTarget { 672 class ConstructorTarget {
655 final ConstructorElement element; 673 final ConstructorElement element;
656 final DartType type; 674 final DartType type;
657 675
658 ConstructorTarget(this.element, this.type); 676 ConstructorTarget(this.element, this.type);
659 677
660 String toString() => "ConstructorTarget($element, $type)"; 678 String toString() => "ConstructorTarget($element, $type)";
661 } 679 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/fall_through_visitor.dart ('k') | pkg/compiler/lib/src/kernel/kernel_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698