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

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

Issue 10447088: Add a new magic element type for annotating types that have Javascript array behavior. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 final bool REPORT_EXCESS_RESOLUTION = false; 10 final bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ClassElement boolClass; 123 ClassElement boolClass;
124 ClassElement numClass; 124 ClassElement numClass;
125 ClassElement intClass; 125 ClassElement intClass;
126 ClassElement doubleClass; 126 ClassElement doubleClass;
127 ClassElement stringClass; 127 ClassElement stringClass;
128 ClassElement functionClass; 128 ClassElement functionClass;
129 ClassElement nullClass; 129 ClassElement nullClass;
130 ClassElement listClass; 130 ClassElement listClass;
131 Element assertMethod; 131 Element assertMethod;
132 132
133 /**
134 * Interface used to determine if an object has the JavaScript
135 * indexing behavior. The interface is only visible to specific
136 * libraries.
137 */
138 ClassElement jsIndexingBehaviorInterface;
139
133 Element get currentElement() => _currentElement; 140 Element get currentElement() => _currentElement;
134 withCurrentElement(Element element, f()) { 141 withCurrentElement(Element element, f()) {
135 Element old = currentElement; 142 Element old = currentElement;
136 _currentElement = element; 143 _currentElement = element;
137 try { 144 try {
138 return f(); 145 return f();
139 } catch (CompilerCancelledException ex) { 146 } catch (CompilerCancelledException ex) {
140 throw; 147 throw;
141 } catch (var ex) { 148 } catch (var ex) {
142 unhandledExceptionOnElement(element); 149 unhandledExceptionOnElement(element);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 scanner.importLibrary(interceptorsLibrary, coreLibrary, null); 366 scanner.importLibrary(interceptorsLibrary, coreLibrary, null);
360 addForeignFunctions(jsHelperLibrary); 367 addForeignFunctions(jsHelperLibrary);
361 addForeignFunctions(interceptorsLibrary); 368 addForeignFunctions(interceptorsLibrary);
362 369
363 libraries['dart:core'] = coreLibrary; 370 libraries['dart:core'] = coreLibrary;
364 libraries['dart:coreimpl'] = coreImplLibrary; 371 libraries['dart:coreimpl'] = coreImplLibrary;
365 372
366 assertMethod = coreLibrary.find(const SourceString('assert')); 373 assertMethod = coreLibrary.find(const SourceString('assert'));
367 374
368 initializeSpecialClasses(); 375 initializeSpecialClasses();
376
377 jsIndexingBehaviorInterface =
378 findHelper(const SourceString('JavaScriptIndexingBehavior'));
369 } 379 }
370 380
371 /** Define the JS helper functions in the given library. */ 381 /** Define the JS helper functions in the given library. */
372 void addForeignFunctions(LibraryElement library) { 382 void addForeignFunctions(LibraryElement library) {
373 library.define(new ForeignElement( 383 library.define(new ForeignElement(
374 const SourceString('JS'), library), this); 384 const SourceString('JS'), library), this);
375 library.define(new ForeignElement( 385 library.define(new ForeignElement(
376 const SourceString('UNINTERCEPTED'), library), this); 386 const SourceString('UNINTERCEPTED'), library), this);
377 library.define(new ForeignElement( 387 library.define(new ForeignElement(
378 const SourceString('JS_HAS_EQUALS'), library), this); 388 const SourceString('JS_HAS_EQUALS'), library), this);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 // invariant that endOffset > beginOffset, but for EOF the 711 // invariant that endOffset > beginOffset, but for EOF the
702 // charoffset of the next token may be [beginOffset]. This can 712 // charoffset of the next token may be [beginOffset]. This can
703 // also happen for synthetized tokens that are produced during 713 // also happen for synthetized tokens that are produced during
704 // error handling. 714 // error handling.
705 final endOffset = 715 final endOffset =
706 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); 716 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1);
707 assert(endOffset > beginOffset); 717 assert(endOffset > beginOffset);
708 return f(beginOffset, endOffset); 718 return f(beginOffset, endOffset);
709 } 719 }
710 } 720 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698