Update trunk to version 0.5.15.0
svn merge -r 23627:23744 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@23763 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ClassImplementsUnknownInterfaceNegativeTest.dart b/compiler/javatests/com/google/dart/compiler/resolver/ClassImplementsUnknownInterfaceNegativeTest.dart
deleted file mode 100644
index 94ed0c8..0000000
--- a/compiler/javatests/com/google/dart/compiler/resolver/ClassImplementsUnknownInterfaceNegativeTest.dart
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Expect error - Base is not an interface.
-
-interface I {
-}
-
-interface I extends UNKNOWN;
diff --git a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
index 5e171c6..d924a04 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/NegativeResolverTest.java
@@ -256,10 +256,6 @@
"}"));
}
- public void tesClassImplementsUnknownInterfaceNegativeTest() {
- checkNumErrors("ClassImplementsUnknownInterfaceNegativeTest.dart", 1);
- }
-
public void testConstSuperNegativeTest1() {
checkNumErrors("ConstSuperNegativeTest1.dart", 0);
}
@@ -355,7 +351,7 @@
"set bar(x) {}",
"get bar {}"));
}
-
+
public void test_nameShadow_topLevel_setter_variable() {
checkSourceErrors(
makeCode(
@@ -1034,7 +1030,7 @@
Type boundType = typeParameter.getBound().getType();
assertEquals("A", boundType.getElement().getName());
}
-
+
/**
* <p>
* http://code.google.com/p/dart/issues/detail?id=3986
@@ -1163,7 +1159,7 @@
""),
errEx(ResolverErrorCode.ILLEGAL_FIELD_ACCESS_FROM_STATIC, 4, 22, 1));
}
-
+
/**
* <p>
* http://code.google.com/p/dart/issues/detail?id=6489
diff --git a/pkg/analyzer_experimental/bin/analyzer.dart b/pkg/analyzer_experimental/bin/analyzer.dart
index c9b83c8..805e960 100644
--- a/pkg/analyzer_experimental/bin/analyzer.dart
+++ b/pkg/analyzer_experimental/bin/analyzer.dart
@@ -42,32 +42,30 @@
stdout.writeln("Analyzing ${options.sourceFiles}...");
}
ErrorSeverity allResult = ErrorSeverity.NONE;
- for (String sourcePath in options.sourceFiles) {
- sourcePath = sourcePath.trim();
- // check that file exists
- if (!new File(sourcePath).existsSync()) {
- print('File not found: $sourcePath');
- return ErrorSeverity.ERROR;
- }
- // check that file is Dart file
- if (!AnalysisEngine.isDartFileName(sourcePath)) {
- print('$sourcePath is not a Dart file');
- return ErrorSeverity.ERROR;
- }
- // do analyze
- ErrorFormatter formatter = new ErrorFormatter(options.machineFormat ? stderr : stdout, options);
- AnalyzerImpl analyzer = new AnalyzerImpl(options);
- analyzer.analyze(sourcePath);
- // pring errors
- formatter.formatErrors(analyzer.errorInfos);
- // prepare status
- ErrorSeverity status = analyzer.maxErrorSeverity;
- if (status == ErrorSeverity.WARNING && options.warningsAreFatal) {
- status = ErrorSeverity.ERROR;
- }
- allResult = allResult.max(status);
+ String sourcePath = options.sourceFiles[0];
+ sourcePath = sourcePath.trim();
+ // check that file exists
+ if (!new File(sourcePath).existsSync()) {
+ print('File not found: $sourcePath');
+ return ErrorSeverity.ERROR;
}
- return allResult;
+ // check that file is Dart file
+ if (!AnalysisEngine.isDartFileName(sourcePath)) {
+ print('$sourcePath is not a Dart file');
+ return ErrorSeverity.ERROR;
+ }
+ // do analyze
+ ErrorFormatter formatter = new ErrorFormatter(options.machineFormat ? stderr : stdout, options);
+ AnalyzerImpl analyzer = new AnalyzerImpl(options);
+ analyzer.analyze(sourcePath);
+ // print errors
+ formatter.formatErrors(analyzer.errorInfos);
+ // prepare status
+ ErrorSeverity status = analyzer.maxErrorSeverity;
+ if (status == ErrorSeverity.WARNING && options.warningsAreFatal) {
+ status = ErrorSeverity.ERROR;
+ }
+ return status;
}
typedef ErrorSeverity BatchRunnerHandler(List<String> args);
@@ -92,7 +90,8 @@
var subscription = cmdLine.listen((String line) {
// may be finish
if (line.isEmpty) {
- stdout.writeln('>>> BATCH END (${totalTests - testsFailed}/$totalTests) ${stopwatch.elapsedMilliseconds}ms');
+ var time = stopwatch.elapsedMilliseconds;
+ stdout.writeln('>>> BATCH END (${totalTests - testsFailed}/$totalTests) ${time}ms');
exit(batchResult.ordinal);
}
// prepare aruments
diff --git a/pkg/analyzer_experimental/lib/options.dart b/pkg/analyzer_experimental/lib/options.dart
index 8c26f43..83d5585 100644
--- a/pkg/analyzer_experimental/lib/options.dart
+++ b/pkg/analyzer_experimental/lib/options.dart
@@ -86,6 +86,7 @@
}
static CommandLineOptions _parse(List<String> args) {
+ args = args.expand((String arg) => arg.split('=')).toList();
var parser = new _CommandLineParser()
..addFlag('batch', abbr: 'b', help: 'Run in batch mode',
defaultsTo: false, negatable: false)
@@ -200,6 +201,7 @@
void addOption(String name, {String abbr, String help, List<String> allowed,
Map<String, String> allowedHelp, String defaultsTo,
void callback(value), bool allowMultiple: false}) {
+ _knownFlags.add(name);
_parser.addOption(name, abbr: abbr, help: help, allowed: allowed,
allowedHelp: allowedHelp, defaultsTo: defaultsTo, callback: callback,
allowMultiple: allowMultiple);
@@ -224,7 +226,7 @@
List<String> _filterUnknowns(args) {
// Only filter args if the ignore flag is specified.
- if (!args.contains('--ignore_unrecognized_flags')) {
+ if (!args.contains('--ignore-unrecognized-flags')) {
return args;
}
@@ -238,6 +240,7 @@
var arg = args[i];
if (arg.startsWith('--') && arg.length > 2) {
if (!_knownFlags.contains(arg.substring(2))) {
+ print('remove: $arg');
//"eat" params by advancing to the next flag/option
i = _getNextFlagIndex(args, i);
} else {
@@ -248,6 +251,7 @@
}
}
+ print(filtered);
return filtered;
}
diff --git a/pkg/analyzer_experimental/lib/src/analyzer_impl.dart b/pkg/analyzer_experimental/lib/src/analyzer_impl.dart
index 4e46d61..5d8fc4c 100644
--- a/pkg/analyzer_experimental/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_experimental/lib/src/analyzer_impl.dart
@@ -81,6 +81,7 @@
} else {
packageDirectory = getPackageDirectoryFor(sourceFile);
}
+ print('packageDirectory: ${packageDirectory.getPath()}');
if (packageDirectory != null) {
resolvers.add(new PackageUriResolver([packageDirectory]));
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/ast.dart b/pkg/analyzer_experimental/lib/src/generated/ast.dart
index 82647d4..e242155 100644
--- a/pkg/analyzer_experimental/lib/src/generated/ast.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/ast.dart
@@ -2775,6 +2775,7 @@
CommentType(this.name, this.ordinal) {
}
int compareTo(CommentType other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -12652,6 +12653,23 @@
*/
VariableDeclaration({Comment comment, List<Annotation> metadata, SimpleIdentifier name, Token equals, Expression initializer}) : this.full(comment, metadata, name, equals, initializer);
accept(ASTVisitor visitor) => visitor.visitVariableDeclaration(this);
+
+ /**
+ * This overridden implementation of getDocumentationComment() looks in the grandparent node for
+ * dartdoc comments if no documentation is specifically available on the node.
+ */
+ Comment get documentationComment {
+ Comment comment = super.documentationComment;
+ if (comment == null) {
+ if (parent != null && parent.parent != null) {
+ ASTNode node = parent.parent;
+ if (node is AnnotatedNode) {
+ return ((node as AnnotatedNode)).documentationComment;
+ }
+ }
+ }
+ return comment;
+ }
VariableElement get element => _name != null ? (_name.element as VariableElement) : null;
Token get endToken {
if (_initializer != null) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/element.dart b/pkg/analyzer_experimental/lib/src/generated/element.dart
index 575fe43..98ec241 100644
--- a/pkg/analyzer_experimental/lib/src/generated/element.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/element.dart
@@ -553,6 +553,7 @@
*/
String get displayName => _displayName;
int compareTo(ElementKind other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -3932,6 +3933,7 @@
Modifier(this.name, this.ordinal) {
}
int compareTo(Modifier other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -5399,35 +5401,23 @@
}
FunctionType t = this;
FunctionType s = type as FunctionType;
- if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
- return false;
- } else if (t.normalParameterTypes.length > 0) {
- List<Type2> tTypes = t.normalParameterTypes;
- List<Type2> sTypes = s.normalParameterTypes;
- for (int i = 0; i < tTypes.length; i++) {
- if (!tTypes[i].isAssignableTo(sTypes[i])) {
- return false;
- }
- }
- }
- if (t.optionalParameterTypes.length > 0) {
- List<Type2> tOpTypes = t.optionalParameterTypes;
- List<Type2> sOpTypes = s.optionalParameterTypes;
- if (tOpTypes.length < sOpTypes.length) {
- return false;
- }
- for (int i = 0; i < sOpTypes.length; i++) {
- if (!tOpTypes[i].isAssignableTo(sOpTypes[i])) {
- return false;
- }
- }
- if (t.namedParameterTypes.length > 0 || s.namedParameterTypes.length > 0) {
- return false;
- }
- } else if (s.optionalParameterTypes.length > 0) {
+ List<Type2> tTypes = t.normalParameterTypes;
+ List<Type2> tOpTypes = t.optionalParameterTypes;
+ List<Type2> sTypes = s.normalParameterTypes;
+ List<Type2> sOpTypes = s.optionalParameterTypes;
+ if ((sOpTypes.length > 0 && t.namedParameterTypes.length > 0) || (tOpTypes.length > 0 && s.namedParameterTypes.length > 0)) {
return false;
}
if (t.namedParameterTypes.length > 0) {
+ if (t.normalParameterTypes.length != s.normalParameterTypes.length) {
+ return false;
+ } else if (t.normalParameterTypes.length > 0) {
+ for (int i = 0; i < tTypes.length; i++) {
+ if (!tTypes[i].isAssignableTo(sTypes[i])) {
+ return false;
+ }
+ }
+ }
Map<String, Type2> namedTypesT = t.namedParameterTypes;
Map<String, Type2> namedTypesS = s.namedParameterTypes;
if (namedTypesT.length < namedTypesS.length) {
@@ -5446,6 +5436,31 @@
}
} else if (s.namedParameterTypes.length > 0) {
return false;
+ } else {
+ int tArgLength = tTypes.length + tOpTypes.length;
+ int sArgLength = sTypes.length + sOpTypes.length;
+ if (tArgLength < sArgLength || sTypes.length < tTypes.length) {
+ return false;
+ }
+ List<Type2> tAllTypes = new List<Type2>(sArgLength);
+ for (int i = 0; i < tTypes.length; i++) {
+ tAllTypes[i] = tTypes[i];
+ }
+ for (int i = tTypes.length, j = 0; i < sArgLength; i++, j++) {
+ tAllTypes[i] = tOpTypes[j];
+ }
+ List<Type2> sAllTypes = new List<Type2>(sArgLength);
+ for (int i = 0; i < sTypes.length; i++) {
+ sAllTypes[i] = sTypes[i];
+ }
+ for (int i = sTypes.length, j = 0; i < sArgLength; i++, j++) {
+ sAllTypes[i] = sOpTypes[j];
+ }
+ for (int i = 0; i < sAllTypes.length; i++) {
+ if (!sAllTypes[i].isAssignableTo(tAllTypes[i])) {
+ return false;
+ }
+ }
}
return s.returnType == VoidTypeImpl.instance || t.returnType.isAssignableTo(s.returnType);
}
@@ -5607,7 +5622,6 @@
* @see #getLeastUpperBound(Type)
*/
static Set<InterfaceType> computeSuperinterfaceSet(InterfaceType type) => computeSuperinterfaceSet2(type, new Set<InterfaceType>());
- List<TypeVariableElement> get typeVariables => element.typeVariables;
/**
* This method computes the longest inheritance path from some passed {@link Type} to Object. This
@@ -5784,6 +5798,9 @@
return typedInterfaces;
}
Type2 getLeastUpperBound(Type2 type) {
+ if (identical(type, this)) {
+ return this;
+ }
Type2 dynamicType = DynamicTypeImpl.instance;
if (identical(this, dynamicType) || identical(type, dynamicType)) {
return dynamicType;
@@ -5846,6 +5863,7 @@
return supertype2.substitute2(_typeArguments, TypeVariableTypeImpl.getTypes(classElement.typeVariables));
}
List<Type2> get typeArguments => _typeArguments;
+ List<TypeVariableElement> get typeVariables => element.typeVariables;
int get hashCode {
ClassElement element2 = element;
if (element2 == null) {
@@ -6118,6 +6136,8 @@
}
}
return true;
+ } else if (typeS.isDartCoreFunction() && elementT.getMethod("call") != null) {
+ return true;
}
InterfaceType supertype2 = elementT.supertype;
if (supertype2 != null && ((supertype2 as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/engine.dart b/pkg/analyzer_experimental/lib/src/generated/engine.dart
index 52df59f..b82126a 100644
--- a/pkg/analyzer_experimental/lib/src/generated/engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/engine.dart
@@ -3411,6 +3411,7 @@
CacheState(this.name, this.ordinal) {
}
int compareTo(CacheState other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/error.dart b/pkg/analyzer_experimental/lib/src/generated/error.dart
index 56db0bd..32cfa70 100644
--- a/pkg/analyzer_experimental/lib/src/generated/error.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/error.dart
@@ -80,6 +80,7 @@
*/
ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal ? this : severity;
int compareTo(ErrorSeverity other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -399,6 +400,7 @@
ErrorProperty(this.name, this.ordinal) {
}
int compareTo(ErrorProperty other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -487,6 +489,7 @@
*/
ErrorSeverity get severity => _severity;
int compareTo(ErrorType other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -621,36 +624,42 @@
static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 15, "'const' variables must be constant value");
/**
+ * 7.5 Instance Variables: It is a compile-time error if an instance variable is declared to be
+ * constant.
+ */
+ static final CompileTimeErrorCode CONST_INSTANCE_FIELD = new CompileTimeErrorCode('CONST_INSTANCE_FIELD', 16, "Only static fields can be declared as 'const'");
+
+ /**
* 12.11.2 Const: An expression of one of the forms !e, e1 && e2 or e1 || e2, where e, e1 and e2
* are constant expressions that evaluate to a boolean value.
*/
- static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = new CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL', 16, "An expression of type 'bool' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = new CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL', 17, "An expression of type 'bool' was expected");
/**
* 12.11.2 Const: An expression of one of the forms e1 == e2 or e1 != e2 where e1 and e2 are
* constant expressions that evaluate to a numeric, string or boolean value or to null.
*/
- static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = new CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL_NUM_STRING', 17, "An expression of type 'bool', 'num', 'String' or 'null' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = new CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL_NUM_STRING', 18, "An expression of type 'bool', 'num', 'String' or 'null' was expected");
/**
* 12.11.2 Const: An expression of one of the forms ~e, e1 ^ e2, e1 & e2, e1 | e2, e1 >> e2 or e1
* << e2, where e, e1 and e2 are constant expressions that evaluate to an integer value or to
* null.
*/
- static final CompileTimeErrorCode CONST_EVAL_TYPE_INT = new CompileTimeErrorCode('CONST_EVAL_TYPE_INT', 18, "An expression of type 'int' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_INT = new CompileTimeErrorCode('CONST_EVAL_TYPE_INT', 19, "An expression of type 'int' was expected");
/**
* 12.11.2 Const: An expression of one of the forms e, e1 + e2, e1 - e2, e1 * e2, e1 / e2, e1 ~/
* e2, e1 > e2, e1 < e2, e1 >= e2, e1 <= e2 or e1 % e2, where e, e1 and e2 are constant
* expressions that evaluate to a numeric value or to null..
*/
- static final CompileTimeErrorCode CONST_EVAL_TYPE_NUM = new CompileTimeErrorCode('CONST_EVAL_TYPE_NUM', 19, "An expression of type 'num' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_NUM = new CompileTimeErrorCode('CONST_EVAL_TYPE_NUM', 20, "An expression of type 'num' was expected");
/**
* 12.11.2 Const: It is a compile-time error if evaluation of a constant object results in an
* uncaught exception being thrown.
*/
- static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', 20, "Evaluation of this constant expression causes exception");
+ static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', 21, "Evaluation of this constant expression causes exception");
/**
* 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, …,
@@ -660,7 +669,7 @@
* @param parameterCount the number of type parameters that were declared
* @param argumentCount the number of type arguments provided
*/
- static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 21, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
+ static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 22, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
/**
* 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, …, a<sub>n</sub>,
@@ -668,13 +677,13 @@
* compile-time error if the type <i>T</i> does not declare a constant constructor with the same
* name as the declaration of <i>T</i>.
*/
- static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode('CONST_WITH_NON_CONST', 22, "The constructor being called is not a 'const' constructor");
+ static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode('CONST_WITH_NON_CONST', 23, "The constructor being called is not a 'const' constructor");
/**
* 12.11.2 Const: In all of the above cases, it is a compile-time error if <i>a<sub>i</sub>, 1
* <= i <= n + k</i>, is not a compile-time constant expression.
*/
- static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', 23, "Arguments of a constant creation must be constant expressions");
+ static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', 24, "Arguments of a constant creation must be constant expressions");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class accessible in the current
@@ -686,12 +695,12 @@
* followed by type arguments.
* @param name the name of the non-type element
*/
- static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 24, "The name '%s' is not a class");
+ static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 25, "The name '%s' is not a class");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type parameters.
*/
- static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', 25, "The constant creation cannot use a type parameter");
+ static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', 26, "The constant creation cannot use a type parameter");
/**
* 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant
@@ -699,78 +708,78 @@
* @param typeName the name of the type
* @param constructorName the name of the requested constant constructor
*/
- static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 26, "The class '%s' does not have a constant constructor '%s'");
+ static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 27, "The class '%s' does not have a constant constructor '%s'");
/**
* 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant
* constructor declared by the type <i>T</i>.
* @param typeName the name of the type
*/
- static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 27, "The class '%s' does not have a default constant constructor");
+ static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 28, "The class '%s' does not have a default constant constructor");
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are specified in the signature
* of a function type alias.
*/
- static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 28, "Default values aren't allowed in typedefs");
+ static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 29, "Default values aren't allowed in typedefs");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity with the same name
* declared in the same scope.
*/
- static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT', 29, "The default constructor is already defined");
+ static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT', 30, "The default constructor is already defined");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity with the same name
* declared in the same scope.
* @param duplicateName the name of the duplicate entity
*/
- static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME', 30, "The constructor with name '%s' is already defined");
+ static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME', 31, "The constructor with name '%s' is already defined");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity with the same name
* declared in the same scope.
* @param duplicateName the name of the duplicate entity
*/
- static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 31, "The name '%s' is already defined");
+ static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 32, "The name '%s' is already defined");
/**
* 7 Classes: It is a compile-time error if a class declares two members of the same name.
*/
- static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME', 32, "");
+ static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME', 33, "");
/**
* 7 Classes: It is a compile-time error if a class has an instance member and a static member
* with the same name.
*/
- static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME_INSTANCE_STATIC = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME_INSTANCE_STATIC', 33, "");
+ static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME_INSTANCE_STATIC = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME_INSTANCE_STATIC', 34, "");
/**
* 12.14.2 Binding Actuals to Formals: It is a compile-time error if <i>q<sub>i</sub> =
* q<sub>j</sub></i> for any <i>i != j</i> \[where <i>q<sub>i</sub></i> is the label for a named
* argument\].
*/
- static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', 34, "The argument for the named parameter '%s' was already specified");
+ static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', 35, "The argument for the named parameter '%s' was already specified");
/**
* SDK implementation libraries can be exported only by other SDK libraries.
* @param uri the uri pointing to a library
*/
- static final CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = new CompileTimeErrorCode('EXPORT_INTERNAL_LIBRARY', 35, "The library %s is internal and cannot be exported");
+ static final CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = new CompileTimeErrorCode('EXPORT_INTERNAL_LIBRARY', 36, "The library %s is internal and cannot be exported");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at the specified URI is
* not a library declaration.
* @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 36, "The exported library '%s' must not have a part-of directive");
+ static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 37, "The exported library '%s' must not have a part-of directive");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a class <i>C</i> includes
* a type expression that does not denote a class available in the lexical scope of <i>C</i>.
* @param typeName the name of the superclass that was not found
*/
- static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 37, "Classes can only extend other classes");
+ static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 38, "Classes can only extend other classes");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or implement Null.
@@ -788,7 +797,7 @@
* @param typeName the name of the type that cannot be extended
* @see #IMPLEMENTS_DISALLOWED_CLASS
*/
- static final CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = new CompileTimeErrorCode('EXTENDS_DISALLOWED_CLASS', 38, "Classes cannot extend '%s'");
+ static final CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = new CompileTimeErrorCode('EXTENDS_DISALLOWED_CLASS', 39, "Classes cannot extend '%s'");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m > n</i>.
@@ -798,7 +807,7 @@
* @param requiredCount the maximum number of positional arguments
* @param argumentCount the actual number of positional arguments given
*/
- static final CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = new CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS', 39, "%d positional arguments expected, but %d found");
+ static final CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = new CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS', 40, "%d positional arguments expected, but %d found");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or implement Null.
@@ -816,35 +825,35 @@
* @param typeName the name of the type that cannot be implemented
* @see #EXTENDS_DISALLOWED_CLASS
*/
- static final CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode('IMPLEMENTS_DISALLOWED_CLASS', 40, "Classes cannot implement '%s'");
+ static final CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode('IMPLEMENTS_DISALLOWED_CLASS', 41, "Classes cannot implement '%s'");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if more than one initializer corresponding to a given instance variable appears in
* <i>k</i>'s list.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 41, "The field '%s' cannot be initialized twice in the same constructor");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 42, "The field '%s' cannot be initialized twice in the same constructor");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if <i>k</i>'s initializer list contains an initializer for a final variable <i>f</i>
* whose declaration includes an initialization expression.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 42, "Values cannot be set in the constructor if they are final, and have already been set");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 43, "Values cannot be set in the constructor if they are final, and have already been set");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if <i>k</i>'s initializer list contains an initializer for a variable that is initialized
* by means of an initializing formal of <i>k</i>.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 43, "Fields cannot be initialized in both the parameter list and the initializers");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 44, "Fields cannot be initialized in both the parameter list and the initializers");
/**
* 5 Variables: It is a compile-time error if a final instance variable that has been initialized
* at its point of declaration is also initialized in a constructor.
* @param name the name of the field in question
*/
- static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 44, "'%s' is final and was given a value when it was declared, so it cannot be set to a new value");
+ static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 45, "'%s' is final and was given a value when it was declared, so it cannot be set to a new value");
/**
* 5 Variables: It is a compile-time error if a final instance variable that has is initialized by
@@ -852,19 +861,19 @@
* constructor.
* @param name the name of the field in question
*/
- static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 45, "'%s' is a final field and so can only be set once");
+ static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 46, "'%s' is a final field and so can only be set once");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an initializing formal is used by
* a function other than a non-redirecting generative constructor.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', 46, "Initializing formal fields cannot be used in factory constructors");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', 47, "Initializing formal fields cannot be used in factory constructors");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an initializing formal is used by
* a function other than a non-redirecting generative constructor.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 47, "Initializing formal fields can only be used in constructors");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 48, "Initializing formal fields can only be used in constructors");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
@@ -873,14 +882,7 @@
* 7.6.1 Generative Constructors: It is a compile-time error if an initializing formal is used by
* a function other than a non-redirecting generative constructor.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', 48, "The redirecting constructor cannot have a field initializer");
-
- /**
- * 5 Variables: It is a compile-time error if a library, static or local variable <i>v</i> is
- * final and <i>v</i> is not initialized at its point of declaration.
- * @param name the name of the variable in question
- */
- static final CompileTimeErrorCode FINAL_NOT_INITIALIZED = new CompileTimeErrorCode('FINAL_NOT_INITIALIZED', 49, "The final variable '%s' must be initialized");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', 49, "The redirecting constructor cannot have a field initializer");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
@@ -1511,7 +1513,7 @@
* <i>n</i> type parameters.
*/
static final CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new CompileTimeErrorCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 130, "");
- static final List<CompileTimeErrorCode> values = [AMBIGUOUS_EXPORT, AMBIGUOUS_IMPORT, ARGUMENT_DEFINITION_TEST_NON_PARAMETER, BUILT_IN_IDENTIFIER_AS_TYPE, BUILT_IN_IDENTIFIER_AS_TYPE_NAME, BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME, CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, CONST_CONSTRUCTOR_THROWS_EXCEPTION, CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE, CONST_FORMAL_PARAMETER, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, CONST_EVAL_TYPE_BOOL, CONST_EVAL_TYPE_BOOL_NUM_STRING, CONST_EVAL_TYPE_INT, CONST_EVAL_TYPE_NUM, CONST_EVAL_THROWS_EXCEPTION, CONST_WITH_INVALID_TYPE_PARAMETERS, CONST_WITH_NON_CONST, CONST_WITH_NON_CONSTANT_ARGUMENT, CONST_WITH_NON_TYPE, CONST_WITH_TYPE_PARAMETERS, CONST_WITH_UNDEFINED_CONSTRUCTOR, CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, DUPLICATE_CONSTRUCTOR_DEFAULT, DUPLICATE_CONSTRUCTOR_NAME, DUPLICATE_DEFINITION, DUPLICATE_MEMBER_NAME, DUPLICATE_MEMBER_NAME_INSTANCE_STATIC, DUPLICATE_NAMED_ARGUMENT, EXPORT_INTERNAL_LIBRARY, EXPORT_OF_NON_LIBRARY, EXTENDS_NON_CLASS, EXTENDS_DISALLOWED_CLASS, EXTRA_POSITIONAL_ARGUMENTS, IMPLEMENTS_DISALLOWED_CLASS, FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, FINAL_INITIALIZED_MULTIPLE_TIMES, FIELD_INITIALIZER_FACTORY_CONSTRUCTOR, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, FINAL_NOT_INITIALIZED, GETTER_AND_METHOD_WITH_SAME_NAME, IMPLEMENTS_DYNAMIC, IMPLEMENTS_NON_CLASS, IMPLEMENTS_REPEATED, IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, IMPORT_INTERNAL_LIBRARY, IMPORT_OF_NON_LIBRARY, INCONSISTENT_CASE_EXPRESSION_TYPES, INITIALIZER_FOR_NON_EXISTANT_FIELD, INITIALIZER_FOR_STATIC_FIELD, INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, INITIALIZING_FORMAL_FOR_STATIC_FIELD, INVALID_CONSTANT, INVALID_CONSTRUCTOR_NAME, INVALID_FACTORY_NAME_NOT_A_CLASS, INVALID_OVERRIDE_DEFAULT_VALUE, INVALID_OVERRIDE_NAMED, INVALID_OVERRIDE_POSITIONAL, INVALID_OVERRIDE_REQUIRED, INVALID_REFERENCE_TO_THIS, INVALID_TYPE_ARGUMENT_FOR_KEY, INVALID_TYPE_ARGUMENT_IN_CONST_LIST, INVALID_TYPE_ARGUMENT_IN_CONST_MAP, INVALID_URI, LABEL_IN_OUTER_SCOPE, LABEL_UNDEFINED, MEMBER_WITH_CLASS_NAME, METHOD_AND_GETTER_WITH_SAME_NAME, MISSING_CONST_IN_LIST_LITERAL, MISSING_CONST_IN_MAP_LITERAL, MIXIN_DECLARES_CONSTRUCTOR, MIXIN_INHERITS_FROM_NOT_OBJECT, MIXIN_OF_NON_CLASS, MIXIN_REFERENCES_SUPER, MIXIN_WITH_NON_CLASS_SUPERCLASS, MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS, MULTIPLE_SUPER_INITIALIZERS, NEW_WITH_INVALID_TYPE_PARAMETERS, NON_CONST_MAP_AS_EXPRESSION_STATEMENT, NON_CONSTANT_CASE_EXPRESSION, NON_CONSTANT_DEFAULT_VALUE, NON_CONSTANT_LIST_ELEMENT, NON_CONSTANT_MAP_KEY, NON_CONSTANT_MAP_VALUE, NON_CONSTANT_VALUE_IN_INITIALIZER, NOT_ENOUGH_REQUIRED_ARGUMENTS, NON_GENERATIVE_CONSTRUCTOR, OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, OPTIONAL_PARAMETER_IN_OPERATOR, PART_OF_NON_PART, PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, PRIVATE_OPTIONAL_PARAMETER, RECURSIVE_COMPILE_TIME_CONSTANT, RECURSIVE_CONSTRUCTOR_REDIRECT, RECURSIVE_FACTORY_REDIRECT, RECURSIVE_FUNCTION_TYPE_ALIAS, RECURSIVE_INTERFACE_INHERITANCE, RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS, RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS, REDIRECT_TO_NON_CONST_CONSTRUCTOR, REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER, RESERVED_WORD_AS_IDENTIFIER, RETHROW_OUTSIDE_CATCH, RETURN_IN_GENERATIVE_CONSTRUCTOR, STATIC_TOP_LEVEL_FUNCTION, STATIC_TOP_LEVEL_VARIABLE, SUPER_IN_INVALID_CONTEXT, SUPER_IN_REDIRECTING_CONSTRUCTOR, SUPER_INITIALIZER_IN_OBJECT, TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS, UNDEFINED_CLASS, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, UNINITIALIZED_FINAL_FIELD, UNDEFINED_NAMED_PARAMETER, URI_DOES_NOT_EXIST, URI_WITH_INTERPOLATION, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS, WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
+ static final List<CompileTimeErrorCode> values = [AMBIGUOUS_EXPORT, AMBIGUOUS_IMPORT, ARGUMENT_DEFINITION_TEST_NON_PARAMETER, BUILT_IN_IDENTIFIER_AS_TYPE, BUILT_IN_IDENTIFIER_AS_TYPE_NAME, BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME, CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, CONST_CONSTRUCTOR_THROWS_EXCEPTION, CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE, CONST_FORMAL_PARAMETER, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, CONST_INSTANCE_FIELD, CONST_EVAL_TYPE_BOOL, CONST_EVAL_TYPE_BOOL_NUM_STRING, CONST_EVAL_TYPE_INT, CONST_EVAL_TYPE_NUM, CONST_EVAL_THROWS_EXCEPTION, CONST_WITH_INVALID_TYPE_PARAMETERS, CONST_WITH_NON_CONST, CONST_WITH_NON_CONSTANT_ARGUMENT, CONST_WITH_NON_TYPE, CONST_WITH_TYPE_PARAMETERS, CONST_WITH_UNDEFINED_CONSTRUCTOR, CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, DUPLICATE_CONSTRUCTOR_DEFAULT, DUPLICATE_CONSTRUCTOR_NAME, DUPLICATE_DEFINITION, DUPLICATE_MEMBER_NAME, DUPLICATE_MEMBER_NAME_INSTANCE_STATIC, DUPLICATE_NAMED_ARGUMENT, EXPORT_INTERNAL_LIBRARY, EXPORT_OF_NON_LIBRARY, EXTENDS_NON_CLASS, EXTENDS_DISALLOWED_CLASS, EXTRA_POSITIONAL_ARGUMENTS, IMPLEMENTS_DISALLOWED_CLASS, FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, FINAL_INITIALIZED_MULTIPLE_TIMES, FIELD_INITIALIZER_FACTORY_CONSTRUCTOR, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR, GETTER_AND_METHOD_WITH_SAME_NAME, IMPLEMENTS_DYNAMIC, IMPLEMENTS_NON_CLASS, IMPLEMENTS_REPEATED, IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, IMPORT_INTERNAL_LIBRARY, IMPORT_OF_NON_LIBRARY, INCONSISTENT_CASE_EXPRESSION_TYPES, INITIALIZER_FOR_NON_EXISTANT_FIELD, INITIALIZER_FOR_STATIC_FIELD, INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, INITIALIZING_FORMAL_FOR_STATIC_FIELD, INVALID_CONSTANT, INVALID_CONSTRUCTOR_NAME, INVALID_FACTORY_NAME_NOT_A_CLASS, INVALID_OVERRIDE_DEFAULT_VALUE, INVALID_OVERRIDE_NAMED, INVALID_OVERRIDE_POSITIONAL, INVALID_OVERRIDE_REQUIRED, INVALID_REFERENCE_TO_THIS, INVALID_TYPE_ARGUMENT_FOR_KEY, INVALID_TYPE_ARGUMENT_IN_CONST_LIST, INVALID_TYPE_ARGUMENT_IN_CONST_MAP, INVALID_URI, LABEL_IN_OUTER_SCOPE, LABEL_UNDEFINED, MEMBER_WITH_CLASS_NAME, METHOD_AND_GETTER_WITH_SAME_NAME, MISSING_CONST_IN_LIST_LITERAL, MISSING_CONST_IN_MAP_LITERAL, MIXIN_DECLARES_CONSTRUCTOR, MIXIN_INHERITS_FROM_NOT_OBJECT, MIXIN_OF_NON_CLASS, MIXIN_REFERENCES_SUPER, MIXIN_WITH_NON_CLASS_SUPERCLASS, MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS, MULTIPLE_SUPER_INITIALIZERS, NEW_WITH_INVALID_TYPE_PARAMETERS, NON_CONST_MAP_AS_EXPRESSION_STATEMENT, NON_CONSTANT_CASE_EXPRESSION, NON_CONSTANT_DEFAULT_VALUE, NON_CONSTANT_LIST_ELEMENT, NON_CONSTANT_MAP_KEY, NON_CONSTANT_MAP_VALUE, NON_CONSTANT_VALUE_IN_INITIALIZER, NOT_ENOUGH_REQUIRED_ARGUMENTS, NON_GENERATIVE_CONSTRUCTOR, OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, OPTIONAL_PARAMETER_IN_OPERATOR, PART_OF_NON_PART, PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, PRIVATE_OPTIONAL_PARAMETER, RECURSIVE_COMPILE_TIME_CONSTANT, RECURSIVE_CONSTRUCTOR_REDIRECT, RECURSIVE_FACTORY_REDIRECT, RECURSIVE_FUNCTION_TYPE_ALIAS, RECURSIVE_INTERFACE_INHERITANCE, RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS, RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS, REDIRECT_TO_NON_CONST_CONSTRUCTOR, REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER, RESERVED_WORD_AS_IDENTIFIER, RETHROW_OUTSIDE_CATCH, RETURN_IN_GENERATIVE_CONSTRUCTOR, STATIC_TOP_LEVEL_FUNCTION, STATIC_TOP_LEVEL_VARIABLE, SUPER_IN_INVALID_CONTEXT, SUPER_IN_REDIRECTING_CONSTRUCTOR, SUPER_INITIALIZER_IN_OBJECT, TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS, UNDEFINED_CLASS, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, UNINITIALIZED_FINAL_FIELD, UNDEFINED_NAMED_PARAMETER, URI_DOES_NOT_EXIST, URI_WITH_INTERPOLATION, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS, WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
/// The name of this enum constant, as declared in the enum declaration.
final String name;
@@ -1535,6 +1537,7 @@
String get message => _message;
ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
int compareTo(CompileTimeErrorCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -1591,6 +1594,7 @@
String get message => _message;
ErrorType get type => ErrorType.PUB_SUGGESTION;
int compareTo(PubSuggestionCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -1657,7 +1661,7 @@
* 12.32 Type Cast: It is a static warning if <i>T</i> does not denote a type available in the
* current lexical scope.
*/
- static final StaticWarningCode CAST_TO_NON_TYPE = new StaticWarningCode('CAST_TO_NON_TYPE', 4, "");
+ static final StaticWarningCode CAST_TO_NON_TYPE = new StaticWarningCode('CAST_TO_NON_TYPE', 4, "The name '%s' is not a type and cannot be used in an 'as' expression");
/**
* 16.1.2 Comments: A token of the form <i>\[new c\](uri)</i> will be replaced by a link in the
@@ -1782,12 +1786,19 @@
static final StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = new StaticWarningCode('FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', 20, "The parameter type '%s' is incompatable with the field type '%s'");
/**
+ * 5 Variables: It is a static warning if a library, static or local variable <i>v</i> is final
+ * and <i>v</i> is not initialized at its point of declaration.
+ * @param name the name of the uninitialized final variable
+ */
+ static final StaticWarningCode FINAL_NOT_INITIALIZED = new StaticWarningCode('FINAL_NOT_INITIALIZED', 21, "The final variable '%s' must be initialized");
+
+ /**
* 14.1 Imports: It is a static warning to import two different libraries with the same name.
* @param uri1 the uri pointing to a first library
* @param uri2 the uri pointing to a second library
* @param name the shared name of the imported libraries
*/
- static final StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAME = new StaticWarningCode('IMPORT_DUPLICATED_LIBRARY_NAME', 21, "The imported libraries '%s' and '%s' should not have the same name '%s'");
+ static final StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAME = new StaticWarningCode('IMPORT_DUPLICATED_LIBRARY_NAME', 22, "The imported libraries '%s' and '%s' should not have the same name '%s'");
/**
* 8.1.1 Inheritance and Overriding: However, if there are multiple members <i>m<sub>1</sub>,
@@ -1799,13 +1810,13 @@
* not all of the <i>m<sub>i</sub></i> are setters, none of the <i>m<sub>i</sub></i> are
* inherited, and a static warning is issued.
*/
- static final StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD = new StaticWarningCode('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', 22, "'%s' is inherited as a getter and also a method");
+ static final StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD = new StaticWarningCode('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', 23, "'%s' is inherited as a getter and also a method");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m >
* n</i>.
*/
- static final StaticWarningCode INCORRECT_NUMBER_OF_ARGUMENTS = new StaticWarningCode('INCORRECT_NUMBER_OF_ARGUMENTS', 23, "");
+ static final StaticWarningCode INCORRECT_NUMBER_OF_ARGUMENTS = new StaticWarningCode('INCORRECT_NUMBER_OF_ARGUMENTS', 24, "");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares an instance method
@@ -1814,12 +1825,12 @@
* @param memberName the name of the member with the name conflict
* @param superclassName the name of the enclosing class that has the static member
*/
- static final StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC = new StaticWarningCode('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', 24, "'%s' collides with a static member in the superclass '%s'");
+ static final StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC = new StaticWarningCode('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', 25, "'%s' collides with a static member in the superclass '%s'");
/**
* 7.6.2 Factories: It is a static warning if <i>M.id</i> is not a constructor name.
*/
- static final StaticWarningCode INVALID_FACTORY_NAME = new StaticWarningCode('INVALID_FACTORY_NAME', 25, "");
+ static final StaticWarningCode INVALID_FACTORY_NAME = new StaticWarningCode('INVALID_FACTORY_NAME', 26, "");
/**
* 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a getter <i>m2</i> and the
@@ -1830,7 +1841,7 @@
* @param className the name of the class where the overridden getter is declared
* @see #INVALID_METHOD_OVERRIDE_RETURN_TYPE
*/
- static final StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 26, "The return type '%s' is not assignable to '%s' as required from getter it is overriding from '%s'");
+ static final StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 27, "The return type '%s' is not assignable to '%s' as required from getter it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -1840,7 +1851,7 @@
* actualParamTypeName
* @param className the name of the class where the overridden method is declared
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 27, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 28, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -1851,7 +1862,7 @@
* @param className the name of the class where the overridden method is declared
* @see #INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 28, "The parameter type '%s' is not assignable to '%s' as required by the method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 29, "The parameter type '%s' is not assignable to '%s' as required by the method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -1861,7 +1872,7 @@
* actualParamTypeName
* @param className the name of the class where the overridden method is declared
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 29, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 30, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -1872,7 +1883,7 @@
* @param className the name of the class where the overridden method is declared
* @see #INVALID_GETTER_OVERRIDE_RETURN_TYPE
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 30, "The return type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 31, "The return type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -1880,7 +1891,7 @@
* a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a different default value
* for <i>p</i>.
*/
- static final StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES = new StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES', 31, "");
+ static final StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES = new StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES', 32, "");
/**
* 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a setter <i>m2</i> and the
@@ -1891,7 +1902,7 @@
* @param className the name of the class where the overridden setter is declared
* @see #INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE
*/
- static final StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = new StaticWarningCode('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', 32, "The parameter type '%s' is not assignable to '%s' as required by the setter it is overriding from '%s'");
+ static final StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = new StaticWarningCode('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', 33, "The parameter type '%s' is not assignable to '%s' as required by the setter it is overriding from '%s'");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -1899,7 +1910,7 @@
* x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. If <i>S.m</i> exists, it is a static warning if the type
* <i>F</i> of <i>S.m</i> may not be assigned to a function type.
*/
- static final StaticWarningCode INVOCATION_OF_NON_FUNCTION = new StaticWarningCode('INVOCATION_OF_NON_FUNCTION', 33, "");
+ static final StaticWarningCode INVOCATION_OF_NON_FUNCTION = new StaticWarningCode('INVOCATION_OF_NON_FUNCTION', 34, "");
/**
* 15.1 Static Types: A type <i>T</i> is malformed iff: <li><i>T</i> has the form <i>id</i> or the
@@ -1911,27 +1922,27 @@
* <p>
* Any use of a malformed type gives rise to a static warning.
*/
- static final StaticWarningCode MALFORMED_TYPE = new StaticWarningCode('MALFORMED_TYPE', 34, "");
+ static final StaticWarningCode MALFORMED_TYPE = new StaticWarningCode('MALFORMED_TYPE', 35, "");
/**
* 7.3 Setters: It is a static warning if a class has a setter named <i>v=</i> with argument type
* <i>T</i> and a getter named <i>v</i> with return type <i>S</i>, and <i>T</i> may not be
* assigned to <i>S</i>.
*/
- static final StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = new StaticWarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES', 35, "The parameter type for setter '%s' is %s which is not assignable to its getter (of type %s)");
+ static final StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = new StaticWarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES', 36, "The parameter type for setter '%s' is %s which is not assignable to its getter (of type %s)");
/**
* 12.11.1 New: It is a static warning if <i>q</i> is a constructor of an abstract class and
* <i>q</i> is not a factory constructor.
*/
- static final StaticWarningCode NEW_WITH_ABSTRACT_CLASS = new StaticWarningCode('NEW_WITH_ABSTRACT_CLASS', 36, "Abstract classes cannot be created with a 'new' expression");
+ static final StaticWarningCode NEW_WITH_ABSTRACT_CLASS = new StaticWarningCode('NEW_WITH_ABSTRACT_CLASS', 37, "Abstract classes cannot be created with a 'new' expression");
/**
* 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible in the current scope,
* optionally followed by type arguments.
* @param name the name of the non-type element
*/
- static final StaticWarningCode NEW_WITH_NON_TYPE = new StaticWarningCode('NEW_WITH_NON_TYPE', 37, "The name '%s' is not a class");
+ static final StaticWarningCode NEW_WITH_NON_TYPE = new StaticWarningCode('NEW_WITH_NON_TYPE', 38, "The name '%s' is not a class");
/**
* 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the current scope then:
@@ -1942,7 +1953,7 @@
* a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a static warning if the
* type <i>T</i> does not declare a constructor with the same name as the declaration of <i>T</i>.
*/
- static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = new StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR', 38, "The class '%s' does not have a constructor '%s'");
+ static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = new StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR', 39, "The class '%s' does not have a constructor '%s'");
/**
* 12.11.1 New: If <i>T</i> is a class or parameterized type accessible in the current scope then:
@@ -1953,7 +1964,7 @@
* a<sub>n+1</sub>, … x<sub>n+k</sub>: a<sub>n+kM/sub>)</i> it is a static warning if the
* type <i>T</i> does not declare a constructor with the same name as the declaration of <i>T</i>.
*/
- static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 39, "The class '%s' does not have a default constructor");
+ static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 40, "The class '%s' does not have a default constructor");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -1962,17 +1973,25 @@
* 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
* <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
* corresponding instance member <i>m</i>.
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the first
+ * member
* @param enclosingClass enclosing class of the first missing member
* @param name first member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the second
+ * member
* @param enclosingClass enclosing class of the second missing member
* @param name second member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the third
+ * member
* @param enclosingClass enclosing class of the third missing member
* @param name third member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the fourth
+ * member
* @param enclosingClass enclosing class of the fourth missing member
* @param name fourth member name
* @param additionalCount the number of additional missing members that aren't listed
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', 40, "Missing inherited members '%s.%s', '%s.%s', '%s.%s', '%s.%s' and %d more");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', 41, "Missing inherited members: %s'%s.%s', %s'%s.%s', %s'%s.%s', %s'%s.%s' and %d more");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -1981,16 +2000,24 @@
* 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
* <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
* corresponding instance member <i>m</i>.
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the first
+ * member
* @param enclosingClass enclosing class of the first missing member
* @param name first member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the second
+ * member
* @param enclosingClass enclosing class of the second missing member
* @param name second member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the third
+ * member
* @param enclosingClass enclosing class of the third missing member
* @param name third member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the fourth
+ * member
* @param enclosingClass enclosing class of the fourth missing member
* @param name fourth member name
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', 41, "Missing inherited members '%s.%s', '%s.%s', '%s.%s' and '%s.%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', 42, "Missing inherited members: %s'%s.%s', %s'%s.%s', %s'%s.%s' and %s'%s.%s'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -1999,10 +2026,11 @@
* 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
* <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
* corresponding instance member <i>m</i>.
+ * @param getterSetterOrMethod a string containing either "get ", "set " or ""
* @param enclosingClass enclosing class of the missing member
* @param name member name
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', 42, "Missing inherited member '%s.%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', 43, "Missing inherited member %s'%s.%s'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -2011,14 +2039,20 @@
* 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
* <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
* corresponding instance member <i>m</i>.
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the first
+ * member
* @param enclosingClass enclosing class of the first missing member
* @param name first member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the second
+ * member
* @param enclosingClass enclosing class of the second missing member
* @param name second member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the third
+ * member
* @param enclosingClass enclosing class of the third missing member
* @param name third member name
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', 43, "Missing inherited members '%s.%s', '%s.%s' and '%s.%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', 44, "Missing inherited members: %s'%s.%s', %s'%s.%s' and %s'%s.%s'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -2027,18 +2061,16 @@
* 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
* <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
* corresponding instance member <i>m</i>.
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the first
+ * member
* @param enclosingClass enclosing class of the first missing member
* @param name first member name
+ * @param getterSetterOrMethod a string containing either "get ", "set " or "" for the second
+ * member
* @param enclosingClass enclosing class of the second missing member
* @param name second member name
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', 44, "Missing inherited members '%s.%s' and '%s.%s'");
-
- /**
- * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type available in the
- * current lexical scope.
- */
- static final StaticWarningCode NON_TYPE = new StaticWarningCode('NON_TYPE', 45, "");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', 45, "Missing inherited members: %s'%s.%s' and %s'%s.%s'");
/**
* 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, p<sub>2</sub>) s</i> or
@@ -2096,14 +2128,14 @@
* current scope; if type does denote such a class <i>C</i> it is a static warning if the
* referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a constructor of <i>C</i>.
*/
- static final StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = new StaticWarningCode('REDIRECT_TO_MISSING_CONSTRUCTOR', 53, "");
+ static final StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = new StaticWarningCode('REDIRECT_TO_MISSING_CONSTRUCTOR', 53, "The constructor '%s' could not be found in '%s'");
/**
* 7.6.2 Factories: It is a static warning if type does not denote a class accessible in the
* current scope; if type does denote such a class <i>C</i> it is a static warning if the
* referenced constructor (be it <i>type</i> or <i>type.id</i>) is not a constructor of <i>C</i>.
*/
- static final StaticWarningCode REDIRECT_TO_NON_CLASS = new StaticWarningCode('REDIRECT_TO_NON_CLASS', 54, "");
+ static final StaticWarningCode REDIRECT_TO_NON_CLASS = new StaticWarningCode('REDIRECT_TO_NON_CLASS', 54, "The name '%s' is not a type and cannot be used in a redirected constructor");
/**
* 13.11 Return: Let <i>f</i> be the function immediately enclosing a return statement of the form
@@ -2129,17 +2161,23 @@
static final StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = new StaticWarningCode('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 57, "Type '%s' of the switch expression is not assignable to the type '%s' of case expressions");
/**
+ * 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type available in the
+ * current lexical scope.
+ */
+ static final StaticWarningCode TYPE_TEST_NON_TYPE = new StaticWarningCode('TYPE_TEST_NON_TYPE', 58, "The name '%s' is not a type and cannot be used in an 'is' expression");
+
+ /**
* 12.15.3 Static Invocation: A static method invocation <i>i</i> has the form
* <i>C.m(a<sub>1</sub>, …, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, …
* x<sub>n+k</sub>: a<sub>n+k</sub>)</i>. It is a static warning if <i>C</i> does not denote a
* class in the current scope.
*/
- static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 58, "Undefined class '%s'");
+ static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 59, "Undefined class '%s'");
/**
* Same as {@link #UNDEFINED_CLASS}, but to catch using "boolean" instead of "bool".
*/
- static final StaticWarningCode UNDEFINED_CLASS_BOOLEAN = new StaticWarningCode('UNDEFINED_CLASS_BOOLEAN', 59, "Undefined class 'boolean'; did you mean 'bool'?");
+ static final StaticWarningCode UNDEFINED_CLASS_BOOLEAN = new StaticWarningCode('UNDEFINED_CLASS_BOOLEAN', 60, "Undefined class 'boolean'; did you mean 'bool'?");
/**
* 12.17 Getter Invocation: It is a static warning if there is no class <i>C</i> in the enclosing
@@ -2148,7 +2186,7 @@
* @param getterName the name of the getter
* @param enclosingType the name of the enclosing type where the getter is being looked for
*/
- static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEFINED_GETTER', 60, "There is no such getter '%s' in '%s'");
+ static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEFINED_GETTER', 61, "There is no such getter '%s' in '%s'");
/**
* 12.30 Identifier Reference: It is as static warning if an identifier expression of the form
@@ -2156,7 +2194,7 @@
* setter) or variable initializer and there is no declaration <i>d</i> with name <i>id</i> in the
* lexical scope enclosing the expression.
*/
- static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('UNDEFINED_IDENTIFIER', 61, "Undefined name '%s'");
+ static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('UNDEFINED_IDENTIFIER', 62, "Undefined name '%s'");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
@@ -2164,7 +2202,7 @@
* <i>p<sub>n+k</sub></i>} or a static warning occurs.
* @param name the name of the requested named parameter
*/
- static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode('UNDEFINED_NAMED_PARAMETER', 62, "The named parameter '%s' is not defined");
+ static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode('UNDEFINED_NAMED_PARAMETER', 63, "The named parameter '%s' is not defined");
/**
* 12.18 Assignment: It is as static warning if an assignment of the form <i>v = e</i> occurs
@@ -2178,7 +2216,7 @@
* @param setterName the name of the getter
* @param enclosingType the name of the enclosing type where the setter is being looked for
*/
- static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEFINED_SETTER', 63, "There is no such setter '%s' in '%s'");
+ static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEFINED_SETTER', 64, "There is no such setter '%s' in '%s'");
/**
* 12.15.3 Static Invocation: It is a static warning if <i>C</i> does not declare a static method
@@ -2186,8 +2224,8 @@
* @param methodName the name of the method
* @param enclosingType the name of the enclosing type where the method is being looked for
*/
- static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', 64, "There is no such static method '%s' in '%s'");
- static final List<StaticWarningCode> values = [AMBIGUOUS_IMPORT, ARGUMENT_TYPE_NOT_ASSIGNABLE, ASSIGNMENT_TO_FINAL, CASE_BLOCK_NOT_TERMINATED, CAST_TO_NON_TYPE, COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE, COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE, COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR, COMMENT_REFERENCE_UNDECLARED_IDENTIFIER, COMMENT_REFERENCE_URI_NOT_LIBRARY, CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER, CONST_WITH_ABSTRACT_CLASS, EQUAL_KEYS_IN_MAP, EXPORT_DUPLICATED_LIBRARY_NAME, EXTRA_POSITIONAL_ARGUMENTS, FIELD_INITIALIZER_NOT_ASSIGNABLE, FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, IMPORT_DUPLICATED_LIBRARY_NAME, INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, INCORRECT_NUMBER_OF_ARGUMENTS, INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, INVALID_FACTORY_NAME, INVALID_GETTER_OVERRIDE_RETURN_TYPE, INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE, INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE, INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE, INVALID_METHOD_OVERRIDE_RETURN_TYPE, INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES, INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE, INVOCATION_OF_NON_FUNCTION, MALFORMED_TYPE, MISMATCHED_GETTER_AND_SETTER_TYPES, NEW_WITH_ABSTRACT_CLASS, NEW_WITH_NON_TYPE, NEW_WITH_UNDEFINED_CONSTRUCTOR, NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, NON_TYPE, NON_TYPE_IN_CATCH_CLAUSE, NON_VOID_RETURN_FOR_OPERATOR, NON_VOID_RETURN_FOR_SETTER, NOT_ENOUGH_REQUIRED_ARGUMENTS, PART_OF_DIFFERENT_LIBRARY, REDIRECT_TO_INVALID_FUNCTION_TYPE, REDIRECT_TO_INVALID_RETURN_TYPE, REDIRECT_TO_MISSING_CONSTRUCTOR, REDIRECT_TO_NON_CLASS, RETURN_WITHOUT_VALUE, STATIC_ACCESS_TO_INSTANCE_MEMBER, SWITCH_EXPRESSION_NOT_ASSIGNABLE, UNDEFINED_CLASS, UNDEFINED_CLASS_BOOLEAN, UNDEFINED_GETTER, UNDEFINED_IDENTIFIER, UNDEFINED_NAMED_PARAMETER, UNDEFINED_SETTER, UNDEFINED_STATIC_METHOD_OR_GETTER];
+ static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticWarningCode('UNDEFINED_STATIC_METHOD_OR_GETTER', 65, "There is no such static method '%s' in '%s'");
+ static final List<StaticWarningCode> values = [AMBIGUOUS_IMPORT, ARGUMENT_TYPE_NOT_ASSIGNABLE, ASSIGNMENT_TO_FINAL, CASE_BLOCK_NOT_TERMINATED, CAST_TO_NON_TYPE, COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE, COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE, COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR, COMMENT_REFERENCE_UNDECLARED_IDENTIFIER, COMMENT_REFERENCE_URI_NOT_LIBRARY, CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER, CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER, CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER, CONST_WITH_ABSTRACT_CLASS, EQUAL_KEYS_IN_MAP, EXPORT_DUPLICATED_LIBRARY_NAME, EXTRA_POSITIONAL_ARGUMENTS, FIELD_INITIALIZER_NOT_ASSIGNABLE, FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, FINAL_NOT_INITIALIZED, IMPORT_DUPLICATED_LIBRARY_NAME, INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD, INCORRECT_NUMBER_OF_ARGUMENTS, INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC, INVALID_FACTORY_NAME, INVALID_GETTER_OVERRIDE_RETURN_TYPE, INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE, INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE, INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE, INVALID_METHOD_OVERRIDE_RETURN_TYPE, INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES, INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE, INVOCATION_OF_NON_FUNCTION, MALFORMED_TYPE, MISMATCHED_GETTER_AND_SETTER_TYPES, NEW_WITH_ABSTRACT_CLASS, NEW_WITH_NON_TYPE, NEW_WITH_UNDEFINED_CONSTRUCTOR, NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, NON_TYPE_IN_CATCH_CLAUSE, NON_VOID_RETURN_FOR_OPERATOR, NON_VOID_RETURN_FOR_SETTER, NOT_ENOUGH_REQUIRED_ARGUMENTS, PART_OF_DIFFERENT_LIBRARY, REDIRECT_TO_INVALID_FUNCTION_TYPE, REDIRECT_TO_INVALID_RETURN_TYPE, REDIRECT_TO_MISSING_CONSTRUCTOR, REDIRECT_TO_NON_CLASS, RETURN_WITHOUT_VALUE, STATIC_ACCESS_TO_INSTANCE_MEMBER, SWITCH_EXPRESSION_NOT_ASSIGNABLE, TYPE_TEST_NON_TYPE, UNDEFINED_CLASS, UNDEFINED_CLASS_BOOLEAN, UNDEFINED_GETTER, UNDEFINED_IDENTIFIER, UNDEFINED_NAMED_PARAMETER, UNDEFINED_SETTER, UNDEFINED_STATIC_METHOD_OR_GETTER];
/// The name of this enum constant, as declared in the enum declaration.
final String name;
@@ -2211,6 +2249,7 @@
String get message => _message;
ErrorType get type => ErrorType.STATIC_WARNING;
int compareTo(StaticWarningCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -2280,6 +2319,7 @@
String get message => _message;
ErrorType get type => ErrorType.STATIC_WARNING;
int compareTo(HtmlWarningCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -2514,5 +2554,6 @@
String get message => _message;
ErrorType get type => ErrorType.STATIC_TYPE_WARNING;
int compareTo(StaticTypeWarningCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/html.dart b/pkg/analyzer_experimental/lib/src/generated/html.dart
index 206f552..741c07f 100644
--- a/pkg/analyzer_experimental/lib/src/generated/html.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/html.dart
@@ -300,10 +300,54 @@
}
/**
+ * This method exists for debugging purposes only.
+ */
+ void appendIdentifier(JavaStringBuilder builder, XmlNode node) {
+ if (node is XmlTagNode) {
+ builder.append(((node as XmlTagNode)).tag.lexeme);
+ } else if (node is XmlAttributeNode) {
+ builder.append(((node as XmlAttributeNode)).name.lexeme);
+ } else {
+ builder.append("htmlUnit");
+ }
+ }
+
+ /**
+ * This method exists for debugging purposes only.
+ */
+ String buildRecursiveStructureMessage(XmlNode newParent) {
+ JavaStringBuilder builder = new JavaStringBuilder();
+ builder.append("Attempt to create recursive structure: ");
+ XmlNode current = newParent;
+ while (current != null) {
+ if (current != newParent) {
+ builder.append(" -> ");
+ }
+ if (identical(current, this)) {
+ builder.appendChar(0x2A);
+ appendIdentifier(builder, current);
+ builder.appendChar(0x2A);
+ } else {
+ appendIdentifier(builder, current);
+ }
+ current = current.parent;
+ }
+ return builder.toString();
+ }
+
+ /**
* Set the parent of this node to the given node.
* @param newParent the node that is to be made the parent of this node
*/
void set parent(XmlNode newParent) {
+ XmlNode current = newParent;
+ while (current != null) {
+ if (identical(current, this)) {
+ AnalysisEngine.instance.logger.logError3(new IllegalArgumentException(buildRecursiveStructureMessage(newParent)));
+ return;
+ }
+ current = current.parent;
+ }
_parent = newParent;
}
}
@@ -853,6 +897,7 @@
*/
String get lexeme => _lexeme;
int compareTo(TokenType other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
class TokenType_EOF extends TokenType {
diff --git a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
index 034f718..6821936 100644
--- a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
@@ -257,6 +257,7 @@
InstrumentationLevel(this.name, this.ordinal) {
}
int compareTo(InstrumentationLevel other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_core.dart b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
index 18888f7..e8b1047 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_core.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
@@ -456,8 +456,8 @@
}
}
-Set<MapEntry> getMapEntrySet(Map m) {
- Set<MapEntry> result = new Set();
+Iterable<MapEntry> getMapEntrySet(Map m) {
+ List<MapEntry> result = [];
m.forEach((k, v) {
result.add(new MapEntry(m, k, v));
});
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_engine.dart b/pkg/analyzer_experimental/lib/src/generated/java_engine.dart
index e507ea3..265e323 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_engine.dart
@@ -1,7 +1,8 @@
library java.engine;
class StringUtilities {
- static List<String> EMPTY_ARRAY = new List(0);
+ static const String EMPTY = '';
+ static const List<String> EMPTY_ARRAY = const <String> [];
static String intern(String s) => s;
static String substringBefore(String str, String separator) {
if (str == null || str.isEmpty) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_io.dart b/pkg/analyzer_experimental/lib/src/generated/java_io.dart
index 7799d49..b1cced8 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_io.dart
@@ -63,7 +63,11 @@
this._path = new Path(path);
}
JavaFile.relative(JavaFile base, String child) {
- this._path = base._path.join(new Path(child));
+ if (child.isEmpty) {
+ this._path = base._path;
+ } else {
+ this._path = base._path.join(new Path(child));
+ }
}
JavaFile.fromUri(Uri uri) : this(uri.path);
int get hashCode => _path.hashCode;
diff --git a/pkg/analyzer_experimental/lib/src/generated/parser.dart b/pkg/analyzer_experimental/lib/src/generated/parser.dart
index 0a82fed..c24b42e 100644
--- a/pkg/analyzer_experimental/lib/src/generated/parser.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/parser.dart
@@ -5370,6 +5370,7 @@
String get message => _message;
ErrorType get type => ErrorType.SYNTACTIC_ERROR;
int compareTo(ParserErrorCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/resolver.dart b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
index 4ff1d00..e0a4a74 100644
--- a/pkg/analyzer_experimental/lib/src/generated/resolver.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
@@ -3523,18 +3523,42 @@
} else {
resultMap = new Map<String, ExecutableElement>();
}
+ InterfaceType supertype2 = classElt.supertype;
+ ClassElement superclassElement = supertype2 != null ? supertype2.element : null;
List<InterfaceType> interfaces2 = classElt.interfaces;
- if (interfaces2.length == 0) {
+ if (superclassElement == null || interfaces2.length == 0) {
_interfaceLookup[classElt] = resultMap;
return resultMap;
}
List<Map<String, ExecutableElement>> lookupMaps = new List<Map<String, ExecutableElement>>();
+ if (superclassElement != null) {
+ if (!visitedInterfaces.contains(superclassElement)) {
+ try {
+ javaSetAdd(visitedInterfaces, superclassElement);
+ lookupMaps.add(computeInterfaceLookupMap(superclassElement, visitedInterfaces));
+ } finally {
+ visitedInterfaces.remove(superclassElement);
+ }
+ } else {
+ Map<String, ExecutableElement> map = _interfaceLookup[classElt];
+ if (map != null) {
+ lookupMaps.add(map);
+ } else {
+ _interfaceLookup[superclassElement] = resultMap;
+ return resultMap;
+ }
+ }
+ }
for (InterfaceType interfaceType in interfaces2) {
ClassElement interfaceElement = interfaceType.element;
if (interfaceElement != null) {
if (!visitedInterfaces.contains(interfaceElement)) {
- javaSetAdd(visitedInterfaces, interfaceElement);
- lookupMaps.add(computeInterfaceLookupMap(interfaceElement, visitedInterfaces));
+ try {
+ javaSetAdd(visitedInterfaces, interfaceElement);
+ lookupMaps.add(computeInterfaceLookupMap(interfaceElement, visitedInterfaces));
+ } finally {
+ visitedInterfaces.remove(interfaceElement);
+ }
} else {
Map<String, ExecutableElement> map = _interfaceLookup[classElt];
if (map != null) {
@@ -3563,11 +3587,39 @@
}
}
}
+ if (superclassElement != null) {
+ List<MethodElement> methods2 = superclassElement.methods;
+ for (MethodElement method in methods2) {
+ if (method.isAccessibleIn(_library) && !method.isStatic()) {
+ String key = method.name;
+ if (!unionMap.containsKey(key)) {
+ Set<ExecutableElement> set = new Set<ExecutableElement>();
+ javaSetAdd(set, method);
+ unionMap[key] = set;
+ } else {
+ javaSetAdd(unionMap[key], method);
+ }
+ }
+ }
+ List<PropertyAccessorElement> accessors2 = superclassElement.accessors;
+ for (PropertyAccessorElement accessor in accessors2) {
+ if (accessor.isAccessibleIn(_library) && !accessor.isStatic()) {
+ String key = accessor.name;
+ if (!unionMap.containsKey(key)) {
+ Set<ExecutableElement> set = new Set<ExecutableElement>();
+ javaSetAdd(set, accessor);
+ unionMap[key] = set;
+ } else {
+ javaSetAdd(unionMap[key], accessor);
+ }
+ }
+ }
+ }
for (InterfaceType interfaceType in interfaces2) {
ClassElement interfaceElement = interfaceType.element;
if (interfaceElement != null) {
- List<MethodElement> methods2 = interfaceElement.methods;
- for (MethodElement method in methods2) {
+ List<MethodElement> methods3 = interfaceElement.methods;
+ for (MethodElement method in methods3) {
if (method.isAccessibleIn(_library) && !method.isStatic()) {
String key = method.name;
if (!unionMap.containsKey(key)) {
@@ -3579,8 +3631,8 @@
}
}
}
- List<PropertyAccessorElement> accessors2 = interfaceElement.accessors;
- for (PropertyAccessorElement accessor in accessors2) {
+ List<PropertyAccessorElement> accessors3 = interfaceElement.accessors;
+ for (PropertyAccessorElement accessor in accessors3) {
if (accessor.isAccessibleIn(_library) && !accessor.isStatic()) {
String key = accessor.name;
if (!unionMap.containsKey(key)) {
@@ -3623,7 +3675,7 @@
for (int i = 0; i < numOfEltsWithMatchingNames; i++) {
executableElementTypes[i] = elements[i].type;
}
- bool foundSubtypeOfAllTypes = true;
+ bool foundSubtypeOfAllTypes = false;
for (int i = 0; i < numOfEltsWithMatchingNames; i++) {
FunctionType subtype = executableElementTypes[i];
if (subtype == null) {
@@ -3634,12 +3686,12 @@
if (i != j) {
if (!subtype.isSubtypeOf(executableElementTypes[j])) {
subtypeOfAllTypes = false;
- foundSubtypeOfAllTypes = false;
break;
}
}
}
if (subtypeOfAllTypes) {
+ foundSubtypeOfAllTypes = true;
resultMap[key] = elements[i];
break;
}
@@ -7969,9 +8021,15 @@
if (typeNameSimple.name == "boolean") {
reportError(StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, typeNameSimple, []);
} else if (isTypeNameInCatchClause(node)) {
- reportError(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, node, [node]);
+ reportError(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
+ } else if (isTypeNameInAsExpression(node)) {
+ reportError(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
+ } else if (isTypeNameInIsExpression(node)) {
+ reportError(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
+ } else if (isTypeNameTargetInRedirectedConstructor(node)) {
+ reportError(StaticWarningCode.REDIRECT_TO_NON_CLASS, typeName, [typeName.name]);
} else {
- reportError(StaticWarningCode.UNDEFINED_CLASS, typeNameSimple, [typeNameSimple.name]);
+ reportError(StaticWarningCode.UNDEFINED_CLASS, typeName, [typeName.name]);
}
elementValid = false;
}
@@ -8001,7 +8059,11 @@
}
} else {
if (isTypeNameInCatchClause(node)) {
- reportError(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, node, [node]);
+ reportError(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
+ } else if (isTypeNameInAsExpression(node)) {
+ reportError(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
+ } else if (isTypeNameInIsExpression(node)) {
+ reportError(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
}
setElement(typeName, _dynamicType.element);
typeName.staticType = _dynamicType;
@@ -8201,9 +8263,23 @@
}
/**
- * Checks if the given type name is used as the exception type in the catch clause.
+ * Checks if the given type name is used as the type in an as expression.
* @param typeName the type name to analyzer
- * @return {@code true} if the given type name is used as the exception type in the catch clause.
+ * @return {@code true} if the given type name is used as the type in an as expression
+ */
+ bool isTypeNameInAsExpression(TypeName typeName) {
+ ASTNode parent2 = typeName.parent;
+ if (parent2 is AsExpression) {
+ AsExpression asExpression = parent2 as AsExpression;
+ return identical(asExpression.type, typeName);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the given type name is used as the exception type in a catch clause.
+ * @param typeName the type name to analyzer
+ * @return {@code true} if the given type name is used as the exception type in a catch clause
*/
bool isTypeNameInCatchClause(TypeName typeName) {
ASTNode parent2 = typeName.parent;
@@ -8215,9 +8291,9 @@
}
/**
- * Checks if the given type name is used as the type in the instance creation expression.
+ * Checks if the given type name is used as the type in an instance creation expression.
* @param typeName the type name to analyzer
- * @return {@code true} if the given type name is used as the type in the instance creation
+ * @return {@code true} if the given type name is used as the type in an instance creation
* expression
*/
bool isTypeNameInInstanceCreationExpression(TypeName typeName) {
@@ -8230,6 +8306,38 @@
}
/**
+ * Checks if the given type name is used as the type in an is expression.
+ * @param typeName the type name to analyzer
+ * @return {@code true} if the given type name is used as the type in an is expression
+ */
+ bool isTypeNameInIsExpression(TypeName typeName) {
+ ASTNode parent2 = typeName.parent;
+ if (parent2 is IsExpression) {
+ IsExpression isExpression = parent2 as IsExpression;
+ return identical(isExpression.type, typeName);
+ }
+ return false;
+ }
+
+ /**
+ * Checks if the given type name is the target in a redirected constructor.
+ * @param typeName the type name to analyzer
+ * @return {@code true} if the given type name is used as the type in a redirected constructor
+ */
+ bool isTypeNameTargetInRedirectedConstructor(TypeName typeName) {
+ ASTNode parent2 = typeName.parent;
+ if (parent2 is ConstructorName) {
+ ConstructorName constructorName = parent2 as ConstructorName;
+ parent2 = constructorName.parent;
+ if (parent2 is ConstructorDeclaration) {
+ ConstructorDeclaration constructorDeclaration = parent2 as ConstructorDeclaration;
+ return constructorName == constructorDeclaration.redirectedConstructor;
+ }
+ }
+ return false;
+ }
+
+ /**
* Record that the static type of the given node is the given type.
* @param expression the node whose type is to be recorded
* @param type the static type of the node
@@ -9766,7 +9874,7 @@
checkForMultipleSuperInitializers(node);
checkForRecursiveConstructorRedirect(node);
checkForRecursiveFactoryRedirect(node);
- checkForRedirectToInvalidFunction(node);
+ checkForAllRedirectConstructorErrorCodes(node);
checkForUndefinedConstructorInInitializerImplicit(node);
checkForRedirectToNonConstConstructor(node);
return super.visitConstructorDeclaration(node);
@@ -9798,6 +9906,15 @@
checkForExportInternalLibrary(node);
return super.visitExportDirective(node);
}
+ Object visitFieldDeclaration(FieldDeclaration node) {
+ if (!node.isStatic()) {
+ VariableDeclarationList variables = node.fields;
+ if (variables.isConst()) {
+ _errorReporter.reportError4(CompileTimeErrorCode.CONST_INSTANCE_FIELD, variables.keyword, []);
+ }
+ }
+ return super.visitFieldDeclaration(node);
+ }
Object visitFieldFormalParameter(FieldFormalParameter node) {
checkForConstFormalParameter(node);
checkForFieldInitializingFormalRedirectingConstructor(node);
@@ -10283,6 +10400,48 @@
}
/**
+ * This checks error related to the redirected constructors.
+ * @param node the constructor declaration to evaluate
+ * @return {@code true} if and only if an error code is generated on the passed node
+ * @see StaticWarningCode#REDIRECT_TO_INVALID_RETURN_TYPE
+ * @see StaticWarningCode#REDIRECT_TO_INVALID_FUNCTION_TYPE
+ * @see StaticWarningCode#REDIRECT_TO_MISSING_CONSTRUCTOR
+ */
+ bool checkForAllRedirectConstructorErrorCodes(ConstructorDeclaration node) {
+ ConstructorName redirectedNode = node.redirectedConstructor;
+ if (redirectedNode == null) {
+ return false;
+ }
+ ConstructorElement redirectedElement = redirectedNode.element;
+ if (redirectedElement == null) {
+ TypeName constructorTypeName = redirectedNode.type;
+ Type2 redirectedType = constructorTypeName.type;
+ if (redirectedType != null && redirectedType.element != null && redirectedType.element != DynamicElementImpl.instance) {
+ String constructorStrName = constructorTypeName.name.name;
+ if (redirectedNode.name != null) {
+ constructorStrName += ".${redirectedNode.name.name}";
+ }
+ _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR, redirectedNode, [constructorStrName, redirectedType.displayName]);
+ return true;
+ }
+ return false;
+ }
+ FunctionType redirectedType = redirectedElement.type;
+ Type2 redirectedReturnType = redirectedType.returnType;
+ FunctionType constructorType = node.element.type;
+ Type2 constructorReturnType = constructorType.returnType;
+ if (!redirectedReturnType.isSubtypeOf(constructorReturnType)) {
+ _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE, redirectedNode, [redirectedReturnType, constructorReturnType]);
+ return true;
+ }
+ if (!redirectedType.isSubtypeOf(constructorType)) {
+ _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_INVALID_FUNCTION_TYPE, redirectedNode, [redirectedType, constructorType]);
+ return true;
+ }
+ return false;
+ }
+
+ /**
* This checks that the return statement of the form <i>return e;</i> is not in a generative
* constructor.
* <p>
@@ -11200,7 +11359,7 @@
NodeList<VariableDeclaration> variables2 = node.variables;
for (VariableDeclaration variable in variables2) {
if (variable.initializer == null) {
- _errorReporter.reportError2(CompileTimeErrorCode.FINAL_NOT_INITIALIZED, variable, [variable.name.name]);
+ _errorReporter.reportError2(StaticWarningCode.FINAL_NOT_INITIALIZED, variable, [variable.name.name]);
foundError = true;
}
}
@@ -11728,16 +11887,25 @@
return false;
}
List<ExecutableElement> missingOverridesArray = new List.from(missingOverrides);
+ List<String> stringTypeArray = new List<String>(Math.min(missingOverridesSize, 4));
+ String GET = "get ";
+ String SET = "set ";
+ for (int i = 0; i < stringTypeArray.length; i++) {
+ stringTypeArray[i] = StringUtilities.EMPTY;
+ if (missingOverridesArray[i] is PropertyAccessorElement) {
+ stringTypeArray[i] = ((missingOverridesArray[i] as PropertyAccessorElement)).isGetter() ? GET : SET;
+ }
+ }
if (missingOverridesSize == 1) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, node.name, [missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName]);
+ _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName]);
} else if (missingOverridesSize == 2) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, node.name, [missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName]);
+ _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName]);
} else if (missingOverridesSize == 3) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, node.name, [missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName]);
+ _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName]);
} else if (missingOverridesSize == 4) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, node.name, [missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName]);
+ _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, stringTypeArray[3], missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName]);
} else {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, node.name, [missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName, missingOverridesArray.length - 4]);
+ _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, stringTypeArray[3], missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName, missingOverridesArray.length - 4]);
}
return true;
}
@@ -12038,38 +12206,6 @@
}
/**
- * This checks if the passed constructor declaration has redirected constructor with compatible
- * function type.
- * @param node the constructor declaration to evaluate
- * @return {@code true} if and only if an error code is generated on the passed node
- * @see StaticWarningCode#REDIRECT_TO_INVALID_RETURN_TYPE
- * @see StaticWarningCode#REDIRECT_TO_INVALID_FUNCTION_TYPE
- */
- bool checkForRedirectToInvalidFunction(ConstructorDeclaration node) {
- ConstructorName redirectedNode = node.redirectedConstructor;
- if (redirectedNode == null) {
- return false;
- }
- ConstructorElement redirectedElement = redirectedNode.element;
- if (redirectedElement == null) {
- return false;
- }
- FunctionType redirectedType = redirectedElement.type;
- Type2 redirectedReturnType = redirectedType.returnType;
- FunctionType constructorType = node.element.type;
- Type2 constructorReturnType = constructorType.returnType;
- if (!redirectedReturnType.isSubtypeOf(constructorReturnType)) {
- _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE, redirectedNode, [redirectedReturnType, constructorReturnType]);
- return true;
- }
- if (!redirectedType.isSubtypeOf(constructorType)) {
- _errorReporter.reportError2(StaticWarningCode.REDIRECT_TO_INVALID_FUNCTION_TYPE, redirectedNode, [redirectedType, constructorType]);
- return true;
- }
- return false;
- }
-
- /**
* This checks if the passed constructor declaration has redirected constructor and references
* itself directly or indirectly. TODO(scheglov)
* @param node the constructor declaration to evaluate
@@ -12245,8 +12381,9 @@
}
/**
- * This checks that if the passed generative constructor has no explicit super constructor
- * invocation, then super class has the default generative constructor.
+ * This checks that if the passed generative constructor has neither an explicit super constructor
+ * invocation nor a redirecting constructor invocation, that the superclass has a default
+ * generative constructor.
* @param node the constructor declaration to evaluate
* @return {@code true} if and only if an error code is generated on the passed node
* @see CompileTimeErrorCode#UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT
@@ -12256,6 +12393,11 @@
if (node.factoryKeyword != null) {
return false;
}
+ for (ConstructorInitializer constructorInitializer in node.initializers) {
+ if (constructorInitializer is SuperConstructorInvocation || constructorInitializer is RedirectingConstructorInvocation) {
+ return false;
+ }
+ }
if (_enclosingClass == null) {
return false;
}
@@ -12264,11 +12406,6 @@
return false;
}
ClassElement superElement = superType.element;
- for (ConstructorInitializer constructorInitializer in node.initializers) {
- if (constructorInitializer is SuperConstructorInvocation) {
- return false;
- }
- }
ConstructorElement superDefaultConstructor = superElement.unnamedConstructor;
if (superDefaultConstructor != null) {
if (superDefaultConstructor.isFactory()) {
@@ -12485,6 +12622,7 @@
INIT_STATE(this.name, this.ordinal) {
}
int compareTo(INIT_STATE other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -12554,7 +12692,7 @@
* @param path the path to be validated (not {@code null})
* @return {@code true} if the import path contains ".."
*/
- bool checkForPackageImportContainsDotDot(String path) => path.contains("/../");
+ bool checkForPackageImportContainsDotDot(String path) => path.startsWith("../") || path.contains("/../");
/**
* Answer the full name of the source associated with the compilation unit containing the given
@@ -12621,5 +12759,6 @@
String get message => _message;
ErrorType get type => _type;
int compareTo(ResolverErrorCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/scanner.dart b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
index 2da3af1..091e88c 100644
--- a/pkg/analyzer_experimental/lib/src/generated/scanner.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
@@ -158,6 +158,7 @@
String get message => _message;
ErrorType get type => ErrorType.SYNTACTIC_ERROR;
int compareTo(ScannerErrorCode other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -312,6 +313,7 @@
*/
bool isPseudoKeyword() => _isPseudoKeyword2;
int compareTo(Keyword other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -1806,6 +1808,7 @@
*/
int get precedence => _precedence;
int compareTo(TokenClass other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -2033,6 +2036,7 @@
*/
bool isUserDefinableOperator() => identical(_lexeme, "==") || identical(_lexeme, "~") || identical(_lexeme, "[]") || identical(_lexeme, "[]=") || identical(_lexeme, "*") || identical(_lexeme, "/") || identical(_lexeme, "%") || identical(_lexeme, "~/") || identical(_lexeme, "+") || identical(_lexeme, "-") || identical(_lexeme, "<<") || identical(_lexeme, ">>") || identical(_lexeme, ">=") || identical(_lexeme, ">") || identical(_lexeme, "<=") || identical(_lexeme, "<") || identical(_lexeme, "&") || identical(_lexeme, "^") || identical(_lexeme, "|");
int compareTo(TokenType other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
class TokenType_EOF extends TokenType {
diff --git a/pkg/analyzer_experimental/lib/src/generated/source.dart b/pkg/analyzer_experimental/lib/src/generated/source.dart
index 1fec215..da272e9 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source.dart
@@ -420,6 +420,7 @@
SourceKind(this.name, this.ordinal) {
}
int compareTo(SourceKind other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
@@ -490,6 +491,7 @@
*/
int get encoding => _encoding;
int compareTo(UriKind other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/source_io.dart b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
index 3decc7b..e473fc9 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
@@ -234,7 +234,7 @@
AnalysisEngine.instance.logger.logError2("Canonical failed: ${pkgDir}", e);
}
}
- return new JavaFile.relative(pkgDir, relPath.replaceAll('/', JavaFile.separatorChar));
+ return new JavaFile.relative(pkgDir, relPath.replaceAll('/', new String.fromCharCode(JavaFile.separatorChar)));
}
}
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
index ee959a3..80804cd 100644
--- a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
@@ -38,5 +38,6 @@
*/
bool isOptional() => _isOptional2;
int compareTo(ParameterKind other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/test/generated/ast_test.dart b/pkg/analyzer_experimental/test/generated/ast_test.dart
index 10c7928..a458f11 100644
--- a/pkg/analyzer_experimental/test/generated/ast_test.dart
+++ b/pkg/analyzer_experimental/test/generated/ast_test.dart
@@ -182,6 +182,35 @@
});
}
}
+class VariableDeclarationTest extends ParserTestCase {
+ void test_getDocumentationComment_onGrandParent() {
+ VariableDeclaration varDecl = ASTFactory.variableDeclaration("a");
+ TopLevelVariableDeclaration decl = ASTFactory.topLevelVariableDeclaration2(Keyword.VAR, [varDecl]);
+ Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+ JUnitTestCase.assertNull(varDecl.documentationComment);
+ decl.documentationComment = comment;
+ JUnitTestCase.assertNotNull(varDecl.documentationComment);
+ JUnitTestCase.assertNotNull(decl.documentationComment);
+ }
+ void test_getDocumentationComment_onNode() {
+ VariableDeclaration decl = ASTFactory.variableDeclaration("a");
+ Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+ decl.documentationComment = comment;
+ JUnitTestCase.assertNotNull(decl.documentationComment);
+ }
+ static dartSuite() {
+ _ut.group('VariableDeclarationTest', () {
+ _ut.test('test_getDocumentationComment_onGrandParent', () {
+ final __test = new VariableDeclarationTest();
+ runJUnitTest(__test, __test.test_getDocumentationComment_onGrandParent);
+ });
+ _ut.test('test_getDocumentationComment_onNode', () {
+ final __test = new VariableDeclarationTest();
+ runJUnitTest(__test, __test.test_getDocumentationComment_onNode);
+ });
+ });
+ }
+}
/**
* The class {@code ASTFactory} defines utility methods that can be used to create AST nodes. The
* nodes that are created are complete in the sense that all of the tokens that would have been
@@ -679,6 +708,7 @@
AssignmentKind(this.name, this.ordinal) {
}
int compareTo(AssignmentKind other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
class WrapperKind implements Comparable<WrapperKind> {
@@ -697,6 +727,7 @@
WrapperKind(this.name, this.ordinal) {
}
int compareTo(WrapperKind other) => ordinal - other.ordinal;
+ int get hashCode => ordinal;
String toString() => name;
}
class BreadthFirstVisitorTest extends ParserTestCase {
@@ -2910,4 +2941,5 @@
BreadthFirstVisitorTest.dartSuite();
IndexExpressionTest.dartSuite();
SimpleIdentifierTest.dartSuite();
+ VariableDeclarationTest.dartSuite();
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/test/generated/element_test.dart b/pkg/analyzer_experimental/test/generated/element_test.dart
index ed98686..4b440f0 100644
--- a/pkg/analyzer_experimental/test/generated/element_test.dart
+++ b/pkg/analyzer_experimental/test/generated/element_test.dart
@@ -2279,6 +2279,38 @@
FunctionType s = ElementFactory.functionElement4("s", null, null, <String> ["name"], <ClassElement> [b]).type;
JUnitTestCase.assertTrue(t.isSubtypeOf(s));
}
+ void test_isSubtypeOf_normalAndPositionalArgs_1() {
+ ClassElement a = ElementFactory.classElement2("A", []);
+ FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [a]).type;
+ FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).type;
+ JUnitTestCase.assertTrue(t.isSubtypeOf(s));
+ JUnitTestCase.assertFalse(s.isSubtypeOf(t));
+ }
+ void test_isSubtypeOf_normalAndPositionalArgs_2() {
+ ClassElement a = ElementFactory.classElement2("A", []);
+ FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a], <ClassElement> [a]).type;
+ FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).type;
+ JUnitTestCase.assertTrue(t.isSubtypeOf(s));
+ JUnitTestCase.assertFalse(s.isSubtypeOf(t));
+ }
+ void test_isSubtypeOf_normalAndPositionalArgs_3() {
+ ClassElement a = ElementFactory.classElement2("A", []);
+ FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [a]).type;
+ FunctionType s = ElementFactory.functionElement("s").type;
+ JUnitTestCase.assertTrue(t.isSubtypeOf(s));
+ JUnitTestCase.assertFalse(s.isSubtypeOf(t));
+ }
+ void test_isSubtypeOf_normalAndPositionalArgs_4() {
+ ClassElement a = ElementFactory.classElement2("A", []);
+ ClassElement b = ElementFactory.classElement2("B", []);
+ ClassElement c = ElementFactory.classElement2("C", []);
+ ClassElement d = ElementFactory.classElement2("D", []);
+ ClassElement e = ElementFactory.classElement2("E", []);
+ FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a, b], <ClassElement> [c, d, e]).type;
+ FunctionType s = ElementFactory.functionElement6("s", <ClassElement> [a, b, c], <ClassElement> [d]).type;
+ JUnitTestCase.assertTrue(t.isSubtypeOf(s));
+ JUnitTestCase.assertFalse(s.isSubtypeOf(t));
+ }
void test_isSubtypeOf_normalParameters_isAssignable() {
ClassElement a = ElementFactory.classElement2("A", []);
ClassElement b = ElementFactory.classElement("B", a.type, []);
@@ -2311,7 +2343,7 @@
InterfaceType t = ElementFactory.object.type;
JUnitTestCase.assertTrue(f.isSubtypeOf(t));
}
- void test_isSubtypeOf_optionalParameters_isAssignable() {
+ void test_isSubtypeOf_positionalParameters_isAssignable() {
ClassElement a = ElementFactory.classElement2("A", []);
ClassElement b = ElementFactory.classElement("B", a.type, []);
FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [a]).type;
@@ -2319,19 +2351,19 @@
JUnitTestCase.assertTrue(t.isSubtypeOf(s));
JUnitTestCase.assertTrue(s.isSubtypeOf(t));
}
- void test_isSubtypeOf_optionalParameters_isNotAssignable() {
+ void test_isSubtypeOf_positionalParameters_isNotAssignable() {
FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [ElementFactory.classElement2("A", [])]).type;
FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [ElementFactory.classElement2("B", [])]).type;
JUnitTestCase.assertFalse(t.isSubtypeOf(s));
}
- void test_isSubtypeOf_optionalParameters_sHasMoreParams() {
+ void test_isSubtypeOf_positionalParameters_sHasMoreParams() {
ClassElement a = ElementFactory.classElement2("A", []);
ClassElement b = ElementFactory.classElement("B", a.type, []);
FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [a]).type;
FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [b, b]).type;
JUnitTestCase.assertFalse(t.isSubtypeOf(s));
}
- void test_isSubtypeOf_optionalParameters_tHasMoreParams() {
+ void test_isSubtypeOf_positionalParameters_tHasMoreParams() {
ClassElement a = ElementFactory.classElement2("A", []);
ClassElement b = ElementFactory.classElement("B", a.type, []);
FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [a, a]).type;
@@ -2339,7 +2371,7 @@
JUnitTestCase.assertTrue(t.isSubtypeOf(s));
}
void test_isSubtypeOf_returnType_sIsVoid() {
- FunctionType t = ElementFactory.functionElement2("t", ElementFactory.classElement2("A", [])).type;
+ FunctionType t = ElementFactory.functionElement("t").type;
FunctionType s = ElementFactory.functionElement("s").type;
JUnitTestCase.assertTrue(VoidTypeImpl.instance == s.returnType);
JUnitTestCase.assertTrue(t.isSubtypeOf(s));
@@ -2364,13 +2396,6 @@
JUnitTestCase.assertFalse(t.isSubtypeOf(s));
JUnitTestCase.assertFalse(s.isSubtypeOf(t));
}
- void test_isSubtypeOf_wrongFunctionType_normal_optional() {
- ClassElement a = ElementFactory.classElement2("A", []);
- FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).type;
- FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [a]).type;
- JUnitTestCase.assertFalse(t.isSubtypeOf(s));
- JUnitTestCase.assertFalse(s.isSubtypeOf(t));
- }
void test_isSubtypeOf_wrongFunctionType_optional_named() {
ClassElement a = ElementFactory.classElement2("A", []);
FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [a]).type;
@@ -2544,6 +2569,22 @@
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_namedParameters_tHasMoreParams);
});
+ _ut.test('test_isSubtypeOf_normalAndPositionalArgs_1', () {
+ final __test = new FunctionTypeImplTest();
+ runJUnitTest(__test, __test.test_isSubtypeOf_normalAndPositionalArgs_1);
+ });
+ _ut.test('test_isSubtypeOf_normalAndPositionalArgs_2', () {
+ final __test = new FunctionTypeImplTest();
+ runJUnitTest(__test, __test.test_isSubtypeOf_normalAndPositionalArgs_2);
+ });
+ _ut.test('test_isSubtypeOf_normalAndPositionalArgs_3', () {
+ final __test = new FunctionTypeImplTest();
+ runJUnitTest(__test, __test.test_isSubtypeOf_normalAndPositionalArgs_3);
+ });
+ _ut.test('test_isSubtypeOf_normalAndPositionalArgs_4', () {
+ final __test = new FunctionTypeImplTest();
+ runJUnitTest(__test, __test.test_isSubtypeOf_normalAndPositionalArgs_4);
+ });
_ut.test('test_isSubtypeOf_normalParameters_isAssignable', () {
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_normalParameters_isAssignable);
@@ -2560,21 +2601,21 @@
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_normalParameters_tHasMoreParams);
});
- _ut.test('test_isSubtypeOf_optionalParameters_isAssignable', () {
+ _ut.test('test_isSubtypeOf_positionalParameters_isAssignable', () {
final __test = new FunctionTypeImplTest();
- runJUnitTest(__test, __test.test_isSubtypeOf_optionalParameters_isAssignable);
+ runJUnitTest(__test, __test.test_isSubtypeOf_positionalParameters_isAssignable);
});
- _ut.test('test_isSubtypeOf_optionalParameters_isNotAssignable', () {
+ _ut.test('test_isSubtypeOf_positionalParameters_isNotAssignable', () {
final __test = new FunctionTypeImplTest();
- runJUnitTest(__test, __test.test_isSubtypeOf_optionalParameters_isNotAssignable);
+ runJUnitTest(__test, __test.test_isSubtypeOf_positionalParameters_isNotAssignable);
});
- _ut.test('test_isSubtypeOf_optionalParameters_sHasMoreParams', () {
+ _ut.test('test_isSubtypeOf_positionalParameters_sHasMoreParams', () {
final __test = new FunctionTypeImplTest();
- runJUnitTest(__test, __test.test_isSubtypeOf_optionalParameters_sHasMoreParams);
+ runJUnitTest(__test, __test.test_isSubtypeOf_positionalParameters_sHasMoreParams);
});
- _ut.test('test_isSubtypeOf_optionalParameters_tHasMoreParams', () {
+ _ut.test('test_isSubtypeOf_positionalParameters_tHasMoreParams', () {
final __test = new FunctionTypeImplTest();
- runJUnitTest(__test, __test.test_isSubtypeOf_optionalParameters_tHasMoreParams);
+ runJUnitTest(__test, __test.test_isSubtypeOf_positionalParameters_tHasMoreParams);
});
_ut.test('test_isSubtypeOf_returnType_sIsVoid', () {
final __test = new FunctionTypeImplTest();
@@ -2592,10 +2633,6 @@
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_wrongFunctionType_normal_named);
});
- _ut.test('test_isSubtypeOf_wrongFunctionType_normal_optional', () {
- final __test = new FunctionTypeImplTest();
- runJUnitTest(__test, __test.test_isSubtypeOf_wrongFunctionType_normal_optional);
- });
_ut.test('test_isSubtypeOf_wrongFunctionType_optional_named', () {
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_wrongFunctionType_optional_named);
diff --git a/pkg/analyzer_experimental/test/generated/resolver_test.dart b/pkg/analyzer_experimental/test/generated/resolver_test.dart
index 4884cbe..77231c2 100644
--- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
+++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
@@ -527,6 +527,12 @@
assertNoErrors();
verify([source]);
}
+ void test_argumentTypeNotAssignable_classWithCall_Function() {
+ Source source = addSource(EngineTestCase.createSource([" caller(Function callee) {", " callee();", " }", "", " class CallMeBack {", " call() => 0;", " }", "", " main() {", " caller(new CallMeBack());", " }"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_argumentTypeNotAssignable_invocation_functionParameter_generic() {
Source source = addSource(EngineTestCase.createSource(["class A<K> {", " m(f(K k), K v) {", " f(v);", " }", "}"]));
resolve(source);
@@ -636,12 +642,6 @@
assertNoErrors();
verify([source]);
}
- void test_constConstructorWithNonFinalField_constInstanceVar() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " const int x = 0;", " const A();", "}"]));
- resolve(source);
- assertNoErrors();
- verify([source]);
- }
void test_constConstructorWithNonFinalField_finalInstanceVar() {
Source source = addSource(EngineTestCase.createSource(["class A {", " final int x = 0;", " const A();", "}"]));
resolve(source);
@@ -685,7 +685,7 @@
verify([source]);
}
void test_constWithTypeParameters_direct() {
- Source source = addSource(EngineTestCase.createSource(["class A<T> {", " const V = const A<int>();", " const A();", "}"]));
+ Source source = addSource(EngineTestCase.createSource(["class A<T> {", " static const V = const A<int>();", " const A();", "}"]));
resolve(source);
assertNoErrors();
verify([source]);
@@ -1457,6 +1457,12 @@
assertNoErrors();
verify([source]);
}
+ void test_undefinedConstructorInInitializer_redirecting() {
+ Source source = addSource(EngineTestCase.createSource(["class Foo {", " Foo.ctor();", "}", "class Bar extends Foo {", " Bar() : this.ctor();", " Bar.ctor() : super.ctor();", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_undefinedGetter_noSuchMethod_getter() {
Source source = addSource(EngineTestCase.createSource(["class A {", " noSuchMethod(invocation) {}", "}", "f() {", " (new A()).g;", "}"]));
resolve(source);
@@ -1587,6 +1593,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_argumentTypeNotAssignable_Object_Function);
});
+ _ut.test('test_argumentTypeNotAssignable_classWithCall_Function', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_argumentTypeNotAssignable_classWithCall_Function);
+ });
_ut.test('test_argumentTypeNotAssignable_invocation_functionParameter_generic', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_functionParameter_generic);
@@ -1655,10 +1665,6 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_conflictingStaticSetterAndInstanceMember_thisClass_method);
});
- _ut.test('test_constConstructorWithNonFinalField_constInstanceVar', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_constInstanceVar);
- });
_ut.test('test_constConstructorWithNonFinalField_finalInstanceVar', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_finalInstanceVar);
@@ -2199,6 +2205,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_implicit_typedef);
});
+ _ut.test('test_undefinedConstructorInInitializer_redirecting', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_redirecting);
+ });
_ut.test('test_undefinedGetter_noSuchMethod_getter', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedGetter_noSuchMethod_getter);
@@ -2433,10 +2443,22 @@
assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_VIOLATES_BOUNDS]);
verify([source]);
}
- void test_inconsistentMethodInheritanceGetterAndMethod() {
- Source source = addSource(EngineTestCase.createSource(["abstract class A {", " int x();", "}", "abstract class B {", " int get x;", "}", "class C implements A, B {", "}"]));
+ void test_inconsistentMethodInheritance_paramCount() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A {", " int x();", "}", "abstract class B {", " int x(int y);", "}", "class C implements A, B {", "}"]));
resolve(source);
- assertErrors([StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]);
+ assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
+ verify([source]);
+ }
+ void test_inconsistentMethodInheritance_paramType() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A {", " x(int i);", "}", "abstract class B {", " x(String s);", "}", "abstract class C implements A, B {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
+ verify([source]);
+ }
+ void test_inconsistentMethodInheritance_returnType() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A {", " int x();", "}", "abstract class B {", " String x();", "}", "abstract class C implements A, B {}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
verify([source]);
}
void test_invalidAssignment_compoundAssignment() {
@@ -2631,9 +2653,17 @@
}
static dartSuite() {
_ut.group('StaticTypeWarningCodeTest', () {
- _ut.test('test_inconsistentMethodInheritanceGetterAndMethod', () {
+ _ut.test('test_inconsistentMethodInheritance_paramCount', () {
final __test = new StaticTypeWarningCodeTest();
- runJUnitTest(__test, __test.test_inconsistentMethodInheritanceGetterAndMethod);
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_paramCount);
+ });
+ _ut.test('test_inconsistentMethodInheritance_paramType', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_paramType);
+ });
+ _ut.test('test_inconsistentMethodInheritance_returnType', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_returnType);
});
_ut.test('test_invalidAssignment_compoundAssignment', () {
final __test = new StaticTypeWarningCodeTest();
@@ -3820,12 +3850,6 @@
assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
verify([source]);
}
- void fail_finalNotInitialized_inConstructor() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " final int x;", " A() {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
void fail_invalidOverrideDefaultValue() {
Source source = addSource(EngineTestCase.createSource(["class A {", " m([a = 0]) {}", "}", "class B extends A {", " m([a = 1]) {}", "}"]));
resolve(source);
@@ -4203,6 +4227,12 @@
assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
verify([source]);
}
+ void test_constInstanceField() {
+ Source source = addSource(EngineTestCase.createSource(["class C {", " const int f = 0;", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_INSTANCE_FIELD]);
+ verify([source]);
+ }
void test_constWithInvalidTypeParameters() {
Source source = addSource(EngineTestCase.createSource(["class A {", " const A();", "}", "f() { return const A<A>(); }"]));
resolve(source);
@@ -4228,13 +4258,13 @@
verify([source]);
}
void test_constWithTypeParameters_direct() {
- Source source = addSource(EngineTestCase.createSource(["class A<T> {", " const V = const A<T>();", " const A();", "}"]));
+ Source source = addSource(EngineTestCase.createSource(["class A<T> {", " static const V = const A<T>();", " const A();", "}"]));
resolve(source);
assertErrors([CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS]);
verify([source]);
}
void test_constWithTypeParameters_indirect() {
- Source source = addSource(EngineTestCase.createSource(["class A<T> {", " const V = const A<List<T>>();", " const A();", "}"]));
+ Source source = addSource(EngineTestCase.createSource(["class A<T> {", " static const V = const A<List<T>>();", " const A();", "}"]));
resolve(source);
assertErrors([CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS]);
verify([source]);
@@ -4403,12 +4433,6 @@
assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
verify([source]);
}
- void test_fieldInitializedInInitializerAndDeclaration_const() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " const int x = 0;", " A() : x = 1 {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
- verify([source]);
- }
void test_fieldInitializedInInitializerAndDeclaration_final() {
Source source = addSource(EngineTestCase.createSource(["class A {", " final int x = 0;", " A() : x = 1 {}", "}"]));
resolve(source);
@@ -4512,54 +4536,6 @@
assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES]);
verify([source]);
}
- void test_finalNotInitialized_instanceField_const() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " const F;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
- void test_finalNotInitialized_instanceField_const_static() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " static const F;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
- void test_finalNotInitialized_instanceField_final() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " final F;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
- void test_finalNotInitialized_instanceField_final_static() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " static final F;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
- void test_finalNotInitialized_library_const() {
- Source source = addSource(EngineTestCase.createSource(["const F;"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
- void test_finalNotInitialized_library_final() {
- Source source = addSource(EngineTestCase.createSource(["final F;"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
- void test_finalNotInitialized_local_const() {
- Source source = addSource(EngineTestCase.createSource(["f() {", " const int x;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
- void test_finalNotInitialized_local_final() {
- Source source = addSource(EngineTestCase.createSource(["f() {", " final int x;", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_NOT_INITIALIZED]);
- verify([source]);
- }
void test_getterAndMethodWithSameName() {
Source source = addSource(EngineTestCase.createSource(["class A {", " x(y) {}", " get x => 0;", "}"]));
resolve(source);
@@ -5584,6 +5560,10 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constInitializedWithNonConstValue_missingConstInMapLiteral);
});
+ _ut.test('test_constInstanceField', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constInstanceField);
+ });
_ut.test('test_constWithInvalidTypeParameters', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constWithInvalidTypeParameters);
@@ -5716,10 +5696,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers_multipleNames);
});
- _ut.test('test_fieldInitializedInInitializerAndDeclaration_const', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclaration_const);
- });
_ut.test('test_fieldInitializedInInitializerAndDeclaration_final', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclaration_final);
@@ -5776,38 +5752,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_finalInitializedMultipleTimes_initializingFormals);
});
- _ut.test('test_finalNotInitialized_instanceField_const', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_const);
- });
- _ut.test('test_finalNotInitialized_instanceField_const_static', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_const_static);
- });
- _ut.test('test_finalNotInitialized_instanceField_final', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final);
- });
- _ut.test('test_finalNotInitialized_instanceField_final_static', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final_static);
- });
- _ut.test('test_finalNotInitialized_library_const', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_library_const);
- });
- _ut.test('test_finalNotInitialized_library_final', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_library_final);
- });
- _ut.test('test_finalNotInitialized_local_const', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_local_const);
- });
- _ut.test('test_finalNotInitialized_local_final', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalNotInitialized_local_final);
- });
_ut.test('test_getterAndMethodWithSameName', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_getterAndMethodWithSameName);
@@ -7419,6 +7363,11 @@
resolve(source);
assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST, PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT]);
}
+ void test_import_packageWithLeadingDotDot() {
+ Source source = addSource(EngineTestCase.createSource(["import 'package:../other.dart';"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST, PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT]);
+ }
void test_import_referenceIntoLibDirectory() {
Source source = addSource(EngineTestCase.createSource(["import '../lib/other.dart';"]));
resolve(source);
@@ -7440,6 +7389,10 @@
final __test = new PubSuggestionCodeTest();
runJUnitTest(__test, __test.test_import_packageWithDotDot);
});
+ _ut.test('test_import_packageWithLeadingDotDot', () {
+ final __test = new PubSuggestionCodeTest();
+ runJUnitTest(__test, __test.test_import_packageWithLeadingDotDot);
+ });
_ut.test('test_import_referenceIntoLibDirectory', () {
final __test = new PubSuggestionCodeTest();
runJUnitTest(__test, __test.test_import_referenceIntoLibDirectory);
@@ -7462,12 +7415,6 @@
assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
verify([source]);
}
- void fail_castToNonType() {
- Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(String s) { var x = s as A; }"]));
- resolve(source);
- assertErrors([StaticWarningCode.CAST_TO_NON_TYPE]);
- verify([source]);
- }
void fail_commentReferenceConstructorNotVisible() {
Source source = addSource(EngineTestCase.createSource([]));
resolve(source);
@@ -7498,6 +7445,12 @@
assertErrors([StaticWarningCode.COMMENT_REFERENCE_URI_NOT_LIBRARY]);
verify([source]);
}
+ void fail_finalNotInitialized_inConstructor() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " final int x;", " A() {}", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
void fail_incorrectNumberOfArguments_tooFew() {
Source source = addSource(EngineTestCase.createSource(["f(a, b) => 0;", "g() {", " f(2);", "}"]));
resolve(source);
@@ -7540,24 +7493,6 @@
assertErrors([StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]);
verify([source]);
}
- void fail_nonType() {
- Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(var p) {", " if (p is A) {", " }", "}"]));
- resolve(source);
- assertErrors([StaticWarningCode.NON_TYPE]);
- verify([source]);
- }
- void fail_redirectToMissingConstructor() {
- Source source = addSource(EngineTestCase.createSource([]));
- resolve(source);
- assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
- verify([source]);
- }
- void fail_redirectToNonClass() {
- Source source = addSource(EngineTestCase.createSource([]));
- resolve(source);
- assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]);
- verify([source]);
- }
void fail_undefinedGetter() {
Source source = addSource(EngineTestCase.createSource([]));
resolve(source);
@@ -7751,6 +7686,12 @@
assertErrors([StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]);
verify([source]);
}
+ void test_castToNonType() {
+ Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(String s) { var x = s as A; }"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.CAST_TO_NON_TYPE]);
+ verify([source]);
+ }
void test_concreteClassWithAbstractMember() {
Source source = addSource(EngineTestCase.createSource(["class A {", " m();", "}"]));
resolve(source);
@@ -7867,6 +7808,48 @@
assertErrors([StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE]);
verify([source]);
}
+ void test_finalNotInitialized_instanceField_const_static() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " static const F;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
+ void test_finalNotInitialized_instanceField_final() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " final F;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
+ void test_finalNotInitialized_instanceField_final_static() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " static final F;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
+ void test_finalNotInitialized_library_const() {
+ Source source = addSource(EngineTestCase.createSource(["const F;"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
+ void test_finalNotInitialized_library_final() {
+ Source source = addSource(EngineTestCase.createSource(["final F;"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
+ void test_finalNotInitialized_local_const() {
+ Source source = addSource(EngineTestCase.createSource(["f() {", " const int x;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
+ void test_finalNotInitialized_local_final() {
+ Source source = addSource(EngineTestCase.createSource(["f() {", " final int x;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_NOT_INITIALIZED]);
+ verify([source]);
+ }
void test_importDuplicatedLibraryName() {
Source source = addSource(EngineTestCase.createSource(["library test;", "import 'lib1.dart';", "import 'lib2.dart';"]));
addSource2("/lib1.dart", "library lib;");
@@ -7875,10 +7858,10 @@
assertErrors([StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME]);
verify([source]);
}
- void test_inconsistentMethodInheritance() {
- Source source = addSource(EngineTestCase.createSource(["abstract class A {", " x(int i);", "}", "abstract class B {", " x(String s);", "}", "abstract class C implements A, B {}"]));
+ void test_inconsistentMethodInheritanceGetterAndMethod() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A {", " int x();", "}", "abstract class B {", " int get x;", "}", "class C implements A, B {", "}"]));
resolve(source);
- assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
+ assertErrors([StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]);
verify([source]);
}
void test_instanceMethodNameCollidesWithSuperclassStatic_field() {
@@ -8066,6 +8049,12 @@
assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
verify([source]);
}
+ void test_nonAbstractClassInheritsAbstractMemberOne_method_optionalParamCount() {
+ Source source = addSource(EngineTestCase.createSource(["abstract class A {", " int x(int a);", "}", "abstract class B {", " int x(int a, [int b]);", "}", "class C implements A, B {", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
+ verify([source]);
+ }
void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface() {
Source source = addSource(EngineTestCase.createSource(["class I {", " set s(int i) {}", "}", "class C implements I {", "}"]));
resolve(source);
@@ -8145,6 +8134,22 @@
assertErrors([StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE]);
verify([source]);
}
+ void test_redirectToMissingConstructor_named() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements B{", " A() {}", "}", "class B {", " B() = A.name;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
+ }
+ void test_redirectToMissingConstructor_unnamed() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements B{", " A.name() {}", "}", "class B {", " B() = A;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
+ }
+ void test_redirectToNonClass() {
+ Source source = addSource(EngineTestCase.createSource(["class B {", " B() = A;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.REDIRECT_TO_NON_CLASS]);
+ verify([source]);
+ }
void test_returnWithoutValue() {
Source source = addSource(EngineTestCase.createSource(["int f() { return; }"]));
resolve(source);
@@ -8187,6 +8192,12 @@
assertErrors([StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]);
verify([source]);
}
+ void test_typeTestNonType() {
+ Source source = addSource(EngineTestCase.createSource(["var A = 0;", "f(var p) {", " if (p is A) {", " }", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.TYPE_TEST_NON_TYPE]);
+ verify([source]);
+ }
void test_undefinedClass_instanceCreation() {
Source source = addSource(EngineTestCase.createSource(["f() { new C(); }"]));
resolve(source);
@@ -8328,6 +8339,10 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_caseBlockNotTerminated);
});
+ _ut.test('test_castToNonType', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_castToNonType);
+ });
_ut.test('test_concreteClassWithAbstractMember', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_concreteClassWithAbstractMember);
@@ -8404,13 +8419,41 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_fieldInitializingFormalNotAssignable);
});
+ _ut.test('test_finalNotInitialized_instanceField_const_static', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_const_static);
+ });
+ _ut.test('test_finalNotInitialized_instanceField_final', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final);
+ });
+ _ut.test('test_finalNotInitialized_instanceField_final_static', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalNotInitialized_instanceField_final_static);
+ });
+ _ut.test('test_finalNotInitialized_library_const', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalNotInitialized_library_const);
+ });
+ _ut.test('test_finalNotInitialized_library_final', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalNotInitialized_library_final);
+ });
+ _ut.test('test_finalNotInitialized_local_const', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalNotInitialized_local_const);
+ });
+ _ut.test('test_finalNotInitialized_local_final', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalNotInitialized_local_final);
+ });
_ut.test('test_importDuplicatedLibraryName', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_importDuplicatedLibraryName);
});
- _ut.test('test_inconsistentMethodInheritance', () {
+ _ut.test('test_inconsistentMethodInheritanceGetterAndMethod', () {
final __test = new StaticWarningCodeTest();
- runJUnitTest(__test, __test.test_inconsistentMethodInheritance);
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritanceGetterAndMethod);
});
_ut.test('test_instanceMethodNameCollidesWithSuperclassStatic_field', () {
final __test = new StaticWarningCodeTest();
@@ -8536,6 +8579,10 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberOne_method_fromSuperclass);
});
+ _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_method_optionalParamCount', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberOne_method_optionalParamCount);
+ });
_ut.test('test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface);
@@ -8588,6 +8635,18 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_redirectToInvalidReturnType);
});
+ _ut.test('test_redirectToMissingConstructor_named', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_redirectToMissingConstructor_named);
+ });
+ _ut.test('test_redirectToMissingConstructor_unnamed', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_redirectToMissingConstructor_unnamed);
+ });
+ _ut.test('test_redirectToNonClass', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_redirectToNonClass);
+ });
_ut.test('test_returnWithoutValue', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_returnWithoutValue);
@@ -8616,6 +8675,10 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_switchExpressionNotAssignable);
});
+ _ut.test('test_typeTestNonType', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_typeTestNonType);
+ });
_ut.test('test_undefinedClassBoolean_variableDeclaration', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedClassBoolean_variableDeclaration);
diff --git a/pkg/crypto/lib/crypto.dart b/pkg/crypto/lib/crypto.dart
index 1b764ae..f5f737b 100644
--- a/pkg/crypto/lib/crypto.dart
+++ b/pkg/crypto/lib/crypto.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library dart.crypto;
+library crypto;
import 'dart:math';
@@ -54,75 +54,9 @@
}
/**
- * SHA1 hash function implementation.
- */
-abstract class SHA1 implements Hash {
- factory SHA1() => new _SHA1();
-}
-
-/**
- * SHA256 hash function implementation.
- */
-abstract class SHA256 implements Hash {
- factory SHA256() => new _SHA256();
-}
-
-/**
- * MD5 hash function implementation.
- *
- * WARNING: MD5 has known collisions and should only be used when
- * required for backwards compatibility.
- */
-abstract class MD5 implements Hash {
- factory MD5() => new _MD5();
-}
-
-/**
- * Hash-based Message Authentication Code support.
- *
- * The [add] method is used to add data to the message. The [digest] and
- * [close] methods are used to extract the message authentication code.
- */
-// TODO(floitsch): make Hash implement Sink, EventSink or similar.
-abstract class HMAC {
- /**
- * Create an [HMAC] object from a [Hash] and a key.
- */
- factory HMAC(Hash hash, List<int> key) => new _HMAC(hash, key);
-
- /**
- * Add a list of bytes to the message.
- */
- add(List<int> data);
-
- /**
- * Perform the actual computation and extract the message digest
- * as a list of bytes.
- */
- List<int> close();
-
- /**
- * Extract the message digest as a list of bytes without closing [this].
- */
- List<int> get digest;
-
- /**
- * Verify that the HMAC computed for the data so far matches the
- * given message digest.
- *
- * This method should be used instead of memcmp-style comparisons
- * to avoid leaking information via timing.
- *
- * Throws an exception if the given digest does not have the same
- * size as the digest computed by this HMAC instance.
- */
- bool verify(List<int> digest);
-}
-
-/**
* Utility methods for working with message digests.
*/
-abstract class CryptoUtils {
+class CryptoUtils {
/**
* Convert a list of bytes (for example a message digest) into a hex
* string.
@@ -157,26 +91,15 @@
/**
* Converts a Base 64 encoded String into list of bytes.
*
- * Decoder ignores "\r\n" sequences from input. By default it also ignores
- * all illegal characters unless [ignoreInvalidCharacters] is false.
+ * Decoder ignores "\r\n" sequences from input.
*
* Accepts both URL safe and unsafe Base 64 encoded strings.
*
+ * Throws a FormatException exception if input contains invalid characters.
+ *
* Based on [RFC 4648](http://tools.ietf.org/html/rfc4648)
*/
- static List<int> base64StringToBytes(String input,
- {bool ignoreInvalidCharacters : true}) {
- return _CryptoUtils.base64StringToBytes(input, ignoreInvalidCharacters);
+ static List<int> base64StringToBytes(String input) {
+ return _CryptoUtils.base64StringToBytes(input);
}
}
-
-/**
- * HashExceptions are thrown on invalid use of a Hash
- * object.
- */
-class HashException {
- HashException(String this.message);
- toString() => "HashException: $message";
- String message;
-}
-
diff --git a/pkg/crypto/lib/src/crypto_utils.dart b/pkg/crypto/lib/src/crypto_utils.dart
index e08bbdd..b593c0d 100644
--- a/pkg/crypto/lib/src/crypto_utils.dart
+++ b/pkg/crypto/lib/src/crypto_utils.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of dart.crypto;
+part of crypto;
abstract class _CryptoUtils {
static String bytesToHex(List<int> bytes) {
@@ -104,21 +104,20 @@
return new String.fromCharCodes(out);
}
- static List<int> base64StringToBytes(String input,
- [bool ignoreInvalidCharacters = true]) {
+ static List<int> base64StringToBytes(String input) {
int len = input.length;
if (len == 0) {
return new List<int>(0);
}
// Count '\r', '\n' and illegal characters, For illegal characters,
- // if [ignoreInvalidCharacters] is false, throw an exception.
+ // throw an exception.
int extrasLen = 0;
for (int i = 0; i < len; i++) {
int c = _decodeTable[input.codeUnitAt(i)];
if (c < 0) {
extrasLen++;
- if(c == -2 && !ignoreInvalidCharacters) {
+ if(c == -2) {
throw new FormatException('Invalid character: ${input[i]}');
}
}
@@ -129,7 +128,7 @@
must be a multiple of 4. Input: $input''');
}
- // Count pad characters, ignore illegal characters at the end.
+ // Count pad characters.
int padLength = 0;
for (int i = len - 1; i >= 0; i--) {
int currentCodeUnit = input.codeUnitAt(i);
diff --git a/pkg/crypto/lib/src/hash_utils.dart b/pkg/crypto/lib/src/hash_utils.dart
index 4188c52..713dbb9 100644
--- a/pkg/crypto/lib/src/hash_utils.dart
+++ b/pkg/crypto/lib/src/hash_utils.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of dart.crypto;
+part of crypto;
// Constants.
const _MASK_8 = 0xff;
@@ -33,7 +33,7 @@
// Update the hasher with more data.
add(List<int> data) {
if (_digestCalled) {
- throw new HashException(
+ throw new StateError(
'Hash update method called after digest was retrieved');
}
_lengthInBytes += data.length;
diff --git a/pkg/crypto/lib/src/hmac.dart b/pkg/crypto/lib/src/hmac.dart
index 794746d..59c1771 100644
--- a/pkg/crypto/lib/src/hmac.dart
+++ b/pkg/crypto/lib/src/hmac.dart
@@ -2,18 +2,34 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of dart.crypto;
+part of crypto;
-class _HMAC implements HMAC {
+/**
+ * Hash-based Message Authentication Code support.
+ *
+ * The [add] method is used to add data to the message. The [digest] and
+ * [close] methods are used to extract the message authentication code.
+ */
+// TODO(floitsch): make Hash implement Sink, EventSink or similar.
+class HMAC {
bool _isClosed = false;
- _HMAC(Hash this._hash, List<int> this._key) : _message = [];
+ /**
+ * Create an [HMAC] object from a [Hash] and a key.
+ */
+ HMAC(Hash this._hash, List<int> this._key) : _message = [];
+ /**
+ * Add a list of bytes to the message.
+ */
add(List<int> data) {
if (_isClosed) throw new StateError("HMAC is closed");
_message.addAll(data);
}
+ /**
+ * Extract the message digest as a list of bytes without closing [this].
+ */
List<int> get digest {
var blockSize = _hash.blockSize;
@@ -58,11 +74,25 @@
return _hash.close();
}
+ /**
+ * Perform the actual computation and extract the message digest
+ * as a list of bytes.
+ */
List<int> close() {
_isClosed = true;
return digest;
}
+ /**
+ * Verify that the HMAC computed for the data so far matches the
+ * given message digest.
+ *
+ * This method should be used instead of memcmp-style comparisons
+ * to avoid leaking information via timing.
+ *
+ * Throws an exception if the given digest does not have the same
+ * size as the digest computed by this HMAC instance.
+ */
bool verify(List<int> digest) {
var computedDigest = this.digest;
if (digest.length != computedDigest.length) {
diff --git a/pkg/crypto/lib/src/md5.dart b/pkg/crypto/lib/src/md5.dart
index 7763832..6acf384 100644
--- a/pkg/crypto/lib/src/md5.dart
+++ b/pkg/crypto/lib/src/md5.dart
@@ -2,11 +2,16 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of dart.crypto;
+part of crypto;
-// The MD5 hasher is used to compute an MD5 message digest.
-class _MD5 extends _HashBase implements MD5 {
- _MD5() : super(16, 4, false) {
+/**
+ * MD5 hash function implementation.
+ *
+ * WARNING: MD5 has known collisions and should only be used when
+ * required for backwards compatibility.
+ */
+class MD5 extends _HashBase {
+ MD5() : super(16, 4, false) {
_h[0] = 0x67452301;
_h[1] = 0xefcdab89;
_h[2] = 0x98badcfe;
diff --git a/pkg/crypto/lib/src/sha1.dart b/pkg/crypto/lib/src/sha1.dart
index 8ee28ce..f08c987 100644
--- a/pkg/crypto/lib/src/sha1.dart
+++ b/pkg/crypto/lib/src/sha1.dart
@@ -2,12 +2,14 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of dart.crypto;
+part of crypto;
-// The SHA1 hasher is used to compute an SHA1 message digest.
-class _SHA1 extends _HashBase implements SHA1 {
+/**
+ * SHA1 hash function implementation.
+ */
+class SHA1 extends _HashBase {
// Construct a SHA1 hasher object.
- _SHA1() : _w = new List(80), super(16, 5, true) {
+ SHA1() : _w = new List(80), super(16, 5, true) {
_h[0] = 0x67452301;
_h[1] = 0xEFCDAB89;
_h[2] = 0x98BADCFE;
diff --git a/pkg/crypto/lib/src/sha256.dart b/pkg/crypto/lib/src/sha256.dart
index 3df0ffd..f1c20e3 100644
--- a/pkg/crypto/lib/src/sha256.dart
+++ b/pkg/crypto/lib/src/sha256.dart
@@ -2,12 +2,14 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of dart.crypto;
+part of crypto;
-// The SHA256 hasher is used to compute an SHA256 message digest.
-class _SHA256 extends _HashBase implements SHA256 {
+/**
+ * SHA256 hash function implementation.
+ */
+class SHA256 extends _HashBase {
// Construct a SHA256 hasher object.
- _SHA256() : _w = new List(64), super(16, 8, true) {
+ SHA256() : _w = new List(64), super(16, 8, true) {
// Initial value of the hash parts. First 32 bits of the fractional parts
// of the square roots of the first 8 prime numbers.
_h[0] = 0x6a09e667;
diff --git a/pkg/crypto/pubspec.yaml b/pkg/crypto/pubspec.yaml
index cc3c47d..3fd7917 100644
--- a/pkg/crypto/pubspec.yaml
+++ b/pkg/crypto/pubspec.yaml
@@ -1,5 +1,6 @@
name: crypto
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
+documentation: http://api.dartlang.org/docs/pkg/crypto
description: >
Library of cryptographic functions.
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 06ccb56..0f21f41 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -116,6 +116,10 @@
unittest/test/mock_regexp_negative_test: fail
unittest/test/mock_stepwise_negative_test: fail
+[ $compiler == dart2analyzer ]
+unittest/test/mock_regexp_negative_test: fail
+unittest/test/mock_stepwise_negative_test: fail
+
[ $compiler == dart2js ]
unittest/test/instance_test: Skip
diff --git a/pkg/unittest/lib/test_controller.js b/pkg/unittest/lib/test_controller.js
index f3932d3..145173a 100644
--- a/pkg/unittest/lib/test_controller.js
+++ b/pkg/unittest/lib/test_controller.js
@@ -121,9 +121,6 @@
window.postMessage('unittest-suite-external-error', '*');
}
-// If nobody intercepts the error, finish the test.
-window.addEventListener("error", externalError, false);
-
document.addEventListener('readystatechange', function () {
if (document.readyState != "loaded") return;
// If 'startedDartTest' is not set, that means that the test did not have
diff --git a/runtime/lib/double.cc b/runtime/lib/double.cc
index 35d52ba..04006e5 100644
--- a/runtime/lib/double.cc
+++ b/runtime/lib/double.cc
@@ -83,6 +83,7 @@
return big.AsValidInteger();
}
+
DEFINE_NATIVE_ENTRY(Double_trunc_div, 2) {
double left = Double::CheckedHandle(arguments->NativeArgAt(0)).value();
GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart
index e365f30..fc7797f 100644
--- a/runtime/lib/regexp_patch.dart
+++ b/runtime/lib/regexp_patch.dart
@@ -13,21 +13,21 @@
}
class _JSRegExpMatch implements Match {
- _JSRegExpMatch(this.regexp, this.str, this._match);
+ _JSRegExpMatch(this._regexp, this.str, this._match);
int get start => _start(0);
int get end => _end(0);
int _start(int groupIdx) {
- return _match[(groupIdx * MATCH_PAIR)];
+ return _match[(groupIdx * _MATCH_PAIR)];
}
int _end(int groupIdx) {
- return _match[(groupIdx * MATCH_PAIR) + 1];
+ return _match[(groupIdx * _MATCH_PAIR) + 1];
}
String group(int groupIdx) {
- if (groupIdx < 0 || groupIdx > regexp._groupCount) {
+ if (groupIdx < 0 || groupIdx > _regexp._groupCount) {
throw new RangeError.value(groupIdx);
}
int startIndex = _start(groupIdx);
@@ -51,14 +51,14 @@
return groupsList;
}
- int get groupCount => regexp._groupCount;
+ int get groupCount => _regexp._groupCount;
- String get pattern => regexp.pattern;
+ Pattern get pattern => _regexp;
- final RegExp regexp;
+ final RegExp _regexp;
final String str;
final List<int> _match;
- static const int MATCH_PAIR = 2;
+ static const int _MATCH_PAIR = 2;
}
@@ -78,25 +78,7 @@
Iterable<Match> allMatches(String str) {
if (str is! String) throw new ArgumentError(str);
- List<Match> result = new List<Match>();
- int length = str.length;
- int startIndex = 0;
- while (true) {
- List match = _ExecuteMatch(str, startIndex);
- if (match == null) {
- break;
- }
- result.add(new _JSRegExpMatch(this, str, match));
- int endIndex = match[1];
- if (endIndex == length) {
- break;
- } else if (match[0] == endIndex) {
- ++startIndex; // empty match, advance and restart
- } else {
- startIndex = endIndex;
- }
- }
- return result;
+ return new _AllMatchesIterable(this, str);
}
bool hasMatch(String str) {
@@ -123,3 +105,47 @@
List _ExecuteMatch(String str, int start_index)
native "JSSyntaxRegExp_ExecuteMatch";
}
+
+class _AllMatchesIterable extends IterableBase<Match> {
+ final _JSSyntaxRegExp _re;
+ final String _str;
+
+ const _AllMatchesIterable(this._re, this._str);
+
+ Iterator<Match> get iterator => new _AllMatchesIterator(_re, _str);
+}
+
+class _AllMatchesIterator implements Iterator<Match> {
+ final String _str;
+ _JSSyntaxRegExp _re;
+ Match _current;
+
+ _AllMatchesIterator(this._re, this._str);
+
+ Match get current => _current;
+
+ bool moveNext() {
+ if (_re == null) return false; // Cleared after a failed match.
+ int nextIndex = 0;
+ if (_current != null) {
+ nextIndex = _current.end;
+ if (nextIndex == _current.start) {
+ // Zero-width match. Advance by one more.
+ nextIndex++;
+ if (nextIndex > _str.length) {
+ _re = null;
+ _current = null;
+ return false;
+ }
+ }
+ }
+ var match = _re._ExecuteMatch(_str, nextIndex);
+ if (match == null) {
+ _current = null;
+ _re = null;
+ return false;
+ }
+ _current = new _JSRegExpMatch(_re, _str, match);
+ return true;
+ }
+}
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 0707a5f..3cdb2a1 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -267,9 +267,12 @@
bool contains(Pattern pattern, [int startIndex = 0]) {
if (pattern is String) {
+ if (startIndex < 0 || startIndex > this.length) {
+ throw new RangeError.range(startIndex, 0, this.length);
+ }
return indexOf(pattern, startIndex) >= 0;
}
- return pattern.allMatches(this.substring(startIndex)).iterator.moveNext();
+ return pattern.allMatches(this.substring(startIndex)).isNotEmpty;
}
String replaceFirst(Pattern pattern, String replacement) {
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index dedbd9c..9130d89 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -86,3 +86,7 @@
# has compilation error, as designed
dart/isolate_mirror_local_test: fail
+[ $compiler == dart2analyzer ]
+# has compilation error, as designed
+dart/isolate_mirror_local_test: fail
+
diff --git a/runtime/vm/assembler_arm_test.cc b/runtime/vm/assembler_arm_test.cc
index 0c0296d..9e54e5a 100644
--- a/runtime/vm/assembler_arm_test.cc
+++ b/runtime/vm/assembler_arm_test.cc
@@ -239,8 +239,8 @@
ASSEMBLER_TEST_RUN(DoubleSqrtNeg, test) {
EXPECT(test != NULL);
- typedef double (*DoubleFPOperations)();
- EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleFPOperations, test->entry()));
+ typedef int (*DoubleSqrtNeg)();
+ EXPECT_EQ(1, EXECUTE_TEST_CODE_INT32(DoubleSqrtNeg, test->entry()));
}
diff --git a/runtime/vm/ast.cc b/runtime/vm/ast.cc
index 77f14fd..48df7e3 100644
--- a/runtime/vm/ast.cc
+++ b/runtime/vm/ast.cc
@@ -77,7 +77,7 @@
: AstNode(token_pos),
vars_(1),
initializers_(1),
- body_(NULL) { }
+ nodes_(1) { }
LocalVariable* LetNode::AddInitializer(AstNode* node) {
@@ -97,7 +97,9 @@
for (intptr_t i = 0; i < num_temps(); ++i) {
initializers_[i]->Visit(visitor);
}
- body_->Visit(visitor);
+ for (intptr_t i = 0; i < nodes_.length(); ++i) {
+ nodes_[i]->Visit(visitor);
+ }
}
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index 43fe8b2..c679d2a 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -56,7 +56,6 @@
V(StoreIndexedNode, "store indexed") \
V(SequenceNode, "seq") \
V(LetNode, "let") \
- V(CommaNode, "comma") \
V(CatchClauseNode, "catch clause block") \
V(TryCatchNode, "try catch block") \
V(ThrowNode, "throw") \
@@ -182,35 +181,6 @@
};
-// Comma node represents a pair of expressions evaluated in sequence
-// and return the value of the second expression.
-class CommaNode : public AstNode {
- public:
- CommaNode(intptr_t token_pos,
- AstNode* first,
- AstNode* second)
- : AstNode(token_pos),
- first_(first),
- second_(second) { }
-
- AstNode* first() const { return first_; }
- AstNode* second() const { return second_; }
-
- void VisitChildren(AstNodeVisitor* visitor) const {
- first_->Visit(visitor);
- second_->Visit(visitor);
- }
-
- DECLARE_COMMON_NODE_FUNCTIONS(CommaNode);
-
- private:
- AstNode* first_;
- AstNode* second_;
-
- DISALLOW_COPY_AND_ASSIGN(CommaNode);
-};
-
-
class CloneContextNode : public AstNode {
public:
explicit CloneContextNode(intptr_t token_pos)
@@ -303,13 +273,14 @@
LocalVariable* AddInitializer(AstNode* node);
+ const GrowableArray<AstNode*>& nodes() const { return nodes_; }
+
+ void AddNode(AstNode* node) { nodes_.Add(node); }
+
intptr_t num_temps() const {
return vars_.length();
}
- AstNode* body() const { return body_; }
- void set_body(AstNode* node) { body_ = node; }
-
void VisitChildren(AstNodeVisitor* visitor) const;
DECLARE_COMMON_NODE_FUNCTIONS(LetNode);
@@ -317,7 +288,7 @@
private:
GrowableArray<LocalVariable*> vars_;
GrowableArray<AstNode*> initializers_;
- AstNode* body_;
+ GrowableArray<AstNode*> nodes_;
DISALLOW_COPY_AND_ASSIGN(LetNode);
};
diff --git a/runtime/vm/ast_printer.cc b/runtime/vm/ast_printer.cc
index 9bf4816..58fce94 100644
--- a/runtime/vm/ast_printer.cc
+++ b/runtime/vm/ast_printer.cc
@@ -38,11 +38,6 @@
}
-void AstPrinter::VisitCommaNode(CommaNode* node) {
- VisitGenericAstNode(node);
-}
-
-
void AstPrinter::VisitCloneContextNode(CloneContextNode* node) {
VisitGenericAstNode(node);
}
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index 3badf77..ba6b949 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -59,7 +59,9 @@
const int kNumIterations = 100;
char* err = NULL;
Dart_Isolate base_isolate = Dart_CurrentIsolate();
- Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &err);
+ Dart_Isolate test_isolate = Dart_CreateIsolate(NULL, NULL,
+ bin::snapshot_buffer,
+ NULL, &err);
EXPECT(test_isolate != NULL);
Dart_EnterScope();
uint8_t* buffer = NULL;
diff --git a/runtime/vm/bit_vector.cc b/runtime/vm/bit_vector.cc
index b97c18e..90c074a 100644
--- a/runtime/vm/bit_vector.cc
+++ b/runtime/vm/bit_vector.cc
@@ -55,8 +55,10 @@
for (intptr_t i = 0; i < data_length_; i++) {
const uword before = data_[i];
const uword after = data_[i] | from->data_[i];
- if (before != after) changed = true;
- data_[i] = after;
+ if (before != after) {
+ changed = true;
+ data_[i] = after;
+ }
}
return changed;
}
@@ -68,8 +70,10 @@
for (intptr_t i = 0; i < data_length_; i++) {
const uword before = data_[i];
const uword after = data_[i] & ~from->data_[i];
- if (before != after) changed = true;
- data_[i] = after;
+ if (before != after) {
+ changed = true;
+ data_[i] = after;
+ }
}
return changed;
}
diff --git a/runtime/vm/bitmap.cc b/runtime/vm/bitmap.cc
index ae114d8..e2d5fe6e 100644
--- a/runtime/vm/bitmap.cc
+++ b/runtime/vm/bitmap.cc
@@ -32,7 +32,9 @@
bool BitmapBuilder::Get(intptr_t bit_offset) const {
- ASSERT(InRange(bit_offset));
+ if (!InRange(bit_offset)) {
+ return false;
+ }
intptr_t byte_offset = bit_offset >> kBitsPerByteLog2;
// Bits not covered by the backing store are implicitly false.
return (byte_offset < data_size_in_bytes_) && GetBit(bit_offset);
@@ -40,7 +42,6 @@
void BitmapBuilder::Set(intptr_t bit_offset, bool value) {
- ASSERT(bit_offset >= 0);
if (!InRange(bit_offset)) {
length_ = bit_offset + 1;
// Bits not covered by the backing store are implicitly false.
@@ -72,7 +73,9 @@
bool BitmapBuilder::GetBit(intptr_t bit_offset) const {
- ASSERT(InRange(bit_offset));
+ if (!InRange(bit_offset)) {
+ return false;
+ }
intptr_t byte_offset = bit_offset >> kBitsPerByteLog2;
ASSERT(byte_offset < data_size_in_bytes_);
intptr_t bit_remainder = bit_offset & (kBitsPerByte - 1);
@@ -83,7 +86,10 @@
void BitmapBuilder::SetBit(intptr_t bit_offset, bool value) {
- ASSERT(InRange(bit_offset));
+ if (!InRange(bit_offset)) {
+ FATAL1("Fatal error in BitmapBuilder::SetBit :"
+ " invalid bit_offset, %"Pd"\n", bit_offset);
+ }
int byte_offset = bit_offset >> kBitsPerByteLog2;
ASSERT(byte_offset < data_size_in_bytes_);
int bit_remainder = bit_offset & (kBitsPerByte - 1);
diff --git a/runtime/vm/bitmap.h b/runtime/vm/bitmap.h
index f0304d0..bf8e437 100644
--- a/runtime/vm/bitmap.h
+++ b/runtime/vm/bitmap.h
@@ -52,7 +52,11 @@
static const intptr_t kIncrementSizeInBytes = 16;
bool InRange(intptr_t offset) const {
- return (offset >= 0) && (offset < length_);
+ if (offset < 0) {
+ FATAL1("Fatal error in BitmapBuilder::InRange :"
+ " invalid bit_offset, %"Pd"\n", offset);
+ }
+ return (offset < length_);
}
// Get/Set a bit that is known to be covered by the backing store.
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 05e4b78..a2f37fb 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -445,6 +445,10 @@
sinking->Optimize();
}
+ // Ensure that all phis inserted by optimization passes have consistent
+ // representations.
+ optimizer.UnboxPhis();
+
if (optimizer.Canonicalize()) {
// To fully remove redundant boxing (e.g. BoxDouble used only in
// environments and UnboxDouble instructions) instruction we
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index e77d6df..250f714 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -2632,7 +2632,7 @@
intptr_t mydata = 12345;
char* err;
Dart_Isolate isolate =
- Dart_CreateIsolate(NULL, NULL, NULL,
+ Dart_CreateIsolate(NULL, NULL, bin::snapshot_buffer,
reinterpret_cast<void*>(mydata),
&err);
EXPECT(isolate != NULL);
@@ -6685,7 +6685,9 @@
{
sync->Enter();
char* error = NULL;
- shared_isolate = Dart_CreateIsolate(NULL, NULL, NULL, NULL, &error);
+ shared_isolate = Dart_CreateIsolate(NULL, NULL,
+ bin::snapshot_buffer,
+ NULL, &error);
EXPECT(shared_isolate != NULL);
Dart_EnterScope();
Dart_Handle url = NewString(TestCase::url());
@@ -6809,7 +6811,9 @@
// Create an isolate.
char* err;
- Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL, NULL, my_data, &err);
+ Dart_Isolate isolate = Dart_CreateIsolate(NULL, NULL,
+ bin::snapshot_buffer,
+ my_data, &err);
if (isolate == NULL) {
OS::Print("Creation of isolate failed '%s'\n", err);
free(err);
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 280bd6e..9cc15fd 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -604,6 +604,10 @@
library = Library::IsolateLibrary();
class_name = &Symbols::IsolateUnhandledException();
break;
+ case kFiftyThreeBitOverflowError:
+ library = Library::CoreLibrary();
+ class_name = &Symbols::FiftyThreeBitOverflowError();
+ break;
}
return DartLibraryCalls::ExceptionCreate(library,
diff --git a/runtime/vm/exceptions.h b/runtime/vm/exceptions.h
index e74a0db..b762627 100644
--- a/runtime/vm/exceptions.h
+++ b/runtime/vm/exceptions.h
@@ -59,7 +59,8 @@
kInternalError,
kNullThrown,
kIsolateSpawn,
- kIsolateUnhandledException
+ kIsolateUnhandledException,
+ kFiftyThreeBitOverflowError,
};
static void ThrowByType(ExceptionType type, const Array& arguments);
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index ed90651..a524b8e 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -1877,29 +1877,53 @@
void EffectGraphVisitor::VisitLetNode(LetNode* node) {
- BuildLetTempExpressions(node);
intptr_t num_temps = node->num_temps();
+ if (num_temps > 0) {
+ BuildLetTempExpressions(node);
+ // TODO(fschneider): Generate better code for effect context by visiting the
+ // body for effect. Currently, the value of the body expression is
+ // materialized and then dropped. This also requires changing DropTempsInstr
+ // to have zero or one inputs.
- // TODO(fschneider): Generate better code for effect context by visiting the
- // body for effect. Currently, the value of the body expression is
- // materialized and then dropped. This also requires changing DropTempsInstr
- // to have zero or one inputs.
- ValueGraphVisitor for_value(owner(), temp_index());
- node->body()->Visit(&for_value);
- Append(for_value);
- Value* result_value = for_value.value();
- DeallocateTempIndex(num_temps);
- Do(new DropTempsInstr(num_temps, result_value));
+ // Visit body.
+ for (intptr_t i = 0; i < node->nodes().length() - 1; ++i) {
+ EffectGraphVisitor for_effect(owner(), temp_index());
+ node->nodes()[i]->Visit(&for_effect);
+ Append(for_effect);
+ }
+ // Visit the last body expression for value.
+ ValueGraphVisitor for_value(owner(), temp_index());
+ node->nodes().Last()->Visit(&for_value);
+ Append(for_value);
+ Value* result_value = for_value.value();
+ DeallocateTempIndex(num_temps);
+ Do(new DropTempsInstr(num_temps, result_value));
+ } else {
+ ASSERT(num_temps == 0);
+ for (intptr_t i = 0; i < node->nodes().length(); ++i) {
+ EffectGraphVisitor for_effect(owner(), temp_index());
+ node->nodes()[i]->Visit(&for_effect);
+ Append(for_effect);
+ }
+ }
}
void ValueGraphVisitor::VisitLetNode(LetNode* node) {
BuildLetTempExpressions(node);
+ // Visit body.
+ for (intptr_t i = 0; i < node->nodes().length() - 1; ++i) {
+ EffectGraphVisitor for_effect(owner(), temp_index());
+ node->nodes()[i]->Visit(&for_effect);
+ Append(for_effect);
+ }
+ // Visit the last body expression for value.
ValueGraphVisitor for_value(owner(), temp_index());
- node->body()->Visit(&for_value);
+ node->nodes().Last()->Visit(&for_value);
Append(for_value);
Value* result_value = for_value.value();
+
intptr_t num_temps = node->num_temps();
if (num_temps > 0) {
DeallocateTempIndex(num_temps);
@@ -3215,29 +3239,6 @@
}
-void EffectGraphVisitor::VisitCommaNode(CommaNode* node) {
- EffectGraphVisitor for_effect_first(owner(), temp_index());
- node->first()->Visit(&for_effect_first);
- Append(for_effect_first);
-
- EffectGraphVisitor for_effect_second(owner(), temp_index());
- node->second()->Visit(&for_effect_second);
- Append(for_effect_second);
-}
-
-
-void ValueGraphVisitor::VisitCommaNode(CommaNode* node) {
- EffectGraphVisitor for_effect(owner(), temp_index());
- node->first()->Visit(&for_effect);
- Append(for_effect);
-
- ValueGraphVisitor for_value(owner(), temp_index());
- node->second()->Visit(&for_value);
- Append(for_value);
- ReturnValue(for_value.value());
-}
-
-
void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
InlineBailout("EffectGraphVisitor::VisitTryCatchNode (exception)");
intptr_t old_try_index = owner()->try_index();
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index e087659..e3d2acf 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -418,7 +418,6 @@
virtual void VisitStaticSetterNode(StaticSetterNode* node);
virtual void VisitStoreStaticFieldNode(StoreStaticFieldNode* node);
virtual void VisitTypeNode(TypeNode* node);
- virtual void VisitCommaNode(CommaNode* node);
virtual void VisitLetNode(LetNode* node);
Value* value() const { return value_; }
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index a42ed3b..d282034 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -28,6 +28,7 @@
DECLARE_FLAG(bool, print_scopes);
DECLARE_FLAG(bool, enable_type_checks);
DECLARE_FLAG(bool, eliminate_type_checks);
+DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
FlowGraphCompiler::~FlowGraphCompiler() {
@@ -42,7 +43,8 @@
bool FlowGraphCompiler::SupportsUnboxedMints() {
// Support unboxed mints when SSE 4.1 is available.
- return FLAG_unbox_mints && CPUFeatures::sse4_1_supported();
+ return FLAG_unbox_mints && CPUFeatures::sse4_1_supported() &&
+ !FLAG_throw_on_javascript_int_overflow;
}
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 8eb247b..c2379c3 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -25,7 +25,7 @@
// Flags for inlining heuristics.
DEFINE_FLAG(int, inlining_depth_threshold, 3,
"Inline function calls up to threshold nesting depth");
-DEFINE_FLAG(int, inlining_size_threshold, 20,
+DEFINE_FLAG(int, inlining_size_threshold, 22,
"Always inline functions that have threshold or fewer instructions");
DEFINE_FLAG(int, inlining_callee_call_sites_threshold, 1,
"Always inline functions containing threshold or fewer calls.");
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index f22e386..6087381 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -390,53 +390,104 @@
}
+void FlowGraphOptimizer::ConvertUse(Value* use, Representation from_rep) {
+ const Representation to_rep =
+ use->instruction()->RequiredInputRepresentation(use->use_index());
+ if (from_rep == to_rep || to_rep == kNoRepresentation) {
+ return;
+ }
+
+ Instruction* insert_before;
+ Instruction* deopt_target;
+ PhiInstr* phi = use->instruction()->AsPhi();
+ if (phi != NULL) {
+ ASSERT(phi->is_alive());
+ // For phis conversions have to be inserted in the predecessor.
+ insert_before =
+ phi->block()->PredecessorAt(use->use_index())->last_instruction();
+ deopt_target = NULL;
+ } else {
+ deopt_target = insert_before = use->instruction();
+ }
+
+ InsertConversion(from_rep, to_rep, use, insert_before, deopt_target);
+}
+
void FlowGraphOptimizer::InsertConversionsFor(Definition* def) {
const Representation from_rep = def->representation();
for (Value::Iterator it(def->input_use_list());
!it.Done();
it.Advance()) {
- Value* use = it.Current();
- const Representation to_rep =
- use->instruction()->RequiredInputRepresentation(use->use_index());
- if (from_rep == to_rep || to_rep == kNoRepresentation) {
- continue;
- }
+ ConvertUse(it.Current(), from_rep);
+ }
+}
- Instruction* insert_before;
- Instruction* deopt_target;
- PhiInstr* phi = use->instruction()->AsPhi();
- if (phi != NULL) {
- ASSERT(phi->is_alive());
- // For phis conversions have to be inserted in the predecessor.
- insert_before =
- phi->block()->PredecessorAt(use->use_index())->last_instruction();
- deopt_target = NULL;
- } else {
- deopt_target = insert_before = use->instruction();
- }
- InsertConversion(from_rep, to_rep, use, insert_before, deopt_target);
+// Returns true if phi's representation was changed.
+static bool UnboxPhi(PhiInstr* phi) {
+ Representation current = phi->representation();
+ Representation unboxed = current;
+
+ switch (phi->Type()->ToCid()) {
+ case kDoubleCid:
+ unboxed = kUnboxedDouble;
+ break;
+ case kFloat32x4Cid:
+ unboxed = kUnboxedFloat32x4;
+ break;
+ case kUint32x4Cid:
+ unboxed = kUnboxedUint32x4;
+ break;
+ }
+
+ if (unboxed != current) {
+ phi->set_representation(unboxed);
+ return true;
+ }
+
+ return false;
+}
+
+
+void FlowGraphOptimizer::UnboxPhis() {
+ GrowableArray<PhiInstr*> worklist(5);
+
+ // Convervatively unbox all phis that were proven to be of Double,
+ // Float32x4, or Uint32x4 type.
+ for (intptr_t i = 0; i < block_order_.length(); ++i) {
+ JoinEntryInstr* join_entry = block_order_[i]->AsJoinEntry();
+ if (join_entry != NULL) {
+ for (PhiIterator it(join_entry); !it.Done(); it.Advance()) {
+ PhiInstr* phi = it.Current();
+ if (UnboxPhi(phi)) {
+ worklist.Add(phi);
+ }
+ }
+ }
+ }
+
+ while (!worklist.is_empty()) {
+ PhiInstr* phi = worklist.RemoveLast();
+ InsertConversionsFor(phi);
+
+ for (intptr_t i = 0; i < phi->InputCount(); i++) {
+ ConvertUse(phi->InputAt(i),
+ phi->InputAt(i)->definition()->representation());
+ }
}
}
void FlowGraphOptimizer::SelectRepresentations() {
// Convervatively unbox all phis that were proven to be of Double,
- // Float32x4, or Uint32x4.
+ // Float32x4, or Uint32x4 type.
for (intptr_t i = 0; i < block_order_.length(); ++i) {
JoinEntryInstr* join_entry = block_order_[i]->AsJoinEntry();
if (join_entry != NULL) {
for (PhiIterator it(join_entry); !it.Done(); it.Advance()) {
PhiInstr* phi = it.Current();
- ASSERT(phi != NULL);
- if (phi->Type()->ToCid() == kDoubleCid) {
- phi->set_representation(kUnboxedDouble);
- } else if (phi->Type()->ToCid() == kFloat32x4Cid) {
- phi->set_representation(kUnboxedFloat32x4);
- } else if (phi->Type()->ToCid() == kUint32x4Cid) {
- phi->set_representation(kUnboxedUint32x4);
- }
+ UnboxPhi(phi);
}
}
}
@@ -706,7 +757,6 @@
InsertBefore(call,
new CheckArrayBoundInstr(new Value(length),
new Value(*index),
- class_id,
call),
call->env(),
Definition::kEffect);
@@ -1586,7 +1636,6 @@
InsertBefore(call,
new CheckArrayBoundInstr(new Value(length),
new Value(index),
- cid,
call),
call->env(),
Definition::kEffect);
@@ -2185,7 +2234,6 @@
InsertBefore(call,
new CheckArrayBoundInstr(new Value(len_in_bytes),
new Value(byte_index),
- receiver_cid,
call),
call->env(),
Definition::kEffect);
@@ -3070,10 +3118,6 @@
void RangeAnalysis::ConstrainValueAfterCheckArrayBound(
Definition* defn, CheckArrayBoundInstr* check) {
- if (!CheckArrayBoundInstr::IsFixedLengthArrayType(check->array_type())) {
- return;
- }
-
Definition* length = check->length()->definition();
Range* constraint_range = new Range(
@@ -6299,6 +6343,7 @@
// Update use lists to reflect changes in the graph.
phi->UnuseAllInputs();
branch->UnuseAllInputs();
+ block->UnuseAllInputs();
// The graph has changed. Recompute dominators and block orders after
// this pass is finished.
diff --git a/runtime/vm/flow_graph_optimizer.h b/runtime/vm/flow_graph_optimizer.h
index dfa24a6..4b8574a 100644
--- a/runtime/vm/flow_graph_optimizer.h
+++ b/runtime/vm/flow_graph_optimizer.h
@@ -42,6 +42,8 @@
void SelectRepresentations();
+ void UnboxPhis();
+
void InferSmiRanges();
void AnalyzeTryCatch();
@@ -133,6 +135,8 @@
void InsertConversionsFor(Definition* def);
+ void ConvertUse(Value* use, Representation from);
+
void InsertConversion(Representation from,
Representation to,
Value* use,
diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc
index 7dc47d2..82a9233 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -14,6 +14,7 @@
"Trace flow graph type propagation");
DECLARE_FLAG(bool, enable_type_checks);
+DECLARE_FLAG(bool, propagate_types);
DECLARE_FLAG(bool, use_cha);
@@ -489,9 +490,11 @@
intptr_t CompileType::ToNullableCid() {
if (cid_ == kIllegalCid) {
- ASSERT(type_ != NULL);
-
- if (type_->IsMalformed()) {
+ if (type_ == NULL) {
+ // Type propagation is turned off.
+ ASSERT(!FLAG_propagate_types);
+ return kDynamicCid;
+ } else if (type_->IsMalformed()) {
cid_ = kDynamicCid;
} else if (type_->IsVoidType()) {
cid_ = kNullCid;
diff --git a/runtime/vm/handles.h b/runtime/vm/handles.h
index aeca55d..9f08b7a 100644
--- a/runtime/vm/handles.h
+++ b/runtime/vm/handles.h
@@ -77,8 +77,7 @@
Handles()
: zone_blocks_(NULL),
first_scoped_block_(NULL),
- scoped_blocks_(&first_scoped_block_),
- last_visited_block_(NULL) {
+ scoped_blocks_(&first_scoped_block_) {
}
~Handles() {
DeleteAll();
@@ -139,8 +138,7 @@
class HandlesBlock {
public:
explicit HandlesBlock(HandlesBlock* next)
- : last_visited_handle_(0),
- next_handle_slot_(0),
+ : next_handle_slot_(0),
next_block_(next) { }
~HandlesBlock();
@@ -170,10 +168,6 @@
// Visit all object pointers in the handle block.
void VisitObjectPointers(ObjectPointerVisitor* visitor);
- // Visit all the object pointers in the block since the last time this
- // method was called.
- void VisitUnvisitedObjectPointers(ObjectPointerVisitor* visitor);
-
// Visit all of the handles in the handle block.
void Visit(HandleVisitor* visitor);
@@ -194,10 +188,6 @@
void set_next_block(HandlesBlock* next) { next_block_ = next; }
private:
- // Last handle visited by VisitUnvisitedObjectPointers. Handles
- // at, or beyond this index are new.
- intptr_t last_visited_handle_;
-
uword data_[kHandleSizeInWords * kHandlesPerChunk]; // Handles area.
intptr_t next_handle_slot_; // Next slot for allocation in current block.
HandlesBlock* next_block_; // Link to next block of handles.
@@ -234,8 +224,6 @@
HandlesBlock* zone_blocks_; // List of zone handles.
HandlesBlock first_scoped_block_; // First block of scoped handles.
HandlesBlock* scoped_blocks_; // List of scoped handles.
- // Last block visited by VisitUnvisitedHandles.
- HandlesBlock* last_visited_block_;
friend class HandleScope;
friend class Dart;
diff --git a/runtime/vm/handles_impl.h b/runtime/vm/handles_impl.h
index 95d7515..dbc376a 100644
--- a/runtime/vm/handles_impl.h
+++ b/runtime/vm/handles_impl.h
@@ -49,23 +49,6 @@
template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
void Handles<kHandleSizeInWords,
kHandlesPerChunk,
- kOffsetOfRawPtr>::VisitUnvisitedScopedHandles(
- ObjectPointerVisitor* visitor) {
- HandlesBlock* block = &first_scoped_block_;
- while (block != NULL && block != last_visited_block_) {
- block->VisitUnvisitedObjectPointers(visitor);
- block = block->next_block();
- }
- // We want this to point to first_scoped_block.next,
- // Because pointers are still being added to first_scoped_block
- // So it may be "partially new", and require a partial scan.
- last_visited_block_ = first_scoped_block_.next_block();
-}
-
-
-template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
-void Handles<kHandleSizeInWords,
- kHandlesPerChunk,
kOffsetOfRawPtr>::Visit(HandleVisitor* visitor) {
// Visit all zone handles.
HandlesBlock* block = zone_blocks_;
@@ -339,24 +322,6 @@
template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
void Handles<kHandleSizeInWords,
kHandlesPerChunk,
- kOffsetOfRawPtr>::HandlesBlock::VisitUnvisitedObjectPointers(
- ObjectPointerVisitor* visitor) {
- ASSERT(visitor != NULL);
-
- // last_visited_handle_ picks up where we were last time,
- // so there is nothing in the intialization position of this for loop.
-
- while (last_visited_handle_ < next_handle_slot_) {
- last_visited_handle_ += kHandleSizeInWords;
- uword* addr = &data_[last_visited_handle_ + kOffsetOfRawPtr / kWordSize];
- visitor->VisitPointer(reinterpret_cast<RawObject**>(addr));
- }
-}
-
-
-template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr>
-void Handles<kHandleSizeInWords,
- kHandlesPerChunk,
kOffsetOfRawPtr>::HandlesBlock::Visit(HandleVisitor* visitor) {
ASSERT(visitor != NULL);
for (intptr_t i = 0; i < next_handle_slot_; i += kHandleSizeInWords) {
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 3fd1a11..35b3f25 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -30,6 +30,7 @@
DECLARE_FLAG(int, max_polymorphic_checks);
DECLARE_FLAG(bool, trace_optimization);
DECLARE_FLAG(bool, trace_constant_propagation);
+DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
Definition::Definition()
: range_(NULL),
@@ -129,13 +130,6 @@
}
-bool CheckArrayBoundInstr::AttributesEqual(Instruction* other) const {
- CheckArrayBoundInstr* other_check = other->AsCheckArrayBound();
- ASSERT(other_check != NULL);
- return array_type() == other_check->array_type();
-}
-
-
bool AssertAssignableInstr::AttributesEqual(Instruction* other) const {
AssertAssignableInstr* other_assert = other->AsAssertAssignable();
ASSERT(other_assert != NULL);
@@ -975,6 +969,7 @@
bool BinarySmiOpInstr::CanDeoptimize() const {
+ if (FLAG_throw_on_javascript_int_overflow) return true;
switch (op_kind()) {
case Token::kBIT_AND:
case Token::kBIT_OR:
@@ -2347,11 +2342,6 @@
bool CheckArrayBoundInstr::IsRedundant(RangeBoundary length) {
- // Check that array has an immutable length.
- if (!IsFixedLengthArrayType(array_type())) {
- return false;
- }
-
Range* index_range = index()->definition()->range();
// Range of the index is unknown can't decide if the check is redundant.
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 99fc0d3..e3bd33d 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -6208,9 +6208,7 @@
public:
CheckArrayBoundInstr(Value* length,
Value* index,
- intptr_t array_type,
- InstanceCallInstr* instance_call)
- : array_type_(array_type) {
+ InstanceCallInstr* instance_call) {
SetInputAt(kLengthPos, length);
SetInputAt(kIndexPos, index);
deopt_id_ = instance_call->deopt_id();
@@ -6219,8 +6217,6 @@
Value* length() const { return inputs_[kLengthPos]; }
Value* index() const { return inputs_[kIndexPos]; }
- intptr_t array_type() const { return array_type_; }
-
DECLARE_INSTRUCTION(CheckArrayBound)
virtual intptr_t ArgumentCount() const { return 0; }
@@ -6239,7 +6235,7 @@
virtual bool AllowsCSE() const { return true; }
virtual EffectSet Effects() const { return EffectSet::None(); }
virtual EffectSet Dependencies() const { return EffectSet::None(); }
- virtual bool AttributesEqual(Instruction* other) const;
+ virtual bool AttributesEqual(Instruction* other) const { return true; }
virtual bool MayThrow() const { return false; }
@@ -6249,7 +6245,6 @@
kLengthPos = 0,
kIndexPos = 1
};
- intptr_t array_type_;
DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr);
};
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 1124c02..500ca71 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -300,7 +300,7 @@
// Only right can be a stack slot.
locs->set_in(1, locs->in(0).IsConstant()
? Location::RequiresRegister()
- : Location::AnyOrConstant(right()));
+ : Location::RegisterOrConstant(right()));
locs->set_out(Location::RequiresRegister());
return locs;
}
@@ -945,7 +945,7 @@
// operands should be handled by constant propagation.
summary->set_in(1, summary->in(0).IsConstant()
? Location::RequiresRegister()
- : Location::AnyOrConstant(right()));
+ : Location::RegisterOrConstant(right()));
summary->set_out(Location::RequiresRegister());
return summary;
}
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 1ca8f2e..26bcf90 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -23,6 +23,7 @@
DECLARE_FLAG(int, optimization_counter_threshold);
DECLARE_FLAG(bool, propagate_ic_data);
+DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
// Generic summary for call instructions that have all arguments pushed
// on the stack and return the result in a fixed register RAX.
@@ -455,7 +456,7 @@
// Only right can be a stack slot.
locs->set_in(1, locs->in(0).IsConstant()
? Location::RequiresRegister()
- : Location::AnyOrConstant(right()));
+ : Location::RegisterOrConstant(right()));
locs->set_out(Location::RequiresRegister());
return locs;
}
@@ -975,7 +976,7 @@
// operands should be handled by constant propagation.
summary->set_in(1, summary->in(0).IsConstant()
? Location::RequiresRegister()
- : Location::AnyOrConstant(right()));
+ : Location::RegisterOrConstant(right()));
summary->set_out(Location::RequiresRegister());
return summary;
}
@@ -2129,6 +2130,22 @@
}
+static void Emit53BitOverflowCheck(FlowGraphCompiler* compiler,
+ Label* overflow,
+ Register result) {
+ if (FLAG_throw_on_javascript_int_overflow) {
+ ASSERT(overflow != NULL);
+ __ movq(TMP, result); // result is a tagged Smi.
+ // Bits 54...64 must be all 0 or all 1. (It would be bit 53, but result
+ // is tagged.)
+ __ shlq(result, Immediate(64 - 54));
+ __ sarq(result, Immediate(64 - 54));
+ __ cmpq(result, TMP);
+ __ j(NOT_EQUAL, overflow); // 53-bit overflow.
+ }
+}
+
+
static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
BinarySmiOpInstr* shift_left) {
const bool is_truncating = shift_left->is_truncating();
@@ -2168,6 +2185,7 @@
// Shift for result now we know there is no overflow.
__ shlq(left, Immediate(value));
}
+ Emit53BitOverflowCheck(compiler, deopt, result);
return;
}
@@ -2197,6 +2215,7 @@
__ SmiUntag(right);
__ shlq(left, right);
}
+ Emit53BitOverflowCheck(compiler, deopt, result);
return;
}
@@ -2247,6 +2266,7 @@
// Shift for result now we know there is no overflow.
__ shlq(left, right);
}
+ Emit53BitOverflowCheck(compiler, deopt, result);
}
@@ -2445,6 +2465,7 @@
UNREACHABLE();
break;
}
+ Emit53BitOverflowCheck(compiler, deopt, result);
return;
} // locs()->in(1).IsConstant().
@@ -2487,6 +2508,7 @@
UNREACHABLE();
break;
}
+ Emit53BitOverflowCheck(compiler, deopt, result);
return;
} // locs()->in(1).IsStackSlot().
@@ -2616,6 +2638,7 @@
UNREACHABLE();
break;
}
+ Emit53BitOverflowCheck(compiler, deopt, result);
}
@@ -3734,6 +3757,7 @@
__ shlq(temp, Immediate(1));
__ j(OVERFLOW, &do_call, Assembler::kNearJump);
__ SmiTag(result);
+ Emit53BitOverflowCheck(compiler, &do_call, result);
__ jmp(&done);
__ Bind(&do_call);
ASSERT(instance_call()->HasICData());
@@ -3779,6 +3803,7 @@
__ shlq(temp, Immediate(1));
__ j(OVERFLOW, deopt);
__ SmiTag(result);
+ Emit53BitOverflowCheck(compiler, deopt, result);
}
diff --git a/runtime/vm/intrinsifier.cc b/runtime/vm/intrinsifier.cc
index f8f2542..9df4798 100644
--- a/runtime/vm/intrinsifier.cc
+++ b/runtime/vm/intrinsifier.cc
@@ -11,7 +11,7 @@
namespace dart {
DEFINE_FLAG(bool, intrinsify, true, "Instrinsify when possible");
-
+DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
static bool CompareNames(const Library& lib,
const char* test_name,
@@ -117,12 +117,18 @@
func = cls.LookupFunctionAllowPrivate(str); \
} \
ASSERT(!func.IsNull()); \
- func.set_is_intrinsic(true); \
+ func.set_is_intrinsic(true);
// Set up all core lib functions that can be intrisified.
lib = Library::CoreLibrary();
CORE_LIB_INTRINSIC_LIST(SETUP_FUNCTION);
+ // Integer intrinsics are in the core library, but we don't want to intrinsify
+ // if we are looking for javascript integer overflow.
+ if (!FLAG_throw_on_javascript_int_overflow) {
+ CORE_INTEGER_LIB_INTRINSIC_LIST(SETUP_FUNCTION);
+ }
+
// Set up all math lib functions that can be intrisified.
lib = Library::MathLibrary();
MATH_LIB_INTRINSIC_LIST(SETUP_FUNCTION);
@@ -153,6 +159,9 @@
if (lib.raw() == Library::CoreLibrary()) {
CORE_LIB_INTRINSIC_LIST(FIND_INTRINSICS);
+ if (!FLAG_throw_on_javascript_int_overflow) {
+ CORE_INTEGER_LIB_INTRINSIC_LIST(FIND_INTRINSICS);
+ }
} else if (lib.raw() == Library::TypedDataLibrary()) {
TYPED_DATA_LIB_INTRINSIC_LIST(FIND_INTRINSICS);
} else if (lib.raw() == Library::MathLibrary()) {
diff --git a/runtime/vm/intrinsifier.h b/runtime/vm/intrinsifier.h
index d55d3c1..0e0f942 100644
--- a/runtime/vm/intrinsifier.h
+++ b/runtime/vm/intrinsifier.h
@@ -16,6 +16,46 @@
// When adding a new function for intrinsification add a 0 as fingerprint,
// build and run to get the correct fingerprint from the mismatch error.
#define CORE_LIB_INTRINSIC_LIST(V) \
+ V(_Smi, ~, Smi_bitNegate, 882629793) \
+ V(_Double, >, Double_greaterThan, 301935359) \
+ V(_Double, >=, Double_greaterEqualThan, 1184528952) \
+ V(_Double, <, Double_lessThan, 1596251333) \
+ V(_Double, <=, Double_lessEqualThan, 1184499161) \
+ V(_Double, ==, Double_equal, 1706047712) \
+ V(_Double, +, Double_add, 210576655) \
+ V(_Double, -, Double_sub, 1605354741) \
+ V(_Double, *, Double_mul, 788270837) \
+ V(_Double, /, Double_div, 1202831412) \
+ V(_Double, get:isNaN, Double_getIsNaN, 54462366) \
+ V(_Double, get:isNegative, Double_getIsNegative, 54462366) \
+ V(_Double, _mulFromInteger, Double_mulFromInteger, 704314034) \
+ V(_Double, .fromInteger, Double_fromInteger, 842078193) \
+ V(_ObjectArray, ., ObjectArray_Allocate, 97987288) \
+ V(_ObjectArray, get:length, Array_getLength, 405297088) \
+ V(_ObjectArray, [], Array_getIndexed, 71937385) \
+ V(_ObjectArray, []=, Array_setIndexed, 255863719) \
+ V(_GrowableObjectArray, .withData, GrowableArray_Allocate, 816132033) \
+ V(_GrowableObjectArray, get:length, GrowableArray_getLength, 725548050) \
+ V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 725548050) \
+ V(_GrowableObjectArray, [], GrowableArray_getIndexed, 581838973) \
+ V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 1048007636) \
+ V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 796709584) \
+ V(_GrowableObjectArray, _setData, GrowableArray_setData, 629110947) \
+ V(_GrowableObjectArray, add, GrowableArray_add, 1904852879) \
+ V(_ImmutableArray, [], ImmutableArray_getIndexed, 486821199) \
+ V(_ImmutableArray, get:length, ImmutableArray_getLength, 433698233) \
+ V(Object, ==, Object_equal, 2126897013) \
+ V(_StringBase, get:hashCode, String_getHashCode, 320803993) \
+ V(_StringBase, get:isEmpty, String_getIsEmpty, 1026765313) \
+ V(_StringBase, get:length, String_getLength, 320803993) \
+ V(_StringBase, codeUnitAt, String_codeUnitAt, 984449525) \
+ V(_OneByteString, get:hashCode, OneByteString_getHashCode, 682660413) \
+ V(_OneByteString, _substringUncheckedNative, \
+ OneByteString_substringUnchecked, 713121438) \
+ V(_OneByteString, _setAt, OneByteString_setAt, 342452817) \
+ V(_OneByteString, _allocate, OneByteString_allocate, 510754908) \
+
+#define CORE_INTEGER_LIB_INTRINSIC_LIST(V) \
V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger, 726019207)\
V(_IntegerImplementation, +, Integer_add, 1768648592) \
V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, 726019207)\
@@ -46,45 +86,7 @@
V(_IntegerImplementation, >=, Integer_greaterEqualThan, 949045946) \
V(_IntegerImplementation, <<, Integer_shl, 1195917829) \
V(_IntegerImplementation, >>, Integer_sar, 1980227743) \
- V(_Smi, ~, Smi_bitNegate, 882629793) \
- V(_Double, >, Double_greaterThan, 301935359) \
- V(_Double, >=, Double_greaterEqualThan, 1184528952) \
- V(_Double, <, Double_lessThan, 1596251333) \
- V(_Double, <=, Double_lessEqualThan, 1184499161) \
- V(_Double, ==, Double_equal, 1706047712) \
- V(_Double, +, Double_add, 210576655) \
- V(_Double, -, Double_sub, 1605354741) \
- V(_Double, *, Double_mul, 788270837) \
- V(_Double, /, Double_div, 1202831412) \
- V(_Double, get:isNaN, Double_getIsNaN, 54462366) \
- V(_Double, get:isNegative, Double_getIsNegative, 54462366) \
- V(_Double, _mulFromInteger, Double_mulFromInteger, 704314034) \
- V(_Double, .fromInteger, Double_fromInteger, 842078193) \
- V(_Double, toInt, Double_toInt, 362666636) \
- V(_ObjectArray, ., ObjectArray_Allocate, 97987288) \
- V(_ObjectArray, get:length, Array_getLength, 405297088) \
- V(_ObjectArray, [], Array_getIndexed, 71937385) \
- V(_ObjectArray, []=, Array_setIndexed, 255863719) \
- V(_GrowableObjectArray, .withData, GrowableArray_Allocate, 816132033) \
- V(_GrowableObjectArray, get:length, GrowableArray_getLength, 725548050) \
- V(_GrowableObjectArray, get:_capacity, GrowableArray_getCapacity, 725548050) \
- V(_GrowableObjectArray, [], GrowableArray_getIndexed, 581838973) \
- V(_GrowableObjectArray, []=, GrowableArray_setIndexed, 1048007636) \
- V(_GrowableObjectArray, _setLength, GrowableArray_setLength, 796709584) \
- V(_GrowableObjectArray, _setData, GrowableArray_setData, 629110947) \
- V(_GrowableObjectArray, add, GrowableArray_add, 1904852879) \
- V(_ImmutableArray, [], ImmutableArray_getIndexed, 486821199) \
- V(_ImmutableArray, get:length, ImmutableArray_getLength, 433698233) \
- V(Object, ==, Object_equal, 2126897013) \
- V(_StringBase, get:hashCode, String_getHashCode, 320803993) \
- V(_StringBase, get:isEmpty, String_getIsEmpty, 1026765313) \
- V(_StringBase, get:length, String_getLength, 320803993) \
- V(_StringBase, codeUnitAt, String_codeUnitAt, 984449525) \
- V(_OneByteString, get:hashCode, OneByteString_getHashCode, 682660413) \
- V(_OneByteString, _substringUncheckedNative, \
- OneByteString_substringUnchecked, 713121438) \
- V(_OneByteString, _setAt, OneByteString_setAt, 342452817) \
- V(_OneByteString, _allocate, OneByteString_allocate, 510754908) \
+ V(_Double, toInt, Double_toInt, 362666636)
#define MATH_LIB_INTRINSIC_LIST(V) \
@@ -142,6 +144,7 @@
static bool destination(Assembler* assembler);
CORE_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
+ CORE_INTEGER_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
MATH_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
TYPED_DATA_LIB_INTRINSIC_LIST(DECLARE_FUNCTION)
diff --git a/runtime/vm/intrinsifier_arm.cc b/runtime/vm/intrinsifier_arm.cc
index 1d6a9d3..71463e8 100644
--- a/runtime/vm/intrinsifier_arm.cc
+++ b/runtime/vm/intrinsifier_arm.cc
@@ -1308,12 +1308,20 @@
bool Intrinsifier::Double_toInt(Assembler* assembler) {
+ Label fall_through;
+
__ ldr(R0, Address(SP, 0 * kWordSize));
__ LoadDFromOffset(D0, R0, Double::value_offset() - kHeapObjectTag);
+
+ // Explicit NaN check, since ARM gives an FPU exception if you try to
+ // convert NaN to an int.
+ __ vcmpd(D0, D0);
+ __ vmstat();
+ __ b(&fall_through, VS);
+
__ vcvtid(S0, D0);
__ vmovrs(R0, S0);
// Overflow is signaled with minint.
- Label fall_through;
// Check for overflow and that it fits into Smi.
__ CompareImmediate(R0, 0xC0000000);
__ b(&fall_through, MI);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index a9e8d41..b2a77b9 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -50,6 +50,8 @@
"Huge method cutoff in tokens: Disables optimizations for huge methods.");
DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000,
"Huge method cutoff in unoptimized code size (in bytes).");
+DEFINE_FLAG(bool, throw_on_javascript_int_overflow, false,
+ "Throw an exception when integer arithmetic exceeds 53 bits.");
DECLARE_FLAG(bool, trace_compiler);
DECLARE_FLAG(bool, eliminate_type_checks);
DECLARE_FLAG(bool, enable_type_checks);
@@ -7005,6 +7007,7 @@
lib = Library::CoreLibrary();
CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
+ CORE_INTEGER_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
RECOGNIZED_LIST(CHECK_FINGERPRINTS);
@@ -10440,16 +10443,33 @@
}
+// Throw FiftyThreeBitOverflow exception.
+static void ThrowFiftyThreeBitOverflow(const Integer& i) {
+ const Array& exc_args = Array::Handle(Array::New(1));
+ exc_args.SetAt(0, i);
+ Exceptions::ThrowByType(Exceptions::kFiftyThreeBitOverflowError, exc_args);
+}
+
+
RawInteger* Integer::New(int64_t value, Heap::Space space) {
if ((value <= Smi::kMaxValue) && (value >= Smi::kMinValue)) {
return Smi::New(value);
}
+ if (FLAG_throw_on_javascript_int_overflow && !Utils::IsInt(53, value)) {
+ const Integer &i = Integer::Handle(Mint::New(value));
+ ThrowFiftyThreeBitOverflow(i);
+ }
return Mint::New(value, space);
}
RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) {
if (value > static_cast<uint64_t>(Mint::kMaxValue)) {
+ if (FLAG_throw_on_javascript_int_overflow) {
+ const Integer &i =
+ Integer::Handle(BigintOperations::NewFromUint64(value));
+ ThrowFiftyThreeBitOverflow(i);
+ }
return BigintOperations::NewFromUint64(value);
} else {
return Integer::New(value);
@@ -10475,7 +10495,32 @@
}
+static void CheckFiftyThreeBitOverflow(const Integer &i) {
+ // Always overflow if the value doesn't fit into an int64_t.
+ int64_t value = 1ULL << 63;
+ if (i.IsSmi()) {
+ value = i.AsInt64Value();
+ } else if (i.IsMint()) {
+ Mint& mint = Mint::Handle();
+ mint ^= i.raw();
+ value = mint.value();
+ } else {
+ ASSERT(i.IsBigint());
+ Bigint& big_value = Bigint::Handle();
+ big_value ^= i.raw();
+ if (BigintOperations::FitsIntoInt64(big_value)) {
+ value = BigintOperations::ToInt64(big_value);
+ }
+ }
+ if (Utils::IsInt(53, value)) return;
+ ThrowFiftyThreeBitOverflow(i);
+}
+
+
RawInteger* Integer::AsValidInteger() const {
+ if (FLAG_throw_on_javascript_int_overflow) {
+ CheckFiftyThreeBitOverflow(*this);
+ }
if (IsSmi()) return raw();
if (IsMint()) {
Mint& mint = Mint::Handle();
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index ddde3cf..bcc02b0 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -1435,15 +1435,15 @@
for (intptr_t i = 0; i < function_args.length(); i++) {
AstNode* arg = function_args.NodeAt(i);
if ((temp_for_last_arg != NULL) && (i == function_args.length() - 1)) {
- args_array->AddElement(
- new CommaNode(arg->token_pos(),
- new StoreLocalNode(arg->token_pos(),
+ LetNode* store_arg = new LetNode(arg->token_pos());
+ store_arg->AddNode(new StoreLocalNode(arg->token_pos(),
temp_for_last_arg,
- arg),
- new LoadLocalNode(arg->token_pos(),
- temp_for_last_arg)));
+ arg));
+ store_arg->AddNode(new LoadLocalNode(arg->token_pos(),
+ temp_for_last_arg));
+ args_array->AddElement(store_arg);
} else {
- args_array->AddElement(function_args.NodeAt(i));
+ args_array->AddElement(arg);
}
}
arguments->Add(args_array);
@@ -7081,12 +7081,8 @@
AstNode* Parser::ParseCascades(AstNode* expr) {
intptr_t cascade_pos = TokenPos();
- LetNode* result = new LetNode(cascade_pos);
- LocalVariable* cascade_receiver_var = result->AddInitializer(expr);
- // TODO(fschneider): Make LetNode support more than one body node and
- // replace the SequenceNode here and CommaNode here and in postfix
- // expressions.
- SequenceNode* cascade = new SequenceNode(cascade_pos, NULL);
+ LetNode* cascade = new LetNode(cascade_pos);
+ LocalVariable* cascade_receiver_var = cascade->AddInitializer(expr);
while (CurrentToken() == Token::kCASCADE) {
cascade_pos = TokenPos();
LoadLocalNode* load_cascade_receiver =
@@ -7120,7 +7116,7 @@
"left hand side of '%s' is not assignable",
Token::Str(assignment_op));
}
- let_expr->set_body(assign_expr);
+ let_expr->AddNode(assign_expr);
expr = let_expr;
} else {
right_expr =
@@ -7134,16 +7130,12 @@
expr = assign_expr;
}
}
- cascade->Add(expr);
+ cascade->AddNode(expr);
}
- // The result is a pair of the (side effects of the) cascade sequence
- // followed by the (value of the) receiver temp variable load.
- CommaNode* body = new CommaNode(
- cascade_pos,
- cascade,
- new LoadLocalNode(cascade_pos, cascade_receiver_var));
- result->set_body(body);
- return result;
+ // The result is an expression with the (side effects of the) cascade
+ // sequence followed by the (value of the) receiver temp variable load.
+ cascade->AddNode(new LoadLocalNode(cascade_pos, cascade_receiver_var));
+ return cascade;
}
@@ -7188,7 +7180,7 @@
"left hand side of '%s' is not assignable",
Token::Str(assignment_op));
}
- let_expr->set_body(assign_expr);
+ let_expr->AddNode(assign_expr);
return let_expr;
} else {
AstNode* assigned_value =
@@ -7268,7 +7260,7 @@
new LiteralNode(op_pos, Smi::ZoneHandle(Smi::New(1))));
AstNode* store = CreateAssignmentNode(expr, add);
ASSERT(store != NULL);
- let_expr->set_body(store);
+ let_expr->AddNode(store);
expr = let_expr;
} else {
expr = ParsePostfixExpr();
@@ -7764,10 +7756,8 @@
ASSERT(store != NULL);
// The result is a pair of the (side effects of the) store followed by
// the (value of the) initial value temp variable load.
- let_expr->set_body(new CommaNode(
- postfix_expr_pos,
- store,
- new LoadLocalNode(postfix_expr_pos, temp)));
+ let_expr->AddNode(store);
+ let_expr->AddNode(new LoadLocalNode(postfix_expr_pos, temp));
return let_expr;
}
return postfix_expr;
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 9d76bca..fab5eec 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -347,6 +347,9 @@
bool IsDartInstance() {
return (!IsHeapObject() || (GetClassId() >= kInstanceCid));
}
+ bool IsFreeListElement() {
+ return ((GetClassId() == kFreeListElement));
+ }
intptr_t Size() const {
uword tags = ptr()->tags_;
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 741a96f..a1752a0 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -224,6 +224,7 @@
V(NullThrownError, "NullThrownError") \
V(IsolateSpawnException, "IsolateSpawnException") \
V(IsolateUnhandledException, "IsolateUnhandledException") \
+ V(FiftyThreeBitOverflowError, "FiftyThreeBitOverflowError") \
V(_setupFullStackTrace, "_setupFullStackTrace") \
V(BooleanExpression, "boolean expression") \
V(Malformed, "malformed") \
diff --git a/sdk/bin/dartanalyzer_developer b/sdk/bin/dartanalyzer_developer
index b522f56..9cf163d 100755
--- a/sdk/bin/dartanalyzer_developer
+++ b/sdk/bin/dartanalyzer_developer
@@ -38,4 +38,18 @@
JAR_FILE="$JAR_DIR/dartanalyzer.jar"
-exec java -jar $JAR_FILE --dart-sdk "$SDK_DIR" "$@"
+EXTRA_JVMARGS="-Xss2M "
+OS=`uname | tr "[A-Z]" "[a-z]"`
+if [ "$OS" == "darwin" ] ; then
+ # Bump up the heap on Mac VMs, some of which default to 128M or less.
+ EXTRA_JVMARGS+=" -Xmx256M -client "
+else
+ # On other architectures
+ # -batch invocations will do better with a server vm
+ # invocations for analyzing a single file do better with a client vm
+ if [ $FOUND_BATCH = 0 ] ; then
+ EXTRA_JVMARGS+=" -client "
+ fi
+fi
+
+exec java $EXTRA_JVMARGS -jar $JAR_FILE --dart-sdk "$SDK_DIR" "$@"
diff --git a/sdk/bin/dartdoc b/sdk/bin/dartdoc
index 3f22367..f95cb16 100755
--- a/sdk/bin/dartdoc
+++ b/sdk/bin/dartdoc
@@ -18,9 +18,17 @@
fi
unset SNAPSHOT
-if test -f "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart.snapshot"; then
+
+SNAPSHOT="$BIN_DIR/snapshots/utils_wrapper.dart.snapshot"
+
+if test -f $SNAPSHOT; then
# TODO(ahe): Remove the following line when we are relatively sure it works.
- echo Using snapshot "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart.snapshot" 1>&2
- SNAPSHOT="--use-script-snapshot=$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart.snapshot"
+ echo Using snapshot $SNAPSHOT 1>&2
+ exec "$BIN_DIR"/dart --heap_growth_rate=32 \
+ "--package-root=$BIN_DIR/../packages/" $SNAPSHOT dartdoc $COLORS \
+ "--package-root=$BIN_DIR/../packages/" "--library-root=$BIN_DIR/.." "$@"
+else
+ exec "$BIN_DIR"/dart --heap_growth_rate=32 \
+ "--package-root=$BIN_DIR/../packages/" \
+ "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart" $COLORS "$@"
fi
-exec "$BIN_DIR"/dart --heap_growth_rate=32 "--package-root=$BIN_DIR/../packages/" $SNAPSHOT "$BIN_DIR/../lib/_internal/dartdoc/bin/dartdoc.dart" "--package-root=$BIN_DIR/../packages/" $COLORS "$@"
diff --git a/sdk/bin/dartdoc.bat b/sdk/bin/dartdoc.bat
index 11911ef..c80ef95 100644
--- a/sdk/bin/dartdoc.bat
+++ b/sdk/bin/dartdoc.bat
@@ -3,15 +3,49 @@
REM for details. All rights reserved. Use of this source code is governed by a
REM BSD-style license that can be found in the LICENSE file.
-set SCRIPTPATH=%~dp0
+setlocal
+rem Handle the case where dart-sdk/bin has been symlinked to.
+set DIR_NAME_WITH_SLASH=%~dp0
+set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
+call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
+rem Get rid of surrounding quotes.
+for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
-REM Does the path have a trailing slash? If so, remove it.
-if %SCRIPTPATH:~-1%== set SCRIPTPATH=%SCRIPTPATH:~0,-1%
+rem Get absolute full name for SDK_DIR.
+for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
-set arguments=%*
-rem set SNAPSHOTNAME="%SCRIPTPATH%dartdoc.snapshot"
-rem if exist %SNAPSHOTNAME% set SNAPSHOT=--use-script-snapshot=%SNAPSHOTNAME%
+rem Remove trailing backslash if there is one
+IF %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
-:: The trailing forward slash in --package-root is required because of issue
-:: 9499.
-"%SCRIPTPATH%dart" --heap_growth_rate=32 "--package-root=%SCRIPTPATH%..\packages/" %SNAPSHOT% "%SCRIPTPATH%..\lib\_internal\dartdoc\bin\dartdoc.dart" %arguments%
+set DARTDOC=%SDK_DIR%\lib\_internal\dartdoc\bin\dartdoc.dart
+set DART=%BIN_DIR%\dart
+set SNAPSHOT=%BIN_DIR%\snapshots\utils_wrapper.dart.snapshot
+
+if not defined DART_CONFIGURATION set DART_CONFIGURATION=ReleaseIA32
+
+set BUILD_DIR=%SDK_DIR%\..\build\%DART_CONFIGURATION%
+if exist "%SNAPSHOT%" (
+ "%DART%" "%SNAPSHOT%" "dartdoc" "--library-root=%SDK_DIR%" %*
+) else (
+ :: The trailing forward slash in --package-root is required because of issue
+ :: 9499.
+ "%BUILD_DIR%\dart-sdk\bin\dart" "--package-root=%BUILD_DIR%\packages/" "%DARTDOC%" %*
+)
+
+endlocal
+
+exit /b %errorlevel%
+
+:follow_links
+setlocal
+for %%i in (%1) do set result=%%~fi
+set current=
+for /f "tokens=2 delims=[]" %%i in ('dir /a:l ^"%~dp1^" 2^>nul ^
+ ^| find "> %~n1 ["') do (
+ set current=%%i
+)
+if not "%current%"=="" call :follow_links "%current%", result
+endlocal & set %~2=%result%
+goto :eof
+
+:end
diff --git a/sdk/bin/pub b/sdk/bin/pub
index 76085ab..3643085 100755
--- a/sdk/bin/pub
+++ b/sdk/bin/pub
@@ -1,4 +1,8 @@
#!/bin/bash
+# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
# Run pub.dart on the Dart VM. This script assumes the Dart SDK's directory
# structure.
@@ -6,6 +10,34 @@
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
# with this case.
BIN_DIR="$(cd "${0%/*}" ; pwd -P)"
-DART_SDK="$(cd "${BIN_DIR%/*}" ; pwd -P)"
+SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
-exec "$BIN_DIR"/dart "$DART_SDK"/bin/snapshots/pub.dart.snapshot $@
+SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot"
+
+if test -f "$SNAPSHOT"; then
+ # We are running the snapshot in the built SDK.
+ DART="$BIN_DIR/dart"
+ exec "$DART" "--checked" "$SNAPSHOT" "$@"
+else
+ # We are running pub from source in the development repo.
+ if [ -z "$DART_CONFIGURATION" ];
+ then
+ DART_CONFIGURATION="ReleaseIA32"
+ fi
+
+ if [[ `uname` == 'Darwin' ]];
+ then
+ BUILD_DIR="$SDK_DIR/../xcodebuild/$DART_CONFIGURATION"
+ else
+ BUILD_DIR="$SDK_DIR/../out/$DART_CONFIGURATION"
+ fi
+
+ # Use the Dart binary in the built SDK so pub can find the version file next
+ # to it.
+ DART="$BUILD_DIR/dart-sdk/bin/dart"
+ PACKAGES_DIR="$BUILD_DIR/packages/"
+
+ PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart"
+
+ exec "$DART" "--checked" "--package-root=$PACKAGES_DIR" "$PUB" "$@"
+fi
\ No newline at end of file
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index f71d6e6..671b02a 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -1094,6 +1094,13 @@
api.Diagnostic.WARNING);
}
+ void reportInfo(Spannable node, MessageKind errorCode,
+ [Map arguments = const {}]) {
+ reportMessage(spanFromSpannable(node),
+ errorCode.error(arguments),
+ api.Diagnostic.INFO);
+ }
+
void reportMessage(SourceSpan span, Diagnostic message, api.Diagnostic kind) {
// TODO(ahe): The names Diagnostic and api.Diagnostic are in
// conflict. Fix it.
diff --git a/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart b/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart
index 6732b8c..b825f68 100644
--- a/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart
+++ b/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart
@@ -336,28 +336,28 @@
* not return the correct values.
*/
class DartConstantSystem extends ConstantSystem {
- const add = const AddOperation();
- const bitAnd = const BitAndOperation();
- const bitNot = const BitNotOperation();
- const bitOr = const BitOrOperation();
- const bitXor = const BitXorOperation();
- const booleanAnd = const BooleanAndOperation();
- const booleanOr = const BooleanOrOperation();
- const divide = const DivideOperation();
- const equal = const EqualsOperation();
- const greaterEqual = const GreaterEqualOperation();
- const greater = const GreaterOperation();
- const identity = const IdentityOperation();
- const lessEqual = const LessEqualOperation();
- const less = const LessOperation();
- const modulo = const ModuloOperation();
- const multiply = const MultiplyOperation();
- const negate = const NegateOperation();
- const not = const NotOperation();
- const shiftLeft = const ShiftLeftOperation();
- const shiftRight = const ShiftRightOperation();
- const subtract = const SubtractOperation();
- const truncatingDivide = const TruncatingDivideOperation();
+ final add = const AddOperation();
+ final bitAnd = const BitAndOperation();
+ final bitNot = const BitNotOperation();
+ final bitOr = const BitOrOperation();
+ final bitXor = const BitXorOperation();
+ final booleanAnd = const BooleanAndOperation();
+ final booleanOr = const BooleanOrOperation();
+ final divide = const DivideOperation();
+ final equal = const EqualsOperation();
+ final greaterEqual = const GreaterEqualOperation();
+ final greater = const GreaterOperation();
+ final identity = const IdentityOperation();
+ final lessEqual = const LessEqualOperation();
+ final less = const LessOperation();
+ final modulo = const ModuloOperation();
+ final multiply = const MultiplyOperation();
+ final negate = const NegateOperation();
+ final not = const NotOperation();
+ final shiftLeft = const ShiftLeftOperation();
+ final shiftRight = const ShiftRightOperation();
+ final subtract = const SubtractOperation();
+ final truncatingDivide = const TruncatingDivideOperation();
const DartConstantSystem();
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart
index a936b7d..ddc8571 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/renamer.dart
@@ -9,9 +9,9 @@
typedef String _Renamer(Renamable renamable);
abstract class Renamable {
- const int RENAMABLE_TYPE_ELEMENT = 1;
- const int RENAMABLE_TYPE_MEMBER = 2;
- const int RENAMABLE_TYPE_LOCAL = 3;
+ final int RENAMABLE_TYPE_ELEMENT = 1;
+ final int RENAMABLE_TYPE_MEMBER = 2;
+ final int RENAMABLE_TYPE_LOCAL = 3;
final Set<Node> nodes;
final _Renamer renamer;
diff --git a/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart b/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart
index 1d0c2b9..ff9595f 100644
--- a/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart
+++ b/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart
@@ -23,6 +23,14 @@
// TODO(ahe): Rename to reportError when that method has been removed.
void reportErrorCode(Spannable node, MessageKind errorCode, [Map arguments]);
+ void reportInfo(Spannable node, MessageKind errorCode, [Map arguments]);
+
/// Returns true if a diagnostic was emitted.
bool onDeprecatedFeature(Spannable span, String feature);
+
+ // TODO(ahe): We should not expose this here. Perhaps a
+ // [SourceSpan] should implement [Spannable], and we should have a
+ // way to construct a [SourceSpan] from a [Spannable] and an
+ // [Element].
+ withCurrentElement(Element element, f());
}
diff --git a/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index 3d7982b..ea72505 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -253,6 +253,8 @@
/// the generative constructor that the forwarding constructor points to
/// (possibly via other forwarding constructors).
FunctionElement get targetConstructor;
+
+ void diagnose(Element context, DiagnosticListener listener);
}
class Elements {
@@ -626,7 +628,7 @@
void addCompilationUnit(CompilationUnitElement element);
void addTag(LibraryTag tag, DiagnosticListener listener);
- void addImport(Element element, DiagnosticListener listener);
+ void addImport(Element element, Import import, DiagnosticListener listener);
/// Record which element an import or export tag resolved to.
/// (Belongs on builder object).
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index 27b8fa6..732e44c 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -276,6 +276,8 @@
bool isForeign(Compiler compiler) => getLibrary() == compiler.foreignLibrary;
FunctionElement get targetConstructor => null;
+
+ void diagnose(Element context, DiagnosticListener listener) {}
}
/**
@@ -377,6 +379,36 @@
super(existingElement.name, ElementKind.AMBIGUOUS, enclosingElement);
bool isAmbiguous() => true;
+
+ Set flatten() {
+ Element element = this;
+ var set = new Set();
+ while (element.isAmbiguous()) {
+ AmbiguousElement ambiguous = element;
+ set.add(ambiguous.newElement);
+ element = ambiguous.existingElement;
+ }
+ set.add(element);
+ return set;
+ }
+
+ void diagnose(Element context, DiagnosticListener listener) {
+ Set ambiguousElements = flatten();
+ MessageKind code = (ambiguousElements.length == 1)
+ ? MessageKind.AMBIGUOUS_REEXPORT : MessageKind.AMBIGUOUS_LOCATION;
+ LibraryElementX importer = context.getLibrary();
+ for (Element element in ambiguousElements) {
+ var arguments = {'element': element};
+ listener.reportInfo(element, code, arguments);
+ Link<Import> importers = importer.importers[element];
+ listener.withCurrentElement(importer, () {
+ for (; !importers.isEmpty; importers = importers.tail) {
+ listener.reportInfo(
+ importers.head, MessageKind.IMPORTED_HERE, arguments);
+ }
+ });
+ }
+ }
}
class ScopeX {
@@ -566,6 +598,9 @@
*/
final Map<SourceString, Element> importScope;
+ /// A mapping from an imported element to the "import" tag.
+ final Map<Element, Link<Import>> importers;
+
/**
* Link for elements exported either through export declarations or through
* declaration. This field should not be accessed directly but instead through
@@ -582,6 +617,7 @@
LibraryElementX(Script script, [Uri canonicalUri, LibraryElement this.origin])
: this.canonicalUri = ((canonicalUri == null) ? script.uri : canonicalUri),
importScope = new Map<SourceString, Element>(),
+ importers = new Map<Element, Link<Import>>(),
super(new SourceString(script.name), ElementKind.LIBRARY, null) {
entryCompilationUnit = new CompilationUnitElementX(script, this);
if (isPatch) {
@@ -628,7 +664,10 @@
* [ErroneousElement] will be put in the imported scope, allowing for the
* detection of ambiguous uses of imported names.
*/
- void addImport(Element element, DiagnosticListener listener) {
+ void addImport(Element element, Import import, DiagnosticListener listener) {
+ importers[element] =
+ importers.putIfAbsent(element, () => const Link<Import>())
+ .prepend(import);
Element existing = importScope[element.name];
if (existing != null) {
// TODO(johnniwinther): Provide access to the import tags from which
@@ -1950,11 +1989,6 @@
ClassElement mixin;
- // TODO(kasperl): The analyzer complains when I don't have these two
- // fields. This is pretty weird. I cannot replace them with getters.
- final ClassElement patch = null;
- final ClassElement origin = null;
-
MixinApplicationElementX(SourceString name, Element enclosing, int id,
this.node, this.modifiers)
: super(name, enclosing, id, STATE_NOT_STARTED);
@@ -1963,6 +1997,16 @@
bool get hasConstructor => !constructors.isEmpty;
bool get hasLocalScopeMembers => !constructors.isEmpty;
+ unsupported(message) {
+ throw new UnsupportedError('$message is not supported on $this');
+ }
+
+ get patch => null;
+ get origin => null;
+
+ set patch(value) => unsupported('set patch');
+ set origin(value) => unsupported('set origin');
+
Token position() => node.getBeginToken();
Node parseNode(DiagnosticListener listener) => node;
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/constant_system_javascript.dart b/sdk/lib/_internal/compiler/implementation/js_backend/constant_system_javascript.dart
index 1b4a0ff..6437764 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/constant_system_javascript.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/constant_system_javascript.dart
@@ -142,8 +142,8 @@
* compiled to JavaScript.
*/
class JavaScriptConstantSystem extends ConstantSystem {
- const int BITS31 = 0x8FFFFFFF;
- const int BITS32 = 0xFFFFFFFF;
+ final int BITS31 = 0x8FFFFFFF;
+ final int BITS32 = 0xFFFFFFFF;
final add = const JavaScriptBinaryArithmeticOperation(const AddOperation());
final bitAnd = const JavaScriptBinaryBitOperation(const BitAndOperation());
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 6bbd6d5..494eebf 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -73,6 +73,7 @@
final List<ClassElement> deferredClasses = <ClassElement>[];
final List<ClassElement> nativeClasses = <ClassElement>[];
final List<Selector> trivialNsmHandlers = <Selector>[];
+ final Map<String, String> mangledFieldNames = <String, String>{};
// TODO(ngeoffray): remove this field.
Set<ClassElement> instantiatedClasses;
@@ -361,12 +362,12 @@
];
}
- const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4;
+ static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4;
// If we need fewer than this many noSuchMethod handlers we can save space by
// just emitting them in JS, rather than emitting the JS needed to generate
// them at run time.
- const VERY_FEW_NO_SUCH_METHOD_HANDLERS = 10;
+ static const VERY_FEW_NO_SUCH_METHOD_HANDLERS = 10;
/**
* Adds (at runtime) the handlers to the Object class which catch calls to
@@ -1460,6 +1461,21 @@
/* Do nothing. */
}
+ void recordMangledField(Element member,
+ String accessorName,
+ String memberName) {
+ String previousName = mangledFieldNames.putIfAbsent(
+ '${namer.getterPrefix}$accessorName',
+ () => memberName);
+ assert(invariant(member, previousName == memberName,
+ message: '$previousName != ${memberName}'));
+ previousName = mangledFieldNames.putIfAbsent(
+ '${namer.setterPrefix}$accessorName',
+ () => '${memberName}=');
+ assert(invariant(member, previousName == '${memberName}=',
+ message: '$previousName != ${memberName}='));
+ }
+
/// Returns `true` if fields added.
bool emitClassFields(ClassElement classElement,
ClassBuilder builder,
@@ -1502,6 +1518,9 @@
}
fieldMetadata.add(metadata);
}
+ if (compiler.mirrorsEnabled) {
+ recordMangledField(member, accessorName, member.name.slowToString());
+ }
if (!needsAccessor) {
// Emit field for constructor generation.
assert(!classIsNative);
@@ -3089,6 +3108,22 @@
if (compiler.enableMinification) {
mainBuffer.write(';');
}
+ if (!mangledFieldNames.isEmpty) {
+ var keys = mangledFieldNames.keys.toList();
+ keys.sort();
+ var properties = [];
+ for (String key in keys) {
+ var value = js.string('${mangledFieldNames[key]}');
+ properties.add(new jsAst.Property(js.string(key), value));
+ }
+ var map = new jsAst.ObjectInitializer(properties);
+ mainBuffer.write(
+ jsAst.prettyPrint(
+ js('init.mangledNames = #', map).toStatement(), compiler));
+ if (compiler.enableMinification) {
+ mainBuffer.write(';');
+ }
+ }
mainBuffer
..write(getReflectionDataParser())
..write('([$n');
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart b/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart
index bfc844a..093a2d0 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart
@@ -19,8 +19,8 @@
final String getterPrefix = 'g';
final String setterPrefix = 's';
- const ALPHABET_CHARACTERS = 52; // a-zA-Z.
- const ALPHANUMERIC_CHARACTERS = 62; // a-zA-Z0-9.
+ static const ALPHABET_CHARACTERS = 52; // a-zA-Z.
+ static const ALPHANUMERIC_CHARACTERS = 62; // a-zA-Z0-9.
// You can pass an invalid identifier to this and unlike its non-minifying
// counterpart it will never return the proposedName as the new fresh name.
diff --git a/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart
index 2f85b44..3743ad0 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart
@@ -1010,7 +1010,7 @@
if (x is _NativeJsSendPort) return visitNativeJsSendPort(x);
if (x is _WorkerSendPort) return visitWorkerSendPort(x);
if (x is _BufferingSendPort) return visitBufferingSendPort(x);
- throw "Illegal underlying port $p";
+ throw "Illegal underlying port $x";
}
SendPort visitNativeJsSendPort(_NativeJsSendPort port) {
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart b/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart
index 2a50b31..c06e251 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart
@@ -291,14 +291,16 @@
}
InstanceMirror setField(Symbol fieldName, Object arg) {
- _invoke(
- fieldName, JSInvocationMirror.SETTER, 'set\$${n(fieldName)}', [arg]);
+ String reflectiveName = '${n(fieldName)}=';
+ String mangledName = JsMirrorSystem.reflectiveNames[reflectiveName];
+ _invoke(s(reflectiveName), JSInvocationMirror.SETTER, mangledName, [arg]);
return reflect(arg);
}
InstanceMirror getField(Symbol fieldName) {
- return _invoke(
- fieldName, JSInvocationMirror.GETTER, 'get\$${n(fieldName)}', []);
+ String reflectiveName = n(fieldName);
+ String mangledName = JsMirrorSystem.reflectiveNames[reflectiveName];
+ return _invoke(fieldName, JSInvocationMirror.GETTER, mangledName, []);
}
delegate(Invocation invocation) {
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_string.dart b/sdk/lib/_internal/compiler/implementation/lib/js_string.dart
index 610f7f8..92d7c67 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_string.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_string.dart
@@ -222,6 +222,9 @@
bool contains(Pattern other, [int startIndex = 0]) {
checkNull(other);
+ if (startIndex < 0 || startIndex > this.length) {
+ throw new RangeError.range(startIndex, 0, this.length);
+ }
return stringContainsUnchecked(this, other, startIndex);
}
diff --git a/sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart
index f8243c5..45ab03c 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/regexp_helper.dart
@@ -136,6 +136,10 @@
bool moveNext() {
// firstMatch actually acts as nextMatch because of
// hidden global flag.
+ if (_current != null && _current.start == _current.end) {
+ // Advance implicit start-position if last match was empty.
+ JS("void", "#.lastIndex++", regExpGetNative(_re));
+ }
_current = _re.firstMatch(_str);
return _current != null;
}
diff --git a/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart
index 1157f89..f321fbb 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/string_helper.dart
@@ -65,7 +65,7 @@
return other.hasMatch(receiver.substring(startIndex));
} else {
var substr = receiver.substring(startIndex);
- return other.allMatches(substr).iterator.moveNext();
+ return other.allMatches(substr).isNotEmpty;
}
}
diff --git a/sdk/lib/_internal/compiler/implementation/library_loader.dart b/sdk/lib/_internal/compiler/implementation/library_loader.dart
index 872aa58..0e70958 100644
--- a/sdk/lib/_internal/compiler/implementation/library_loader.dart
+++ b/sdk/lib/_internal/compiler/implementation/library_loader.dart
@@ -528,7 +528,7 @@
importedLibrary.forEachExport((Element element) {
compiler.withCurrentElement(element, () {
if (combinatorFilter.exclude(element)) return;
- importingLibrary.addImport(element, compiler);
+ importingLibrary.addImport(element, import, compiler);
});
});
}
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index d409045..135da9d 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -422,6 +422,8 @@
MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC);
}
ResolverVisitor visitor = visitorFor(element);
+ visitor.useElement(tree, element);
+
// TODO(johnniwinther): Avoid analyzing initializers if
// [Compiler.analyzeSignaturesOnly] is set.
initializerDo(tree, visitor.visit);
@@ -1485,6 +1487,7 @@
AmbiguousElement ambiguous = element;
type = reportFailureAndCreateType(
ambiguous.messageKind, ambiguous.messageArguments);
+ ambiguous.diagnose(visitor.mapping.currentElement, compiler);
} else if (!element.impliesType()) {
type = reportFailureAndCreateType(
MessageKind.NOT_A_TYPE, {'node': node.typeName});
@@ -1721,6 +1724,7 @@
AmbiguousElement ambiguous = result;
compiler.reportErrorCode(
node, ambiguous.messageKind, ambiguous.messageArguments);
+ ambiguous.diagnose(enclosingElement, compiler);
return new ErroneousElementX(ambiguous.messageKind,
ambiguous.messageArguments,
name, enclosingElement);
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 1c4f47d..1187969 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -1141,6 +1141,12 @@
List<HInstruction> compiledArguments;
bool isInstanceMember = function.isInstanceMember();
+ if (function.isGenerativeConstructor()) {
+ // The optimistic field type optimization requires
+ // to know all generative constructors seen in codegen.
+ backend.registerConstructor(function);
+ }
+
if (currentNode == null
|| currentNode.asForIn() != null
|| !isInstanceMember
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart b/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
index e27ae59..5ea9e29 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
@@ -575,8 +575,7 @@
if (right.isConstantNull() || instructionType.isPrimitiveOrNull()) {
return newBuiltinVariant(instruction);
}
- TypeMask mask = instructionType.computeMask(compiler);
- Selector selector = new TypedSelector(mask, instruction.selector);
+ Selector selector = instructionType.refine(instruction.selector, compiler);
World world = compiler.world;
JavaScriptBackend backend = compiler.backend;
Iterable<Element> matches = world.allFunctions.filter(selector);
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
index ffcab4d..a0a6005 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
@@ -1469,8 +1469,7 @@
// Don't handle fields defined in superclasses. Given that the field is
// always added to the [allSetters] set, setting a field defined in a
// superclass will get an inferred type of UNKNOWN.
- if (identical(work.element.getEnclosingClass(), field.getEnclosingClass()) &&
- !value.instructionType.isUnknown()) {
+ if (work.element.getEnclosingClass() == field.getEnclosingClass()) {
currentFieldSetters[field] = type;
}
}
@@ -1481,6 +1480,7 @@
if (!thisExposed) {
// Register the known field types.
currentFieldSetters.forEach((Element element, HType type) {
+ if (type.isUnknown()) return;
backend.registerFieldConstructor(element, type);
allSetters.remove(element);
});
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/types.dart b/sdk/lib/_internal/compiler/implementation/ssa/types.dart
index faf1f08..06fa93d 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/types.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/types.dart
@@ -231,6 +231,7 @@
// TODO(kasperl): Should we check if the refinement really is more
// specialized than the starting point?
TypeMask mask = computeMask(compiler);
+ if (selector.mask == mask) return selector;
return new TypedSelector(mask, selector);
}
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index cdd5f8c..49612a9 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -335,16 +335,13 @@
return currentClass.supertype;
} else {
Element element = elements[node];
- if (element != null) {
- assert(invariant(node, element.isVariable() || element.isParameter(),
- message: 'Unexpected context element ${element}'));
- return element.computeType(compiler);
- }
-
- assert(invariant(node, elements.currentElement.isField(),
- message: 'Unexpected context element ${elements.currentElement}'));
- // This is an identifier of a field declaration.
- return types.dynamicType;
+ assert(invariant(node, element != null,
+ message: 'Missing element for identifier'));
+ assert(invariant(node, element.isVariable() ||
+ element.isParameter() ||
+ element.isField(),
+ message: 'Unexpected context element ${element}'));
+ return element.computeType(compiler);
}
}
@@ -553,8 +550,12 @@
*/
ElementAccess computeResolvedAccess(Send node, SourceString name,
Element element, MemberKind memberKind) {
- if (Elements.isUnresolved(element)) {
+ if (element == null) {
// foo() where foo is unresolved.
+ return lookupMember(node, currentClass.computeType(compiler),
+ name, memberKind);
+ } else if (element.isErroneous()) {
+ // foo() where foo is erroneous.
return const DynamicAccess();
} else if (element.isMember()) {
// foo() where foo is an instance member.
diff --git a/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart b/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
index f1e5291..ee5ccd5 100644
--- a/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart
@@ -307,15 +307,15 @@
final ClassBaseType typeBaseType;
BaseTypes(Compiler compiler) :
- intBaseType = new ClassBaseType(compiler.intClass),
- doubleBaseType = new ClassBaseType(compiler.doubleClass),
- numBaseType = new ClassBaseType(compiler.numClass),
- boolBaseType = new ClassBaseType(compiler.boolClass),
- stringBaseType = new ClassBaseType(compiler.stringClass),
- listBaseType = new ClassBaseType(compiler.listClass),
- mapBaseType = new ClassBaseType(compiler.mapClass),
+ intBaseType = new ClassBaseType(compiler.backend.intImplementation),
+ doubleBaseType = new ClassBaseType(compiler.backend.doubleImplementation),
+ numBaseType = new ClassBaseType(compiler.backend.numImplementation),
+ boolBaseType = new ClassBaseType(compiler.backend.boolImplementation),
+ stringBaseType = new ClassBaseType(compiler.backend.stringImplementation),
+ listBaseType = new ClassBaseType(compiler.backend.listImplementation),
+ mapBaseType = new ClassBaseType(compiler.backend.mapImplementation),
objectBaseType = new ClassBaseType(compiler.objectClass),
- typeBaseType = new ClassBaseType(compiler.typeClass);
+ typeBaseType = new ClassBaseType(compiler.backend.typeImplementation);
}
/**
@@ -414,7 +414,7 @@
return true;
}
- String toString() => "{ this: $typeOfThis, env: ${environment.toString()} }";
+ String toString() => "{ this: $typeOfThis, env: $environment }";
}
/**
@@ -434,6 +434,112 @@
}
/**
+ * A sentinel type mask class representing the dynamicType. It is absorbing
+ * for [:ConcreteTypesEnvironment.typeMaskUnion:].
+ */
+class DynamicTypeMask implements TypeMask {
+ const DynamicTypeMask();
+
+ String toString() => 'sentinel type mask';
+
+ TypeMask nullable() {
+ throw new UnsupportedError("");
+ }
+
+ TypeMask nonNullable() {
+ throw new UnsupportedError("");
+ }
+
+ TypeMask simplify(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool get isEmpty {
+ throw new UnsupportedError("");
+ }
+
+ bool get isNullable {
+ throw new UnsupportedError("");
+ }
+
+ bool get isExact {
+ throw new UnsupportedError("");
+ }
+
+ bool get isUnion {
+ throw new UnsupportedError("");
+ }
+
+ bool containsOnlyInt(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool containsOnlyDouble(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool containsOnlyNum(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool containsOnlyNull(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool containsOnlyBool(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool containsOnlyString(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool containsOnly(ClassElement element) {
+ throw new UnsupportedError("");
+ }
+
+ bool satisfies(ClassElement cls, Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool contains(DartType type, Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool containsAll(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ ClassElement singleClass(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ Iterable<ClassElement> containedClasses(Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ TypeMask union(TypeMask other, Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ TypeMask intersection(TypeMask other, Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool willHit(Selector selector, Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ bool canHit(Element element, Selector selector, Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+
+ Element locateSingleElement(Selector selector, Compiler compiler) {
+ throw new UnsupportedError("");
+ }
+}
+
+/**
* A task which conservatively infers a [ConcreteType] for each sub expression
* of the program. The entry point is [analyzeMain].
*/
@@ -488,15 +594,6 @@
*/
final Map<FunctionElement, Map<ConcreteTypesEnvironment, ConcreteType>> cache;
- /**
- * An ad-hoc cache that overrides the computed cache for very specific cases
- * like [:int + {int}:] where we know better than the type annotations of
- * [:int:] (which we trust as a special case already).
- */
- final Map<FunctionElement, Map<ConcreteTypesEnvironment, ConcreteType>>
- adHocRules;
-
-
/** A map from expressions to their inferred concrete types. */
final Map<Node, ConcreteType> inferredTypes;
@@ -546,8 +643,6 @@
: this.compiler = compiler,
cache = new Map<FunctionElement,
Map<ConcreteTypesEnvironment, ConcreteType>>(),
- adHocRules = new Map<FunctionElement,
- Map<ConcreteTypesEnvironment, ConcreteType>>(),
inferredTypes = new Map<Node, ConcreteType>(),
inferredFieldTypes = new Map<Element, ConcreteType>(),
inferredParameterTypes = new Map<VariableElement, ConcreteType>(),
@@ -560,60 +655,6 @@
unknownConcreteType = new ConcreteType.unknown();
}
- /**
- * Populates [adHocRules] with ad hoc rules who know better than the corelib
- * type annotations for types whose type annotations we trust, like:
- *
- * {int} + {int} -> {int}
- * {double} + {double} -> {double}
- * ...
- */
- populateAdHocRules() {
- // Builds the environment that would be looked up if we were to analyze
- // o.method(arg) where o has concrete type {receiverType} and arg have
- // concrete types {argumentTypes}.
- ConcreteTypesEnvironment makeEnvironment(BaseType receiverType,
- FunctionElement method,
- List<BaseType> argumentTypes) {
- ArgumentsTypes argumentsTypes = new ArgumentsTypes(
- argumentTypes.map((type) => singletonConcreteType(type)).toList(),
- new Map());
- Map<Element, ConcreteType> argumentMap =
- associateArguments(method, argumentsTypes);
- return new ConcreteTypesEnvironment.of(this, argumentMap, receiverType);
- }
-
- // Adds the rule {receiverType}.method({arg1}, ..., {argn}) -> {returnType}
- // to cache.
- void rule(ClassBaseType receiverType, String method,
- List<BaseType> argumentTypes, BaseType returnType) {
- // The following line shouldn't be needed but the mock compiler doesn't
- // resolve num for some reason.
- receiverType.element.ensureResolved(compiler);
- FunctionElement methodElement =
- receiverType.element.lookupMember(new SourceString(method))
- .implementation;
- ConcreteTypesEnvironment environment =
- makeEnvironment(receiverType, methodElement, argumentTypes);
- Map<ConcreteTypesEnvironment, ConcreteType> map =
- adHocRules.containsKey(methodElement)
- ? adHocRules[methodElement]
- : new Map<ConcreteTypesEnvironment, ConcreteType>();
- map[environment] = singletonConcreteType(returnType);
- adHocRules[methodElement] = map;
- }
-
- // The hardcoded typing rules.
- final ClassBaseType int = baseTypes.intBaseType;
- final ClassBaseType double = baseTypes.doubleBaseType;
-
- for (String method in ['+', '*', '-']) {
- for (ClassBaseType type in [int, double]) {
- rule(type, method, [type], type);
- }
- }
- }
-
// --- utility methods ---
/** The unknown concrete type */
@@ -632,6 +673,18 @@
}
/**
+ * Computes the union of [mask1] and [mask2] where [mask1] and [mask2] are
+ * possibly equal to [: DynamicTypeMask.instance :].
+ */
+ TypeMask typeMaskUnion(TypeMask mask1, TypeMask mask2) {
+ if (mask1 == const DynamicTypeMask()
+ || mask2 == const DynamicTypeMask()) {
+ return const DynamicTypeMask();
+ }
+ return mask1.union(mask2, compiler);
+ }
+
+ /**
* Returns all the members with name [methodName].
*/
List<Element> getMembersByName(SourceString methodName) {
@@ -664,6 +717,7 @@
*/
void augmentInferredSelectorType(Selector selector, TypeMask typeOfThis,
TypeMask returnType) {
+ assert(returnType != null);
assert(typeOfThis != null);
selector = selector.asUntyped;
Map<TypeMask, TypeMask> currentMap = inferredSelectorTypes.putIfAbsent(
@@ -671,7 +725,7 @@
TypeMask currentReturnType = currentMap[typeOfThis];
currentMap[typeOfThis] = (currentReturnType == null)
? returnType
- : currentReturnType.union(returnType, compiler);
+ : typeMaskUnion(currentReturnType, returnType);
}
/**
@@ -827,22 +881,20 @@
*/
TypeMask baseTypeToTypeMask(BaseType baseType) {
if (baseType.isUnknown()) {
- return null;
+ return const DynamicTypeMask();
} else if (baseType.isNull()) {
return new TypeMask.empty();
} else {
ClassBaseType classBaseType = baseType;
final element = classBaseType.element;
- if (element != null) {
- if (element == compiler.numClass) {
- return new TypeMask.nonNullSubclass(compiler.numClass.rawType);
- } else if (element == compiler.dynamicClass) {
- return new TypeMask.nonNullSubclass(compiler.objectClass.rawType);
- } else {
- return new TypeMask.nonNullExact(element.rawType);
- }
+ assert(element != null);
+ if (element == compiler.backend.numImplementation) {
+ return new TypeMask.nonNullSubclass(
+ compiler.backend.numImplementation.rawType);
+ } else if (element == compiler.dynamicClass) {
+ return new TypeMask.nonNullSubclass(compiler.objectClass.rawType);
} else {
- return null;
+ return new TypeMask.nonNullExact(element.rawType);
}
}
}
@@ -854,9 +906,9 @@
if (concreteType == null) return null;
TypeMask typeMask = new TypeMask.nonNullEmpty();
for (BaseType baseType in concreteType.baseTypes) {
- TypeMask other = baseTypeToTypeMask(baseType);
- if (other == null) return null;
- typeMask = typeMask.union(baseTypeToTypeMask(baseType), compiler);
+ TypeMask baseMask = baseTypeToTypeMask(baseType);
+ if (baseMask == const DynamicTypeMask()) return baseMask;
+ typeMask = typeMask.union(baseMask, compiler);
}
return typeMask;
}
@@ -865,19 +917,22 @@
* Get the inferred concrete type of [node].
*/
TypeMask getTypeOfNode(Element owner, Node node) {
- return concreteTypeToTypeMask(inferredTypes[node]);
+ TypeMask result = concreteTypeToTypeMask(inferredTypes[node]);
+ return result == const DynamicTypeMask() ? null : result;
}
/**
* Get the inferred concrete type of [element].
*/
TypeMask getTypeOfElement(Element element) {
+ TypeMask result = null;
if (element.isParameter()) {
- return concreteTypeToTypeMask(inferredParameterTypes[element]);
+ result = concreteTypeToTypeMask(inferredParameterTypes[element]);
} else if (element.isField()) {
- return concreteTypeToTypeMask(inferredFieldTypes[element]);
+ result = concreteTypeToTypeMask(inferredFieldTypes[element]);
}
// TODO(polux): handle field parameters
+ return result == const DynamicTypeMask() ? null : result;
}
/**
@@ -891,7 +946,8 @@
templates.forEach((_, concreteType) {
returnType = returnType.union(concreteType);
});
- return concreteTypeToTypeMask(returnType);
+ TypeMask result = concreteTypeToTypeMask(returnType);
+ return result == const DynamicTypeMask() ? null : result;
}
/**
@@ -907,18 +963,18 @@
TypeMask result = new TypeMask.nonNullEmpty();
if (selector.mask == null) {
candidates.forEach((TypeMask receiverType, TypeMask returnType) {
- result = result.union(returnType, compiler);
+ result = typeMaskUnion(result, returnType);
});
} else {
candidates.forEach((TypeMask receiverType, TypeMask returnType) {
TypeMask intersection =
receiverType.intersection(selector.mask, compiler);
if (!intersection.isEmpty || intersection.isNullable) {
- result = result.union(returnType, compiler);
+ result = typeMaskUnion(result, returnType);
}
});
}
- return result;
+ return result == const DynamicTypeMask() ? null : result;
}
// --- analysis ---
@@ -950,7 +1006,12 @@
}
if (selector != null && receiverType != null) {
- TypeMask receiverMask = new TypeMask.nonNullExact(receiverType.rawType);
+ // TODO(polux): generalize to any abstract class if we ever handle other
+ // abstract classes than num.
+ TypeMask receiverMask =
+ (receiverType == compiler.backend.numImplementation)
+ ? new TypeMask.nonNullSubclass(receiverType.rawType)
+ : new TypeMask.nonNullExact(receiverType.rawType);
TypeMask resultMask = concreteTypeToTypeMask(result);
augmentInferredSelectorType(selector, receiverMask, resultMask);
}
@@ -1048,22 +1109,19 @@
ConcreteType getMonomorphicSendReturnType(
FunctionElement function,
ConcreteTypesEnvironment environment) {
- ConcreteType specialType = getSpecialCaseReturnType(function, environment);
- if (specialType != null) return specialType;
-
Map<ConcreteTypesEnvironment, ConcreteType> template = cache[function];
if (template == null) {
template = new Map<ConcreteTypesEnvironment, ConcreteType>();
cache[function] = template;
}
ConcreteType type = template[environment];
+ ConcreteType specialType = getSpecialCaseReturnType(function, environment);
if (type != null) {
- return type;
+ return specialType != null ? specialType : type;
} else {
- workQueue.addLast(
- new InferenceWorkItem(function, environment));
+ workQueue.addLast(new InferenceWorkItem(function, environment));
// in case of a constructor, optimize by returning the class
- return emptyConcreteType;
+ return specialType != null ? specialType : emptyConcreteType;
}
}
@@ -1118,6 +1176,29 @@
return result;
}
+ /// Replaces native types by their backend implementation.
+ Element normalize(Element cls) {
+ if (cls == compiler.boolClass) {
+ return compiler.backend.boolImplementation;
+ }
+ if (cls == compiler.intClass) {
+ return compiler.backend.intImplementation;
+ }
+ if (cls == compiler.doubleClass) {
+ return compiler.backend.doubleImplementation;
+ }
+ if (cls == compiler.numClass) {
+ return compiler.backend.numImplementation;
+ }
+ if (cls == compiler.stringClass) {
+ return compiler.backend.stringImplementation;
+ }
+ if (cls == compiler.listClass) {
+ return compiler.backend.listImplementation;
+ }
+ return cls;
+ }
+
/**
* Handles external methods that cannot be cached because they depend on some
* other state of [ConcreteTypesInferrer] like [:List#[]:] and
@@ -1126,20 +1207,30 @@
*/
ConcreteType getSpecialCaseReturnType(FunctionElement function,
ConcreteTypesEnvironment environment) {
- Map<ConcreteTypesEnvironment, ConcreteType> template = adHocRules[function];
- if (template != null) {
- ConcreteType result = template[environment];
- if (result != null) return result;
- }
- if (trustedClasses.contains(function.enclosingElement)) {
- FunctionSignature signature = function.functionSignature;
- if (environment.matches(signature)) {
- return singletonConcreteType(
- new ClassBaseType(signature.returnType.element));
- } else {
- return null;
+ // Handles int + int, double + double, int - int, ...
+ // We cannot compare function to int#+, int#-, etc. because int and double
+ // don't override these methods. So for 1+2, getSpecialCaseReturnType will
+ // be invoked with function = num#+. We use environment.typeOfThis instead.
+ BaseType baseType = environment.typeOfThis;
+ if (baseType != null && baseType.isClass()) {
+ ClassBaseType classBaseType = baseType;
+ ClassElement cls = classBaseType.element;
+ SourceString name = function.name;
+ if ((cls == baseTypes.intBaseType.element
+ || cls == baseTypes.doubleBaseType.element)
+ && (name == const SourceString('+')
+ || name == const SourceString('-')
+ || name == const SourceString('*'))) {
+ Link<Element> parameters =
+ function.functionSignature.requiredParameters;
+ ConcreteType argumentType = environment.lookupType(parameters.head);
+ if (argumentType.getUniqueType() == cls) {
+ return singletonConcreteType(new ClassBaseType(cls));
+ }
}
- } else if (function == listIndex) {
+ }
+
+ if (function == listIndex) {
ConcreteType indexType = environment.lookupType(
listIndex.functionSignature.requiredParameters.head);
if (!indexType.baseTypes.contains(baseTypes.intBaseType)) {
@@ -1182,6 +1273,7 @@
ConcreteTypesEnvironment environment) {
TreeElements elements =
compiler.enqueuer.resolution.resolvedElements[element.declaration];
+ assert(elements != null);
ConcreteType specialResult = handleSpecialMethod(element, environment);
if (specialResult != null) return specialResult;
FunctionExpression tree = element.parseNode(compiler);
@@ -1203,6 +1295,7 @@
ConcreteType analyzeFieldInitialization(VariableElement element) {
TreeElements elements =
compiler.enqueuer.resolution.resolvedElements[element];
+ assert(elements != null);
Visitor visitor = new TypeInferrerVisitor(elements, element, this,
new ConcreteTypesEnvironment(this));
Node tree = element.parseNode(compiler);
@@ -1241,7 +1334,8 @@
// analyze initializers, including a possible call to super or a redirect
FunctionExpression tree = compiler.parser.parse(element);
TreeElements elements =
- compiler.enqueuer.resolution.resolvedElements[element];
+ compiler.enqueuer.resolution.resolvedElements[element.declaration];
+ assert(elements != null);
Visitor visitor =
new TypeInferrerVisitor(elements, element, this, environment);
@@ -1285,8 +1379,7 @@
/**
* Hook that performs side effects on some special method calls (like
- * [:List(length):]) and possibly returns a concrete type
- * (like [:{JsArray}:]).
+ * [:List(length):]) and possibly returns a concrete type.
*/
ConcreteType handleSpecialMethod(FunctionElement element,
ConcreteTypesEnvironment environment) {
@@ -1299,7 +1392,6 @@
if (lengthType.baseTypes.contains(baseTypes.intBaseType)) {
augmentListElementType(nullConcreteType);
}
- return singletonConcreteType(baseTypes.listBaseType);
}
}
@@ -1310,14 +1402,15 @@
baseTypes = new BaseTypes(compiler);
ClassElement jsArrayClass = baseTypes.listBaseType.element;
listIndex = jsArrayClass.lookupMember(const SourceString('[]'));
- listIndexSet =
- jsArrayClass.lookupMember(const SourceString('[]='));
+ listIndexSet = jsArrayClass.lookupMember(const SourceString('[]='));
+ List<SourceString> typePreservingOps = const [const SourceString('+'),
+ const SourceString('-'),
+ const SourceString('*')];
listConstructor =
compiler.listClass.lookupConstructor(
- new Selector.callConstructor(const SourceString(''),
- compiler.listClass.getLibrary()));
- trustedClasses = new Set.from([compiler.intClass, compiler.doubleClass,
- compiler.numClass]);
+ new Selector.callConstructor(
+ const SourceString(''),
+ compiler.listClass.getLibrary())).implementation;
emptyConcreteType = new ConcreteType.empty(compiler.maxConcreteTypeSize,
baseTypes);
nullConcreteType = singletonConcreteType(const NullBaseType());
@@ -1331,7 +1424,6 @@
bool analyzeMain(Element element) {
initialize();
cache[element] = new Map<ConcreteTypesEnvironment, ConcreteType>();
- populateAdHocRules();
try {
workQueue.addLast(
new InferenceWorkItem(element, new ConcreteTypesEnvironment(this)));
@@ -1424,14 +1516,35 @@
*/
class TypeInferrerVisitor extends ResolvedVisitor<ConcreteType> {
final ConcreteTypesInferrer inferrer;
+ /// Invariant: backend = inferrer.compiler.backend
+ final Backend backend;
final Element currentMethodOrField;
ConcreteTypesEnvironment environment;
Node lastSeenNode;
TypeInferrerVisitor(TreeElements elements, this.currentMethodOrField,
- this.inferrer, this.environment)
- : super(elements);
+ ConcreteTypesInferrer inferrer, this.environment)
+ : this.inferrer = inferrer
+ , this.backend = inferrer.compiler.backend
+ , super(elements) {
+ for (Element element in elements.otherDependencies) {
+ if (element.isClass()) {
+ inferrer.augmentSeenClasses(inferrer.normalize(element));
+ } else {
+ FunctionElement functionElement = element;
+ List<ConcreteType> unknowns = new List.filled(
+ functionElement.computeSignature(inferrer.compiler)
+ .requiredParameterCount,
+ inferrer.unknownConcreteType);
+ inferrer.getSendReturnType(
+ null,
+ functionElement,
+ functionElement.getEnclosingClass(),
+ new ArgumentsTypes(unknowns, new Map()));
+ }
+ }
+ }
ArgumentsTypes analyzeArguments(Link<Node> arguments) {
final positional = new List<ConcreteType>();
@@ -1533,8 +1646,14 @@
}
Element element = elements[node];
assert(element != null);
- environment = environment.put(element, inferrer.nullConcreteType);
- return inferrer.nullConcreteType;
+ ConcreteType result = environment.lookupType(element);
+ if (result != null) {
+ assert(element.isParameter());
+ return result;
+ } else {
+ environment = environment.put(element, inferrer.nullConcreteType);
+ return inferrer.nullConcreteType;
+ }
}
ConcreteType visitIf(If node) {
@@ -1680,19 +1799,19 @@
}
ConcreteType visitLiteralInt(LiteralInt node) {
- inferrer.augmentSeenClasses(inferrer.compiler.intClass);
- inferrer.augmentSeenClasses(inferrer.compiler.numClass);
+ inferrer.augmentSeenClasses(backend.intImplementation);
+ inferrer.augmentSeenClasses(backend.numImplementation);
return inferrer.singletonConcreteType(inferrer.baseTypes.intBaseType);
}
ConcreteType visitLiteralDouble(LiteralDouble node) {
- inferrer.augmentSeenClasses(inferrer.compiler.doubleClass);
- inferrer.augmentSeenClasses(inferrer.compiler.numClass);
+ inferrer.augmentSeenClasses(backend.doubleImplementation);
+ inferrer.augmentSeenClasses(backend.numImplementation);
return inferrer.singletonConcreteType(inferrer.baseTypes.doubleBaseType);
}
ConcreteType visitLiteralBool(LiteralBool node) {
- inferrer.augmentSeenClasses(inferrer.compiler.boolClass);
+ inferrer.augmentSeenClasses(backend.boolImplementation);
return inferrer.singletonConcreteType(inferrer.baseTypes.boolBaseType);
}
@@ -1718,7 +1837,7 @@
}
ConcreteType visitNewExpression(NewExpression node) {
- Element constructor = elements[node.send];
+ Element constructor = elements[node.send].implementation;
inferrer.addCaller(constructor, currentMethodOrField);
ClassElement cls = constructor.enclosingElement;
return inferrer.getSendReturnType(null, constructor, cls,
@@ -1734,7 +1853,7 @@
elementsType = elementsType.union(analyze(link.head));
}
inferrer.augmentListElementType(elementsType);
- inferrer.augmentSeenClasses(inferrer.compiler.listClass);
+ inferrer.augmentSeenClasses(backend.listImplementation);
return inferrer.singletonConcreteType(inferrer.baseTypes.listBaseType);
}
@@ -1938,9 +2057,8 @@
}
}
} else {
- // node is a field of not(this)
- assert(node.receiver != null);
-
+ // node is a field/getter which doesn't belong to the current class or
+ // the field/getter of a mixed-in class
ConcreteType result = inferrer.emptyConcreteType;
void augmentResult(ClassElement baseReceiverType, Element member) {
if (member.isField()) {
@@ -1955,7 +2073,9 @@
// since this is a get we ignore non-fields
}
- ConcreteType receiverType = analyze(node.receiver);
+ ConcreteType receiverType = node.receiver != null
+ ? analyze(node.receiver)
+ : environment.lookupTypeOfThis();
if (receiverType.isUnknown()) {
SourceString name = node.selector.asIdentifier().source;
inferrer.addDynamicCaller(name, currentMethodOrField);
diff --git a/sdk/lib/_internal/compiler/implementation/universe/universe.dart b/sdk/lib/_internal/compiler/implementation/universe/universe.dart
index 764a4d4..8ee58d2b 100644
--- a/sdk/lib/_internal/compiler/implementation/universe/universe.dart
+++ b/sdk/lib/_internal/compiler/implementation/universe/universe.dart
@@ -95,13 +95,14 @@
class SelectorKind {
final String name;
- const SelectorKind(this.name);
+ final int hashCode;
+ const SelectorKind(this.name, this.hashCode);
- static const SelectorKind GETTER = const SelectorKind('getter');
- static const SelectorKind SETTER = const SelectorKind('setter');
- static const SelectorKind CALL = const SelectorKind('call');
- static const SelectorKind OPERATOR = const SelectorKind('operator');
- static const SelectorKind INDEX = const SelectorKind('index');
+ static const SelectorKind GETTER = const SelectorKind('getter', 0);
+ static const SelectorKind SETTER = const SelectorKind('setter', 1);
+ static const SelectorKind CALL = const SelectorKind('call', 2);
+ static const SelectorKind OPERATOR = const SelectorKind('operator', 3);
+ static const SelectorKind INDEX = const SelectorKind('index', 4);
String toString() => name;
}
@@ -116,6 +117,8 @@
final List<SourceString> namedArguments;
final List<SourceString> orderedNamedArguments;
+ int cachedHashCode;
+
Selector(
this.kind,
SourceString name,
@@ -205,7 +208,6 @@
/** Check whether this is a call to 'assert'. */
bool isAssert() => isCall() && identical(name.stringValue, "assert");
- int get hashCode => argumentCount + 1000 * namedArguments.length;
int get namedArgumentCount => namedArguments.length;
int get positionalArgumentCount => argumentCount - namedArgumentCount;
@@ -366,11 +368,13 @@
bool operator ==(other) {
if (other is !Selector) return false;
+ if (identical(this, other)) return true;
return mask == other.mask && equalsUntyped(other);
}
bool equalsUntyped(Selector other) {
- return name == other.name
+ return hashCode == other.hashCode // Fast because it is cached.
+ && name == other.name
&& kind == other.kind
&& identical(library, other.library)
&& argumentCount == other.argumentCount
@@ -378,6 +382,43 @@
&& sameNames(namedArguments, other.namedArguments);
}
+ int get hashCode {
+ // Check the hash code cache first.
+ if (cachedHashCode != null) return cachedHashCode;
+ // Add bits from name and kind.
+ int hash = mixHashCodeBits(name.hashCode, kind.hashCode);
+ // Add bits from the type mask.
+ if (mask != null) hash = mixHashCodeBits(hash, mask.hashCode);
+ // Add bits from the library.
+ if (library != null) hash = mixHashCodeBits(hash, library.hashCode);
+ // Add bits from the unnamed arguments.
+ hash = mixHashCodeBits(hash, argumentCount);
+ // Add bits from the named arguments.
+ int named = namedArguments.length;
+ hash = mixHashCodeBits(hash, named);
+ for (int i = 0; i < named; i++) {
+ hash = mixHashCodeBits(hash, namedArguments[i].hashCode);
+ }
+ return cachedHashCode = hash;
+ }
+
+ // TODO(kasperl): Move this out so it becomes useful in other places too?
+ static int mixHashCodeBits(int existing, int value) {
+ // Spread the bits of value. Try to stay in the 30-bit range to
+ // avoid overflowing into a more expensive integer representation.
+ int h = value & 0x1fffffff;
+ h += ((h & 0x3fff) << 15) ^ 0x1fffcd7d;
+ h ^= (h >> 10);
+ h += ((h & 0x3ffffff) << 3);
+ h ^= (h >> 6);
+ h += ((h & 0x7ffffff) << 2) + ((h & 0x7fff) << 14);
+ h ^= (h >> 16);
+ // Combine the two hash values.
+ int high = existing >> 15;
+ int low = existing & 0x7fff;
+ return (high * 13) ^ (low * 997) ^ h;
+ }
+
List<SourceString> getOrderedNamedArguments() {
if (namedArguments.isEmpty) return namedArguments;
if (!orderedNamedArguments.isEmpty) return orderedNamedArguments;
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 97b7cfa..5425bd1 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -428,6 +428,15 @@
* a qualified non-private identifier optionally followed by "=", or
* a qualified non-private identifier followed by "." and a user-defined operator.''');
+ static const AMBIGUOUS_REEXPORT = const MessageKind(
+ 'Info: "#{element}" is (re)exported by multiple libraries.');
+
+ static const AMBIGUOUS_LOCATION = const MessageKind(
+ 'Info: "#{element}" is defined here.');
+
+ static const IMPORTED_HERE = const MessageKind(
+ 'Info: "#{element}" is imported here.');
+
static const COMPILER_CRASHED = const MessageKind(
"Error: The compiler crashed when compiling this element.");
diff --git a/sdk/lib/_internal/dartdoc/bin/dartdoc.dart b/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
index d9fe3d9..c0fdf6e 100644
--- a/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
@@ -29,10 +29,18 @@
* Run this from the `lib/_internal/dartdoc` directory.
*/
main() {
+ mainWithOptions(new Options());
+}
+
+/**
+ * We use this to include dartdoc in a single snapshot with dart2js.
+ * (They share 90% of the code)
+ */
+mainWithOptions(Options options) {
// Need this because ArgParser.getUsage doesn't show command invocation.
final USAGE = 'Usage dartdoc [options] <entrypoint(s)>\n[options] include:';
- final args = new Options().arguments;
+ final args = options.arguments;
final dartdoc = new Dartdoc();
@@ -239,9 +247,10 @@
// Prepare the dart2js script code and copy static resources.
// TODO(amouravski): move compileScript out and pre-generate the client
// scripts. This takes a long time and the js hardly ever changes.
- .then((_) => compileScript(dartdoc.mode, dartdoc.outputDir, libPath))
- .then((_) => copyDirectory(scriptDir.append('../static'),
- dartdoc.outputDir))
+ .then((_) => compileScript(dartdoc.mode, dartdoc.outputDir, libPath,
+ dartdoc.tmpPath))
+ .then((_) => copyDirectory(libPath.append('lib/_internal/dartdoc/static'),
+ dartdoc.outputDir))
.then((_) {
print(dartdoc.status);
if (dartdoc.totals == 0) {
diff --git a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
index dfc0f45..f470414 100644
--- a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
@@ -103,6 +103,7 @@
print('Copying static files...');
final completer = new Completer();
final fromDir = new Directory.fromPath(from);
+ var futureList = [];
fromDir.list(recursive: false).listen(
(FileSystemEntity entity) {
if (entity is File) {
@@ -112,10 +113,10 @@
File fromFile = entity;
File toFile = new File.fromPath(to.append(name));
- fromFile.openRead().pipe(toFile.openWrite());
+ futureList.add(fromFile.openRead().pipe(toFile.openWrite()));
}
},
- onDone: () => completer.complete(),
+ onDone: () => Future.wait(futureList).then((_) => completer.complete()),
onError: (e) => completer.completeError(e));
return completer.future;
}
@@ -123,42 +124,25 @@
/**
* Compiles the dartdoc client-side code to JavaScript using Dart2js.
*/
-Future compileScript(int mode, Path outputDir, Path libPath) {
+Future compileScript(int mode, Path outputDir, Path libPath, String tmpPath) {
print('Compiling client JavaScript...');
+ var clientScript = (mode == MODE_STATIC) ? 'static' : 'live-nav';
+ var dartdocLibPath = pathos.join(libPath.toNativePath(),
+ 'lib', '_internal', 'dartdoc', 'lib');
+ var dartPath = mode == MODE_STATIC ?
+ pathos.join(tmpPath, 'client.dart') :
+ pathos.join(dartdocLibPath, 'src', 'client', 'client-live-nav.dart');
- // TODO(nweiz): don't run this in an isolate when issue 9815 is fixed.
- return spawnFunction(_compileScript).call({
- 'mode': mode,
- 'outputDir': outputDir.toNativePath(),
- 'libPath': libPath.toNativePath()
- }).then((result) {
- if (result.first == 'success') return;
- throw result[1] + (result[2] == null ? '' : '\n' + result[2]);
- });
-}
+ var jsPath = pathos.join(outputDir.toNativePath(),
+ 'client-$clientScript.js');
-void _compileScript() {
- port.receive((message, replyTo) {
- new Future.sync(() {
- var clientScript = (message['mode'] == MODE_STATIC) ?
- 'static' : 'live-nav';
- var dartPath = pathos.join(message['libPath'], 'lib', '_internal',
- 'dartdoc', 'lib', 'src', 'client', 'client-$clientScript.dart');
- var jsPath = pathos.join(message['outputDir'], 'client-$clientScript.js');
-
- return dart2js.compile(
- new Path(dartPath), new Path(message['libPath']),
- options: const <String>['--categories=Client,Server', '--minify'])
- .then((jsCode) {
- writeString(new File(jsPath), jsCode);
- });
- }).then((_) {
- replyTo.send(['success']);
- }).catchError((error) {
- var trace = getAttachedStackTrace(error);
- var traceString = trace == null ? null : trace.toString();
- replyTo.send(['error', error.toString(), traceString]);
- });
+ return dart2js.compile(
+ new Path(dartPath), libPath,
+ options: const <String>['--categories=Client,Server', '--minify'])
+ .then((jsCode) {
+ if (jsCode != null) {
+ writeString(new File(jsPath), jsCode);
+ }
});
}
@@ -286,6 +270,9 @@
/** The map containing all the exports for each library. */
ExportMap _exports;
+ /** The path to a temporary directory used by Dartdoc. */
+ String tmpPath;
+
/**
* This list contains the libraries sorted in by the library name.
*/
@@ -370,8 +357,8 @@
List<md.InlineSyntax> dartdocSyntaxes =
[new md.CodeSyntax(r'\[:\s?((?:.|\n)*?)\s?:\]')];
-
Dartdoc() {
+ tmpPath = new Directory('').createTempSync().path;
dartdocResolver = (String name) => resolveNameReference(name,
currentLibrary: _currentLibrary, currentType: _currentType,
currentMember: _currentMember);
@@ -782,34 +769,54 @@
writeln(json.stringify(createNavigationInfo()));
endFile();
}
+ /// Whether dartdoc is running from within the Dart SDK or the
+ /// Dart source repository.
+ bool get runningFromSdk =>
+ pathos.extension(new Options().script) == '.snapshot';
+
+ /// Gets the path to the root directory of the SDK.
+ String get sdkDir =>
+ pathos.dirname(pathos.dirname(new Options().executable));
+
+ /// Gets the path to the dartdoc directory normalized for running in different
+ /// places.
+ String get normalizedDartdocPath => runningFromSdk ?
+ pathos.join(sdkDir, 'lib', '_internal', 'dartdoc') :
+ dartdocPath.toString();
void docNavigationDart() {
- final dir = new Directory.fromPath(tmpPath);
- if (!dir.existsSync()) {
- // TODO(3914): Hack to avoid 'file already exists' exception
- // thrown due to invalid result from dir.existsSync() (probably due to
- // race conditions).
- try {
- dir.createSync();
- } on DirectoryIOException catch (e) {
- // Ignore.
- }
+ var tmpDir = new Directory(tmpPath);
+ if (!tmpDir.existsSync()) {
+ tmpDir.createSync();
}
String jsonString = json.stringify(createNavigationInfo());
String dartString = jsonString.replaceAll(r"$", r"\$");
- final filePath = tmpPath.append('nav.dart');
- writeString(new File.fromPath(filePath),
- '''part of client;
- get json => $dartString;''');
+ var filePath = pathos.join(tmpPath, 'client.dart');
+ var clientDir = pathos.relative(
+ pathos.join(normalizedDartdocPath, 'lib', 'src', 'client'),
+ from: tmpPath);
+
+ writeString(new File(filePath),
+ '''library client;
+ import 'dart:html';
+ import 'dart:json';
+ import '${pathos.join(clientDir, 'client-shared.dart')}';
+ import '${pathos.join(clientDir, 'dropdown.dart')}';
+
+ main() {
+ setup();
+ setupSearch(json);
+ }
+
+ get json => $dartString;''');
}
- Path get tmpPath => dartdocPath.append('tmp');
-
void cleanup() {
- final dir = new Directory.fromPath(tmpPath);
- if (dir.existsSync()) {
- dir.deleteSync(recursive: true);
+ var tmpDir = new Directory(tmpPath);
+ if (tmpDir.existsSync()) {
+ tmpDir.deleteSync(recursive: true);
}
+ tmpPath = null;
}
List createNavigationInfo() {
diff --git a/sdk/lib/_internal/dartdoc/lib/src/client/client-live-nav.dart b/sdk/lib/_internal/dartdoc/lib/src/client/client-live-nav.dart
index 6d0948c..9d52c49 100644
--- a/sdk/lib/_internal/dartdoc/lib/src/client/client-live-nav.dart
+++ b/sdk/lib/_internal/dartdoc/lib/src/client/client-live-nav.dart
@@ -7,7 +7,6 @@
import 'dart:html';
import 'dart:json' as jsonlib;
-import '../../../../compiler/implementation/source_file.dart';
// TODO(rnystrom): Use "package:" URL (#4968).
import '../../classify.dart';
import '../../markdown.dart' as md;
diff --git a/sdk/lib/_internal/dartdoc/lib/src/client/client-static.dart b/sdk/lib/_internal/dartdoc/lib/src/client/client-static.dart
deleted file mode 100644
index d76b21e..0000000
--- a/sdk/lib/_internal/dartdoc/lib/src/client/client-static.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/** Provides client-side behavior for generated docs using the static mode. */
-library client;
-
-import 'dart:html';
-import 'dart:json';
-import 'dropdown.dart';
-import 'client-shared.dart';
-
-part '../../../tmp/nav.dart';
-
-main() {
- setup();
- setupSearch(json);
-}
diff --git a/sdk/lib/_internal/pub/test/command_line_config.dart b/sdk/lib/_internal/pub/test/command_line_config.dart
index ed55aff..bdceafb 100644
--- a/sdk/lib/_internal/pub/test/command_line_config.dart
+++ b/sdk/lib/_internal/pub/test/command_line_config.dart
@@ -106,11 +106,8 @@
return result.toString();
}
- String _indent(String str) {
- // TODO(nweiz): Use this simpler code once issue 2980 is fixed.
- // return str.replaceAll(new RegExp("^", multiLine: true), " ");
- return str.split("\n").map((line) => " $line").join("\n");
- }
+ String _indent(String str) =>
+ str.replaceAll(new RegExp("^", multiLine: true), " ");
}
class _StackFrame {
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 43697ec..bff0435 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -1033,7 +1033,7 @@
*
* An example that duplicates all data events:
*
- * class DoubleTransformer<T> extends StreamEventTransformerBase<T, T> {
+ * class DoubleTransformer<T> extends StreamEventTransformer<T, T> {
* void handleData(T data, EventSink<T> sink) {
* sink.add(value);
* sink.add(value);
diff --git a/sdk/lib/collection/hash_map.dart b/sdk/lib/collection/hash_map.dart
index 431c89f..2aea9c9 100644
--- a/sdk/lib/collection/hash_map.dart
+++ b/sdk/lib/collection/hash_map.dart
@@ -4,6 +4,17 @@
part of dart.collection;
+/**
+ * A hash-table based implementation of [Map].
+ *
+ * The keys of a `HashMap` must have consistent [Object.operator==]
+ * and [Object.hashCode] implementations. This means that the `==` operator
+ * must define a stable equivalence relation on the keys (reflexive,
+ * anti-symmetric, transitive, and consistent over time), and that `hashCode`
+ * must be the same for objects that are considered equal by `==`.
+ *
+ * The map allows `null` as a key.
+ */
class HashMap<K, V> implements Map<K, V> {
external HashMap();
diff --git a/sdk/lib/collection/hash_set.dart b/sdk/lib/collection/hash_set.dart
index 8d484db..e2c797d 100644
--- a/sdk/lib/collection/hash_set.dart
+++ b/sdk/lib/collection/hash_set.dart
@@ -56,6 +56,20 @@
String toString() => ToString.iterableToString(this);
}
+/**
+ * A [HashSet] is a hash-table based [Set] implementation.
+ *
+ * The elements of a `HashSet` must have consistent [Object.operator==]
+ * and [Object.hashCode] implementations. This means that the `==` operator
+ * must define a stable equivalence relation on the elements (reflexive,
+ * anti-symmetric, transitive, and consistent over time), and that `hashCode`
+ * must be the same for objects that are considered equal by `==`.
+ *
+ * The set allows `null` as an element.
+ *
+ * Most simple operations on `HashSet` are done in constant time: [add],
+ * [contains], [remove], and [length].
+ */
class HashSet<E> extends _HashSetBase<E> {
external HashSet();
@@ -74,7 +88,7 @@
external bool contains(Object object);
- // Collection.
+ // Set.
external void add(E element);
external void addAll(Iterable<E> objects);
@@ -89,6 +103,5 @@
external void clear();
- // Set.
Set<E> _newSet() => new HashSet<E>();
}
diff --git a/sdk/lib/collection/linked_hash_map.dart b/sdk/lib/collection/linked_hash_map.dart
index d41cb40..8e6538c 100644
--- a/sdk/lib/collection/linked_hash_map.dart
+++ b/sdk/lib/collection/linked_hash_map.dart
@@ -5,7 +5,18 @@
part of dart.collection;
/**
- * A hash-based map that iterates keys and values in key insertion order.
+ * A hash-table based implementation of [Map].
+ *
+ * Keys insertion order is remembered, and keys are iterated in insertion order.
+ * Values are iterated in their corresponding key's order.
+ *
+ * The keys of a `HashMap` must have consistent [Object.operator==]
+ * and [Object.hashCode] implementations. This means that the `==` operator
+ * must define a stable equivalence relation on the keys (reflexive,
+ * anti-symmetric, transitive, and consistent over time), and that `hashCode`
+ * must be the same for objects that are considered equal by `==`.
+ *
+ * The map allows `null` as a key.
*/
class LinkedHashMap<K, V> implements Map<K, V> {
external LinkedHashMap();
@@ -32,7 +43,9 @@
external void forEach(void action (K key, V value));
+ /** The keys of the map, in insertion order. */
external Iterable<K> get keys;
+ /** The values of the map, in the order of their corresponding [keys].*/
external Iterable<V> get values;
external int get length;
diff --git a/sdk/lib/collection/linked_hash_set.dart b/sdk/lib/collection/linked_hash_set.dart
index ee9cdb1..28b7ce2 100644
--- a/sdk/lib/collection/linked_hash_set.dart
+++ b/sdk/lib/collection/linked_hash_set.dart
@@ -4,6 +4,23 @@
part of dart.collection;
+/**
+ * A [LinkedHashSet] is a hash-table based [Set] implementation.
+ *
+ * The `LinkedHashSet` also keep track of the order that elements were inserted
+ * in, and iteration happens in first-to-last insertion order.
+ *
+ * The elements of a `LinkedHashSet` must have consistent [Object.operator==]
+ * and [Object.hashCode] implementations. This means that the `==` operator
+ * must define a stable equivalence relation on the elements (reflexive,
+ * anti-symmetric, transitive, and consistent over time), and that `hashCode`
+ * must be the same for objects that are considered equal by `==`.
+ *
+ * The set allows `null` as an element.
+ *
+ * Most simple operations on `HashSet` are done in constant time: [add],
+ * [contains], [remove], and [length].
+ */
class LinkedHashSet<E> extends _HashSetBase<E> {
external LinkedHashSet();
@@ -13,6 +30,8 @@
}
// Iterable.
+
+ /** Return an iterator that iterates over elements in insertion order. */
external Iterator<E> get iterator;
external int get length;
@@ -23,6 +42,7 @@
external bool contains(Object object);
+ /** Perform an operation on each element in insertion order. */
external void forEach(void action(E element));
external E get first;
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index 060eba7..245fc49 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -235,6 +235,13 @@
String toString() => "Stack Overflow";
}
+class FiftyThreeBitOverflowError implements Error {
+ final Object value;
+
+ const FiftyThreeBitOverflowError(this.value);
+ String toString() => "53-bit Overflow: $value";
+}
+
/**
* Error thrown when a lazily initialized variable cannot be initialized.
*
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 672c8b8..419527e 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -374,7 +374,8 @@
* Returns an unmodifiable [Map] view of `this`.
*
* It has the indices of this list as keys, and the corresponding elements
- * as values.
+ * as values. The [Map.keys] [Iterable] will iterate the indices of this list
+ * in numerical order.
*/
Map<int, E> asMap();
}
diff --git a/sdk/lib/core/num.dart b/sdk/lib/core/num.dart
index eb8f82c..19dbbe2 100644
--- a/sdk/lib/core/num.dart
+++ b/sdk/lib/core/num.dart
@@ -22,7 +22,7 @@
*
* Returns the remainder of the euclidean division. The euclidean division of
* two integers `a` and `b` yields two integers `q` and `r` such that
- * `a = b*q + r` and `0 <= r < |a|`.
+ * `a == b*q + r` and `0 <= r < a.abs()`.
*
* The euclidean division is only defined for integers, but can be easily
* extended to work with doubles. In that case `r` may have a non-integer
@@ -51,10 +51,10 @@
/** Negate operator. */
num operator -();
- /**
- * Return the remainder of the truncating division of `this` by [other].
+ /**
+ * Returns the remainder of the truncating division of `this` by [other].
*
- * The result `r` of this operation satisfies: `this = this ~/ other + r`.
+ * The result `r` of this operation satisfies: `this == this ~/ other + r`.
* As a consequence the remainder `r` has the same sign as the dividend
* `this`.
*/
@@ -165,8 +165,8 @@
double toDouble();
/**
- * Converts [this] to a string representation with [fractionDigits] digits
- * after the decimal point.
+ * Converts [this] to a [double] and then gives string representation with
+ * [fractionDigits] digits after the decimal point.
*
* The parameter [fractionDigits] must be an integer satisfying:
* [:0 <= fractionDigits <= 20:].
@@ -174,8 +174,8 @@
String toStringAsFixed(int fractionDigits);
/**
- * Converts [this] to a string in decimal exponential notation with
- * [fractionDigits] digits after the decimal point.
+ * Converts [this] to a [double] and then gives a string in decimal
+ * exponential notation with [fractionDigits] digits after the decimal point.
*
* If [fractionDigits] is given then it must be an integer satisfying:
* [:0 <= fractionDigits <= 20:]. Without the parameter the returned string
@@ -184,13 +184,11 @@
String toStringAsExponential([int fractionDigits]);
/**
- * Converts [this] to a string representation with [precision] significant
- * digits.
+ * Converts [this] to a double and gives a string representation with
+ * [precision] significant digits.
*
* The parameter [precision] must be an integer satisfying:
* [:1 <= precision <= 21:].
*/
String toStringAsPrecision(int precision);
-
-
}
diff --git a/sdk/lib/core/regexp.dart b/sdk/lib/core/regexp.dart
index c6db026..dd29d51 100644
--- a/sdk/lib/core/regexp.dart
+++ b/sdk/lib/core/regexp.dart
@@ -18,7 +18,7 @@
* for (Match m in matches) {
* String match = m.group(0);
* print(match);
- * };
+ * }
*
* The output of the example is:
*
diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart
index ff8d4b3..7b5980e 100644
--- a/sdk/lib/core/set.dart
+++ b/sdk/lib/core/set.dart
@@ -5,14 +5,37 @@
part of dart.core;
/**
- * This class is the public interface of a set. A set is a collection
- * without duplicates.
+ * A `Set` is a collection of elements where each element can occur only once.
+ *
+ * That is, for each object of the element type, the object is either considered
+ * to be in the set, or it is not in the set.
+ *
+ * Set implementations may consider some elements indistinguishable. These
+ * objects will be treated as being the same for any operation on the set.
+ *
+ * The default `Set` implementation, [HashSet], considers objects
+ * indistinguishable if they are equal with regard to [Object.operator==].
+ *
+ * Sets may be either ordered or unordered. [HashSet] is unordered and doesn't
+ * guarantee anything about the order that elements are accessed in by
+ * iteration. [LinkedHashSet] iterates in the insertion order of its elements.
*/
abstract class Set<E> extends IterableBase<E> {
+ /**
+ * Creates an empty [Set].
+ *
+ * The created `Set` is a [HashSet]. As such, it considers elements that
+ * are equal (using `==`) to be undistinguishable, and requires them to
+ * have a compatible [Object.hashCode] implementation.
+ */
factory Set() => new HashSet<E>();
/**
* Creates a [Set] that contains all elements of [other].
+ *
+ * The created `Set` is a [HashSet]. As such, it considers elements that
+ * are equal (using `==`) to be undistinguishable, and requires them to
+ * have a compatible [Object.hashCode] implementation.
*/
factory Set.from(Iterable<E> other) => new HashSet<E>.from(other);
@@ -22,8 +45,9 @@
bool contains(E value);
/**
- * Adds [value] into the set. The method has no effect if
- * [value] was already in the set.
+ * Adds [value] into the set.
+ *
+ * The method has no effect if [value] is already in the set.
*/
void add(E value);
@@ -43,13 +67,12 @@
bool remove(Object value);
/**
- * Removes all of [elements] from this set.
+ * Removes each element of [elements] from this set.
*/
void removeAll(Iterable elements);
/**
- * Removes all elements of this set that are not
- * in [elements].
+ * Removes all elements of this set that are not elements in [elements].
*/
void retainAll(Iterable elements);
@@ -64,22 +87,31 @@
void retainWhere(bool test(E element));
/**
- * Returns true if this Set contains all the elements of [other].
+ * Returns whether this Set contains all the elements of [other].
*/
bool containsAll(Iterable<E> other);
/**
* Returns a new set which is the intersection between this set and [other].
+ *
+ * That is, the returned set contains all the elements of this `Set` that
+ * are also elements of [other].
*/
Set<E> intersection(Set<E> other);
/**
* Returns a new set which contains all the elements of this set and [other].
+ *
+ * That is, the returned set contains all the elements of this `Set` and
+ * all the elements of [other].
*/
Set<E> union(Set<E> other);
/**
* Returns a new set with the the elements of this that are not in [other].
+ *
+ * That is, the returned set contains all the elements of this `Set` that
+ * are not elements of [other].
*/
Set<E> difference(Set<E> other);
diff --git a/sdk/lib/core/string.dart b/sdk/lib/core/string.dart
index 3f0ad31..0b4fbd4 100644
--- a/sdk/lib/core/string.dart
+++ b/sdk/lib/core/string.dart
@@ -179,10 +179,14 @@
String trim();
/**
- * Returns whether this string contains [other] starting
- * at [startIndex] (inclusive).
+ * Returns whether this string contains a match of [other].
+ *
+ * If [startIndex] is provided, only matches at or after that index
+ * are considered.
+ *
+ * It is an error if [startIndex] is negative or greater than [length].
*/
- bool contains(Pattern other, [int startIndex]);
+ bool contains(Pattern other, [int startIndex = 0]);
/**
* Returns a new string where the first occurence of [from] in this string
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index a7926dd..75bd214 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -9,6 +9,7 @@
*/
class Uri {
int _port;
+ String _path;
/**
* Returns the scheme component.
@@ -63,7 +64,7 @@
*
* Returns the empty string if there is no path component.
*/
- final String path;
+ String get path => _path;
/**
* Returns the query component. The returned query is encoded. To get
@@ -137,7 +138,9 @@
* is percent-encoded and joined using the forward slash
* separator. The percent-encoding of the path segments encodes all
* characters except for the unreserved characters and the following
- * list of characters: `!$&'()*+,;=:@`.
+ * list of characters: `!$&'()*+,;=:@`. If the other components
+ * calls for an absolute path a leading slash `/` is prepended if
+ * not already there.
*
* The query component is set through either [query] or
* [queryParameters]. When [query] is used the provided string is
@@ -160,7 +163,6 @@
Map<String, String> queryParameters,
fragment: ""}) :
scheme = _makeScheme(scheme),
- path = _makePath(path, pathSegments),
query = _makeQuery(query, queryParameters),
fragment = _makeFragment(fragment) {
// Perform scheme specific normalization.
@@ -171,23 +173,29 @@
} else {
_port = port;
}
+ // Fill the path.
+ _path = _makePath(path, pathSegments);
}
/*
* Returns the URI path split into its segments. Each of the
* segments in the returned list have been decoded. If the path is
- * empty the empty list will be returned.
+ * empty the empty list will be returned. A leading slash `/` does
+ * not affect the segments returned.
*
- * The returned list is immutable and will throw [StateError] on any
+ * The returned list is unmodifiable and will throw [UnsupportedError] on any
* calls that would mutate it.
*/
List<String> get pathSegments {
if (_pathSegments == null) {
+ var pathToSplit = !path.isEmpty && path.codeUnitAt(0) == _SLASH
+ ? path.substring(1)
+ : path;
_pathSegments = new UnmodifiableListView(
- path == "" ? const<String>[]
- : path.split("/")
- .map(Uri.decodeComponent)
- .toList(growable: false));
+ pathToSplit == "" ? const<String>[]
+ : pathToSplit.split("/")
+ .map(Uri.decodeComponent)
+ .toList(growable: false));
}
return _pathSegments;
}
@@ -198,7 +206,7 @@
* and value in the returned map have been decoded. If there is no
* query the empty map will be returned.
*
- * The returned map is immutable and will throw [StateError] on any
+ * The returned map is unmodifiable and will throw [UnsupportedError] on any
* calls that would mutate it.
*/
Map<String, String> get queryParameters {
@@ -247,14 +255,22 @@
return allLowercase ? scheme : scheme.toLowerCase();
}
- static String _makePath(String path, List<String> pathSegments) {
+ String _makePath(String path, List<String> pathSegments) {
if (path == null && pathSegments == null) return "";
if (path != null && pathSegments != null) {
throw new ArgumentError('Both path and pathSegments specified');
}
- if (path != null) return _normalize(path);
-
- return pathSegments.map((s) => _uriEncode(_pathCharTable, s)).join("/");
+ var result;
+ if (path != null) {
+ result = _normalize(path);
+ } else {
+ result = pathSegments.map((s) => _uriEncode(_pathCharTable, s)).join("/");
+ }
+ if ((hasAuthority || (scheme == "file")) &&
+ result.isNotEmpty && !result.startsWith("/")) {
+ return "/$result";
+ }
+ return result;
}
static String _makeQuery(String query, Map<String, String> queryParameters) {
@@ -705,6 +721,7 @@
// Frequently used character codes.
static const int _PERCENT = 0x25;
static const int _PLUS = 0x2B;
+ static const int _SLASH = 0x2F;
static const int _ZERO = 0x30;
static const int _NINE = 0x39;
static const int _COLON = 0x3A;
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index e9de909..a3f0363 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -2058,13 +2058,10 @@
@DocsEditable
String name;
- @JSName('None')
- @DomName('WebKitCSSKeyframesRule')
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental
- // http://www.w3.org/TR/css3-animations/#csskeyframesrule
- CssKeyframeRule item(int index) native;
+ @DomName('WebKitCSSKeyframesRule.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ CssKeyframeRule __getter__(int index) native;
@DomName('WebKitCSSKeyframesRule.deleteRule')
@DocsEditable
@@ -7129,9 +7126,10 @@
@DocsEditable
String value;
- @JSName('None')
- @DomName('DOMSettableTokenList')
- String item(int index) native;
+ @DomName('DOMSettableTokenList.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ String __getter__(int index) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -7206,7 +7204,7 @@
@DomName('DOMStringMap')
abstract class DomStringMap {
- String None(String name);
+ String __getter__(String name);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -9099,6 +9097,23 @@
// BSD-style license that can be found in the LICENSE file.
+@DomName('ElementTimeControl')
+@Unstable
+abstract class ElementTimeControl {
+
+ void beginElement();
+
+ void beginElementAt(num offset);
+
+ void endElement();
+
+ void endElementAt(num offset);
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+
@DomName('ElementTraversal')
@Unstable
abstract class ElementTraversal {
@@ -10599,9 +10614,10 @@
@DocsEditable
String target;
- @JSName('None')
- @DomName('HTMLFormElement')
- Node item(int index) native;
+ @DomName('HTMLFormElement.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ Node __getter__(int index) native;
@DomName('HTMLFormElement.checkValidity')
@DocsEditable
@@ -11283,9 +11299,10 @@
@DomName('HTMLFormControlsCollection')
class HtmlFormControlsCollection extends HtmlCollection native "HTMLFormControlsCollection" {
- @JSName('None')
- @DomName('HTMLFormControlsCollection')
- Node item(int index) native;
+ @DomName('HTMLFormControlsCollection.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ Node __getter__(int index) native;
@DomName('HTMLFormControlsCollection.namedItem')
@DocsEditable
@@ -11859,7 +11876,7 @@
@DomName('XMLHttpRequestUpload')
// http://xhr.spec.whatwg.org/#xmlhttprequestupload
@Experimental
-class HttpRequestUpload extends EventTarget native "XMLHttpRequestUpload" {
+class HttpRequestUpload extends EventTarget native "XMLHttpRequestUpload,XMLHttpRequestEventTarget" {
@DomName('XMLHttpRequestUpload.abortEvent')
@DocsEditable
@@ -18862,7 +18879,8 @@
// Override default options, since IE returns SelectElement itself and it
// does not operate as a List.
List<OptionElement> get options {
- var options = this.children.where((e) => e is OptionElement).toList();
+ var options =
+ this.queryAll('option').where((e) => e is OptionElement).toList();
return new UnmodifiableListView(options);
}
@@ -19908,10 +19926,10 @@
@DocsEditable
final int $dom_length;
- @JSName('None')
- @DomName('Storage')
- @Unstable
- String anonymousIndexedGetter(index_OR_name) native;
+ @DomName('Storage.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ String __getter__(index_OR_name) native;
@JSName('clear')
@DomName('Storage.clear')
@@ -22903,17 +22921,21 @@
@Returns('Window|=Object')
final dynamic _get_window;
- @DomName('Window')
+ @DomName('Window.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
@Creates('Window|=Object')
@Returns('Window|=Object')
- WindowBase anonymousIndexedGetter(int index) {
- return _convertNativeToDart_Window(_anonymousIndexedGetter_1(index));
+ WindowBase __getter__(int index) {
+ return _convertNativeToDart_Window(___getter___1(index));
}
- @JSName('None')
- @DomName('Window')
+ @JSName('__getter__')
+ @DomName('Window.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
@Creates('Window|=Object')
@Returns('Window|=Object')
- _anonymousIndexedGetter_1(index) native;
+ ___getter___1(index) native;
@JSName('addEventListener')
@DomName('Window.addEventListener')
@@ -29139,7 +29161,7 @@
int get _realCharCode => JS('int', '#.charCode', _parent);
/** Accessor to the underlying altKey value is the parent event. */
- bool get _realAltKey => JS('int', '#.altKey', _parent);
+ bool get _realAltKey => JS('bool', '#.altKey', _parent);
/** Construct a KeyEvent with [parent] as the event we're emulating. */
KeyEvent(KeyboardEvent parent): super(parent) {
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 1942b09..e8df740 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -2491,12 +2491,10 @@
@DocsEditable
void set name(String value) native "WebKitCSSKeyframesRule_name_Setter";
- @DomName('WebKitCSSKeyframesRule')
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental
- // http://www.w3.org/TR/css3-animations/#csskeyframesrule
- CssKeyframeRule item(int index) native "WebKitCSSKeyframesRule_None_Callback";
+ @DomName('WebKitCSSKeyframesRule.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ CssKeyframeRule __getter__(int index) native "WebKitCSSKeyframesRule___getter___Callback";
@DomName('WebKitCSSKeyframesRule.deleteRule')
@DocsEditable
@@ -7564,8 +7562,10 @@
@DocsEditable
void set value(String value) native "DOMSettableTokenList_value_Setter";
- @DomName('DOMSettableTokenList')
- String item(int index) native "DOMSettableTokenList_None_Callback";
+ @DomName('DOMSettableTokenList.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ String __getter__(int index) native "DOMSettableTokenList___getter___Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -7650,8 +7650,10 @@
class DomStringMap extends NativeFieldWrapperClass1 {
DomStringMap.internal();
- @DomName('DOMStringMap')
- String item(String name) native "DOMStringMap_None_Callback";
+ @DomName('DOMStringMap.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ String __getter__(String name) native "DOMStringMap___getter___Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -9387,6 +9389,36 @@
@DocsEditable
+@DomName('ElementTimeControl')
+@Unstable
+class ElementTimeControl extends NativeFieldWrapperClass1 {
+ ElementTimeControl.internal();
+
+ @DomName('ElementTimeControl.beginElement')
+ @DocsEditable
+ void beginElement() native "ElementTimeControl_beginElement_Callback";
+
+ @DomName('ElementTimeControl.beginElementAt')
+ @DocsEditable
+ void beginElementAt(num offset) native "ElementTimeControl_beginElementAt_Callback";
+
+ @DomName('ElementTimeControl.endElement')
+ @DocsEditable
+ void endElement() native "ElementTimeControl_endElement_Callback";
+
+ @DomName('ElementTimeControl.endElementAt')
+ @DocsEditable
+ void endElementAt(num offset) native "ElementTimeControl_endElementAt_Callback";
+
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
+
+@DocsEditable
@DomName('ElementTraversal')
@Unstable
class ElementTraversal extends NativeFieldWrapperClass1 {
@@ -11006,8 +11038,10 @@
@DocsEditable
void set target(String value) native "HTMLFormElement_target_Setter";
- @DomName('HTMLFormElement')
- Node item(int index) native "HTMLFormElement_None_Callback";
+ @DomName('HTMLFormElement.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ Node __getter__(int index) native "HTMLFormElement___getter___Callback";
@DomName('HTMLFormElement.checkValidity')
@DocsEditable
@@ -11704,8 +11738,10 @@
class HtmlFormControlsCollection extends HtmlCollection {
HtmlFormControlsCollection.internal() : super.internal();
- @DomName('HTMLFormControlsCollection')
- Node item(int index) native "HTMLFormControlsCollection_None_Callback";
+ @DomName('HTMLFormControlsCollection.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ Node __getter__(int index) native "HTMLFormControlsCollection___getter___Callback";
@DomName('HTMLFormControlsCollection.namedItem')
@DocsEditable
@@ -20178,7 +20214,8 @@
// Override default options, since IE returns SelectElement itself and it
// does not operate as a List.
List<OptionElement> get options {
- var options = this.children.where((e) => e is OptionElement).toList();
+ var options =
+ this.queryAll('option').where((e) => e is OptionElement).toList();
return new UnmodifiableListView(options);
}
@@ -21395,19 +21432,19 @@
@DocsEditable
int get $dom_length native "Storage_length_Getter";
- String anonymousIndexedGetter(index_OR_name) {
+ String __getter__(index_OR_name) {
if ((index_OR_name is int || index_OR_name == null)) {
- return _None_1(index_OR_name);
+ return ___getter___1(index_OR_name);
}
if ((index_OR_name is String || index_OR_name == null)) {
- return _None_2(index_OR_name);
+ return ___getter___2(index_OR_name);
}
throw new ArgumentError("Incorrect number or type of arguments");
}
- String _None_1(index_OR_name) native "Storage__None_1_Callback";
+ String ___getter___1(index_OR_name) native "Storage____getter___1_Callback";
- String _None_2(index_OR_name) native "Storage__None_2_Callback";
+ String ___getter___2(index_OR_name) native "Storage____getter___2_Callback";
@DomName('Storage.clear')
@DocsEditable
@@ -24436,8 +24473,10 @@
@DocsEditable
WindowBase get window native "DOMWindow_window_Getter";
- @DomName('Window')
- WindowBase anonymousIndexedGetter(int index) native "DOMWindow_None_Callback";
+ @DomName('Window.__getter__')
+ @DocsEditable
+ @Experimental // untriaged
+ WindowBase __getter__(int index) native "DOMWindow___getter___Callback";
@DomName('Window.addEventListener')
@DocsEditable
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 0a16be9..15d7ee8 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -1485,6 +1485,7 @@
Future<HttpClientRequest> _openUrlFromRequest(String method,
Uri uri,
_HttpClientRequest previous) {
+ var u = uri;
// If the new URI is relative (to either '/' or some sub-path),
// construct a full URI from the previous one.
// See http://tools.ietf.org/html/rfc3986#section-4.2
@@ -1497,17 +1498,24 @@
query: uri.query,
fragment: uri.fragment);
}
+
+ var scheme;
+ var host;
+ var port;
+ var path;
if (uri.host.isEmpty) {
- replaceComponents(host: previous.uri.host, port: previous.uri.port);
+ host = previous.uri.host;
+ port = previous.uri.port;
}
if (uri.scheme.isEmpty) {
- replaceComponents(scheme: previous.uri.scheme);
+ scheme = previous.uri.scheme;
}
- if (!uri.path.startsWith('/') && previous.uri.path.startsWith('/')) {
+ if (!uri.path.startsWith('/')) {
var absolute = new Path.raw(previous.uri.path).directoryPath;
- absolute = absolute.join(new Path.raw(uri.path));
- replaceComponents(path: absolute.canonicalize().toString());
+ absolute = absolute.join(new Path.raw(u.path));
+ path = absolute.canonicalize().toString();
}
+ replaceComponents(scheme: scheme, host: host, port: port, path: path);
return openUrl(method, uri).then((_HttpClientRequest request) {
// Only follow redirects if initial request did.
request.followRedirects = previous.followRedirects;
diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart
index 62fb74b..8a8ad6c 100644
--- a/sdk/lib/svg/dart2js/svg_dart2js.dart
+++ b/sdk/lib/svg/dart2js/svg_dart2js.dart
@@ -1243,23 +1243,6 @@
// BSD-style license that can be found in the LICENSE file.
-@DomName('ElementTimeControl')
-@Unstable
-abstract class ElementTimeControl {
-
- void beginElement();
-
- void beginElementAt(num offset);
-
- void endElement();
-
- void endElementAt(num offset);
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
@DocsEditable
@DomName('SVGEllipseElement')
@Unstable
diff --git a/sdk/lib/svg/dartium/svg_dartium.dart b/sdk/lib/svg/dartium/svg_dartium.dart
index 713e9ab..ee6484f 100644
--- a/sdk/lib/svg/dartium/svg_dartium.dart
+++ b/sdk/lib/svg/dartium/svg_dartium.dart
@@ -1357,36 +1357,6 @@
@DocsEditable
-@DomName('ElementTimeControl')
-@Unstable
-class ElementTimeControl extends NativeFieldWrapperClass1 {
- ElementTimeControl.internal();
-
- @DomName('ElementTimeControl.beginElement')
- @DocsEditable
- void beginElement() native "ElementTimeControl_beginElement_Callback";
-
- @DomName('ElementTimeControl.beginElementAt')
- @DocsEditable
- void beginElementAt(num offset) native "ElementTimeControl_beginElementAt_Callback";
-
- @DomName('ElementTimeControl.endElement')
- @DocsEditable
- void endElement() native "ElementTimeControl_endElement_Callback";
-
- @DomName('ElementTimeControl.endElementAt')
- @DocsEditable
- void endElementAt(num offset) native "ElementTimeControl_endElementAt_Callback";
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
-
-@DocsEditable
@DomName('SVGEllipseElement')
@Unstable
class EllipseElement extends StyledElement implements Transformable, Tests, ExternalResourcesRequired, LangSpace {
diff --git a/tests/co19/co19-analyzer.status b/tests/co19/co19-analyzer.status
index c24c867..c3a7852 100644
--- a/tests/co19/co19-analyzer.status
+++ b/tests/co19/co19-analyzer.status
@@ -190,3 +190,23 @@
# infinite loop
Language/14_Types/4_Interface_Types_A11_t01: skip
Language/14_Types/4_Interface_Types_A11_t02: skip
+
+# co19 issue #424, Uninitialized finals are warnings not errors
+Language/05_Variables/05_Variables_A05_t05: fail, OK
+Language/05_Variables/05_Variables_A05_t06: fail, OK
+Language/05_Variables/05_Variables_A05_t07: fail, OK
+Language/05_Variables/05_Variables_A05_t08: fail, OK
+Language/05_Variables/05_Variables_A05_t09: fail, OK
+Language/05_Variables/05_Variables_A05_t10: fail, OK
+Language/05_Variables/05_Variables_A07_t05: fail, OK
+Language/05_Variables/05_Variables_A07_t06: fail, OK
+Language/05_Variables/05_Variables_A07_t07: fail, OK
+Language/05_Variables/05_Variables_A07_t08: fail, OK
+Language/05_Variables/05_Variables_A08_t01: fail, OK
+Language/11_Expressions/11_Instance_Creation/2_Const_A01_t02: fail, OK
+
+# co19 issue #425, Only static fields can be declared as 'const'
+Language/05_Variables/05_Variables_A12_t01: fail, OK
+Language/05_Variables/05_Variables_A12_t06: fail, OK
+Language/05_Variables/05_Variables_A13_t01: fail, OK
+Language/07_Classes/07_Classes_A02_t11: fail, OK
diff --git a/tests/co19/co19-analyzer2.status b/tests/co19/co19-analyzer2.status
index ccd5242..7332f17 100644
--- a/tests/co19/co19-analyzer2.status
+++ b/tests/co19/co19-analyzer2.status
@@ -186,3 +186,23 @@
# infinite loop
Language/14_Types/4_Interface_Types_A11_t01: skip
Language/14_Types/4_Interface_Types_A11_t02: skip
+
+# co19 issue #424, Uninitialized finals are warnings not errors
+Language/05_Variables/05_Variables_A05_t05: fail, OK
+Language/05_Variables/05_Variables_A05_t06: fail, OK
+Language/05_Variables/05_Variables_A05_t07: fail, OK
+Language/05_Variables/05_Variables_A05_t08: fail, OK
+Language/05_Variables/05_Variables_A05_t09: fail, OK
+Language/05_Variables/05_Variables_A05_t10: fail, OK
+Language/05_Variables/05_Variables_A07_t05: fail, OK
+Language/05_Variables/05_Variables_A07_t06: fail, OK
+Language/05_Variables/05_Variables_A07_t07: fail, OK
+Language/05_Variables/05_Variables_A07_t08: fail, OK
+Language/05_Variables/05_Variables_A08_t01: fail, OK
+Language/11_Expressions/11_Instance_Creation/2_Const_A01_t02: fail, OK
+
+# co19 issue #425, Only static fields can be declared as 'const'
+Language/05_Variables/05_Variables_A12_t01: fail, OK
+Language/05_Variables/05_Variables_A12_t06: fail, OK
+Language/05_Variables/05_Variables_A13_t01: fail, OK
+Language/07_Classes/07_Classes_A02_t11: fail, OK
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index b7f598d..7a856a4 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -360,6 +360,7 @@
LibTest/core/Date/year_A01_t01: Fail, OK # inherited from VM
LibTest/core/Match/operator_subscript_A01_t01: Fail # inherited from VM
LibTest/core/Match/operator_subscript_A01_t01: Fail, OK # co19 issue 294
+LibTest/core/Match/pattern_A01_t01: Fail, OK # Issue 400
LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A02_t01: Fail # inherited from VM
LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A02_t01: Fail, OK # co19 issue 294
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A03_t01: Fail # inherited from VM
@@ -371,6 +372,7 @@
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t06: Fail
LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A03_t01: Fail # inherited from VM
LibTest/core/RegExp/Pattern_semantics/firstMatch_Term_A03_t01: Fail, OK # co19 issue 294
+LibTest/core/RegExp/allMatches_A01_t01: Fail, OK # co19 issue 400
LibTest/core/RegExp/firstMatch_A01_t01: Fail, OK # co19 issue 294
LibTest/core/String/contains_A01_t02: Fail # inherited from VM
LibTest/core/double/parse_A02_t01: Fail # Inherited from VM.
diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status
index 51a0e35..960a6cb 100644
--- a/tests/co19/co19-runtime.status
+++ b/tests/co19/co19-runtime.status
@@ -67,6 +67,8 @@
LibTest/core/double/toStringAsExponential_A02_t01: Fail # TODO(vm-team): Please triage this failure.
LibTest/core/int/toStringAsExponential_A02_t01: Fail # TODO(vm-team): Please triage this failure.
+LibTest/core/Match/pattern_A01_t01: Fail # Issue 422
+LibTest/core/RegExp/allMatches_A01_t01: Fail # Issue 422
[ $compiler == none && $runtime == vm && $checked ]
LibTest/core/Strings/concatAll_A04_t01: Fail, OK # checks for ArgumentError. TypeError is ok too. co19 issue 366
@@ -90,7 +92,6 @@
Language/11_Expressions/18_Assignment_A08_t04: Fail, OK # co19 issue 405
-
[ $compiler == none && $runtime == vm ]
Language/13_Libraries_and_Scripts/1_Imports_A02_t21: Crash # Dart issue 6060
Language/13_Libraries_and_Scripts/1_Imports_A02_t22: Crash # Dart issue 6060
@@ -494,13 +495,11 @@
LibTest/core/Set/intersection_A01_t01: Fail # issue 390
LibTest/core/Set/intersection_A01_t02: Fail # issue 390
LibTest/core/Set/intersection_A01_t03: Fail # issue 390
-LibTest/collection/Queue/Queue.from_A01_t01: fail # Issue 400
-LibTest/collection/Queue/Queue.from_A01_t02: fail # Issue 400
-LibTest/core/List/List.from_A01_t01: fail # Issue 400
-LibTest/core/List/every_A01_t01: fail # Issue 400
-LibTest/core/Match/pattern_A01_t01: fail # Issue 400
-LibTest/core/Match/str_A01_t01: fail # Issue 400
-LibTest/core/RegExp/allMatches_A01_t01: fail # Issue 400
+LibTest/collection/Queue/Queue.from_A01_t01: Fail # Issue 400
+LibTest/collection/Queue/Queue.from_A01_t02: Fail # Issue 400
+LibTest/core/List/List.from_A01_t01: Fail # Issue 400
+LibTest/core/List/every_A01_t01: Fail # Issue 400
+LibTest/core/Match/str_A01_t01: Fail # Issue 400
LibTest/async/Completer/completeError_A03_t02: Fail # No AsyncError anymore. Issue 407
LibTest/async/Completer/complete_A02_t02: Fail # No AsyncError anymore. Issue 407
@@ -511,11 +510,12 @@
LibTest/core/List/setRange_A05_t01: Fail # setRange now takes end-argument. Issue 402
[ $compiler == none && $runtime == vm && $arch == arm ]
-LibTest/math/tan_A01_t01: Fail
-LibTest/math/Random/nextDouble_A01_t01: Pass, Crash
+LibTest/math/tan_A01_t01: Pass, Fail
+LibTest/math/cos_A01_t01: Pass, Fail
+LibTest/math/sin_A01_t01: Pass, Fail
+LibTest/math/Random/nextDouble_A01_t01: Pass, Crash, Fail
LibTest/core/int/operator_left_shift_A01_t02: Fail
LibTest/core/int/operator_unary_minus_A01_t01: Fail, Pass
-LibTest/math/cos_A01_t01: Pass, Fail
[ $compiler == none && $runtime == vm && $arch == arm && $mode == debug ]
LibTest/core/Expect/throws_A01_t04: Crash
@@ -529,11 +529,12 @@
LibTest/core/int/operator_unary_minus_A01_t01: Fail, Pass
[ $compiler == none && $runtime == vm && $arch == simarm ]
-LibTest/math/tan_A01_t01: Fail
-LibTest/math/Random/nextDouble_A01_t01: Pass, Crash
+LibTest/math/tan_A01_t01: Pass, Fail
+LibTest/math/cos_A01_t01: Pass, Fail
+LibTest/math/sin_A01_t01: Pass, Fail
+LibTest/math/Random/nextDouble_A01_t01: Pass, Crash, Fail
LibTest/core/int/operator_left_shift_A01_t02: Fail
LibTest/core/int/operator_unary_minus_A01_t01: Fail, Pass
-LibTest/math/cos_A01_t01: Pass, Fail
[ $compiler == none && $runtime == vm && $arch == simarm && $mode == debug ]
LibTest/core/Expect/throws_A01_t04: Crash
diff --git a/tests/compiler/dart2js/cpa_inference_test.dart b/tests/compiler/dart2js/cpa_inference_test.dart
index 2e69408..493a8b7 100644
--- a/tests/compiler/dart2js/cpa_inference_test.dart
+++ b/tests/compiler/dart2js/cpa_inference_test.dart
@@ -159,9 +159,7 @@
class Object {}
class Function {}
abstract class List<E> {
- factory List([int length]) {}
- E operator [](int index);
- void operator []=(int index, E value);
+ factory List([int length]) => JS('=List', r'new Array(#)', length);
}
abstract class Map<K, V> {}
class Closure {}
@@ -1203,23 +1201,6 @@
result.checkNodeHasType('foo', [result.int]);
}
-testGoodGuys() {
- final String source = r"""
- main() {
- var a = 1.isEven;
- var b = 3.14.isNaN;
- var c = 1.floor();
- var d = 3.14.floor();
- a; b; c; d;
- }
- """;
- AnalysisResult result = analyze(source);
- result.checkNodeHasType('a', [result.bool]);
- result.checkNodeHasType('b', [result.bool]);
- result.checkNodeHasType('c', [result.num]);
- result.checkNodeHasType('d', [result.num]);
-}
-
testIntDoubleNum() {
final String source = r"""
main() {
@@ -1354,6 +1335,32 @@
Expect.isNull(inferredType(bar));
}
+testMixins() {
+ final String source = r"""
+ class A {
+ foo() => "abc";
+ get x => 42;
+ }
+ class B extends Object with A {
+ bar() => foo();
+ baz() => x;
+ }
+ main() {
+ var b = new B();
+ var x = b.foo();
+ var y = b.bar();
+ var z = b.x;
+ var w = b.baz();
+ x; y; z; w;
+ }
+ """;
+ AnalysisResult result = analyze(source);
+ result.checkNodeHasType('x', [result.string]);
+ result.checkNodeHasType('y', [result.string]);
+ result.checkNodeHasType('z', [result.int]);
+ result.checkNodeHasType('w', [result.int]);
+}
+
void main() {
testDynamicBackDoor();
testVariableDeclaration();
@@ -1402,8 +1409,8 @@
testJsCall();
testIsCheck();
testSeenClasses();
- testGoodGuys();
testIntDoubleNum();
testConcreteTypeToTypeMask();
testSelectors();
+ testMixins();
}
diff --git a/tests/compiler/dart2js/diagnose_ambiguous_test.dart b/tests/compiler/dart2js/diagnose_ambiguous_test.dart
new file mode 100644
index 0000000..cd10b1b
--- /dev/null
+++ b/tests/compiler/dart2js/diagnose_ambiguous_test.dart
@@ -0,0 +1,87 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'memory_source_file_helper.dart';
+
+import '../../../sdk/lib/_internal/compiler/compiler.dart'
+ show Diagnostic;
+
+import 'dart:json';
+
+main() {
+ Uri script = currentDirectory.resolve(nativeToUriPath(new Options().script));
+ Uri libraryRoot = script.resolve('../../../sdk/');
+ Uri packageRoot = script.resolve('./packages/');
+
+ MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
+ var provider = new MemorySourceFileProvider();
+ var diagnostics = [];
+ void diagnosticHandler(Uri uri, int begin, int end,
+ String message, Diagnostic kind) {
+ if (kind == Diagnostic.VERBOSE_INFO) {
+ return;
+ }
+ diagnostics.add('$uri:$begin:$end:$message:$kind');
+ }
+
+ Compiler compiler = new Compiler(provider.readStringFromUri,
+ (name, extension) => null,
+ diagnosticHandler,
+ libraryRoot,
+ packageRoot,
+ ['--analyze-only']);
+ compiler.run(Uri.parse('memory:main.dart'));
+ diagnostics.sort();
+ var expected = [
+ 'memory:exporter.dart:43:47:Info: "function(hest)" is defined here.:info',
+ 'memory:library.dart:14:19:Info: "class(Fisk)" is (re)exported by '
+ 'multiple libraries.:info',
+ 'memory:library.dart:30:34:Info: "function(fisk)" is (re)exported by '
+ 'multiple libraries.:info',
+ 'memory:library.dart:41:45:Info: "function(hest)" is defined here.'
+ ':info',
+ 'memory:main.dart:0:22:Info: "class(Fisk)" is imported here.:info',
+ 'memory:main.dart:0:22:Info: "function(fisk)" is imported here.:info',
+ 'memory:main.dart:0:22:Info: "function(hest)" is imported here.:info',
+ 'memory:main.dart:23:46:Info: "class(Fisk)" is imported here.:info',
+ 'memory:main.dart:23:46:Info: "function(fisk)" is imported here.:info',
+ 'memory:main.dart:23:46:Info: "function(hest)" is imported here.:info',
+ 'memory:main.dart:59:63:Warning: duplicate import of Fisk:warning',
+ 'memory:main.dart:76:80:duplicate import of fisk:error',
+ 'memory:main.dart:86:90:duplicate import of hest:error'
+ ];
+ Expect.listEquals(expected, diagnostics);
+ Expect.isTrue(compiler.compilationFailed);
+}
+
+const Map MEMORY_SOURCE_FILES = const {
+ 'main.dart': """
+import 'library.dart';
+import 'exporter.dart';
+
+main() {
+ Fisk x = null;
+ fisk();
+ hest();
+}
+""",
+ 'library.dart': """
+library lib;
+
+class Fisk {
+}
+
+fisk() {}
+
+hest() {}
+""",
+ 'exporter.dart': """
+library exporter;
+
+export 'library.dart';
+
+hest() {}
+""",
+};
diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
index b0cec7d..f476e1e 100644
--- a/tests/compiler/dart2js/patch_test.dart
+++ b/tests/compiler/dart2js/patch_test.dart
@@ -719,16 +719,33 @@
}
void testAnalyzeAllInjectedMembers() {
- String patchText = """
- void method() {
- String s = 0;
- }
- """;
- var compiler = applyPatch('', patchText, analyzeAll: true, analyzeOnly: true);
- compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')];
- compiler.runCompiler(null);
- compareWarningKinds(patchText,
- [MessageKind.NOT_ASSIGNABLE], compiler.warnings);
+ void expect(String patchText, [expectedWarnings]) {
+ if (expectedWarnings == null) expectedWarnings = [];
+ if (expectedWarnings is! List) expectedWarnings = [expectedWarnings];
+
+ var compiler = applyPatch('', patchText,
+ analyzeAll: true, analyzeOnly: true);
+ compiler.librariesToAnalyzeWhenRun = [Uri.parse('dart:core')];
+ compiler.runCompiler(null);
+ compareWarningKinds(patchText, expectedWarnings, compiler.warnings);
+ }
+
+ expect('String s = 0;', MessageKind.NOT_ASSIGNABLE);
+ expect('void method() { String s = 0; }', MessageKind.NOT_ASSIGNABLE);
+ expect('''
+ class Class {
+ String s = 0;
+ }
+ ''',
+ MessageKind.NOT_ASSIGNABLE);
+ expect('''
+ class Class {
+ void method() {
+ String s = 0;
+ }
+ }
+ ''',
+ MessageKind.NOT_ASSIGNABLE);
}
void testTypecheckPatchedMembers() {
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index c9c0221..7102f8b 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -38,13 +38,15 @@
testConstructorInvocationArgumentTypes,
testMethodInvocationArgumentCount,
testMethodInvocations,
+ testMethodInvocationsInClass,
testControlFlow,
// testNewExpression,
testConditionalExpression,
testIfStatement,
testThis,
testSuper,
- testOperatorsAssignability];
+ testOperatorsAssignability,
+ testFieldInitializers];
for (Function test in tests) {
setup();
test();
@@ -433,8 +435,166 @@
check("foo('string');");
check("foo(a: 'string');");
check("foo(a: localMethod(1));", MessageKind.NOT_ASSIGNABLE);
+}
- // TODO(johnniwinther): Add tests of invocations using implicit this.
+testMethodInvocationsInClass() {
+ LibraryElement library = mockLibrary(compiler, CLASS_WITH_METHODS);
+ compiler.parseScript(CLASS_WITH_METHODS, library);
+ ClassElement ClassWithMethods =
+ library.find(const SourceString("ClassWithMethods"));
+ ClassWithMethods.ensureResolved(compiler);
+ Element c = ClassWithMethods.lookupLocalMember(const SourceString('method'));
+ assert(c != null);
+ ClassElement SubClass = library.find(const SourceString("SubClass"));
+ SubClass.ensureResolved(compiler);
+ Element d = SubClass.lookupLocalMember(const SourceString('method'));
+ assert(d != null);
+
+ check(Element element, String text, [expectedWarnings]){
+ analyzeIn(element,
+ """{
+ var e;
+ int i;
+ int j;
+ int localMethod(String str) { return 0; }
+ $text
+ }""",
+ expectedWarnings);
+ }
+
+
+ check(c, "int k = untypedNoArgumentMethod();");
+ check(c, "ClassWithMethods x = untypedNoArgumentMethod();");
+ check(d, "ClassWithMethods x = untypedNoArgumentMethod();");
+ check(d, "int k = intMethod();");
+ check(c, "int k = untypedOneArgumentMethod(this);");
+ check(c, "ClassWithMethods x = untypedOneArgumentMethod(1);");
+ check(c, "int k = untypedOneArgumentMethod('string');");
+ check(c, "int k = untypedOneArgumentMethod(i);");
+ check(d, "int k = untypedOneArgumentMethod(this);");
+ check(d, "ClassWithMethods x = untypedOneArgumentMethod(1);");
+ check(d, "int k = untypedOneArgumentMethod('string');");
+ check(d, "int k = untypedOneArgumentMethod(i);");
+
+ check(c, "int k = untypedTwoArgumentMethod(1, 'string');");
+ check(c, "int k = untypedTwoArgumentMethod(i, j);");
+ check(c, "ClassWithMethods x = untypedTwoArgumentMethod(i, this);");
+ check(d, "int k = untypedTwoArgumentMethod(1, 'string');");
+ check(d, "int k = untypedTwoArgumentMethod(i, j);");
+ check(d, "ClassWithMethods x = untypedTwoArgumentMethod(i, this);");
+
+ check(c, "int k = intNoArgumentMethod();");
+ check(c, "ClassWithMethods x = intNoArgumentMethod();",
+ MessageKind.NOT_ASSIGNABLE);
+
+ check(c, "int k = intOneArgumentMethod('');", MessageKind.NOT_ASSIGNABLE);
+ check(c, "ClassWithMethods x = intOneArgumentMethod(1);",
+ MessageKind.NOT_ASSIGNABLE);
+ check(c, "int k = intOneArgumentMethod('string');",
+ MessageKind.NOT_ASSIGNABLE);
+ check(c, "int k = intOneArgumentMethod(i);");
+
+ check(c, "int k = intTwoArgumentMethod(1, 'string');",
+ MessageKind.NOT_ASSIGNABLE);
+ check(c, "int k = intTwoArgumentMethod(i, j);");
+ check(c, "ClassWithMethods x = intTwoArgumentMethod(i, j);",
+ MessageKind.NOT_ASSIGNABLE);
+
+ check(c, "functionField();");
+ check(d, "functionField();");
+ check(c, "functionField(1);");
+ check(d, "functionField('string');");
+
+ check(c, "intField();", MessageKind.NOT_CALLABLE);
+ check(d, "intField();", MessageKind.NOT_CALLABLE);
+
+ check(c, "untypedField();");
+ check(d, "untypedField();");
+ check(c, "untypedField(1);");
+ check(d, "untypedField('string');");
+
+
+ check(c, "intOneArgumentOneOptionalMethod('');",
+ MessageKind.NOT_ASSIGNABLE);
+ check(c, "intOneArgumentOneOptionalMethod('', '');",
+ [MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
+
+ check(c, "intTwoOptionalMethod('');", MessageKind.NOT_ASSIGNABLE);
+ check(c, "intTwoOptionalMethod('', '');",
+ [MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
+
+ check(c, "intOneArgumentOneNamedMethod('');",
+ MessageKind.NOT_ASSIGNABLE);
+ check(c, "intOneArgumentOneNamedMethod('', b: '');",
+ [MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
+
+ check(c, "intTwoNamedMethod(a: '');", MessageKind.NOT_ASSIGNABLE);
+ check(c, "intTwoNamedMethod(b: '');", MessageKind.NOT_ASSIGNABLE);
+ check(c, "intTwoNamedMethod(a: '', b: '');",
+ [MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
+ check(c, "intTwoNamedMethod(b: '', a: '');",
+ [MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
+
+ // Invocation of dynamic variable.
+ check(c, "e();");
+ check(c, "e(1);");
+ check(c, "e('string');");
+
+ // Invocation on local method.
+ check(c, "localMethod();", MessageKind.MISSING_ARGUMENT);
+ check(c, "localMethod(1);", MessageKind.NOT_ASSIGNABLE);
+ check(c, "localMethod('string');");
+ check(c, "int k = localMethod('string');");
+ check(c, "String k = localMethod('string');", MessageKind.NOT_ASSIGNABLE);
+
+ // Invocation on parenthesized expressions.
+ check(c, "(e)();");
+ check(c, "(e)(1);");
+ check(c, "(e)('string');");
+ check(c, "(foo)();", MessageKind.PROPERTY_NOT_FOUND);
+ check(c, "(foo)(1);", MessageKind.PROPERTY_NOT_FOUND);
+ check(c, "(foo)('string');", MessageKind.PROPERTY_NOT_FOUND);
+
+ // Invocations on function expressions.
+ check(c, "(foo){}();", MessageKind.MISSING_ARGUMENT);
+ check(c, "(foo){}(1);");
+ check(c, "(foo){}('string');");
+ check(c, "(int foo){}('string');", MessageKind.NOT_ASSIGNABLE);
+ check(c, "(String foo){}('string');");
+ check(c, "int k = int bar(String foo){ return 0; }('string');");
+ check(c, "int k = String bar(String foo){ return foo; }('string');",
+ MessageKind.NOT_ASSIGNABLE);
+
+ // Static invocations.
+ check(c, "staticMethod();",
+ MessageKind.MISSING_ARGUMENT);
+ check(c, "staticMethod(1);",
+ MessageKind.NOT_ASSIGNABLE);
+ check(c, "staticMethod('string');");
+ check(c, "int k = staticMethod('string');");
+ check(c, "String k = staticMethod('string');",
+ MessageKind.NOT_ASSIGNABLE);
+ check(d, "staticMethod();",
+ MessageKind.MISSING_ARGUMENT);
+ check(d, "staticMethod(1);",
+ MessageKind.NOT_ASSIGNABLE);
+ check(d, "staticMethod('string');");
+ check(d, "int k = staticMethod('string');");
+ check(d, "String k = staticMethod('string');",
+ MessageKind.NOT_ASSIGNABLE);
+
+ // Invocation on dynamic variable.
+ check(c, "e.foo();");
+ check(c, "e.foo(1);");
+ check(c, "e.foo('string');");
+
+ // Invocation on unresolved variable.
+ check(c, "foo();", MessageKind.METHOD_NOT_FOUND);
+ check(c, "foo(1);", MessageKind.METHOD_NOT_FOUND);
+ check(c, "foo('string');", MessageKind.METHOD_NOT_FOUND);
+ check(c, "foo(a: 'string');", MessageKind.METHOD_NOT_FOUND);
+ check(c, "foo(a: localMethod(1));",
+ [MessageKind.METHOD_NOT_FOUND, MessageKind.NOT_ASSIGNABLE]);
}
/** Tests analysis of returns (not required by the specification). */
@@ -544,13 +704,17 @@
}
testThis() {
- String script = "class Foo {}";
+ String script = """class Foo {
+ void method() {}
+ }""";
LibraryElement library = mockLibrary(compiler, script);
compiler.parseScript(script, library);
ClassElement foo = library.find(const SourceString("Foo"));
- analyzeIn(foo, "{ int i = this; }", MessageKind.NOT_ASSIGNABLE);
- analyzeIn(foo, "{ Object o = this; }");
- analyzeIn(foo, "{ Foo f = this; }");
+ foo.ensureResolved(compiler);
+ Element method = foo.lookupLocalMember(const SourceString('method'));
+ analyzeIn(method, "{ int i = this; }", MessageKind.NOT_ASSIGNABLE);
+ analyzeIn(method, "{ Object o = this; }");
+ analyzeIn(method, "{ Foo f = this; }");
}
testSuper() {
@@ -561,14 +725,17 @@
class B extends A {
Object field = 42;
+ void method() {}
}
''';
LibraryElement library = mockLibrary(compiler, script);
compiler.parseScript(script, library);
ClassElement B = library.find(const SourceString("B"));
- analyzeIn(B, "{ int i = super.field; }", MessageKind.NOT_ASSIGNABLE);
- analyzeIn(B, "{ Object o = super.field; }");
- analyzeIn(B, "{ String s = super.field; }");
+ B.ensureResolved(compiler);
+ Element method = B.lookupLocalMember(const SourceString('method'));
+ analyzeIn(method, "{ int i = super.field; }", MessageKind.NOT_ASSIGNABLE);
+ analyzeIn(method, "{ Object o = super.field; }");
+ analyzeIn(method, "{ String s = super.field; }");
}
const String CLASSES_WITH_OPERATORS = '''
@@ -846,6 +1013,19 @@
[MessageKind.NOT_ASSIGNABLE, MessageKind.NOT_ASSIGNABLE]);
}
+void testFieldInitializers() {
+ analyzeTopLevel("""int i = 0;""");
+ analyzeTopLevel("""int i = '';""", MessageKind.NOT_ASSIGNABLE);
+
+ analyzeTopLevel("""class Class {
+ int i = 0;
+ }""");
+ analyzeTopLevel("""class Class {
+ int i = '';
+ }""", MessageKind.NOT_ASSIGNABLE);
+}
+
+
const CLASS_WITH_METHODS = '''
class ClassWithMethods {
untypedNoArgumentMethod() {}
@@ -866,11 +1046,15 @@
int intField;
static int staticMethod(String str) {}
+
+ void method() {}
}
class I {
int intMethod();
}
-class SubClass extends ClassWithMethods implements I {}''';
+class SubClass extends ClassWithMethods implements I {
+ void method() {}
+}''';
Types types;
MockCompiler compiler;
@@ -941,6 +1125,8 @@
if (expectedWarnings == null) expectedWarnings = [];
if (expectedWarnings is !List) expectedWarnings = [expectedWarnings];
+ compiler.diagnosticHandler = createHandler(text);
+
LibraryElement library = mockLibrary(compiler, text);
Link<Element> topLevelElements = parseUnit(text, compiler, library);
@@ -948,14 +1134,22 @@
for (Link<Element> elements = topLevelElements;
!elements.isEmpty;
elements = elements.tail) {
- Node node = elements.head.parseNode(compiler);
- TreeElements mapping = compiler.resolver.resolve(elements.head);
+ Element element = elements.head;
+ if (element.isClass()) {
+ ClassElement classElement = element;
+ classElement.ensureResolved(compiler);
+ // Analyze last class member.
+ classElement.forEachLocalMember((Element e) => element = e);
+ }
+ Node node = element.parseNode(compiler);
+ TreeElements mapping = compiler.resolver.resolve(element);
TypeCheckerVisitor checker =
new TypeCheckerVisitor(compiler, mapping, types);
compiler.clearWarnings();
checker.analyze(node);
compareWarningKinds(text, expectedWarnings, compiler.warnings);
}
+ compiler.diagnosticHandler = null;
}
api.DiagnosticHandler createHandler(String text) {
@@ -1010,7 +1204,7 @@
}
}
-analyzeIn(ClassElement classElement, String text, [expectedWarnings]) {
+analyzeIn(Element element, String text, [expectedWarnings]) {
if (expectedWarnings == null) expectedWarnings = [];
if (expectedWarnings is !List) expectedWarnings = [expectedWarnings];
@@ -1019,8 +1213,7 @@
Parser parser = new Parser(listener);
parser.parseStatement(tokens);
Node node = listener.popNode();
- classElement.ensureResolved(compiler);
- TreeElements elements = compiler.resolveNodeStatement(node, classElement);
+ TreeElements elements = compiler.resolveNodeStatement(node, element);
TypeCheckerVisitor checker = new TypeCheckerVisitor(compiler, elements,
types);
compiler.clearWarnings();
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 037000c..44252e2 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -44,3 +44,4 @@
[ $csp ]
mirrors_test: Fail # http://dartbug.com/6490
+minified_mirrors_test: Fail # http://dartbug.com/6490
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index b728712..55913e5 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -83,12 +83,23 @@
iterable_to_list_test: Fail
iterable_to_set_test: Fail
-[ $compiler == dartc || $compiler == dartanalyzer ]
+[ $compiler == dartc ]
symbol_test/01: Fail
symbol_test/02: Fail
symbol_test/03: Fail
[ $compiler == dartanalyzer ]
+symbol_test/01: Fail
+symbol_test/02: Fail
+symbol_test/03: Fail
+int_parse_radix_test: fail
+list_insert_test: fail
+list_removeat_test: fail
+
+[ $compiler == dart2analyzer ]
+symbol_test/01: Fail
+symbol_test/02: Fail
+symbol_test/03: Fail
int_parse_radix_test: fail
list_insert_test: fail
list_removeat_test: fail
diff --git a/tests/corelib/uri_path_test.dart b/tests/corelib/uri_path_test.dart
index e997ce3..058d912 100644
--- a/tests/corelib/uri_path_test.dart
+++ b/tests/corelib/uri_path_test.dart
@@ -8,18 +8,35 @@
}
void testPath() {
- test(s, uri) {
+ void test(s, uri) {
Expect.equals(s, uri.toString());
Expect.equals(uri, Uri.parse(s));
}
+ test("http:", new Uri(scheme: "http"));
+ test("http://host/xxx", new Uri(scheme: "http", host: "host", path: "xxx"));
+ test("http://host/xxx", new Uri(scheme: "http", host: "host", path: "/xxx"));
+ test("http://host/xxx",
+ new Uri(scheme: "http", host: "host", pathSegments: ["xxx"]));
+ test("http://host/xxx/yyy",
+ new Uri(scheme: "http", host: "host", path: "xxx/yyy"));
+ test("http://host/xxx/yyy",
+ new Uri(scheme: "http", host: "host", path: "/xxx/yyy"));
+ test("http://host/xxx/yyy",
+ new Uri(scheme: "http", host: "host", pathSegments: ["xxx", "yyy"]));
+
test("urn:", new Uri(scheme: "urn"));
test("urn:xxx", new Uri(scheme: "urn", path: "xxx"));
test("urn:xxx:yyy", new Uri(scheme: "urn", path: "xxx:yyy"));
+
+ Expect.equals(3, new Uri(path: "xxx/yyy/zzz").pathSegments.length);
+ Expect.equals(3, new Uri(path: "/xxx/yyy/zzz").pathSegments.length);
+ Expect.equals(3, Uri.parse("http://host/xxx/yyy/zzz").pathSegments.length);
+ Expect.equals(3, Uri.parse("file:///xxx/yyy/zzz").pathSegments.length);
}
void testPathSegments() {
- test(String path, List<String> segments) {
+ void test(String path, List<String> segments) {
void check(uri) {
Expect.equals(path, uri.path);
Expect.equals(path, uri.toString());
@@ -72,11 +89,41 @@
unencoded = unencoded.toString();
test(encoded, [unencoded]);
test(encoded + "/" + encoded, [unencoded, unencoded]);
+
+ Uri uri;
+ uri = new Uri(pathSegments: ["xxx", "yyy", "zzz"]);
+ Expect.equals(3, uri.pathSegments.length);
+ uri = new Uri(scheme: "http",
+ host: "host",
+ pathSegments: ["xxx", "yyy", "zzz"]);
+ Expect.equals(3, uri.pathSegments.length);
+ uri = new Uri(scheme: "file",
+ pathSegments: ["xxx", "yyy", "zzz"]);
+ Expect.equals(3, uri.pathSegments.length);
+}
+
+void testPathCompare() {
+ void test(Uri uri1, Uri uri2) {
+ Expect.equals(uri1, uri2);
+ Expect.equals(uri2, uri1);
+ }
+
+ test(new Uri(scheme: "http", host: "host", path: "xxx"),
+ new Uri(scheme: "http", host: "host", path: "/xxx"));
+ test(new Uri(scheme: "http", host: "host", pathSegments: ["xxx"]),
+ new Uri(scheme: "http", host: "host", path: "/xxx"));
+ test(new Uri(scheme: "http", host: "host", pathSegments: ["xxx"]),
+ new Uri(scheme: "http", host: "host", path: "xxx"));
+ test(new Uri(scheme: "file", path: "xxx"),
+ new Uri(scheme: "file", path: "/xxx"));
+ test(new Uri(scheme: "file", pathSegments: ["xxx"]),
+ new Uri(scheme: "file", path: "/xxx"));
+ test(new Uri(scheme: "file", pathSegments: ["xxx"]),
+ new Uri(scheme: "file", path: "xxx"));
}
testPathSegmentsUnmodifiableList() {
-
- test(list) {
+ void test(list) {
bool isUnsupported(e) => e is UnsupportedError;
Expect.equals("a", list[0]);
@@ -118,5 +165,6 @@
testInvalidArguments();
testPath();
testPathSegments();
+ testPathCompare();
testPathSegmentsUnmodifiableList();
}
diff --git a/tests/html/html.status b/tests/html/html.status
index 581755c..3e1588d 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -375,3 +375,6 @@
[ $compiler == dartanalyzer ]
path_observer_test: Fail
+
+[ $compiler == dart2analyzer ]
+path_observer_test: Fail
diff --git a/tests/html/selectelement_test.dart b/tests/html/selectelement_test.dart
index 300e29e..717502f 100644
--- a/tests/html/selectelement_test.dart
+++ b/tests/html/selectelement_test.dart
@@ -55,4 +55,22 @@
// Use last to make sure that the list was correctly wrapped.
expect(element.options.last, equals(options[3]));
});
+
+ test('optgroup', () {
+ var element = new Element.html(
+ '<select>'
+ '<option>1</option>'
+ '<optgroup>'
+ '<option>2</option>'
+ '</optgroup>'
+ '</select>');
+
+ expect(element.options.length, 2);
+ element.selectedIndex = 1;
+
+ var optGroup = element.children[1];
+ expect(optGroup is OptGroupElement, isTrue);
+ expect(optGroup.children.single.selected, isTrue);
+ expect(element.selectedOptions, optGroup.children);
+ });
}
diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart
index 484b2e7..8ddae00 100644
--- a/tests/html/xhr_test.dart
+++ b/tests/html/xhr_test.dart
@@ -179,6 +179,31 @@
HttpRequest.request(url, mimeType: 'application/binary');
}, expectation);
});
+
+ if (Platform.supportsTypedData) {
+ test('xhr upload', () {
+ var xhr = new HttpRequest();
+ var progressCalled = false;
+ xhr.upload.onProgress.listen((e) {
+ progressCalled = true;
+ });
+
+ xhr.open('POST',
+ '${window.location.protocol}//${window.location.host}/echo');
+
+ // 10MB of payload data w/ a bit of data to make sure it
+ // doesn't get compressed to nil.
+ var data = new Uint8List(1 * 1024 * 1024);
+ for (var i = 0; i < data.length; ++i) {
+ data[i] = i & 0xFF;
+ }
+ xhr.send(data);
+
+ return xhr.onLoad.first.then((_) {
+ expect(progressCalled, isTrue);
+ });
+ });
+ }
});
group('xhr_requestBlob', () {
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index b5f430c..1600565 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -13,10 +13,6 @@
unresolved_ports_negative_test: Skip # See Issue 6839
isolate_stress_test: Fail # TODO(ahe): This should be able to pass when we have wrapper-less tests.
-
-[ $runtime == vm && $system == windows ]
-timer_test: Pass, Fail # See Issue 5133
-
[ $compiler == none && $runtime == drt ]
isolate2_negative_test: Skip # Inherited from VM.
isolate3_negative_test: Skip # Inherited from VM.
@@ -49,6 +45,19 @@
global_error_handler_stream_test: fail, OK
global_error_handler_test: fail, OK
+[ $compiler == dart2analyzer ]
+isolate2_negative_test: fail
+isolate_import_negative_test: fail
+isolate_negative_test: fail
+spawn_function_negative_test: fail
+spawn_uri_negative_test: fail
+spawn_uri_vm_negative_test: fail
+unresolved_ports_negative_test: fail
+
+# test issue 10888
+global_error_handler_stream_test: fail, OK
+global_error_handler_test: fail, OK
+
[ $compiler == dart2js && ($runtime == d8 || $jscl) ]
illegal_msg_stream_test: Fail # Issue 6750
typed_data_message_test: Fail, OK # DataView only supported in browsers.
diff --git a/tests/language/compiler_annotations.dart b/tests/language/compiler_annotations.dart
new file mode 100644
index 0000000..c920add
--- /dev/null
+++ b/tests/language/compiler_annotations.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library compiler_annotations;
+
+// This library contains annotations useful for testing.
+
+// TODO(ngeoffray): Implement in dart2js.
+class DontInline {
+ const DontInline();
+}
diff --git a/tests/language/extends_test.dart b/tests/language/extends_test.dart
new file mode 100644
index 0000000..35cbb2e6
--- /dev/null
+++ b/tests/language/extends_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library ExtendsTestMain;
+import "extends_test_lib.dart";
+import "package:expect/expect.dart";
+
+// S should extend class A from below, not the one imported
+// from the library.
+class S extends A {
+}
+
+class A {
+ var y = "class A from main script";
+}
+
+main() {
+ var s = new S();
+ Expect.equals("class A from main script", s.y);
+}
+
diff --git a/tests/language/extends_test_lib.dart b/tests/language/extends_test_lib.dart
new file mode 100644
index 0000000..d62ca8f
--- /dev/null
+++ b/tests/language/extends_test_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library ExtendsTestLib;
+
+class A {
+ var y = "class A from library";
+}
diff --git a/tests/language/inferrer_constructor2_test.dart b/tests/language/inferrer_constructor2_test.dart
new file mode 100644
index 0000000..218723b
--- /dev/null
+++ b/tests/language/inferrer_constructor2_test.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for dart2js that used to optimistically infer the
+// wrong types for fields because of generative constructors being
+// inlined.
+
+import "package:expect/expect.dart";
+import "compiler_annotations.dart";
+
+class A {
+ var foo;
+ var bar;
+
+ @DontInline
+ A() {
+ // Currently defeat inlining by using a closure.
+ bar = () => 42;
+ foo = 54;
+ }
+ A.inline();
+}
+
+main() {
+ // Make sure A's constructor is analyzed first by surrounding the
+ // body by two allocations.
+ new A();
+ bar();
+ new A();
+}
+
+class B {
+ var bar;
+ var closure;
+ @DontInline
+ B() {
+ // Currently defeat inlining by using a closure.
+ closure = () => 42;
+ bar = new A().foo;
+ }
+}
+
+@DontInline
+bar() {
+ // Make sure B's constructor is analyzed first by surrounding the
+ // body by two allocations.
+ new B();
+ // Currently defeat inlining by using a closure.
+ Expect.throws(() => new A.inline().foo + 42, (e) => e is NoSuchMethodError);
+ codegenLast();
+ new B();
+}
+
+@DontInline
+codegenLast() {
+ // This assignment currently defeats simple type inference, but not
+ // the optimistic inferrer.
+ new A().foo = new B().bar;
+ // Currently defeat inlining by using a closure.
+ new B().closure = () => 42;
+}
diff --git a/tests/language/issue11087_vm_test.dart b/tests/language/issue11087_vm_test.dart
new file mode 100644
index 0000000..3dd71e1
--- /dev/null
+++ b/tests/language/issue11087_vm_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for VM's IfConverted pass not keeping graph structure and
+// use lists in sync.
+
+class A {
+ int x;
+}
+
+f() {
+ var a = new A();
+ a.x = (true ? 2 : 4);
+ return a.x;
+}
+
+main() {
+ for (var i = 0; i < 10000; i++) f();
+}
+
diff --git a/tests/language/language.status b/tests/language/language.status
index 60460aa..f988626 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -25,6 +25,7 @@
closure_type_variable_test: Fail # Type variable used as expression (dartbug.com/6282)
[ $compiler == none ]
+extends_test: Fail # issue 11023
mixin_super_constructor_test: Fail
mixin_super_constructor2_test: Fail
mixin_super_constructor_default_test: Fail
@@ -305,6 +306,7 @@
final_variable_assignment_test/02: Fail
final_variable_assignment_test/03: Fail
final_variable_assignment_test/04: Fail
+extends_test: Pass, Fail # issue 11023, may pass or fail depending on loading order
[ $runtime == dartium ]
@@ -525,296 +527,32 @@
invocation_mirror_test: Fail, OK # hardcoded names.
super_call4_test: Fail, OK # hardcoded names.
-[ $compiler == dartanalyzer ]
-abstract_factory_constructor_test/00: fail
-assign_instance_method_negative_test: fail
-assign_static_type_test/06: fail
-bad_named_parameters2_test: fail
-bad_named_parameters_test: fail
-bad_override_test/01: fail
-bad_override_test/02: fail
-bad_override_test/03: fail
-bad_override_test/04: fail
-bad_override_test/05: fail
-black_listed_test/11: fail
-body_less_constructor_wrong_arg_negative_test: fail
-built_in_identifier_prefix_test: fail
-call_constructor_on_unresolvable_class_test/01: fail
-call_constructor_on_unresolvable_class_test/02: fail
-call_constructor_on_unresolvable_class_test/03: fail
-call_constructor_on_unresolvable_class_test/07: fail
-call_nonexistent_static_test/04: fail
-call_nonexistent_static_test/06: fail
-call_nonexistent_static_test/07: fail
-call_nonexistent_static_test/09: fail
-call_nonexistent_static_test/10: fail
-call_through_getter_test: fail
-callable_test/none: fail
-cast_test/04: fail
-cast_test/05: fail
-class_cycle_test/03: fail
-closure_call_wrong_argument_count_negative_test: fail
-compile_time_constant10_test/none: fail
-compile_time_constant8_test: fail
-compile_time_constant_b_test: fail
-compile_time_constant_c_test/01: fail
-compile_time_constant_c_test/02: fail
-compile_time_constant_checked2_test/02: fail
-compile_time_constant_checked2_test/03: fail
-compile_time_constant_checked2_test/04: fail
-compile_time_constant_checked2_test/06: fail
-compile_time_constant_checked3_test/02: fail
-compile_time_constant_checked3_test/03: fail
-compile_time_constant_checked3_test/04: fail
-compile_time_constant_checked3_test/06: fail
-compile_time_constant_d_test: fail
-compile_time_constant_e_test: fail
-compile_time_constant_test/02: fail
-const_syntax_test/06: fail
-constructor2_negative_test: fail
-constructor3_negative_test: fail
-constructor_call_wrong_argument_count_negative_test: fail
-constructor_negative_test: fail
-constructor_return_with_arrow_negative_test: fail
-constructor_return_with_init_and_arrow_negative_test: fail
-cyclic_type_variable_test/01: fail
-cyclic_type_variable_test/02: fail
-cyclic_type_variable_test/03: fail
-cyclic_type_variable_test/04: fail
-default_factory2_test/01: fail
-default_implementation2_test: fail
-dynamic2_test/00: fail
-dynamic_field_test: fail
-export_cyclic_test: fail
-f_bounded_quantification_test/01: fail
-f_bounded_quantification_test/02: fail
-factory2_test: fail
-factory5_test/00: fail
-factory_implementation_test/none: fail
-factory_redirection2_test/01: fail
-fauxverride_test/03: fail
-fauxverride_test/05: fail
-field_method4_negative_test: fail
-field_override_test/01: fail
-final_for_in_variable_test/01: fail
-final_param_negative_test: fail
-final_var_negative_test: fail
-final_variable_assignment_test/01: fail
-final_variable_assignment_test/02: fail
-final_variable_assignment_test/03: fail
-final_variable_assignment_test/04: fail
-first_class_types_constants_test: fail
-for_in2_test: fail
-function_type_alias5_test/00: fail
-function_type_alias5_test/01: fail
-function_type_alias5_test/02: fail
-getter_no_setter2_test/00: fail
-getter_no_setter2_test/03: fail
-getter_no_setter_test/00: fail
-getter_no_setter_test/01: fail
-getters_setters2_test/01: fail
-getters_setters_type_test/01: fail
-implicit_this_test/01: fail
-implicit_this_test/04: fail
-implicit_this_test/none: fail
-import_combinators_negative_test: fail
-inst_field_initializer1_negative_test: fail
-instance_call_wrong_argument_count_negative_test: fail
-instance_method2_negative_test: fail
-instance_method_negative_test: fail
-instantiate_type_variable_negative_test: fail
-interface_inherit_field_test: fail
-interface_static_non_final_fields_negative_test: fail
-interface_test/00: fail
-is_not_class2_negative_test: fail
-library_juxtaposition_test: fail
-licm_test: fail
-list_literal1_negative_test: fail
-list_literal_syntax_test/01: fail
-list_literal_syntax_test/02: fail
-list_literal_syntax_test/03: fail
-map_literal1_negative_test: fail
-map_literal3_test: fail
-method_override2_test/03: fail
-mixin_illegal_constructor_test/13: fail
-mixin_illegal_constructor_test/14: fail
-mixin_illegal_constructor_test/15: fail
-mixin_illegal_constructor_test/16: fail
-mixin_illegal_cycles_test/02: fail
-mixin_illegal_cycles_test/03: fail
-mixin_illegal_cycles_test/04: fail
-mixin_illegal_cycles_test/06: fail
-mixin_illegal_syntax_test/13: fail
-mixin_type_parameters_errors_test/01: fail
-mixin_type_parameters_errors_test/02: fail
-mixin_type_parameters_errors_test/03: fail
-mixin_type_parameters_errors_test/04: fail
-mixin_type_parameters_errors_test/05: fail
-named_parameters2_test: fail
-named_parameters_aggregated_test/03: fail
-named_parameters_aggregated_test/05: fail
-new_expression_type_args_test/00: fail
-new_expression_type_args_test/01: fail
-new_expression_type_args_test/02: fail
-no_such_method_negative_test: fail
-non_const_super_negative_test: fail
-number_identifier_negative_test: fail
-override_field_method1_negative_test: fail
-override_field_method2_negative_test: fail
-override_field_method4_negative_test: fail
-override_field_method5_negative_test: fail
-override_field_test/01: fail
-override_field_test/02: fail
-override_field_test/03: fail
-override_method_with_field_test/01: fail
-override_method_with_field_test/02: fail
-prefix10_negative_test: fail
-prefix11_negative_test: fail
-prefix12_negative_test: fail
-prefix1_negative_test: fail
-prefix22_test: fail
-prefix23_test: fail
-prefix2_negative_test: fail
-prefix4_negative_test: fail
-prefix5_negative_test: fail
-prefix6_negative_test: fail
-prefix8_negative_test: fail
-prefix9_negative_test: fail
-private_member1_negative_test: fail
-private_member2_negative_test: fail
-private_member3_negative_test: fail
-pseudo_kw_illegal_test/14: fail
-pseudo_kw_test: fail
-redirecting_factory_infinite_steps_test/01: fail
-redirecting_factory_infinite_steps_test/02: fail
-scope_negative_test: fail
-setter3_test/01: fail
-setter3_test/02: fail
-static_call_wrong_argument_count_negative_test: fail
-static_field3_test/01: fail
-static_field3_test/02: fail
-static_field3_test/04: fail
-static_field_test/01: fail
-static_field_test/02: fail
-static_field_test/03: fail
-static_final_field2_negative_test: fail
-static_final_field_negative_test: fail
-syntax_test/28: fail
-syntax_test/29: fail
-syntax_test/30: fail
-syntax_test/31: fail
-syntax_test/32: fail
-syntax_test/33: fail
-ternary_test: fail
-throw7_negative_test: fail
-type_error_test: fail
-type_parameter_test/01: fail
-type_parameter_test/02: fail
-type_parameter_test/03: fail
-type_parameter_test/04: fail
-type_variable_bounds2_test/00: fail
-type_variable_bounds2_test/01: fail
-type_variable_bounds2_test/02: fail
-type_variable_bounds2_test/03: fail
-type_variable_bounds2_test/04: fail
-type_variable_bounds2_test/06: fail
-type_variable_bounds_test/00: fail
-type_variable_bounds_test/01: fail
-type_variable_bounds_test/02: fail
-type_variable_bounds_test/03: fail
-type_variable_bounds_test/04: fail
-type_variable_bounds_test/06: fail
-type_variable_bounds_test/07: fail
-type_variable_bounds_test/09: fail
-type_variable_identifier_expression_negative_test: fail
-type_variable_static_context_negative_test: fail
-typed_equality_test: fail
-unary2_test: fail
-unary_test: fail
-unresolved_in_factory_negative_test: fail
-unresolved_top_level_method_negative_test: fail
-unresolved_top_level_var_negative_test: fail
-
-# test issue 10683, It is a compile-time error if e refers to the name v or the name v=.
-block_scope_test: fail, OK
-lazy_static3_test: fail, OK
-
-# test issue 10752, there are 'implicit' scopes for 'if', 'while' and 'do-while'
-implicit_scope_test: fail, OK
-
-# test issue 10889, "throw" requires expression, "rethrow" should be used instead
-execute_finally10_test: fail, OK
-execute_finally11_test: fail, OK
-final_used_in_try_test: fail, OK
-full_stacktrace2_test: fail, OK
-stack_trace_test: fail, OK
-throw3_test: fail, OK
-try_catch3_test: fail, OK
-
-# test issue 10890; on-catch UnknownType is a static warning, not error
-try_catch_on_syntax_test/01: fail, OK
-try_catch_on_syntax_test/07: fail, OK
-try_catch_syntax_test/08: fail, OK
-
-# test issue 10899; it is static warning, not error, to call methods of class literal
-class_literal_test/02: fail, OK
-class_literal_test/05: fail, OK
-class_literal_test/07: fail, OK
-class_literal_test/10: fail, OK
-class_literal_test/11: fail, OK
-class_literal_test/12: fail, OK
-class_literal_test/14: fail, OK
-class_literal_test/17: fail, OK
-class_literal_test/18: fail, OK
-class_literal_test/19: fail, OK
-class_literal_test/22: fail, OK
-class_literal_test/23: fail, OK
-class_literal_test/24: fail, OK
-class_literal_test/27: fail, OK
-class_literal_test/28: fail, OK
-class_literal_test/29: fail, OK
-class_literal_test/none: fail, OK
-
-[ $compiler == dartanalyzer && $checked ]
-factory1_test/00: fail
-factory1_test/01: fail
-field_type_check2_test/01: fail
-factory_implementation_test/00: fail
-factory_redirection_test/08: fail
-factory_redirection_test/09: fail
-factory_redirection_test/10: fail
-factory_redirection_test/11: fail
-factory_redirection_test/12: fail
-factory_redirection_test/13: fail
-factory_redirection_test/14: fail
-getters_setters2_test/03: fail
-type_variable_bounds3_test/00: fail
-type_variable_bounds2_test/05: fail
-type_variable_scope_test/00: fail
-type_variable_scope_test/01: fail
-type_variable_scope_test/02: fail
-type_variable_scope_test/03: fail
-type_variable_scope_test/04: fail
-type_variable_scope_test/05: fail
-
[ $arch == simarm || $arch == arm ]
arithmetic_test: Fail, Crash
bit_operations_test: Crash, Fail
char_escape_test: Pass, Crash
deopt_smi_op_test: Fail
div_with_power_of_two_test: Fail
-double_modulo_test: Fail
gc_test: Crash
invocation_mirror_test: Fail
-large_implicit_getter_test: Crash
-load_to_load_forwarding_test: Fail
-math_vm_test: Fail
+load_to_load_forwarding_vm_test: Fail
named_parameters_with_conversions_test: Pass, Crash
-stack_overflow_stacktrace_test: Crash
-stack_overflow_test: Crash
positive_bit_operations_test: Pass, Fail, Crash
left_shift_test: Pass, Fail
+# large_implicit_getter_test Passes on ReleaseARM, Crashes in SIMARM and
+# DebugARM. Should crash on ReleaseARM, but there is no exception on an
+# unaligned access. stack_overflow_test and _stacktrace_test have the same
+# problem.
+large_implicit_getter_test: Crash, Pass
+stack_overflow_test: Crash, Pass
+stack_overflow_stacktrace_test: Crash, Pass
+
+# math_vm_test and double_modulo test fail on SIMARM because the simulator
+# isn't implementing the softfp calling convention correctly.
+math_vm_test: Fail, Pass
+double_modulo_test: Fail, Pass
+
[ $arch == mips ]
*: Skip
diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status
new file mode 100644
index 0000000..ee8acc1
--- /dev/null
+++ b/tests/language/language_analyzer.status
@@ -0,0 +1,288 @@
+# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+[ $compiler == dartanalyzer ]
+abstract_factory_constructor_test/00: fail
+assign_instance_method_negative_test: fail
+assign_static_type_test/06: fail
+bad_named_parameters2_test: fail
+bad_named_parameters_test: fail
+bad_override_test/01: fail
+bad_override_test/02: fail
+bad_override_test/03: fail
+bad_override_test/04: fail
+bad_override_test/05: fail
+black_listed_test/11: fail
+body_less_constructor_wrong_arg_negative_test: fail
+built_in_identifier_prefix_test: fail
+call_constructor_on_unresolvable_class_test/01: fail
+call_constructor_on_unresolvable_class_test/02: fail
+call_constructor_on_unresolvable_class_test/03: fail
+call_constructor_on_unresolvable_class_test/07: fail
+call_nonexistent_static_test/04: fail
+call_nonexistent_static_test/06: fail
+call_nonexistent_static_test/07: fail
+call_nonexistent_static_test/09: fail
+call_nonexistent_static_test/10: fail
+call_through_getter_test: fail
+callable_test/none: fail
+cast_test/04: fail
+cast_test/05: fail
+class_cycle_test/03: fail
+closure_call_wrong_argument_count_negative_test: fail
+compile_time_constant10_test/none: fail
+compile_time_constant8_test: fail
+compile_time_constant_b_test: fail
+compile_time_constant_c_test/01: fail
+compile_time_constant_c_test/02: fail
+compile_time_constant_checked2_test/02: fail
+compile_time_constant_checked2_test/03: fail
+compile_time_constant_checked2_test/04: fail
+compile_time_constant_checked2_test/06: fail
+compile_time_constant_checked3_test/02: fail
+compile_time_constant_checked3_test/03: fail
+compile_time_constant_checked3_test/04: fail
+compile_time_constant_checked3_test/06: fail
+compile_time_constant_d_test: fail
+compile_time_constant_e_test: fail
+const_syntax_test/06: fail
+constructor2_negative_test: fail
+constructor3_negative_test: fail
+constructor_call_wrong_argument_count_negative_test: fail
+constructor_negative_test: fail
+constructor_return_with_arrow_negative_test: fail
+constructor_return_with_init_and_arrow_negative_test: fail
+cyclic_type_variable_test/01: fail
+cyclic_type_variable_test/02: fail
+cyclic_type_variable_test/03: fail
+cyclic_type_variable_test/04: fail
+default_factory2_test/01: fail
+default_implementation2_test: fail
+dynamic2_test/00: fail
+dynamic_field_test: fail
+export_cyclic_test: fail
+f_bounded_quantification_test/01: fail
+f_bounded_quantification_test/02: fail
+factory2_test: fail
+factory5_test/00: fail
+factory_implementation_test/none: fail
+factory_redirection2_test/01: fail
+fauxverride_test/03: fail
+fauxverride_test/05: fail
+field_method4_negative_test: fail
+field_override_test/01: fail
+final_for_in_variable_test/01: fail
+final_param_negative_test: fail
+final_var_negative_test: fail
+final_variable_assignment_test/01: fail
+final_variable_assignment_test/02: fail
+final_variable_assignment_test/03: fail
+final_variable_assignment_test/04: fail
+first_class_types_constants_test: fail
+for_in2_test: fail
+function_type_alias5_test/00: fail
+function_type_alias5_test/01: fail
+function_type_alias5_test/02: fail
+getter_no_setter2_test/00: fail
+getter_no_setter2_test/03: fail
+getter_no_setter_test/00: fail
+getter_no_setter_test/01: fail
+getters_setters2_test/01: fail
+getters_setters_type_test/01: fail
+implicit_this_test/01: fail
+implicit_this_test/04: fail
+import_combinators_negative_test: fail
+inst_field_initializer1_negative_test: fail
+instance_call_wrong_argument_count_negative_test: fail
+instance_method2_negative_test: fail
+instance_method_negative_test: fail
+instantiate_type_variable_negative_test: fail
+interface_static_non_final_fields_negative_test: fail
+interface_test/00: fail
+is_not_class2_negative_test: fail
+library_juxtaposition_test: fail
+licm_test: fail
+list_literal1_negative_test: fail
+list_literal_syntax_test/01: fail
+list_literal_syntax_test/02: fail
+list_literal_syntax_test/03: fail
+map_literal1_negative_test: fail
+map_literal3_test: fail
+method_override2_test/03: fail
+mixin_illegal_constructor_test/13: fail
+mixin_illegal_constructor_test/14: fail
+mixin_illegal_constructor_test/15: fail
+mixin_illegal_constructor_test/16: fail
+mixin_illegal_cycles_test/02: fail
+mixin_illegal_cycles_test/03: fail
+mixin_illegal_cycles_test/04: fail
+mixin_illegal_cycles_test/06: fail
+mixin_illegal_syntax_test/13: fail
+mixin_type_parameters_errors_test/01: fail
+mixin_type_parameters_errors_test/02: fail
+mixin_type_parameters_errors_test/03: fail
+mixin_type_parameters_errors_test/04: fail
+mixin_type_parameters_errors_test/05: fail
+named_parameters2_test: fail
+named_parameters_aggregated_test/03: fail
+named_parameters_aggregated_test/05: fail
+new_expression_type_args_test/00: fail
+new_expression_type_args_test/01: fail
+new_expression_type_args_test/02: fail
+no_such_method_negative_test: fail
+non_const_super_negative_test: fail
+number_identifier_negative_test: fail
+override_field_method1_negative_test: fail
+override_field_method2_negative_test: fail
+override_field_method4_negative_test: fail
+override_field_method5_negative_test: fail
+override_field_test/01: fail
+override_field_test/02: fail
+override_field_test/03: fail
+override_method_with_field_test/01: fail
+override_method_with_field_test/02: fail
+prefix10_negative_test: fail
+prefix11_negative_test: fail
+prefix12_negative_test: fail
+prefix1_negative_test: fail
+prefix22_test: fail
+prefix23_test: fail
+prefix2_negative_test: fail
+prefix4_negative_test: fail
+prefix5_negative_test: fail
+prefix6_negative_test: fail
+prefix8_negative_test: fail
+prefix9_negative_test: fail
+private_member1_negative_test: fail
+private_member2_negative_test: fail
+private_member3_negative_test: fail
+pseudo_kw_illegal_test/14: fail
+pseudo_kw_test: fail
+redirecting_factory_infinite_steps_test/01: fail
+redirecting_factory_infinite_steps_test/02: fail
+scope_negative_test: fail
+setter3_test/01: fail
+setter3_test/02: fail
+static_call_wrong_argument_count_negative_test: fail
+static_field3_test/01: fail
+static_field3_test/02: fail
+static_field3_test/04: fail
+static_field_test/01: fail
+static_field_test/02: fail
+static_field_test/03: fail
+static_final_field2_negative_test: fail
+static_final_field_negative_test: fail
+syntax_test/28: fail
+syntax_test/29: fail
+syntax_test/30: fail
+syntax_test/31: fail
+syntax_test/32: fail
+syntax_test/33: fail
+ternary_test: fail
+throw7_negative_test: fail
+type_error_test: fail
+type_parameter_test/01: fail
+type_parameter_test/02: fail
+type_parameter_test/03: fail
+type_parameter_test/04: fail
+type_variable_bounds2_test/00: fail
+type_variable_bounds2_test/01: fail
+type_variable_bounds2_test/02: fail
+type_variable_bounds2_test/03: fail
+type_variable_bounds2_test/04: fail
+type_variable_bounds2_test/06: fail
+type_variable_bounds_test/00: fail
+type_variable_bounds_test/01: fail
+type_variable_bounds_test/02: fail
+type_variable_bounds_test/03: fail
+type_variable_bounds_test/04: fail
+type_variable_bounds_test/06: fail
+type_variable_bounds_test/07: fail
+type_variable_bounds_test/09: fail
+type_variable_identifier_expression_negative_test: fail
+type_variable_static_context_negative_test: fail
+typed_equality_test: fail
+unary2_test: fail
+unary_test: fail
+unresolved_in_factory_negative_test: fail
+unresolved_top_level_method_negative_test: fail
+unresolved_top_level_var_negative_test: fail
+
+# test issue 10683, It is a compile-time error if e refers to the name v or the name v=.
+block_scope_test: fail, OK
+lazy_static3_test: fail, OK
+
+# test issue 10752, there are 'implicit' scopes for 'if', 'while' and 'do-while'
+implicit_scope_test: fail, OK
+
+# test issue 10889, "throw" requires expression, "rethrow" should be used instead
+execute_finally10_test: fail, OK
+execute_finally11_test: fail, OK
+final_used_in_try_test: fail, OK
+full_stacktrace2_test: fail, OK
+stack_trace_test: fail, OK
+throw3_test: fail, OK
+try_catch3_test: fail, OK
+
+# test issue 10890; on-catch UnknownType is a static warning, not error
+try_catch_on_syntax_test/01: fail, OK
+try_catch_on_syntax_test/07: fail, OK
+try_catch_syntax_test/08: fail, OK
+
+# test issue 10899; it is static warning, not error, to call methods of class literal
+class_literal_test/02: fail, OK
+class_literal_test/05: fail, OK
+class_literal_test/07: fail, OK
+class_literal_test/10: fail, OK
+class_literal_test/11: fail, OK
+class_literal_test/12: fail, OK
+class_literal_test/14: fail, OK
+class_literal_test/17: fail, OK
+class_literal_test/18: fail, OK
+class_literal_test/19: fail, OK
+class_literal_test/22: fail, OK
+class_literal_test/23: fail, OK
+class_literal_test/24: fail, OK
+class_literal_test/27: fail, OK
+class_literal_test/28: fail, OK
+class_literal_test/29: fail, OK
+class_literal_test/none: fail, OK
+
+# Test issue 11124, Uninitialized finals are warnings not errors
+field3a_negative_test: fail, OK
+const_syntax_test/01: fail, OK
+const_syntax_test/04: fail, OK
+const_syntax_test/02: fail, OK
+const_syntax_test/03: fail, OK
+final_syntax_test/01: fail, OK
+final_syntax_test/04: fail, OK
+final_syntax_test/02: fail, OK
+final_syntax_test/03: fail, OK
+
+# Test issue 11123, Only static fields can be declared as 'const'
+const_escape_frog_test: fail, OK
+compile_time_constant_test/none: fail, OK
+
+[ $compiler == dartanalyzer && $checked ]
+factory1_test/00: fail
+factory1_test/01: fail
+field_type_check2_test/01: fail
+factory_implementation_test/00: fail
+factory_redirection_test/08: fail
+factory_redirection_test/09: fail
+factory_redirection_test/10: fail
+factory_redirection_test/11: fail
+factory_redirection_test/12: fail
+factory_redirection_test/13: fail
+factory_redirection_test/14: fail
+getters_setters2_test/03: fail
+type_variable_bounds3_test/00: fail
+type_variable_bounds2_test/05: fail
+type_variable_scope_test/00: fail
+type_variable_scope_test/01: fail
+type_variable_scope_test/02: fail
+type_variable_scope_test/03: fail
+type_variable_scope_test/04: fail
+type_variable_scope_test/05: fail
+
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
new file mode 100644
index 0000000..926d8e9
--- /dev/null
+++ b/tests/language/language_analyzer2.status
@@ -0,0 +1,288 @@
+# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+[ $compiler == dart2analyzer ]
+abstract_factory_constructor_test/00: fail
+assign_instance_method_negative_test: fail
+assign_static_type_test/06: fail
+bad_named_parameters2_test: fail
+bad_named_parameters_test: fail
+bad_override_test/01: fail
+bad_override_test/02: fail
+bad_override_test/03: fail
+bad_override_test/04: fail
+bad_override_test/05: fail
+black_listed_test/11: fail
+body_less_constructor_wrong_arg_negative_test: fail
+built_in_identifier_prefix_test: fail
+call_constructor_on_unresolvable_class_test/01: fail
+call_constructor_on_unresolvable_class_test/02: fail
+call_constructor_on_unresolvable_class_test/03: fail
+call_constructor_on_unresolvable_class_test/07: fail
+call_nonexistent_static_test/04: fail
+call_nonexistent_static_test/06: fail
+call_nonexistent_static_test/07: fail
+call_nonexistent_static_test/09: fail
+call_nonexistent_static_test/10: fail
+call_through_getter_test: fail
+callable_test/none: fail
+cast_test/04: fail
+cast_test/05: fail
+class_cycle_test/03: fail
+closure_call_wrong_argument_count_negative_test: fail
+compile_time_constant10_test/none: fail
+compile_time_constant8_test: fail
+compile_time_constant_b_test: fail
+compile_time_constant_c_test/01: fail
+compile_time_constant_c_test/02: fail
+compile_time_constant_checked2_test/02: fail
+compile_time_constant_checked2_test/03: fail
+compile_time_constant_checked2_test/04: fail
+compile_time_constant_checked2_test/06: fail
+compile_time_constant_checked3_test/02: fail
+compile_time_constant_checked3_test/03: fail
+compile_time_constant_checked3_test/04: fail
+compile_time_constant_checked3_test/06: fail
+compile_time_constant_d_test: fail
+compile_time_constant_e_test: fail
+const_syntax_test/06: fail
+constructor2_negative_test: fail
+constructor3_negative_test: fail
+constructor_call_wrong_argument_count_negative_test: fail
+constructor_negative_test: fail
+constructor_return_with_arrow_negative_test: fail
+constructor_return_with_init_and_arrow_negative_test: fail
+cyclic_type_variable_test/01: fail
+cyclic_type_variable_test/02: fail
+cyclic_type_variable_test/03: fail
+cyclic_type_variable_test/04: fail
+default_factory2_test/01: fail
+default_implementation2_test: fail
+dynamic2_test/00: fail
+dynamic_field_test: fail
+export_cyclic_test: fail
+f_bounded_quantification_test/01: fail
+f_bounded_quantification_test/02: fail
+factory2_test: fail
+factory5_test/00: fail
+factory_implementation_test/none: fail
+factory_redirection2_test/01: fail
+fauxverride_test/03: fail
+fauxverride_test/05: fail
+field_method4_negative_test: fail
+field_override_test/01: fail
+final_for_in_variable_test/01: fail
+final_param_negative_test: fail
+final_var_negative_test: fail
+final_variable_assignment_test/01: fail
+final_variable_assignment_test/02: fail
+final_variable_assignment_test/03: fail
+final_variable_assignment_test/04: fail
+first_class_types_constants_test: fail
+for_in2_test: fail
+function_type_alias5_test/00: fail
+function_type_alias5_test/01: fail
+function_type_alias5_test/02: fail
+getter_no_setter2_test/00: fail
+getter_no_setter2_test/03: fail
+getter_no_setter_test/00: fail
+getter_no_setter_test/01: fail
+getters_setters2_test/01: fail
+getters_setters_type_test/01: fail
+implicit_this_test/01: fail
+implicit_this_test/04: fail
+import_combinators_negative_test: fail
+inst_field_initializer1_negative_test: fail
+instance_call_wrong_argument_count_negative_test: fail
+instance_method2_negative_test: fail
+instance_method_negative_test: fail
+instantiate_type_variable_negative_test: fail
+interface_static_non_final_fields_negative_test: fail
+interface_test/00: fail
+is_not_class2_negative_test: fail
+library_juxtaposition_test: fail
+licm_test: fail
+list_literal1_negative_test: fail
+list_literal_syntax_test/01: fail
+list_literal_syntax_test/02: fail
+list_literal_syntax_test/03: fail
+map_literal1_negative_test: fail
+map_literal3_test: fail
+method_override2_test/03: fail
+mixin_illegal_constructor_test/13: fail
+mixin_illegal_constructor_test/14: fail
+mixin_illegal_constructor_test/15: fail
+mixin_illegal_constructor_test/16: fail
+mixin_illegal_cycles_test/02: fail
+mixin_illegal_cycles_test/03: fail
+mixin_illegal_cycles_test/04: fail
+mixin_illegal_cycles_test/06: fail
+mixin_illegal_syntax_test/13: fail
+mixin_type_parameters_errors_test/01: fail
+mixin_type_parameters_errors_test/02: fail
+mixin_type_parameters_errors_test/03: fail
+mixin_type_parameters_errors_test/04: fail
+mixin_type_parameters_errors_test/05: fail
+named_parameters2_test: fail
+named_parameters_aggregated_test/03: fail
+named_parameters_aggregated_test/05: fail
+new_expression_type_args_test/00: fail
+new_expression_type_args_test/01: fail
+new_expression_type_args_test/02: fail
+no_such_method_negative_test: fail
+non_const_super_negative_test: fail
+number_identifier_negative_test: fail
+override_field_method1_negative_test: fail
+override_field_method2_negative_test: fail
+override_field_method4_negative_test: fail
+override_field_method5_negative_test: fail
+override_field_test/01: fail
+override_field_test/02: fail
+override_field_test/03: fail
+override_method_with_field_test/01: fail
+override_method_with_field_test/02: fail
+prefix10_negative_test: fail
+prefix11_negative_test: fail
+prefix12_negative_test: fail
+prefix1_negative_test: fail
+prefix22_test: fail
+prefix23_test: fail
+prefix2_negative_test: fail
+prefix4_negative_test: fail
+prefix5_negative_test: fail
+prefix6_negative_test: fail
+prefix8_negative_test: fail
+prefix9_negative_test: fail
+private_member1_negative_test: fail
+private_member2_negative_test: fail
+private_member3_negative_test: fail
+pseudo_kw_illegal_test/14: fail
+pseudo_kw_test: fail
+redirecting_factory_infinite_steps_test/01: fail
+redirecting_factory_infinite_steps_test/02: fail
+scope_negative_test: fail
+setter3_test/01: fail
+setter3_test/02: fail
+static_call_wrong_argument_count_negative_test: fail
+static_field3_test/01: fail
+static_field3_test/02: fail
+static_field3_test/04: fail
+static_field_test/01: fail
+static_field_test/02: fail
+static_field_test/03: fail
+static_final_field2_negative_test: fail
+static_final_field_negative_test: fail
+syntax_test/28: fail
+syntax_test/29: fail
+syntax_test/30: fail
+syntax_test/31: fail
+syntax_test/32: fail
+syntax_test/33: fail
+ternary_test: fail
+throw7_negative_test: fail
+type_error_test: fail
+type_parameter_test/01: fail
+type_parameter_test/02: fail
+type_parameter_test/03: fail
+type_parameter_test/04: fail
+type_variable_bounds2_test/00: fail
+type_variable_bounds2_test/01: fail
+type_variable_bounds2_test/02: fail
+type_variable_bounds2_test/03: fail
+type_variable_bounds2_test/04: fail
+type_variable_bounds2_test/06: fail
+type_variable_bounds_test/00: fail
+type_variable_bounds_test/01: fail
+type_variable_bounds_test/02: fail
+type_variable_bounds_test/03: fail
+type_variable_bounds_test/04: fail
+type_variable_bounds_test/06: fail
+type_variable_bounds_test/07: fail
+type_variable_bounds_test/09: fail
+type_variable_identifier_expression_negative_test: fail
+type_variable_static_context_negative_test: fail
+typed_equality_test: fail
+unary2_test: fail
+unary_test: fail
+unresolved_in_factory_negative_test: fail
+unresolved_top_level_method_negative_test: fail
+unresolved_top_level_var_negative_test: fail
+
+# test issue 10683, It is a compile-time error if e refers to the name v or the name v=.
+block_scope_test: fail, OK
+lazy_static3_test: fail, OK
+
+# test issue 10752, there are 'implicit' scopes for 'if', 'while' and 'do-while'
+implicit_scope_test: fail, OK
+
+# test issue 10889, "throw" requires expression, "rethrow" should be used instead
+execute_finally10_test: fail, OK
+execute_finally11_test: fail, OK
+final_used_in_try_test: fail, OK
+full_stacktrace2_test: fail, OK
+stack_trace_test: fail, OK
+throw3_test: fail, OK
+try_catch3_test: fail, OK
+
+# test issue 10890; on-catch UnknownType is a static warning, not error
+try_catch_on_syntax_test/01: fail, OK
+try_catch_on_syntax_test/07: fail, OK
+try_catch_syntax_test/08: fail, OK
+
+# test issue 10899; it is static warning, not error, to call methods of class literal
+class_literal_test/02: fail, OK
+class_literal_test/05: fail, OK
+class_literal_test/07: fail, OK
+class_literal_test/10: fail, OK
+class_literal_test/11: fail, OK
+class_literal_test/12: fail, OK
+class_literal_test/14: fail, OK
+class_literal_test/17: fail, OK
+class_literal_test/18: fail, OK
+class_literal_test/19: fail, OK
+class_literal_test/22: fail, OK
+class_literal_test/23: fail, OK
+class_literal_test/24: fail, OK
+class_literal_test/27: fail, OK
+class_literal_test/28: fail, OK
+class_literal_test/29: fail, OK
+class_literal_test/none: fail, OK
+
+# Test issue 11124, Uninitialized finals are warnings not errors
+field3a_negative_test: fail, OK
+const_syntax_test/01: fail, OK
+const_syntax_test/04: fail, OK
+const_syntax_test/02: fail, OK
+const_syntax_test/03: fail, OK
+final_syntax_test/01: fail, OK
+final_syntax_test/04: fail, OK
+final_syntax_test/02: fail, OK
+final_syntax_test/03: fail, OK
+
+# Test issue 11123, Only static fields can be declared as 'const'
+const_escape_frog_test: fail, OK
+compile_time_constant_test/none: fail, OK
+
+[ $compiler == dart2analyzer && $checked ]
+factory1_test/00: fail
+factory1_test/01: fail
+field_type_check2_test/01: fail
+factory_implementation_test/00: fail
+factory_redirection_test/08: fail
+factory_redirection_test/09: fail
+factory_redirection_test/10: fail
+factory_redirection_test/11: fail
+factory_redirection_test/12: fail
+factory_redirection_test/13: fail
+factory_redirection_test/14: fail
+getters_setters2_test/03: fail
+type_variable_bounds3_test/00: fail
+type_variable_bounds2_test/05: fail
+type_variable_scope_test/00: fail
+type_variable_scope_test/01: fail
+type_variable_scope_test/02: fail
+type_variable_scope_test/03: fail
+type_variable_scope_test/04: fail
+type_variable_scope_test/05: fail
+
diff --git a/tests/language/load_to_load_forwarding_test.dart b/tests/language/load_to_load_forwarding_vm_test.dart
similarity index 73%
rename from tests/language/load_to_load_forwarding_test.dart
rename to tests/language/load_to_load_forwarding_vm_test.dart
index cade3c6..b77854f 100644
--- a/tests/language/load_to_load_forwarding_test.dart
+++ b/tests/language/load_to_load_forwarding_vm_test.dart
@@ -4,6 +4,7 @@
// Test correctness of side effects tracking used by load to load forwarding.
import "package:expect/expect.dart";
+import "dart:typed_data";
class A {
var x, y;
@@ -50,6 +51,26 @@
return arr.length;
}
+
+testPhiRepresentation(f, arr) {
+ if (f) {
+ arr[0] = arr[0] + arr[1];
+ } else {
+ arr[0] = arr[0] - arr[1];
+ }
+ return arr[0];
+}
+
+
+testPhiConvertions(f, arr) {
+ if (f) {
+ arr[0] = arr[1];
+ } else {
+ arr[0] = arr[2];
+ }
+ return arr[0];
+}
+
main() {
final fixed = new List(10);
final growable = [];
@@ -57,15 +78,30 @@
testImmutableVMFields(growable, false);
testImmutableVMFields(growable, false);
+ final f64List = new Float64List(2);
+ testPhiRepresentation(true, f64List);
+ testPhiRepresentation(false, f64List);
+
for (var i = 0; i < 2000; i++) {
Expect.listEquals([0x02010000, 0x03020100], foo(new A(0, 0)));
Expect.listEquals([0x02010000, 0x03020100], bar(new A(0, 0), false));
Expect.listEquals([0x04020000, 0x03020100], bar(new A(0, 0), true));
testImmutableVMFields(fixed, true);
+ testPhiRepresentation(true, f64List);
}
Expect.equals(1, testImmutableVMFields([], false));
Expect.equals(2, testImmutableVMFields([1], false));
Expect.equals(2, testImmutableVMFields([1, 2], false));
Expect.equals(3, testImmutableVMFields([1, 2, 3], false));
-}
\ No newline at end of file
+
+ final u32List = new Uint32List(3);
+ u32List[0] = 0;
+ u32List[1] = 0x3FFFFFFF;
+ u32List[2] = 0x7FFFFFFF;
+
+ for (var i = 0; i < 4000; i++) {
+ testPhiConvertions(true, u32List);
+ testPhiConvertions(false, u32List);
+ }
+}
diff --git a/tests/language/multiple_field_assignment_constructor_test.dart b/tests/language/multiple_field_assignment_constructor_test.dart
new file mode 100644
index 0000000..9058c42
--- /dev/null
+++ b/tests/language/multiple_field_assignment_constructor_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import "compiler_annotations.dart";
+
+var a = [null];
+
+class A {
+ var foo;
+ var bar;
+
+ @DontInline
+ A() {
+ // Currently defeat inlining by using a closure.
+ bar = () => 42;
+ foo = 42;
+ foo = a[0];
+ }
+}
+
+class B {
+ var foo;
+ var bar;
+
+ @DontInline
+ B() {
+ // Currently defeat inlining by using a closure.
+ bar = () => 42;
+ foo = 42;
+ foo = a[0];
+ if (false) foo = 42;
+ }
+}
+
+main() {
+ // Surround the call to [bar] by allocations of [A] and [B] to
+ // ensure their constructors get analyzed first.
+ new A();
+ new B();
+ bar();
+ new A();
+ new B();
+}
+
+@DontInline
+bar() {
+ // Currently defeat inlining by using a closure.
+ Expect.throws(() => new A().foo + 42, (e) => e is NoSuchMethodError);
+ Expect.throws(() => new B().foo + 42, (e) => e is NoSuchMethodError);
+}
diff --git a/tests/language/reg_exp_test.dart b/tests/language/reg_exp_test.dart
index 631cfda..26826a9 100644
--- a/tests/language/reg_exp_test.dart
+++ b/tests/language/reg_exp_test.dart
@@ -5,22 +5,24 @@
import "package:expect/expect.dart";
-class RegExpTest {
- static test1() {
- RegExp exp = new RegExp("(\\w+)");
- String str = "Parse my string";
- List<Match> matches = new List<Match>.from(exp.allMatches(str));
- Expect.equals(3, matches.length);
- Expect.equals("Parse", matches[0].group(0));
- Expect.equals("my", matches[1].group(0));
- Expect.equals("string", matches[2].group(0));
- }
+void main() {
+ RegExp exp = new RegExp(r"(\w+)");
+ String str = "Parse my string";
+ List<Match> matches = exp.allMatches(str).toList();
+ Expect.equals(3, matches.length);
+ Expect.equals("Parse", matches[0].group(0));
+ Expect.equals("my", matches[1].group(0));
+ Expect.equals("string", matches[2].group(0));
- static testMain() {
- test1();
- }
-}
+ // Check that allMatches progresses correctly for empty matches, and that
+ // it includes the empty match at the end position.
+ exp = new RegExp("a?");
+ str = "babba";
+ Expect.listEquals(["", "a", "", "", "a", ""],
+ exp.allMatches(str).map((x)=>x[0]).toList());
-main() {
- RegExpTest.testMain();
+ // Regression test for http://dartbug.com/2980
+ exp = new RegExp("^", multiLine: true); // Any zero-length match will work.
+ str = "foo\nbar\nbaz";
+ Expect.equals(" foo\n bar\n baz", str.replaceAll(exp, " "));
}
diff --git a/tests/lib/analyzer/analyze_tests.status b/tests/lib/analyzer/analyze_tests.status
index 90d7b8b..25abec6 100644
--- a/tests/lib/analyzer/analyze_tests.status
+++ b/tests/lib/analyzer/analyze_tests.status
@@ -36,5 +36,10 @@
standalone/io/web_socket_protocol_processor_test: Fail
standalone/io/url_encoding_test: Fail
+
[ $compiler == dartanalyzer ]
standalone/io/process_exit_negative_test: fail
+
+
+[ $compiler == dart2analyzer ]
+standalone/io/process_exit_negative_test: fail
diff --git a/tests/lib/crypto/base64_test.dart b/tests/lib/crypto/base64_test.dart
index efc438e..9a58e3b 100644
--- a/tests/lib/crypto/base64_test.dart
+++ b/tests/lib/crypto/base64_test.dart
@@ -81,16 +81,12 @@
testDecoderForMalformedInput() {
Expect.throws(() {
- CryptoUtils.base64StringToBytes('AB~', ignoreInvalidCharacters: false);
+ CryptoUtils.base64StringToBytes('AB~');
}, (e) => e is FormatException);
Expect.throws(() {
CryptoUtils.base64StringToBytes('A');
}, (e) => e is FormatException);
-
- Expect.listEquals('f'.codeUnits,
- CryptoUtils.base64StringToBytes('~~Zg==@@@',
- ignoreInvalidCharacters: true));
}
testUrlSafeEncodeDecode() {
diff --git a/tests/lib/crypto/sha1_test.dart b/tests/lib/crypto/sha1_test.dart
index 24a7271..7ce49c3 100644
--- a/tests/lib/crypto/sha1_test.dart
+++ b/tests/lib/crypto/sha1_test.dart
@@ -545,7 +545,7 @@
void testInvalidUse() {
var sha = new SHA1();
sha.close();
- Expect.throws(() => sha.add([0]), (e) => e is HashException);
+ Expect.throws(() => sha.add([0]), (e) => e is StateError);
}
void testRepeatedDigest() {
diff --git a/tests/lib/crypto/sha256_test.dart b/tests/lib/crypto/sha256_test.dart
index 528c831..01bb4b8 100644
--- a/tests/lib/crypto/sha256_test.dart
+++ b/tests/lib/crypto/sha256_test.dart
@@ -289,7 +289,7 @@
void testInvalidUse() {
var sha = new SHA256();
sha.close();
- Expect.throws(() => sha.add([0]), (e) => e is HashException);
+ Expect.throws(() => sha.add([0]), (e) => e is StateError);
}
void testRepeatedDigest() {
diff --git a/tests/lib/mirrors/mirrors_test.dart b/tests/lib/mirrors/mirrors_test.dart
index 310f57c..b044283 100644
--- a/tests/lib/mirrors/mirrors_test.dart
+++ b/tests/lib/mirrors/mirrors_test.dart
@@ -203,11 +203,12 @@
mainWithArgument({bool isDart2js: false, bool isMinified: false}) {
var mirrors = currentMirrorSystem();
test("Test reflective method invocation", () { testInvoke(mirrors); });
- if (isMinified) return;
test("Test instance field access", () { testInstanceFieldAccess(mirrors); });
test('Test intercepted objects', () { testIntercepted(mirrors); });
+ if (!isMinified) // TODO(ahe): Remove this line.
test("Test field access", () { testFieldAccess(mirrors); });
test("Test closure mirrors", () { testClosureMirrors(mirrors); });
+ if (!isMinified) // TODO(ahe): Remove this line.
test("Test invoke constructor", () { testInvokeConstructor(mirrors); });
test("Test current library uri", () {
testLibraryUri(new Class(),
@@ -216,6 +217,7 @@
test("Test dart library uri", () {
testLibraryUri("test", (Uri uri) => uri == Uri.parse('dart:core'));
});
+ if (!isMinified) // TODO(ahe): Remove this line.
test("Test simple and qualifiedName", () { testNames(mirrors, isDart2js); });
if (isDart2js) return; // TODO(ahe): Remove this line.
test("Test reflect type", () { testReflectClass(mirrors); });
diff --git a/tests/standalone/53bit_overflow_test.dart b/tests/standalone/53bit_overflow_test.dart
new file mode 100644
index 0000000..1475cfd
--- /dev/null
+++ b/tests/standalone/53bit_overflow_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// VMOptions=--throw_on_javascript_int_overflow
+
+
+import "package:expect/expect.dart";
+import 'dart:typed_data';
+
+
+int double_to_int_throws() {
+ double d = 1.9e16;
+ return d.toInt();
+}
+
+
+int integer_add_throws() {
+ return (1 << 52) + (1 << 52);
+}
+
+
+int i64list_throws() {
+ var i64l = new Int64List(16);
+ i64l[0] = (1 << 54);
+ return i64l[0];
+}
+
+
+int double_to_int() {
+ double d = 1.9e14;
+ return d.toInt();
+}
+
+
+int integer_add() {
+ return (1 << 50) + (1 << 50);
+}
+
+
+main() {
+ Expect.throws(double_to_int_throws, (e) => e is FiftyThreeBitOverflowError);
+ Expect.throws(integer_add_throws, (e) => e is FiftyThreeBitOverflowError);
+ Expect.throws(i64list_throws, (e) => e is FiftyThreeBitOverflowError);
+ Expect.equals(190000000000000, double_to_int());
+ Expect.equals(1 << 51, integer_add());
+}
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index 7bb7492..7d552d6 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -81,6 +81,7 @@
io/process_exit_negative_test: Fail # This is a compilation-time negative test.
+
[ $compiler == dartanalyzer ]
io/file_constructor_test: fail
io/http_date_test: fail
@@ -95,6 +96,20 @@
io/skipping_dart2js_compilations_test: fail, OK
+[ $compiler == dart2analyzer ]
+io/file_constructor_test: fail
+io/http_date_test: fail
+io/http_headers_test: fail
+io/http_parser_test: fail
+io/process_exit_negative_test: fail
+io/url_encoding_test: fail
+io/web_socket_protocol_processor_test: fail
+
+# Fails because checked-in dart executable is not up to date.
+io/test_runner_test: fail, OK
+io/skipping_dart2js_compilations_test: fail, OK
+
+
[ $compiler == dart2js ]
number_identity_test: Skip # Bigints and int/double diff. not supported.
typed_data_test: Skip # dart:typed_data support needed.
@@ -117,6 +132,7 @@
io/test_runner_test: Fail # Library dart:uri removed.
io/skipping_dart2js_compilations_test: Skip # Library dart:uri removed.
http_launch_test: Skip
+53bit_overflow_test: Skip
[ $compiler == dart2js && $jscl ]
assert_test: Fail, OK # Assumes unspecified fields on the AssertionError.
diff --git a/tests/utils/utils.status b/tests/utils/utils.status
index 79344f3..7bc1414 100644
--- a/tests/utils/utils.status
+++ b/tests/utils/utils.status
@@ -20,10 +20,6 @@
[ $system == macos || $system == windows ]
*_layout_test: Skip
-[ $compiler == dart2dart ]
-# Skip until we stabilize language tests.
-*: Skip
-
[ $arch == arm ]
*: Skip
diff --git a/tools/VERSION b/tools/VERSION
index 49da9c5..080e489 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 5
-BUILD 14
-PATCH 3
+BUILD 15
+PATCH 0
diff --git a/tools/bots/cross-vm.py b/tools/bots/cross-vm.py
index 3671f20..ea992a5 100644
--- a/tools/bots/cross-vm.py
+++ b/tools/bots/cross-vm.py
@@ -132,7 +132,7 @@
run([GSUTIL, 'cp', uri, checked_recording])
run(['python', execute_testcases_py, checked_recording,
checked_recording_out])
- run([GSUTIL, 'cp', recording_out, uri_out])
+ run([GSUTIL, 'cp', checked_recording_out, uri_out])
run([GSUTIL, 'setacl', 'public-read', uri_out])
finally:
for path in temporary_files:
diff --git a/tools/create_sdk.py b/tools/create_sdk.py
index c938e92..6c10830 100755
--- a/tools/create_sdk.py
+++ b/tools/create_sdk.py
@@ -40,14 +40,6 @@
# ......mirrors/
# ......utf/
# ......typed_data/
-# ....packages/
-# ......args/
-# ......intl/
-# ......logging/
-# ......meta/
-# ......serialization
-# ......unittest/
-# ......(more will come here)
# ....util/
# ......dartanalyzer/
# ........dartanalyzer.jar
@@ -219,20 +211,6 @@
copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'),
join(LIB, '_internal', 'libraries.dart'))
- # Create and copy packages.
- PACKAGES = join(SDK_tmp, 'packages')
- os.makedirs(PACKAGES)
-
- #
- # Create and populate packages/{args, intl, logging, meta, unittest, ...}
- #
-
- for library in ['args', 'http', 'intl', 'logging', 'meta', 'oauth2', 'pathos',
- 'serialization', 'unittest', 'yaml', 'analyzer_experimental']:
-
- copytree(join(HOME, 'pkg', library, 'lib'), join(PACKAGES, library),
- ignore=ignore_patterns('*.svn'))
-
# Create and copy tools.
UTIL = join(SDK_tmp, 'util')
os.makedirs(UTIL)
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index c0f2c2c..e9292c2 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -1086,6 +1086,9 @@
"DOMSettableTokenList": {
"comment": "http://dev.w3.org/html5/spec-LC/common-dom-interfaces.html#domsettabletokenlist-0",
"members": {
+ "__getter__": {
+ "support_level": "untriaged"
+ },
"value": {}
},
"support_level": "stable"
@@ -1101,7 +1104,11 @@
},
"DOMStringMap": {
"comment": "http://dev.w3.org/html5/spec-LC/common-dom-interfaces.html#domstringmap-0",
- "members": {},
+ "members": {
+ "__getter__": {
+ "support_level": "untriaged"
+ }
+ },
"support_level": "stable"
},
"DOMTokenList": {
@@ -1128,6 +1135,9 @@
"comment": "http://www.w3.org/TR/file-system-api/#idl-def-LocalFileSystem",
"support_level": "experimental"
},
+ "__getter__": {
+ "support_level": "untriaged"
+ },
"addEventListener": {},
"alert": {},
"applicationCache": {},
@@ -3402,6 +3412,9 @@
"HTMLFormControlsCollection": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection-0",
"members": {
+ "__getter__": {
+ "support_level": "untriaged"
+ },
"namedItem": {}
},
"support_level": "stable"
@@ -3410,6 +3423,9 @@
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#the-form-element",
"members": {
"HTMLFormElement": {},
+ "__getter__": {
+ "support_level": "untriaged"
+ },
"acceptCharset": {},
"action": {},
"autocomplete": {
@@ -10108,6 +10124,9 @@
"comment": "http://www.w3.org/TR/webstorage/#the-storage-interface",
"dart_action": "unstable",
"members": {
+ "__getter__": {
+ "support_level": "untriaged"
+ },
"clear": {},
"getItem": {},
"key": {},
@@ -11194,6 +11213,9 @@
"WebKitCSSKeyframesRule": {
"comment": "http://www.w3.org/TR/css3-animations/#csskeyframesrule",
"members": {
+ "__getter__": {
+ "support_level": "untriaged"
+ },
"cssRules": {},
"deleteRule": {},
"findRule": {},
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 7912543..c08f2e0 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -105,6 +105,8 @@
'WheelEvent': 'WheelEvent,MouseWheelEvent,MouseScrollEvent',
+ 'XMLHttpRequestUpload': 'XMLHttpRequestUpload,XMLHttpRequestEventTarget',
+
}, dart2jsOnly=True)
def IsRegisteredType(type_name):
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index cd1d45c..18e5949 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -727,18 +727,19 @@
return 'indexed_db'
if interface.id.startswith("SQL"):
return 'web_sql'
+ if interface.id.startswith("SVG"):
+ return 'svg'
+ if interface.id.startswith("WebGL") or interface.id.startswith("OES") \
+ or interface.id.startswith("EXT"):
+ return 'web_gl'
if 'Conditional' in interface.ext_attrs:
if 'WEB_AUDIO' in interface.ext_attrs['Conditional']:
return 'web_audio'
- if 'SVG' in interface.ext_attrs['Conditional']:
- return 'svg'
if 'INDEXED_DATABASE' in interface.ext_attrs['Conditional']:
return 'indexed_db'
if 'SQL_DATABASE' in interface.ext_attrs['Conditional']:
return 'web_sql'
- if 'WEBGL' in interface.ext_attrs['Conditional']:
- return 'web_gl'
if interface.id in typed_array_renames:
return 'typed_data'
diff --git a/tools/dom/scripts/idlnode.py b/tools/dom/scripts/idlnode.py
index ea6d78d..5fc3d22 100755
--- a/tools/dom/scripts/idlnode.py
+++ b/tools/dom/scripts/idlnode.py
@@ -478,6 +478,21 @@
self.arguments = self._convert_all(ast, 'Argument', IDLArgument)
self.specials = self._find_all(ast, 'Special')
self.is_stringifier = self._has(ast, 'Stringifier')
+ # Special case: there are getters of the form
+ # getter <ReturnType>(args). For now force the name to be __getter__,
+ # but it should be operator[] later.
+ if self.id is None:
+ if self.specials == ['getter']:
+ self.id = '__getter__'
+ elif self.specials == ['setter']:
+ self.id = '__setter__'
+ # Special case: if it's a setter, ignore 'declared' return type
+ self.type = IDLType([('VoidType', None)])
+ elif self.specials == ['deleter']:
+ self.id = '__delete__'
+ else:
+ raise Exception('Cannot handle %s: operation has no id' % ast)
+
def _extra_repr(self):
return [self.arguments]
diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py
index c016b7e..648f2eb 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -576,10 +576,12 @@
'static ' if operation.is_static else '',
self.SecureOutputType(operation.type.id),
overload_name, argument_list)
+ is_custom = 'Custom' in operation.ext_attrs
cpp_callback_name = self._GenerateNativeBinding(
overload_name, (0 if operation.is_static else 1) + argument_count,
- dart_declaration, 'Callback', False, False)
- self._GenerateOperationNativeCallback(operation, operation.arguments[:argument_count], cpp_callback_name)
+ dart_declaration, 'Callback', is_custom, emit_metadata=False)
+ if not is_custom:
+ self._GenerateOperationNativeCallback(operation, operation.arguments[:argument_count], cpp_callback_name)
self._GenerateDispatcherBody(
info,
@@ -787,6 +789,7 @@
start_index = 1 if needs_receiver else 0
for i, argument in enumerate(arguments):
type_info = self._TypeInfo(argument.type.id)
+ self._cpp_impl_includes |= set(type_info.conversion_includes())
argument_expression_template, type, cls, function = \
type_info.to_native_info(argument, self._interface.id)
diff --git a/tools/dom/src/dart2js_KeyEvent.dart b/tools/dom/src/dart2js_KeyEvent.dart
index a81d842..15a7153 100644
--- a/tools/dom/src/dart2js_KeyEvent.dart
+++ b/tools/dom/src/dart2js_KeyEvent.dart
@@ -42,7 +42,7 @@
int get _realCharCode => JS('int', '#.charCode', _parent);
/** Accessor to the underlying altKey value is the parent event. */
- bool get _realAltKey => JS('int', '#.altKey', _parent);
+ bool get _realAltKey => JS('bool', '#.altKey', _parent);
/** Construct a KeyEvent with [parent] as the event we're emulating. */
KeyEvent(KeyboardEvent parent): super(parent) {
diff --git a/tools/dom/templates/html/impl/impl_HTMLSelectElement.darttemplate b/tools/dom/templates/html/impl/impl_HTMLSelectElement.darttemplate
index 2f1b90a..4099cd1 100644
--- a/tools/dom/templates/html/impl/impl_HTMLSelectElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLSelectElement.darttemplate
@@ -10,7 +10,8 @@
// Override default options, since IE returns SelectElement itself and it
// does not operate as a List.
List<OptionElement> get options {
- var options = this.children.where((e) => e is OptionElement).toList();
+ var options =
+ this.queryAll('option').where((e) => e is OptionElement).toList();
return new UnmodifiableListView(options);
}
diff --git a/tools/make_links.py b/tools/make_links.py
index e47d02f..965d04f 100644
--- a/tools/make_links.py
+++ b/tools/make_links.py
@@ -21,14 +21,6 @@
def make_link(source, target):
- # TODO(ahe): Remove this code when the build bots are green again.
- bug_cleanup = os.path.join(target, 'lib')
- if os.path.islink(bug_cleanup):
- print 'Removing %s' % bug_cleanup
- sys.stdout.flush()
- os.unlink(bug_cleanup)
- # End of temporary code.
-
if os.path.islink(target):
print 'Removing %s' % target
sys.stdout.flush()
diff --git a/tools/testing/dart/browser_controller.dart b/tools/testing/dart/browser_controller.dart
index 8570f35..52679e6 100644
--- a/tools/testing/dart/browser_controller.dart
+++ b/tools/testing/dart/browser_controller.dart
@@ -50,8 +50,9 @@
/** Print everything (stdout, stderr, usageLog) whenever we add to it */
bool debugPrint = false;
- // We use this to gracefully handle double calls to close.
- bool underTermination = false;
+ // This future will be lazily set when calling close() and will complete once
+ // the process did exit.
+ Future browserTerminationFuture;
Browser();
@@ -95,75 +96,31 @@
_stderr.write(output);
}
- // Kill the underlying process using the supplied kill function
- // If there is a alternativeKillFunction we will use that after trying
- // the default killFunction.
- Future _killIt(killFunction, retries, [alternativeKillFunction = null]) {
- Completer<bool> completer = new Completer<bool>();
-
- // To capture non successfull attempts we set up a timer that will
- // trigger a retry (using the alternativeKillFunction if supplied).
- Timer timer = new Timer(killRepeatInternal, () {
- // Remove the handler, we will set this again in the call to killIt
- // below
- if (retries <= 0) {
- _logEvent("Could not kill the process, not trying anymore");
- // TODO(ricow): Should we crash the test script here and
- // write out all our log. This is basically not a situation
- // that we want to ignore. We could potentially have a handler we
- // can call if this happens, which will shutdown the main process
- // with info that people should contact [ricow,kustermann,?]
- completer.complete(false);
- }
- _logEvent("Could not kill the process, retrying");
- var nextKillFunction = killFunction;
- if (alternativeKillFunction != null) {
- nextKillFunction = alternativeKillFunction;
- }
- _killIt(nextKillFunction, retries - 1).then((success) {
- completer.complete(success);
- });
- });
-
- // Make sure we intercept onExit calls and eliminate the timer.
- _processClosed = () {
- timer.cancel();
- _logEvent("Proccess exited, cancel timer in kill loop");
- _processClosed = null;
- process = null;
- completer.complete(true);
- };
-
-
- _logEvent("calling kill function");
- if (process != null && killFunction()) {
- // We successfully sent the signal.
- _logEvent("killing signal sent");
- } else {
- _logEvent("The process is already dead, kill signal could not be send");
- completer.complete(true);
- }
- return completer.future;
- }
-
-
- /** Close the browser */
- Future<bool> close() {
+ Future close() {
_logEvent("Close called on browser");
- if (underTermination) {
- _logEvent("Browser already under termination.");
- return new Future.immediate(true);
+ if (browserTerminationFuture == null) {
+ var completer = new Completer();
+ browserTerminationFuture = completer.future;
+
+ if (process != null) {
+ // Make sure we intercept onExit calls and complete.
+ _processClosed = () {
+ _processClosed = null;
+ process = null;
+ completer.complete(true);
+ };
+
+ if (process.kill(ProcessSignal.SIGKILL)) {
+ _logEvent("Successfully sent kill signal to process.");
+ } else {
+ _logEvent("Sending kill signal failed.");
+ }
+ } else {
+ _logEvent("The process is already dead.");
+ completer.complete(true);
+ }
}
- underTermination = true;
- if (process == null) {
- _logEvent("No process open, nothing to kill.");
- return new Future.immediate(true);
- }
- var killFunction = process.kill;
- // We use a SIGKILL signal if we don't kill the process in the first go.
- var alternativeKillFunction =
- () { return process.kill(ProcessSignal.SIGKILL);};
- return _killIt(killFunction, killRetries, alternativeKillFunction);
+ return browserTerminationFuture;
}
/**
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 0546964..40cccd2 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -478,7 +478,8 @@
return new StandardTestSuite(configuration,
name, directory,
- ['$directory/$name.status', '$directory/${name}_dart2js.status'],
+ ['$directory/$name.status', '$directory/${name}_dart2js.status',
+ '$directory/${name}_analyzer.status', '$directory/${name}_analyzer2.status'],
isTestFilePredicate: (filename) => filename.endsWith('_test.dart'),
recursive: true);
}
@@ -564,9 +565,11 @@
}
for (var statusFilePath in statusFilePaths) {
- // [forDirectory] adds name_dart2js.status for all tests suites. Use it
+ // [forDirectory] adds name_$compiler.status for all tests suites. Use it
// if it exists, but otherwise skip it and don't fail.
- if (statusFilePath.endsWith('_dart2js.status')) {
+ if (statusFilePath.endsWith('_dart2js.status') ||
+ statusFilePath.endsWith('_analyzer.status') ||
+ statusFilePath.endsWith('_analyzer2.status')) {
var file = new File.fromPath(dartDir.append(statusFilePath));
if (!file.existsSync()) {
filesRead++;
@@ -1834,6 +1837,9 @@
if (compiler == "dart2js" && configuration["csp"]) {
args.add("--disallow-unsafe-eval");
}
+ if (compiler == "dartanalyzer" || compiler == "dart2analyzer") {
+ args.add("--show-package-warnings");
+ }
return args;
}
diff --git a/utils/apidoc/apidoc.dart b/utils/apidoc/apidoc.dart
index bc20887c..ef6bae5 100644
--- a/utils/apidoc/apidoc.dart
+++ b/utils/apidoc/apidoc.dart
@@ -180,7 +180,7 @@
Future.wait([copiedStatic, copiedApiDocStatic, htmlDiff])
.then((_) => apidoc.documentLibraries(apidocLibraries, libPath,
packageRoot))
- .then((_) => compileScript(mode, outputDir, libPath))
+ .then((_) => compileScript(mode, outputDir, libPath, apidoc.tmpPath))
.then((_) => print(apidoc.status))
.catchError((e) {
print('Error: generation failed: ${e}');
diff --git a/utils/compiler/compiler.gyp b/utils/compiler/compiler.gyp
index 1755ce2..8c95316 100644
--- a/utils/compiler/compiler.gyp
+++ b/utils/compiler/compiler.gyp
@@ -19,7 +19,8 @@
'inputs': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
'../../sdk/lib/_internal/libraries.dart',
- '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../sdk/lib/_internal/compiler", "../../runtime/lib"])',
+ '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../sdk/lib/_internal/compiler", "../../runtime/lib", "../../sdk/lib/_internal/dartdoc"])',
+ 'create_snapshot.dart',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/utils_wrapper.dart.snapshot',
@@ -29,6 +30,8 @@
'create_snapshot.dart',
'--output_dir=<(SHARED_INTERMEDIATE_DIR)',
'--dart2js_main=sdk/lib/_internal/compiler/implementation/dart2js.dart',
+ '--dartdoc_main=sdk/lib/_internal/dartdoc/bin/dartdoc.dart',
+ '--package_root=<(PRODUCT_DIR)/packages/',
],
},
],
diff --git a/utils/compiler/create_snapshot.dart b/utils/compiler/create_snapshot.dart
index c5a8af4..d3a460e 100644
--- a/utils/compiler/create_snapshot.dart
+++ b/utils/compiler/create_snapshot.dart
@@ -22,11 +22,13 @@
Future<String> getSnapshotGenerationFile(var options, var args, var rootPath) {
var dart2js = rootPath.append(args["dart2js_main"]);
+ var dartdoc = rootPath.append(args["dartdoc_main"]);
return getVersion(options, rootPath).then((version) {
var snapshotGenerationText =
"""
import '${dart2js}' as dart2jsMain;
+import '${dartdoc}' as dartdocMain;
import 'dart:io';
void main() {
@@ -36,6 +38,8 @@
if (tool == "dart2js") {
dart2jsMain.BUILD_ID = "$version";
dart2jsMain.mainWithErrorHandler(options);
+ } else if (tool == "dartdoc") {
+ dartdocMain.mainWithOptions(options);
}
}
@@ -51,9 +55,10 @@
writer.close();
}
-Future createSnapshot(var options, var dart_file) {
+Future createSnapshot(var options, var dart_file, var packageRoot) {
return Process.run(options.executable,
- ["--generate-script-snapshot=$dart_file.snapshot",
+ ["--package-root=$packageRoot",
+ "--generate-script-snapshot=$dart_file.snapshot",
dart_file])
.then((result) {
if (result.exitCode != 0) {
@@ -69,7 +74,8 @@
*/
void main() {
Options options = new Options();
- var validArguments = ["--output_dir", "--dart2js_main"];
+ var validArguments = ["--output_dir", "--dart2js_main", "--dartdoc_main",
+ "--package_root"];
var args = {};
for (var argument in options.arguments) {
var argumentSplit = argument.split("=");
@@ -80,7 +86,9 @@
args[argumentSplit[0].substring(2)] = argumentSplit[1];
}
if (!args.containsKey("dart2js_main")) throw "Please specify dart2js_main";
+ if (!args.containsKey("dartdoc_main")) throw "Please specify dartdoc_main";
if (!args.containsKey("output_dir")) throw "Please specify output_dir";
+ if (!args.containsKey("package_root")) throw "Please specify package_root";
var scriptFile = new File(new File(options.script).fullPathSync());
var path = new Path(scriptFile.directory.path);
@@ -88,6 +96,6 @@
getSnapshotGenerationFile(options, args, rootPath).then((result) {
var wrapper = "${args['output_dir']}/utils_wrapper.dart";
writeSnapshotFile(wrapper, result);
- createSnapshot(options, wrapper);
+ createSnapshot(options, wrapper, args["package_root"]);
});
}