Chromium Code Reviews

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

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: New check encoding Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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 part of dart_backend; 5 part of dart_backend;
6 6
7 // TODO(ahe): This class is simply wrong. This backend should use 7 // TODO(ahe): This class is simply wrong. This backend should use
8 // elements when it can, not AST nodes. Perhaps a [Map<Element, 8 // elements when it can, not AST nodes. Perhaps a [Map<Element,
9 // TreeElements>] is what is needed. 9 // TreeElements>] is what is needed.
10 class ElementAst { 10 class ElementAst {
(...skipping 200 matching lines...)
211 return true; 211 return true;
212 } 212 }
213 213
214 DartBackend(Compiler compiler, List<String> strips) 214 DartBackend(Compiler compiler, List<String> strips)
215 : tasks = <CompilerTask>[], 215 : tasks = <CompilerTask>[],
216 forceStripTypes = strips.indexOf('types') != -1, 216 forceStripTypes = strips.indexOf('types') != -1,
217 stripAsserts = strips.indexOf('asserts') != -1, 217 stripAsserts = strips.indexOf('asserts') != -1,
218 super(compiler); 218 super(compiler);
219 219
220 bool needsRti(ClassElement cls) => false; 220 bool needsRti(ClassElement cls) => false;
221 bool methodNeedsRti(Element cls) => false;
karlklose 2013/03/22 13:17:46 See comments on abstract super.
Johnni Winther 2013/06/21 12:19:14 Done.
221 222
222 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements) { 223 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements) {
223 // Right now resolver doesn't always resolve interfaces needed 224 // Right now resolver doesn't always resolve interfaces needed
224 // for literals, so force them. TODO(antonm): fix in the resolver. 225 // for literals, so force them. TODO(antonm): fix in the resolver.
225 final LITERAL_TYPE_NAMES = const [ 226 final LITERAL_TYPE_NAMES = const [
226 'Map', 'List', 'num', 'int', 'double', 'bool' 227 'Map', 'List', 'num', 'int', 'double', 'bool'
227 ]; 228 ];
228 final coreLibrary = compiler.coreLibrary; 229 final coreLibrary = compiler.coreLibrary;
229 for (final name in LITERAL_TYPE_NAMES) { 230 for (final name in LITERAL_TYPE_NAMES) {
230 ClassElement classElement = coreLibrary.findLocal(new SourceString(name)); 231 ClassElement classElement = coreLibrary.findLocal(new SourceString(name));
(...skipping 363 matching lines...)
594 } 595 }
595 596
596 compareElements(e0, e1) { 597 compareElements(e0, e1) {
597 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1); 598 int result = compareBy((e) => e.getLibrary().canonicalUri.toString())(e0, e1);
598 if (result != 0) return result; 599 if (result != 0) return result;
599 return compareBy((e) => e.position().charOffset)(e0, e1); 600 return compareBy((e) => e.position().charOffset)(e0, e1);
600 } 601 }
601 602
602 List<Element> sortElements(Iterable<Element> elements) => 603 List<Element> sortElements(Iterable<Element> elements) =>
603 sorted(elements, compareElements); 604 sorted(elements, compareElements);
OLDNEW

Powered by Google App Engine