| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Set of flags and options passed to the compiler | 5 /// Set of flags and options passed to the compiler |
| 6 library dev_compiler.src.options; | 6 library dev_compiler.src.options; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:args/args.dart'; | 10 import 'package:args/args.dart'; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 /// Whether to infer return types and field types from overriden members. | 28 /// Whether to infer return types and field types from overriden members. |
| 29 final bool inferFromOverrides; | 29 final bool inferFromOverrides; |
| 30 static const inferFromOverridesDefault = true; | 30 static const inferFromOverridesDefault = true; |
| 31 | 31 |
| 32 /// Whether to infer types for consts and fields by looking at initializers on | 32 /// Whether to infer types for consts and fields by looking at initializers on |
| 33 /// the RHS. For example, in a constant declaration like: | 33 /// the RHS. For example, in a constant declaration like: |
| 34 /// | 34 /// |
| 35 /// const A = B; | 35 /// const A = B; |
| 36 /// | 36 /// |
| 37 /// We can infer the type of `A` based on the type of `B`. The current | 37 /// We can infer the type of `A` based on the type of `B`. The inference |
| 38 /// implementation of this inference is limited to ensure the answer is | 38 /// algorithm determines what variables depend on others, and computes types |
| 39 /// deterministic when applying inference on library cycles. In the example | 39 /// by visiting the variable dependency graph in topological order. This |
| 40 /// above, `A` is inferred to have `B`'s declared type if they are both in the | 40 /// ensures that the inferred type is deterministic when applying inference on |
| 41 /// same library cycle. However, if `B`'s definition is not in the same | 41 /// library cycles. |
| 42 /// connected component as `A`, we use `B`'s inferred type instead. | |
| 43 /// | 42 /// |
| 44 /// Because this might be surprising to users, this is turned off by default. | 43 /// When this feature is turned off, we don't use the type of `B` to infer the |
| 45 /// In the future, inference might track dependencies between variables in | 44 /// type of `A`, even if `B` has a declared type. |
| 46 /// more detail so that, in the example above, we can use `B`'s inferred type | |
| 47 /// always. | |
| 48 final bool inferTransitively; | 45 final bool inferTransitively; |
| 49 static const inferTransitivelyDefault = false; | 46 static const inferTransitivelyDefault = true; |
| 50 | 47 |
| 51 /// Restrict inference of fields and top-levels to those that are final and | 48 /// Restrict inference of fields and top-levels to those that are final and |
| 52 /// const. | 49 /// const. |
| 53 final bool onlyInferConstsAndFinalFields; | 50 final bool onlyInferConstsAndFinalFields; |
| 54 static const onlyInferConstAndFinalFieldsDefault = false; | 51 static const onlyInferConstAndFinalFieldsDefault = false; |
| 55 | 52 |
| 56 ResolverOptions({this.useMultiPackage: false, this.packageRoot: 'packages/', | 53 ResolverOptions({this.useMultiPackage: false, this.packageRoot: 'packages/', |
| 57 this.packagePaths: const <String>[], | 54 this.packagePaths: const <String>[], |
| 58 this.inferFromOverrides: inferFromOverridesDefault, | 55 this.inferFromOverrides: inferFromOverridesDefault, |
| 59 this.inferTransitively: inferTransitivelyDefault, | 56 this.inferTransitively: inferTransitivelyDefault, |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // The pub-cache directory is two levels up, but we verify that the layout | 392 // The pub-cache directory is two levels up, but we verify that the layout |
| 396 // looks correct. | 393 // looks correct. |
| 397 if (path.basename(dir) != 'dev_compiler') return null; | 394 if (path.basename(dir) != 'dev_compiler') return null; |
| 398 dir = path.dirname(dir); | 395 dir = path.dirname(dir); |
| 399 if (path.basename(dir) != 'global_packages') return null; | 396 if (path.basename(dir) != 'global_packages') return null; |
| 400 dir = path.dirname(dir); | 397 dir = path.dirname(dir); |
| 401 return path.join(dir, cacheDir, 'lib', 'runtime'); | 398 return path.join(dir, cacheDir, 'lib', 'runtime'); |
| 402 } | 399 } |
| 403 return null; | 400 return null; |
| 404 } | 401 } |
| OLD | NEW |