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

Side by Side Diff: pkg/compiler/lib/src/native/behavior.dart

Issue 1172693003: Move computeType to TypedElement and TypeDeclarationElement. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 native; 5 part of native;
6 6
7 /// This class is a temporary work-around until we get a more powerful DartType. 7 /// This class is a temporary work-around until we get a more powerful DartType.
8 class SpecialType { 8 class SpecialType {
9 final String name; 9 final String name;
10 const SpecialType._(this.name); 10 const SpecialType._(this.name);
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 // removed. 624 // removed.
625 method.functionSignature.forEachOptionalParameter( 625 method.functionSignature.forEachOptionalParameter(
626 (ParameterElement parameter) { 626 (ParameterElement parameter) {
627 behavior._escape(parameter.type, compiler); 627 behavior._escape(parameter.type, compiler);
628 }); 628 });
629 629
630 behavior._overrideWithAnnotations(method, compiler); 630 behavior._overrideWithAnnotations(method, compiler);
631 return behavior; 631 return behavior;
632 } 632 }
633 633
634 static NativeBehavior ofFieldLoad(Element field, Compiler compiler) { 634 static NativeBehavior ofFieldLoad(MemberElement field, Compiler compiler) {
635 DartType type = field.computeType(compiler); 635 DartType type = field.computeType(compiler);
636 var behavior = new NativeBehavior(); 636 var behavior = new NativeBehavior();
637 behavior.typesReturned.add(type); 637 behavior.typesReturned.add(type);
638 // Declared types are nullable. 638 // Declared types are nullable.
639 behavior.typesReturned.add(compiler.nullClass.computeType(compiler)); 639 behavior.typesReturned.add(compiler.nullClass.computeType(compiler));
640 behavior._capture(type, compiler); 640 behavior._capture(type, compiler);
641 behavior._overrideWithAnnotations(field, compiler); 641 behavior._overrideWithAnnotations(field, compiler);
642 return behavior; 642 return behavior;
643 } 643 }
644 644
645 static NativeBehavior ofFieldStore(Element field, Compiler compiler) { 645 static NativeBehavior ofFieldStore(MemberElement field, Compiler compiler) {
646 DartType type = field.computeType(compiler); 646 DartType type = field.computeType(compiler);
647 var behavior = new NativeBehavior(); 647 var behavior = new NativeBehavior();
648 behavior._escape(type, compiler); 648 behavior._escape(type, compiler);
649 // We don't override the default behaviour - the annotations apply to 649 // We don't override the default behaviour - the annotations apply to
650 // loading the field. 650 // loading the field.
651 return behavior; 651 return behavior;
652 } 652 }
653 653
654 void _overrideWithAnnotations(Element element, Compiler compiler) { 654 void _overrideWithAnnotations(Element element, Compiler compiler) {
655 if (element.metadata.isEmpty) return; 655 if (element.metadata.isEmpty) return;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 MessageKind.GENERIC, 771 MessageKind.GENERIC,
772 {'text': "Type '$typeString' not found."}); 772 {'text': "Type '$typeString' not found."});
773 return const DynamicType(); 773 return const DynamicType();
774 } 774 }
775 775
776 static _errorNode(locationNodeOrElement, compiler) { 776 static _errorNode(locationNodeOrElement, compiler) {
777 if (locationNodeOrElement is Node) return locationNodeOrElement; 777 if (locationNodeOrElement is Node) return locationNodeOrElement;
778 return locationNodeOrElement.parseNode(compiler); 778 return locationNodeOrElement.parseNode(compiler);
779 } 779 }
780 } 780 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart ('k') | pkg/compiler/lib/src/patch_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698