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

Side by Side Diff: lib/compiler/implementation/compiler.dart

Issue 10908287: Make identical(a,b) a compile-time constant in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comment. Created 8 years, 3 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 5
6 /** 6 /**
7 * If true, print a warning for each method that was resolved, but not 7 * If true, print a warning for each method that was resolved, but not
8 * compiled. 8 * compiled.
9 */ 9 */
10 const bool REPORT_EXCESS_RESOLUTION = false; 10 const bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 ClassElement dynamicClass; 115 ClassElement dynamicClass;
116 ClassElement boolClass; 116 ClassElement boolClass;
117 ClassElement numClass; 117 ClassElement numClass;
118 ClassElement intClass; 118 ClassElement intClass;
119 ClassElement doubleClass; 119 ClassElement doubleClass;
120 ClassElement stringClass; 120 ClassElement stringClass;
121 ClassElement functionClass; 121 ClassElement functionClass;
122 ClassElement nullClass; 122 ClassElement nullClass;
123 ClassElement listClass; 123 ClassElement listClass;
124 Element assertMethod; 124 Element assertMethod;
125 Element identicalFunction;
125 126
126 Element get currentElement => _currentElement; 127 Element get currentElement => _currentElement;
127 withCurrentElement(Element element, f()) { 128 withCurrentElement(Element element, f()) {
128 Element old = currentElement; 129 Element old = currentElement;
129 _currentElement = element; 130 _currentElement = element;
130 try { 131 try {
131 return f(); 132 return f();
132 } on CompilerCancelledException catch (ex) { 133 } on CompilerCancelledException catch (ex) {
133 throw; 134 throw;
134 } on StackOverflowException catch (ex) { 135 } on StackOverflowException catch (ex) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 jsHelperLibrary = scanBuiltinLibrary('_js_helper'); 361 jsHelperLibrary = scanBuiltinLibrary('_js_helper');
361 interceptorsLibrary = scanBuiltinLibrary('_interceptors'); 362 interceptorsLibrary = scanBuiltinLibrary('_interceptors');
362 363
363 addForeignFunctions(jsHelperLibrary); 364 addForeignFunctions(jsHelperLibrary);
364 addForeignFunctions(interceptorsLibrary); 365 addForeignFunctions(interceptorsLibrary);
365 366
366 libraries['dart:core'] = coreLibrary; 367 libraries['dart:core'] = coreLibrary;
367 libraries['dart:coreimpl'] = coreImplLibrary; 368 libraries['dart:coreimpl'] = coreImplLibrary;
368 369
369 assertMethod = jsHelperLibrary.find(const SourceString('assert')); 370 assertMethod = jsHelperLibrary.find(const SourceString('assert'));
371 identicalFunction = coreLibrary.find(const SourceString('identical'));
ahe 2012/09/18 08:30:17 This doesn't report an error if it cannot find 'id
370 372
371 initializeSpecialClasses(); 373 initializeSpecialClasses();
372 } 374 }
373 375
374 void importCoreLibrary(LibraryElement library) { 376 void importCoreLibrary(LibraryElement library) {
375 Uri coreUri = new Uri.fromComponents(scheme: 'dart', path: 'core'); 377 Uri coreUri = new Uri.fromComponents(scheme: 'dart', path: 'core');
376 if (coreLibrary === null) { 378 if (coreLibrary === null) {
377 coreLibrary = scanner.loadLibrary(coreUri, null, coreUri); 379 coreLibrary = scanner.loadLibrary(coreUri, null, coreUri);
378 } 380 }
379 scanner.importLibrary(library, 381 scanner.importLibrary(library,
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 final endOffset = end.charOffset + end.slowCharCount; 941 final endOffset = end.charOffset + end.slowCharCount;
940 942
941 // [begin] and [end] might be the same for the same empty token. This 943 // [begin] and [end] might be the same for the same empty token. This
942 // happens for instance when scanning '$$'. 944 // happens for instance when scanning '$$'.
943 assert(endOffset >= beginOffset); 945 assert(endOffset >= beginOffset);
944 return f(beginOffset, endOffset); 946 return f(beginOffset, endOffset);
945 } 947 }
946 948
947 String toString() => 'SourceSpan($uri, $begin, $end)'; 949 String toString() => 'SourceSpan($uri, $begin, $end)';
948 } 950 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698