Check that non-abstract classes implement all methods.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//18029018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30859 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ahe@google.com 2013-12-04 17:17:23 +00:00
parent 7a47bc4442
commit 8375ade7c4
13 changed files with 729 additions and 14 deletions

View file

@ -1310,6 +1310,11 @@ class AbstractFieldElementX extends ElementX implements AbstractFieldElement {
}
accept(ElementVisitor visitor) => visitor.visitAbstractFieldElement(this);
bool get isAbstract {
return getter != null && getter.isAbstract
|| setter != null && setter.isAbstract;
}
}
// TODO(johnniwinther): [FunctionSignature] should be merged with

View file

@ -910,6 +910,25 @@ class ResolverTask extends CompilerTask {
MessageKind.CONST_CONSTRUCTOR_WITH_NONFINAL_FIELDS_FIELD);
}
}
if (!cls.isAbstract) {
for (DartType supertype in cls.allSupertypes) {
// This must have been reported elsewhere.
if (!supertype.element.isClass()) continue;
ClassElement superclass = supertype.element;
superclass.forEachMember((ClassElement holder, Element member) {
if (member.isAbstract) {
Element mine = cls.lookupMember(member.name);
if (mine == null || mine.isAbstract) {
compiler.reportWarningCode(
cls, MessageKind.UNIMPLEMENTED_METHOD,
{'class_name': cls.name, 'member_name': member.name});
compiler.reportHint(member, MessageKind.THIS_IS_THE_METHOD, {});
}
}
});
}
}
}
void checkAbstractField(Element member) {

View file

@ -1360,6 +1360,41 @@ main() {}
howToFix: "Consider deleting it.",
examples: const ["deadCode() {} main() {}"]);
static const MessageKind UNIMPLEMENTED_METHOD = const MessageKind(
"Warning: '#{class_name}' doesn't implement '#{member_name}'.",
howToFix: "Try adding an implementation of '#{member_name}'.",
examples: const ["""
abstract class I {
m();
}
class C implements I {}
class D implements I {
m() {}
}
main() {
new D().m();
new C();
}
""", """
abstract class I {
m();
}
class C extends I {}
class D extends I {
m() {}
}
main() {
new D().m();
new C();
}
"""]);
static const MessageKind COMPILER_CRASHED = const MessageKind(
"Error: The compiler crashed when compiling this element.");

View file

@ -515,7 +515,7 @@ class _LinkedHashMap<K, V> implements LinkedHashMap<K, V> {
// iterated over.
int _modifications = 0;
_LinkedHash();
_LinkedHashMap();
int get length => _length;

View file

@ -122,4 +122,6 @@ class GeneralConstantMap<K, V> extends ConstantMap<K, V> {
Iterable<V> get values {
return _getMap().values;
}
int get length => _getMap().length;
}

View file

@ -703,7 +703,7 @@ class IsolateNatives {
********************************************************/
/** Common functionality to all send ports. */
class _BaseSendPort implements SendPort {
abstract class _BaseSendPort implements SendPort {
/** Id for the destination isolate. */
final int _isolateId;
@ -1216,6 +1216,7 @@ class _Copier extends _MessageTraverser {
return copy;
}
visitSendPort(SendPort x) => throw new UnimplementedError();
}
/** Visitor that serializes a message as a JSON array. */
@ -1257,6 +1258,8 @@ class _Serializer extends _MessageTraverser {
}
return result;
}
visitSendPort(SendPort x) => throw new UnimplementedError();
}
/** Deserializes arrays created with [_Serializer]. */

View file

@ -230,7 +230,9 @@ class JsTypeMirror extends JsDeclarationMirror implements TypeMirror {
List<InstanceMirror> get metadata => throw new UnimplementedError();
bool get hasReflectedType => false;
Type get reflectedType => throw new UnsupportedError("This type does not support reflectedTypees");
Type get reflectedType {
throw new UnsupportedError("This type does not support reflectedTypees");
}
List<TypeVariableMirror> get typeVariables => const <TypeVariableMirror>[];
List<TypeMirror> get typeArguments => const <TypeMirror>[];
@ -457,6 +459,14 @@ class JsLibraryMirror extends JsDeclarationMirror with JsObjectMirror
// TODO(ahe): Test this getter.
DeclarationMirror get owner => null;
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get topLevelMembers
=> throw new UnimplementedError();
// TODO(ahe): Implement this.
Function operator [](Symbol name)
=> throw new UnimplementedError();
}
String n(Symbol symbol) => _symbol_dev.Symbol.getName(symbol);
@ -731,6 +741,16 @@ class JsMixinApplication extends JsTypeMirror with JsObjectMirror
}
List<TypeMirror> get typeArguments => const <TypeMirror>[];
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get instanceMembers
=> throw new UnimplementedError();
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get staticMembers => throw new UnimplementedError();
// TODO(ahe): Implement this.
Function operator [](Symbol name) => throw new UnimplementedError();
}
abstract class JsObjectMirror implements ObjectMirror {
@ -881,6 +901,9 @@ class JsInstanceMirror extends JsObjectMirror implements InstanceMirror {
// TODO(ahe): Remove this method from the API.
MirrorSystem get mirrors => currentJsMirrorSystem;
// TODO(ahe): Implement this method.
Function operator [](Symbol name) => throw new UnimplementedError();
}
/**
@ -890,7 +913,8 @@ class JsInstanceMirror extends JsObjectMirror implements InstanceMirror {
* to JsCLassMirror that returns an empty list since it represents original
* declarations and classes that are not generic.
*/
class JsTypeBoundClassMirror extends JsDeclarationMirror implements ClassMirror {
class JsTypeBoundClassMirror extends JsDeclarationMirror
implements ClassMirror {
final JsClassMirror _class;
/**
@ -1092,6 +1116,19 @@ class JsTypeBoundClassMirror extends JsDeclarationMirror implements ClassMirror
Type get reflectedType => _class.reflectedType;
Symbol get simpleName => _class.simpleName;
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get instanceMembers
=> throw new UnimplementedError();
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get staticMembers => throw new UnimplementedError();
// TODO(ahe): Implement this.
ClassMirror get mixin => throw new UnimplementedError();
// TODO(ahe): Implement this.
Function operator [](Symbol name) => throw new UnimplementedError();
}
class JsClassMirror extends JsTypeMirror with JsObjectMirror
@ -1447,6 +1484,19 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
}
List<TypeMirror> get typeArguments => const <TypeMirror>[];
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get instanceMembers
=> throw new UnimplementedError();
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get staticMembers => throw new UnimplementedError();
// TODO(ahe): Implement this.
ClassMirror get mixin => throw new UnimplementedError();
// TODO(ahe): Implement this.
Function operator [](Symbol name) => throw new UnimplementedError();
}
class JsVariableMirror extends JsDeclarationMirror implements VariableMirror {
@ -1556,6 +1606,9 @@ class JsVariableMirror extends JsDeclarationMirror implements VariableMirror {
}
receiver._storeField(_jsName, arg);
}
// TODO(ahe): Implement this method.
bool get isConst => throw new UnimplementedError();
}
class JsClosureMirror extends JsInstanceMirror implements ClosureMirror {
@ -1610,11 +1663,16 @@ function(reflectee) {
String toString() => "ClosureMirror on '${Error.safeToString(reflectee)}'";
// TODO(ahe): Implement these.
// TODO(ahe): Implement this method.
String get source => throw new UnimplementedError();
// TODO(ahe): Implement this method.
InstanceMirror findInContext(Symbol name) {
throw new UnsupportedError("ClosureMirror.findInContext not yet supported");
}
// TODO(ahe): Implement this method.
Function operator [](Symbol name) => throw new UnimplementedError();
}
class JsMethodMirror extends JsDeclarationMirror implements MethodMirror {
@ -1764,11 +1822,20 @@ class JsMethodMirror extends JsDeclarationMirror implements MethodMirror {
// TODO(ahe): Test this.
bool get isRegularMethod => !isGetter && !isSetter && !isConstructor;
// TODO(ahe): Implement these.
// TODO(ahe): Implement this method.
bool get isConstConstructor => throw new UnimplementedError();
// TODO(ahe): Implement this method.
bool get isGenerativeConstructor => throw new UnimplementedError();
// TODO(ahe): Implement this method.
bool get isRedirectingConstructor => throw new UnimplementedError();
// TODO(ahe): Implement this method.
bool get isFactoryConstructor => throw new UnimplementedError();
// TODO(ahe): Implement this method.
String get source => throw new UnimplementedError();
}
class JsParameterMirror extends JsDeclarationMirror implements ParameterMirror {
@ -1821,9 +1888,63 @@ class JsTypedefMirror extends JsDeclarationMirror implements TypedefMirror {
JsFunctionTypeMirror get value => referent;
String get _prettyName => 'TypedefMirror';
// TODO(ahe): Implement this method.
List<TypeVariableMirror> get typeVariables => throw new UnimplementedError();
// TODO(ahe): Implement this method.
List<TypeMirror> get typeArguments => throw new UnimplementedError();
// TODO(ahe): Implement this method.
bool get isOriginalDeclaration => throw new UnimplementedError();
// TODO(ahe): Implement this method.
TypeMirror get originalDeclaration => throw new UnimplementedError();
// TODO(ahe): Implement this method.
DeclarationMirror get owner => throw new UnimplementedError();
// TODO(ahe): Implement this method.
List<InstanceMirror> get metadata => throw new UnimplementedError();
}
class JsFunctionTypeMirror implements FunctionTypeMirror {
// TODO(ahe): Remove this class when API is updated.
class BrokenClassMirror {
bool get hasReflectedType => throw new UnimplementedError();
Type get reflectedType => throw new UnimplementedError();
ClassMirror get superclass => throw new UnimplementedError();
List<ClassMirror> get superinterfaces => throw new UnimplementedError();
Map<Symbol, DeclarationMirror> get declarations
=> throw new UnimplementedError();
Map<Symbol, MethodMirror> get instanceMembers
=> throw new UnimplementedError();
Map<Symbol, MethodMirror> get staticMembers => throw new UnimplementedError();
ClassMirror get mixin => throw new UnimplementedError();
InstanceMirror newInstance(
Symbol constructorName,
List positionalArguments,
[Map<Symbol,dynamic> namedArguments]) => throw new UnimplementedError();
Function operator [](Symbol name) => throw new UnimplementedError();
InstanceMirror invoke(Symbol memberName,
List positionalArguments,
[Map<Symbol, dynamic> namedArguments])
=> throw new UnimplementedError();
InstanceMirror getField(Symbol fieldName) => throw new UnimplementedError();
InstanceMirror setField(Symbol fieldName, Object value)
=> throw new UnimplementedError();
List<TypeVariableMirror> get typeVariables => throw new UnimplementedError();
List<TypeMirror> get typeArguments => throw new UnimplementedError();
TypeMirror get originalDeclaration => throw new UnimplementedError();
Symbol get simpleName => throw new UnimplementedError();
Symbol get qualifiedName => throw new UnimplementedError();
bool get isPrivate => throw new UnimplementedError();
bool get isTopLevel => throw new UnimplementedError();
SourceLocation get location => throw new UnimplementedError();
List<InstanceMirror> get metadata => throw new UnimplementedError();
}
class JsFunctionTypeMirror extends BrokenClassMirror
implements FunctionTypeMirror {
final _typeData;
String _cachedToString;
TypeMirror _cachedReturnType;
@ -1923,6 +2044,9 @@ class JsFunctionTypeMirror implements FunctionTypeMirror {
}
return _cachedToString = "$s'";
}
// TODO(ahe): Implement this method.
MethodMirror get callMethod => throw new UnimplementedError();
}
int findTypeVariableIndex(List<TypeVariableMirror> typeVariables, String name) {

View file

@ -20,6 +20,272 @@ import "package:async_helper/async_helper.dart";
// TODO(johnniwinther): Support canonical URIs as keys and message kinds as
// values.
const Map<String, List<String>> WHITE_LIST = const {
// The following notices go away when bugs 15417 and 15418 are fixed.
"sdk/lib/_collection_dev/iterable.dart": const [
"Info: This is the method declaration."],
"sdk/lib/_internal/lib/interceptors.dart": const [
"Info: This is the method declaration."],
"sdk/lib/core/iterable.dart": const [
"Info: This is the method declaration."],
"sdk/lib/core/list.dart": const [
"Info: This is the method declaration."],
"sdk/lib/core/map.dart": const [
"Info: This is the method declaration."],
// Bug 15417.
"sdk/lib/html/dart2js/html_dart2js.dart": const ["""
Warning: '_DataAttributeMap' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""", """
Warning: '_NamespacedAttributeMap' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""", """
Warning: '_ElementAttributeMap' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""", """
Warning: 'Window' doesn't implement 'clearInterval'.
Try adding an implementation of 'clearInterval'.""", """
Warning: 'Window' doesn't implement 'clearTimeout'.
Try adding an implementation of 'clearTimeout'.""", """
Warning: 'Window' doesn't implement 'setInterval'.
Try adding an implementation of 'setInterval'.""", """
Warning: 'Window' doesn't implement 'setTimeout'.
Try adding an implementation of 'setTimeout'.""", """
Warning: 'Storage' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""",
"Info: This is the method declaration."],
// Bug 15418.
"sdk/lib/typed_data/dart2js/typed_data_dart2js.dart": const ["""
Warning: 'Uint64List' doesn't implement '[]'.
Try adding an implementation of '[]'.""", """
Warning: 'Uint64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'add'.
Try adding an implementation of 'add'.""", """
Warning: 'Uint64List' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""", """
Warning: 'Uint64List' doesn't implement 'reversed'.
Try adding an implementation of 'reversed'.""", """
Warning: 'Uint64List' doesn't implement 'sort'.
Try adding an implementation of 'sort'.""", """
Warning: 'Uint64List' doesn't implement 'shuffle'.
Try adding an implementation of 'shuffle'.""", """
Warning: 'Uint64List' doesn't implement 'indexOf'.
Try adding an implementation of 'indexOf'.""", """
Warning: 'Uint64List' doesn't implement 'lastIndexOf'.
Try adding an implementation of 'lastIndexOf'.""", """
Warning: 'Uint64List' doesn't implement 'clear'.
Try adding an implementation of 'clear'.""", """
Warning: 'Uint64List' doesn't implement 'insert'.
Try adding an implementation of 'insert'.""", """
Warning: 'Uint64List' doesn't implement 'insertAll'.
Try adding an implementation of 'insertAll'.""", """
Warning: 'Uint64List' doesn't implement 'setAll'.
Try adding an implementation of 'setAll'.""", """
Warning: 'Uint64List' doesn't implement 'remove'.
Try adding an implementation of 'remove'.""", """
Warning: 'Uint64List' doesn't implement 'removeAt'.
Try adding an implementation of 'removeAt'.""", """
Warning: 'Uint64List' doesn't implement 'removeLast'.
Try adding an implementation of 'removeLast'.""", """
Warning: 'Uint64List' doesn't implement 'removeWhere'.
Try adding an implementation of 'removeWhere'.""", """
Warning: 'Uint64List' doesn't implement 'retainWhere'.
Try adding an implementation of 'retainWhere'.""", """
Warning: 'Uint64List' doesn't implement 'sublist'.
Try adding an implementation of 'sublist'.""", """
Warning: 'Uint64List' doesn't implement 'getRange'.
Try adding an implementation of 'getRange'.""", """
Warning: 'Uint64List' doesn't implement 'setRange'.
Try adding an implementation of 'setRange'.""", """
Warning: 'Uint64List' doesn't implement 'removeRange'.
Try adding an implementation of 'removeRange'.""", """
Warning: 'Uint64List' doesn't implement 'fillRange'.
Try adding an implementation of 'fillRange'.""", """
Warning: 'Uint64List' doesn't implement 'replaceRange'.
Try adding an implementation of 'replaceRange'.""", """
Warning: 'Uint64List' doesn't implement 'asMap'.
Try adding an implementation of 'asMap'.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'iterator'.
Try adding an implementation of 'iterator'.""", """
Warning: 'Uint64List' doesn't implement 'map'.
Try adding an implementation of 'map'.""", """
Warning: 'Uint64List' doesn't implement 'where'.
Try adding an implementation of 'where'.""", """
Warning: 'Uint64List' doesn't implement 'expand'.
Try adding an implementation of 'expand'.""", """
Warning: 'Uint64List' doesn't implement 'contains'.
Try adding an implementation of 'contains'.""", """
Warning: 'Uint64List' doesn't implement 'forEach'.
Try adding an implementation of 'forEach'.""", """
Warning: 'Uint64List' doesn't implement 'reduce'.
Try adding an implementation of 'reduce'.""", """
Warning: 'Uint64List' doesn't implement 'fold'.
Try adding an implementation of 'fold'.""", """
Warning: 'Uint64List' doesn't implement 'every'.
Try adding an implementation of 'every'.""", """
Warning: 'Uint64List' doesn't implement 'any'.
Try adding an implementation of 'any'.""", """
Warning: 'Uint64List' doesn't implement 'toList'.
Try adding an implementation of 'toList'.""", """
Warning: 'Uint64List' doesn't implement 'toSet'.
Try adding an implementation of 'toSet'.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'isEmpty'.
Try adding an implementation of 'isEmpty'.""", """
Warning: 'Uint64List' doesn't implement 'isNotEmpty'.
Try adding an implementation of 'isNotEmpty'.""", """
Warning: 'Uint64List' doesn't implement 'take'.
Try adding an implementation of 'take'.""", """
Warning: 'Uint64List' doesn't implement 'takeWhile'.
Try adding an implementation of 'takeWhile'.""", """
Warning: 'Uint64List' doesn't implement 'skip'.
Try adding an implementation of 'skip'.""", """
Warning: 'Uint64List' doesn't implement 'skipWhile'.
Try adding an implementation of 'skipWhile'.""", """
Warning: 'Uint64List' doesn't implement 'first'.
Try adding an implementation of 'first'.""", """
Warning: 'Uint64List' doesn't implement 'last'.
Try adding an implementation of 'last'.""", """
Warning: 'Uint64List' doesn't implement 'single'.
Try adding an implementation of 'single'.""", """
Warning: 'Uint64List' doesn't implement 'firstWhere'.
Try adding an implementation of 'firstWhere'.""", """
Warning: 'Uint64List' doesn't implement 'lastWhere'.
Try adding an implementation of 'lastWhere'.""", """
Warning: 'Uint64List' doesn't implement 'singleWhere'.
Try adding an implementation of 'singleWhere'.""", """
Warning: 'Uint64List' doesn't implement 'elementAt'.
Try adding an implementation of 'elementAt'.""", """
Warning: 'Uint64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement '[]'.
Try adding an implementation of '[]'.""", """
Warning: 'Int64List' doesn't implement '[]'.
Try adding an implementation of '[]'.""", """
Warning: 'Int64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'add'.
Try adding an implementation of 'add'.""", """
Warning: 'Int64List' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""", """
Warning: 'Int64List' doesn't implement 'reversed'.
Try adding an implementation of 'reversed'.""", """
Warning: 'Int64List' doesn't implement 'sort'.
Try adding an implementation of 'sort'.""", """
Warning: 'Int64List' doesn't implement 'shuffle'.
Try adding an implementation of 'shuffle'.""", """
Warning: 'Int64List' doesn't implement 'indexOf'.
Try adding an implementation of 'indexOf'.""", """
Warning: 'Int64List' doesn't implement 'lastIndexOf'.
Try adding an implementation of 'lastIndexOf'.""", """
Warning: 'Int64List' doesn't implement 'clear'.
Try adding an implementation of 'clear'.""", """
Warning: 'Int64List' doesn't implement 'insert'.
Try adding an implementation of 'insert'.""", """
Warning: 'Int64List' doesn't implement 'insertAll'.
Try adding an implementation of 'insertAll'.""", """
Warning: 'Int64List' doesn't implement 'setAll'.
Try adding an implementation of 'setAll'.""", """
Warning: 'Int64List' doesn't implement 'remove'.
Try adding an implementation of 'remove'.""", """
Warning: 'Int64List' doesn't implement 'removeAt'.
Try adding an implementation of 'removeAt'.""", """
Warning: 'Int64List' doesn't implement 'removeLast'.
Try adding an implementation of 'removeLast'.""", """
Warning: 'Int64List' doesn't implement 'removeWhere'.
Try adding an implementation of 'removeWhere'.""", """
Warning: 'Int64List' doesn't implement 'retainWhere'.
Try adding an implementation of 'retainWhere'.""", """
Warning: 'Int64List' doesn't implement 'sublist'.
Try adding an implementation of 'sublist'.""", """
Warning: 'Int64List' doesn't implement 'getRange'.
Try adding an implementation of 'getRange'.""", """
Warning: 'Int64List' doesn't implement 'setRange'.
Try adding an implementation of 'setRange'.""", """
Warning: 'Int64List' doesn't implement 'removeRange'.
Try adding an implementation of 'removeRange'.""", """
Warning: 'Int64List' doesn't implement 'fillRange'.
Try adding an implementation of 'fillRange'.""", """
Warning: 'Int64List' doesn't implement 'replaceRange'.
Try adding an implementation of 'replaceRange'.""", """
Warning: 'Int64List' doesn't implement 'asMap'.
Try adding an implementation of 'asMap'.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'iterator'.
Try adding an implementation of 'iterator'.""", """
Warning: 'Int64List' doesn't implement 'map'.
Try adding an implementation of 'map'.""", """
Warning: 'Int64List' doesn't implement 'where'.
Try adding an implementation of 'where'.""", """
Warning: 'Int64List' doesn't implement 'expand'.
Try adding an implementation of 'expand'.""", """
Warning: 'Int64List' doesn't implement 'contains'.
Try adding an implementation of 'contains'.""", """
Warning: 'Int64List' doesn't implement 'forEach'.
Try adding an implementation of 'forEach'.""", """
Warning: 'Int64List' doesn't implement 'reduce'.
Try adding an implementation of 'reduce'.""", """
Warning: 'Int64List' doesn't implement 'fold'.
Try adding an implementation of 'fold'.""", """
Warning: 'Int64List' doesn't implement 'every'.
Try adding an implementation of 'every'.""", """
Warning: 'Int64List' doesn't implement 'any'.
Try adding an implementation of 'any'.""", """
Warning: 'Int64List' doesn't implement 'toList'.
Try adding an implementation of 'toList'.""", """
Warning: 'Int64List' doesn't implement 'toSet'.
Try adding an implementation of 'toSet'.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'isEmpty'.
Try adding an implementation of 'isEmpty'.""", """
Warning: 'Int64List' doesn't implement 'isNotEmpty'.
Try adding an implementation of 'isNotEmpty'.""", """
Warning: 'Int64List' doesn't implement 'take'.
Try adding an implementation of 'take'.""", """
Warning: 'Int64List' doesn't implement 'takeWhile'.
Try adding an implementation of 'takeWhile'.""", """
Warning: 'Int64List' doesn't implement 'skip'.
Try adding an implementation of 'skip'.""", """
Warning: 'Int64List' doesn't implement 'skipWhile'.
Try adding an implementation of 'skipWhile'.""", """
Warning: 'Int64List' doesn't implement 'first'.
Try adding an implementation of 'first'.""", """
Warning: 'Int64List' doesn't implement 'last'.
Try adding an implementation of 'last'.""", """
Warning: 'Int64List' doesn't implement 'single'.
Try adding an implementation of 'single'.""", """
Warning: 'Int64List' doesn't implement 'firstWhere'.
Try adding an implementation of 'firstWhere'.""", """
Warning: 'Int64List' doesn't implement 'lastWhere'.
Try adding an implementation of 'lastWhere'.""", """
Warning: 'Int64List' doesn't implement 'singleWhere'.
Try adding an implementation of 'singleWhere'.""", """
Warning: 'Int64List' doesn't implement 'elementAt'.
Try adding an implementation of 'elementAt'.""", """
Warning: 'Int64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement '[]'.
Try adding an implementation of '[]'."""],
};
void main() {

View file

@ -21,6 +21,249 @@ import "package:async_helper/async_helper.dart";
// TODO(johnniwinther): Support canonical URIs as keys and message kinds as
// values.
const Map<String,List<String>> WHITE_LIST = const {
// The following notices go away when bug 15418 is fixed.
"sdk/lib/_collection_dev/iterable.dart": const [
"Info: This is the method declaration."],
"sdk/lib/_internal/lib/interceptors.dart": const [
"Info: This is the method declaration."],
"sdk/lib/core/iterable.dart": const [
"Info: This is the method declaration."],
"sdk/lib/core/list.dart": const [
"Info: This is the method declaration."],
// Bug 15418.
"sdk/lib/typed_data/dart2js/typed_data_dart2js.dart": const ["""
Warning: 'Uint64List' doesn't implement '[]'.
Try adding an implementation of '[]'.""", """
Warning: 'Uint64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'add'.
Try adding an implementation of 'add'.""", """
Warning: 'Uint64List' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""", """
Warning: 'Uint64List' doesn't implement 'reversed'.
Try adding an implementation of 'reversed'.""", """
Warning: 'Uint64List' doesn't implement 'sort'.
Try adding an implementation of 'sort'.""", """
Warning: 'Uint64List' doesn't implement 'shuffle'.
Try adding an implementation of 'shuffle'.""", """
Warning: 'Uint64List' doesn't implement 'indexOf'.
Try adding an implementation of 'indexOf'.""", """
Warning: 'Uint64List' doesn't implement 'lastIndexOf'.
Try adding an implementation of 'lastIndexOf'.""", """
Warning: 'Uint64List' doesn't implement 'clear'.
Try adding an implementation of 'clear'.""", """
Warning: 'Uint64List' doesn't implement 'insert'.
Try adding an implementation of 'insert'.""", """
Warning: 'Uint64List' doesn't implement 'insertAll'.
Try adding an implementation of 'insertAll'.""", """
Warning: 'Uint64List' doesn't implement 'setAll'.
Try adding an implementation of 'setAll'.""", """
Warning: 'Uint64List' doesn't implement 'remove'.
Try adding an implementation of 'remove'.""", """
Warning: 'Uint64List' doesn't implement 'removeAt'.
Try adding an implementation of 'removeAt'.""", """
Warning: 'Uint64List' doesn't implement 'removeLast'.
Try adding an implementation of 'removeLast'.""", """
Warning: 'Uint64List' doesn't implement 'removeWhere'.
Try adding an implementation of 'removeWhere'.""", """
Warning: 'Uint64List' doesn't implement 'retainWhere'.
Try adding an implementation of 'retainWhere'.""", """
Warning: 'Uint64List' doesn't implement 'sublist'.
Try adding an implementation of 'sublist'.""", """
Warning: 'Uint64List' doesn't implement 'getRange'.
Try adding an implementation of 'getRange'.""", """
Warning: 'Uint64List' doesn't implement 'setRange'.
Try adding an implementation of 'setRange'.""", """
Warning: 'Uint64List' doesn't implement 'removeRange'.
Try adding an implementation of 'removeRange'.""", """
Warning: 'Uint64List' doesn't implement 'fillRange'.
Try adding an implementation of 'fillRange'.""", """
Warning: 'Uint64List' doesn't implement 'replaceRange'.
Try adding an implementation of 'replaceRange'.""", """
Warning: 'Uint64List' doesn't implement 'asMap'.
Try adding an implementation of 'asMap'.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'iterator'.
Try adding an implementation of 'iterator'.""", """
Warning: 'Uint64List' doesn't implement 'map'.
Try adding an implementation of 'map'.""", """
Warning: 'Uint64List' doesn't implement 'where'.
Try adding an implementation of 'where'.""", """
Warning: 'Uint64List' doesn't implement 'expand'.
Try adding an implementation of 'expand'.""", """
Warning: 'Uint64List' doesn't implement 'contains'.
Try adding an implementation of 'contains'.""", """
Warning: 'Uint64List' doesn't implement 'forEach'.
Try adding an implementation of 'forEach'.""", """
Warning: 'Uint64List' doesn't implement 'reduce'.
Try adding an implementation of 'reduce'.""", """
Warning: 'Uint64List' doesn't implement 'fold'.
Try adding an implementation of 'fold'.""", """
Warning: 'Uint64List' doesn't implement 'every'.
Try adding an implementation of 'every'.""", """
Warning: 'Uint64List' doesn't implement 'any'.
Try adding an implementation of 'any'.""", """
Warning: 'Uint64List' doesn't implement 'toList'.
Try adding an implementation of 'toList'.""", """
Warning: 'Uint64List' doesn't implement 'toSet'.
Try adding an implementation of 'toSet'.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement 'isEmpty'.
Try adding an implementation of 'isEmpty'.""", """
Warning: 'Uint64List' doesn't implement 'isNotEmpty'.
Try adding an implementation of 'isNotEmpty'.""", """
Warning: 'Uint64List' doesn't implement 'take'.
Try adding an implementation of 'take'.""", """
Warning: 'Uint64List' doesn't implement 'takeWhile'.
Try adding an implementation of 'takeWhile'.""", """
Warning: 'Uint64List' doesn't implement 'skip'.
Try adding an implementation of 'skip'.""", """
Warning: 'Uint64List' doesn't implement 'skipWhile'.
Try adding an implementation of 'skipWhile'.""", """
Warning: 'Uint64List' doesn't implement 'first'.
Try adding an implementation of 'first'.""", """
Warning: 'Uint64List' doesn't implement 'last'.
Try adding an implementation of 'last'.""", """
Warning: 'Uint64List' doesn't implement 'single'.
Try adding an implementation of 'single'.""", """
Warning: 'Uint64List' doesn't implement 'firstWhere'.
Try adding an implementation of 'firstWhere'.""", """
Warning: 'Uint64List' doesn't implement 'lastWhere'.
Try adding an implementation of 'lastWhere'.""", """
Warning: 'Uint64List' doesn't implement 'singleWhere'.
Try adding an implementation of 'singleWhere'.""", """
Warning: 'Uint64List' doesn't implement 'elementAt'.
Try adding an implementation of 'elementAt'.""", """
Warning: 'Uint64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Uint64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Uint64List' doesn't implement '[]'.
Try adding an implementation of '[]'.""", """
Warning: 'Int64List' doesn't implement '[]'.
Try adding an implementation of '[]'.""", """
Warning: 'Int64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'add'.
Try adding an implementation of 'add'.""", """
Warning: 'Int64List' doesn't implement 'addAll'.
Try adding an implementation of 'addAll'.""", """
Warning: 'Int64List' doesn't implement 'reversed'.
Try adding an implementation of 'reversed'.""", """
Warning: 'Int64List' doesn't implement 'sort'.
Try adding an implementation of 'sort'.""", """
Warning: 'Int64List' doesn't implement 'shuffle'.
Try adding an implementation of 'shuffle'.""", """
Warning: 'Int64List' doesn't implement 'indexOf'.
Try adding an implementation of 'indexOf'.""", """
Warning: 'Int64List' doesn't implement 'lastIndexOf'.
Try adding an implementation of 'lastIndexOf'.""", """
Warning: 'Int64List' doesn't implement 'clear'.
Try adding an implementation of 'clear'.""", """
Warning: 'Int64List' doesn't implement 'insert'.
Try adding an implementation of 'insert'.""", """
Warning: 'Int64List' doesn't implement 'insertAll'.
Try adding an implementation of 'insertAll'.""", """
Warning: 'Int64List' doesn't implement 'setAll'.
Try adding an implementation of 'setAll'.""", """
Warning: 'Int64List' doesn't implement 'remove'.
Try adding an implementation of 'remove'.""", """
Warning: 'Int64List' doesn't implement 'removeAt'.
Try adding an implementation of 'removeAt'.""", """
Warning: 'Int64List' doesn't implement 'removeLast'.
Try adding an implementation of 'removeLast'.""", """
Warning: 'Int64List' doesn't implement 'removeWhere'.
Try adding an implementation of 'removeWhere'.""", """
Warning: 'Int64List' doesn't implement 'retainWhere'.
Try adding an implementation of 'retainWhere'.""", """
Warning: 'Int64List' doesn't implement 'sublist'.
Try adding an implementation of 'sublist'.""", """
Warning: 'Int64List' doesn't implement 'getRange'.
Try adding an implementation of 'getRange'.""", """
Warning: 'Int64List' doesn't implement 'setRange'.
Try adding an implementation of 'setRange'.""", """
Warning: 'Int64List' doesn't implement 'removeRange'.
Try adding an implementation of 'removeRange'.""", """
Warning: 'Int64List' doesn't implement 'fillRange'.
Try adding an implementation of 'fillRange'.""", """
Warning: 'Int64List' doesn't implement 'replaceRange'.
Try adding an implementation of 'replaceRange'.""", """
Warning: 'Int64List' doesn't implement 'asMap'.
Try adding an implementation of 'asMap'.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'iterator'.
Try adding an implementation of 'iterator'.""", """
Warning: 'Int64List' doesn't implement 'map'.
Try adding an implementation of 'map'.""", """
Warning: 'Int64List' doesn't implement 'where'.
Try adding an implementation of 'where'.""", """
Warning: 'Int64List' doesn't implement 'expand'.
Try adding an implementation of 'expand'.""", """
Warning: 'Int64List' doesn't implement 'contains'.
Try adding an implementation of 'contains'.""", """
Warning: 'Int64List' doesn't implement 'forEach'.
Try adding an implementation of 'forEach'.""", """
Warning: 'Int64List' doesn't implement 'reduce'.
Try adding an implementation of 'reduce'.""", """
Warning: 'Int64List' doesn't implement 'fold'.
Try adding an implementation of 'fold'.""", """
Warning: 'Int64List' doesn't implement 'every'.
Try adding an implementation of 'every'.""", """
Warning: 'Int64List' doesn't implement 'any'.
Try adding an implementation of 'any'.""", """
Warning: 'Int64List' doesn't implement 'toList'.
Try adding an implementation of 'toList'.""", """
Warning: 'Int64List' doesn't implement 'toSet'.
Try adding an implementation of 'toSet'.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement 'isEmpty'.
Try adding an implementation of 'isEmpty'.""", """
Warning: 'Int64List' doesn't implement 'isNotEmpty'.
Try adding an implementation of 'isNotEmpty'.""", """
Warning: 'Int64List' doesn't implement 'take'.
Try adding an implementation of 'take'.""", """
Warning: 'Int64List' doesn't implement 'takeWhile'.
Try adding an implementation of 'takeWhile'.""", """
Warning: 'Int64List' doesn't implement 'skip'.
Try adding an implementation of 'skip'.""", """
Warning: 'Int64List' doesn't implement 'skipWhile'.
Try adding an implementation of 'skipWhile'.""", """
Warning: 'Int64List' doesn't implement 'first'.
Try adding an implementation of 'first'.""", """
Warning: 'Int64List' doesn't implement 'last'.
Try adding an implementation of 'last'.""", """
Warning: 'Int64List' doesn't implement 'single'.
Try adding an implementation of 'single'.""", """
Warning: 'Int64List' doesn't implement 'firstWhere'.
Try adding an implementation of 'firstWhere'.""", """
Warning: 'Int64List' doesn't implement 'lastWhere'.
Try adding an implementation of 'lastWhere'.""", """
Warning: 'Int64List' doesn't implement 'singleWhere'.
Try adding an implementation of 'singleWhere'.""", """
Warning: 'Int64List' doesn't implement 'elementAt'.
Try adding an implementation of 'elementAt'.""", """
Warning: 'Int64List' doesn't implement '[]='.
Try adding an implementation of '[]='.""", """
Warning: 'Int64List' doesn't implement 'length'.
Try adding an implementation of 'length'.""", """
Warning: 'Int64List' doesn't implement '[]'.
Try adding an implementation of '[]'."""],
};
void main() {

View file

@ -8,13 +8,11 @@ import 'package:async_helper/async_helper.dart';
import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
import 'analyze_dart2js_test.dart' as analyze_dart2js;
import 'analyze_helper.dart';
void main() {
var uri = currentDirectory.resolve(
'sdk/lib/_internal/compiler/implementation/use_unused_api.dart');
asyncTest(
() => analyze([uri], analyze_dart2js.WHITE_LIST, analyzeAll: false));
() => analyze([uri], {}, analyzeAll: false));
}

View file

@ -74,6 +74,9 @@ DiagnosticHandler createDiagnosticHandler(DiagnosticHandler diagnosticHandler,
return handler;
}
Expando<MemorySourceFileProvider> expando =
new Expando<MemorySourceFileProvider>();
Compiler compilerFor(Map<String,String> memorySourceFiles,
{DiagnosticHandler diagnosticHandler,
List<String> options: const [],
@ -83,7 +86,24 @@ Compiler compilerFor(Map<String,String> memorySourceFiles,
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');
var provider = new MemorySourceFileProvider(memorySourceFiles);
MemorySourceFileProvider provider;
var readStringFromUri;
if (cachedCompiler == null) {
provider = new MemorySourceFileProvider(memorySourceFiles);
readStringFromUri = provider.readStringFromUri;
// Saving the provider in case we need it later for a cached compiler.
expando[readStringFromUri] = provider;
} else {
// When using a cached compiler, it has read a number of files from disk
// already (and will not attemp to read them again due to caching). These
// files must be available to the new diagnostic handler.
provider = expando[cachedCompiler.provider];
readStringFromUri = cachedCompiler.provider;
provider.memorySourceFiles.clear();
memorySourceFiles.forEach((key, value) {
provider.memorySourceFiles[key] = value;
});
}
var handler =
createDiagnosticHandler(diagnosticHandler, provider, showDiagnostics);
@ -92,7 +112,7 @@ Compiler compilerFor(Map<String,String> memorySourceFiles,
return new NullSink('$name.$extension');
}
Compiler compiler = new Compiler(provider.readStringFromUri,
Compiler compiler = new Compiler(readStringFromUri,
outputProvider,
handler,
libraryRoot,

View file

@ -58,7 +58,7 @@ void main() {
// 2. Some code was refactored, and there are more methods.
// Either situation could be problematic, but in situation 2, it is often
// acceptable to increase [expectedMethodCount] a little.
int expectedMethodCount = 344;
int expectedMethodCount = 346;
Expect.isTrue(
generatedCode.length <= expectedMethodCount,
'Too many compiled methods: '

View file

@ -54,7 +54,7 @@ class Interceptor {
get hashCode => throw 'Interceptor.hashCode not implemented.';
}
class JSIndexable {
get length;
get length {}
}
class JSMutableIndexable {}
class JSArray<E> implements JSIndexable {