Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 class WorkItem { | 5 class WorkItem { |
| 6 final Element element; | 6 final Element element; |
| 7 TreeElements resolutionTree; | 7 TreeElements resolutionTree; |
| 8 Function run; | 8 Function run; |
| 9 Map<int, BailoutInfo> bailouts = null; | 9 Map<int, BailoutInfo> bailouts = null; |
| 10 bool allowSpeculativeOptimization = true; | 10 bool allowSpeculativeOptimization = true; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 // we add the implicit import of coreLibrary now. This can be | 162 // we add the implicit import of coreLibrary now. This can be |
| 163 // cleaned up when we have proper support for "dart:core" and | 163 // cleaned up when we have proper support for "dart:core" and |
| 164 // don't need to access it through the field "coreLibrary". | 164 // don't need to access it through the field "coreLibrary". |
| 165 // TODO(ahe): Clean this up as described above. | 165 // TODO(ahe): Clean this up as described above. |
| 166 scanner.importLibrary(coreImplLibrary, coreLibrary, null); | 166 scanner.importLibrary(coreImplLibrary, coreLibrary, null); |
| 167 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); | 167 scanner.importLibrary(jsHelperLibrary, coreLibrary, null); |
| 168 addForeignFunctions(jsHelperLibrary); | 168 addForeignFunctions(jsHelperLibrary); |
| 169 // TODO(ngeoffray): Lazily add this method. | 169 // TODO(ngeoffray): Lazily add this method. |
| 170 universe.invokedNames[NO_SUCH_METHOD] = | 170 universe.invokedNames[NO_SUCH_METHOD] = |
| 171 new Set<Invocation>.from(<Invocation>[new Invocation(2)]); | 171 new Set<Invocation>.from(<Invocation>[new Invocation(2)]); |
| 172 | |
| 173 universe.libraries.putIfAbsent('dart:core', () => coreLibrary); | |
|
ngeoffray
2012/02/16 10:50:50
Why putIfAbsent and not [] ?
ahe
2012/02/16 11:23:18
No particular reason. Now that I think about it, i
| |
| 174 universe.libraries.putIfAbsent('dart:coreimpl', () => coreImplLibrary); | |
| 172 } | 175 } |
| 173 | 176 |
| 174 /** Define the JS helper functions in the given library. */ | 177 /** Define the JS helper functions in the given library. */ |
| 175 void addForeignFunctions(LibraryElement library) { | 178 void addForeignFunctions(LibraryElement library) { |
| 176 library.define(new ForeignElement( | 179 library.define(new ForeignElement( |
| 177 const SourceString('JS'), library), this); | 180 const SourceString('JS'), library), this); |
| 178 library.define(new ForeignElement( | 181 library.define(new ForeignElement( |
| 179 const SourceString('UNINTERCEPTED'), library), this); | 182 const SourceString('UNINTERCEPTED'), library), this); |
| 180 library.define(new ForeignElement( | 183 library.define(new ForeignElement( |
| 181 const SourceString('JS_HAS_EQUALS'), library), this); | 184 const SourceString('JS_HAS_EQUALS'), library), this); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 | 369 |
| 367 class CompilerCancelledException implements Exception { | 370 class CompilerCancelledException implements Exception { |
| 368 final String reason; | 371 final String reason; |
| 369 CompilerCancelledException(this.reason); | 372 CompilerCancelledException(this.reason); |
| 370 | 373 |
| 371 String toString() { | 374 String toString() { |
| 372 String banner = 'compiler cancelled'; | 375 String banner = 'compiler cancelled'; |
| 373 return (reason !== null) ? '$banner: $reason' : '$banner'; | 376 return (reason !== null) ? '$banner: $reason' : '$banner'; |
| 374 } | 377 } |
| 375 } | 378 } |
| OLD | NEW |