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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/elements.dart

Issue 12753003: Recognize const/fixed/growable arrays in simple types inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 library elements; 5 library elements;
6 6
7 import 'dart:uri'; 7 import 'dart:uri';
8 8
9 import 'modelx.dart'; 9 import 'modelx.dart';
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 r = a.name.slowToString().compareTo(b.name.slowToString()); 479 r = a.name.slowToString().compareTo(b.name.slowToString());
480 if (r != 0) return r; 480 if (r != 0) return r;
481 // Same file, position and name. If this happens, we should find out why 481 // Same file, position and name. If this happens, we should find out why
482 // and make the order total and independent of hashCode. 482 // and make the order total and independent of hashCode.
483 return a.hashCode.compareTo(b.hashCode); 483 return a.hashCode.compareTo(b.hashCode);
484 } 484 }
485 485
486 static List<Element> sortedByPosition(Iterable<Element> elements) { 486 static List<Element> sortedByPosition(Iterable<Element> elements) {
487 return elements.toList()..sort(compareByPosition); 487 return elements.toList()..sort(compareByPosition);
488 } 488 }
489
490 static bool isFixedListConstructorCall(Element element,
491 Node node,
492 Compiler compiler) {
493 return element == compiler.unnamedListConstructor
494 && node.isCall
495 && !node.arguments.isEmpty
496 && node.arguments.tail.isEmpty;
497 }
498
499 static bool isGrowableListConstructorCall(Element element,
500 Node node,
501 Compiler compiler) {
502 return element == compiler.unnamedListConstructor
503 && node.isCall
504 && node.arguments.isEmpty;
505 }
489 } 506 }
490 507
491 abstract class ErroneousElement extends Element implements FunctionElement { 508 abstract class ErroneousElement extends Element implements FunctionElement {
492 MessageKind get messageKind; 509 MessageKind get messageKind;
493 Map get messageArguments; 510 Map get messageArguments;
494 } 511 }
495 512
496 abstract class AmbiguousElement extends Element { 513 abstract class AmbiguousElement extends Element {
497 MessageKind get messageKind; 514 MessageKind get messageKind;
498 Map get messageArguments; 515 Map get messageArguments;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 int get resolutionState; 859 int get resolutionState;
843 Token get beginToken; 860 Token get beginToken;
844 Token get endToken; 861 Token get endToken;
845 862
846 // TODO(kasperl): Try to get rid of these. 863 // TODO(kasperl): Try to get rid of these.
847 void set annotatedElement(Element value); 864 void set annotatedElement(Element value);
848 void set resolutionState(int value); 865 void set resolutionState(int value);
849 866
850 MetadataAnnotation ensureResolved(Compiler compiler); 867 MetadataAnnotation ensureResolved(Compiler compiler);
851 } 868 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698