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

Unified Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 561373002: Issue 19682. New analyzer snapshot that fixes an inline refactoring problem. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes for mock_sdk Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/element.dart
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
index 2cb282ace9656276ac5a4f14308b8ce6eac672bc..9f7ee281a0d23234646c725e3174e5e170ffea3e 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -5285,7 +5285,7 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
*
* @param element the element representing the declaration of the function type
*/
- FunctionTypeImpl.con1(ExecutableElement element) : super(element, element == null ? null : element.name);
+ FunctionTypeImpl.con1(ExecutableElement element) : super(element, null);
/**
* Initialize a newly created function type to be declared by the given element and to have the
@@ -11117,7 +11117,8 @@ abstract class UnionType implements DartType {
class UnionTypeImpl extends TypeImpl implements UnionType {
/**
* Any unions in the `types` will be flattened in the returned union. If there is only one
- * type after flattening then it will be returned directly, instead of a singleton union.
+ * type after flattening then it will be returned directly, instead of a singleton union. Nulls
+ * are discarded, unless all types are null, in which case an exception is raised.
*
* @param types the `Type`s to union
* @return a `Type` comprising the `Type`s in `types`
@@ -11128,10 +11129,17 @@ class UnionTypeImpl extends TypeImpl implements UnionType {
if (t is UnionType) {
set.addAll(t.elements);
} else {
- set.add(t);
+ if (t != null) {
+ set.add(t);
+ }
}
}
if (set.length == 0) {
+ // TODO(collinsn): better to return [null] here? The use case is e.g.
+ //
+ // union(null, null) ==> null;
+ //
+ // instead of raising an exception.
throw new IllegalArgumentException("No known use case for empty unions.");
} else if (set.length == 1) {
return new JavaIterator(set).next();
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698