| OLD | NEW |
| 1 # The dart2js compiler | 1 # The dart2js compiler |
| 2 | 2 |
| 3 Welcome to the sources of the dart2js compiler! | 3 Welcome to the sources of the dart2js compiler! |
| 4 | 4 |
| 5 ## Architecture | 5 ## Architecture |
| 6 | 6 |
| 7 The compiler is currently undergoing a long refactoring process. As you navigate | 7 The compiler is currently undergoing a long refactoring process. As you navigate |
| 8 this code you may find it helpful to understand how the compiler used to be, | 8 this code you may find it helpful to understand how the compiler used to be, |
| 9 where it is going, and where it is today. | 9 where it is going, and where it is today. |
| 10 | 10 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 **bin folder**: some experimental command-line entrypoints, these need to be | 235 **bin folder**: some experimental command-line entrypoints, these need to be |
| 236 revisited | 236 revisited |
| 237 | 237 |
| 238 * `bin/dart2js.dart`: is a dart2js entry point, not used today other than | 238 * `bin/dart2js.dart`: is a dart2js entry point, not used today other than |
| 239 locally for development, most of our tools launch dart2js from | 239 locally for development, most of our tools launch dart2js from |
| 240 `lib/src/dart2js.dart` instead. | 240 `lib/src/dart2js.dart` instead. |
| 241 | 241 |
| 242 AI: change how we build the SDK to launch dart2js from here, most logic might | 242 AI: change how we build the SDK to launch dart2js from here, most logic might |
| 243 remain inside `lib/src/dart2js.dart` for testing purposes. | 243 remain inside `lib/src/dart2js.dart` for testing purposes. |
| 244 | 244 |
| 245 * `bin/resolver.dart`: an experiemntal binary we used to run the resolver and | 245 * `bin/resolver.dart`: an experimental binary we used to run the resolver and |
| 246 serializer. As we are moving to work on top of kernel this is deprecated and | 246 serializer. As we are moving to work on top of kernel this is deprecated and |
| 247 should be deleted. | 247 should be deleted. |
| 248 | 248 |
| 249 AI: delete this file. | 249 AI: delete this file. |
| 250 | 250 |
| 251 **lib folder**: API to use dart2js as a library. This is used by our | 251 **lib folder**: API to use dart2js as a library. This is used by our |
| 252 command-line tool to launch dart2js, but also by pub to invoke dart2js as a | 252 command-line tool to launch dart2js, but also by pub to invoke dart2js as a |
| 253 library during `pub-build` and `pub-serve`. | 253 library during `pub-build` and `pub-serve`. |
| 254 | 254 |
| 255 * `lib/compiler_new.dart`: the current API. This API is used by our command-line | 255 * `lib/compiler_new.dart`: the current API. This API is used by our command-line |
| 256 tool to spawn the dart2js compiler. This API (and everything that is | 256 tool to spawn the dart2js compiler. This API (and everything that is |
| 257 transitively created from it) has no dependencies on `dart:io` so that the | 257 transitively created from it) has no dependencies on `dart:io` so that the |
| 258 compiler can be used in contexts where `dart:io` is not available (e.g. | 258 compiler can be used in contexts where `dart:io` is not available (e.g. |
| 259 running in a browser worker) or where `dart:io` is not used explicitly (e.g. | 259 running in a browser worker) or where `dart:io` is not used explicitly (e.g. |
| 260 running as a pub transformer). | 260 running as a pub transformer). |
| 261 | 261 |
| 262 AI: rename to `compiler.dart`. | 262 AI: rename to `compiler.dart`. |
| 263 | 263 |
| 264 * `lib/compiler.dart`: a legacy API that now is implemented by adapting calls to | 264 * `lib/compiler.dart`: a legacy API that now is implemented by adapting calls to |
| 265 the new API in `compiler_new.dart`. | 265 the new API in `compiler_new.dart`. |
| 266 | 266 |
| 267 AI: migrate users to the new API (pub is one of those users, possibly dart-pad | 267 AI: migrate users to the new API (pub is one of those users, possibly dart-pad |
| 268 is another), and delete the legacy API. | 268 is another), and delete the legacy API. |
| 269 | 269 |
| 270 **lib/src folder**: most of the compiler lives here, as very little of its | 270 **lib/src folder**: most of the compiler lives here, as very little of its |
| 271 funtionality is publicly exposed. | 271 functionality is publicly exposed. |
| 272 | 272 |
| 273 | 273 |
| 274 * `lib/src/dart2js.dart`: the command-line script that runs dart2js. When | 274 * `lib/src/dart2js.dart`: the command-line script that runs dart2js. When |
| 275 building the SDK, the dart2js snapshot is built using the main method on this | 275 building the SDK, the dart2js snapshot is built using the main method on this |
| 276 script. This file creates the parameters needed to invoke the API defined in | 276 script. This file creates the parameters needed to invoke the API defined in |
| 277 `lib/compiler_new.dart`. All dependencies on `dart:io` come from here. This is | 277 `lib/compiler_new.dart`. All dependencies on `dart:io` come from here. This is |
| 278 also where we process options (although some of the logic is done in | 278 also where we process options (although some of the logic is done in |
| 279 `options.dart`). | 279 `options.dart`). |
| 280 | 280 |
| 281 * `lib/src/compiler.dart`: defines the core `Compiler` object, which contains | 281 * `lib/src/compiler.dart`: defines the core `Compiler` object, which contains |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 specific example is a result of the way dart2js compiles numbers as | 355 specific example is a result of the way dart2js compiles numbers as |
| 356 JavaScript Numbers. | 356 JavaScript Numbers. |
| 357 | 357 |
| 358 * `lib/src/constants/evaluation.dart`: defines the algorithm to turn an | 358 * `lib/src/constants/evaluation.dart`: defines the algorithm to turn an |
| 359 expression into a value. | 359 expression into a value. |
| 360 | 360 |
| 361 * `lib/src/constants/constant_system.dart`: an abstraction that defines how | 361 * `lib/src/constants/constant_system.dart`: an abstraction that defines how |
| 362 expressions may be folded. Different implementations of the constant system | 362 expressions may be folded. Different implementations of the constant system |
| 363 are used to target Dart or JavaScript. | 363 are used to target Dart or JavaScript. |
| 364 | 364 |
| 365 * `lib/src/compile_time_constants.dart`: defines how constant expresions are | 365 * `lib/src/compile_time_constants.dart`: defines how constant expressions are |
| 366 created from a parsed AST. | 366 created from a parsed AST. |
| 367 | 367 |
| 368 * `lib/src/constant_system_dart.dart`: defines an implementation of a constant | 368 * `lib/src/constant_system_dart.dart`: defines an implementation of a constant |
| 369 system with the Dart semantics (where `1 == 1.0` is true). | 369 system with the Dart semantics (where `1 == 1.0` is true). |
| 370 | 370 |
| 371 * `lib/src/js_backend/constant_system_javascript.dart`: defines an | 371 * `lib/src/js_backend/constant_system_javascript.dart`: defines an |
| 372 implementation of a constant system with the JavaScript semantics (where | 372 implementation of a constant system with the JavaScript semantics (where |
| 373 `1 == 1.0` is false). | 373 `1 == 1.0` is false). |
| 374 | 374 |
| 375 * `lib/src/constants/constructors.dart` and | 375 * `lib/src/constants/constructors.dart` and |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 `lib/src/types/forwarding_type_mask.dart` | 813 `lib/src/types/forwarding_type_mask.dart` |
| 814 `lib/src/types/container_type_mask.dart` | 814 `lib/src/types/container_type_mask.dart` |
| 815 `lib/src/types/constants.dart` | 815 `lib/src/types/constants.dart` |
| 816 `lib/src/types/flat_type_mask.dart` | 816 `lib/src/types/flat_type_mask.dart` |
| 817 `lib/src/types/masks.dart` | 817 `lib/src/types/masks.dart` |
| 818 `lib/src/types/value_type_mask.dart` | 818 `lib/src/types/value_type_mask.dart` |
| 819 `lib/src/types/union_type_mask.dart` | 819 `lib/src/types/union_type_mask.dart` |
| 820 | 820 |
| 821 `lib/src/hash` | 821 `lib/src/hash` |
| 822 `lib/src/hash/sha1.dart` | 822 `lib/src/hash/sha1.dart` |
| OLD | NEW |