Version 0.7.1.0
svn merge -r 26775:27023 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@27025 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/analyzer_experimental/bin/formatter.dart b/pkg/analyzer_experimental/bin/formatter.dart
index 3fc928d..d80a0e2 100755
--- a/pkg/analyzer_experimental/bin/formatter.dart
+++ b/pkg/analyzer_experimental/bin/formatter.dart
@@ -4,46 +4,75 @@
// 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 'dart:convert';
import 'dart:io';
import 'package:args/args.dart';
+import 'package:path/path.dart' as path;
import 'package:analyzer_experimental/src/services/formatter_impl.dart';
const BINARY_NAME = 'dartfmt';
+final dartFileRegExp = new RegExp(r'^[^.].*\.dart$', caseSensitive: false);
final argParser = _initArgParser();
+bool overwriteFileContents;
+
void main() {
var options = argParser.parse(new Options().arguments);
if (options['help']) {
_printUsage();
return;
}
+ overwriteFileContents = options['write'];
+
if (options.rest.isEmpty) {
_formatStdin(options);
} else {
- _formatFiles(options.rest);
+ _formatPaths(options.rest);
}
}
-_formatFiles(files) {
- for (var file in files) {
- _formatFile(file);
+_formatPaths(paths) {
+ paths.forEach((path) {
+ if (FileSystemEntity.isDirectorySync(path)) {
+ _formatDirectory(new Directory(path));
+ } else {
+ _formatFile(new File(path));
+ }
+ });
+}
+
+_formatResource(resource) {
+ if (resource is Directory) {
+ _formatDirectory(resource);
+ } else if (resource is File) {
+ _formatFile(resource);
}
}
-_formatFile(path) {
- var buffer = new StringBuffer();
- var file = new File(path);
- file.openRead()
- .transform(UTF8.decoder)
- .listen((data) => buffer.write(data),
- onError: (error) => print('Error, could not open "$path"'),
- onDone: () => print(_formatCU(buffer.toString())));
+_formatDirectory(dir) =>
+ dir.listSync().forEach((resource) => _formatResource(resource));
+
+void _formatFile(file) {
+ if (_isDartFile(file)) {
+ try {
+ var buffer = new StringBuffer();
+ var rawSource = file.readAsStringSync();
+ var formatted = _formatCU(rawSource);
+ if (overwriteFileContents) {
+ file.writeAsStringSync(formatted);
+ } else {
+ print(formatted);
+ }
+ } catch (e) {
+ _log('Error formatting "${file.path}": $e');
+ }
+ }
}
+_isDartFile(file) => dartFileRegExp.hasMatch(path.basename(file.path));
+
_formatStdin(options) {
_log('not supported yet!');
// stdin.transform(new StringDecoder())
diff --git a/pkg/analyzer_experimental/example/parser_driver.dart b/pkg/analyzer_experimental/example/parser_driver.dart
index 8501552..e69c33b 100644
--- a/pkg/analyzer_experimental/example/parser_driver.dart
+++ b/pkg/analyzer_experimental/example/parser_driver.dart
@@ -6,7 +6,6 @@
import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:analyzer_experimental/src/generated/error.dart';
-import 'package:analyzer_experimental/src/generated/java_core.dart';
import 'package:analyzer_experimental/src/generated/parser.dart';
import 'package:analyzer_experimental/src/generated/scanner.dart';
diff --git a/pkg/analyzer_experimental/example/resolver_driver.dart b/pkg/analyzer_experimental/example/resolver_driver.dart
index 883816e..2207cf1 100644
--- a/pkg/analyzer_experimental/example/resolver_driver.dart
+++ b/pkg/analyzer_experimental/example/resolver_driver.dart
@@ -45,7 +45,7 @@
visitNode(ASTNode node) {
String text = '${node.runtimeType} : <"${node.toString()}">';
if (node is SimpleIdentifier) {
- Element element = (node as SimpleIdentifier).element;
+ Element element = (node as SimpleIdentifier).staticElement;
if (element != null) {
text += " element: ${element.runtimeType}";
LibraryElement library = element.library;
diff --git a/pkg/analyzer_experimental/example/scanner_driver.dart b/pkg/analyzer_experimental/example/scanner_driver.dart
index 0455cbe..346eb61 100644
--- a/pkg/analyzer_experimental/example/scanner_driver.dart
+++ b/pkg/analyzer_experimental/example/scanner_driver.dart
@@ -4,7 +4,6 @@
// 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:analyzer_experimental/src/generated/java_core.dart';
import 'package:analyzer_experimental/src/generated/scanner.dart';
import 'dart:io';
diff --git a/pkg/analyzer_experimental/lib/src/generated/ast.dart b/pkg/analyzer_experimental/lib/src/generated/ast.dart
index 8fc097e..f3e9d2e 100644
--- a/pkg/analyzer_experimental/lib/src/generated/ast.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/ast.dart
@@ -209,7 +209,7 @@
*
* @param visitor the visitor that will be used to visit the children of this node
*/
- void visitChildren(ASTVisitor<Object> visitor);
+ void visitChildren(ASTVisitor visitor);
/**
* Make this node the parent of the given child node.
@@ -231,7 +231,7 @@
* @param child the child to be visited
* @param visitor the visitor that will be used to visit the child
*/
- void safelyVisitChild(ASTNode child, ASTVisitor<Object> visitor) {
+ void safelyVisitChild(ASTNode child, ASTVisitor visitor) {
if (child != null) {
child.accept(visitor);
}
@@ -406,7 +406,7 @@
* @return the strings that are implicitly concatenated
*/
NodeList<StringLiteral> get strings => _strings;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_strings.accept(visitor);
}
void appendStringValue(JavaStringBuilder builder) {
@@ -504,7 +504,7 @@
this._metadata.clear();
this._metadata.addAll(metadata2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
if (commentIsBeforeAnnotations()) {
safelyVisitChild(_comment, visitor);
_metadata.accept(visitor);
@@ -674,7 +674,7 @@
return _element;
}
if (_name != null) {
- return _name.element;
+ return _name.staticElement;
}
return null;
}
@@ -757,7 +757,7 @@
void set period(Token period2) {
this._period = period2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_name, visitor);
safelyVisitChild(_constructorName, visitor);
safelyVisitChild(_arguments, visitor);
@@ -838,7 +838,7 @@
void set question(Token question2) {
this._question = question2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_identifier, visitor);
}
}
@@ -988,7 +988,7 @@
void set rightParenthesis(Token parenthesis) {
_rightParenthesis = parenthesis;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_arguments.accept(visitor);
}
@@ -1139,7 +1139,7 @@
void set type(TypeName name) {
this._type = becomeParentOf(name);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
safelyVisitChild(_type, visitor);
}
@@ -1291,7 +1291,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_condition, visitor);
}
}
@@ -1464,7 +1464,7 @@
void set staticElement(MethodElement element) {
_staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_leftHandSide, visitor);
safelyVisitChild(_rightHandSide, visitor);
}
@@ -1680,7 +1680,7 @@
void set staticElement(MethodElement element) {
_staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_leftOperand, visitor);
safelyVisitChild(_rightOperand, visitor);
}
@@ -1818,7 +1818,7 @@
void set rightBracket(Token rightBracket2) {
this._rightBracket = rightBracket2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_statements.accept(visitor);
}
}
@@ -1874,7 +1874,7 @@
void set block(Block block2) {
this._block = becomeParentOf(block2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_block, visitor);
}
}
@@ -1954,7 +1954,7 @@
void set value(bool value2) {
this._value = value2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -2056,7 +2056,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_label, visitor);
}
}
@@ -2137,7 +2137,7 @@
void set target(Expression target2) {
this._target = becomeParentOf(target2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_target, visitor);
_cascadeSections.accept(visitor);
}
@@ -2402,7 +2402,7 @@
void set stackTraceParameter(SimpleIdentifier parameter) {
_stackTraceParameter = becomeParentOf(parameter);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_exceptionType, visitor);
safelyVisitChild(_exceptionParameter, visitor);
safelyVisitChild(_stackTraceParameter, visitor);
@@ -2543,7 +2543,7 @@
* @return the token representing the 'class' keyword
*/
Token get classKeyword => _classKeyword;
- ClassElement get element => _name != null ? (_name.element as ClassElement) : null;
+ ClassElement get element => _name != null ? (_name.staticElement as ClassElement) : null;
Token get endToken => _rightBracket;
/**
@@ -2702,7 +2702,7 @@
void set withClause(WithClause withClause2) {
this._withClause = becomeParentOf(withClause2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_name, visitor);
safelyVisitChild(_typeParameters, visitor);
@@ -2845,7 +2845,7 @@
* @return the token for the 'abstract' keyword
*/
Token get abstractKeyword => _abstractKeyword;
- ClassElement get element => _name != null ? (_name.element as ClassElement) : null;
+ ClassElement get element => _name != null ? (_name.staticElement as ClassElement) : null;
/**
* Return the token for the '=' separating the name from the definition.
@@ -2952,7 +2952,7 @@
void set withClause(WithClause withClause2) {
this._withClause = becomeParentOf(withClause2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_name, visitor);
safelyVisitChild(_typeParameters, visitor);
@@ -3150,7 +3150,7 @@
* @return `true` if this is an end-of-line comment
*/
bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE);
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_references.accept(visitor);
}
}
@@ -3158,7 +3158,7 @@
* The enumeration `CommentType` encodes all the different types of comments that are
* recognized by the parser.
*/
-class CommentType implements Enum<CommentType> {
+class CommentType extends Enum<CommentType> {
/**
* An end-of-line comment.
@@ -3175,16 +3175,7 @@
*/
static final CommentType DOCUMENTATION = new CommentType('DOCUMENTATION', 2);
static final List<CommentType> values = [END_OF_LINE, BLOCK, DOCUMENTATION];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- CommentType(this.name, this.ordinal);
- int compareTo(CommentType other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ CommentType(String name, int ordinal) : super(name, ordinal);
}
/**
* Instances of the class `CommentReference` represent a reference to a Dart element that is
@@ -3262,7 +3253,7 @@
void set newKeyword(Token newKeyword2) {
this._newKeyword = newKeyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_identifier, visitor);
}
}
@@ -3500,7 +3491,7 @@
void set scriptTag(ScriptTag scriptTag2) {
this._scriptTag = becomeParentOf(scriptTag2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_scriptTag, visitor);
if (directivesAreBeforeDeclarations()) {
_directives.accept(visitor);
@@ -3730,7 +3721,7 @@
void set thenExpression(Expression expression) {
_thenExpression = becomeParentOf(expression);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_condition, visitor);
safelyVisitChild(_thenExpression, visitor);
safelyVisitChild(_elseExpression, visitor);
@@ -4077,7 +4068,7 @@
void set separator(Token separator2) {
this._separator = separator2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_returnType, visitor);
safelyVisitChild(_name, visitor);
@@ -4270,7 +4261,7 @@
void set period(Token period2) {
this._period = period2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_fieldName, visitor);
safelyVisitChild(_expression, visitor);
}
@@ -4449,7 +4440,7 @@
void set type(TypeName type2) {
this._type = becomeParentOf(type2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_type, visitor);
safelyVisitChild(_name, visitor);
}
@@ -4553,7 +4544,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_label, visitor);
}
}
@@ -4650,7 +4641,7 @@
if (identifier == null) {
return null;
}
- return identifier.element as LocalVariableElement;
+ return identifier.staticElement as LocalVariableElement;
}
Token get endToken => _identifier.endToken;
@@ -4710,7 +4701,7 @@
void set type(TypeName typeName) {
_type = becomeParentOf(typeName);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_type, visitor);
safelyVisitChild(_identifier, visitor);
@@ -4858,7 +4849,7 @@
void set separator(Token separator2) {
this._separator = separator2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_parameter, visitor);
safelyVisitChild(_defaultValue, visitor);
}
@@ -5123,7 +5114,7 @@
void set whileKeyword(Token whileKeyword2) {
this._whileKeyword = whileKeyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_body, visitor);
safelyVisitChild(_condition, visitor);
}
@@ -5207,7 +5198,7 @@
void set value(double value2) {
this._value = value2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -5263,7 +5254,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -5317,7 +5308,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -5374,7 +5365,7 @@
}
return null;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
combinators.accept(visitor);
}
@@ -5646,7 +5637,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
}
}
@@ -5733,7 +5724,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
}
}
@@ -5813,7 +5804,7 @@
void set superclass(TypeName name) {
_superclass = becomeParentOf(name);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_superclass, visitor);
}
}
@@ -5833,7 +5824,7 @@
/**
* The token representing the 'static' keyword, or `null` if the fields are not static.
*/
- Token _keyword;
+ Token _staticKeyword;
/**
* The fields being declared.
@@ -5850,12 +5841,12 @@
*
* @param comment the documentation comment associated with this field
* @param metadata the annotations associated with this field
- * @param keyword the token representing the 'static' keyword
+ * @param staticKeyword the token representing the 'static' keyword
* @param fieldList the fields being declared
* @param semicolon the semicolon terminating the declaration
*/
- FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token keyword, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, metadata) {
- this._keyword = keyword;
+ FieldDeclaration.full(Comment comment, List<Annotation> metadata, Token staticKeyword, VariableDeclarationList fieldList, Token semicolon) : super.full(comment, metadata) {
+ this._staticKeyword = staticKeyword;
this._fieldList = becomeParentOf(fieldList);
this._semicolon = semicolon;
}
@@ -5865,11 +5856,11 @@
*
* @param comment the documentation comment associated with this field
* @param metadata the annotations associated with this field
- * @param keyword the token representing the 'static' keyword
+ * @param staticKeyword the token representing the 'static' keyword
* @param fieldList the fields being declared
* @param semicolon the semicolon terminating the declaration
*/
- FieldDeclaration({Comment comment, List<Annotation> metadata, Token keyword, VariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadata, keyword, fieldList, semicolon);
+ FieldDeclaration({Comment comment, List<Annotation> metadata, Token staticKeyword, VariableDeclarationList fieldList, Token semicolon}) : this.full(comment, metadata, staticKeyword, fieldList, semicolon);
accept(ASTVisitor visitor) => visitor.visitFieldDeclaration(this);
Element get element => null;
Token get endToken => _semicolon;
@@ -5887,7 +5878,7 @@
*
* @return the token representing the 'static' keyword
*/
- Token get keyword => _keyword;
+ Token get staticKeyword => _staticKeyword;
/**
* Return the semicolon terminating the declaration.
@@ -5901,7 +5892,7 @@
*
* @return `true` if the fields are declared to be static
*/
- bool get isStatic => _keyword != null;
+ bool get isStatic => _staticKeyword != null;
/**
* Set the fields being declared to the given list of variables.
@@ -5917,8 +5908,8 @@
*
* @param keyword the token representing the 'static' keyword
*/
- void set keyword(Token keyword2) {
- this._keyword = keyword2;
+ void set staticKeyword(Token keyword) {
+ this._staticKeyword = keyword;
}
/**
@@ -5929,13 +5920,13 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_fieldList, visitor);
}
Token get firstTokenAfterCommentAndMetadata {
- if (_keyword != null) {
- return _keyword;
+ if (_staticKeyword != null) {
+ return _staticKeyword;
}
return _fieldList.beginToken;
}
@@ -6111,7 +6102,7 @@
void set type(TypeName typeName) {
_type = becomeParentOf(typeName);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_type, visitor);
safelyVisitChild(identifier, visitor);
@@ -6311,7 +6302,7 @@
void set rightParenthesis(Token rightParenthesis2) {
this._rightParenthesis = rightParenthesis2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_loopVariable, visitor);
safelyVisitChild(_iterator, visitor);
safelyVisitChild(_body, visitor);
@@ -6589,7 +6580,7 @@
void set variables(VariableDeclarationList variableList) {
variableList = becomeParentOf(variableList);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_variableList, visitor);
safelyVisitChild(_initialization, visitor);
safelyVisitChild(_condition, visitor);
@@ -6623,7 +6614,7 @@
if (identifier == null) {
return null;
}
- return identifier.element as ParameterElement;
+ return identifier.staticElement as ParameterElement;
}
/**
@@ -6839,7 +6830,7 @@
void set rightParenthesis(Token parenthesis) {
_rightParenthesis = parenthesis;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_parameters.accept(visitor);
}
}
@@ -6933,7 +6924,7 @@
*/
FunctionDeclaration({Comment comment, List<Annotation> metadata, Token externalKeyword, TypeName returnType, Token propertyKeyword, SimpleIdentifier name, FunctionExpression functionExpression}) : this.full(comment, metadata, externalKeyword, returnType, propertyKeyword, name, functionExpression);
accept(ASTVisitor visitor) => visitor.visitFunctionDeclaration(this);
- ExecutableElement get element => _name != null ? (_name.element as ExecutableElement) : null;
+ ExecutableElement get element => _name != null ? (_name.staticElement as ExecutableElement) : null;
Token get endToken => _functionExpression.endToken;
/**
@@ -7031,7 +7022,7 @@
void set returnType(TypeName name) {
_returnType = becomeParentOf(name);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_returnType, visitor);
safelyVisitChild(_name, visitor);
@@ -7098,7 +7089,7 @@
void set functionExpression(FunctionDeclaration functionDeclaration2) {
this._functionDeclaration = becomeParentOf(functionDeclaration2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_functionDeclaration, visitor);
}
}
@@ -7214,7 +7205,7 @@
void set parameters(FormalParameterList parameters2) {
this._parameters = becomeParentOf(parameters2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_parameters, visitor);
safelyVisitChild(_body, visitor);
}
@@ -7366,7 +7357,7 @@
void set staticElement(ExecutableElement element) {
this._staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_function, visitor);
safelyVisitChild(_argumentList, visitor);
}
@@ -7441,7 +7432,7 @@
*/
FunctionTypeAlias({Comment comment, List<Annotation> metadata, Token keyword, TypeName returnType, SimpleIdentifier name, TypeParameterList typeParameters, FormalParameterList parameters, Token semicolon}) : this.full(comment, metadata, keyword, returnType, name, typeParameters, parameters, semicolon);
accept(ASTVisitor visitor) => visitor.visitFunctionTypeAlias(this);
- FunctionTypeAliasElement get element => _name != null ? (_name.element as FunctionTypeAliasElement) : null;
+ FunctionTypeAliasElement get element => _name != null ? (_name.staticElement as FunctionTypeAliasElement) : null;
/**
* Return the name of the function type being declared.
@@ -7508,7 +7499,7 @@
void set typeParameters(TypeParameterList typeParameters2) {
this._typeParameters = becomeParentOf(typeParameters2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_returnType, visitor);
safelyVisitChild(_name, visitor);
@@ -7608,7 +7599,7 @@
void set returnType(TypeName returnType2) {
this._returnType = becomeParentOf(returnType2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_returnType, visitor);
safelyVisitChild(identifier, visitor);
@@ -7660,7 +7651,7 @@
* @return the list of names from the library that are hidden by this combinator
*/
NodeList<SimpleIdentifier> get hiddenNames => _hiddenNames;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_hiddenNames.accept(visitor);
}
}
@@ -7688,14 +7679,14 @@
static bool isPrivateName(String name) => name.startsWith("_");
/**
- * Return the element associated with this identifier based on propagated type information, or
- * `null` if the AST structure has not been resolved or if this identifier could not be
- * resolved. One example of the latter case is an identifier that is not defined within the scope
- * in which it appears.
+ * Return the best element available for this operator. If resolution was able to find a better
+ * element based on type propagation, that element will be returned. Otherwise, the element found
+ * using the result of static analysis will be returned. If resolution has not been performed,
+ * then `null` will be returned.
*
- * @return the element associated with this identifier
+ * @return the best element available for this operator
*/
- Element get element;
+ Element get bestElement;
/**
* Return the lexical representation of the identifier.
@@ -7705,6 +7696,16 @@
String get name;
/**
+ * Return the element associated with this identifier based on propagated type information, or
+ * `null` if the AST structure has not been resolved or if this identifier could not be
+ * resolved. One example of the latter case is an identifier that is not defined within the scope
+ * in which it appears.
+ *
+ * @return the element associated with this identifier
+ */
+ Element get propagatedElement;
+
+ /**
* Return the element associated with this identifier based on static type information, or
* `null` if the AST structure has not been resolved or if this identifier could not be
* resolved. One example of the latter case is an identifier that is not defined within the scope
@@ -7921,7 +7922,7 @@
void set thenStatement(Statement statement) {
_thenStatement = becomeParentOf(statement);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_condition, visitor);
safelyVisitChild(_thenStatement, visitor);
safelyVisitChild(_elseStatement, visitor);
@@ -7995,7 +7996,7 @@
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_interfaces.accept(visitor);
}
}
@@ -8094,7 +8095,7 @@
void set prefix(SimpleIdentifier prefix2) {
this._prefix = becomeParentOf(prefix2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_prefix, visitor);
combinators.accept(visitor);
@@ -8154,6 +8155,13 @@
MethodElement _propagatedElement;
/**
+ * If this expression is both in a getter and setter context, the [AuxiliaryElements] will
+ * be set to hold onto the static and propagated information. The auxiliary element will hold onto
+ * the elements from the getter context.
+ */
+ AuxiliaryElements _auxiliaryElements = null;
+
+ /**
* Initialize a newly created index expression.
*
* @param target the expression used to compute the object being indexed
@@ -8203,6 +8211,12 @@
*/
IndexExpression.forCascade({Token period, Token leftBracket, Expression index, Token rightBracket}) : this.forCascade_full(period, leftBracket, index, rightBracket);
accept(ASTVisitor visitor) => visitor.visitIndexExpression(this);
+
+ /**
+ * Get the auxiliary elements, this will be `null` if the node is not in a getter and setter
+ * context, or if it is not yet fully resolved.
+ */
+ AuxiliaryElements get auxiliaryElements => _auxiliaryElements;
Token get beginToken {
if (_target != null) {
return _target.beginToken;
@@ -8361,6 +8375,13 @@
bool get isCascaded => _period != null;
/**
+ * Set the auxiliary elements.
+ */
+ void set auxiliaryElements(AuxiliaryElements auxiliaryElements2) {
+ this._auxiliaryElements = auxiliaryElements2;
+ }
+
+ /**
* Set the expression used to compute the index to the given expression.
*
* @param expression the expression used to compute the index
@@ -8424,7 +8445,7 @@
void set target(Expression expression) {
_target = becomeParentOf(expression);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_target, visitor);
safelyVisitChild(_index, visitor);
}
@@ -8629,7 +8650,7 @@
void set staticElement(ConstructorElement element) {
this._staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_constructorName, visitor);
safelyVisitChild(_argumentList, visitor);
}
@@ -8717,7 +8738,7 @@
void set value(int value2) {
this._value = value2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -8842,7 +8863,7 @@
void set rightBracket(Token rightBracket2) {
this._rightBracket = rightBracket2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
}
}
@@ -8922,7 +8943,7 @@
void set value(String string) {
_value = string;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -9049,7 +9070,7 @@
void set type(TypeName name) {
this._type = becomeParentOf(name);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
safelyVisitChild(_type, visitor);
}
@@ -9129,7 +9150,7 @@
void set label(SimpleIdentifier label2) {
this._label = becomeParentOf(label2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_label, visitor);
}
}
@@ -9206,7 +9227,7 @@
void set statement(Statement statement2) {
this._statement = becomeParentOf(statement2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_labels.accept(visitor);
safelyVisitChild(_statement, visitor);
}
@@ -9314,7 +9335,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_name, visitor);
}
@@ -9355,6 +9376,7 @@
LibraryIdentifier({List<SimpleIdentifier> components}) : this.full(components);
accept(ASTVisitor visitor) => visitor.visitLibraryIdentifier(this);
Token get beginToken => _components.beginToken;
+ Element get bestElement => staticElement;
/**
* Return the components of the identifier.
@@ -9362,7 +9384,6 @@
* @return the components of the identifier
*/
NodeList<SimpleIdentifier> get components => _components;
- Element get element => null;
Token get endToken => _components.endToken;
String get name {
JavaStringBuilder builder = new JavaStringBuilder();
@@ -9377,8 +9398,9 @@
}
return builder.toString();
}
+ Element get propagatedElement => null;
Element get staticElement => null;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_components.accept(visitor);
}
}
@@ -9412,14 +9434,14 @@
/**
* Initialize a newly created list literal.
*
- * @param modifier the const modifier associated with this literal
+ * @param constKeyword the token representing the 'const' keyword
* @param typeArguments the type argument associated with this literal, or `null` if no type
* arguments were declared
* @param leftBracket the left square bracket
* @param elements the expressions used to compute the elements of the list
* @param rightBracket the right square bracket
*/
- ListLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBracket, List<Expression> elements, Token rightBracket) : super.full(modifier, typeArguments) {
+ ListLiteral.full(Token constKeyword, TypeArgumentList typeArguments, Token leftBracket, List<Expression> elements, Token rightBracket) : super.full(constKeyword, typeArguments) {
this._elements = new NodeList<Expression>(this);
this._leftBracket = leftBracket;
this._elements.addAll(elements);
@@ -9429,17 +9451,17 @@
/**
* Initialize a newly created list literal.
*
- * @param modifier the const modifier associated with this literal
+ * @param constKeyword the token representing the 'const' keyword
* @param typeArguments the type argument associated with this literal, or `null` if no type
* arguments were declared
* @param leftBracket the left square bracket
* @param elements the expressions used to compute the elements of the list
* @param rightBracket the right square bracket
*/
- ListLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket, List<Expression> elements, Token rightBracket}) : this.full(modifier, typeArguments, leftBracket, elements, rightBracket);
+ ListLiteral({Token constKeyword, TypeArgumentList typeArguments, Token leftBracket, List<Expression> elements, Token rightBracket}) : this.full(constKeyword, typeArguments, leftBracket, elements, rightBracket);
accept(ASTVisitor visitor) => visitor.visitListLiteral(this);
Token get beginToken {
- Token token = modifier;
+ Token token = constKeyword;
if (token != null) {
return token;
}
@@ -9489,7 +9511,7 @@
void set rightBracket(Token bracket) {
_rightBracket = bracket;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
_elements.accept(visitor);
}
@@ -9543,14 +9565,14 @@
/**
* Initialize a newly created map literal.
*
- * @param modifier the const modifier associated with this literal
+ * @param constKeyword the token representing the 'const' keyword
* @param typeArguments the type argument associated with this literal, or `null` if no type
* arguments were declared
* @param leftBracket the left curly bracket
* @param entries the entries in the map
* @param rightBracket the right curly bracket
*/
- MapLiteral.full(Token modifier, TypeArgumentList typeArguments, Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(modifier, typeArguments) {
+ MapLiteral.full(Token constKeyword, TypeArgumentList typeArguments, Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket) : super.full(constKeyword, typeArguments) {
this._entries = new NodeList<MapLiteralEntry>(this);
this._leftBracket = leftBracket;
this._entries.addAll(entries);
@@ -9560,17 +9582,17 @@
/**
* Initialize a newly created map literal.
*
- * @param modifier the const modifier associated with this literal
+ * @param constKeyword the token representing the 'const' keyword
* @param typeArguments the type argument associated with this literal, or `null` if no type
* arguments were declared
* @param leftBracket the left curly bracket
* @param entries the entries in the map
* @param rightBracket the right curly bracket
*/
- MapLiteral({Token modifier, TypeArgumentList typeArguments, Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket}) : this.full(modifier, typeArguments, leftBracket, entries, rightBracket);
+ MapLiteral({Token constKeyword, TypeArgumentList typeArguments, Token leftBracket, List<MapLiteralEntry> entries, Token rightBracket}) : this.full(constKeyword, typeArguments, leftBracket, entries, rightBracket);
accept(ASTVisitor visitor) => visitor.visitMapLiteral(this);
Token get beginToken {
- Token token = modifier;
+ Token token = constKeyword;
if (token != null) {
return token;
}
@@ -9620,7 +9642,7 @@
void set rightBracket(Token bracket) {
_rightBracket = bracket;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
_entries.accept(visitor);
}
@@ -9727,7 +9749,7 @@
void set value(Expression expression) {
_value = becomeParentOf(expression);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_key, visitor);
safelyVisitChild(_value, visitor);
}
@@ -9854,7 +9876,7 @@
*
* @return the element associated with this method
*/
- ExecutableElement get element => _name != null ? (_name.element as ExecutableElement) : null;
+ ExecutableElement get element => _name != null ? (_name.staticElement as ExecutableElement) : null;
Token get endToken => _body.endToken;
/**
@@ -10017,7 +10039,7 @@
void set returnType(TypeName typeName) {
_returnType = becomeParentOf(typeName);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_returnType, visitor);
safelyVisitChild(_name, visitor);
@@ -10209,7 +10231,7 @@
void set target(Expression expression) {
_target = becomeParentOf(expression);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_target, visitor);
safelyVisitChild(_methodName, visitor);
safelyVisitChild(_argumentList, visitor);
@@ -10267,7 +10289,7 @@
* @return the element representing the parameter being named by this expression
*/
ParameterElement get element {
- Element element = _name.label.element;
+ Element element = _name.label.staticElement;
if (element is ParameterElement) {
return element as ParameterElement;
}
@@ -10306,7 +10328,7 @@
void set name(Label identifier) {
_name = becomeParentOf(identifier);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_name, visitor);
safelyVisitChild(_expression, visitor);
}
@@ -10481,7 +10503,7 @@
void set name(StringLiteral name2) {
this._name = name2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_name, visitor);
}
}
@@ -10560,7 +10582,7 @@
* @return the string literal representing the string after the 'native' token
*/
StringLiteral get stringLiteral => _stringLiteral;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_stringLiteral, visitor);
}
}
@@ -10658,7 +10680,7 @@
void set identifier(SimpleIdentifier identifier2) {
this._identifier = becomeParentOf(identifier2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
if (commentIsBeforeAnnotations()) {
safelyVisitChild(_comment, visitor);
_metadata.accept(visitor);
@@ -10749,7 +10771,7 @@
void set literal(Token literal2) {
this._literal = literal2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -10851,7 +10873,7 @@
void set rightParenthesis(Token parenthesis) {
_rightParenthesis = parenthesis;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
}
}
@@ -11066,7 +11088,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_libraryName, visitor);
}
@@ -11217,7 +11239,7 @@
void set staticElement(MethodElement element) {
_staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_operand, visitor);
}
@@ -11408,7 +11430,7 @@
void set staticElement(MethodElement element) {
_staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_operand, visitor);
}
@@ -11506,11 +11528,11 @@
PrefixedIdentifier({SimpleIdentifier prefix, Token period, SimpleIdentifier identifier}) : this.full(prefix, period, identifier);
accept(ASTVisitor visitor) => visitor.visitPrefixedIdentifier(this);
Token get beginToken => _prefix.beginToken;
- Element get element {
+ Element get bestElement {
if (_identifier == null) {
return null;
}
- return _identifier.element;
+ return _identifier.bestElement;
}
Token get endToken => _identifier.endToken;
@@ -11535,6 +11557,12 @@
* @return the prefix associated with the library in which the identifier is defined
*/
SimpleIdentifier get prefix => _prefix;
+ Element get propagatedElement {
+ if (_identifier == null) {
+ return null;
+ }
+ return _identifier.propagatedElement;
+ }
Element get staticElement {
if (_identifier == null) {
return null;
@@ -11569,7 +11597,7 @@
void set prefix(SimpleIdentifier identifier) {
_prefix = becomeParentOf(identifier);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_prefix, visitor);
safelyVisitChild(_identifier, visitor);
}
@@ -11718,7 +11746,7 @@
void set target(Expression expression) {
_target = becomeParentOf(expression);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_target, visitor);
safelyVisitChild(_propertyName, visitor);
}
@@ -11905,7 +11933,7 @@
void set staticElement(ConstructorElement element) {
this._staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_constructorName, visitor);
safelyVisitChild(_argumentList, visitor);
}
@@ -11961,7 +11989,7 @@
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -12065,7 +12093,7 @@
void set semicolon(Token semicolon2) {
this._semicolon = semicolon2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
}
}
@@ -12121,7 +12149,7 @@
void set scriptTag(Token scriptTag2) {
this._scriptTag = scriptTag2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -12169,7 +12197,7 @@
* @return the list of names from the library that are made visible by this combinator
*/
NodeList<SimpleIdentifier> get shownNames => _shownNames;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_shownNames.accept(visitor);
}
}
@@ -12266,7 +12294,7 @@
void set type(TypeName typeName) {
_type = becomeParentOf(typeName);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_type, visitor);
safelyVisitChild(identifier, visitor);
@@ -12307,6 +12335,13 @@
Element _propagatedElement;
/**
+ * If this expression is both in a getter and setter context, the [AuxiliaryElements] will
+ * be set to hold onto the static and propagated information. The auxiliary element will hold onto
+ * the elements from the getter context.
+ */
+ AuxiliaryElements _auxiliaryElements = null;
+
+ /**
* Initialize a newly created identifier.
*
* @param token the token representing the identifier
@@ -12322,10 +12357,22 @@
*/
SimpleIdentifier({Token token}) : this.full(token);
accept(ASTVisitor visitor) => visitor.visitSimpleIdentifier(this);
+
+ /**
+ * Get the auxiliary elements, this will be `null` if the node is not in a getter and setter
+ * context, or if it is not yet fully resolved.
+ */
+ AuxiliaryElements get auxiliaryElements => _auxiliaryElements;
Token get beginToken => _token;
- Element get element => _propagatedElement;
+ Element get bestElement {
+ if (_propagatedElement == null) {
+ return _staticElement;
+ }
+ return _propagatedElement;
+ }
Token get endToken => _token;
String get name => _token.lexeme;
+ Element get propagatedElement => _propagatedElement;
Element get staticElement => _staticElement;
/**
@@ -12449,13 +12496,20 @@
bool get isSynthetic => _token.isSynthetic;
/**
+ * Set the auxiliary elements.
+ */
+ void set auxiliaryElements(AuxiliaryElements auxiliaryElements2) {
+ this._auxiliaryElements = auxiliaryElements2;
+ }
+
+ /**
* Set the element associated with this identifier based on propagated type information to the
* given element.
*
* @param element the element to be associated with this identifier
*/
- void set element(Element element2) {
- _propagatedElement = element2;
+ void set propagatedElement(Element element) {
+ _propagatedElement = validateElement2(element);
}
/**
@@ -12465,7 +12519,7 @@
* @param element the element to be associated with this identifier
*/
void set staticElement(Element element) {
- _staticElement = element;
+ _staticElement = validateElement2(element);
}
/**
@@ -12476,7 +12530,56 @@
void set token(Token token2) {
this._token = token2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
+ }
+
+ /**
+ * Return the given element if it is an appropriate element based on the parent of this
+ * identifier, or `null` if it is not appropriate.
+ *
+ * @param element the element to be associated with this identifier
+ * @return the element to be associated with this identifier
+ */
+ Element validateElement(ASTNode parent, Type expectedClass, Element element) {
+ if (!isInstanceOf(element, expectedClass)) {
+ AnalysisEngine.instance.logger.logInformation2("Internal error: attempting to set the name of a ${parent.runtimeType.toString()} to a ${element.runtimeType.toString()}", new JavaException());
+ return null;
+ }
+ return element;
+ }
+
+ /**
+ * Return the given element if it is an appropriate element based on the parent of this
+ * identifier, or `null` if it is not appropriate.
+ *
+ * @param element the element to be associated with this identifier
+ * @return the element to be associated with this identifier
+ */
+ Element validateElement2(Element element) {
+ if (element == null) {
+ return null;
+ }
+ ASTNode parent = this.parent;
+ if (parent is ClassDeclaration && identical(((parent as ClassDeclaration)).name, this)) {
+ return validateElement(parent, ClassElement, element);
+ } else if (parent is ClassTypeAlias && identical(((parent as ClassTypeAlias)).name, this)) {
+ return validateElement(parent, ClassElement, element);
+ } else if (parent is DeclaredIdentifier && identical(((parent as DeclaredIdentifier)).identifier, this)) {
+ return validateElement(parent, LocalVariableElement, element);
+ } else if (parent is FormalParameter && identical(((parent as FormalParameter)).identifier, this)) {
+ return validateElement(parent, ParameterElement, element);
+ } else if (parent is FunctionDeclaration && identical(((parent as FunctionDeclaration)).name, this)) {
+ return validateElement(parent, ExecutableElement, element);
+ } else if (parent is FunctionTypeAlias && identical(((parent as FunctionTypeAlias)).name, this)) {
+ return validateElement(parent, FunctionTypeAliasElement, element);
+ } else if (parent is MethodDeclaration && identical(((parent as MethodDeclaration)).name, this)) {
+ return validateElement(parent, ExecutableElement, element);
+ } else if (parent is TypeParameter && identical(((parent as TypeParameter)).name, this)) {
+ return validateElement(parent, TypeVariableElement, element);
+ } else if (parent is VariableDeclaration && identical(((parent as VariableDeclaration)).name, this)) {
+ return validateElement(parent, VariableElement, element);
+ }
+ return element;
}
}
/**
@@ -12591,7 +12694,7 @@
void set value(String string) {
_value = StringUtilities.intern(_value);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
void appendStringValue(JavaStringBuilder builder) {
builder.append(value);
@@ -12667,7 +12770,7 @@
*/
NodeList<InterpolationElement> get elements => _elements;
Token get endToken => _elements.endToken;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_elements.accept(visitor);
}
void appendStringValue(JavaStringBuilder builder) {
@@ -12894,7 +12997,7 @@
void set staticElement(ConstructorElement element) {
this._staticElement = element;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_constructorName, visitor);
safelyVisitChild(_argumentList, visitor);
}
@@ -12950,7 +13053,7 @@
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -13010,7 +13113,7 @@
void set expression(Expression expression2) {
this._expression = becomeParentOf(expression2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
labels.accept(visitor);
safelyVisitChild(_expression, visitor);
statements.accept(visitor);
@@ -13048,7 +13151,7 @@
*/
SwitchDefault({List<Label> labels, Token keyword, Token colon, List<Statement> statements}) : this.full(labels, keyword, colon, statements);
accept(ASTVisitor visitor) => visitor.visitSwitchDefault(this);
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
labels.accept(visitor);
statements.accept(visitor);
}
@@ -13360,7 +13463,7 @@
void set rightParenthesis(Token rightParenthesis2) {
this._rightParenthesis = rightParenthesis2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
_members.accept(visitor);
}
@@ -13431,7 +13534,7 @@
void set poundSign(Token poundSign2) {
this._poundSign = poundSign2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -13485,7 +13588,7 @@
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -13568,7 +13671,7 @@
void set keyword(Token keyword2) {
this._keyword = keyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_expression, visitor);
}
}
@@ -13653,7 +13756,7 @@
void set variables(VariableDeclarationList variableList) {
variableList = becomeParentOf(variableList);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_variableList, visitor);
}
@@ -13696,10 +13799,10 @@
Token _finallyKeyword;
/**
- * The finally clause contained in the try statement, or `null` if the statement does not
+ * The finally block contained in the try statement, or `null` if the statement does not
* contain a finally clause.
*/
- Block _finallyClause;
+ Block _finallyBlock;
/**
* Initialize a newly created try statement.
@@ -13708,15 +13811,15 @@
* @param body the body of the statement
* @param catchClauses the catch clauses contained in the try statement
* @param finallyKeyword the token representing the 'finally' keyword
- * @param finallyClause the finally clause contained in the try statement
+ * @param finallyBlock the finally block contained in the try statement
*/
- TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses, Token finallyKeyword, Block finallyClause) {
+ TryStatement.full(Token tryKeyword, Block body, List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock) {
this._catchClauses = new NodeList<CatchClause>(this);
this._tryKeyword = tryKeyword;
this._body = becomeParentOf(body);
this._catchClauses.addAll(catchClauses);
this._finallyKeyword = finallyKeyword;
- this._finallyClause = becomeParentOf(finallyClause);
+ this._finallyBlock = becomeParentOf(finallyBlock);
}
/**
@@ -13726,9 +13829,9 @@
* @param body the body of the statement
* @param catchClauses the catch clauses contained in the try statement
* @param finallyKeyword the token representing the 'finally' keyword
- * @param finallyClause the finally clause contained in the try statement
+ * @param finallyBlock the finally block contained in the try statement
*/
- TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, Token finallyKeyword, Block finallyClause}) : this.full(tryKeyword, body, catchClauses, finallyKeyword, finallyClause);
+ TryStatement({Token tryKeyword, Block body, List<CatchClause> catchClauses, Token finallyKeyword, Block finallyBlock}) : this.full(tryKeyword, body, catchClauses, finallyKeyword, finallyBlock);
accept(ASTVisitor visitor) => visitor.visitTryStatement(this);
Token get beginToken => _tryKeyword;
@@ -13746,8 +13849,8 @@
*/
NodeList<CatchClause> get catchClauses => _catchClauses;
Token get endToken {
- if (_finallyClause != null) {
- return _finallyClause.endToken;
+ if (_finallyBlock != null) {
+ return _finallyBlock.endToken;
} else if (_finallyKeyword != null) {
return _finallyKeyword;
} else if (!_catchClauses.isEmpty) {
@@ -13757,12 +13860,12 @@
}
/**
- * Return the finally clause contained in the try statement, or `null` if the statement does
+ * Return the finally block contained in the try statement, or `null` if the statement does
* not contain a finally clause.
*
- * @return the finally clause contained in the try statement
+ * @return the finally block contained in the try statement
*/
- Block get finallyClause => _finallyClause;
+ Block get finallyBlock => _finallyBlock;
/**
* Return the token representing the 'finally' keyword, or `null` if the statement does not
@@ -13789,12 +13892,12 @@
}
/**
- * Set the finally clause contained in the try statement to the given block.
+ * Set the finally block contained in the try statement to the given block.
*
- * @param block the finally clause contained in the try statement
+ * @param block the finally block contained in the try statement
*/
- void set finallyClause(Block block) {
- _finallyClause = becomeParentOf(block);
+ void set finallyBlock(Block block) {
+ _finallyBlock = becomeParentOf(block);
}
/**
@@ -13814,10 +13917,10 @@
void set tryKeyword(Token tryKeyword2) {
this._tryKeyword = tryKeyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_body, visitor);
_catchClauses.accept(visitor);
- safelyVisitChild(_finallyClause, visitor);
+ safelyVisitChild(_finallyBlock, visitor);
}
}
/**
@@ -13994,7 +14097,7 @@
void set rightBracket(Token rightBracket2) {
this._rightBracket = rightBracket2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_arguments.accept(visitor);
}
}
@@ -14104,7 +14207,7 @@
void set typeArguments(TypeArgumentList typeArguments2) {
this._typeArguments = becomeParentOf(typeArguments2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_name, visitor);
safelyVisitChild(_typeArguments, visitor);
}
@@ -14172,7 +14275,7 @@
* @return the name of the upper bound for legal arguments
*/
TypeName get bound => _bound;
- TypeVariableElement get element => _name != null ? (_name.element as TypeVariableElement) : null;
+ TypeVariableElement get element => _name != null ? (_name.staticElement as TypeVariableElement) : null;
Token get endToken {
if (_bound == null) {
return _name.endToken;
@@ -14221,7 +14324,7 @@
void set name(SimpleIdentifier identifier) {
_name = becomeParentOf(identifier);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_name, visitor);
safelyVisitChild(_bound, visitor);
@@ -14301,7 +14404,7 @@
* @return the type parameters for the type
*/
NodeList<TypeParameter> get typeParameters => _typeParameters;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_typeParameters.accept(visitor);
}
}
@@ -14320,10 +14423,9 @@
abstract class TypedLiteral extends Literal {
/**
- * The const modifier associated with this literal, or `null` if the literal is not a
- * constant.
+ * The token representing the 'const' keyword, or `null` if the literal is not a constant.
*/
- Token _modifier;
+ Token _constKeyword;
/**
* The type argument associated with this literal, or `null` if no type arguments were
@@ -14334,30 +14436,30 @@
/**
* Initialize a newly created typed literal.
*
- * @param modifier the const modifier associated with this literal
+ * @param constKeyword the token representing the 'const' keyword
* @param typeArguments the type argument associated with this literal, or `null` if no type
* arguments were declared
*/
- TypedLiteral.full(Token modifier, TypeArgumentList typeArguments) {
- this._modifier = modifier;
+ TypedLiteral.full(Token constKeyword, TypeArgumentList typeArguments) {
+ this._constKeyword = constKeyword;
this._typeArguments = becomeParentOf(typeArguments);
}
/**
* Initialize a newly created typed literal.
*
- * @param modifier the const modifier associated with this literal
+ * @param constKeyword the token representing the 'const' keyword
* @param typeArguments the type argument associated with this literal, or `null` if no type
* arguments were declared
*/
- TypedLiteral({Token modifier, TypeArgumentList typeArguments}) : this.full(modifier, typeArguments);
+ TypedLiteral({Token constKeyword, TypeArgumentList typeArguments}) : this.full(constKeyword, typeArguments);
/**
- * Return the const modifier associated with this literal.
+ * Return the token representing the 'const' keyword.
*
- * @return the const modifier associated with this literal
+ * @return the token representing the 'const' keyword
*/
- Token get modifier => _modifier;
+ Token get constKeyword => _constKeyword;
/**
* Return the type argument associated with this literal, or `null` if no type arguments
@@ -14368,12 +14470,12 @@
TypeArgumentList get typeArguments => _typeArguments;
/**
- * Set the modifiers associated with this literal to the given modifiers.
+ * Set the token representing the 'const' keyword to the given keyword.
*
- * @param modifiers the modifiers associated with this literal
+ * @param keyword the token representing the 'const' keyword
*/
- void set modifier(Token modifier2) {
- this._modifier = modifier2;
+ void set constKeyword(Token keyword) {
+ this._constKeyword = keyword;
}
/**
@@ -14384,7 +14486,7 @@
void set typeArguments(TypeArgumentList typeArguments2) {
this._typeArguments = typeArguments2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_typeArguments, visitor);
}
}
@@ -14452,7 +14554,7 @@
void set uri(StringLiteral uri2) {
this._uri = becomeParentOf(uri2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_uri, visitor);
}
@@ -14531,7 +14633,7 @@
}
return comment;
}
- VariableElement get element => _name != null ? (_name.element as VariableElement) : null;
+ VariableElement get element => _name != null ? (_name.staticElement as VariableElement) : null;
Token get endToken {
if (_initializer != null) {
return _initializer.endToken;
@@ -14610,7 +14712,7 @@
void set name(SimpleIdentifier name2) {
this._name = becomeParentOf(name2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_name, visitor);
safelyVisitChild(_initializer, visitor);
@@ -14736,7 +14838,7 @@
void set type(TypeName typeName) {
_type = becomeParentOf(typeName);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_type, visitor);
_variables.accept(visitor);
}
@@ -14825,7 +14927,7 @@
void set variables(VariableDeclarationList variableList2) {
this._variableList = becomeParentOf(variableList2);
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_variableList, visitor);
}
}
@@ -14977,7 +15079,7 @@
void set rightParenthesis(Token rightParenthesis2) {
this._rightParenthesis = rightParenthesis2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
safelyVisitChild(_condition, visitor);
safelyVisitChild(_body, visitor);
}
@@ -15049,7 +15151,7 @@
void set mixinKeyword(Token withKeyword2) {
this._withKeyword = withKeyword2;
}
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
_mixinTypes.accept(visitor);
}
}
@@ -15213,7 +15315,7 @@
}
} else if (node.operator.type == TokenType.EQ_EQ) {
if (leftOperand is bool && rightOperand is bool) {
- return identical(((leftOperand as bool)), ((rightOperand as bool)));
+ return identical(leftOperand as bool, rightOperand as bool);
} else if (leftOperand is int && rightOperand is int) {
return ((leftOperand as int)) == rightOperand;
} else if (leftOperand is double && rightOperand is double) {
@@ -15223,15 +15325,15 @@
}
} else if (node.operator.type == TokenType.GT) {
if (leftOperand is int && rightOperand is int) {
- return ((leftOperand as int)).compareTo((rightOperand as int)) > 0;
+ return ((leftOperand as int)).compareTo(rightOperand as int) > 0;
} else if (leftOperand is double && rightOperand is double) {
- return ((leftOperand as double)).compareTo((rightOperand as double)) > 0;
+ return ((leftOperand as double)).compareTo(rightOperand as double) > 0;
}
} else if (node.operator.type == TokenType.GT_EQ) {
if (leftOperand is int && rightOperand is int) {
- return ((leftOperand as int)).compareTo((rightOperand as int)) >= 0;
+ return ((leftOperand as int)).compareTo(rightOperand as int) >= 0;
} else if (leftOperand is double && rightOperand is double) {
- return ((leftOperand as double)).compareTo((rightOperand as double)) >= 0;
+ return ((leftOperand as double)).compareTo(rightOperand as double) >= 0;
}
} else if (node.operator.type == TokenType.GT_GT) {
if (leftOperand is int && rightOperand is int) {
@@ -15239,15 +15341,15 @@
}
} else if (node.operator.type == TokenType.LT) {
if (leftOperand is int && rightOperand is int) {
- return ((leftOperand as int)).compareTo((rightOperand as int)) < 0;
+ return ((leftOperand as int)).compareTo(rightOperand as int) < 0;
} else if (leftOperand is double && rightOperand is double) {
- return ((leftOperand as double)).compareTo((rightOperand as double)) < 0;
+ return ((leftOperand as double)).compareTo(rightOperand as double) < 0;
}
} else if (node.operator.type == TokenType.LT_EQ) {
if (leftOperand is int && rightOperand is int) {
- return ((leftOperand as int)).compareTo((rightOperand as int)) <= 0;
+ return ((leftOperand as int)).compareTo(rightOperand as int) <= 0;
} else if (leftOperand is double && rightOperand is double) {
- return ((leftOperand as double)).compareTo((rightOperand as double)) <= 0;
+ return ((leftOperand as double)).compareTo(rightOperand as double) <= 0;
}
} else if (node.operator.type == TokenType.LT_LT) {
if (leftOperand is int && rightOperand is int) {
@@ -15261,7 +15363,7 @@
}
} else if (node.operator.type == TokenType.PERCENT) {
if (leftOperand is int && rightOperand is int) {
- return ((leftOperand as int)).remainder((rightOperand as int));
+ return ((leftOperand as int)).remainder(rightOperand as int);
} else if (leftOperand is double && rightOperand is double) {
return ((leftOperand as double)) % ((rightOperand as double));
}
@@ -15447,9 +15549,9 @@
if (identical(returnType, node)) {
SimpleIdentifier name = decl.name;
if (name != null) {
- return name.element;
+ return name.bestElement;
}
- Element element = node.element;
+ Element element = node.bestElement;
if (element is ClassElement) {
return ((element as ClassElement)).unnamedConstructor;
}
@@ -15464,7 +15566,7 @@
}
}
}
- Element element = node.element;
+ Element element = node.bestElement;
if (element == null) {
element = node.staticElement;
}
@@ -15472,12 +15574,12 @@
}
Element visitImportDirective(ImportDirective node) => node.element;
Element visitIndexExpression(IndexExpression node) => node.bestElement;
- Element visitInstanceCreationExpression(InstanceCreationExpression node) => node.element;
+ Element visitInstanceCreationExpression(InstanceCreationExpression node) => node.staticElement;
Element visitLibraryDirective(LibraryDirective node) => node.element;
Element visitMethodDeclaration(MethodDeclaration node) => node.element;
- Element visitMethodInvocation(MethodInvocation node) => node.methodName.element;
+ Element visitMethodInvocation(MethodInvocation node) => node.methodName.bestElement;
Element visitPostfixExpression(PostfixExpression node) => node.bestElement;
- Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element;
+ Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.bestElement;
Element visitPrefixExpression(PrefixExpression node) => node.bestElement;
Element visitStringLiteral(StringLiteral node) {
ASTNode parent = node.parent;
@@ -16530,7 +16632,7 @@
return null;
}
Object visitFieldDeclaration(FieldDeclaration node) {
- visit5(node.keyword, " ");
+ visit5(node.staticKeyword, " ");
visit(node.fields);
_writer.print(";");
return null;
@@ -16726,8 +16828,8 @@
return null;
}
Object visitListLiteral(ListLiteral node) {
- if (node.modifier != null) {
- _writer.print(node.modifier.lexeme);
+ if (node.constKeyword != null) {
+ _writer.print(node.constKeyword.lexeme);
_writer.print(' ');
}
visit2(node.typeArguments, " ");
@@ -16737,8 +16839,8 @@
return null;
}
Object visitMapLiteral(MapLiteral node) {
- if (node.modifier != null) {
- _writer.print(node.modifier.lexeme);
+ if (node.constKeyword != null) {
+ _writer.print(node.constKeyword.lexeme);
_writer.print(' ');
}
visit2(node.typeArguments, " ");
@@ -16948,7 +17050,7 @@
_writer.print("try ");
visit(node.body);
visitList4(" ", node.catchClauses, " ");
- visit3(" finally ", node.finallyClause);
+ visit3(" finally ", node.finallyBlock);
return null;
}
Object visitTypeArgumentList(TypeArgumentList node) {
@@ -17194,7 +17296,7 @@
ExpressionFunctionBody visitExpressionFunctionBody(ExpressionFunctionBody node) => new ExpressionFunctionBody.full(node.functionDefinition, clone2(node.expression), node.semicolon);
ExpressionStatement visitExpressionStatement(ExpressionStatement node) => new ExpressionStatement.full(clone2(node.expression), node.semicolon);
ExtendsClause visitExtendsClause(ExtendsClause node) => new ExtendsClause.full(node.keyword, clone2(node.superclass));
- FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => new FieldDeclaration.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.fields), node.semicolon);
+ FieldDeclaration visitFieldDeclaration(FieldDeclaration node) => new FieldDeclaration.full(clone2(node.documentationComment), clone3(node.metadata), node.staticKeyword, clone2(node.fields), node.semicolon);
FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) => new FieldFormalParameter.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.type), node.thisToken, node.period, clone2(node.identifier), clone2(node.parameters));
ForEachStatement visitForEachStatement(ForEachStatement node) => new ForEachStatement.full(node.forKeyword, node.leftParenthesis, clone2(node.loopVariable), node.inKeyword, clone2(node.iterator), node.rightParenthesis, clone2(node.body));
FormalParameterList visitFormalParameterList(FormalParameterList node) => new FormalParameterList.full(node.leftParenthesis, clone3(node.parameters), node.leftDelimiter, node.rightDelimiter, node.rightParenthesis);
@@ -17226,8 +17328,8 @@
LabeledStatement visitLabeledStatement(LabeledStatement node) => new LabeledStatement.full(clone3(node.labels), clone2(node.statement));
LibraryDirective visitLibraryDirective(LibraryDirective node) => new LibraryDirective.full(clone2(node.documentationComment), clone3(node.metadata), node.libraryToken, clone2(node.name), node.semicolon);
LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) => new LibraryIdentifier.full(clone3(node.components));
- ListLiteral visitListLiteral(ListLiteral node) => new ListLiteral.full(node.modifier, clone2(node.typeArguments), node.leftBracket, clone3(node.elements), node.rightBracket);
- MapLiteral visitMapLiteral(MapLiteral node) => new MapLiteral.full(node.modifier, clone2(node.typeArguments), node.leftBracket, clone3(node.entries), node.rightBracket);
+ ListLiteral visitListLiteral(ListLiteral node) => new ListLiteral.full(node.constKeyword, clone2(node.typeArguments), node.leftBracket, clone3(node.elements), node.rightBracket);
+ MapLiteral visitMapLiteral(MapLiteral node) => new MapLiteral.full(node.constKeyword, clone2(node.typeArguments), node.leftBracket, clone3(node.entries), node.rightBracket);
MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) => new MapLiteralEntry.full(clone2(node.key), node.separator, clone2(node.value));
MethodDeclaration visitMethodDeclaration(MethodDeclaration node) => new MethodDeclaration.full(clone2(node.documentationComment), clone3(node.metadata), node.externalKeyword, node.modifierKeyword, clone2(node.returnType), node.propertyKeyword, node.operatorKeyword, clone2(node.name), clone2(node.parameters), clone2(node.body));
MethodInvocation visitMethodInvocation(MethodInvocation node) => new MethodInvocation.full(clone2(node.target), node.period, clone2(node.methodName), clone2(node.argumentList));
@@ -17260,7 +17362,7 @@
ThisExpression visitThisExpression(ThisExpression node) => new ThisExpression.full(node.keyword);
ThrowExpression visitThrowExpression(ThrowExpression node) => new ThrowExpression.full(node.keyword, clone2(node.expression));
TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) => new TopLevelVariableDeclaration.full(clone2(node.documentationComment), clone3(node.metadata), clone2(node.variables), node.semicolon);
- TryStatement visitTryStatement(TryStatement node) => new TryStatement.full(node.tryKeyword, clone2(node.body), clone3(node.catchClauses), node.finallyKeyword, clone2(node.finallyClause));
+ TryStatement visitTryStatement(TryStatement node) => new TryStatement.full(node.tryKeyword, clone2(node.body), clone3(node.catchClauses), node.finallyKeyword, clone2(node.finallyBlock));
TypeArgumentList visitTypeArgumentList(TypeArgumentList node) => new TypeArgumentList.full(node.leftBracket, clone3(node.arguments), node.rightBracket);
TypeName visitTypeName(TypeName node) => new TypeName.full(clone2(node.name), clone2(node.typeArguments));
TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter.full(clone2(node.documentationComment), clone3(node.metadata), clone2(node.name), node.keyword, clone2(node.bound));
@@ -17279,7 +17381,7 @@
List clone3(NodeList nodes) {
List clonedNodes = new List();
for (ASTNode node in nodes) {
- clonedNodes.add((node.accept(this) as ASTNode));
+ clonedNodes.add(node.accept(this) as ASTNode);
}
return clonedNodes;
}
@@ -17347,7 +17449,7 @@
return super.visitFunctionDeclarationStatement(node);
}
Object visitFunctionExpression(FunctionExpression node) {
- if (_immediateChild != node.parameters) {
+ if (node.parameters != null && _immediateChild != node.parameters) {
addParameters(node.parameters.parameters);
}
return super.visitFunctionExpression(node);
diff --git a/pkg/analyzer_experimental/lib/src/generated/constant.dart b/pkg/analyzer_experimental/lib/src/generated/constant.dart
index bb5a292..176f8b3 100644
--- a/pkg/analyzer_experimental/lib/src/generated/constant.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/constant.dart
@@ -379,7 +379,7 @@
if (!node.isConst) {
return error(node, null);
}
- ConstructorElement constructor = node.element;
+ ConstructorElement constructor = node.staticElement;
if (constructor != null && constructor.isConst) {
node.argumentList.accept(this);
return ValidResult.RESULT_OBJECT;
@@ -393,7 +393,7 @@
}
EvaluationResultImpl visitInterpolationString(InterpolationString node) => new ValidResult(node.value);
EvaluationResultImpl visitListLiteral(ListLiteral node) {
- if (node.modifier == null) {
+ if (node.constKeyword == null) {
return new ErrorResult.con1(node, CompileTimeErrorCode.MISSING_CONST_IN_LIST_LITERAL);
}
ErrorResult result = null;
@@ -406,7 +406,7 @@
return ValidResult.RESULT_OBJECT;
}
EvaluationResultImpl visitMapLiteral(MapLiteral node) {
- if (node.modifier == null) {
+ if (node.constKeyword == null) {
return new ErrorResult.con1(node, CompileTimeErrorCode.MISSING_CONST_IN_MAP_LITERAL);
}
ErrorResult result = null;
@@ -420,7 +420,7 @@
return ValidResult.RESULT_OBJECT;
}
EvaluationResultImpl visitMethodInvocation(MethodInvocation node) {
- Element element = node.methodName.element;
+ Element element = node.methodName.staticElement;
if (element is FunctionElement) {
FunctionElement function = element as FunctionElement;
if (function.name == "identical") {
@@ -440,19 +440,20 @@
}
return error(node, null);
}
+ EvaluationResultImpl visitNamedExpression(NamedExpression node) => node.expression.accept(this);
EvaluationResultImpl visitNode(ASTNode node) => error(node, null);
EvaluationResultImpl visitNullLiteral(NullLiteral node) => ValidResult.RESULT_NULL;
EvaluationResultImpl visitParenthesizedExpression(ParenthesizedExpression node) => node.expression.accept(this);
EvaluationResultImpl visitPrefixedIdentifier(PrefixedIdentifier node) {
SimpleIdentifier prefixNode = node.prefix;
- Element prefixElement = prefixNode.element;
+ Element prefixElement = prefixNode.staticElement;
if (prefixElement is! PrefixElement) {
EvaluationResultImpl prefixResult = prefixNode.accept(this);
if (prefixResult is! ValidResult) {
return error(node, null);
}
}
- return getConstantValue(node, node.element);
+ return getConstantValue(node, node.staticElement);
}
EvaluationResultImpl visitPrefixExpression(PrefixExpression node) {
EvaluationResultImpl operand = node.operand.accept(this);
@@ -471,8 +472,8 @@
}
return error(node, null);
}
- EvaluationResultImpl visitPropertyAccess(PropertyAccess node) => getConstantValue(node, node.propertyName.element);
- EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(node, node.element);
+ EvaluationResultImpl visitPropertyAccess(PropertyAccess node) => getConstantValue(node, node.propertyName.staticElement);
+ EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(node, node.staticElement);
EvaluationResultImpl visitSimpleStringLiteral(SimpleStringLiteral node) => new ValidResult(node.value);
EvaluationResultImpl visitStringInterpolation(StringInterpolation node) {
EvaluationResultImpl result = null;
@@ -534,7 +535,7 @@
ErrorResult union(ErrorResult leftResult, EvaluationResultImpl rightResult) {
if (rightResult is ErrorResult) {
if (leftResult != null) {
- return new ErrorResult.con2(leftResult, (rightResult as ErrorResult));
+ return new ErrorResult.con2(leftResult, rightResult as ErrorResult);
} else {
return rightResult as ErrorResult;
}
@@ -939,7 +940,7 @@
this._referenceGraph = referenceGraph;
}
Object visitSimpleIdentifier(SimpleIdentifier node) {
- Element element = node.element;
+ Element element = node.staticElement;
if (element is PropertyAccessorElement) {
element = ((element as PropertyAccessorElement)).variable;
}
@@ -1104,7 +1105,9 @@
if (!isAnyNum || !leftOperand2.isAnyNum) {
return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
}
- if (isSomeNum || leftOperand2.isSomeNum) {
+ if (isSomeInt || leftOperand2.isSomeInt) {
+ return RESULT_INT;
+ } else if (isSomeNum || leftOperand2.isSomeNum) {
return RESULT_NUM;
}
Object leftValue = leftOperand2.value;
@@ -1254,19 +1257,19 @@
return valueOf2(_value == null);
} else if (leftValue is bool) {
if (_value is bool) {
- return valueOf2(identical(((leftValue as bool)), ((_value as bool))));
+ return valueOf2(identical(leftValue as bool, _value as bool));
}
return RESULT_FALSE;
} else if (leftValue is int) {
if (_value is int) {
return valueOf2(((leftValue as int)) == _value);
} else if (_value is double) {
- return valueOf2(toDouble((leftValue as int)) == _value);
+ return valueOf2(toDouble(leftValue as int) == _value);
}
return RESULT_FALSE;
} else if (leftValue is double) {
if (_value is int) {
- return valueOf2(((leftValue as double)) == toDouble((_value as int)));
+ return valueOf2(((leftValue as double)) == toDouble(_value as int));
} else if (_value is double) {
return valueOf2(((leftValue as double)) == _value);
}
@@ -1295,7 +1298,7 @@
return error(node.rightOperand);
} else if (leftValue is int) {
if (_value is int) {
- return valueOf2(((leftValue as int)).compareTo((_value as int)) >= 0);
+ return valueOf2(((leftValue as int)).compareTo(_value as int) >= 0);
} else if (_value is double) {
return valueOf2(((leftValue as int)).toDouble() >= ((_value as double)));
}
@@ -1322,7 +1325,7 @@
return error(node.rightOperand);
} else if (leftValue is int) {
if (_value is int) {
- return valueOf2(((leftValue as int)).compareTo((_value as int)) > 0);
+ return valueOf2(((leftValue as int)).compareTo(_value as int) > 0);
} else if (_value is double) {
return valueOf2(((leftValue as int)).toDouble() > ((_value as double)));
}
@@ -1385,7 +1388,7 @@
return error(node.rightOperand);
} else if (leftValue is int) {
if (_value is int) {
- return valueOf2(((leftValue as int)).compareTo((_value as int)) <= 0);
+ return valueOf2(((leftValue as int)).compareTo(_value as int) <= 0);
} else if (_value is double) {
return valueOf2(((leftValue as int)).toDouble() <= ((_value as double)));
}
@@ -1412,7 +1415,7 @@
return error(node.rightOperand);
} else if (leftValue is int) {
if (_value is int) {
- return valueOf2(((leftValue as int)).compareTo((_value as int)) < 0);
+ return valueOf2(((leftValue as int)).compareTo(_value as int) < 0);
} else if (_value is double) {
return valueOf2(((leftValue as int)).toDouble() < ((_value as double)));
}
@@ -1461,7 +1464,9 @@
if (!isAnyNum || !leftOperand2.isAnyNum) {
return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
}
- if (isSomeNum || leftOperand2.isSomeNum) {
+ if (isSomeInt || leftOperand2.isSomeInt) {
+ return RESULT_INT;
+ } else if (isSomeNum || leftOperand2.isSomeNum) {
return RESULT_NUM;
}
Object leftValue = leftOperand2.value;
@@ -1501,12 +1506,12 @@
if (_value is int) {
return valueOf2(((leftValue as int)) != _value);
} else if (_value is double) {
- return valueOf2(toDouble((leftValue as int)) != _value);
+ return valueOf2(toDouble(leftValue as int) != _value);
}
return RESULT_TRUE;
} else if (leftValue is double) {
if (_value is int) {
- return valueOf2(((leftValue as double)) != toDouble((_value as int)));
+ return valueOf2(((leftValue as double)) != toDouble(_value as int));
} else if (_value is double) {
return valueOf2(((leftValue as double)) != _value);
}
@@ -1524,7 +1529,9 @@
if (!isAnyNum || !leftOperand2.isAnyNum) {
return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
}
- if (isSomeNum || leftOperand2.isSomeNum) {
+ if (isSomeInt || leftOperand2.isSomeInt) {
+ return RESULT_INT;
+ } else if (isSomeNum || leftOperand2.isSomeNum) {
return RESULT_NUM;
}
Object leftValue = leftOperand2.value;
@@ -1537,7 +1544,7 @@
if (((_value as int)) == 0) {
return valueOf3(((leftValue as int)).toDouble() % ((_value as int)).toDouble());
}
- return valueOf(((leftValue as int)).remainder((_value as int)));
+ return valueOf(((leftValue as int)).remainder(_value as int));
} else if (_value is double) {
return valueOf3(((leftValue as int)).toDouble() % ((_value as double)));
}
@@ -1603,7 +1610,9 @@
if (!isAnyNum || !leftOperand2.isAnyNum) {
return error2(node, CompileTimeErrorCode.CONST_EVAL_TYPE_NUM);
}
- if (isSomeNum || leftOperand2.isSomeNum) {
+ if (isSomeInt || leftOperand2.isSomeInt) {
+ return RESULT_INT;
+ } else if (isSomeNum || leftOperand2.isSomeNum) {
return RESULT_NUM;
}
Object leftValue = leftOperand2.value;
diff --git a/pkg/analyzer_experimental/lib/src/generated/element.dart b/pkg/analyzer_experimental/lib/src/generated/element.dart
index 5df3e1e..254fdbd 100644
--- a/pkg/analyzer_experimental/lib/src/generated/element.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/element.dart
@@ -275,6 +275,14 @@
* @return the type in which this member is defined
*/
ClassElement get enclosingElement;
+
+ /**
+ * Return `true` if this element is a static element. A static element is an element that is
+ * not associated with a particular instance, but rather with an entire library or class.
+ *
+ * @return `true` if this executable element is a static element
+ */
+ bool get isStatic;
}
/**
* The interface `CompilationUnitElement` defines the behavior of elements representing a
@@ -539,7 +547,7 @@
*
* @param visitor the visitor that will be used to visit the children of this element
*/
- void visitChildren(ElementVisitor<Object> visitor);
+ void visitChildren(ElementVisitor visitor);
}
/**
* The interface `ElementAnnotation` defines the behavior of objects representing a single
@@ -562,7 +570,7 @@
*
* @coverage dart.engine.element
*/
-class ElementKind implements Enum<ElementKind> {
+class ElementKind extends Enum<ElementKind> {
static final ElementKind CLASS = new ElementKind('CLASS', 0, "class");
static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT', 1, "compilation unit");
static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 2, "constructor");
@@ -615,12 +623,6 @@
TYPE_VARIABLE,
UNIVERSE];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* Return the kind of the given element, or [ERROR] if the element is `null`. This is
* a utility method that can reduce the need for null checks in other places.
@@ -645,7 +647,7 @@
*
* @param displayName the name displayed in the UI for this kind of element
*/
- ElementKind(this.name, this.ordinal, String displayName) {
+ ElementKind(String name, int ordinal, String displayName) : super(name, ordinal) {
this._displayName = displayName;
}
@@ -655,9 +657,6 @@
* @return the name of this [ElementKind] to display in UI.
*/
String get displayName => _displayName;
- int compareTo(ElementKind other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* The interface `ElementLocation` defines the behavior of objects that represent the location
@@ -1557,11 +1556,11 @@
R visitLibraryElement(LibraryElement element) => visitElement(element);
R visitLocalElement(LocalElement element) {
if (element is LocalVariableElement) {
- return visitVariableElement((element as LocalVariableElement));
+ return visitVariableElement(element as LocalVariableElement);
} else if (element is ParameterElement) {
- return visitVariableElement((element as ParameterElement));
+ return visitVariableElement(element as ParameterElement);
} else if (element is FunctionElement) {
- return visitExecutableElement((element as FunctionElement));
+ return visitExecutableElement(element as FunctionElement);
}
return null;
}
@@ -1711,6 +1710,48 @@
R visitTypeVariableElement(TypeVariableElement element) => null;
}
/**
+ * For AST nodes that could be in both the getter and setter contexts ([IndexExpression]s and
+ * [SimpleIdentifier]s), the additional resolved elements are stored in the AST node, in an
+ * [AuxiliaryElements]. Since resolved elements are either statically resolved or resolved
+ * using propagated type information, this class is a wrapper for a pair of
+ * [ExecutableElement]s, not just a single [ExecutableElement].
+ */
+class AuxiliaryElements {
+
+ /**
+ * The element based on propagated type information, or `null` if the AST structure has not
+ * been resolved or if this identifier could not be resolved.
+ */
+ ExecutableElement _propagatedElement;
+
+ /**
+ * The element associated with this identifier based on static type information, or `null`
+ * if the AST structure has not been resolved or if this identifier could not be resolved.
+ */
+ ExecutableElement _staticElement;
+
+ /**
+ * Create the [AuxiliaryElements] with a static and propagated [ExecutableElement].
+ *
+ * @param staticElement the static element
+ * @param propagatedElement the propagated element
+ */
+ AuxiliaryElements(ExecutableElement staticElement, ExecutableElement propagatedElement) {
+ this._staticElement = staticElement;
+ this._propagatedElement = propagatedElement;
+ }
+
+ /**
+ * Get the propagated element.
+ */
+ ExecutableElement get propagatedElement => _propagatedElement;
+
+ /**
+ * Get the static element.
+ */
+ ExecutableElement get staticElement => _staticElement;
+}
+/**
* Instances of the class `ClassElementImpl` implement a `ClassElement`.
*
* @coverage dart.engine.element
@@ -2121,7 +2162,7 @@
void set validMixin(bool isValidMixin) {
setModifier(Modifier.MIXIN, isValidMixin);
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(_accessors, visitor);
safelyVisitChildren(_constructors, visitor);
@@ -2361,7 +2402,7 @@
void set uri(String uri2) {
this._uri = uri2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(_accessors, visitor);
safelyVisitChildren(_functions, visitor);
@@ -2796,7 +2837,7 @@
appendTo(builder);
return builder.toString();
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
}
/**
@@ -2836,7 +2877,7 @@
* @param child the child to be visited
* @param visitor the visitor to be used to visit the child
*/
- void safelyVisitChild(Element child, ElementVisitor<Object> visitor) {
+ void safelyVisitChild(Element child, ElementVisitor visitor) {
if (child != null) {
child.accept(visitor);
}
@@ -2848,7 +2889,7 @@
* @param children the children to be visited
* @param visitor the visitor being used to visit the children
*/
- void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visitor) {
+ void safelyVisitChildren(List<Element> children, ElementVisitor visitor) {
if (children != null) {
for (Element child in children) {
child.accept(visitor);
@@ -3088,7 +3129,7 @@
scriptLibrary2.enclosingElement = this;
this._scriptLibrary = scriptLibrary2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
safelyVisitChild(_scriptLibrary, visitor);
}
}
@@ -3246,7 +3287,7 @@
void set type(FunctionType type2) {
this._type = type2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(_functions, visitor);
safelyVisitChildren(_labels, visitor);
@@ -3641,7 +3682,7 @@
void shareTypeVariables(List<TypeVariableElement> typeVariables2) {
this._typeVariables = typeVariables2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(_parameters, visitor);
safelyVisitChildren(_typeVariables, visitor);
@@ -3779,7 +3820,7 @@
void set source(Source source2) {
this._source = source2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(_scripts, visitor);
}
@@ -3887,7 +3928,7 @@
void set uri(String uri2) {
this._uri = uri2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_prefix, visitor);
}
@@ -4183,7 +4224,7 @@
}
this._parts = parts2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_definingCompilationUnit, visitor);
safelyVisitChildren(_exports, visitor);
@@ -4357,7 +4398,7 @@
*
* @coverage dart.engine.element
*/
-class Modifier implements Enum<Modifier> {
+class Modifier extends Enum<Modifier> {
static final Modifier ABSTRACT = new Modifier('ABSTRACT', 0);
static final Modifier CONST = new Modifier('CONST', 1);
static final Modifier FACTORY = new Modifier('FACTORY', 2);
@@ -4381,16 +4422,7 @@
STATIC,
SYNTHETIC,
TYPEDEF];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- Modifier(this.name, this.ordinal);
- int compareTo(Modifier other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ Modifier(String name, int ordinal) : super(name, ordinal);
}
/**
* Instances of the class `MultiplyDefinedElementImpl` represent a collection of elements that
@@ -4463,7 +4495,7 @@
builder.append("]");
return builder.toString();
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
}
/**
@@ -4623,7 +4655,7 @@
_visibleRangeOffset = offset;
_visibleRangeLength = length;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(_parameters, visitor);
}
@@ -5094,7 +5126,7 @@
void set type(Type2 type2) {
this._type = type2;
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(_initializer, visitor);
}
@@ -5219,7 +5251,7 @@
FunctionType get type => substituteFor(baseElement.type);
bool get isOperator => baseElement.isOperator;
bool get isStatic => baseElement.isStatic;
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(baseElement.functions, visitor);
safelyVisitChildren(labels, visitor);
@@ -5322,7 +5354,7 @@
Source get source => _baseElement.source;
bool isAccessibleIn(LibraryElement library) => _baseElement.isAccessibleIn(library);
bool get isSynthetic => _baseElement.isSynthetic;
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
}
/**
@@ -5338,7 +5370,7 @@
* @param child the child to be visited
* @param visitor the visitor to be used to visit the child
*/
- void safelyVisitChild(Element child, ElementVisitor<Object> visitor) {
+ void safelyVisitChild(Element child, ElementVisitor visitor) {
if (child != null) {
child.accept(visitor);
}
@@ -5350,7 +5382,7 @@
* @param children the children to be visited
* @param visitor the visitor being used to visit the children
*/
- void safelyVisitChildren(List<Element> children, ElementVisitor<Object> visitor) {
+ void safelyVisitChildren(List<Element> children, ElementVisitor visitor) {
if (children != null) {
for (Element child in children) {
child.accept(visitor);
@@ -5498,11 +5530,11 @@
if (definingType is InterfaceType) {
InterfaceType definingInterfaceType = definingType as InterfaceType;
if (element is ConstructorElement) {
- return ConstructorMember.from((element as ConstructorElement), definingInterfaceType) as Element;
+ return ConstructorMember.from(element as ConstructorElement, definingInterfaceType) as Element;
} else if (element is MethodElement) {
- return MethodMember.from((element as MethodElement), definingInterfaceType) as Element;
+ return MethodMember.from(element as MethodElement, definingInterfaceType) as Element;
} else if (element is PropertyAccessorElement) {
- return PropertyAccessorMember.from((element as PropertyAccessorElement), definingInterfaceType) as Element;
+ return PropertyAccessorMember.from(element as PropertyAccessorElement, definingInterfaceType) as Element;
}
}
return element;
@@ -5547,7 +5579,7 @@
builder.append(right);
return builder.toString();
}
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChildren(parameters, visitor);
}
@@ -5599,13 +5631,41 @@
PropertyInducingElement get variable {
PropertyInducingElement variable = baseElement.variable;
if (variable is FieldElement) {
- return FieldMember.from(((variable as FieldElement)), definingType);
+ return FieldMember.from(variable as FieldElement, definingType);
}
return variable;
}
bool get isAbstract => baseElement.isAbstract;
bool get isGetter => baseElement.isGetter;
bool get isSetter => baseElement.isSetter;
+ String toString() {
+ PropertyAccessorElement baseElement = this.baseElement;
+ List<ParameterElement> parameters = this.parameters;
+ FunctionType type = this.type;
+ JavaStringBuilder builder = new JavaStringBuilder();
+ if (isGetter) {
+ builder.append("get ");
+ } else {
+ builder.append("set ");
+ }
+ builder.append(baseElement.enclosingElement.displayName);
+ builder.append(".");
+ builder.append(baseElement.displayName);
+ builder.append("(");
+ int parameterCount = parameters.length;
+ for (int i = 0; i < parameterCount; i++) {
+ if (i > 0) {
+ builder.append(", ");
+ }
+ builder.append(parameters[i]).toString();
+ }
+ builder.append(")");
+ if (type != null) {
+ builder.append(" -> ");
+ builder.append(type.returnType);
+ }
+ return builder.toString();
+ }
InterfaceType get definingType => super.definingType as InterfaceType;
}
/**
@@ -5630,7 +5690,7 @@
Type2 get type => substituteFor(baseElement.type);
bool get isConst => baseElement.isConst;
bool get isFinal => baseElement.isFinal;
- void visitChildren(ElementVisitor<Object> visitor) {
+ void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
safelyVisitChild(baseElement.initializer, visitor);
}
@@ -5908,6 +5968,7 @@
}
return element.hashCode;
}
+ bool isAssignableTo(Type2 type) => this.isSubtypeOf(type);
bool isSubtypeOf(Type2 type) {
if (type == null) {
return false;
@@ -6009,7 +6070,7 @@
return this;
}
Element element = this.element;
- FunctionTypeImpl newType = (element is ExecutableElement) ? new FunctionTypeImpl.con1((element as ExecutableElement)) : new FunctionTypeImpl.con2((element as FunctionTypeAliasElement));
+ FunctionTypeImpl newType = (element is ExecutableElement) ? new FunctionTypeImpl.con1(element as ExecutableElement) : new FunctionTypeImpl.con2(element as FunctionTypeAliasElement);
newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, parameterTypes);
return newType;
}
@@ -6461,7 +6522,7 @@
} else if (type is! InterfaceType) {
return false;
}
- return isMoreSpecificThan2((type as InterfaceType), new Set<ClassElement>());
+ return isMoreSpecificThan2(type as InterfaceType, new Set<ClassElement>());
}
bool get isObject => element.supertype == null;
bool isSubtypeOf(Type2 type2) {
@@ -6481,7 +6542,7 @@
} else if (this == type2) {
return true;
}
- return isSubtypeOf2((type2 as InterfaceType), new Set<ClassElement>());
+ return isSubtypeOf2(type2 as InterfaceType, new Set<ClassElement>());
}
ConstructorElement lookUpConstructor(String constructorName, LibraryElement library) {
ConstructorElement constructorElement;
@@ -6705,17 +6766,17 @@
} else if (typeS.isDartCoreFunction && elementT.getMethod("call") != null) {
return true;
}
- InterfaceType supertype = elementT.supertype;
+ InterfaceType supertype = superclass;
if (supertype != null && ((supertype as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)) {
return true;
}
- List<InterfaceType> interfaceTypes = elementT.interfaces;
+ List<InterfaceType> interfaceTypes = interfaces;
for (InterfaceType interfaceType in interfaceTypes) {
if (((interfaceType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)) {
return true;
}
}
- List<InterfaceType> mixinTypes = elementT.mixins;
+ List<InterfaceType> mixinTypes = mixins;
for (InterfaceType mixinType in mixinTypes) {
if (((mixinType as InterfaceTypeImpl)).isSubtypeOf2(typeS, visitedClasses)) {
return true;
diff --git a/pkg/analyzer_experimental/lib/src/generated/engine.dart b/pkg/analyzer_experimental/lib/src/generated/engine.dart
index 1570f8c..909e4f7 100644
--- a/pkg/analyzer_experimental/lib/src/generated/engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/engine.dart
@@ -800,6 +800,181 @@
}
}
/**
+ * Instances of the class `AnalysisCache` implement an LRU cache of information related to
+ * analysis.
+ */
+class AnalysisCache {
+
+ /**
+ * A table mapping the sources known to the context to the information known about the source.
+ */
+ Map<Source, SourceEntry> _sourceMap = new Map<Source, SourceEntry>();
+
+ /**
+ * The maximum number of sources for which AST structures should be kept in the cache.
+ */
+ int _maxCacheSize = 0;
+
+ /**
+ * A list containing the most recently accessed sources with the most recently used at the end of
+ * the list. When more sources are added than the maximum allowed then the least recently used
+ * source will be removed and will have it's cached AST structure flushed.
+ */
+ List<Source> _recentlyUsed;
+
+ /**
+ * An array containing sources for which data should not be flushed.
+ */
+ List<Source> _priorityOrder = Source.EMPTY_ARRAY;
+
+ /**
+ * The number of times that the flushing of information from the cache has been disabled without
+ * being re-enabled.
+ */
+ int _cacheRemovalCount = 0;
+
+ /**
+ * Initialize a newly created cache to maintain at most the given number of AST structures in the
+ * cache.
+ *
+ * @param maxCacheSize the maximum number of sources for which AST structures should be kept in
+ * the cache
+ */
+ AnalysisCache(int maxCacheSize) {
+ this._maxCacheSize = maxCacheSize;
+ _recentlyUsed = new List<Source>();
+ }
+
+ /**
+ * Record that the given source was just accessed.
+ *
+ * @param source the source that was accessed
+ */
+ void accessed(Source source) {
+ if (_recentlyUsed.remove(source)) {
+ _recentlyUsed.add(source);
+ return;
+ }
+ if (_cacheRemovalCount == 0 && _recentlyUsed.length >= _maxCacheSize) {
+ flushAstFromCache();
+ }
+ _recentlyUsed.add(source);
+ }
+
+ /**
+ * Disable flushing information from the cache until [enableCacheRemoval] has been
+ * called.
+ */
+ void disableCacheRemoval() {
+ _cacheRemovalCount++;
+ }
+
+ /**
+ * Re-enable flushing information from the cache.
+ */
+ void enableCacheRemoval() {
+ if (_cacheRemovalCount > 0) {
+ _cacheRemovalCount--;
+ }
+ if (_cacheRemovalCount == 0) {
+ while (_recentlyUsed.length > _maxCacheSize) {
+ flushAstFromCache();
+ }
+ }
+ }
+
+ /**
+ * Return a set containing all of the map entries mapping sources to cache entries. Clients should
+ * not modify the returned set.
+ *
+ * @return a set containing all of the map entries mapping sources to cache entries
+ */
+ Set<MapEntry<Source, SourceEntry>> entrySet() => getMapEntrySet(_sourceMap);
+
+ /**
+ * Return the entry associated with the given source.
+ *
+ * @param source the source whose entry is to be returned
+ * @return the entry associated with the given source
+ */
+ SourceEntry get(Source source) => _sourceMap[source];
+
+ /**
+ * Return an array containing sources for which data should not be flushed.
+ *
+ * @return an array containing sources for which data should not be flushed
+ */
+ List<Source> get priorityOrder => _priorityOrder;
+
+ /**
+ * Associate the given entry with the given source.
+ *
+ * @param source the source with which the entry is to be associated
+ * @param entry the entry to be associated with the source
+ */
+ void put(Source source, SourceEntry entry) {
+ _sourceMap[source] = entry;
+ }
+
+ /**
+ * Set the sources for which data should not be flushed to the given array.
+ *
+ * @param sources the sources for which data should not be flushed
+ */
+ void set priorityOrder(List<Source> sources) {
+ _priorityOrder = sources;
+ }
+
+ /**
+ * Flush one AST structure from the cache.
+ */
+ void flushAstFromCache() {
+ Source removedSource = removeAstToFlush();
+ SourceEntry sourceEntry = _sourceMap[removedSource];
+ if (sourceEntry is HtmlEntry) {
+ HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
+ htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED);
+ _sourceMap[removedSource] = htmlCopy;
+ } else if (sourceEntry is DartEntry) {
+ DartEntryImpl dartCopy = ((sourceEntry as DartEntry)).writableCopy;
+ dartCopy.flushAstStructures();
+ _sourceMap[removedSource] = dartCopy;
+ }
+ }
+
+ /**
+ * Return `true` if the given source is in the array of priority sources.
+ *
+ * @return `true` if the given source is in the array of priority sources
+ */
+ bool isPrioritySource(Source source) {
+ for (Source prioritySource in _priorityOrder) {
+ if (source == prioritySource) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Remove and return one source from the list of recently used sources whose AST structure can be
+ * flushed from the cache. The source that will be returned will be the source that has been
+ * unreferenced for the longest period of time but that is not a priority for analysis.
+ *
+ * @return the source that was removed
+ */
+ Source removeAstToFlush() {
+ for (int i = 0; i < _recentlyUsed.length; i++) {
+ Source source = _recentlyUsed[i];
+ if (!isPrioritySource(source)) {
+ return _recentlyUsed.removeAt(i);
+ }
+ }
+ AnalysisEngine.instance.logger.logError2("Internal error: The number of priority sources (${_priorityOrder.length}) is greater than the maximum cache size (${_maxCacheSize})", new JavaException());
+ return _recentlyUsed.removeAt(0);
+ }
+}
+/**
* The interface `DartEntry` defines the behavior of objects that maintain the information
* cached by an analysis context about an individual Dart file.
*
@@ -912,7 +1087,7 @@
* context for the data
* @return the value of the data represented by the given descriptor and library
*/
- CacheState getState2(DataDescriptor<Object> descriptor, Source librarySource);
+ CacheState getState2(DataDescriptor descriptor, Source librarySource);
/**
* Return the value of the data represented by the given descriptor in the context of the given
@@ -949,6 +1124,12 @@
CacheState _parsedUnitState = CacheState.INVALID;
/**
+ * A flag indicating whether the parsed AST structure has been accessed since it was set. This is
+ * used to determine whether the structure needs to be copied before it is resolved.
+ */
+ bool _parsedUnitAccessed = false;
+
+ /**
* The parsed compilation unit, or `null` if the parsed compilation unit is not currently
* cached.
*/
@@ -1049,6 +1230,18 @@
* If the library is not "client code", then it is referenced as "server code".
*/
static int _CLIENT_CODE = 1 << 2;
+
+ /**
+ * Flush any AST structures being maintained by this entry.
+ */
+ void flushAstStructures() {
+ if (identical(_parsedUnitState, CacheState.VALID)) {
+ _parsedUnitState = CacheState.FLUSHED;
+ _parsedUnitAccessed = false;
+ _parsedUnit = null;
+ }
+ _resolutionState.flushAstStructures();
+ }
List<AnalysisError> get allErrors {
List<AnalysisError> errors = new List<AnalysisError>();
for (AnalysisError error in _parseErrors) {
@@ -1072,6 +1265,7 @@
}
CompilationUnit get anyParsedCompilationUnit {
if (identical(_parsedUnitState, CacheState.VALID)) {
+ _parsedUnitAccessed = true;
return _parsedUnit;
}
return anyResolvedCompilationUnit;
@@ -1088,7 +1282,35 @@
return null;
}
SourceKind get kind => _sourceKind;
- CacheState getState(DataDescriptor<Object> descriptor) {
+
+ /**
+ * Return a compilation unit that has not been accessed by any other client and can therefore
+ * safely be modified by the reconciler.
+ *
+ * @return a compilation unit that can be modified by the reconciler
+ */
+ CompilationUnit get resolvableCompilationUnit {
+ if (identical(_parsedUnitState, CacheState.VALID)) {
+ if (_parsedUnitAccessed) {
+ return _parsedUnit.accept(new ASTCloner()) as CompilationUnit;
+ }
+ CompilationUnit unit = _parsedUnit;
+ _parsedUnitState = CacheState.FLUSHED;
+ _parsedUnitAccessed = false;
+ _parsedUnit = null;
+ return unit;
+ }
+ DartEntryImpl_ResolutionState state = _resolutionState;
+ while (state != null) {
+ if (identical(state._resolvedUnitState, CacheState.VALID)) {
+ return state._resolvedUnit.accept(new ASTCloner()) as CompilationUnit;
+ }
+ state = state._nextState;
+ }
+ ;
+ return null;
+ }
+ CacheState getState(DataDescriptor descriptor) {
if (identical(descriptor, DartEntry.ELEMENT)) {
return _elementState;
} else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) {
@@ -1113,7 +1335,7 @@
return super.getState(descriptor);
}
}
- CacheState getState2(DataDescriptor<Object> descriptor, Source librarySource2) {
+ CacheState getState2(DataDescriptor descriptor, Source librarySource2) {
DartEntryImpl_ResolutionState state = _resolutionState;
while (state != null) {
if (librarySource2 == state._librarySource) {
@@ -1152,6 +1374,7 @@
} else if (identical(descriptor, DartEntry.PARSE_ERRORS)) {
return _parseErrors as Object;
} else if (identical(descriptor, DartEntry.PARSED_UNIT)) {
+ _parsedUnitAccessed = true;
return _parsedUnit as Object;
} else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) {
return _publicNamespace as Object;
@@ -1201,6 +1424,7 @@
_parseErrors = AnalysisError.NO_ERRORS;
_parseErrorsState = CacheState.INVALID;
_parsedUnit = null;
+ _parsedUnitAccessed = false;
_parsedUnitState = CacheState.INVALID;
invalidateAllResolutionInformation();
}
@@ -1237,6 +1461,7 @@
_parseErrors = AnalysisError.NO_ERRORS;
_parseErrorsState = CacheState.ERROR;
_parsedUnit = null;
+ _parsedUnitAccessed = false;
_parsedUnitState = CacheState.ERROR;
_exportedLibraries = Source.EMPTY_ARRAY;
_exportedLibrariesState = CacheState.ERROR;
@@ -1336,6 +1561,7 @@
}
if (_parsedUnitState != CacheState.VALID) {
_parsedUnit = unit;
+ _parsedUnitAccessed = false;
_parsedUnitState = CacheState.VALID;
}
if (_parseErrorsState != CacheState.VALID) {
@@ -1343,7 +1569,7 @@
_parseErrorsState = CacheState.VALID;
}
}
- void setState(DataDescriptor<Object> descriptor, CacheState state) {
+ void setState(DataDescriptor descriptor, CacheState state) {
if (identical(descriptor, DartEntry.ELEMENT)) {
_element = updatedValue(state, _element, null);
_elementState = state;
@@ -1366,7 +1592,11 @@
_parseErrors = updatedValue(state, _parseErrors, AnalysisError.NO_ERRORS);
_parseErrorsState = state;
} else if (identical(descriptor, DartEntry.PARSED_UNIT)) {
- _parsedUnit = updatedValue(state, _parsedUnit, null);
+ CompilationUnit newUnit = updatedValue(state, _parsedUnit, null);
+ if (newUnit != _parsedUnit) {
+ _parsedUnitAccessed = false;
+ }
+ _parsedUnit = newUnit;
_parsedUnitState = state;
} else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) {
_publicNamespace = updatedValue(state, _publicNamespace, null);
@@ -1388,7 +1618,7 @@
* context for the data
* @param cacheState the new state of the data represented by the given descriptor
*/
- void setState2(DataDescriptor<Object> descriptor, Source librarySource, CacheState cacheState) {
+ void setState2(DataDescriptor descriptor, Source librarySource, CacheState cacheState) {
DartEntryImpl_ResolutionState state = getOrCreateResolutionState(librarySource);
if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) {
state._resolutionErrors = updatedValue(cacheState, state._resolutionErrors, AnalysisError.NO_ERRORS);
@@ -1435,6 +1665,7 @@
_parseErrorsState = CacheState.VALID;
} else if (identical(descriptor, DartEntry.PARSED_UNIT)) {
_parsedUnit = value as CompilationUnit;
+ _parsedUnitAccessed = false;
_parsedUnitState = CacheState.VALID;
} else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) {
_publicNamespace = value as Namespace;
@@ -1476,6 +1707,7 @@
_sourceKind = other._sourceKind;
_parsedUnitState = other._parsedUnitState;
_parsedUnit = other._parsedUnit;
+ _parsedUnitAccessed = other._parsedUnitAccessed;
_parseErrorsState = other._parseErrorsState;
_parseErrors = other._parseErrors;
_includedPartsState = other._includedPartsState;
@@ -1500,7 +1732,9 @@
builder.append(_sourceKindState);
builder.append("; parsedUnit = ");
builder.append(_parsedUnitState);
- builder.append("; parseErrors = ");
+ builder.append(" (");
+ builder.append(_parsedUnitAccessed ? "T" : "F");
+ builder.append("); parseErrors = ");
builder.append(_parseErrorsState);
builder.append("; exportedLibraries = ");
builder.append(_exportedLibrariesState);
@@ -1633,6 +1867,19 @@
}
/**
+ * Flush any AST structures being maintained by this state.
+ */
+ void flushAstStructures() {
+ if (identical(_resolvedUnitState, CacheState.VALID)) {
+ _resolvedUnitState = CacheState.FLUSHED;
+ _resolvedUnit = null;
+ }
+ if (_nextState != null) {
+ _nextState.flushAstStructures();
+ }
+ }
+
+ /**
* Invalidate all of the resolution information associated with the compilation unit.
*/
void invalidateAllResolutionInformation() {
@@ -1817,7 +2064,7 @@
return new List.from(errors);
}
SourceKind get kind => SourceKind.HTML;
- CacheState getState(DataDescriptor<Object> descriptor) {
+ CacheState getState(DataDescriptor descriptor) {
if (identical(descriptor, HtmlEntry.ELEMENT)) {
return _elementState;
} else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) {
@@ -1862,7 +2109,7 @@
_hints = AnalysisError.NO_ERRORS;
_hintsState = CacheState.INVALID;
}
- void setState(DataDescriptor<Object> descriptor, CacheState state) {
+ void setState(DataDescriptor descriptor, CacheState state) {
if (identical(descriptor, HtmlEntry.ELEMENT)) {
_element = updatedValue(state, _element, null);
_elementState = state;
@@ -1966,7 +2213,7 @@
* @param descriptor the descriptor representing the data whose state is to be returned
* @return the state of the data represented by the given descriptor
*/
- CacheState getState(DataDescriptor<Object> descriptor);
+ CacheState getState(DataDescriptor descriptor);
/**
* Return the value of the data represented by the given descriptor, or `null` if the data
@@ -2010,7 +2257,7 @@
*/
LineInfo _lineInfo;
int get modificationTime => _modificationTime;
- CacheState getState(DataDescriptor<Object> descriptor) {
+ CacheState getState(DataDescriptor descriptor) {
if (identical(descriptor, SourceEntry.LINE_INFO)) {
return _lineInfoState;
} else {
@@ -2041,7 +2288,7 @@
* @param descriptor the descriptor representing the data whose state is to be set
* @param the new state of the data represented by the given descriptor
*/
- void setState(DataDescriptor<Object> descriptor, CacheState state) {
+ void setState(DataDescriptor descriptor, CacheState state) {
if (identical(descriptor, SourceEntry.LINE_INFO)) {
_lineInfo = updatedValue(state, _lineInfo, null);
_lineInfoState = state;
@@ -2121,7 +2368,7 @@
Iterable<AnalysisContentStatistics_CacheRow> items = _dataMap.values;
return new List.from(items);
}
- void putCacheItem(DataDescriptor<Object> rowDesc, CacheState state) {
+ void putCacheItem(DataDescriptor rowDesc, CacheState state) {
String rowName = rowDesc.toString();
AnalysisContentStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as AnalysisContentStatisticsImpl_CacheRowImpl;
if (row == null) {
@@ -2178,7 +2425,7 @@
* Helper for [getStatistics], puts the library-specific state into the given statistics
* object.
*/
- static void putStatCacheItem(AnalysisContentStatisticsImpl statistics, DartEntry dartEntry, Source librarySource, DataDescriptor<Object> key) {
+ static void putStatCacheItem(AnalysisContentStatisticsImpl statistics, DartEntry dartEntry, Source librarySource, DataDescriptor key) {
statistics.putCacheItem(key, dartEntry.getState2(key, librarySource));
}
@@ -2186,7 +2433,7 @@
* Helper for [getStatistics], puts the library independent state into the given
* statistics object.
*/
- static void putStatCacheItem2(AnalysisContentStatisticsImpl statistics, SourceEntry entry, DataDescriptor<Object> key) {
+ static void putStatCacheItem2(AnalysisContentStatisticsImpl statistics, SourceEntry entry, DataDescriptor key) {
statistics.putCacheItem(key, entry.getState(key));
}
@@ -2380,7 +2627,7 @@
return SourceKind.UNKNOWN;
} else if (sourceEntry is DartEntry) {
try {
- return internalGetDartParseData(source, (sourceEntry as DartEntry), DartEntry.SOURCE_KIND);
+ return internalGetDartParseData(source, sourceEntry as DartEntry, DartEntry.SOURCE_KIND);
} on AnalysisException catch (exception) {
return SourceKind.UNKNOWN;
}
@@ -2418,22 +2665,28 @@
}
return null;
}
- CompilationUnit computeResolvableCompilationUnit(Source source) {
- DartEntry dartEntry = getReadableDartEntry(source);
- if (dartEntry == null) {
- return null;
- }
- CompilationUnit unit = dartEntry.anyParsedCompilationUnit;
- if (unit == null) {
- try {
- unit = parseCompilationUnit(source);
- } on AnalysisException catch (exception) {
- return null;
+ ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) {
+ while (true) {
+ {
+ SourceEntry sourceEntry = getSourceEntry(source);
+ if (sourceEntry is! DartEntry) {
+ throw new AnalysisException.con1("computeResolvableCompilationUnit for non-Dart: ${source.fullName}");
+ }
+ DartEntry dartEntry = sourceEntry as DartEntry;
+ if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.ERROR)) {
+ throw new AnalysisException.con1("Internal error: computeResolvableCompilationUnit could not parse ${source.fullName}");
+ }
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ CompilationUnit unit = dartCopy.resolvableCompilationUnit;
+ if (unit != null) {
+ _sourceMap[source] = dartCopy;
+ return new ResolvableCompilationUnit(dartCopy.modificationTime, unit);
+ }
}
+ internalParseDart(source);
}
- return unit.accept(new ASTCloner()) as CompilationUnit;
}
- AnalysisContext extractContext(SourceContainer container) => extractContextInto(container, (AnalysisEngine.instance.createAnalysisContext() as InternalAnalysisContext));
+ AnalysisContext extractContext(SourceContainer container) => extractContextInto(container, AnalysisEngine.instance.createAnalysisContext() as InternalAnalysisContext);
InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) {
List<Source> sourcesToRemove = new List<Source>();
{
@@ -2733,6 +2986,12 @@
return false;
}
void mergeContext(AnalysisContext context) {
+ if (context is InstrumentedAnalysisContextImpl) {
+ context = ((context as InstrumentedAnalysisContextImpl)).basis;
+ }
+ if (context is! AnalysisContextImpl) {
+ return;
+ }
{
for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(((context as AnalysisContextImpl))._sourceMap)) {
Source newSource = entry.getKey();
@@ -2812,7 +3071,8 @@
Source coreLibrarySource = libraryElement.context.sourceFactory.forUri(DartSdk.DART_CORE);
LibraryElement coreElement = computeLibraryElement(coreLibrarySource);
TypeProvider typeProvider = new TypeProviderImpl(coreElement);
- CompilationUnit unitAST = computeResolvableCompilationUnit(unitSource);
+ ResolvableCompilationUnit resolvableUnit = computeResolvableCompilationUnit(unitSource);
+ CompilationUnit unitAST = resolvableUnit.compilationUnit;
new DeclarationResolver().resolve(unitAST, find(libraryElement, unitSource));
RecordingErrorListener errorListener = new RecordingErrorListener();
TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor.con2(libraryElement, unitSource, typeProvider, errorListener);
@@ -2820,6 +3080,11 @@
InheritanceManager inheritanceManager = new InheritanceManager(libraryElement);
ResolverVisitor resolverVisitor = new ResolverVisitor.con2(libraryElement, unitSource, typeProvider, inheritanceManager, errorListener);
unitAST.accept(resolverVisitor);
+ for (ProxyConditionalAnalysisError conditionalCode in resolverVisitor.proxyConditionalAnalysisErrors) {
+ if (conditionalCode.shouldIncludeErrorCode()) {
+ resolverVisitor.reportError(conditionalCode.analysisError);
+ }
+ }
ErrorReporter errorReporter = new ErrorReporter(errorListener, unitSource);
ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, libraryElement, typeProvider, inheritanceManager);
unitAST.accept(errorVerifier);
@@ -3332,8 +3597,8 @@
* @param descriptor the descriptor representing the data to be returned
* @return a cache entry containing the required data
*/
- bool hasHtmlParseDataCached(HtmlEntry htmlEntry, List<DataDescriptor<Object>> descriptors) {
- for (DataDescriptor<Object> descriptor in descriptors) {
+ bool hasHtmlParseDataCached(HtmlEntry htmlEntry, List<DataDescriptor> descriptors) {
+ for (DataDescriptor descriptor in descriptors) {
CacheState state = htmlEntry.getState(descriptor);
if (state != CacheState.VALID && state != CacheState.ERROR) {
return false;
@@ -3354,7 +3619,7 @@
* @throws AnalysisException if data could not be returned because the source could not be
* resolved
*/
- DartEntry internalCacheDartParseData(Source source, DartEntry dartEntry, DataDescriptor<Object> descriptor) {
+ DartEntry internalCacheDartParseData(Source source, DartEntry dartEntry, DataDescriptor descriptor) {
CacheState state = dartEntry.getState(descriptor);
while (state != CacheState.ERROR && state != CacheState.VALID) {
dartEntry = internalParseDart(source);
@@ -3376,7 +3641,7 @@
* @return the requested data about the given source
* @throws AnalysisException if data could not be returned because the source could not be parsed
*/
- DartEntry internalCacheDartResolutionData(Source unitSource, Source librarySource, DartEntry dartEntry, DataDescriptor<Object> descriptor) {
+ DartEntry internalCacheDartResolutionData(Source unitSource, Source librarySource, DartEntry dartEntry, DataDescriptor descriptor) {
CacheState state = dartEntry.getState2(descriptor, librarySource);
while (state != CacheState.ERROR && state != CacheState.VALID) {
dartEntry = internalResolveDart(unitSource, librarySource);
@@ -3397,7 +3662,7 @@
* @throws AnalysisException if data could not be returned because the source could not be
* resolved
*/
- HtmlEntry internalCacheHtmlParseData(Source source, HtmlEntry htmlEntry, List<DataDescriptor<Object>> descriptors) {
+ HtmlEntry internalCacheHtmlParseData(Source source, HtmlEntry htmlEntry, List<DataDescriptor> descriptors) {
while (!hasHtmlParseDataCached(htmlEntry, descriptors)) {
htmlEntry = internalParseHtml(source);
}
@@ -3537,19 +3802,19 @@
Set<Source> includedSources = new Set<Source>();
for (Directive directive in unit.directives) {
if (directive is ExportDirective) {
- Source exportSource = resolveSource(source, (directive as ExportDirective));
+ Source exportSource = resolveSource(source, directive as ExportDirective);
if (exportSource != null) {
javaSetAdd(exportedSources, exportSource);
}
} else if (directive is ImportDirective) {
- Source importSource = resolveSource(source, (directive as ImportDirective));
+ Source importSource = resolveSource(source, directive as ImportDirective);
if (importSource != null) {
javaSetAdd(importedSources, importSource);
}
} else if (directive is LibraryDirective) {
hasLibraryDirective = true;
} else if (directive is PartDirective) {
- Source partSource = resolveSource(source, (directive as PartDirective));
+ Source partSource = resolveSource(source, directive as PartDirective);
if (partSource != null) {
javaSetAdd(includedSources, partSource);
}
@@ -3572,7 +3837,7 @@
dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, toArray(exportedSources));
dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, toArray(importedSources));
dartCopy.setValue(DartEntry.INCLUDED_PARTS, toArray(includedSources));
- return unit;
+ return dartCopy.getValue(DartEntry.PARSED_UNIT);
} on AnalysisException catch (exception) {
dartCopy.setState(SourceEntry.LINE_INFO, CacheState.ERROR);
dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.ERROR);
@@ -3613,19 +3878,19 @@
errors = errorListener.getErrors2(source);
for (Directive directive in unit.directives) {
if (directive is ExportDirective) {
- Source exportSource = resolveSource(source, (directive as ExportDirective));
+ Source exportSource = resolveSource(source, directive as ExportDirective);
if (exportSource != null) {
javaSetAdd(exportedSources, exportSource);
}
} else if (directive is ImportDirective) {
- Source importSource = resolveSource(source, (directive as ImportDirective));
+ Source importSource = resolveSource(source, directive as ImportDirective);
if (importSource != null) {
javaSetAdd(importedSources, importSource);
}
} else if (directive is LibraryDirective) {
hasLibraryDirective = true;
} else if (directive is PartDirective) {
- Source partSource = resolveSource(source, (directive as PartDirective));
+ Source partSource = resolveSource(source, directive as PartDirective);
if (partSource != null) {
javaSetAdd(includedSources, partSource);
}
@@ -3809,7 +4074,7 @@
}
resultTime = htmlEntry.modificationTime;
HtmlUnitBuilder builder = new HtmlUnitBuilder(this);
- element = builder.buildHtmlElement2(source, unit);
+ element = builder.buildHtmlElement2(source, resultTime, unit);
resolutionErrors = builder.errorListener.getErrors2(source);
} on AnalysisException catch (exception) {
thrownException = exception;
@@ -4124,7 +4389,7 @@
return null;
}
String uriContent = uriLiteral.stringValue.trim();
- if (uriContent == null) {
+ if (uriContent == null || uriContent.isEmpty) {
return null;
}
uriContent = Uri.encodeFull(uriContent);
@@ -4167,7 +4432,9 @@
try {
parseHtmlUnit(source);
} on AnalysisException catch (exception) {
- AnalysisEngine.instance.logger.logError2("Could not parse ${source.fullName}", exception);
+ if (exception.cause is! JavaIOException) {
+ AnalysisEngine.instance.logger.logError2("Could not parse ${source.fullName}", exception);
+ }
}
}
@@ -4515,21 +4782,25 @@
if (javaStringEqualsIgnoreCase(attribute.name.lexeme, AnalysisContextImpl._ATTRIBUTE_SRC)) {
scriptAttribute = attribute;
} else if (javaStringEqualsIgnoreCase(attribute.name.lexeme, AnalysisContextImpl._ATTRIBUTE_TYPE)) {
- if (javaStringEqualsIgnoreCase(attribute.text, AnalysisContextImpl._TYPE_DART)) {
+ String text = attribute.text;
+ if (text != null && javaStringEqualsIgnoreCase(text, AnalysisContextImpl._TYPE_DART)) {
isDartScript = true;
}
}
}
if (isDartScript && scriptAttribute != null) {
- try {
- Uri uri = new Uri(path: scriptAttribute.text);
- String fileName = uri.path;
- Source librarySource = AnalysisContextImpl_this._sourceFactory.resolveUri(htmlSource, fileName);
- if (librarySource.exists()) {
- libraries.add(librarySource);
+ String text = scriptAttribute.text;
+ if (text != null) {
+ try {
+ Uri uri = new Uri(path: text);
+ String fileName = uri.path;
+ Source librarySource = AnalysisContextImpl_this._sourceFactory.resolveUri(htmlSource, fileName);
+ if (librarySource != null && librarySource.exists()) {
+ libraries.add(librarySource);
+ }
+ } catch (exception) {
+ AnalysisEngine.instance.logger.logInformation2("Invalid URI ('${text}') in script tag in '${htmlSource.fullName}'", exception);
}
- } catch (exception) {
- AnalysisEngine.instance.logger.logInformation2("Invalid URL ('${scriptAttribute.text}') in script tag in '${htmlSource.fullName}'", exception);
}
}
}
@@ -4606,7 +4877,7 @@
* A flag indicating whether analysis is to use strict mode. In strict mode, error reporting is
* based exclusively on the static type information.
*/
- bool _strictMode = false;
+ bool _strictMode = true;
/**
* A flag indicating whether analysis is to generate hint results (e.g. type inference based
@@ -4646,7 +4917,7 @@
/**
* The enumeration `CacheState` defines the possible states of cached data.
*/
-class CacheState implements Enum<CacheState> {
+class CacheState extends Enum<CacheState> {
/**
* The data is not in the cache and the last time an attempt was made to compute the data an
@@ -4703,16 +4974,7 @@
*/
static final CacheState VALID = new CacheState('VALID', 4);
static final List<CacheState> values = [ERROR, FLUSHED, IN_PROCESS, INVALID, VALID];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- CacheState(this.name, this.ordinal);
- int compareTo(CacheState other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ CacheState(String name, int ordinal) : super(name, ordinal);
}
/**
* Instances of the class `ChangeNoticeImpl` represent a change to the analysis results
@@ -4883,7 +5145,7 @@
return super.computeLineInfo(source);
}
}
- CompilationUnit computeResolvableCompilationUnit(Source source) {
+ ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) {
if (source.isInSystemLibrary) {
return _sdkAnalysisContext.computeResolvableCompilationUnit(source);
} else {
@@ -5196,7 +5458,7 @@
instrumentation.log();
}
}
- CompilationUnit computeResolvableCompilationUnit(Source source) => _basis.computeResolvableCompilationUnit(source);
+ ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _basis.computeResolvableCompilationUnit(source);
AnalysisContext extractContext(SourceContainer container) {
InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-extractContext");
try {
@@ -5599,7 +5861,7 @@
* @return the AST structure representing the content of the source
* @throws AnalysisException if the analysis could not be performed
*/
- CompilationUnit computeResolvableCompilationUnit(Source source);
+ ResolvableCompilationUnit computeResolvableCompilationUnit(Source source);
/**
* Initialize the specified context by removing the specified sources from the receiver and adding
@@ -5786,7 +6048,7 @@
}
Object visitSimpleIdentifier(SimpleIdentifier node) {
node.staticElement = null;
- node.element = null;
+ node.propagatedElement = null;
return super.visitSimpleIdentifier(node);
}
Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
@@ -5796,6 +6058,48 @@
}
}
/**
+ * Instances of the class `ResolvableCompilationUnit` represent a compilation unit that is not
+ * referenced by any other objects and for which we have modification stamp information. It is used
+ * by the [LibraryResolver] to resolve a library.
+ */
+class ResolvableCompilationUnit {
+
+ /**
+ * The modification time of the source from which the AST was created.
+ */
+ int _modificationStamp = 0;
+
+ /**
+ * The AST that was created from the source.
+ */
+ CompilationUnit _unit;
+
+ /**
+ * Initialize a newly created holder to hold the given values.
+ *
+ * @param modificationStamp the modification time of the source from which the AST was created
+ * @param unit the AST that was created from the source
+ */
+ ResolvableCompilationUnit(int modificationStamp, CompilationUnit unit) {
+ this._modificationStamp = modificationStamp;
+ this._unit = unit;
+ }
+
+ /**
+ * Return the AST that was created from the source.
+ *
+ * @return the AST that was created from the source
+ */
+ CompilationUnit get compilationUnit => _unit;
+
+ /**
+ * Return the modification time of the source from which the AST was created.
+ *
+ * @return the modification time of the source from which the AST was created
+ */
+ int get modificationStamp => _modificationStamp;
+}
+/**
* The interface `Logger` defines the behavior of objects that can be used to receive
* information about errors within the analysis engine. Implementations usually write this
* information to a file, but can also record the information for later use (such as during testing)
diff --git a/pkg/analyzer_experimental/lib/src/generated/error.dart b/pkg/analyzer_experimental/lib/src/generated/error.dart
index 22e3162..5dfba2f 100644
--- a/pkg/analyzer_experimental/lib/src/generated/error.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/error.dart
@@ -11,7 +11,7 @@
*
* @coverage dart.engine.error
*/
-class ErrorSeverity implements Enum<ErrorSeverity> {
+class ErrorSeverity extends Enum<ErrorSeverity> {
/**
* The severity representing a non-error. This is never used for any error code, but is useful for
@@ -37,12 +37,6 @@
static final ErrorSeverity ERROR = new ErrorSeverity('ERROR', 3, "E", "error");
static final List<ErrorSeverity> values = [NONE, SUGGESTION, WARNING, ERROR];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The name of the severity used when producing machine output.
*/
@@ -59,7 +53,7 @@
* @param machineCode the name of the severity used when producing machine output
* @param displayName the name of the severity used when producing readable output
*/
- ErrorSeverity(this.name, this.ordinal, String machineCode, String displayName) {
+ ErrorSeverity(String name, int ordinal, String machineCode, String displayName) : super(name, ordinal) {
this._machineCode = machineCode;
this._displayName = displayName;
}
@@ -85,9 +79,6 @@
* @return the most sever of this or the given severity
*/
ErrorSeverity max(ErrorSeverity severity) => this.ordinal >= severity.ordinal ? this : severity;
- int compareTo(ErrorSeverity other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* Instances of the class `AnalysisErrorWithProperties`
@@ -283,6 +274,12 @@
String _message;
/**
+ * The correction to be displayed for this error, or `null` if there is no correction
+ * information for this error.
+ */
+ String _correction;
+
+ /**
* The source in which the error occurred, or `null` if unknown.
*/
Source _source;
@@ -299,6 +296,12 @@
int _length = 0;
/**
+ * A flag indicating whether this error can be shown to be a non-issue because of the result of
+ * type propagation.
+ */
+ bool _isStaticOnly2 = false;
+
+ /**
* Initialize a newly created analysis error for the specified source. The error has no location
* information.
*
@@ -327,9 +330,21 @@
this._length = length;
this._errorCode = errorCode;
this._message = JavaString.format(errorCode.message, arguments);
+ String correctionTemplate = errorCode.correction;
+ if (correctionTemplate != null) {
+ this._correction = JavaString.format(correctionTemplate, arguments);
+ }
}
/**
+ * Return the correction to be displayed for this error, or `null` if there is no correction
+ * information for this error. The correction should indicate how the user can fix the error.
+ *
+ * @return the template used to create the correction to be displayed for this error
+ */
+ String get correction => _correction;
+
+ /**
* Return the error code associated with the error.
*
* @return the error code associated with the error
@@ -345,9 +360,10 @@
int get length => _length;
/**
- * Return the localized error message.
+ * Return the message to be displayed for this error. The message should indicate what is wrong
+ * and why it is wrong.
*
- * @return the localized error message
+ * @return the message to be displayed for this error
*/
String get message => _message;
@@ -382,6 +398,24 @@
}
/**
+ * Return `true` if this error can be shown to be a non-issue because of the result of type
+ * propagation.
+ *
+ * @return `true` if this error can be shown to be a non-issue
+ */
+ bool get isStaticOnly => _isStaticOnly2;
+
+ /**
+ * Set whether this error can be shown to be a non-issue because of the result of type propagation
+ * to the given value.
+ *
+ * @param isStaticOnly `true` if this error can be shown to be a non-issue
+ */
+ void set isStaticOnly(bool isStaticOnly2) {
+ this._isStaticOnly2 = isStaticOnly2;
+ }
+
+ /**
* Set the source in which the error occurred to the given source.
*
* @param source the source in which the error occurred
@@ -405,7 +439,7 @@
* The enumeration `ErrorProperty` defines the properties that can be associated with an
* [AnalysisError].
*/
-class ErrorProperty implements Enum<ErrorProperty> {
+class ErrorProperty extends Enum<ErrorProperty> {
/**
* A property whose value is an array of [ExecutableElement] that should
@@ -413,34 +447,25 @@
*/
static final ErrorProperty UNIMPLEMENTED_METHODS = new ErrorProperty('UNIMPLEMENTED_METHODS', 0);
static final List<ErrorProperty> values = [UNIMPLEMENTED_METHODS];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- ErrorProperty(this.name, this.ordinal);
- int compareTo(ErrorProperty other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ ErrorProperty(String name, int ordinal) : super(name, ordinal);
}
/**
* The enumeration `HintCode` defines the hints and coding recommendations for best practices
* which are not mentioned in the Dart Language Specification.
*/
-class HintCode implements Enum<HintCode>, ErrorCode {
+class HintCode extends Enum<HintCode> implements ErrorCode {
/**
* Dead code is code that is never reached, this can happen for instance if a statement follows a
* return statement.
*/
- static final HintCode DEAD_CODE = new HintCode('DEAD_CODE', 0, "Dead code");
+ static final HintCode DEAD_CODE = new HintCode.con1('DEAD_CODE', 0, "Dead code");
/**
* Dead code is code that is never reached. This case covers cases where the user has catch
* clauses after `catch (e)` or `on Object catch (e)`.
*/
- static final HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = new HintCode('DEAD_CODE_CATCH_FOLLOWING_CATCH', 1, "Dead code, catch clauses after a 'catch (e)' or an 'on Object catch (e)' are never reached");
+ static final HintCode DEAD_CODE_CATCH_FOLLOWING_CATCH = new HintCode.con1('DEAD_CODE_CATCH_FOLLOWING_CATCH', 1, "Dead code, catch clauses after a 'catch (e)' or an 'on Object catch (e)' are never reached");
/**
* Dead code is code that is never reached. This case covers cases where the user has an on-catch
@@ -449,53 +474,75 @@
* @param subtypeName name of the subtype
* @param supertypeName name of the supertype
*/
- static final HintCode DEAD_CODE_ON_CATCH_SUBTYPE = new HintCode('DEAD_CODE_ON_CATCH_SUBTYPE', 2, "Dead code, this on-catch block will never be executed since '%s' is a subtype of '%s'");
+ static final HintCode DEAD_CODE_ON_CATCH_SUBTYPE = new HintCode.con1('DEAD_CODE_ON_CATCH_SUBTYPE', 2, "Dead code, this on-catch block will never be executed since '%s' is a subtype of '%s'");
/**
* Unused imports are imports which are never not used.
*/
- static final HintCode UNUSED_IMPORT = new HintCode('UNUSED_IMPORT', 3, "Unused import");
+ static final HintCode UNUSED_IMPORT = new HintCode.con1('UNUSED_IMPORT', 3, "Unused import");
static final List<HintCode> values = [
DEAD_CODE,
DEAD_CODE_CATCH_FOLLOWING_CATCH,
DEAD_CODE_ON_CATCH_SUBTYPE,
UNUSED_IMPORT];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction3;
+
+ /**
* Initialize a newly created error code to have the given message.
*
* @param message the message template used to create the message to be displayed for the error
*/
- HintCode(this.name, this.ordinal, String message) {
+ HintCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given message and correction.
+ *
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ HintCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
+ this._message = message;
+ this.correction3 = correction;
+ }
+ String get correction => correction3;
ErrorSeverity get errorSeverity => ErrorType.HINT.severity;
String get message => _message;
ErrorType get type => ErrorType.HINT;
- int compareTo(HintCode other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* The interface `ErrorCode` defines the behavior common to objects representing error codes
* associated with [AnalysisError].
*
+ * Generally, we want to provide messages that consist of three sentences: 1. what is wrong, 2. why
+ * is it wrong, and 3. how do I fix it. However, we combine the first two in the result of
+ * [getMessage] and the last in the result of [getCorrection].
+ *
* @coverage dart.engine.error
*/
abstract class ErrorCode {
/**
+ * Return the template used to create the correction to be displayed for this error, or
+ * `null` if there is no correction information for this error. The correction should
+ * indicate how the user can fix the error.
+ *
+ * @return the template used to create the correction to be displayed for this error
+ */
+ String get correction;
+
+ /**
* Return the severity of this error.
*
* @return the severity of this error
@@ -503,9 +550,10 @@
ErrorSeverity get errorSeverity;
/**
- * Return the message template used to create the message to be displayed for this error.
+ * Return the template used to create the message to be displayed for this error. The message
+ * should indicate what is wrong and why it is wrong.
*
- * @return the message template used to create the message to be displayed for this error
+ * @return the template used to create the message to be displayed for this error
*/
String get message;
@@ -521,7 +569,7 @@
*
* @coverage dart.engine.error
*/
-class ErrorType implements Enum<ErrorType> {
+class ErrorType extends Enum<ErrorType> {
/**
* Extra analysis run over the code to follow best practices, which are not in the Dart Language
@@ -565,12 +613,6 @@
STATIC_TYPE_WARNING,
SYNTACTIC_ERROR];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The severity of this type of error.
*/
@@ -581,7 +623,7 @@
*
* @param severity the severity of this type of error
*/
- ErrorType(this.name, this.ordinal, ErrorSeverity severity) {
+ ErrorType(String name, int ordinal, ErrorSeverity severity) : super(name, ordinal) {
this._severity = severity;
}
@@ -591,9 +633,6 @@
* @return the severity of this type of error
*/
ErrorSeverity get severity => _severity;
- int compareTo(ErrorType other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* The enumeration `CompileTimeErrorCode` defines the error codes used for compile time
@@ -603,7 +642,7 @@
*
* @coverage dart.engine.error
*/
-class CompileTimeErrorCode implements Enum<CompileTimeErrorCode>, ErrorCode {
+class CompileTimeErrorCode extends Enum<CompileTimeErrorCode> implements ErrorCode {
/**
* 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported by a library
@@ -614,7 +653,7 @@
* @param firstLibraryName the name of the first library that the type is found
* @param secondLibraryName the name of the second library that the type is found
*/
- static final CompileTimeErrorCode AMBIGUOUS_EXPORT = new CompileTimeErrorCode('AMBIGUOUS_EXPORT', 0, "The element '%s' is defined in the libraries '%s' and '%s'");
+ static final CompileTimeErrorCode AMBIGUOUS_EXPORT = new CompileTimeErrorCode.con1('AMBIGUOUS_EXPORT', 0, "The element '%s' is defined in the libraries '%s' and '%s'");
/**
* 12.33 Argument Definition Test: It is a compile time error if <i>v</i> does not denote a formal
@@ -622,7 +661,7 @@
*
* @param the name of the identifier in the argument definition test that is not a parameter
*/
- static final CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = new CompileTimeErrorCode('ARGUMENT_DEFINITION_TEST_NON_PARAMETER', 1, "'%s' is not a parameter");
+ static final CompileTimeErrorCode ARGUMENT_DEFINITION_TEST_NON_PARAMETER = new CompileTimeErrorCode.con1('ARGUMENT_DEFINITION_TEST_NON_PARAMETER', 1, "'%s' is not a parameter");
/**
* 12.14.2 Binding Actuals to Formals: In checked mode, it is a dynamic type error if
@@ -635,57 +674,57 @@
* @param requiredCount the maximum number of positional arguments
* @param argumentCount the actual number of positional arguments given
*/
- static final CompileTimeErrorCode ARGUMENT_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode('ARGUMENT_TYPE_NOT_ASSIGNABLE', 2, "The argument type '%s' cannot be assigned to the parameter type '%s'");
+ static final CompileTimeErrorCode ARGUMENT_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode.con1('ARGUMENT_TYPE_NOT_ASSIGNABLE', 2, "The argument type '%s' cannot be assigned to the parameter type '%s'");
/**
* 12.30 Identifier Reference: It is a compile-time error to use a built-in identifier other than
* dynamic as a type annotation.
*/
- static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE', 3, "The built-in identifier '%s' cannot be as a type");
+ static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = new CompileTimeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPE', 3, "The built-in identifier '%s' cannot be as a type");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in identifier is used as the
* declared name of a class, type parameter or type alias.
*/
- static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', 4, "The built-in identifier '%s' cannot be used as a type name");
+ static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = new CompileTimeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', 4, "The built-in identifier '%s' cannot be used as a type name");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in identifier is used as the
* declared name of a class, type parameter or type alias.
*/
- static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', 5, "The built-in identifier '%s' cannot be used as a type alias name");
+ static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = new CompileTimeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', 5, "The built-in identifier '%s' cannot be used as a type alias name");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in identifier is used as the
* declared name of a class, type parameter or type alias.
*/
- static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME', 6, "The built-in identifier '%s' cannot be used as a type variable name");
+ static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME = new CompileTimeErrorCode.con1('BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME', 6, "The built-in identifier '%s' cannot be used as a type variable name");
/**
* 13.9 Switch: It is a compile-time error if the class <i>C</i> implements the operator
* <i>==</i>.
*/
- static final CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = new CompileTimeErrorCode('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', 7, "The switch case expression type '%s' cannot override the == operator");
+ static final CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = new CompileTimeErrorCode.con1('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', 7, "The switch case expression type '%s' cannot override the == operator");
/**
* 12.1 Constants: It is a compile-time error if evaluation of a compile-time constant would raise
* an exception.
*/
- static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = new CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', 8, "");
+ static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = new CompileTimeErrorCode.con1('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', 8, "");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
* name. This restriction holds regardless of whether the getter is defined explicitly or
* implicitly, or whether the getter or the method are inherited or not.
*/
- static final CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD = new CompileTimeErrorCode('CONFLICTING_GETTER_AND_METHOD', 9, "Class '%s' cannot have both getter '%s.%s' and method with the same name");
+ static final CompileTimeErrorCode CONFLICTING_GETTER_AND_METHOD = new CompileTimeErrorCode.con1('CONFLICTING_GETTER_AND_METHOD', 9, "Class '%s' cannot have both getter '%s.%s' and method with the same name");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
* name. This restriction holds regardless of whether the getter is defined explicitly or
* implicitly, or whether the getter or the method are inherited or not.
*/
- static final CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER = new CompileTimeErrorCode('CONFLICTING_METHOD_AND_GETTER', 10, "Class '%s' cannot have both method '%s.%s' and getter with the same name");
+ static final CompileTimeErrorCode CONFLICTING_METHOD_AND_GETTER = new CompileTimeErrorCode.con1('CONFLICTING_METHOD_AND_GETTER', 10, "Class '%s' cannot have both method '%s.%s' and getter with the same name");
/**
* 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
@@ -693,7 +732,7 @@
* compile-time error if <i>id</i> is the name of a member declared in the immediately enclosing
* class.
*/
- static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', 11, "'%s' cannot be used to name a constructor and a field in this class");
+ static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD = new CompileTimeErrorCode.con1('CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD', 11, "'%s' cannot be used to name a constructor and a field in this class");
/**
* 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
@@ -701,13 +740,20 @@
* compile-time error if <i>id</i> is the name of a member declared in the immediately enclosing
* class.
*/
- static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', 12, "'%s' cannot be used to name a constructor and a method in this class");
+ static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD = new CompileTimeErrorCode.con1('CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD', 12, "'%s' cannot be used to name a constructor and a method in this class");
/**
* 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_CONSTRUCTOR_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION', 13, "'const' constructors cannot throw exceptions");
+ static final CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = new CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_THROWS_EXCEPTION', 13, "'const' constructors cannot throw exceptions");
+
+ /**
+ * 7.6.3 Constant Constructors: The superinitializer that appears, explicitly or implicitly, in
+ * the initializer list of a constant constructor must specify a constant constructor of the
+ * superclass of the immediately enclosing class or a compile-time error occurs.
+ */
+ static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER = new CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER', 14, "Constant constructor cannot call non-constant super constructor");
/**
* 7.6.3 Constant Constructors: It is a compile-time error if a constant constructor is declared
@@ -715,7 +761,7 @@
*
* The above refers to both locally declared and inherited instance variables.
*/
- static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = new CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 14, "Cannot define the 'const' constructor for a class with non-final fields");
+ static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = new CompileTimeErrorCode.con1('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 15, "Cannot define the 'const' constructor for a class with non-final fields");
/**
* 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error if o is not
@@ -728,63 +774,63 @@
* @param initializerType the name of the type of the initializer expression
* @param fieldType the name of the type of the field
*/
- static final CompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = new CompileTimeErrorCode('CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', 15, "The initializer type '%s' cannot be assigned to the field type '%s'");
+ static final CompileTimeErrorCode CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE = new CompileTimeErrorCode.con1('CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE', 16, "The initializer type '%s' cannot be assigned to the field type '%s'");
/**
* 6.2 Formal Parameters: It is a compile-time error if a formal parameter is declared as a
* constant variable.
*/
- static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErrorCode('CONST_FORMAL_PARAMETER', 16, "Parameters cannot be 'const'");
+ static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErrorCode.con1('CONST_FORMAL_PARAMETER', 17, "Parameters cannot be 'const'");
/**
* 5 Variables: A constant variable must be initialized to a compile-time constant or a
* compile-time error occurs.
*/
- static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 17, "'const' variables must be constant value");
+ static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode.con1('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 18, "'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', 18, "Only static fields can be declared as 'const'");
+ static final CompileTimeErrorCode CONST_INSTANCE_FIELD = new CompileTimeErrorCode.con1('CONST_INSTANCE_FIELD', 19, "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', 19, "An expression of type 'bool' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = new CompileTimeErrorCode.con1('CONST_EVAL_TYPE_BOOL', 20, "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', 20, "An expression of type 'bool', 'num', 'String' or 'null' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = new CompileTimeErrorCode.con1('CONST_EVAL_TYPE_BOOL_NUM_STRING', 21, "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', 21, "An expression of type 'int' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_INT = new CompileTimeErrorCode.con1('CONST_EVAL_TYPE_INT', 22, "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', 22, "An expression of type 'num' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_NUM = new CompileTimeErrorCode.con1('CONST_EVAL_TYPE_NUM', 23, "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', 23, "Evaluation of this constant expression causes exception");
+ static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode.con1('CONST_EVAL_THROWS_EXCEPTION', 24, "Evaluation of this constant expression causes exception");
/**
* 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_IDBZE = new CompileTimeErrorCode('CONST_EVAL_THROWS_IDBZE', 24, "Evaluation of this constant expression throws IntegerDivisionByZeroException");
+ static final CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = new CompileTimeErrorCode.con1('CONST_EVAL_THROWS_IDBZE', 25, "Evaluation of this constant expression throws IntegerDivisionByZeroException");
/**
* 12.11.2 Const: If <i>T</i> is a parameterized type <i>S<U<sub>1</sub>, …,
@@ -797,7 +843,7 @@
* @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS
* @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS
*/
- static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 25, "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.con1('CONST_WITH_INVALID_TYPE_PARAMETERS', 26, "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>,
@@ -805,13 +851,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', 26, "The constructor being called is not a 'const' constructor");
+ static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode.con1('CONST_WITH_NON_CONST', 27, "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', 27, "Arguments of a constant creation must be constant expressions");
+ static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new CompileTimeErrorCode.con1('CONST_WITH_NON_CONSTANT_ARGUMENT', 28, "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
@@ -824,12 +870,12 @@
*
* @param name the name of the non-type element
*/
- static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 28, "The name '%s' is not a class");
+ static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode.con1('CONST_WITH_NON_TYPE', 29, "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', 29, "The constant creation cannot use a type parameter");
+ static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode.con1('CONST_WITH_TYPE_PARAMETERS', 30, "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
@@ -838,7 +884,7 @@
* @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', 30, "The class '%s' does not have a constant constructor '%s'");
+ static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR', 31, "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
@@ -846,19 +892,26 @@
*
* @param typeName the name of the type
*/
- static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 31, "The class '%s' does not have a default constant constructor");
+ static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode.con1('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 32, "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', 32, "Default values aren't allowed in typedefs");
+ static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 33, "Default values aren't allowed in typedefs");
+
+ /**
+ * 6.2.1 Required Formals: By means of a function signature that names the parameter and describes
+ * its type as a function type. It is a compile-time error if any default values are specified in
+ * the signature of such a function type.
+ */
+ static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER = new CompileTimeErrorCode.con1('DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER', 34, "Default values aren't allowed in function type parameters");
/**
* 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', 33, "The default constructor is already defined");
+ static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode.con1('DUPLICATE_CONSTRUCTOR_DEFAULT', 35, "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
@@ -866,7 +919,7 @@
*
* @param duplicateName the name of the duplicate entity
*/
- static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME', 34, "The constructor with name '%s' is already defined");
+ static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = new CompileTimeErrorCode.con1('DUPLICATE_CONSTRUCTOR_NAME', 36, "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
@@ -879,7 +932,7 @@
*
* @param duplicateName the name of the duplicate entity
*/
- static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 35, "The name '%s' is already defined");
+ static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode.con1('DUPLICATE_DEFINITION', 37, "The name '%s' is already defined");
/**
* 7. Classes: It is a compile-time error if a class has an instance member and a static member
@@ -891,21 +944,21 @@
* @param name the name of the conflicting members
* @see #DUPLICATE_DEFINITION
*/
- static final CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = new CompileTimeErrorCode('DUPLICATE_DEFINITION_INHERITANCE', 36, "The name '%s' is already defined in '%s'");
+ static final CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = new CompileTimeErrorCode.con1('DUPLICATE_DEFINITION_INHERITANCE', 38, "The name '%s' is already defined in '%s'");
/**
* 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', 37, "The argument for the named parameter '%s' was already specified");
+ static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode.con1('DUPLICATE_NAMED_ARGUMENT', 39, "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', 38, "The library %s is internal and cannot be exported");
+ static final CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = new CompileTimeErrorCode.con1('EXPORT_INTERNAL_LIBRARY', 40, "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
@@ -913,7 +966,7 @@
*
* @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 39, "The exported library '%s' must not have a part-of directive");
+ static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode.con1('EXPORT_OF_NON_LIBRARY', 41, "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
@@ -921,7 +974,7 @@
*
* @param typeName the name of the superclass that was not found
*/
- static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 40, "Classes can only extend other classes");
+ static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode.con1('EXTENDS_NON_CLASS', 42, "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.
@@ -940,7 +993,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', 41, "Classes cannot extend '%s'");
+ static final CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = new CompileTimeErrorCode.con1('EXTENDS_DISALLOWED_CLASS', 43, "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 >
@@ -952,36 +1005,21 @@
* @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', 42, "%d positional arguments expected, but %d found");
+ static final CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = new CompileTimeErrorCode.con1('EXTRA_POSITIONAL_ARGUMENTS', 44, "%d positional arguments expected, but %d found");
/**
* 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', 43, "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', 44, "Values cannot be set in the constructor if they are final, and have already been set");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode.con1('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 45, "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 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', 45, "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', 46, "'%s' is final and was given a value when it was declared, so it cannot be set to a new value");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode.con1('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 46, "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 is initialized by
@@ -990,19 +1028,19 @@
*
* @param name the name of the field in question
*/
- static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 47, "'%s' is a final field and so can only be set once");
+ static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode.con1('FINAL_INITIALIZED_MULTIPLE_TIMES', 47, "'%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', 48, "Initializing formal fields cannot be used in factory constructors");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = new CompileTimeErrorCode.con1('FIELD_INITIALIZER_FACTORY_CONSTRUCTOR', 48, "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', 49, "Initializing formal fields can only be used in constructors");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode.con1('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 49, "Initializing formal fields can only be used in constructors");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
@@ -1011,7 +1049,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', 50, "The redirecting constructor cannot have a field initializer");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = new CompileTimeErrorCode.con1('FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR', 50, "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
@@ -1019,7 +1057,7 @@
*
* @param name the conflicting name of the getter and method
*/
- static final CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = new CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', 51, "'%s' cannot be used to name a getter, there is already a method with the same name");
+ static final CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = new CompileTimeErrorCode.con1('GETTER_AND_METHOD_WITH_SAME_NAME', 51, "'%s' cannot be used to name a getter, there is already a method with the same name");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or implement Null.
@@ -1038,13 +1076,13 @@
* @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', 52, "Classes cannot implement '%s'");
+ static final CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode.con1('IMPLEMENTS_DISALLOWED_CLASS', 52, "Classes cannot implement '%s'");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause of a class includes
* type dynamic.
*/
- static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCode('IMPLEMENTS_DYNAMIC', 53, "Classes cannot implement 'dynamic'");
+ static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCode.con1('IMPLEMENTS_DYNAMIC', 53, "Classes cannot implement 'dynamic'");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause of a class <i>C</i>
@@ -1053,7 +1091,7 @@
*
* @param typeName the name of the interface that was not found
*/
- static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode('IMPLEMENTS_NON_CLASS', 54, "Classes can only implement other classes");
+ static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode.con1('IMPLEMENTS_NON_CLASS', 54, "Classes can only implement other classes");
/**
* 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears more than once in
@@ -1061,7 +1099,7 @@
*
* @param className the name of the class that is implemented more than once
*/
- static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode('IMPLEMENTS_REPEATED', 55, "'%s' can only be implemented once");
+ static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode.con1('IMPLEMENTS_REPEATED', 55, "'%s' can only be implemented once");
/**
* 7.10 Superinterfaces: It is a compile-time error if the superclass of a class <i>C</i> appears
@@ -1069,7 +1107,7 @@
*
* @param className the name of the class that appears in both "extends" and "implements" clauses
*/
- static final CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = new CompileTimeErrorCode('IMPLEMENTS_SUPER_CLASS', 56, "'%s' cannot be used in both 'extends' and 'implements' clauses");
+ static final CompileTimeErrorCode IMPLEMENTS_SUPER_CLASS = new CompileTimeErrorCode.con1('IMPLEMENTS_SUPER_CLASS', 56, "'%s' cannot be used in both 'extends' and 'implements' clauses");
/**
* 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the right hand side of
@@ -1081,14 +1119,14 @@
*
* @param name the name of the type in question
*/
- static final CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = new CompileTimeErrorCode('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', 57, "The 'this' expression cannot be implicitly used in initializers");
+ static final CompileTimeErrorCode IMPLICIT_THIS_REFERENCE_IN_INITIALIZER = new CompileTimeErrorCode.con1('IMPLICIT_THIS_REFERENCE_IN_INITIALIZER', 57, "The 'this' expression cannot be implicitly used in initializers");
/**
* SDK implementation libraries can be imported only by other SDK libraries.
*
* @param uri the uri pointing to a library
*/
- static final CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = new CompileTimeErrorCode('IMPORT_INTERNAL_LIBRARY', 58, "The library %s is internal and cannot be imported");
+ static final CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = new CompileTimeErrorCode.con1('IMPORT_INTERNAL_LIBRARY', 58, "The library '%s' is internal and cannot be imported");
/**
* 14.1 Imports: It is a compile-time error if the compilation unit found at the specified URI is
@@ -1096,7 +1134,7 @@
*
* @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY', 59, "The imported library '%s' must not have a part-of directive");
+ static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeErrorCode.con1('IMPORT_OF_NON_LIBRARY', 59, "The imported library '%s' must not have a part-of directive");
/**
* 13.9 Switch: It is a compile-time error if values of the expressions <i>e<sub>k</sub></i> are
@@ -1105,7 +1143,7 @@
* @param expressionSource the expression source code that is the unexpected type
* @param expectedType the name of the expected type
*/
- static final CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = new CompileTimeErrorCode('INCONSISTENT_CASE_EXPRESSION_TYPES', 60, "Case expressions must have the same types, '%s' is not a %s'");
+ static final CompileTimeErrorCode INCONSISTENT_CASE_EXPRESSION_TYPES = new CompileTimeErrorCode.con1('INCONSISTENT_CASE_EXPRESSION_TYPES', 60, "Case expressions must have the same types, '%s' is not a %s'");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
@@ -1116,7 +1154,7 @@
* immediately enclosing class
* @see #INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD
*/
- static final CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTANT_FIELD', 61, "'%s' is not a variable in the enclosing class");
+ static final CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode.con1('INITIALIZER_FOR_NON_EXISTANT_FIELD', 61, "'%s' is not a variable in the enclosing class");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
@@ -1127,7 +1165,7 @@
* enclosing class
* @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD
*/
- static final CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_STATIC_FIELD', 62, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static");
+ static final CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = new CompileTimeErrorCode.con1('INITIALIZER_FOR_STATIC_FIELD', 62, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
@@ -1139,7 +1177,7 @@
* @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD
* @see #INITIALIZER_FOR_NON_EXISTANT_FIELD
*/
- static final CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD', 63, "'%s' is not a variable in the enclosing class");
+ static final CompileTimeErrorCode INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD', 63, "'%s' is not a variable in the enclosing class");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
@@ -1150,20 +1188,20 @@
* enclosing class
* @see #INITIALIZER_FOR_STATIC_FIELD
*/
- static final CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = new CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_STATIC_FIELD', 64, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static");
+ static final CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = new CompileTimeErrorCode.con1('INITIALIZING_FORMAL_FOR_STATIC_FIELD', 64, "'%s' is a static variable in the enclosing class, variables initialized in a constructor cannot be static");
/**
* 12.30 Identifier Reference: Otherwise, e is equivalent to the property extraction
* <b>this</b>.<i>id</i>.
*/
- static final CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = new CompileTimeErrorCode('INSTANCE_MEMBER_ACCESS_FROM_STATIC', 65, "Instance member cannot be accessed from static method");
+ static final CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = new CompileTimeErrorCode.con1('INSTANCE_MEMBER_ACCESS_FROM_STATIC', 65, "Instance member cannot be accessed from static method");
/**
* 11 Metadata: Metadata consists of a series of annotations, each of which begin with the
* character @, followed by a constant expression that must be either a reference to a
* compile-time constant variable, or a call to a constant constructor.
*/
- static final CompileTimeErrorCode INVALID_ANNOTATION = new CompileTimeErrorCode('INVALID_ANNOTATION', 66, "Annotation can be only constant variable or constant constructor invocation");
+ static final CompileTimeErrorCode INVALID_ANNOTATION = new CompileTimeErrorCode.con1('INVALID_ANNOTATION', 66, "Annotation can be only constant variable or constant constructor invocation");
/**
* TODO(brianwilkerson) Remove this when we have decided on how to report errors in compile-time
@@ -1171,62 +1209,26 @@
*
* See TODOs in ConstantVisitor
*/
- static final CompileTimeErrorCode INVALID_CONSTANT = new CompileTimeErrorCode('INVALID_CONSTANT', 67, "Invalid constant value");
+ static final CompileTimeErrorCode INVALID_CONSTANT = new CompileTimeErrorCode.con1('INVALID_CONSTANT', 67, "Invalid constant value");
/**
* 7.6 Constructors: It is a compile-time error if the name of a constructor is not a constructor
* name.
*/
- static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeErrorCode('INVALID_CONSTRUCTOR_NAME', 68, "Invalid constructor name");
+ static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeErrorCode.con1('INVALID_CONSTRUCTOR_NAME', 68, "Invalid constructor name");
/**
* 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of the immediately
* enclosing class.
*/
- static final CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = new CompileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', 69, "The name of the immediately enclosing class expected");
-
- /**
- * 7.1 Instance Methods: It is a compile-time error if an instance method <i>m1</i> overrides an
- * instance member <i>m2</i> and <i>m1</i> does not declare all the named parameters declared by
- * <i>m2</i>.
- *
- * @param paramCount the number of named parameters in the overridden member
- * @param className the name of the class from the overridden method
- */
- static final CompileTimeErrorCode INVALID_OVERRIDE_NAMED = new CompileTimeErrorCode('INVALID_OVERRIDE_NAMED', 70, "Missing the named parameter '%s' to match the overridden method from '%s'");
-
- /**
- * 7.1 Instance Methods: It is a compile-time error if an instance method <i>m1</i> overrides an
- * instance member <i>m2</i> and <i>m1</i> has fewer optional positional parameters than
- * <i>m2</i>.
- *
- * @param paramCount the number of positional parameters in the overridden member
- * @param className the name of the class from the overridden method
- */
- static final CompileTimeErrorCode INVALID_OVERRIDE_POSITIONAL = new CompileTimeErrorCode('INVALID_OVERRIDE_POSITIONAL', 71, "Must have at least %d optional parameters to match the overridden method from '%s'");
-
- /**
- * 7.1 Instance Methods: It is a compile-time error if an instance method <i>m1</i> overrides an
- * instance member <i>m2</i> and <i>m1</i> has a different number of required parameters than
- * <i>m2</i>.
- *
- * @param paramCount the number of required parameters in the overridden member
- * @param className the name of the class from the overridden method
- */
- static final CompileTimeErrorCode INVALID_OVERRIDE_REQUIRED = new CompileTimeErrorCode('INVALID_OVERRIDE_REQUIRED', 72, "Must have exactly %d required parameters to match the overridden method from '%s'");
+ static final CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = new CompileTimeErrorCode.con1('INVALID_FACTORY_NAME_NOT_A_CLASS', 69, "The name of the immediately enclosing class expected");
/**
* 12.10 This: It is a compile-time error if this appears in a top-level function or variable
* initializer, in a factory constructor, or in a static method or variable initializer, or in the
* initializer of an instance variable.
*/
- static final CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = new CompileTimeErrorCode('INVALID_REFERENCE_TO_THIS', 73, "Invalid reference to 'this' expression");
-
- /**
- * 12.7 Maps: It is a compile-time error if the first type argument to a map literal is not
- * String.
- */
- static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_FOR_KEY = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_FOR_KEY', 74, "The first type argument to a map literal must be 'String'");
+ static final CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = new CompileTimeErrorCode.con1('INVALID_REFERENCE_TO_THIS', 70, "Invalid reference to 'this' expression");
/**
* 12.6 Lists: It is a compile time error if the type argument of a constant list literal includes
@@ -1234,7 +1236,7 @@
*
* @name the name of the type parameter
*/
- static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 75, "Constant list literals cannot include a type parameter as a type argument, such as '%s'");
+ static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = new CompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 71, "Constant list literals cannot include a type parameter as a type argument, such as '%s'");
/**
* 12.7 Maps: It is a compile time error if the type arguments of a constant map literal include a
@@ -1242,7 +1244,7 @@
*
* @name the name of the type parameter
*/
- static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 76, "Constant map literals cannot include a type parameter as a type argument, such as '%s'");
+ static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = new CompileTimeErrorCode.con1('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 72, "Constant map literals cannot include a type parameter as a type argument, such as '%s'");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at the specified URI is
@@ -1257,7 +1259,7 @@
* @param uri the URI that is invalid
* @see #URI_DOES_NOT_EXIST
*/
- static final CompileTimeErrorCode INVALID_URI = new CompileTimeErrorCode('INVALID_URI', 77, "Invalid URI syntax: '%s'");
+ static final CompileTimeErrorCode INVALID_URI = new CompileTimeErrorCode.con1('INVALID_URI', 73, "Invalid URI syntax: '%s'");
/**
* 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</sub></i> exists within
@@ -1268,7 +1270,7 @@
*
* @param labelName the name of the unresolvable label
*/
- static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', 78, "Cannot reference label '%s' declared in an outer method");
+ static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode.con1('LABEL_IN_OUTER_SCOPE', 74, "Cannot reference label '%s' declared in an outer method");
/**
* 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</sub></i> exists within
@@ -1279,7 +1281,7 @@
*
* @param labelName the name of the unresolvable label
*/
- static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('LABEL_UNDEFINED', 79, "Cannot reference undefined label '%s'");
+ static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode.con1('LABEL_UNDEFINED', 75, "Cannot reference undefined label '%s'");
/**
* 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> ...
@@ -1295,7 +1297,7 @@
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 <=
* j <= m</i>.
*/
- static final CompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 80, "The element type '%s' cannot be assigned to the list type '%s'");
+ static final CompileTimeErrorCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 76, "The element type '%s' cannot be assigned to the list type '%s'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -1311,7 +1313,7 @@
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 <=
* j <= m</i>.
*/
- static final CompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode('MAP_KEY_TYPE_NOT_ASSIGNABLE', 81, "The element type '%s' cannot be assigned to the map key type '%s'");
+ static final CompileTimeErrorCode MAP_KEY_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 77, "The element type '%s' cannot be assigned to the map key type '%s'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -1327,13 +1329,13 @@
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 <=
* j <= m</i>.
*/
- static final CompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 82, "The element type '%s' cannot be assigned to the map value type '%s'");
+ static final CompileTimeErrorCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = new CompileTimeErrorCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 78, "The element type '%s' cannot be assigned to the map value type '%s'");
/**
* 7 Classes: It is a compile time error if a class <i>C</i> declares a member with the same name
* as <i>C</i>.
*/
- static final CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = new CompileTimeErrorCode('MEMBER_WITH_CLASS_NAME', 83, "Class members cannot have the same name as the enclosing class");
+ static final CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = new CompileTimeErrorCode.con1('MEMBER_WITH_CLASS_NAME', 79, "Class members cannot have the same name as the enclosing class");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
@@ -1341,17 +1343,17 @@
*
* @param name the conflicting name of the getter and method
*/
- static final CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = new CompileTimeErrorCode('METHOD_AND_GETTER_WITH_SAME_NAME', 84, "'%s' cannot be used to name a method, there is already a getter with the same name");
+ static final CompileTimeErrorCode METHOD_AND_GETTER_WITH_SAME_NAME = new CompileTimeErrorCode.con1('METHOD_AND_GETTER_WITH_SAME_NAME', 80, "'%s' cannot be used to name a method, there is already a getter with the same name");
/**
* 12.1 Constants: A constant expression is ... a constant list literal.
*/
- static final CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = new CompileTimeErrorCode('MISSING_CONST_IN_LIST_LITERAL', 85, "List literals must be prefixed with 'const' when used as a constant expression");
+ static final CompileTimeErrorCode MISSING_CONST_IN_LIST_LITERAL = new CompileTimeErrorCode.con1('MISSING_CONST_IN_LIST_LITERAL', 81, "List literals must be prefixed with 'const' when used as a constant expression");
/**
* 12.1 Constants: A constant expression is ... a constant map literal.
*/
- static final CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = new CompileTimeErrorCode('MISSING_CONST_IN_MAP_LITERAL', 86, "Map literals must be prefixed with 'const' when used as a constant expression");
+ static final CompileTimeErrorCode MISSING_CONST_IN_MAP_LITERAL = new CompileTimeErrorCode.con1('MISSING_CONST_IN_MAP_LITERAL', 82, "Map literals must be prefixed with 'const' when used as a constant expression");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin explicitly declares a
@@ -1359,7 +1361,7 @@
*
* @param typeName the name of the mixin that is invalid
*/
- static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', 87, "The class '%s' cannot be used as a mixin because it declares a constructor");
+ static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTimeErrorCode.con1('MIXIN_DECLARES_CONSTRUCTOR', 83, "The class '%s' cannot be used as a mixin because it declares a constructor");
/**
* 9 Mixins: It is a compile-time error if a mixin is derived from a class whose superclass is not
@@ -1367,43 +1369,62 @@
*
* @param typeName the name of the mixin that is invalid
*/
- static final CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = new CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', 88, "The class '%s' cannot be used as a mixin because it extends a class other than Object");
+ static final CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = new CompileTimeErrorCode.con1('MIXIN_INHERITS_FROM_NOT_OBJECT', 84, "The class '%s' cannot be used as a mixin because it extends a class other than Object");
+
+ /**
+ * 12.2 Null: It is a compile-time error for a class to attempt to extend or implement Null.
+ *
+ * 12.3 Numbers: It is a compile-time error for a class to attempt to extend or implement int.
+ *
+ * 12.3 Numbers: It is a compile-time error for a class to attempt to extend or implement double.
+ *
+ * 12.3 Numbers: It is a compile-time error for any type other than the types int and double to
+ * attempt to extend or implement num.
+ *
+ * 12.4 Booleans: It is a compile-time error for a class to attempt to extend or implement bool.
+ *
+ * 12.5 Strings: It is a compile-time error for a class to attempt to extend or implement String.
+ *
+ * @param typeName the name of the type that cannot be extended
+ * @see #IMPLEMENTS_DISALLOWED_CLASS
+ */
+ static final CompileTimeErrorCode MIXIN_OF_DISALLOWED_CLASS = new CompileTimeErrorCode.con1('MIXIN_OF_DISALLOWED_CLASS', 85, "Classes cannot mixin '%s'");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not denote a class or mixin
* available in the immediately enclosing scope.
*/
- static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCode('MIXIN_OF_NON_CLASS', 89, "Classes can only mixin other classes");
+ static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCode.con1('MIXIN_OF_NON_CLASS', 86, "Classes can only mixin other classes");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin refers to super.
*/
- static final CompileTimeErrorCode MIXIN_REFERENCES_SUPER = new CompileTimeErrorCode('MIXIN_REFERENCES_SUPER', 90, "The class '%s' cannot be used as a mixin because it references 'super'");
+ static final CompileTimeErrorCode MIXIN_REFERENCES_SUPER = new CompileTimeErrorCode.con1('MIXIN_REFERENCES_SUPER', 87, "The class '%s' cannot be used as a mixin because it references 'super'");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not denote a class available
* in the immediately enclosing scope.
*/
- static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', 91, "Mixin can only be applied to class");
+ static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new CompileTimeErrorCode.con1('MIXIN_WITH_NON_CLASS_SUPERCLASS', 88, "Mixin can only be applied to class");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
* only action is to invoke another generative constructor.
*/
- static final CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = new CompileTimeErrorCode('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', 92, "Constructor may have at most one 'this' redirection");
+ static final CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = new CompileTimeErrorCode.con1('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', 89, "Constructor may have at most one 'this' redirection");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Then <i>k</i> may
* include at most one superinitializer in its initializer list or a compile time error occurs.
*/
- static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', 93, "Constructor may have at most one 'super' initializer");
+ static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTimeErrorCode.con1('MULTIPLE_SUPER_INITIALIZERS', 90, "Constructor may have at most one 'super' initializer");
/**
* 11 Metadata: Metadata consists of a series of annotations, each of which begin with the
* character @, followed by a constant expression that must be either a reference to a
* compile-time constant variable, or a call to a constant constructor.
*/
- static final CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = new CompileTimeErrorCode('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', 94, "Annotation creation must have arguments");
+ static final CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = new CompileTimeErrorCode.con1('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', 91, "Annotation creation must have arguments");
/**
* 7.6.1 Generative Constructors: If no superinitializer is provided, an implicit superinitializer
@@ -1413,7 +1434,7 @@
* 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> does not declare a
* generative constructor named <i>S</i> (respectively <i>S.id</i>)
*/
- static final CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = new CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', 95, "The class '%s' does not have a default constructor");
+ static final CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT = new CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT', 92, "The class '%s' does not have a default constructor");
/**
* 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it implicitly has a
@@ -1422,13 +1443,13 @@
* 7.6.1 Generative constructors. It is a compile-time error if class <i>S</i> does not declare a
* generative constructor named <i>S</i> (respectively <i>S.id</i>)
*/
- static final CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = new CompileTimeErrorCode('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', 96, "The class '%s' does not have a default constructor");
+ static final CompileTimeErrorCode NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT = new CompileTimeErrorCode.con1('NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT', 93, "The class '%s' does not have a default constructor");
/**
* 13.2 Expression Statements: It is a compile-time error if a non-constant map literal that has
* no explicit type arguments appears in a place where a statement is expected.
*/
- static final CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = new CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 97, "A non-constant map literal without type arguments cannot be used as an expression statement");
+ static final CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = new CompileTimeErrorCode.con1('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 94, "A non-constant map literal without type arguments cannot be used as an expression statement");
/**
* 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub>11</sub> …
@@ -1439,44 +1460,44 @@
* s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub>k</sub></i> are not
* compile-time constants, for all <i>1 <= k <= n</i>.
*/
- static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTimeErrorCode('NON_CONSTANT_CASE_EXPRESSION', 98, "Case expressions must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTimeErrorCode.con1('NON_CONSTANT_CASE_EXPRESSION', 95, "Case expressions must be constant");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the default value of an optional
* parameter is not a compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', 99, "Default values of an optional parameter must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTimeErrorCode.con1('NON_CONSTANT_DEFAULT_VALUE', 96, "Default values of an optional parameter must be constant");
/**
* 12.6 Lists: It is a compile time error if an element of a constant list literal is not a
* compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', 100, "'const' lists must have all constant values");
+ static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeErrorCode.con1('NON_CONSTANT_LIST_ELEMENT', 97, "'const' lists must have all constant values");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an entry in a constant map
* literal is not a compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorCode('NON_CONSTANT_MAP_KEY', 101, "The keys in a map must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorCode.con1('NON_CONSTANT_MAP_KEY', 98, "The keys in a map must be constant");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an entry in a constant map
* literal is not a compile-time constant.
*/
- static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', 102, "The values in a 'const' map must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErrorCode.con1('NON_CONSTANT_MAP_VALUE', 99, "The values in a 'const' map must be constant");
/**
* 11 Metadata: Metadata consists of a series of annotations, each of which begin with the
* character @, followed by a constant expression that must be either a reference to a
* compile-time constant variable, or a call to a constant constructor.
*/
- static final CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = new CompileTimeErrorCode('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', 103, "Annotation creation can use only 'const' constructor");
+ static final CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = new CompileTimeErrorCode.con1('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', 100, "Annotation creation can use only 'const' constructor");
/**
* 7.6.3 Constant Constructors: Any expression that appears within the initializer list of a
* constant constructor must be a potentially constant expression, or a compile-time error occurs.
*/
- static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', 104, "Initializer expressions in constant constructors must be constants");
+ static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new CompileTimeErrorCode.con1('NON_CONSTANT_VALUE_IN_INITIALIZER', 101, "Initializer expressions in constant constructors must be constants");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m > n</i>.
@@ -1487,7 +1508,7 @@
* @param requiredCount the expected number of required arguments
* @param argumentCount the actual number of positional arguments given
*/
- static final CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = new CompileTimeErrorCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', 105, "%d required argument(s) expected, but %d found");
+ static final CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = new CompileTimeErrorCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 102, "%d required argument(s) expected, but %d found");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the superinitializer appears
@@ -1495,17 +1516,17 @@
* a compile-time error if class <i>S</i> does not declare a generative constructor named <i>S</i>
* (respectively <i>S.id</i>)
*/
- static final CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('NON_GENERATIVE_CONSTRUCTOR', 106, "The generative constructor '%s' expected, but factory found");
+ static final CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode.con1('NON_GENERATIVE_CONSTRUCTOR', 103, "The generative constructor '%s' expected, but factory found");
/**
* 7.9 Superclasses: It is a compile-time error to specify an extends clause for class Object.
*/
- static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 107, "");
+ static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new CompileTimeErrorCode.con1('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 104, "");
/**
* 7.1.1 Operators: It is a compile-time error to declare an optional parameter in an operator.
*/
- static final CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = new CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', 108, "Optional parameters are not allowed when defining an operator");
+ static final CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = new CompileTimeErrorCode.con1('OPTIONAL_PARAMETER_IN_OPERATOR', 105, "Optional parameters are not allowed when defining an operator");
/**
* 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
@@ -1513,25 +1534,25 @@
*
* @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode('PART_OF_NON_PART', 109, "The included part '%s' must have a part-of directive");
+ static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode.con1('PART_OF_NON_PART', 106, "The included part '%s' must have a part-of directive");
/**
* 14.1 Imports: It is a compile-time error if the current library declares a top-level member
* named <i>p</i>.
*/
- static final CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = new CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 110, "The name '%s' is already used as an import prefix and cannot be used to name a top-level element");
+ static final CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = new CompileTimeErrorCode.con1('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 107, "The name '%s' is already used as an import prefix and cannot be used to name a top-level element");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the name of a named optional parameter
* begins with an '_' character.
*/
- static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER', 111, "Named optional parameters cannot start with an underscore");
+ static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTimeErrorCode.con1('PRIVATE_OPTIONAL_PARAMETER', 108, "Named optional parameters cannot start with an underscore");
/**
* 12.1 Constants: It is a compile-time error if the value of a compile-time constant expression
* depends on itself.
*/
- static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', 112, "");
+ static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new CompileTimeErrorCode.con1('RECURSIVE_COMPILE_TIME_CONSTANT', 109, "");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
@@ -1542,13 +1563,13 @@
*
* https://code.google.com/p/dart/issues/detail?id=954
*/
- static final CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = new CompileTimeErrorCode('RECURSIVE_CONSTRUCTOR_REDIRECT', 113, "Cycle in redirecting generative constructors");
+ static final CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = new CompileTimeErrorCode.con1('RECURSIVE_CONSTRUCTOR_REDIRECT', 110, "Cycle in redirecting generative constructors");
/**
* 7.6.2 Factories: It is a compile-time error if a redirecting factory constructor redirects to
* itself, either directly or indirectly via a sequence of redirections.
*/
- static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT', 114, "Cycle in redirecting factory constructors");
+ static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTimeErrorCode.con1('RECURSIVE_FACTORY_REDIRECT', 111, "Cycle in redirecting factory constructors");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a class <i>C</i> is a
@@ -1561,7 +1582,7 @@
* @param className the name of the class that implements itself recursively
* @param strImplementsPath a string representation of the implements loop
*/
- static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', 115, "'%s' cannot be a superinterface of itself: %s");
+ static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE', 112, "'%s' cannot be a superinterface of itself: %s");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a class <i>C</i> is a
@@ -1573,7 +1594,7 @@
*
* @param className the name of the class that implements itself recursively
*/
- static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', 116, "'%s' cannot extend itself");
+ static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS = new CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', 113, "'%s' cannot extend itself");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a class <i>C</i> is a
@@ -1585,31 +1606,31 @@
*
* @param className the name of the class that implements itself recursively
*/
- static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', 117, "'%s' cannot implement itself");
+ static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS = new CompileTimeErrorCode.con1('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', 114, "'%s' cannot implement itself");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with the const modifier but
* <i>k'</i> is not a constant constructor.
*/
- static final CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = new CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 118, "Constant factory constructor cannot delegate to a non-constant constructor");
+ static final CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = new CompileTimeErrorCode.con1('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 115, "Constant factory constructor cannot delegate to a non-constant constructor");
/**
* 13.3 Local Variable Declaration: It is a compile-time error if <i>e</i> refers to the name
* <i>v</i> or the name <i>v=</i>.
*/
- static final CompileTimeErrorCode REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 119, "The name '%s' cannot be referenced in the initializer of a variable with the same name");
+ static final CompileTimeErrorCode REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode.con1('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 116, "The name '%s' cannot be referenced in the initializer of a variable with the same name");
/**
* 12.8.1 Rethrow: It is a compile-time error if an expression of the form <i>rethrow;</i> is not
* enclosed within a on-catch clause.
*/
- static final CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = new CompileTimeErrorCode('RETHROW_OUTSIDE_CATCH', 120, "rethrow must be inside of a catch clause");
+ static final CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = new CompileTimeErrorCode.con1('RETHROW_OUTSIDE_CATCH', 117, "rethrow must be inside of a catch clause");
/**
* 13.11 Return: It is a compile-time error if a return statement of the form <i>return e;</i>
* appears in a generative constructor.
*/
- static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', 121, "Constructors cannot return a value");
+ static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode.con1('RETURN_IN_GENERATIVE_CONSTRUCTOR', 118, "Constructors cannot return a value");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -1619,19 +1640,19 @@
* initializer list, in class Object, in a factory constructor, or in a static method or variable
* initializer.
*/
- static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeErrorCode('SUPER_IN_INVALID_CONTEXT', 122, "Invalid context for 'super' invocation");
+ static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeErrorCode.con1('SUPER_IN_INVALID_CONTEXT', 119, "Invalid context for 'super' invocation");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
* only action is to invoke another generative constructor.
*/
- static final CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = new CompileTimeErrorCode('SUPER_IN_REDIRECTING_CONSTRUCTOR', 123, "The redirecting constructor cannot have a 'super' initializer");
+ static final CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = new CompileTimeErrorCode.con1('SUPER_IN_REDIRECTING_CONSTRUCTOR', 120, "The redirecting constructor cannot have a 'super' initializer");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
* error if a generative constructor of class Object includes a superinitializer.
*/
- static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', 124, "");
+ static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTimeErrorCode.con1('SUPER_INITIALIZER_IN_OBJECT', 121, "");
/**
* 12.11 Instance Creation: It is a static type warning if any of the type arguments to a
@@ -1650,19 +1671,19 @@
* @param boundingTypeName the name of the bounding type
* @see StaticTypeWarningCode#TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
*/
- static final CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = new CompileTimeErrorCode('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 125, "'%s' does not extend '%s'");
+ static final CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = new CompileTimeErrorCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 122, "'%s' does not extend '%s'");
/**
* 15.3.1 Typedef: It is a compile-time error if a typedef refers to itself via a chain of
* references that does not include a class declaration.
*/
- static final CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = new CompileTimeErrorCode('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', 126, "Type alias can reference itself only via the bounds of its generic parameters");
+ static final CompileTimeErrorCode TYPE_ALIAS_CANNOT_REFERENCE_ITSELF = new CompileTimeErrorCode.con1('TYPE_ALIAS_CANNOT_REFERENCE_ITSELF', 123, "Type alias can reference itself only via the bounds of its generic parameters");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class accessible in the current
* scope, optionally followed by type arguments.
*/
- static final CompileTimeErrorCode UNDEFINED_CLASS = new CompileTimeErrorCode('UNDEFINED_CLASS', 127, "Undefined class '%s'");
+ static final CompileTimeErrorCode UNDEFINED_CLASS = new CompileTimeErrorCode.con1('UNDEFINED_CLASS', 124, "Undefined class '%s'");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the superinitializer appears
@@ -1670,7 +1691,7 @@
* a compile-time error if class <i>S</i> does not declare a generative constructor named <i>S</i>
* (respectively <i>S.id</i>)
*/
- static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 128, "The class '%s' does not have a generative constructor '%s'");
+ static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 125, "The class '%s' does not have a generative constructor '%s'");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the superinitializer appears
@@ -1678,7 +1699,17 @@
* a compile-time error if class <i>S</i> does not declare a generative constructor named <i>S</i>
* (respectively <i>S.id</i>)
*/
- static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', 129, "The class '%s' does not have a default generative constructor");
+ static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT = new CompileTimeErrorCode.con1('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', 126, "The class '%s' does not have a default generative constructor");
+
+ /**
+ * 12.14.3 Unqualified Invocation: If there exists a lexically visible declaration named
+ * <i>id</i>, let <i>f<sub>id</sub></i> be the innermost such declaration. Then: [skip].
+ * Otherwise, <i>i</i> is equivalent to <b>this</b>.<i>id</i>(<i>a<sub>1</sub></i>; ...
+ * <i>x<sub>n+k</sub></i> : <i>a<sub>n+k</sub></i>).
+ *
+ * @param methodName the name of the method that is undefined
+ */
+ static final CompileTimeErrorCode UNDEFINED_FUNCTION = new CompileTimeErrorCode.con1('UNDEFINED_FUNCTION', 127, "The function '%s' is not defined");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
@@ -1690,7 +1721,7 @@
*
* @param name the name of the requested named parameter
*/
- static final CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = new CompileTimeErrorCode('UNDEFINED_NAMED_PARAMETER', 130, "The named parameter '%s' is not defined");
+ static final CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = new CompileTimeErrorCode.con1('UNDEFINED_NAMED_PARAMETER', 128, "The named parameter '%s' is not defined");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at the specified URI is
@@ -1705,7 +1736,7 @@
* @param uri the URI pointing to a non-existent file
* @see #INVALID_URI
*/
- static final CompileTimeErrorCode URI_DOES_NOT_EXIST = new CompileTimeErrorCode('URI_DOES_NOT_EXIST', 131, "Target of URI does not exist: '%s'");
+ static final CompileTimeErrorCode URI_DOES_NOT_EXIST = new CompileTimeErrorCode.con1('URI_DOES_NOT_EXIST', 129, "Target of URI does not exist: '%s'");
/**
* 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time constant, or if
@@ -1717,7 +1748,7 @@
* 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that describes a URI is
* not a compile-time constant, or if <i>x</i> involves string interpolation.
*/
- static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErrorCode('URI_WITH_INTERPOLATION', 132, "URIs cannot use string interpolation");
+ static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErrorCode.con1('URI_WITH_INTERPOLATION', 130, "URIs cannot use string interpolation");
/**
* 7.1.1 Operators: It is a compile-time error if the arity of the user-declared operator []= is
@@ -1730,7 +1761,7 @@
* @param expectedNumberOfParameters the number of parameters expected
* @param actualNumberOfParameters the number of parameters found in the operator declaration
*/
- static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 133, "Operator '%s' should declare exactly %d parameter(s), but %d found");
+ static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = new CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 131, "Operator '%s' should declare exactly %d parameter(s), but %d found");
/**
* 7.1.1 Operators: It is a compile time error if the arity of the user-declared operator - is not
@@ -1738,13 +1769,13 @@
*
* @param actualNumberOfParameters the number of parameters found in the operator declaration
*/
- static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS', 134, "Operator '-' should declare 0 or 1 parameter, but %d found");
+ static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS = new CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS', 132, "Operator '-' should declare 0 or 1 parameter, but %d found");
/**
* 7.3 Setters: It is a compile-time error if a setter's formal parameter list does not include
* exactly one required formal parameter <i>p</i>.
*/
- static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 135, "Setters should declare exactly one required parameter");
+ static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = new CompileTimeErrorCode.con1('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 133, "Setters should declare exactly one required parameter");
static final List<CompileTimeErrorCode> values = [
AMBIGUOUS_EXPORT,
ARGUMENT_DEFINITION_TEST_NON_PARAMETER,
@@ -1760,6 +1791,7 @@
CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD,
CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD,
CONST_CONSTRUCTOR_THROWS_EXCEPTION,
+ CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER,
CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
CONST_FORMAL_PARAMETER,
@@ -1779,6 +1811,7 @@
CONST_WITH_UNDEFINED_CONSTRUCTOR,
CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS,
+ DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER,
DUPLICATE_CONSTRUCTOR_DEFAULT,
DUPLICATE_CONSTRUCTOR_NAME,
DUPLICATE_DEFINITION,
@@ -1790,9 +1823,7 @@
EXTENDS_DISALLOWED_CLASS,
EXTRA_POSITIONAL_ARGUMENTS,
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,
@@ -1816,11 +1847,7 @@
INVALID_CONSTANT,
INVALID_CONSTRUCTOR_NAME,
INVALID_FACTORY_NAME_NOT_A_CLASS,
- 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,
@@ -1835,6 +1862,7 @@
MISSING_CONST_IN_MAP_LITERAL,
MIXIN_DECLARES_CONSTRUCTOR,
MIXIN_INHERITS_FROM_NOT_OBJECT,
+ MIXIN_OF_DISALLOWED_CLASS,
MIXIN_OF_NON_CLASS,
MIXIN_REFERENCES_SUPER,
MIXIN_WITH_NON_CLASS_SUPERCLASS,
@@ -1876,6 +1904,7 @@
UNDEFINED_CLASS,
UNDEFINED_CONSTRUCTOR_IN_INITIALIZER,
UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT,
+ UNDEFINED_FUNCTION,
UNDEFINED_NAMED_PARAMETER,
URI_DOES_NOT_EXIST,
URI_WITH_INTERPOLATION,
@@ -1883,31 +1912,40 @@
WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS,
WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction2;
+
+ /**
* Initialize a newly created error code to have the given message.
*
* @param message the message template used to create the message to be displayed for the error
*/
- CompileTimeErrorCode(this.name, this.ordinal, String message) {
+ CompileTimeErrorCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given message and correction.
+ *
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ CompileTimeErrorCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
+ this._message = message;
+ this.correction2 = correction;
+ }
+ String get correction => correction2;
ErrorSeverity get errorSeverity => ErrorType.COMPILE_TIME_ERROR.severity;
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;
}
/**
* The enumeration `PubSuggestionCode` defines the suggestions used for reporting deviations
@@ -1915,7 +1953,7 @@
* indicate the problem that caused the suggestion to be generated and for the message to explain
* what is wrong and, when appropriate, how the situation can be corrected.
*/
-class PubSuggestionCode implements Enum<PubSuggestionCode>, ErrorCode {
+class PubSuggestionCode extends Enum<PubSuggestionCode> implements ErrorCode {
/**
* It is a bad practice for a source file in a package "lib" directory hierarchy to traverse
@@ -1923,7 +1961,7 @@
* contain a directive such as `import '../web/some.dart'` which references a file outside
* the lib directory.
*/
- static final PubSuggestionCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = new PubSuggestionCode('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', 0, "A file in the 'lib' directory hierarchy should not reference a file outside that hierarchy");
+ static final PubSuggestionCode FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE = new PubSuggestionCode.con1('FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE', 0, "A file in the 'lib' directory hierarchy should not reference a file outside that hierarchy");
/**
* It is a bad practice for a source file ouside a package "lib" directory hierarchy to traverse
@@ -1931,44 +1969,53 @@
* contain a directive such as `import '../lib/some.dart'` which references a file inside
* the lib directory.
*/
- static final PubSuggestionCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = new PubSuggestionCode('FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', 1, "A file outside the 'lib' directory hierarchy should not reference a file inside that hierarchy. Use a package: reference instead.");
+ static final PubSuggestionCode FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE = new PubSuggestionCode.con1('FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE', 1, "A file outside the 'lib' directory hierarchy should not reference a file inside that hierarchy. Use a package: reference instead.");
/**
* It is a bad practice for a package import to reference anything outside the given package, or
* more generally, it is bad practice for a package import to contain a "..". For example, a
* source file should not contain a directive such as `import 'package:foo/../some.dart'`.
*/
- static final PubSuggestionCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = new PubSuggestionCode('PACKAGE_IMPORT_CONTAINS_DOT_DOT', 2, "A package import should not contain '..'");
+ static final PubSuggestionCode PACKAGE_IMPORT_CONTAINS_DOT_DOT = new PubSuggestionCode.con1('PACKAGE_IMPORT_CONTAINS_DOT_DOT', 2, "A package import should not contain '..'");
static final List<PubSuggestionCode> values = [
FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE,
FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE,
PACKAGE_IMPORT_CONTAINS_DOT_DOT];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction5;
+
+ /**
* Initialize a newly created error code to have the given message.
*
* @param message the message template used to create the message to be displayed for the error
*/
- PubSuggestionCode(this.name, this.ordinal, String message) {
+ PubSuggestionCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given message and correction.
+ *
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ PubSuggestionCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
+ this._message = message;
+ this.correction5 = correction;
+ }
+ String get correction => correction5;
ErrorSeverity get errorSeverity => ErrorType.PUB_SUGGESTION.severity;
String get message => _message;
ErrorType get type => ErrorType.PUB_SUGGESTION;
- int compareTo(PubSuggestionCode other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* The enumeration `StaticWarningCode` defines the error codes used for static warnings. The
@@ -1978,7 +2025,7 @@
*
* @coverage dart.engine.error
*/
-class StaticWarningCode implements Enum<StaticWarningCode>, ErrorCode {
+class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
/**
* 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and <i>N</i> is introduced
@@ -1994,7 +2041,7 @@
* @param firstLibraryName the name of the first library that the type is found
* @param secondLibraryName the name of the second library that the type is found
*/
- static final StaticWarningCode AMBIGUOUS_IMPORT = new StaticWarningCode('AMBIGUOUS_IMPORT', 0, "The type '%s' is defined in the libraries '%s' and '%s'");
+ static final StaticWarningCode AMBIGUOUS_IMPORT = new StaticWarningCode.con1('AMBIGUOUS_IMPORT', 0, "The type '%s' is defined in the libraries '%s' and '%s'");
/**
* 12.11.1 New: It is a static warning if the static type of <i>a<sub>i</sub>, 1 <= i <= n+
@@ -2017,7 +2064,7 @@
* <i>T<sub>m+j</sub></i> may not be assigned to <i>S<sub>r</sub></i>, where <i>r = q<sub>j</sub>,
* 1 <= j <= l</i>.
*/
- static final StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = new StaticWarningCode('ARGUMENT_TYPE_NOT_ASSIGNABLE', 1, "The argument type '%s' cannot be assigned to the parameter type '%s'");
+ static final StaticWarningCode ARGUMENT_TYPE_NOT_ASSIGNABLE = new StaticWarningCode.con1('ARGUMENT_TYPE_NOT_ASSIGNABLE', 1, "The argument type '%s' cannot be assigned to the parameter type '%s'");
/**
* 5 Variables: Attempting to assign to a final variable elsewhere will cause a NoSuchMethodError
@@ -2026,32 +2073,32 @@
*
* A constant variable is always implicitly final.
*/
- static final StaticWarningCode ASSIGNMENT_TO_CONST = new StaticWarningCode('ASSIGNMENT_TO_CONST', 2, "Constant variables cannot be assigned a value");
+ static final StaticWarningCode ASSIGNMENT_TO_CONST = new StaticWarningCode.con1('ASSIGNMENT_TO_CONST', 2, "Constant variables cannot be assigned a value");
/**
* 5 Variables: Attempting to assign to a final variable elsewhere will cause a NoSuchMethodError
* to be thrown, because no setter is defined for it. The assignment will also give rise to a
* static warning for the same reason.
*/
- static final StaticWarningCode ASSIGNMENT_TO_FINAL = new StaticWarningCode('ASSIGNMENT_TO_FINAL', 3, "Final variables cannot be assigned a value");
+ static final StaticWarningCode ASSIGNMENT_TO_FINAL = new StaticWarningCode.con1('ASSIGNMENT_TO_FINAL', 3, "Final variables cannot be assigned a value");
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
* warning if <i>T</i> does not have an accessible instance setter named <i>v =</i>.
*/
- static final StaticWarningCode ASSIGNMENT_TO_METHOD = new StaticWarningCode('ASSIGNMENT_TO_METHOD', 4, "Methods cannot be assigned a value");
+ static final StaticWarningCode ASSIGNMENT_TO_METHOD = new StaticWarningCode.con1('ASSIGNMENT_TO_METHOD', 4, "Methods cannot be assigned a value");
/**
* 13.9 Switch: It is a static warning if the last statement of the statement sequence
* <i>s<sub>k</sub></i> is not a break, continue, return or throw statement.
*/
- static final StaticWarningCode CASE_BLOCK_NOT_TERMINATED = new StaticWarningCode('CASE_BLOCK_NOT_TERMINATED', 5, "The last statement of the 'case' should be 'break', 'continue', 'return' or 'throw'");
+ static final StaticWarningCode CASE_BLOCK_NOT_TERMINATED = new StaticWarningCode.con1('CASE_BLOCK_NOT_TERMINATED', 5, "The last statement of the 'case' should be 'break', 'continue', 'return' or 'throw'");
/**
* 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', 6, "The name '%s' is not a type and cannot be used in an 'as' expression");
+ static final StaticWarningCode CAST_TO_NON_TYPE = new StaticWarningCode.con1('CAST_TO_NON_TYPE', 6, "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
@@ -2060,7 +2107,7 @@
* <i>L</i>, or if <i>c</i> is not the name of a constructor of a class declared in the exported
* namespace of <i>L</i>.
*/
- static final StaticWarningCode COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE = new StaticWarningCode('COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE', 7, "");
+ static final StaticWarningCode COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE = new StaticWarningCode.con1('COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE', 7, "");
/**
* 16.1.2 Comments: A token of the form <i>[id](uri)</i> will be replaced by a link in the
@@ -2068,19 +2115,19 @@
* of the link will be <i>id</i>. It is a static warning if uri is not the URI of a dart library
* <i>L</i>, or if <i>id</i> is not a name declared in the exported namespace of <i>L</i>.
*/
- static final StaticWarningCode COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE = new StaticWarningCode('COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE', 8, "");
+ static final StaticWarningCode COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE = new StaticWarningCode.con1('COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE', 8, "");
/**
* 16.1.2 Comments: It is a static warning if <i>c</i> does not denote a constructor that
* available in the scope of the documentation comment.
*/
- static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR = new StaticWarningCode('COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR', 9, "");
+ static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR = new StaticWarningCode.con1('COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR', 9, "");
/**
* 16.1.2 Comments: It is a static warning if <i>id</i> does not denote a declaration that
* available in the scope of the documentation comment.
*/
- static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_IDENTIFIER = new StaticWarningCode('COMMENT_REFERENCE_UNDECLARED_IDENTIFIER', 10, "");
+ static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_IDENTIFIER = new StaticWarningCode.con1('COMMENT_REFERENCE_UNDECLARED_IDENTIFIER', 10, "");
/**
* 16.1.2 Comments: A token of the form <i>[id](uri)</i> will be replaced by a link in the
@@ -2088,13 +2135,13 @@
* of the link will be <i>id</i>. It is a static warning if uri is not the URI of a dart library
* <i>L</i>, or if <i>id</i> is not a name declared in the exported namespace of <i>L</i>.
*/
- static final StaticWarningCode COMMENT_REFERENCE_URI_NOT_LIBRARY = new StaticWarningCode('COMMENT_REFERENCE_URI_NOT_LIBRARY', 11, "");
+ static final StaticWarningCode COMMENT_REFERENCE_URI_NOT_LIBRARY = new StaticWarningCode.con1('COMMENT_REFERENCE_URI_NOT_LIBRARY', 11, "");
/**
* 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
* inherited in a concrete class.
*/
- static final StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = new StaticWarningCode('CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', 12, "'%s' must have a method body because '%s' is not abstract");
+ static final StaticWarningCode CONCRETE_CLASS_WITH_ABSTRACT_MEMBER = new StaticWarningCode.con1('CONCRETE_CLASS_WITH_ABSTRACT_MEMBER', 12, "'%s' must have a method body because '%s' is not abstract");
/**
* 7.2 Getters: It is a static warning if a class <i>C</i> declares an instance getter named
@@ -2103,7 +2150,7 @@
*
* @param superName the name of the super class declaring a static member
*/
- static final StaticWarningCode CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER = new StaticWarningCode('CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER', 13, "Superclass '%s' declares static member with the same name");
+ static final StaticWarningCode CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER = new StaticWarningCode.con1('CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER', 13, "Superclass '%s' declares static member with the same name");
/**
* 7.3 Setters: It is a static warning if a class <i>C</i> declares an instance setter named
@@ -2112,31 +2159,31 @@
*
* @param superName the name of the super class declaring a static member
*/
- static final StaticWarningCode CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER = new StaticWarningCode('CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER', 14, "Superclass '%s' declares static member with the same name");
+ static final StaticWarningCode CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER = new StaticWarningCode.con1('CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER', 14, "Superclass '%s' declares static member with the same name");
/**
* 7.2 Getters: It is a static warning if a class declares a static getter named <i>v</i> and also
* has a non-static setter named <i>v=</i>.
*/
- static final StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER = new StaticWarningCode('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', 15, "Class '%s' declares non-static setter with the same name");
+ static final StaticWarningCode CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER = new StaticWarningCode.con1('CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER', 15, "Class '%s' declares non-static setter with the same name");
/**
* 7.3 Setters: It is a static warning if a class declares a static setter named <i>v=</i> and
* also has a non-static member named <i>v</i>.
*/
- static final StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER = new StaticWarningCode('CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER', 16, "Class '%s' declares non-static member with the same name");
+ static final StaticWarningCode CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER = new StaticWarningCode.con1('CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER', 16, "Class '%s' declares non-static member with the same name");
/**
* 12.11.2 Const: Given an instance creation expression of the form <i>const q(a<sub>1</sub>,
* … a<sub>n</sub>)</i> it is a static warning if <i>q</i> is the constructor of an
* abstract class but <i>q</i> is not a factory constructor.
*/
- static final StaticWarningCode CONST_WITH_ABSTRACT_CLASS = new StaticWarningCode('CONST_WITH_ABSTRACT_CLASS', 17, "Abstract classes cannot be created with a 'const' expression");
+ static final StaticWarningCode CONST_WITH_ABSTRACT_CLASS = new StaticWarningCode.con1('CONST_WITH_ABSTRACT_CLASS', 17, "Abstract classes cannot be created with a 'const' expression");
/**
* 12.7 Maps: It is a static warning if the values of any two keys in a map literal are equal.
*/
- static final StaticWarningCode EQUAL_KEYS_IN_MAP = new StaticWarningCode('EQUAL_KEYS_IN_MAP', 18, "Keys in a map cannot be equal");
+ static final StaticWarningCode EQUAL_KEYS_IN_MAP = new StaticWarningCode.con1('EQUAL_KEYS_IN_MAP', 18, "Keys in a map cannot be equal");
/**
* 14.2 Exports: It is a static warning to export two different libraries with the same name.
@@ -2145,7 +2192,7 @@
* @param uri2 the uri pointing to a second library
* @param name the shared name of the exported libraries
*/
- static final StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAME = new StaticWarningCode('EXPORT_DUPLICATED_LIBRARY_NAME', 19, "The exported libraries '%s' and '%s' should not have the same name '%s'");
+ static final StaticWarningCode EXPORT_DUPLICATED_LIBRARY_NAME = new StaticWarningCode.con1('EXPORT_DUPLICATED_LIBRARY_NAME', 19, "The exported libraries '%s' and '%s' should not have the same name '%s'");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m >
@@ -2155,7 +2202,21 @@
* @param argumentCount the actual number of positional arguments given
* @see #NOT_ENOUGH_REQUIRED_ARGUMENTS
*/
- static final StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = new StaticWarningCode('EXTRA_POSITIONAL_ARGUMENTS', 20, "%d positional arguments expected, but %d found");
+ static final StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = new StaticWarningCode.con1('EXTRA_POSITIONAL_ARGUMENTS', 20, "%d positional arguments expected, but %d found");
+
+ /**
+ * 5. Variables: It is a static warning if a final instance variable that has been initialized at
+ * its point of declaration is also initialized in a constructor.
+ */
+ static final StaticWarningCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new StaticWarningCode.con1('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 21, "Values cannot be set in the constructor if they are final, and have already been set");
+
+ /**
+ * 5. Variables: It is a static warning 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 StaticWarningCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new StaticWarningCode.con1('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 22, "'%s' is final and was given a value when it was declared, so it cannot be set to a new value");
/**
* 7.6.1 Generative Constructors: Execution of an initializer of the form <b>this</b>.<i>v</i> =
@@ -2172,7 +2233,7 @@
* @param initializerType the name of the type of the initializer expression
* @param fieldType the name of the type of the field
*/
- static final StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE = new StaticWarningCode('FIELD_INITIALIZER_NOT_ASSIGNABLE', 21, "The initializer type '%s' cannot be assigned to the field type '%s'");
+ static final StaticWarningCode FIELD_INITIALIZER_NOT_ASSIGNABLE = new StaticWarningCode.con1('FIELD_INITIALIZER_NOT_ASSIGNABLE', 23, "The initializer type '%s' cannot be assigned to the field type '%s'");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
@@ -2181,7 +2242,7 @@
* @param parameterType the name of the type of the field formal parameter
* @param fieldType the name of the type of the field
*/
- static final StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = new StaticWarningCode('FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', 22, "The parameter type '%s' is incompatable with the field type '%s'");
+ static final StaticWarningCode FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE = new StaticWarningCode.con1('FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE', 24, "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
@@ -2198,7 +2259,7 @@
*
* @param name the name of the uninitialized final variable
*/
- static final StaticWarningCode FINAL_NOT_INITIALIZED = new StaticWarningCode('FINAL_NOT_INITIALIZED', 23, "The final variable '%s' must be initialized");
+ static final StaticWarningCode FINAL_NOT_INITIALIZED = new StaticWarningCode.con1('FINAL_NOT_INITIALIZED', 25, "The final variable '%s' must be initialized");
/**
* 14.1 Imports: It is a static warning to import two different libraries with the same name.
@@ -2207,7 +2268,7 @@
* @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', 24, "The imported libraries '%s' and '%s' should not have the same name '%s'");
+ static final StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAME = new StaticWarningCode.con1('IMPORT_DUPLICATED_LIBRARY_NAME', 26, "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>,
@@ -2219,7 +2280,7 @@
* 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', 25, "'%s' is inherited as a getter and also a method");
+ static final StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD = new StaticWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', 27, "'%s' is inherited as a getter and also a method");
/**
* 7.1 Instance Methods: It is a static warning if a class <i>C</i> declares an instance method
@@ -2229,7 +2290,7 @@
* @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', 26, "'%s' collides with a static member in the superclass '%s'");
+ static final StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC = new StaticWarningCode.con1('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', 28, "'%s' collides with a static member in the superclass '%s'");
/**
* 7.2 Getters: It is a static warning if a getter <i>m1</i> overrides a getter <i>m2</i> and the
@@ -2241,7 +2302,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', 27, "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.con1('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 29, "The return type '%s' is not assignable to '%s' as required by the getter it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -2252,7 +2313,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', 28, "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.con1('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 30, "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
@@ -2264,7 +2325,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', 29, "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.con1('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 31, "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
@@ -2275,7 +2336,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', 30, "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.con1('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 32, "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
@@ -2287,7 +2348,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', 31, "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.con1('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 33, "The return 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
@@ -2295,7 +2356,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_NAMED = new StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', 32, "Parameters cannot override default values, this method overrides '%s.%s' where '%s' has a different value");
+ static final StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED = new StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', 34, "Parameters cannot override default values, this method overrides '%s.%s' where '%s' has a different value");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -2303,7 +2364,37 @@
* 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_POSITIONAL = new StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', 33, "Parameters cannot override default values, this method overrides '%s.%s' where this positional parameter has a different value");
+ static final StaticWarningCode INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL = new StaticWarningCode.con1('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', 35, "Parameters cannot override default values, this method overrides '%s.%s' where this positional parameter has a different value");
+
+ /**
+ * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
+ * instance member <i>m2</i> and <i>m1</i> does not declare all the named parameters declared by
+ * <i>m2</i>.
+ *
+ * @param paramCount the number of named parameters in the overridden member
+ * @param className the name of the class from the overridden method
+ */
+ static final StaticWarningCode INVALID_OVERRIDE_NAMED = new StaticWarningCode.con1('INVALID_OVERRIDE_NAMED', 36, "Missing the named parameter '%s' to match the overridden method from '%s'");
+
+ /**
+ * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
+ * instance member <i>m2</i> and <i>m1</i> has fewer optional positional parameters than
+ * <i>m2</i>.
+ *
+ * @param paramCount the number of positional parameters in the overridden member
+ * @param className the name of the class from the overridden method
+ */
+ static final StaticWarningCode INVALID_OVERRIDE_POSITIONAL = new StaticWarningCode.con1('INVALID_OVERRIDE_POSITIONAL', 37, "Must have at least %d optional parameters to match the overridden method from '%s'");
+
+ /**
+ * 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
+ * instance member <i>m2</i> and <i>m1</i> has a different number of required parameters than
+ * <i>m2</i>.
+ *
+ * @param paramCount the number of required parameters in the overridden member
+ * @param className the name of the class from the overridden method
+ */
+ static final StaticWarningCode INVALID_OVERRIDE_REQUIRED = new StaticWarningCode.con1('INVALID_OVERRIDE_REQUIRED', 38, "Must have exactly %d required parameters to match the overridden method from '%s'");
/**
* 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a setter <i>m2</i> and the
@@ -2315,7 +2406,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', 34, "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.con1('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', 39, "The parameter type '%s' is not assignable to '%s' as required by the setter it is overriding from '%s'");
/**
* 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> ...
@@ -2331,7 +2422,7 @@
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 <=
* j <= m</i>.
*/
- static final StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = new StaticWarningCode('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 35, "The element type '%s' cannot be assigned to the list type '%s'");
+ static final StaticWarningCode LIST_ELEMENT_TYPE_NOT_ASSIGNABLE = new StaticWarningCode.con1('LIST_ELEMENT_TYPE_NOT_ASSIGNABLE', 40, "The element type '%s' cannot be assigned to the list type '%s'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -2347,7 +2438,7 @@
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 <=
* j <= m</i>.
*/
- static final StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = new StaticWarningCode('MAP_KEY_TYPE_NOT_ASSIGNABLE', 36, "The element type '%s' cannot be assigned to the map key type '%s'");
+ static final StaticWarningCode MAP_KEY_TYPE_NOT_ASSIGNABLE = new StaticWarningCode.con1('MAP_KEY_TYPE_NOT_ASSIGNABLE', 41, "The element type '%s' cannot be assigned to the map key type '%s'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -2363,20 +2454,20 @@
* It is a static warning if <i>T<sub>j</sub></i> may not be assigned to <i>S<sub>j</sub>, 1 <=
* j <= m</i>.
*/
- static final StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = new StaticWarningCode('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 37, "The element type '%s' cannot be assigned to the map value type '%s'");
+ static final StaticWarningCode MAP_VALUE_TYPE_NOT_ASSIGNABLE = new StaticWarningCode.con1('MAP_VALUE_TYPE_NOT_ASSIGNABLE', 42, "The element type '%s' cannot be assigned to the map value type '%s'");
/**
* 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', 38, "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.con1('MISMATCHED_GETTER_AND_SETTER_TYPES', 43, "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', 39, "Abstract classes cannot be created with a 'new' expression");
+ static final StaticWarningCode NEW_WITH_ABSTRACT_CLASS = new StaticWarningCode.con1('NEW_WITH_ABSTRACT_CLASS', 44, "Abstract classes cannot be created with a 'new' expression");
/**
* 15.8 Parameterized Types: Any use of a malbounded type gives rise to a static warning.
@@ -2387,7 +2478,7 @@
* @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS
* @see StaticTypeWarningCode#WRONG_NUMBER_OF_TYPE_ARGUMENTS
*/
- static final StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = new StaticWarningCode('NEW_WITH_INVALID_TYPE_PARAMETERS', 40, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
+ static final StaticWarningCode NEW_WITH_INVALID_TYPE_PARAMETERS = new StaticWarningCode.con1('NEW_WITH_INVALID_TYPE_PARAMETERS', 45, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
/**
* 12.11.1 New: It is a static warning if <i>T</i> is not a class accessible in the current scope,
@@ -2395,7 +2486,7 @@
*
* @param name the name of the non-type element
*/
- static final StaticWarningCode NEW_WITH_NON_TYPE = new StaticWarningCode('NEW_WITH_NON_TYPE', 41, "The name '%s' is not a class");
+ static final StaticWarningCode NEW_WITH_NON_TYPE = new StaticWarningCode.con1('NEW_WITH_NON_TYPE', 46, "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:
@@ -2406,7 +2497,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', 42, "The class '%s' does not have a constructor '%s'");
+ static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = new StaticWarningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR', 47, "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:
@@ -2417,7 +2508,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', 43, "The class '%s' does not have a default constructor");
+ static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new StaticWarningCode.con1('NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 48, "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
@@ -2437,7 +2528,7 @@
* @param memberName the name of the fourth member
* @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', 44, "Missing inherited members: '%s', '%s', '%s', '%s' and %d more");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', 49, "Missing inherited members: '%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
@@ -2456,7 +2547,7 @@
* @param memberName the name of the third member
* @param memberName the name of the fourth member
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', 45, "Missing inherited members: '%s', '%s', '%s' and '%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', 50, "Missing inherited members: '%s', '%s', '%s' and '%s'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -2472,7 +2563,7 @@
*
* @param memberName the name of the member
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', 46, "Missing inherited member '%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', 51, "Missing inherited member '%s'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -2490,7 +2581,7 @@
* @param memberName the name of the second member
* @param memberName the name of the third member
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', 47, "Missing inherited members: '%s', '%s' and '%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', 52, "Missing inherited members: '%s', '%s' and '%s'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
@@ -2507,7 +2598,7 @@
* @param memberName the name of the first member
* @param memberName the name of the second member
*/
- static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', 48, "Missing inherited members: '%s' and '%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', 53, "Missing inherited members: '%s' and '%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
@@ -2517,18 +2608,18 @@
*
* @param name the name of the non-type element
*/
- static final StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = new StaticWarningCode('NON_TYPE_IN_CATCH_CLAUSE', 49, "The name '%s' is not a type and cannot be used in an on-catch clause");
+ static final StaticWarningCode NON_TYPE_IN_CATCH_CLAUSE = new StaticWarningCode.con1('NON_TYPE_IN_CATCH_CLAUSE', 54, "The name '%s' is not a type and cannot be used in an on-catch clause");
/**
* 7.1.1 Operators: It is a static warning if the return type of the user-declared operator []= is
* explicitly declared and not void.
*/
- static final StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = new StaticWarningCode('NON_VOID_RETURN_FOR_OPERATOR', 50, "The return type of the operator []= must be 'void'");
+ static final StaticWarningCode NON_VOID_RETURN_FOR_OPERATOR = new StaticWarningCode.con1('NON_VOID_RETURN_FOR_OPERATOR', 55, "The return type of the operator []= must be 'void'");
/**
* 7.3 Setters: It is a static warning if a setter declares a return type other than void.
*/
- static final StaticWarningCode NON_VOID_RETURN_FOR_SETTER = new StaticWarningCode('NON_VOID_RETURN_FOR_SETTER', 51, "The return type of the setter must be 'void'");
+ static final StaticWarningCode NON_VOID_RETURN_FOR_SETTER = new StaticWarningCode.con1('NON_VOID_RETURN_FOR_SETTER', 56, "The return type of the setter must be 'void'");
/**
* 15.1 Static Types: A type <i>T</i> is malformed iff: * <i>T</i> has the form <i>id</i> or the
@@ -2542,7 +2633,7 @@
*
* @param nonTypeName the name that is not a type
*/
- static final StaticWarningCode NOT_A_TYPE = new StaticWarningCode('NOT_A_TYPE', 52, "%s is not a type");
+ static final StaticWarningCode NOT_A_TYPE = new StaticWarningCode.con1('NOT_A_TYPE', 57, "%s is not a type");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m >
@@ -2552,7 +2643,7 @@
* @param argumentCount the actual number of positional arguments given
* @see #EXTRA_POSITIONAL_ARGUMENTS
*/
- static final StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = new StaticWarningCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', 53, "%d required argument(s) expected, but %d found");
+ static final StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = new StaticWarningCode.con1('NOT_ENOUGH_REQUIRED_ARGUMENTS', 58, "%d required argument(s) expected, but %d found");
/**
* 14.3 Parts: It is a static warning if the referenced part declaration <i>p</i> names a library
@@ -2561,7 +2652,7 @@
* @param expectedLibraryName the name of expected library name
* @param actualLibraryName the non-matching actual library name from the "part of" declaration
*/
- static final StaticWarningCode PART_OF_DIFFERENT_LIBRARY = new StaticWarningCode('PART_OF_DIFFERENT_LIBRARY', 54, "Expected this library to be part of '%s', not '%s'");
+ static final StaticWarningCode PART_OF_DIFFERENT_LIBRARY = new StaticWarningCode.con1('PART_OF_DIFFERENT_LIBRARY', 59, "Expected this library to be part of '%s', not '%s'");
/**
* 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> is not a subtype of
@@ -2570,7 +2661,7 @@
* @param redirectedName the name of the redirected constructor
* @param redirectingName the name of the redirecting constructor
*/
- static final StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = new StaticWarningCode('REDIRECT_TO_INVALID_FUNCTION_TYPE', 55, "The redirected constructor '%s' has incompatible parameters with '%s'");
+ static final StaticWarningCode REDIRECT_TO_INVALID_FUNCTION_TYPE = new StaticWarningCode.con1('REDIRECT_TO_INVALID_FUNCTION_TYPE', 60, "The redirected constructor '%s' has incompatible parameters with '%s'");
/**
* 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> is not a subtype of
@@ -2579,21 +2670,21 @@
* @param redirectedName the name of the redirected constructor return type
* @param redirectingName the name of the redirecting constructor return type
*/
- static final StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = new StaticWarningCode('REDIRECT_TO_INVALID_RETURN_TYPE', 56, "The return type '%s' of the redirected constructor is not a subclass of '%s'");
+ static final StaticWarningCode REDIRECT_TO_INVALID_RETURN_TYPE = new StaticWarningCode.con1('REDIRECT_TO_INVALID_RETURN_TYPE', 61, "The return type '%s' of the redirected constructor is not a subclass of '%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_MISSING_CONSTRUCTOR = new StaticWarningCode('REDIRECT_TO_MISSING_CONSTRUCTOR', 57, "The constructor '%s' could not be found in '%s'");
+ static final StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = new StaticWarningCode.con1('REDIRECT_TO_MISSING_CONSTRUCTOR', 62, "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', 58, "The name '%s' is not a type and cannot be used in a redirected constructor");
+ static final StaticWarningCode REDIRECT_TO_NON_CLASS = new StaticWarningCode.con1('REDIRECT_TO_NON_CLASS', 63, "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
@@ -2603,7 +2694,7 @@
* * The return type of <i>f</i> may not be assigned to void.
* </ol>
*/
- static final StaticWarningCode RETURN_WITHOUT_VALUE = new StaticWarningCode('RETURN_WITHOUT_VALUE', 59, "Missing return value after 'return'");
+ static final StaticWarningCode RETURN_WITHOUT_VALUE = new StaticWarningCode.con1('RETURN_WITHOUT_VALUE', 64, "Missing return value after 'return'");
/**
* 12.15.3 Static Invocation: It is a static warning if <i>C</i> does not declare a static method
@@ -2611,19 +2702,19 @@
*
* @param memberName the name of the instance member
*/
- static final StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = new StaticWarningCode('STATIC_ACCESS_TO_INSTANCE_MEMBER', 60, "Instance member '%s' cannot be accessed using static access");
+ static final StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = new StaticWarningCode.con1('STATIC_ACCESS_TO_INSTANCE_MEMBER', 65, "Instance member '%s' cannot be accessed using static access");
/**
* 13.9 Switch: It is a static warning if the type of <i>e</i> may not be assigned to the type of
* <i>e<sub>k</sub></i>.
*/
- static final StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = new StaticWarningCode('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 61, "Type '%s' of the switch expression is not assignable to the type '%s' of case expressions");
+ static final StaticWarningCode SWITCH_EXPRESSION_NOT_ASSIGNABLE = new StaticWarningCode.con1('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 66, "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', 62, "The name '%s' is not a type and cannot be used in an 'is' expression");
+ static final StaticWarningCode TYPE_TEST_NON_TYPE = new StaticWarningCode.con1('TYPE_TEST_NON_TYPE', 67, "The name '%s' is not a type and cannot be used in an 'is' expression");
/**
* 10 Generics: However, a type parameter is considered to be a malformed type when referenced by
@@ -2632,7 +2723,7 @@
* 15.1 Static Types: Any use of a malformed type gives rise to a static warning. A malformed type
* is then interpreted as dynamic by the static type checker and the runtime.
*/
- static final StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = new StaticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC', 63, "Static members cannot reference type parameters");
+ static final StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = new StaticWarningCode.con1('TYPE_PARAMETER_REFERENCED_BY_STATIC', 68, "Static members cannot reference type parameters");
/**
* 12.15.3 Static Invocation: A static method invocation <i>i</i> has the form
@@ -2642,12 +2733,12 @@
*
* @param undefinedClassName the name of the undefined class
*/
- static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 64, "Undefined class '%s'");
+ static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode.con1('UNDEFINED_CLASS', 69, "Undefined class '%s'");
/**
* Same as [UNDEFINED_CLASS], but to catch using "boolean" instead of "bool".
*/
- static final StaticWarningCode UNDEFINED_CLASS_BOOLEAN = new StaticWarningCode('UNDEFINED_CLASS_BOOLEAN', 65, "Undefined class 'boolean'; did you mean 'bool'?");
+ static final StaticWarningCode UNDEFINED_CLASS_BOOLEAN = new StaticWarningCode.con1('UNDEFINED_CLASS_BOOLEAN', 70, "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
@@ -2657,7 +2748,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', 66, "There is no such getter '%s' in '%s'");
+ static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode.con1('UNDEFINED_GETTER', 71, "There is no such getter '%s' in '%s'");
/**
* 12.30 Identifier Reference: It is as static warning if an identifier expression of the form
@@ -2665,7 +2756,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', 67, "Undefined name '%s'");
+ static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode.con1('UNDEFINED_IDENTIFIER', 72, "Undefined name '%s'");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
@@ -2674,7 +2765,7 @@
*
* @param name the name of the requested named parameter
*/
- static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode('UNDEFINED_NAMED_PARAMETER', 68, "The named parameter '%s' is not defined");
+ static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode.con1('UNDEFINED_NAMED_PARAMETER', 73, "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
@@ -2689,7 +2780,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', 69, "There is no such setter '%s' in '%s'");
+ static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode.con1('UNDEFINED_SETTER', 74, "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
@@ -2698,7 +2789,7 @@
* @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', 70, "There is no such static method '%s' in '%s'");
+ static final StaticWarningCode UNDEFINED_STATIC_METHOD_OR_GETTER = new StaticWarningCode.con1('UNDEFINED_STATIC_METHOD_OR_GETTER', 75, "There is no such static method '%s' in '%s'");
static final List<StaticWarningCode> values = [
AMBIGUOUS_IMPORT,
ARGUMENT_TYPE_NOT_ASSIGNABLE,
@@ -2721,6 +2812,8 @@
EQUAL_KEYS_IN_MAP,
EXPORT_DUPLICATED_LIBRARY_NAME,
EXTRA_POSITIONAL_ARGUMENTS,
+ FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION,
+ FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR,
FIELD_INITIALIZER_NOT_ASSIGNABLE,
FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE,
FINAL_NOT_INITIALIZED,
@@ -2734,6 +2827,9 @@
INVALID_METHOD_OVERRIDE_RETURN_TYPE,
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED,
INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL,
+ INVALID_OVERRIDE_NAMED,
+ INVALID_OVERRIDE_POSITIONAL,
+ INVALID_OVERRIDE_REQUIRED,
INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE,
LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
MAP_KEY_TYPE_NOT_ASSIGNABLE,
@@ -2772,31 +2868,40 @@
UNDEFINED_SETTER,
UNDEFINED_STATIC_METHOD_OR_GETTER];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
- * Initialize a newly created error code to have the given type and message.
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction7;
+
+ /**
+ * Initialize a newly created error code to have the given message.
*
* @param message the message template used to create the message to be displayed for the error
*/
- StaticWarningCode(this.name, this.ordinal, String message) {
+ StaticWarningCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given message and correction.
+ *
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ StaticWarningCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
+ this._message = message;
+ this.correction7 = correction;
+ }
+ String get correction => correction7;
ErrorSeverity get errorSeverity => ErrorType.STATIC_WARNING.severity;
String get message => _message;
ErrorType get type => ErrorType.STATIC_WARNING;
- int compareTo(StaticWarningCode other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* The interface `AnalysisErrorListener` defines the behavior of objects that listen for
@@ -2830,7 +2935,7 @@
*
* @coverage dart.engine.error
*/
-class HtmlWarningCode implements Enum<HtmlWarningCode>, ErrorCode {
+class HtmlWarningCode extends Enum<HtmlWarningCode> implements ErrorCode {
/**
* An error code indicating that the value of the 'src' attribute of a Dart script tag is not a
@@ -2838,7 +2943,7 @@
*
* @param uri the URI that is invalid
*/
- static final HtmlWarningCode INVALID_URI = new HtmlWarningCode('INVALID_URI', 0, "Invalid URI syntax: '%s'");
+ static final HtmlWarningCode INVALID_URI = new HtmlWarningCode.con1('INVALID_URI', 0, "Invalid URI syntax: '%s'");
/**
* An error code indicating that the value of the 'src' attribute of a Dart script tag references
@@ -2846,34 +2951,43 @@
*
* @param uri the URI pointing to a non-existent file
*/
- static final HtmlWarningCode URI_DOES_NOT_EXIST = new HtmlWarningCode('URI_DOES_NOT_EXIST', 1, "Target of URI does not exist: '%s'");
+ static final HtmlWarningCode URI_DOES_NOT_EXIST = new HtmlWarningCode.con1('URI_DOES_NOT_EXIST', 1, "Target of URI does not exist: '%s'");
static final List<HtmlWarningCode> values = [INVALID_URI, URI_DOES_NOT_EXIST];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
- * Initialize a newly created error code to have the given type and message.
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction4;
+
+ /**
+ * Initialize a newly created error code to have the given message.
*
* @param message the message template used to create the message to be displayed for the error
*/
- HtmlWarningCode(this.name, this.ordinal, String message) {
+ HtmlWarningCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given message and correction.
+ *
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ HtmlWarningCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
+ this._message = message;
+ this.correction4 = correction;
+ }
+ String get correction => correction4;
ErrorSeverity get errorSeverity => ErrorSeverity.WARNING;
String get message => _message;
ErrorType get type => ErrorType.STATIC_WARNING;
- int compareTo(HtmlWarningCode other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* The enumeration `StaticTypeWarningCode` defines the error codes used for static type
@@ -2883,7 +2997,7 @@
*
* @coverage dart.engine.error
*/
-class StaticTypeWarningCode implements Enum<StaticTypeWarningCode>, ErrorCode {
+class StaticTypeWarningCode extends Enum<StaticTypeWarningCode> implements ErrorCode {
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
@@ -2891,7 +3005,7 @@
*
* @see #UNDEFINED_SETTER
*/
- static final StaticTypeWarningCode INACCESSIBLE_SETTER = new StaticTypeWarningCode('INACCESSIBLE_SETTER', 0, "");
+ static final StaticTypeWarningCode INACCESSIBLE_SETTER = new StaticTypeWarningCode.con1('INACCESSIBLE_SETTER', 0, "");
/**
* 8.1.1 Inheritance and Overriding: However, if there are multiple members <i>m<sub>1</sub>,
@@ -2913,7 +3027,16 @@
* * Otherwise none of the members <i>m<sub>1</sub>, …, m<sub>k</sub></i> is inherited.
* </ol>
*/
- static final StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = new StaticTypeWarningCode('INCONSISTENT_METHOD_INHERITANCE', 1, "'%s' is inherited by at least two interfaces inconsistently");
+ static final StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = new StaticTypeWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE', 1, "'%s' is inherited by at least two interfaces inconsistently");
+
+ /**
+ * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does not have an
+ * accessible (3.2) instance member named <i>m</i>.
+ *
+ * @param memberName the name of the static member
+ * @see UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER
+ */
+ static final StaticTypeWarningCode INSTANCE_ACCESS_TO_STATIC_MEMBER = new StaticTypeWarningCode.con1('INSTANCE_ACCESS_TO_STATIC_MEMBER', 2, "Static member '%s' cannot be accessed using instance access");
/**
* 12.18 Assignment: It is a static type warning if the static type of <i>e</i> may not be
@@ -2930,16 +3053,9 @@
* @param rhsTypeName the name of the right hand side type
* @param lhsTypeName the name of the left hand side type
*/
- static final StaticTypeWarningCode INVALID_ASSIGNMENT = new StaticTypeWarningCode('INVALID_ASSIGNMENT', 2, "A value of type '%s' cannot be assigned to a variable of type '%s'");
+ static final StaticTypeWarningCode INVALID_ASSIGNMENT = new StaticTypeWarningCode.con1('INVALID_ASSIGNMENT', 3, "A value of type '%s' cannot be assigned to a variable of type '%s'");
/**
- * 12.14.4 Function Expression Invocation: A function expression invocation <i>i</i> has the form
- * <i>e<sub>f</sub>(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>, where <i>e<sub>f</sub></i> is an expression.
- *
- * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub></i> may not be
- * assigned to a function type.
- *
* 12.15.1 Ordinary Invocation: An ordinary method invocation <i>i</i> has the form
* <i>o.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>.
@@ -2959,7 +3075,17 @@
*
* @param nonFunctionIdentifier the name of the identifier that is not a function type
*/
- static final StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = new StaticTypeWarningCode('INVOCATION_OF_NON_FUNCTION', 3, "'%s' is not a method");
+ static final StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION = new StaticTypeWarningCode.con1('INVOCATION_OF_NON_FUNCTION', 4, "'%s' is not a method");
+
+ /**
+ * 12.14.4 Function Expression Invocation: A function expression invocation <i>i</i> has the form
+ * <i>e<sub>f</sub>(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>, where <i>e<sub>f</sub></i> is an expression.
+ *
+ * It is a static type warning if the static type <i>F</i> of <i>e<sub>f</sub></i> may not be
+ * assigned to a function type.
+ */
+ static final StaticTypeWarningCode INVOCATION_OF_NON_FUNCTION_EXPRESSION = new StaticTypeWarningCode.con1('INVOCATION_OF_NON_FUNCTION_EXPRESSION', 5, "Cannot invoke a non-function");
/**
* 12.19 Conditional: It is a static type warning if the type of <i>e<sub>1</sub></i> may not be
@@ -2972,19 +3098,19 @@
*
* 13.8 Do: It is a static type warning if the type of <i>e</i> cannot be assigned to bool.
*/
- static final StaticTypeWarningCode NON_BOOL_CONDITION = new StaticTypeWarningCode('NON_BOOL_CONDITION', 4, "Conditions must have a static type of 'bool'");
+ static final StaticTypeWarningCode NON_BOOL_CONDITION = new StaticTypeWarningCode.con1('NON_BOOL_CONDITION', 6, "Conditions must have a static type of 'bool'");
/**
* 13.15 Assert: It is a static type warning if the type of <i>e</i> may not be assigned to either
* bool or () → bool
*/
- static final StaticTypeWarningCode NON_BOOL_EXPRESSION = new StaticTypeWarningCode('NON_BOOL_EXPRESSION', 5, "Assertions must be on either a 'bool' or '() -> bool'");
+ static final StaticTypeWarningCode NON_BOOL_EXPRESSION = new StaticTypeWarningCode.con1('NON_BOOL_EXPRESSION', 7, "Assertions must be on either a 'bool' or '() -> bool'");
/**
* 15.8 Parameterized Types: It is a static type warning if <i>A<sub>i</sub>, 1 <= i <=
* n</i> does not denote a type in the enclosing lexical scope.
*/
- static final StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = new StaticTypeWarningCode('NON_TYPE_AS_TYPE_ARGUMENT', 6, "The name '%s' is not a type and cannot be used as a parameterized type");
+ static final StaticTypeWarningCode NON_TYPE_AS_TYPE_ARGUMENT = new StaticTypeWarningCode.con1('NON_TYPE_AS_TYPE_ARGUMENT', 8, "The name '%s' is not a type and cannot be used as a parameterized type");
/**
* 13.11 Return: It is a static type warning if the type of <i>e</i> may not be assigned to the
@@ -2994,7 +3120,7 @@
* @param expectedReturnType the expected return type as defined by the method
* @param methodName the name of the method
*/
- static final StaticTypeWarningCode RETURN_OF_INVALID_TYPE = new StaticTypeWarningCode('RETURN_OF_INVALID_TYPE', 7, "The return type '%s' is not a '%s', as defined by the method '%s'");
+ static final StaticTypeWarningCode RETURN_OF_INVALID_TYPE = new StaticTypeWarningCode.con1('RETURN_OF_INVALID_TYPE', 9, "The return type '%s' is not a '%s', as defined by the method '%s'");
/**
* 12.11 Instance Creation: It is a static type warning if any of the type arguments to a
@@ -3019,15 +3145,7 @@
* limited by the bound as specified in the class declaration
* @param boundingTypeName the name of the bounding type
*/
- static final StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = new StaticTypeWarningCode('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 8, "'%s' does not extend '%s'");
-
- /**
- * Specification reference needed. This is equivalent to [UNDEFINED_METHOD], but for
- * top-level functions.
- *
- * @param methodName the name of the method that is undefined
- */
- static final StaticTypeWarningCode UNDEFINED_FUNCTION = new StaticTypeWarningCode('UNDEFINED_FUNCTION', 9, "The function '%s' is not defined");
+ static final StaticTypeWarningCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = new StaticTypeWarningCode.con1('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 10, "'%s' does not extend '%s'");
/**
* 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is a static type
@@ -3036,7 +3154,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 StaticTypeWarningCode UNDEFINED_GETTER = new StaticTypeWarningCode('UNDEFINED_GETTER', 10, "There is no such getter '%s' in '%s'");
+ static final StaticTypeWarningCode UNDEFINED_GETTER = new StaticTypeWarningCode.con1('UNDEFINED_GETTER', 11, "There is no such getter '%s' in '%s'");
/**
* 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>. It is a static type
@@ -3045,7 +3163,7 @@
* @param methodName the name of the method that is undefined
* @param typeName the resolved type name that the method lookup is happening on
*/
- static final StaticTypeWarningCode UNDEFINED_METHOD = new StaticTypeWarningCode('UNDEFINED_METHOD', 11, "The method '%s' is not defined for the class '%s'");
+ static final StaticTypeWarningCode UNDEFINED_METHOD = new StaticTypeWarningCode.con1('UNDEFINED_METHOD', 12, "The method '%s' is not defined for the class '%s'");
/**
* 12.18 Assignment: Evaluation of an assignment of the form
@@ -3063,7 +3181,7 @@
* @param operator the name of the operator
* @param enclosingType the name of the enclosing type where the operator is being looked for
*/
- static final StaticTypeWarningCode UNDEFINED_OPERATOR = new StaticTypeWarningCode('UNDEFINED_OPERATOR', 12, "There is no such operator '%s' in '%s'");
+ static final StaticTypeWarningCode UNDEFINED_OPERATOR = new StaticTypeWarningCode.con1('UNDEFINED_OPERATOR', 13, "There is no such operator '%s' in '%s'");
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
@@ -3073,7 +3191,7 @@
* @param enclosingType the name of the enclosing type where the setter is being looked for
* @see #INACCESSIBLE_SETTER
*/
- static final StaticTypeWarningCode UNDEFINED_SETTER = new StaticTypeWarningCode('UNDEFINED_SETTER', 13, "There is no such setter '%s' in '%s'");
+ static final StaticTypeWarningCode UNDEFINED_SETTER = new StaticTypeWarningCode.con1('UNDEFINED_SETTER', 14, "There is no such setter '%s' in '%s'");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -3084,7 +3202,17 @@
* @param methodName the name of the method that is undefined
* @param typeName the resolved type name that the method lookup is happening on
*/
- static final StaticTypeWarningCode UNDEFINED_SUPER_METHOD = new StaticTypeWarningCode('UNDEFINED_SUPER_METHOD', 14, "There is no such method '%s' in '%s'");
+ static final StaticTypeWarningCode UNDEFINED_SUPER_METHOD = new StaticTypeWarningCode.con1('UNDEFINED_SUPER_METHOD', 15, "There is no such method '%s' in '%s'");
+
+ /**
+ * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does not have an
+ * accessible (3.2) instance member named <i>m</i>.
+ *
+ * This is a specialization of [INSTANCE_ACCESS_TO_STATIC_MEMBER] that is used when we are
+ * able to find the name defined in a supertype. It exists to provide a more informative error
+ * message.
+ */
+ static final StaticTypeWarningCode UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER = new StaticTypeWarningCode.con1('UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER', 16, "Static members from supertypes must be qualified by the name of the defining type");
/**
* 15.8 Parameterized Types: It is a static type warning if <i>G</i> is not a generic type with
@@ -3096,48 +3224,59 @@
* @see CompileTimeErrorCode#CONST_WITH_INVALID_TYPE_PARAMETERS
* @see CompileTimeErrorCode#NEW_WITH_INVALID_TYPE_PARAMETERS
*/
- static final StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new StaticTypeWarningCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 15, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
+ static final StaticTypeWarningCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new StaticTypeWarningCode.con1('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 17, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
static final List<StaticTypeWarningCode> values = [
INACCESSIBLE_SETTER,
INCONSISTENT_METHOD_INHERITANCE,
+ INSTANCE_ACCESS_TO_STATIC_MEMBER,
INVALID_ASSIGNMENT,
INVOCATION_OF_NON_FUNCTION,
+ INVOCATION_OF_NON_FUNCTION_EXPRESSION,
NON_BOOL_CONDITION,
NON_BOOL_EXPRESSION,
NON_TYPE_AS_TYPE_ARGUMENT,
RETURN_OF_INVALID_TYPE,
TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
- UNDEFINED_FUNCTION,
UNDEFINED_GETTER,
UNDEFINED_METHOD,
UNDEFINED_OPERATOR,
UNDEFINED_SETTER,
UNDEFINED_SUPER_METHOD,
+ UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
WRONG_NUMBER_OF_TYPE_ARGUMENTS];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
- * Initialize a newly created error code to have the given type and message.
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction6;
+
+ /**
+ * Initialize a newly created error code to have the given message.
*
* @param message the message template used to create the message to be displayed for the error
*/
- StaticTypeWarningCode(this.name, this.ordinal, String message) {
+ StaticTypeWarningCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given message and correction.
+ *
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ StaticTypeWarningCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
+ this._message = message;
+ this.correction6 = correction;
+ }
+ String get correction => correction6;
ErrorSeverity get errorSeverity => ErrorType.STATIC_TYPE_WARNING.severity;
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 b69bda3..d8e191f 100644
--- a/pkg/analyzer_experimental/lib/src/generated/html.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/html.dart
@@ -5,8 +5,6 @@
import 'java_core.dart';
import 'java_engine.dart';
import 'source.dart';
-import 'error.dart';
-import 'instrumentation.dart';
import 'element.dart' show HtmlElementImpl;
import 'engine.dart' show AnalysisEngine;
/**
@@ -287,7 +285,7 @@
*
* @param visitor the visitor that will be used to visit the children of this node
*/
- void visitChildren(XmlVisitor<Object> visitor);
+ void visitChildren(XmlVisitor visitor);
/**
* Make this node the parent of the given child nodes.
@@ -924,7 +922,7 @@
*
* @coverage dart.engine.html
*/
-class TokenType implements Enum<TokenType> {
+class TokenType extends Enum<TokenType> {
/**
* The type of the token that marks the end of the input.
@@ -955,18 +953,12 @@
TAG,
TEXT];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The lexeme that defines this type of token, or `null` if there is more than one possible
* lexeme for this type of token.
*/
String _lexeme;
- TokenType(this.name, this.ordinal, String lexeme) {
+ TokenType(String name, int ordinal, String lexeme) : super(name, ordinal) {
this._lexeme = lexeme;
}
@@ -977,9 +969,6 @@
* @return the lexeme that defines this type of token
*/
String get lexeme => _lexeme;
- int compareTo(TokenType other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
class TokenType_EOF extends TokenType {
TokenType_EOF(String name, int ordinal, String arg0) : super(name, ordinal, arg0);
@@ -1063,7 +1052,7 @@
* @return the value or `null` if this represents a badly formed attribute
*/
Token get value => _value;
- void visitChildren(XmlVisitor<Object> visitor) {
+ void visitChildren(XmlVisitor visitor) {
}
}
/**
@@ -1626,7 +1615,7 @@
* @return the children (not `null`, contains no `null`s)
*/
List<XmlTagNode> get tagNodes => _tagNodes;
- void visitChildren(XmlVisitor<Object> visitor) {
+ void visitChildren(XmlVisitor visitor) {
for (XmlAttributeNode node in _attributes) {
node.accept(visitor);
}
@@ -1755,7 +1744,7 @@
void set element(HtmlElementImpl element2) {
this._element = element2;
}
- void visitChildren(XmlVisitor<Object> visitor) {
+ void visitChildren(XmlVisitor visitor) {
for (XmlTagNode node in _tagNodes) {
node.accept(visitor);
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
index 5dbf578..7752811 100644
--- a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
@@ -255,7 +255,7 @@
*
* @coverage dart.engine.utilities
*/
-class InstrumentationLevel implements Enum<InstrumentationLevel> {
+class InstrumentationLevel extends Enum<InstrumentationLevel> {
/** Recording all instrumented information */
static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERYTHING', 0);
@@ -266,12 +266,6 @@
/** Nothing recorded */
static final InstrumentationLevel OFF = new InstrumentationLevel('OFF', 2);
static final List<InstrumentationLevel> values = [EVERYTHING, METRICS, OFF];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
static InstrumentationLevel fromString(String str) {
if (str == "EVERYTHING") {
return InstrumentationLevel.EVERYTHING;
@@ -284,10 +278,7 @@
}
throw new IllegalArgumentException("Unrecognised InstrumentationLevel");
}
- InstrumentationLevel(this.name, this.ordinal);
- int compareTo(InstrumentationLevel other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ InstrumentationLevel(String name, int ordinal) : super(name, ordinal);
}
/**
* The interface `InstrumentationLogger` defines the behavior of objects that are used to log
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_core.dart b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
index 4ebd170..c3dadd0 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_core.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
@@ -50,7 +50,26 @@
}
}
if (tTypeName == "ExecutableElement") {
- if (oTypeName == "MethodElementImpl" || oTypeName == "FunctionElementImpl") {
+ if (oTypeName == "MethodElementImpl" ||
+ oTypeName == "FunctionElementImpl" ||
+ oTypeName == "PropertyAccessorElementImpl") {
+ return true;
+ }
+ }
+ if (tTypeName == "ParameterElement") {
+ if (oTypeName == "FieldFormalParameterElementImpl" ||
+ oTypeName == "DefaultFieldFormalParameterElementImpl" ||
+ oTypeName == "DefaultParameterElementImpl") {
+ return true;
+ }
+ }
+ if (tTypeName == "VariableElement") {
+ if (oTypeName == "LocalVariableElementImpl" ||
+ oTypeName == "ConstLocalVariableElementImpl" ||
+ oTypeName == "FieldElementImpl" ||
+ oTypeName == "ConstFieldElementImpl" ||
+ oTypeName == "TopLevelVariableElementImpl" ||
+ oTypeName == "ConstTopLevelVariableElementImpl") {
return true;
}
}
@@ -535,7 +554,13 @@
}
}
-abstract class Enum<E> implements Comparable<E> {
- int get ordinal;
- String get name;
+abstract class Enum<E extends Enum> implements Comparable<E> {
+ /// The name of this enum constant, as declared in the enum declaration.
+ final String name;
+ /// The position in the enum declaration.
+ final int ordinal;
+ Enum(this.name, this.ordinal);
+ int get hashCode => ordinal;
+ String toString() => name;
+ int compareTo(E other) => ordinal - other.ordinal;
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/parser.dart b/pkg/analyzer_experimental/lib/src/generated/parser.dart
index 84fec68..ed3c416 100644
--- a/pkg/analyzer_experimental/lib/src/generated/parser.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/parser.dart
@@ -427,11 +427,11 @@
*/
void appendScalarValue(JavaStringBuilder builder, String escapeSequence, int scalarValue, int startIndex, int endIndex) {
if (scalarValue < 0 || scalarValue > Character.MAX_CODE_POINT || (scalarValue >= 0xD800 && scalarValue <= 0xDFFF)) {
- reportError7(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]);
+ reportError8(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]);
return;
}
if (scalarValue < Character.MAX_VALUE) {
- builder.appendChar((scalarValue as int));
+ builder.appendChar(scalarValue as int);
} else {
builder.append(Character.toChars(scalarValue));
}
@@ -570,7 +570,7 @@
*/
void ensureAssignable(Expression expression) {
if (expression != null && !expression.isAssignable) {
- reportError7(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []);
+ reportError8(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, []);
}
}
@@ -585,7 +585,7 @@
if (matches(keyword)) {
return andAdvance;
}
- reportError7(ParserErrorCode.EXPECTED_TOKEN, [keyword.syntax]);
+ reportError8(ParserErrorCode.EXPECTED_TOKEN, [keyword.syntax]);
return _currentToken;
}
@@ -601,9 +601,9 @@
return andAdvance;
}
if (identical(type, TokenType.SEMICOLON)) {
- reportError8(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type.lexeme]);
+ reportError9(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [type.lexeme]);
} else {
- reportError7(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]);
+ reportError8(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]);
}
return _currentToken;
}
@@ -1136,7 +1136,7 @@
ArgumentDefinitionTest parseArgumentDefinitionTest() {
Token question = expect2(TokenType.QUESTION);
SimpleIdentifier identifier = parseSimpleIdentifier();
- reportError8(ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, question, []);
+ reportError9(ParserErrorCode.DEPRECATED_ARGUMENT_DEFINITION_TEST, question, []);
return new ArgumentDefinitionTest.full(question, identifier);
}
@@ -1169,7 +1169,7 @@
arguments.add(argument);
if (foundNamedArgument) {
if (!generatedError && argument is! NamedExpression) {
- reportError7(ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, []);
+ reportError8(ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, []);
generatedError = true;
}
} else if (argument is NamedExpression) {
@@ -1223,7 +1223,7 @@
while (matches5(TokenType.OPEN_PAREN)) {
ArgumentList argumentList = parseArgumentList();
if (expression is SimpleIdentifier) {
- expression = new MethodInvocation.full(null, null, (expression as SimpleIdentifier), argumentList);
+ expression = new MethodInvocation.full(null, null, expression as SimpleIdentifier, argumentList);
} else if (expression is PrefixedIdentifier) {
PrefixedIdentifier identifier = expression as PrefixedIdentifier;
expression = new MethodInvocation.full(identifier.prefix, identifier.period, identifier.identifier, argumentList);
@@ -1274,7 +1274,7 @@
return new PropertyAccess.full(prefix, period, parseSimpleIdentifier());
} else {
if (!optional) {
- reportError7(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
+ reportError8(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
}
return prefix;
}
@@ -1375,7 +1375,7 @@
statements.add(statement);
}
if (identical(_currentToken, statementStart)) {
- reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
+ reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
advance();
}
statementStart = _currentToken;
@@ -1401,7 +1401,7 @@
label = parseSimpleIdentifier();
}
if (!_inLoop && !_inSwitch && label == null) {
- reportError8(ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, breakKeyword, []);
+ reportError9(ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, breakKeyword, []);
}
Token semicolon = expect2(TokenType.SEMICOLON);
return new BreakStatement.full(breakKeyword, label, semicolon);
@@ -1437,7 +1437,7 @@
expression = new IndexExpression.forCascade_full(period, leftBracket, index, rightBracket);
period = null;
} else {
- reportError8(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_currentToken.lexeme]);
+ reportError9(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_currentToken.lexeme]);
functionName = createSyntheticIdentifier();
}
if (identical(_currentToken.type, TokenType.OPEN_PAREN)) {
@@ -1506,29 +1506,29 @@
if (extendsClause == null) {
extendsClause = parseExtendsClause();
if (withClause != null) {
- reportError8(ParserErrorCode.WITH_BEFORE_EXTENDS, withClause.withKeyword, []);
+ reportError9(ParserErrorCode.WITH_BEFORE_EXTENDS, withClause.withKeyword, []);
} else if (implementsClause != null) {
- reportError8(ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS, implementsClause.keyword, []);
+ reportError9(ParserErrorCode.IMPLEMENTS_BEFORE_EXTENDS, implementsClause.keyword, []);
}
} else {
- reportError8(ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, extendsClause.keyword, []);
+ reportError9(ParserErrorCode.MULTIPLE_EXTENDS_CLAUSES, extendsClause.keyword, []);
parseExtendsClause();
}
} else if (matches(Keyword.WITH)) {
if (withClause == null) {
withClause = parseWithClause();
if (implementsClause != null) {
- reportError8(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, implementsClause.keyword, []);
+ reportError9(ParserErrorCode.IMPLEMENTS_BEFORE_WITH, implementsClause.keyword, []);
}
} else {
- reportError8(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause.withKeyword, []);
+ reportError9(ParserErrorCode.MULTIPLE_WITH_CLAUSES, withClause.withKeyword, []);
parseWithClause();
}
} else if (matches(Keyword.IMPLEMENTS)) {
if (implementsClause == null) {
implementsClause = parseImplementsClause();
} else {
- reportError8(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, implementsClause.keyword, []);
+ reportError9(ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES, implementsClause.keyword, []);
parseImplementsClause();
}
} else {
@@ -1536,7 +1536,7 @@
}
}
if (withClause != null && extendsClause == null) {
- reportError8(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.withKeyword, []);
+ reportError9(ParserErrorCode.WITH_WITHOUT_EXTENDS, withClause.withKeyword, []);
}
NativeClause nativeClause = null;
if (matches2(_NATIVE) && matches4(peek(), TokenType.STRING)) {
@@ -1552,7 +1552,7 @@
} else {
leftBracket = createSyntheticToken2(TokenType.OPEN_CURLY_BRACKET);
rightBracket = createSyntheticToken2(TokenType.CLOSE_CURLY_BRACKET);
- reportError7(ParserErrorCode.MISSING_CLASS_BODY, []);
+ reportError8(ParserErrorCode.MISSING_CLASS_BODY, []);
}
ClassDeclaration classDeclaration = new ClassDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, abstractKeyword, keyword, name, typeParameters, extendsClause, withClause, implementsClause, leftBracket, members, rightBracket);
classDeclaration.nativeClause = nativeClause;
@@ -1603,7 +1603,7 @@
validateModifiersForOperator(modifiers);
return parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType);
}
- reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
+ reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
return null;
}
} else if (matches(Keyword.GET) && matchesIdentifier2(peek())) {
@@ -1620,7 +1620,7 @@
validateModifiersForOperator(modifiers);
return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
}
- reportError8(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
+ reportError9(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
return null;
} else if (matches4(peek(), TokenType.PERIOD) && matchesIdentifier2(peek2(2)) && matches4(peek2(3), TokenType.OPEN_PAREN)) {
return parseConstructor(commentAndMetadata, modifiers.externalKeyword, validateModifiersForConstructor(modifiers), modifiers.factoryKeyword, parseSimpleIdentifier(), andAdvance, parseSimpleIdentifier(), parseFormalParameterList());
@@ -1635,7 +1635,7 @@
return parseMethodDeclaration2(commentAndMetadata, modifiers.externalKeyword, modifiers.staticKeyword, null, methodName, parameters);
} else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) {
if (modifiers.constKeyword == null && modifiers.finalKeyword == null && modifiers.varKeyword == null) {
- reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
+ reportError8(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
}
return parseInitializedIdentifierList(commentAndMetadata, modifiers.staticKeyword, validateModifiersForField(modifiers), null);
}
@@ -1657,7 +1657,7 @@
validateModifiersForOperator(modifiers);
return parseOperator(commentAndMetadata, modifiers.externalKeyword, type);
}
- reportError8(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
+ reportError9(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
return null;
} else if (matches4(peek(), TokenType.OPEN_PAREN)) {
SimpleIdentifier methodName = parseSimpleIdentifier();
@@ -1691,7 +1691,7 @@
Token memberStart = _currentToken;
while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && (closingBracket != null || (!matches(Keyword.CLASS) && !matches(Keyword.TYPEDEF)))) {
if (matches5(TokenType.SEMICOLON)) {
- reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
+ reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
advance();
} else {
ClassMember member = parseClassMember(className);
@@ -1700,7 +1700,7 @@
}
}
if (identical(_currentToken, memberStart)) {
- reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
+ reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
advance();
}
memberStart = _currentToken;
@@ -1748,12 +1748,12 @@
semicolon = andAdvance;
} else {
if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
- reportError7(ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme]);
+ reportError8(ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme]);
Token leftBracket = andAdvance;
parseClassMembers(className.name, getEndToken(leftBracket));
expect2(TokenType.CLOSE_CURLY_BRACKET);
} else {
- reportError8(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [TokenType.SEMICOLON.lexeme]);
+ reportError9(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [TokenType.SEMICOLON.lexeme]);
}
semicolon = createSyntheticToken2(TokenType.SEMICOLON);
}
@@ -1954,15 +1954,15 @@
if ((matches(Keyword.IMPORT) || matches(Keyword.EXPORT) || matches(Keyword.LIBRARY) || matches(Keyword.PART)) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
Directive directive = parseDirective(commentAndMetadata);
if (declarations.length > 0 && !directiveFoundAfterDeclaration) {
- reportError7(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, []);
+ reportError8(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION, []);
directiveFoundAfterDeclaration = true;
}
if (directive is LibraryDirective) {
if (libraryDirectiveFound) {
- reportError7(ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, []);
+ reportError8(ParserErrorCode.MULTIPLE_LIBRARY_DIRECTIVES, []);
} else {
if (directives.length > 0) {
- reportError7(ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, []);
+ reportError8(ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, []);
}
libraryDirectiveFound = true;
}
@@ -1970,28 +1970,28 @@
partDirectiveFound = true;
} else if (partDirectiveFound) {
if (directive is ExportDirective) {
- reportError8(ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []);
+ reportError9(ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []);
} else if (directive is ImportDirective) {
- reportError8(ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []);
+ reportError9(ParserErrorCode.IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, ((directive as NamespaceDirective)).keyword, []);
}
}
if (directive is PartOfDirective) {
if (partOfDirectiveFound) {
- reportError7(ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, []);
+ reportError8(ParserErrorCode.MULTIPLE_PART_OF_DIRECTIVES, []);
} else {
for (Directive preceedingDirective in directives) {
- reportError8(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, preceedingDirective.keyword, []);
+ reportError9(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, preceedingDirective.keyword, []);
}
partOfDirectiveFound = true;
}
} else {
if (partOfDirectiveFound) {
- reportError8(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directive.keyword, []);
+ reportError9(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, directive.keyword, []);
}
}
directives.add(directive);
} else if (matches5(TokenType.SEMICOLON)) {
- reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
+ reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
advance();
} else {
CompilationUnitMember member = parseCompilationUnitMember(commentAndMetadata);
@@ -2000,7 +2000,7 @@
}
}
if (identical(_currentToken, memberStart)) {
- reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
+ reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
advance();
while (!matches5(TokenType.EOF) && !couldBeStartOfCompilationUnitMember()) {
advance();
@@ -2045,7 +2045,7 @@
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, null);
} else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
- reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
+ reportError9(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType));
} else if (matchesIdentifier() && matchesAny(peek(), [
TokenType.OPEN_PAREN,
@@ -2060,24 +2060,24 @@
return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
}
}
- reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
+ reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
return null;
}
} else if ((matches(Keyword.GET) || matches(Keyword.SET)) && matchesIdentifier2(peek())) {
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, null);
} else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
- reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
+ reportError9(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modifiers.externalKeyword, null));
} else if (!matchesIdentifier()) {
- reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
+ reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
return null;
} else if (matches4(peek(), TokenType.OPEN_PAREN)) {
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, null);
} else if (matchesAny(peek(), [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) {
if (modifiers.constKeyword == null && modifiers.finalKeyword == null && modifiers.varKeyword == null) {
- reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
+ reportError8(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
}
return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), null), expect2(TokenType.SEMICOLON));
}
@@ -2086,12 +2086,12 @@
validateModifiersForTopLevelFunction(modifiers);
return parseFunctionDeclaration(commentAndMetadata, modifiers.externalKeyword, returnType);
} else if (matches(Keyword.OPERATOR) && isOperator(peek())) {
- reportError8(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
+ reportError9(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken, []);
return convertToFunctionDeclaration(parseOperator(commentAndMetadata, modifiers.externalKeyword, returnType));
} else if (matches5(TokenType.AT)) {
return new TopLevelVariableDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, parseVariableDeclarationList2(null, validateModifiersForTopLevelVariable(modifiers), returnType), expect2(TokenType.SEMICOLON));
} else if (!matchesIdentifier()) {
- reportError8(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
+ reportError9(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken, []);
Token semicolon;
if (matches5(TokenType.SEMICOLON)) {
semicolon = andAdvance;
@@ -2194,10 +2194,10 @@
} else {
body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false);
if (constKeyword != null && factoryKeyword != null) {
- reportError8(ParserErrorCode.CONST_FACTORY, factoryKeyword, []);
+ reportError9(ParserErrorCode.CONST_FACTORY, factoryKeyword, []);
} else if (body is EmptyFunctionBody) {
if (factoryKeyword != null && externalKeyword == null) {
- reportError8(ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword, []);
+ reportError9(ParserErrorCode.FACTORY_WITHOUT_BODY, factoryKeyword, []);
}
} else {
if (constKeyword != null) {
@@ -2279,14 +2279,14 @@
Statement parseContinueStatement() {
Token continueKeyword = expect(Keyword.CONTINUE);
if (!_inLoop && !_inSwitch) {
- reportError8(ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, continueKeyword, []);
+ reportError9(ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, continueKeyword, []);
}
SimpleIdentifier label = null;
if (matchesIdentifier()) {
label = parseSimpleIdentifier();
}
if (_inSwitch && !_inLoop && label == null) {
- reportError8(ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, continueKeyword, []);
+ reportError9(ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, continueKeyword, []);
}
Token semicolon = expect2(TokenType.SEMICOLON);
return new ContinueStatement.full(continueKeyword, label, semicolon);
@@ -2574,7 +2574,7 @@
if (isTypedIdentifier(_currentToken)) {
type = parseReturnType();
} else if (!optional) {
- reportError7(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
+ reportError8(ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, []);
}
}
return new FinalConstVarOrType(keyword, type);
@@ -2602,7 +2602,7 @@
Token seperator = andAdvance;
Expression defaultValue = parseExpression2();
if (identical(kind, ParameterKind.NAMED)) {
- reportError8(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER, seperator, []);
+ reportError9(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER, seperator, []);
} else if (identical(kind, ParameterKind.REQUIRED)) {
reportError(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, parameter, []);
}
@@ -2611,7 +2611,7 @@
Token seperator = andAdvance;
Expression defaultValue = parseExpression2();
if (identical(kind, ParameterKind.POSITIONAL)) {
- reportError8(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, seperator, []);
+ reportError9(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, seperator, []);
} else if (identical(kind, ParameterKind.REQUIRED)) {
reportError(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, parameter, []);
}
@@ -2673,9 +2673,9 @@
firstParameter = false;
} else if (!optional(TokenType.COMMA)) {
if (getEndToken(leftParenthesis) != null) {
- reportError7(ParserErrorCode.EXPECTED_TOKEN, [TokenType.COMMA.lexeme]);
+ reportError8(ParserErrorCode.EXPECTED_TOKEN, [TokenType.COMMA.lexeme]);
} else {
- reportError8(ParserErrorCode.MISSING_CLOSING_PARENTHESIS, _currentToken.previous, []);
+ reportError9(ParserErrorCode.MISSING_CLOSING_PARENTHESIS, _currentToken.previous, []);
break;
}
}
@@ -2683,11 +2683,11 @@
if (matches5(TokenType.OPEN_SQUARE_BRACKET)) {
wasOptionalParameter = true;
if (leftSquareBracket != null && !reportedMuliplePositionalGroups) {
- reportError7(ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, []);
+ reportError8(ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, []);
reportedMuliplePositionalGroups = true;
}
if (leftCurlyBracket != null && !reportedMixedGroups) {
- reportError7(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
+ reportError8(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
reportedMixedGroups = true;
}
leftSquareBracket = andAdvance;
@@ -2696,11 +2696,11 @@
} else if (matches5(TokenType.OPEN_CURLY_BRACKET)) {
wasOptionalParameter = true;
if (leftCurlyBracket != null && !reportedMulipleNamedGroups) {
- reportError7(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, []);
+ reportError8(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, []);
reportedMulipleNamedGroups = true;
}
if (leftSquareBracket != null && !reportedMixedGroups) {
- reportError7(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
+ reportError8(ParserErrorCode.MIXED_PARAMETER_GROUPS, []);
reportedMixedGroups = true;
}
leftCurlyBracket = andAdvance;
@@ -2718,11 +2718,11 @@
currentParameters = normalParameters;
if (leftSquareBracket == null) {
if (leftCurlyBracket != null) {
- reportError7(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
+ reportError8(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
rightCurlyBracket = rightSquareBracket;
rightSquareBracket = null;
} else {
- reportError7(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["["]);
+ reportError8(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["["]);
}
}
kind = ParameterKind.REQUIRED;
@@ -2731,11 +2731,11 @@
currentParameters = normalParameters;
if (leftCurlyBracket == null) {
if (leftSquareBracket != null) {
- reportError7(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
+ reportError8(ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
rightSquareBracket = rightCurlyBracket;
rightCurlyBracket = null;
} else {
- reportError7(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["{"]);
+ reportError8(ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, ["{"]);
}
}
kind = ParameterKind.REQUIRED;
@@ -2743,10 +2743,10 @@
} while (!matches5(TokenType.CLOSE_PAREN) && initialToken != _currentToken);
Token rightParenthesis = expect2(TokenType.CLOSE_PAREN);
if (leftSquareBracket != null && rightSquareBracket == null) {
- reportError7(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
+ reportError8(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["]"]);
}
if (leftCurlyBracket != null && rightCurlyBracket == null) {
- reportError7(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
+ reportError8(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP, ["}"]);
}
if (leftSquareBracket == null) {
leftSquareBracket = leftCurlyBracket;
@@ -2799,15 +2799,15 @@
if (matches(Keyword.IN)) {
DeclaredIdentifier loopVariable = null;
if (variableList == null) {
- reportError7(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []);
+ reportError8(ParserErrorCode.MISSING_VARIABLE_IN_FOR_EACH, []);
} else {
NodeList<VariableDeclaration> variables = variableList.variables;
if (variables.length > 1) {
- reportError7(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [variables.length.toString()]);
+ reportError8(ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH, [variables.length.toString()]);
}
VariableDeclaration variable = variables[0];
if (variable.initializer != null) {
- reportError7(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, []);
+ reportError8(ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH, []);
}
loopVariable = new DeclaredIdentifier.full(commentAndMetadata.comment, commentAndMetadata.metadata, variableList.keyword, variableList.type, variable.name);
}
@@ -2863,7 +2863,7 @@
try {
if (matches5(TokenType.SEMICOLON)) {
if (!mayBeEmpty) {
- reportError7(emptyErrorCode, []);
+ reportError8(emptyErrorCode, []);
}
return new EmptyFunctionBody.full(andAdvance);
} else if (matches5(TokenType.FUNCTION)) {
@@ -2884,7 +2884,7 @@
}
return new NativeFunctionBody.full(nativeToken, stringLiteral, expect2(TokenType.SEMICOLON));
} else {
- reportError7(emptyErrorCode, []);
+ reportError8(emptyErrorCode, []);
return new EmptyFunctionBody.full(createSyntheticToken2(TokenType.SEMICOLON));
}
} finally {
@@ -2925,10 +2925,10 @@
parameters = parseFormalParameterList();
validateFormalParameterList(parameters);
} else {
- reportError7(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, []);
+ reportError8(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, []);
}
} else if (matches5(TokenType.OPEN_PAREN)) {
- reportError7(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
+ reportError8(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
parseFormalParameterList();
}
FunctionBody body;
@@ -3014,12 +3014,12 @@
typeParameters = parseTypeParameterList();
}
if (matches5(TokenType.SEMICOLON) || matches5(TokenType.EOF)) {
- reportError7(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
+ reportError8(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
FormalParameterList parameters = new FormalParameterList.full(createSyntheticToken2(TokenType.OPEN_PAREN), null, null, null, createSyntheticToken2(TokenType.CLOSE_PAREN));
Token semicolon = expect2(TokenType.SEMICOLON);
return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMetadata.metadata, keyword, returnType, name, typeParameters, parameters, semicolon);
} else if (!matches5(TokenType.OPEN_PAREN)) {
- reportError7(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
+ reportError8(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, []);
return new FunctionTypeAlias.full(commentAndMetadata.comment, commentAndMetadata.metadata, keyword, returnType, name, typeParameters, new FormalParameterList.full(createSyntheticToken2(TokenType.OPEN_PAREN), null, null, null, createSyntheticToken2(TokenType.CLOSE_PAREN)), createSyntheticToken2(TokenType.SEMICOLON));
}
FormalParameterList parameters = parseFormalParameterList();
@@ -3051,13 +3051,13 @@
Token propertyKeyword = expect(Keyword.GET);
SimpleIdentifier name = parseSimpleIdentifier();
if (matches5(TokenType.OPEN_PAREN) && matches4(peek(), TokenType.CLOSE_PAREN)) {
- reportError7(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
+ reportError8(ParserErrorCode.GETTER_WITH_PARAMETERS, []);
advance();
advance();
}
FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeyword == null, ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, false);
if (externalKeyword != null && body is! EmptyFunctionBody) {
- reportError7(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY, []);
+ reportError8(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY, []);
}
return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null, name, null, body);
}
@@ -3255,7 +3255,7 @@
StringLiteral string = parseStringLiteral();
reportError(ParserErrorCode.NON_IDENTIFIER_LIBRARY_NAME, string, []);
} else {
- reportError8(missingNameError, missingNameToken, []);
+ reportError9(missingNameError, missingNameToken, []);
}
List<SimpleIdentifier> components = new List<SimpleIdentifier>();
components.add(createSyntheticIdentifier());
@@ -3332,7 +3332,7 @@
} else if (matches5(TokenType.OPEN_SQUARE_BRACKET) || matches5(TokenType.INDEX)) {
return parseListLiteral(modifier, typeArguments);
}
- reportError7(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, []);
+ reportError8(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL, []);
return new ListLiteral.full(modifier, typeArguments, createSyntheticToken2(TokenType.OPEN_SQUARE_BRACKET), null, createSyntheticToken2(TokenType.CLOSE_SQUARE_BRACKET));
}
@@ -3502,49 +3502,49 @@
while (progress) {
if (matches(Keyword.ABSTRACT) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
if (modifiers.abstractKeyword != null) {
- reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
advance();
} else {
modifiers.abstractKeyword = andAdvance;
}
} else if (matches(Keyword.CONST)) {
if (modifiers.constKeyword != null) {
- reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
advance();
} else {
modifiers.constKeyword = andAdvance;
}
} else if (matches(Keyword.EXTERNAL) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
if (modifiers.externalKeyword != null) {
- reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
advance();
} else {
modifiers.externalKeyword = andAdvance;
}
} else if (matches(Keyword.FACTORY) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
if (modifiers.factoryKeyword != null) {
- reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
advance();
} else {
modifiers.factoryKeyword = andAdvance;
}
} else if (matches(Keyword.FINAL)) {
if (modifiers.finalKeyword != null) {
- reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
advance();
} else {
modifiers.finalKeyword = andAdvance;
}
} else if (matches(Keyword.STATIC) && !matches4(peek(), TokenType.PERIOD) && !matches4(peek(), TokenType.LT)) {
if (modifiers.staticKeyword != null) {
- reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
advance();
} else {
modifiers.staticKeyword = andAdvance;
}
} else if (matches(Keyword.VAR)) {
if (modifiers.varKeyword != null) {
- reportError7(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
advance();
} else {
modifiers.varKeyword = andAdvance;
@@ -3686,7 +3686,7 @@
} else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
return parseVariableDeclarationStatement2(commentAndMetadata, null, returnType);
}
- reportError7(ParserErrorCode.MISSING_STATEMENT, []);
+ reportError8(ParserErrorCode.MISSING_STATEMENT, []);
return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON));
}
} else if (identical(keyword, Keyword.CONST)) {
@@ -3708,7 +3708,7 @@
} else if (identical(keyword, Keyword.NEW) || identical(keyword, Keyword.TRUE) || identical(keyword, Keyword.FALSE) || identical(keyword, Keyword.NULL) || identical(keyword, Keyword.SUPER) || identical(keyword, Keyword.THIS)) {
return new ExpressionStatement.full(parseExpression2(), expect2(TokenType.SEMICOLON));
} else {
- reportError7(ParserErrorCode.MISSING_STATEMENT, []);
+ reportError8(ParserErrorCode.MISSING_STATEMENT, []);
return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON));
}
} else if (matches5(TokenType.SEMICOLON)) {
@@ -3718,7 +3718,7 @@
} else if (isFunctionDeclaration()) {
return parseFunctionDeclarationStatement();
} else if (matches5(TokenType.CLOSE_CURLY_BRACKET)) {
- reportError7(ParserErrorCode.MISSING_STATEMENT, []);
+ reportError8(ParserErrorCode.MISSING_STATEMENT, []);
return new EmptyStatement.full(createSyntheticToken2(TokenType.SEMICOLON));
} else {
return new ExpressionStatement.full(parseExpression2(), expect2(TokenType.SEMICOLON));
@@ -3761,7 +3761,7 @@
FormalParameterList parameters = parseFormalParameterList();
if (thisKeyword == null) {
if (holder.keyword != null) {
- reportError8(ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyword, []);
+ reportError9(ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyword, []);
}
return new FunctionTypedFormalParameter.full(commentAndMetadata.comment, commentAndMetadata.metadata, holder.type, identifier, parameters);
} else {
@@ -3771,9 +3771,9 @@
TypeName type = holder.type;
if (type != null) {
if (matches3(type.name.beginToken, Keyword.VOID)) {
- reportError8(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []);
+ reportError9(ParserErrorCode.VOID_PARAMETER, type.name.beginToken, []);
} else if (holder.keyword != null && matches3(holder.keyword, Keyword.VAR)) {
- reportError8(ParserErrorCode.VAR_AND_TYPE, holder.keyword, []);
+ reportError9(ParserErrorCode.VAR_AND_TYPE, holder.keyword, []);
}
}
if (thisKeyword != null) {
@@ -3805,17 +3805,17 @@
if (matches(Keyword.OPERATOR)) {
operatorKeyword = andAdvance;
} else {
- reportError8(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []);
+ reportError9(ParserErrorCode.MISSING_KEYWORD_OPERATOR, _currentToken, []);
operatorKeyword = createSyntheticToken(Keyword.OPERATOR);
}
if (!_currentToken.isUserDefinableOperator) {
- reportError7(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.lexeme]);
}
SimpleIdentifier name = new SimpleIdentifier.full(andAdvance);
if (matches5(TokenType.EQ)) {
Token previous = _currentToken.previous;
if ((matches4(previous, TokenType.EQ_EQ) || matches4(previous, TokenType.BANG_EQ)) && _currentToken.offset == previous.offset + 2) {
- reportError7(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_currentToken.lexeme}"]);
+ reportError8(ParserErrorCode.INVALID_OPERATOR, ["${previous.lexeme}${_currentToken.lexeme}"]);
advance();
}
}
@@ -3823,7 +3823,7 @@
validateFormalParameterList(parameters);
FunctionBody body = parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false);
if (externalKeyword != null && body is! EmptyFunctionBody) {
- reportError7(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []);
+ reportError8(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY, []);
}
return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, externalKeyword, null, returnType, null, operatorKeyword, name, parameters, body);
}
@@ -3908,7 +3908,7 @@
return operand;
}
if (operand is Literal || operand is FunctionExpressionInvocation) {
- reportError7(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
+ reportError8(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
}
Token operator = andAdvance;
return new PostfixExpression.full(operand, operator);
@@ -4021,13 +4021,13 @@
} else if (matches5(TokenType.QUESTION)) {
return parseArgumentDefinitionTest();
} else if (matches(Keyword.VOID)) {
- reportError7(ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]);
+ reportError8(ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken.lexeme]);
advance();
return parsePrimaryExpression();
} else if (matches5(TokenType.HASH)) {
return parseSymbolLiteral();
} else {
- reportError7(ParserErrorCode.MISSING_IDENTIFIER, []);
+ reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
return createSyntheticIdentifier();
}
}
@@ -4167,7 +4167,7 @@
validateFormalParameterList(parameters);
FunctionBody body = parseFunctionBody(externalKeyword != null || staticKeyword == null, ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, false);
if (externalKeyword != null && body is! EmptyFunctionBody) {
- reportError7(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY, []);
+ reportError8(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY, []);
}
return new MethodDeclaration.full(commentAndMetadata.comment, commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, propertyKeyword, null, name, parameters, body);
}
@@ -4211,7 +4211,7 @@
if (matchesIdentifier()) {
return new SimpleIdentifier.full(andAdvance);
}
- reportError7(ParserErrorCode.MISSING_IDENTIFIER, []);
+ reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
return createSyntheticIdentifier();
}
@@ -4255,7 +4255,7 @@
while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && !isSwitchMember()) {
statements.add(parseStatement2());
if (identical(_currentToken, statementStart)) {
- reportError8(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
+ reportError9(ParserErrorCode.UNEXPECTED_TOKEN, _currentToken, [_currentToken.lexeme]);
advance();
}
statementStart = _currentToken;
@@ -4319,7 +4319,7 @@
}
}
if (strings.length < 1) {
- reportError7(ParserErrorCode.EXPECTED_STRING_LITERAL, []);
+ reportError8(ParserErrorCode.EXPECTED_STRING_LITERAL, []);
return createSyntheticStringLiteral();
} else if (strings.length == 1) {
return strings[0];
@@ -4384,7 +4384,7 @@
SimpleIdentifier identifier = parseSimpleIdentifier();
String label = identifier.token.lexeme;
if (definedLabels.contains(label)) {
- reportError8(ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, identifier.token, [label]);
+ reportError9(ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, identifier.token, [label]);
} else {
javaSetAdd(definedLabels, label);
}
@@ -4397,17 +4397,17 @@
Token colon = expect2(TokenType.COLON);
members.add(new SwitchCase.full(labels, caseKeyword, caseExpression, colon, parseStatements2()));
if (defaultKeyword != null) {
- reportError8(ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, caseKeyword, []);
+ reportError9(ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, caseKeyword, []);
}
} else if (matches(Keyword.DEFAULT)) {
if (defaultKeyword != null) {
- reportError8(ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, peek(), []);
+ reportError9(ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, peek(), []);
}
defaultKeyword = andAdvance;
Token colon = expect2(TokenType.COLON);
members.add(new SwitchDefault.full(labels, defaultKeyword, colon, parseStatements2()));
} else {
- reportError7(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, []);
+ reportError8(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, []);
while (!matches5(TokenType.EOF) && !matches5(TokenType.CLOSE_CURLY_BRACKET) && !matches(Keyword.CASE) && !matches(Keyword.DEFAULT)) {
advance();
}
@@ -4440,7 +4440,7 @@
if (matches5(TokenType.IDENTIFIER)) {
components.add(andAdvance);
} else {
- reportError7(ParserErrorCode.MISSING_IDENTIFIER, []);
+ reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
components.add(createSyntheticToken2(TokenType.IDENTIFIER));
break;
}
@@ -4448,7 +4448,7 @@
} else if (_currentToken.isOperator) {
components.add(andAdvance);
} else {
- reportError7(ParserErrorCode.MISSING_IDENTIFIER, []);
+ reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
components.add(createSyntheticToken2(TokenType.IDENTIFIER));
}
return new SymbolLiteral.full(poundSign, new List.from(components));
@@ -4467,7 +4467,7 @@
Expression parseThrowExpression() {
Token keyword = expect(Keyword.THROW);
if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) {
- reportError8(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
+ reportError9(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
return new ThrowExpression.full(keyword, createSyntheticIdentifier());
}
Expression expression = parseExpression2();
@@ -4487,7 +4487,7 @@
Expression parseThrowExpressionWithoutCascade() {
Token keyword = expect(Keyword.THROW);
if (matches5(TokenType.SEMICOLON) || matches5(TokenType.CLOSE_PAREN)) {
- reportError8(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
+ reportError9(ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken, []);
return new ThrowExpression.full(keyword, createSyntheticIdentifier());
}
Expression expression = parseExpressionWithoutCascade();
@@ -4551,7 +4551,7 @@
finallyClause = parseBlock();
} else {
if (catchClauses.isEmpty) {
- reportError7(ParserErrorCode.MISSING_CATCH_OR_FINALLY, []);
+ reportError8(ParserErrorCode.MISSING_CATCH_OR_FINALLY, []);
}
}
return new TryStatement.full(tryKeyword, body, catchClauses, finallyKeyword, finallyClause);
@@ -4637,13 +4637,13 @@
TypeName parseTypeName() {
Identifier typeName;
if (matches(Keyword.VAR)) {
- reportError7(ParserErrorCode.VAR_AS_TYPE_NAME, []);
+ reportError8(ParserErrorCode.VAR_AS_TYPE_NAME, []);
typeName = new SimpleIdentifier.full(andAdvance);
} else if (matchesIdentifier()) {
typeName = parsePrefixedIdentifier();
} else {
typeName = createSyntheticIdentifier();
- reportError7(ParserErrorCode.EXPECTED_TYPE_NAME, []);
+ reportError8(ParserErrorCode.EXPECTED_TYPE_NAME, []);
}
TypeArgumentList typeArguments = null;
if (matches5(TokenType.LT)) {
@@ -4733,13 +4733,13 @@
operator.previous.setNext(firstOperator);
return new PrefixExpression.full(firstOperator, new PrefixExpression.full(secondOperator, new SuperExpression.full(andAdvance)));
} else {
- reportError7(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lexeme]);
+ reportError8(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lexeme]);
return new PrefixExpression.full(operator, new SuperExpression.full(andAdvance));
}
}
return new PrefixExpression.full(operator, parseAssignableExpression(false));
} else if (matches5(TokenType.PLUS)) {
- reportError7(ParserErrorCode.MISSING_IDENTIFIER, []);
+ reportError8(ParserErrorCode.MISSING_IDENTIFIER, []);
return createSyntheticIdentifier();
}
return parsePostfixExpression();
@@ -4800,7 +4800,7 @@
*/
VariableDeclarationList parseVariableDeclarationList2(CommentAndMetadata commentAndMetadata, Token keyword, TypeName type) {
if (type != null && keyword != null && matches3(keyword, Keyword.VAR)) {
- reportError8(ParserErrorCode.VAR_AND_TYPE, keyword, []);
+ reportError9(ParserErrorCode.VAR_AND_TYPE, keyword, []);
}
List<VariableDeclaration> variables = new List<VariableDeclaration>();
variables.add(parseVariableDeclaration());
@@ -4935,8 +4935,8 @@
* @param errorCode the error code of the error to be reported
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportError7(ParserErrorCode errorCode, List<Object> arguments) {
- reportError8(errorCode, _currentToken, arguments);
+ void reportError8(ParserErrorCode errorCode, List<Object> arguments) {
+ reportError9(errorCode, _currentToken, arguments);
}
/**
@@ -4946,7 +4946,7 @@
* @param token the token specifying the location of the error
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportError8(ParserErrorCode errorCode, Token token, List<Object> arguments) {
+ void reportError9(ParserErrorCode errorCode, Token token, List<Object> arguments) {
_errorListener.onError(new AnalysisError.con2(_source, token.offset, token.length, errorCode, arguments));
}
@@ -5384,28 +5384,28 @@
builder.appendChar(0xB);
} else if (currentChar == 0x78) {
if (currentIndex + 2 >= length) {
- reportError7(ParserErrorCode.INVALID_HEX_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_HEX_ESCAPE, []);
return length;
}
int firstDigit = lexeme.codeUnitAt(currentIndex + 1);
int secondDigit = lexeme.codeUnitAt(currentIndex + 2);
if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit)) {
- reportError7(ParserErrorCode.INVALID_HEX_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_HEX_ESCAPE, []);
} else {
- builder.appendChar((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) as int));
+ builder.appendChar(((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) as int);
}
return currentIndex + 3;
} else if (currentChar == 0x75) {
currentIndex++;
if (currentIndex >= length) {
- reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
return length;
}
currentChar = lexeme.codeUnitAt(currentIndex);
if (currentChar == 0x7B) {
currentIndex++;
if (currentIndex >= length) {
- reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
return length;
}
currentChar = lexeme.codeUnitAt(currentIndex);
@@ -5413,7 +5413,7 @@
int value = 0;
while (currentChar != 0x7D) {
if (!isHexDigit(currentChar)) {
- reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
currentIndex++;
while (currentIndex < length && lexeme.codeUnitAt(currentIndex) != 0x7D) {
currentIndex++;
@@ -5424,19 +5424,19 @@
value = (value << 4) + Character.digit(currentChar, 16);
currentIndex++;
if (currentIndex >= length) {
- reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
return length;
}
currentChar = lexeme.codeUnitAt(currentIndex);
}
if (digitCount < 1 || digitCount > 6) {
- reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
}
appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), value, index, currentIndex);
return currentIndex + 1;
} else {
if (currentIndex + 3 >= length) {
- reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
return length;
}
int firstDigit = currentChar;
@@ -5444,9 +5444,9 @@
int thirdDigit = lexeme.codeUnitAt(currentIndex + 2);
int fourthDigit = lexeme.codeUnitAt(currentIndex + 3);
if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit) || !isHexDigit(thirdDigit) || !isHexDigit(fourthDigit)) {
- reportError7(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
+ reportError8(ParserErrorCode.INVALID_UNICODE_ESCAPE, []);
} else {
- appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), ((((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) << 4) + Character.digit(thirdDigit, 16)) << 4) + Character.digit(fourthDigit, 16)), index, currentIndex + 3);
+ appendScalarValue(builder, lexeme.substring(index, currentIndex + 1), (((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) << 4) + Character.digit(thirdDigit, 16)) << 4) + Character.digit(fourthDigit, 16), index, currentIndex + 3);
}
return currentIndex + 4;
}
@@ -5478,16 +5478,16 @@
Token validateModifiersForClass(Modifiers modifiers) {
validateModifiersForTopLevelDeclaration(modifiers);
if (modifiers.constKeyword != null) {
- reportError8(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
+ reportError9(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
}
if (modifiers.externalKeyword != null) {
- reportError8(ParserErrorCode.EXTERNAL_CLASS, modifiers.externalKeyword, []);
+ reportError9(ParserErrorCode.EXTERNAL_CLASS, modifiers.externalKeyword, []);
}
if (modifiers.finalKeyword != null) {
- reportError8(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
+ reportError9(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
}
if (modifiers.varKeyword != null) {
- reportError8(ParserErrorCode.VAR_CLASS, modifiers.varKeyword, []);
+ reportError9(ParserErrorCode.VAR_CLASS, modifiers.varKeyword, []);
}
return modifiers.abstractKeyword;
}
@@ -5501,25 +5501,25 @@
*/
Token validateModifiersForConstructor(Modifiers modifiers) {
if (modifiers.abstractKeyword != null) {
- reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
+ reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
}
if (modifiers.finalKeyword != null) {
- reportError8(ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword, []);
+ reportError9(ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword, []);
}
if (modifiers.staticKeyword != null) {
- reportError8(ParserErrorCode.STATIC_CONSTRUCTOR, modifiers.staticKeyword, []);
+ reportError9(ParserErrorCode.STATIC_CONSTRUCTOR, modifiers.staticKeyword, []);
}
if (modifiers.varKeyword != null) {
- reportError8(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, modifiers.varKeyword, []);
+ reportError9(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, modifiers.varKeyword, []);
}
Token externalKeyword = modifiers.externalKeyword;
Token constKeyword = modifiers.constKeyword;
Token factoryKeyword = modifiers.factoryKeyword;
if (externalKeyword != null && constKeyword != null && constKeyword.offset < externalKeyword.offset) {
- reportError8(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword, []);
+ reportError9(ParserErrorCode.EXTERNAL_AFTER_CONST, externalKeyword, []);
}
if (externalKeyword != null && factoryKeyword != null && factoryKeyword.offset < externalKeyword.offset) {
- reportError8(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword, []);
+ reportError9(ParserErrorCode.EXTERNAL_AFTER_FACTORY, externalKeyword, []);
}
return constKeyword;
}
@@ -5533,13 +5533,13 @@
*/
Token validateModifiersForField(Modifiers modifiers) {
if (modifiers.abstractKeyword != null) {
- reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
+ reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
}
if (modifiers.externalKeyword != null) {
- reportError8(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
+ reportError9(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
}
if (modifiers.factoryKeyword != null) {
- reportError8(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
+ reportError9(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
}
Token staticKeyword = modifiers.staticKeyword;
Token constKeyword = modifiers.constKeyword;
@@ -5547,23 +5547,23 @@
Token varKeyword = modifiers.varKeyword;
if (constKeyword != null) {
if (finalKeyword != null) {
- reportError8(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
+ reportError9(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
}
if (varKeyword != null) {
- reportError8(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
+ reportError9(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
}
if (staticKeyword != null && constKeyword.offset < staticKeyword.offset) {
- reportError8(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword, []);
+ reportError9(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword, []);
}
} else if (finalKeyword != null) {
if (varKeyword != null) {
- reportError8(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
+ reportError9(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
}
if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) {
- reportError8(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword, []);
+ reportError9(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword, []);
}
} else if (varKeyword != null && staticKeyword != null && varKeyword.offset < staticKeyword.offset) {
- reportError8(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword, []);
+ reportError9(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword, []);
}
return lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
}
@@ -5575,7 +5575,7 @@
*/
void validateModifiersForFunctionDeclarationStatement(Modifiers modifiers) {
if (modifiers.abstractKeyword != null || modifiers.constKeyword != null || modifiers.externalKeyword != null || modifiers.factoryKeyword != null || modifiers.finalKeyword != null || modifiers.staticKeyword != null || modifiers.varKeyword != null) {
- reportError7(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, []);
+ reportError8(ParserErrorCode.LOCAL_FUNCTION_DECLARATION_MODIFIER, []);
}
}
@@ -5586,24 +5586,24 @@
*/
void validateModifiersForGetterOrSetterOrMethod(Modifiers modifiers) {
if (modifiers.abstractKeyword != null) {
- reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
+ reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
}
if (modifiers.constKeyword != null) {
- reportError8(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
+ reportError9(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
}
if (modifiers.factoryKeyword != null) {
- reportError8(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
+ reportError9(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
}
if (modifiers.finalKeyword != null) {
- reportError8(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
+ reportError9(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
}
if (modifiers.varKeyword != null) {
- reportError8(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
+ reportError9(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
}
Token externalKeyword = modifiers.externalKeyword;
Token staticKeyword = modifiers.staticKeyword;
if (externalKeyword != null && staticKeyword != null && staticKeyword.offset < externalKeyword.offset) {
- reportError8(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword, []);
+ reportError9(ParserErrorCode.EXTERNAL_AFTER_STATIC, externalKeyword, []);
}
}
@@ -5614,22 +5614,22 @@
*/
void validateModifiersForOperator(Modifiers modifiers) {
if (modifiers.abstractKeyword != null) {
- reportError7(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
+ reportError8(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
}
if (modifiers.constKeyword != null) {
- reportError8(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
+ reportError9(ParserErrorCode.CONST_METHOD, modifiers.constKeyword, []);
}
if (modifiers.factoryKeyword != null) {
- reportError8(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
+ reportError9(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword, []);
}
if (modifiers.finalKeyword != null) {
- reportError8(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
+ reportError9(ParserErrorCode.FINAL_METHOD, modifiers.finalKeyword, []);
}
if (modifiers.staticKeyword != null) {
- reportError8(ParserErrorCode.STATIC_OPERATOR, modifiers.staticKeyword, []);
+ reportError9(ParserErrorCode.STATIC_OPERATOR, modifiers.staticKeyword, []);
}
if (modifiers.varKeyword != null) {
- reportError8(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
+ reportError9(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
}
}
@@ -5640,10 +5640,10 @@
*/
void validateModifiersForTopLevelDeclaration(Modifiers modifiers) {
if (modifiers.factoryKeyword != null) {
- reportError8(ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, modifiers.factoryKeyword, []);
+ reportError9(ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, modifiers.factoryKeyword, []);
}
if (modifiers.staticKeyword != null) {
- reportError8(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, modifiers.staticKeyword, []);
+ reportError9(ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION, modifiers.staticKeyword, []);
}
}
@@ -5655,16 +5655,16 @@
void validateModifiersForTopLevelFunction(Modifiers modifiers) {
validateModifiersForTopLevelDeclaration(modifiers);
if (modifiers.abstractKeyword != null) {
- reportError7(ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, []);
+ reportError8(ParserErrorCode.ABSTRACT_TOP_LEVEL_FUNCTION, []);
}
if (modifiers.constKeyword != null) {
- reportError8(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
+ reportError9(ParserErrorCode.CONST_CLASS, modifiers.constKeyword, []);
}
if (modifiers.finalKeyword != null) {
- reportError8(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
+ reportError9(ParserErrorCode.FINAL_CLASS, modifiers.finalKeyword, []);
}
if (modifiers.varKeyword != null) {
- reportError8(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
+ reportError9(ParserErrorCode.VAR_RETURN_TYPE, modifiers.varKeyword, []);
}
}
@@ -5678,24 +5678,24 @@
Token validateModifiersForTopLevelVariable(Modifiers modifiers) {
validateModifiersForTopLevelDeclaration(modifiers);
if (modifiers.abstractKeyword != null) {
- reportError7(ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, []);
+ reportError8(ParserErrorCode.ABSTRACT_TOP_LEVEL_VARIABLE, []);
}
if (modifiers.externalKeyword != null) {
- reportError8(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
+ reportError9(ParserErrorCode.EXTERNAL_FIELD, modifiers.externalKeyword, []);
}
Token constKeyword = modifiers.constKeyword;
Token finalKeyword = modifiers.finalKeyword;
Token varKeyword = modifiers.varKeyword;
if (constKeyword != null) {
if (finalKeyword != null) {
- reportError8(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
+ reportError9(ParserErrorCode.CONST_AND_FINAL, finalKeyword, []);
}
if (varKeyword != null) {
- reportError8(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
+ reportError9(ParserErrorCode.CONST_AND_VAR, varKeyword, []);
}
} else if (finalKeyword != null) {
if (varKeyword != null) {
- reportError8(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
+ reportError9(ParserErrorCode.FINAL_AND_VAR, varKeyword, []);
}
}
return lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
@@ -5710,19 +5710,19 @@
void validateModifiersForTypedef(Modifiers modifiers) {
validateModifiersForTopLevelDeclaration(modifiers);
if (modifiers.abstractKeyword != null) {
- reportError8(ParserErrorCode.ABSTRACT_TYPEDEF, modifiers.abstractKeyword, []);
+ reportError9(ParserErrorCode.ABSTRACT_TYPEDEF, modifiers.abstractKeyword, []);
}
if (modifiers.constKeyword != null) {
- reportError8(ParserErrorCode.CONST_TYPEDEF, modifiers.constKeyword, []);
+ reportError9(ParserErrorCode.CONST_TYPEDEF, modifiers.constKeyword, []);
}
if (modifiers.externalKeyword != null) {
- reportError8(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword, []);
+ reportError9(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.externalKeyword, []);
}
if (modifiers.finalKeyword != null) {
- reportError8(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []);
+ reportError9(ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword, []);
}
if (modifiers.varKeyword != null) {
- reportError8(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []);
+ reportError9(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword, []);
}
}
}
@@ -5745,134 +5745,134 @@
*
* @coverage dart.engine.parser
*/
-class ParserErrorCode implements Enum<ParserErrorCode>, ErrorCode {
- static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con2('ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstract'");
- static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con2('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract'");
- static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode.con2('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared to be 'abstract'");
- static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode.con2('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared to be 'abstract'");
- static final ParserErrorCode ABSTRACT_TYPEDEF = new ParserErrorCode.con2('ABSTRACT_TYPEDEF', 4, "Type aliases cannot be declared to be 'abstract'");
- static final ParserErrorCode BREAK_OUTSIDE_OF_LOOP = new ParserErrorCode.con2('BREAK_OUTSIDE_OF_LOOP', 5, "A break statement cannot be used outside of a loop or switch statement");
- static final ParserErrorCode CONST_AND_FINAL = new ParserErrorCode.con2('CONST_AND_FINAL', 6, "Members cannot be declared to be both 'const' and 'final'");
- static final ParserErrorCode CONST_AND_VAR = new ParserErrorCode.con2('CONST_AND_VAR', 7, "Members cannot be declared to be both 'const' and 'var'");
- static final ParserErrorCode CONST_CLASS = new ParserErrorCode.con2('CONST_CLASS', 8, "Classes cannot be declared to be 'const'");
- static final ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con2('CONST_CONSTRUCTOR_WITH_BODY', 9, "'const' constructors cannot have a body");
- static final ParserErrorCode CONST_FACTORY = new ParserErrorCode.con2('CONST_FACTORY', 10, "Only redirecting factory constructors can be declared to be 'const'");
- static final ParserErrorCode CONST_METHOD = new ParserErrorCode.con2('CONST_METHOD', 11, "Getters, setters and methods cannot be declared to be 'const'");
- static final ParserErrorCode CONST_TYPEDEF = new ParserErrorCode.con2('CONST_TYPEDEF', 12, "Type aliases cannot be declared to be 'const'");
- static final ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = new ParserErrorCode.con2('CONSTRUCTOR_WITH_RETURN_TYPE', 13, "Constructors cannot have a return type");
- static final ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = new ParserErrorCode.con2('CONTINUE_OUTSIDE_OF_LOOP', 14, "A continue statement cannot be used outside of a loop or switch statement");
- static final ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = new ParserErrorCode.con2('CONTINUE_WITHOUT_LABEL_IN_CASE', 15, "A continue statement in a switch statement must have a label as a target");
- static final ParserErrorCode DEPRECATED_ARGUMENT_DEFINITION_TEST = new ParserErrorCode.con2('DEPRECATED_ARGUMENT_DEFINITION_TEST', 16, "The argument definition test ('?' operator) has been deprecated");
- static final ParserErrorCode DIRECTIVE_AFTER_DECLARATION = new ParserErrorCode.con2('DIRECTIVE_AFTER_DECLARATION', 17, "Directives must appear before any declarations");
- static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserErrorCode.con2('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 18, "The label %s was already used in this switch statement");
- static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con2('DUPLICATED_MODIFIER', 19, "The modifier '%s' was already specified.");
- static final ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND = new ParserErrorCode.con2('EQUALITY_CANNOT_BE_EQUALITY_OPERAND', 20, "Equality expression cannot be operand of another equality expression.");
- static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.con2('EXPECTED_CASE_OR_DEFAULT', 21, "Expected 'case' or 'default'");
- static final ParserErrorCode EXPECTED_CLASS_MEMBER = new ParserErrorCode.con2('EXPECTED_CLASS_MEMBER', 22, "Expected a class member");
- static final ParserErrorCode EXPECTED_EXECUTABLE = new ParserErrorCode.con2('EXPECTED_EXECUTABLE', 23, "Expected a method, getter, setter or operator declaration");
- static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCode.con2('EXPECTED_LIST_OR_MAP_LITERAL', 24, "Expected a list or map literal");
- static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con2('EXPECTED_STRING_LITERAL', 25, "Expected a string literal");
- static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con2('EXPECTED_TOKEN', 26, "Expected to find '%s'");
- static final ParserErrorCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = new ParserErrorCode.con2('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', 27, "List literal requires exactly one type arguments or none, but %d found");
- static final ParserErrorCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = new ParserErrorCode.con2('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', 28, "Map literal requires exactly two type arguments or none, but %d found");
- static final ParserErrorCode EXPECTED_TYPE_NAME = new ParserErrorCode.con2('EXPECTED_TYPE_NAME', 29, "Expected a type name");
- static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 30, "Export directives must preceed part directives");
- static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con2('EXTERNAL_AFTER_CONST', 31, "The modifier 'external' should be before the modifier 'const'");
- static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con2('EXTERNAL_AFTER_FACTORY', 32, "The modifier 'external' should be before the modifier 'factory'");
- static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con2('EXTERNAL_AFTER_STATIC', 33, "The modifier 'external' should be before the modifier 'static'");
- static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con2('EXTERNAL_CLASS', 34, "Classes cannot be declared to be 'external'");
- static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_CONSTRUCTOR_WITH_BODY', 35, "External constructors cannot have a body");
- static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con2('EXTERNAL_FIELD', 36, "Fields cannot be declared to be 'external'");
- static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_GETTER_WITH_BODY', 37, "External getters cannot have a body");
- static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_METHOD_WITH_BODY', 38, "External methods cannot have a body");
- static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_OPERATOR_WITH_BODY', 39, "External operators cannot have a body");
- static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_SETTER_WITH_BODY', 40, "External setters cannot have a body");
- static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con2('EXTERNAL_TYPEDEF', 41, "Type aliases cannot be declared to be 'external'");
- static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('FACTORY_TOP_LEVEL_DECLARATION', 42, "Top-level declarations cannot be declared to be 'factory'");
- static final ParserErrorCode FACTORY_WITHOUT_BODY = new ParserErrorCode.con2('FACTORY_WITHOUT_BODY', 43, "A non-redirecting 'factory' constructor must have a body");
- static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new ParserErrorCode.con2('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 44, "Field initializers can only be used in a constructor");
- static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con2('FINAL_AND_VAR', 45, "Members cannot be declared to be both 'final' and 'var'");
- static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con2('FINAL_CLASS', 46, "Classes cannot be declared to be 'final'");
- static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con2('FINAL_CONSTRUCTOR', 47, "A constructor cannot be declared to be 'final'");
- static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con2('FINAL_METHOD', 48, "Getters, setters and methods cannot be declared to be 'final'");
- static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con2('FINAL_TYPEDEF', 49, "Type aliases cannot be declared to be 'final'");
- static final ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = new ParserErrorCode.con2('FUNCTION_TYPED_PARAMETER_VAR', 50, "Function typed parameters cannot specify 'const', 'final' or 'var' instead of return type");
- static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con2('GETTER_WITH_PARAMETERS', 51, "Getter should be declared without a parameter list");
- static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new ParserErrorCode.con2('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 52, "Illegal assignment to non-assignable expression");
- static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_EXTENDS', 53, "The extends clause must be before the implements clause");
- static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_WITH', 54, "The with clause must be before the implements clause");
- static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 55, "Import directives must preceed part directives");
- static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('INITIALIZED_VARIABLE_IN_FOR_EACH', 56, "The loop variable in a for-each loop cannot be initialized");
- static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con2('INVALID_CODE_POINT', 57, "The escape sequence '%s' is not a valid code point");
- static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.con2('INVALID_COMMENT_REFERENCE', 58, "Comment references should contain a possibly prefixed identifier and can start with 'new', but should not contain anything else");
- static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con2('INVALID_HEX_ESCAPE', 59, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits");
- static final ParserErrorCode INVALID_OPERATOR = new ParserErrorCode.con2('INVALID_OPERATOR', 60, "The string '%s' is not a valid operator");
- static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode.con2('INVALID_OPERATOR_FOR_SUPER', 61, "The operator '%s' cannot be used with 'super'");
- static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con2('INVALID_UNICODE_ESCAPE', 62, "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
- static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode.con2('LIBRARY_DIRECTIVE_NOT_FIRST', 63, "The library directive must appear before all other directives");
- static final ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = new ParserErrorCode.con2('LOCAL_FUNCTION_DECLARATION_MODIFIER', 64, "Local function declarations cannot specify any modifier");
- static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode.con2('MISSING_ASSIGNABLE_SELECTOR', 65, "Missing selector such as \".<identifier>\" or \"[0]\"");
- static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.con2('MISSING_CATCH_OR_FINALLY', 66, "A try statement must have either a catch or finally clause");
- static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con2('MISSING_CLASS_BODY', 67, "A class definition must have a body, even if it is empty");
- static final ParserErrorCode MISSING_CLOSING_PARENTHESIS = new ParserErrorCode.con2('MISSING_CLOSING_PARENTHESIS', 68, "The closing parenthesis is missing");
- static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserErrorCode.con2('MISSING_CONST_FINAL_VAR_OR_TYPE', 69, "Variables must be declared using the keywords 'const', 'final', 'var' or a type name");
- static final ParserErrorCode MISSING_EXPRESSION_IN_THROW = new ParserErrorCode.con2('MISSING_EXPRESSION_IN_THROW', 70, "Throw expressions must compute the object to be thrown");
- static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con2('MISSING_FUNCTION_BODY', 71, "A function body must be provided");
- static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode.con2('MISSING_FUNCTION_PARAMETERS', 72, "Functions must have an explicit list of parameters");
- static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con2('MISSING_IDENTIFIER', 73, "Expected an identifier");
- static final ParserErrorCode MISSING_KEYWORD_OPERATOR = new ParserErrorCode.con2('MISSING_KEYWORD_OPERATOR', 74, "Operator declarations must be preceeded by the keyword 'operator'");
- static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 75, "Library directives must include a library name");
- static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_PART_OF_DIRECTIVE', 76, "Library directives must include a library name");
- static final ParserErrorCode MISSING_STATEMENT = new ParserErrorCode.con2('MISSING_STATEMENT', 77, "Expected a statement");
- static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 78, "There is no '%s' to close the parameter group");
- static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode.con2('MISSING_TYPEDEF_PARAMETERS', 79, "Type aliases for functions must have an explicit list of parameters");
- static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('MISSING_VARIABLE_IN_FOR_EACH', 80, "A loop variable must be declared in a for-each loop before the 'in', but none were found");
- static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con2('MIXED_PARAMETER_GROUPS', 81, "Cannot have both positional and named parameters in a single parameter list");
- static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_EXTENDS_CLAUSES', 82, "Each class definition can have at most one extends clause");
- static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_IMPLEMENTS_CLAUSES', 83, "Each class definition can have at most one implements clause");
- static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_LIBRARY_DIRECTIVES', 84, "Only one library directive may be declared in a file");
- static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_NAMED_PARAMETER_GROUPS', 85, "Cannot have multiple groups of named parameters in a single parameter list");
- static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_PART_OF_DIRECTIVES', 86, "Only one part-of directive may be declared in a file");
- static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 87, "Cannot have multiple groups of positional parameters in a single parameter list");
- static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorCode.con2('MULTIPLE_VARIABLES_IN_FOR_EACH', 88, "A single loop variable must be declared in a for-each loop before the 'in', but %s were found");
- static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con2('MULTIPLE_WITH_CLAUSES', 89, "Each class definition can have at most one with clause");
- static final ParserErrorCode NAMED_FUNCTION_EXPRESSION = new ParserErrorCode.con2('NAMED_FUNCTION_EXPRESSION', 90, "Function expressions cannot be named");
- static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('NAMED_PARAMETER_OUTSIDE_GROUP', 91, "Named parameters must be enclosed in curly braces ('{' and '}')");
- static final ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = new ParserErrorCode.con2('NATIVE_CLAUSE_IN_NON_SDK_CODE', 92, "Native clause can only be used in the SDK and code that is loaded through native extensions");
- static final ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = new ParserErrorCode.con2('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 93, "Native functions can only be declared in the SDK and code that is loaded through native extensions");
- static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con2('NON_CONSTRUCTOR_FACTORY', 94, "Only constructors can be declared to be a 'factory'");
- static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode.con2('NON_IDENTIFIER_LIBRARY_NAME', 95, "The name of a library must be an identifier");
- static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCode.con2('NON_PART_OF_DIRECTIVE_IN_PART', 96, "The part-of directive must be the only directive in a part");
- static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode.con2('NON_USER_DEFINABLE_OPERATOR', 97, "The operator '%s' is not user definable");
- static final ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = new ParserErrorCode.con2('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 98, "Normal parameters must occur before optional parameters");
- static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 99, "Positional arguments must occur before named arguments");
- static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 100, "Positional parameters must be enclosed in square brackets ('[' and ']')");
- static final ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = new ParserErrorCode.con2('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 101, "Only factory constructor can specify '=' redirection.");
- static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 102, "The modifier 'static' should be before the modifier 'const'");
- static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 103, "The modifier 'static' should be before the modifier 'final'");
- static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 104, "The modifier 'static' should be before the modifier 'var'");
- static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 105, "Constructors cannot be static");
- static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_GETTER_WITHOUT_BODY', 106, "A 'static' getter must have a body");
- static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 107, "Operators cannot be static");
- static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_SETTER_WITHOUT_BODY', 108, "A 'static' setter must have a body");
- static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 109, "Top-level declarations cannot be declared to be 'static'");
- static final ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = new ParserErrorCode.con2('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 110, "The 'default' case should be the last case in a switch statement");
- static final ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = new ParserErrorCode.con2('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 111, "The 'default' case can only be declared once");
- static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con2('TOP_LEVEL_OPERATOR', 112, "Operators must be declared within a class");
- static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 113, "There is no '%s' to open a parameter group");
- static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 114, "Unexpected token '%s'");
- static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 115, "The extends clause must be before the with clause");
- static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 116, "The with clause cannot be used without an extends clause");
- static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 117, "The default value of a named parameter should be preceeded by ':'");
- static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 118, "The default value of a positional parameter should be preceeded by '='");
- static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 119, "Expected '%s' to close parameter group");
- static final ParserErrorCode VAR_AND_TYPE = new ParserErrorCode.con2('VAR_AND_TYPE', 120, "Variables cannot be declared using both 'var' and a type name; remove the 'var'");
- static final ParserErrorCode VAR_AS_TYPE_NAME = new ParserErrorCode.con2('VAR_AS_TYPE_NAME', 121, "The keyword 'var' cannot be used as a type name");
- static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 122, "Classes cannot be declared to be 'var'");
- static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 123, "The return type cannot be 'var'");
- static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 124, "Type aliases cannot be declared to be 'var'");
- static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 125, "Parameters cannot have a type of 'void'");
- static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 126, "Variables cannot have a type of 'void'");
+class ParserErrorCode extends Enum<ParserErrorCode> implements ErrorCode {
+ static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con3('ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstract'");
+ static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con3('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract'");
+ static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode.con3('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared to be 'abstract'");
+ static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode.con3('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared to be 'abstract'");
+ static final ParserErrorCode ABSTRACT_TYPEDEF = new ParserErrorCode.con3('ABSTRACT_TYPEDEF', 4, "Type aliases cannot be declared to be 'abstract'");
+ static final ParserErrorCode BREAK_OUTSIDE_OF_LOOP = new ParserErrorCode.con3('BREAK_OUTSIDE_OF_LOOP', 5, "A break statement cannot be used outside of a loop or switch statement");
+ static final ParserErrorCode CONST_AND_FINAL = new ParserErrorCode.con3('CONST_AND_FINAL', 6, "Members cannot be declared to be both 'const' and 'final'");
+ static final ParserErrorCode CONST_AND_VAR = new ParserErrorCode.con3('CONST_AND_VAR', 7, "Members cannot be declared to be both 'const' and 'var'");
+ static final ParserErrorCode CONST_CLASS = new ParserErrorCode.con3('CONST_CLASS', 8, "Classes cannot be declared to be 'const'");
+ static final ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con3('CONST_CONSTRUCTOR_WITH_BODY', 9, "'const' constructors cannot have a body");
+ static final ParserErrorCode CONST_FACTORY = new ParserErrorCode.con3('CONST_FACTORY', 10, "Only redirecting factory constructors can be declared to be 'const'");
+ static final ParserErrorCode CONST_METHOD = new ParserErrorCode.con3('CONST_METHOD', 11, "Getters, setters and methods cannot be declared to be 'const'");
+ static final ParserErrorCode CONST_TYPEDEF = new ParserErrorCode.con3('CONST_TYPEDEF', 12, "Type aliases cannot be declared to be 'const'");
+ static final ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = new ParserErrorCode.con3('CONSTRUCTOR_WITH_RETURN_TYPE', 13, "Constructors cannot have a return type");
+ static final ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = new ParserErrorCode.con3('CONTINUE_OUTSIDE_OF_LOOP', 14, "A continue statement cannot be used outside of a loop or switch statement");
+ static final ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = new ParserErrorCode.con3('CONTINUE_WITHOUT_LABEL_IN_CASE', 15, "A continue statement in a switch statement must have a label as a target");
+ static final ParserErrorCode DEPRECATED_ARGUMENT_DEFINITION_TEST = new ParserErrorCode.con3('DEPRECATED_ARGUMENT_DEFINITION_TEST', 16, "The argument definition test ('?' operator) has been deprecated");
+ static final ParserErrorCode DIRECTIVE_AFTER_DECLARATION = new ParserErrorCode.con3('DIRECTIVE_AFTER_DECLARATION', 17, "Directives must appear before any declarations");
+ static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserErrorCode.con3('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 18, "The label %s was already used in this switch statement");
+ static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con3('DUPLICATED_MODIFIER', 19, "The modifier '%s' was already specified.");
+ static final ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND = new ParserErrorCode.con3('EQUALITY_CANNOT_BE_EQUALITY_OPERAND', 20, "Equality expression cannot be operand of another equality expression.");
+ static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.con3('EXPECTED_CASE_OR_DEFAULT', 21, "Expected 'case' or 'default'");
+ static final ParserErrorCode EXPECTED_CLASS_MEMBER = new ParserErrorCode.con3('EXPECTED_CLASS_MEMBER', 22, "Expected a class member");
+ static final ParserErrorCode EXPECTED_EXECUTABLE = new ParserErrorCode.con3('EXPECTED_EXECUTABLE', 23, "Expected a method, getter, setter or operator declaration");
+ static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCode.con3('EXPECTED_LIST_OR_MAP_LITERAL', 24, "Expected a list or map literal");
+ static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con3('EXPECTED_STRING_LITERAL', 25, "Expected a string literal");
+ static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con3('EXPECTED_TOKEN', 26, "Expected to find '%s'");
+ static final ParserErrorCode EXPECTED_ONE_LIST_TYPE_ARGUMENTS = new ParserErrorCode.con3('EXPECTED_ONE_LIST_TYPE_ARGUMENTS', 27, "List literal requires exactly one type arguments or none, but %d found");
+ static final ParserErrorCode EXPECTED_TWO_MAP_TYPE_ARGUMENTS = new ParserErrorCode.con3('EXPECTED_TWO_MAP_TYPE_ARGUMENTS', 28, "Map literal requires exactly two type arguments or none, but %d found");
+ static final ParserErrorCode EXPECTED_TYPE_NAME = new ParserErrorCode.con3('EXPECTED_TYPE_NAME', 29, "Expected a type name");
+ static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con3('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 30, "Export directives must preceed part directives");
+ static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con3('EXTERNAL_AFTER_CONST', 31, "The modifier 'external' should be before the modifier 'const'");
+ static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con3('EXTERNAL_AFTER_FACTORY', 32, "The modifier 'external' should be before the modifier 'factory'");
+ static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con3('EXTERNAL_AFTER_STATIC', 33, "The modifier 'external' should be before the modifier 'static'");
+ static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con3('EXTERNAL_CLASS', 34, "Classes cannot be declared to be 'external'");
+ static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con3('EXTERNAL_CONSTRUCTOR_WITH_BODY', 35, "External constructors cannot have a body");
+ static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con3('EXTERNAL_FIELD', 36, "Fields cannot be declared to be 'external'");
+ static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.con3('EXTERNAL_GETTER_WITH_BODY', 37, "External getters cannot have a body");
+ static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.con3('EXTERNAL_METHOD_WITH_BODY', 38, "External methods cannot have a body");
+ static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode.con3('EXTERNAL_OPERATOR_WITH_BODY', 39, "External operators cannot have a body");
+ static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.con3('EXTERNAL_SETTER_WITH_BODY', 40, "External setters cannot have a body");
+ static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con3('EXTERNAL_TYPEDEF', 41, "Type aliases cannot be declared to be 'external'");
+ static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCode.con3('FACTORY_TOP_LEVEL_DECLARATION', 42, "Top-level declarations cannot be declared to be 'factory'");
+ static final ParserErrorCode FACTORY_WITHOUT_BODY = new ParserErrorCode.con3('FACTORY_WITHOUT_BODY', 43, "A non-redirecting 'factory' constructor must have a body");
+ static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new ParserErrorCode.con3('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 44, "Field initializers can only be used in a constructor");
+ static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con3('FINAL_AND_VAR', 45, "Members cannot be declared to be both 'final' and 'var'");
+ static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con3('FINAL_CLASS', 46, "Classes cannot be declared to be 'final'");
+ static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con3('FINAL_CONSTRUCTOR', 47, "A constructor cannot be declared to be 'final'");
+ static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con3('FINAL_METHOD', 48, "Getters, setters and methods cannot be declared to be 'final'");
+ static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con3('FINAL_TYPEDEF', 49, "Type aliases cannot be declared to be 'final'");
+ static final ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = new ParserErrorCode.con3('FUNCTION_TYPED_PARAMETER_VAR', 50, "Function typed parameters cannot specify 'const', 'final' or 'var' instead of return type");
+ static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con3('GETTER_WITH_PARAMETERS', 51, "Getter should be declared without a parameter list");
+ static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new ParserErrorCode.con3('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 52, "Illegal assignment to non-assignable expression");
+ static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.con3('IMPLEMENTS_BEFORE_EXTENDS', 53, "The extends clause must be before the implements clause");
+ static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con3('IMPLEMENTS_BEFORE_WITH', 54, "The with clause must be before the implements clause");
+ static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con3('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 55, "Import directives must preceed part directives");
+ static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con3('INITIALIZED_VARIABLE_IN_FOR_EACH', 56, "The loop variable in a for-each loop cannot be initialized");
+ static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con3('INVALID_CODE_POINT', 57, "The escape sequence '%s' is not a valid code point");
+ static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.con3('INVALID_COMMENT_REFERENCE', 58, "Comment references should contain a possibly prefixed identifier and can start with 'new', but should not contain anything else");
+ static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con3('INVALID_HEX_ESCAPE', 59, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits");
+ static final ParserErrorCode INVALID_OPERATOR = new ParserErrorCode.con3('INVALID_OPERATOR', 60, "The string '%s' is not a valid operator");
+ static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode.con3('INVALID_OPERATOR_FOR_SUPER', 61, "The operator '%s' cannot be used with 'super'");
+ static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con3('INVALID_UNICODE_ESCAPE', 62, "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
+ static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode.con3('LIBRARY_DIRECTIVE_NOT_FIRST', 63, "The library directive must appear before all other directives");
+ static final ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = new ParserErrorCode.con3('LOCAL_FUNCTION_DECLARATION_MODIFIER', 64, "Local function declarations cannot specify any modifier");
+ static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode.con3('MISSING_ASSIGNABLE_SELECTOR', 65, "Missing selector such as \".<identifier>\" or \"[0]\"");
+ static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.con3('MISSING_CATCH_OR_FINALLY', 66, "A try statement must have either a catch or finally clause");
+ static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con3('MISSING_CLASS_BODY', 67, "A class definition must have a body, even if it is empty");
+ static final ParserErrorCode MISSING_CLOSING_PARENTHESIS = new ParserErrorCode.con3('MISSING_CLOSING_PARENTHESIS', 68, "The closing parenthesis is missing");
+ static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserErrorCode.con3('MISSING_CONST_FINAL_VAR_OR_TYPE', 69, "Variables must be declared using the keywords 'const', 'final', 'var' or a type name");
+ static final ParserErrorCode MISSING_EXPRESSION_IN_THROW = new ParserErrorCode.con3('MISSING_EXPRESSION_IN_THROW', 70, "Throw expressions must compute the object to be thrown");
+ static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con3('MISSING_FUNCTION_BODY', 71, "A function body must be provided");
+ static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode.con3('MISSING_FUNCTION_PARAMETERS', 72, "Functions must have an explicit list of parameters");
+ static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con3('MISSING_IDENTIFIER', 73, "Expected an identifier");
+ static final ParserErrorCode MISSING_KEYWORD_OPERATOR = new ParserErrorCode.con3('MISSING_KEYWORD_OPERATOR', 74, "Operator declarations must be preceeded by the keyword 'operator'");
+ static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErrorCode.con3('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 75, "Library directives must include a library name");
+ static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErrorCode.con3('MISSING_NAME_IN_PART_OF_DIRECTIVE', 76, "Library directives must include a library name");
+ static final ParserErrorCode MISSING_STATEMENT = new ParserErrorCode.con3('MISSING_STATEMENT', 77, "Expected a statement");
+ static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con3('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 78, "There is no '%s' to close the parameter group");
+ static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode.con3('MISSING_TYPEDEF_PARAMETERS', 79, "Type aliases for functions must have an explicit list of parameters");
+ static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con3('MISSING_VARIABLE_IN_FOR_EACH', 80, "A loop variable must be declared in a for-each loop before the 'in', but none were found");
+ static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con3('MIXED_PARAMETER_GROUPS', 81, "Cannot have both positional and named parameters in a single parameter list");
+ static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.con3('MULTIPLE_EXTENDS_CLAUSES', 82, "Each class definition can have at most one extends clause");
+ static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode.con3('MULTIPLE_IMPLEMENTS_CLAUSES', 83, "Each class definition can have at most one implements clause");
+ static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode.con3('MULTIPLE_LIBRARY_DIRECTIVES', 84, "Only one library directive may be declared in a file");
+ static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserErrorCode.con3('MULTIPLE_NAMED_PARAMETER_GROUPS', 85, "Cannot have multiple groups of named parameters in a single parameter list");
+ static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode.con3('MULTIPLE_PART_OF_DIRECTIVES', 86, "Only one part-of directive may be declared in a file");
+ static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new ParserErrorCode.con3('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 87, "Cannot have multiple groups of positional parameters in a single parameter list");
+ static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorCode.con3('MULTIPLE_VARIABLES_IN_FOR_EACH', 88, "A single loop variable must be declared in a for-each loop before the 'in', but %s were found");
+ static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con3('MULTIPLE_WITH_CLAUSES', 89, "Each class definition can have at most one with clause");
+ static final ParserErrorCode NAMED_FUNCTION_EXPRESSION = new ParserErrorCode.con3('NAMED_FUNCTION_EXPRESSION', 90, "Function expressions cannot be named");
+ static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con3('NAMED_PARAMETER_OUTSIDE_GROUP', 91, "Named parameters must be enclosed in curly braces ('{' and '}')");
+ static final ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = new ParserErrorCode.con3('NATIVE_CLAUSE_IN_NON_SDK_CODE', 92, "Native clause can only be used in the SDK and code that is loaded through native extensions");
+ static final ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = new ParserErrorCode.con3('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 93, "Native functions can only be declared in the SDK and code that is loaded through native extensions");
+ static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con3('NON_CONSTRUCTOR_FACTORY', 94, "Only constructors can be declared to be a 'factory'");
+ static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode.con3('NON_IDENTIFIER_LIBRARY_NAME', 95, "The name of a library must be an identifier");
+ static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCode.con3('NON_PART_OF_DIRECTIVE_IN_PART', 96, "The part-of directive must be the only directive in a part");
+ static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode.con3('NON_USER_DEFINABLE_OPERATOR', 97, "The operator '%s' is not user definable");
+ static final ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = new ParserErrorCode.con3('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 98, "Normal parameters must occur before optional parameters");
+ static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con3('POSITIONAL_AFTER_NAMED_ARGUMENT', 99, "Positional arguments must occur before named arguments");
+ static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con3('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 100, "Positional parameters must be enclosed in square brackets ('[' and ']')");
+ static final ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = new ParserErrorCode.con3('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 101, "Only factory constructor can specify '=' redirection.");
+ static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con3('STATIC_AFTER_CONST', 102, "The modifier 'static' should be before the modifier 'const'");
+ static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con3('STATIC_AFTER_FINAL', 103, "The modifier 'static' should be before the modifier 'final'");
+ static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con3('STATIC_AFTER_VAR', 104, "The modifier 'static' should be before the modifier 'var'");
+ static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con3('STATIC_CONSTRUCTOR', 105, "Constructors cannot be static");
+ static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode.con3('STATIC_GETTER_WITHOUT_BODY', 106, "A 'static' getter must have a body");
+ static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con3('STATIC_OPERATOR', 107, "Operators cannot be static");
+ static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode.con3('STATIC_SETTER_WITHOUT_BODY', 108, "A 'static' setter must have a body");
+ static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con3('STATIC_TOP_LEVEL_DECLARATION', 109, "Top-level declarations cannot be declared to be 'static'");
+ static final ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = new ParserErrorCode.con3('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 110, "The 'default' case should be the last case in a switch statement");
+ static final ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = new ParserErrorCode.con3('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 111, "The 'default' case can only be declared once");
+ static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con3('TOP_LEVEL_OPERATOR', 112, "Operators must be declared within a class");
+ static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con3('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 113, "There is no '%s' to open a parameter group");
+ static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con3('UNEXPECTED_TOKEN', 114, "Unexpected token '%s'");
+ static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con3('WITH_BEFORE_EXTENDS', 115, "The extends clause must be before the with clause");
+ static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con3('WITH_WITHOUT_EXTENDS', 116, "The with clause cannot be used without an extends clause");
+ static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserErrorCode.con3('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 117, "The default value of a named parameter should be preceeded by ':'");
+ static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new ParserErrorCode.con3('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 118, "The default value of a positional parameter should be preceeded by '='");
+ static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con3('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 119, "Expected '%s' to close parameter group");
+ static final ParserErrorCode VAR_AND_TYPE = new ParserErrorCode.con3('VAR_AND_TYPE', 120, "Variables cannot be declared using both 'var' and a type name; remove the 'var'");
+ static final ParserErrorCode VAR_AS_TYPE_NAME = new ParserErrorCode.con3('VAR_AS_TYPE_NAME', 121, "The keyword 'var' cannot be used as a type name");
+ static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con3('VAR_CLASS', 122, "Classes cannot be declared to be 'var'");
+ static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con3('VAR_RETURN_TYPE', 123, "The return type cannot be 'var'");
+ static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con3('VAR_TYPEDEF', 124, "Type aliases cannot be declared to be 'var'");
+ static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con3('VOID_PARAMETER', 125, "Parameters cannot have a type of 'void'");
+ static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con3('VOID_VARIABLE', 126, "Variables cannot have a type of 'void'");
static final List<ParserErrorCode> values = [
ABSTRACT_CLASS_MEMBER,
ABSTRACT_STATIC_METHOD,
@@ -6002,45 +6002,56 @@
VOID_PARAMETER,
VOID_VARIABLE];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The severity of this error.
*/
ErrorSeverity _severity;
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction8;
+
+ /**
* Initialize a newly created error code to have the given severity and message.
*
* @param severity the severity of the error
* @param message the message template used to create the message to be displayed for the error
*/
- ParserErrorCode.con1(this.name, this.ordinal, ErrorSeverity severity, String message) {
+ ParserErrorCode.con1(String name, int ordinal, ErrorSeverity severity, String message) : super(name, ordinal) {
this._severity = severity;
this._message = message;
}
/**
+ * Initialize a newly created error code to have the given severity, message and correction.
+ *
+ * @param severity the severity of the error
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ ParserErrorCode.con2(String name, int ordinal, ErrorSeverity severity, String message, String correction) : super(name, ordinal) {
+ this._severity = severity;
+ this._message = message;
+ this.correction8 = correction;
+ }
+
+ /**
* Initialize a newly created error code to have the given message and a severity of ERROR.
*
* @param message the message template used to create the message to be displayed for the error
*/
- ParserErrorCode.con2(String name, int ordinal, String message) : this.con1(name, ordinal, ErrorSeverity.ERROR, message);
+ ParserErrorCode.con3(String name, int ordinal, String message) : this.con1(name, ordinal, ErrorSeverity.ERROR, message);
+ String get correction => correction8;
ErrorSeverity get errorSeverity => _severity;
String get message => _message;
ErrorType get type => ErrorType.SYNTACTIC_ERROR;
- int compareTo(ParserErrorCode other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* Instances of the class {link ToFormattedSourceVisitor} write a source representation of a visited
@@ -6331,7 +6342,7 @@
}
Object visitFieldDeclaration(FieldDeclaration node) {
visit(node.documentationComment);
- visit8(node.keyword, " ");
+ visit8(node.staticKeyword, " ");
visit(node.fields);
_writer.print(";");
return null;
@@ -6528,8 +6539,8 @@
return null;
}
Object visitListLiteral(ListLiteral node) {
- if (node.modifier != null) {
- _writer.print(node.modifier.lexeme);
+ if (node.constKeyword != null) {
+ _writer.print(node.constKeyword.lexeme);
_writer.print(' ');
}
visit6(node.typeArguments, " ");
@@ -6549,8 +6560,8 @@
return null;
}
Object visitMapLiteral(MapLiteral node) {
- if (node.modifier != null) {
- _writer.print(node.modifier.lexeme);
+ if (node.constKeyword != null) {
+ _writer.print(node.constKeyword.lexeme);
_writer.print(' ');
}
visit6(node.typeArguments, " ");
@@ -6770,7 +6781,7 @@
_writer.print("try ");
visit(node.body);
visitList7(" ", node.catchClauses, " ");
- visit7(" finally ", node.finallyClause);
+ visit7(" finally ", node.finallyBlock);
return null;
}
Object visitTypeArgumentList(TypeArgumentList node) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/resolver.dart b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
index 2b056f4..d11f9b2 100644
--- a/pkg/analyzer_experimental/lib/src/generated/resolver.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
@@ -108,12 +108,12 @@
if (exceptionParameter != null) {
LocalVariableElementImpl exception = new LocalVariableElementImpl(exceptionParameter);
_currentHolder.addLocalVariable(exception);
- exceptionParameter.element = exception;
+ exceptionParameter.staticElement = exception;
SimpleIdentifier stackTraceParameter = node.stackTraceParameter;
if (stackTraceParameter != null) {
LocalVariableElementImpl stackTrace = new LocalVariableElementImpl(stackTraceParameter);
_currentHolder.addLocalVariable(stackTrace);
- stackTraceParameter.element = stackTrace;
+ stackTraceParameter.staticElement = stackTrace;
}
}
return super.visitCatchClause(node);
@@ -146,7 +146,7 @@
}
_functionTypesToFix = null;
_currentHolder.addType(element);
- className.element = element;
+ className.staticElement = element;
holder.validate();
return null;
}
@@ -170,7 +170,7 @@
}
_functionTypesToFix = null;
_currentHolder.addType(element);
- className.element = element;
+ className.staticElement = element;
holder.validate();
return null;
}
@@ -202,7 +202,7 @@
element.nameOffset = returnType.offset;
}
} else {
- constructorName.element = element;
+ constructorName.staticElement = element;
}
holder.validate();
return null;
@@ -218,7 +218,7 @@
element.const3 = matches(keyword, sc.Keyword.CONST);
element.final2 = matches(keyword, sc.Keyword.FINAL);
_currentHolder.addLocalVariable(element);
- variableName.element = element;
+ variableName.staticElement = element;
return super.visitDeclaredIdentifier(node);
}
Object visitDefaultFormalParameter(DefaultFormalParameter node) {
@@ -249,7 +249,7 @@
parameter.setVisibleRange(body.offset, body.length);
}
_currentHolder.addParameter(parameter);
- parameterName.element = parameter;
+ parameterName.staticElement = parameter;
node.parameter.accept(this);
holder.validate();
return null;
@@ -272,7 +272,7 @@
parameter.final2 = node.isFinal;
parameter.parameterKind = node.kind;
_currentHolder.addParameter(parameter);
- parameterName.element = parameter;
+ parameterName.staticElement = parameter;
}
ElementHolder holder = new ElementHolder();
visitChildren(holder, node);
@@ -309,7 +309,7 @@
}
_currentHolder.addFunction(element);
expression.element = element;
- functionName.element = element;
+ functionName.staticElement = element;
} else {
SimpleIdentifier propertyNameNode = node.name;
if (propertyNameNode == null) {
@@ -333,7 +333,7 @@
getter.static = true;
field.getter = getter;
_currentHolder.addAccessor(getter);
- propertyNameNode.element = getter;
+ propertyNameNode.staticElement = getter;
} else {
PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con1(propertyNameNode);
setter.functions = holder.functions;
@@ -346,7 +346,7 @@
field.setter = setter;
field.final2 = false;
_currentHolder.addAccessor(setter);
- propertyNameNode.element = setter;
+ propertyNameNode.staticElement = setter;
}
}
holder.validate();
@@ -398,7 +398,7 @@
type.typeArguments = createTypeVariableTypes(typeVariables);
element.type = type;
_currentHolder.addTypeAlias(element);
- aliasName.element = element;
+ aliasName.staticElement = element;
holder.validate();
return null;
}
@@ -408,7 +408,7 @@
ParameterElementImpl parameter = new ParameterElementImpl.con1(parameterName);
parameter.parameterKind = node.kind;
_currentHolder.addParameter(parameter);
- parameterName.element = parameter;
+ parameterName.staticElement = parameter;
}
ElementHolder holder = new ElementHolder();
visitChildren(holder, node);
@@ -422,7 +422,7 @@
SimpleIdentifier labelName = label.label;
LabelElementImpl element = new LabelElementImpl(labelName, onSwitchStatement, false);
_currentHolder.addLabel(element);
- labelName.element = element;
+ labelName.staticElement = element;
}
return super.visitLabeledStatement(node);
}
@@ -451,7 +451,7 @@
element.parameters = holder.parameters;
element.static = isStatic;
_currentHolder.addMethod(element);
- methodName.element = element;
+ methodName.staticElement = element;
} else {
SimpleIdentifier propertyNameNode = node.name;
String propertyName = propertyNameNode.name;
@@ -473,7 +473,7 @@
getter.static = isStatic;
field.getter = getter;
_currentHolder.addAccessor(getter);
- propertyNameNode.element = getter;
+ propertyNameNode.staticElement = getter;
} else {
PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con1(propertyNameNode);
setter.functions = holder.functions;
@@ -487,7 +487,7 @@
field.setter = setter;
field.final2 = false;
_currentHolder.addAccessor(setter);
- propertyNameNode.element = setter;
+ propertyNameNode.staticElement = setter;
}
}
holder.validate();
@@ -501,7 +501,7 @@
parameter.final2 = node.isFinal;
parameter.parameterKind = node.kind;
_currentHolder.addParameter(parameter);
- parameterName.element = parameter;
+ parameterName.staticElement = parameter;
}
return super.visitSimpleFormalParameter(node);
}
@@ -514,7 +514,7 @@
SimpleIdentifier labelName = label.label;
LabelElementImpl element = new LabelElementImpl(labelName, false, true);
_currentHolder.addLabel(element);
- labelName.element = element;
+ labelName.staticElement = element;
}
return super.visitSwitchCase(node);
}
@@ -523,7 +523,7 @@
SimpleIdentifier labelName = label.label;
LabelElementImpl element = new LabelElementImpl(labelName, false, true);
_currentHolder.addLabel(element);
- labelName.element = element;
+ labelName.staticElement = element;
}
return super.visitSwitchDefault(node);
}
@@ -533,7 +533,7 @@
TypeVariableTypeImpl type = new TypeVariableTypeImpl(element);
element.type = type;
_currentHolder.addTypeVariable(element);
- parameterName.element = element;
+ parameterName.staticElement = element;
return super.visitTypeParameter(node);
}
Object visitVariableDeclaration(VariableDeclaration node) {
@@ -552,7 +552,7 @@
}
element = field;
_currentHolder.addField(field);
- fieldName.element = field;
+ fieldName.staticElement = field;
} else if (_inFunction) {
SimpleIdentifier variableName = node.name;
LocalVariableElementImpl variable;
@@ -567,7 +567,7 @@
int blockEnd = enclosingBlock.offset + enclosingBlock.length;
variable.setVisibleRange(functionEnd, blockEnd - functionEnd - 1);
_currentHolder.addLocalVariable(variable);
- variableName.element = element;
+ variableName.staticElement = element;
} else {
SimpleIdentifier variableName = node.name;
TopLevelVariableElementImpl variable;
@@ -578,7 +578,7 @@
}
element = variable;
_currentHolder.addTopLevelVariable(variable);
- variableName.element = element;
+ variableName.staticElement = element;
}
element.const3 = isConst;
element.final2 = isFinal;
@@ -602,7 +602,7 @@
if (element is PropertyInducingElementImpl) {
PropertyInducingElementImpl variable = element as PropertyInducingElementImpl;
if (_inFieldContext) {
- ((variable as FieldElementImpl)).static = matches(((node.parent.parent as FieldDeclaration)).keyword, sc.Keyword.STATIC);
+ ((variable as FieldElementImpl)).static = matches(((node.parent.parent as FieldDeclaration)).staticKeyword, sc.Keyword.STATIC);
}
PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(variable);
getter.getter = true;
@@ -1031,6 +1031,11 @@
RecordingErrorListener _errorListener;
/**
+ * The modification time of the source for which an element is being built.
+ */
+ int _modificationStamp = 0;
+
+ /**
* The line information associated with the source for which an element is being built, or
* `null` if we are not building an element.
*/
@@ -1073,16 +1078,19 @@
* @return the HTML element that was built
* @throws AnalysisException if the analysis could not be performed
*/
- HtmlElementImpl buildHtmlElement(Source source) => buildHtmlElement2(source, _context.parseHtmlUnit(source));
+ HtmlElementImpl buildHtmlElement(Source source) => buildHtmlElement2(source, source.modificationStamp, _context.parseHtmlUnit(source));
/**
* Build the HTML element for the given source.
*
* @param source the source describing the compilation unit
+ * @param modificationStamp the modification time of the source for which an element is being
+ * built
* @param unit the AST structure representing the HTML
* @throws AnalysisException if the analysis could not be performed
*/
- HtmlElementImpl buildHtmlElement2(Source source2, ht.HtmlUnit unit) {
+ HtmlElementImpl buildHtmlElement2(Source source2, int modificationStamp2, ht.HtmlUnit unit) {
+ this._modificationStamp = modificationStamp2;
_lineInfo = _context.computeLineInfo(source2);
HtmlElementImpl result = new HtmlElementImpl(_context, source2.shortName);
result.source = source2;
@@ -1162,7 +1170,7 @@
unit.lineInfo = new LineInfo(lineStarts);
try {
LibraryResolver resolver = new LibraryResolver(_context);
- LibraryElementImpl library = resolver.resolveEmbeddedLibrary(htmlSource, unit, true) as LibraryElementImpl;
+ LibraryElementImpl library = resolver.resolveEmbeddedLibrary(htmlSource, _modificationStamp, unit, true) as LibraryElementImpl;
script.scriptLibrary = library;
_resolvedLibraries.addAll(resolver.resolvedLibraries);
_errorListener.addAll(resolver.errorListener);
@@ -1174,14 +1182,15 @@
ExternalHtmlScriptElementImpl script = new ExternalHtmlScriptElementImpl(node);
if (scriptSourcePath != null) {
try {
+ scriptSourcePath = Uri.encodeFull(scriptSourcePath);
parseUriWithException(scriptSourcePath);
Source scriptSource = _context.sourceFactory.resolveUri(htmlSource, scriptSourcePath);
script.scriptSource = scriptSource;
- if (!scriptSource.exists()) {
- reportError(HtmlWarningCode.URI_DOES_NOT_EXIST, scriptAttribute.offset + 1, scriptSourcePath.length, [scriptSourcePath]);
+ if (scriptSource == null || !scriptSource.exists()) {
+ reportValueError(HtmlWarningCode.URI_DOES_NOT_EXIST, scriptAttribute, [scriptSourcePath]);
}
} on URISyntaxException catch (exception) {
- reportError(HtmlWarningCode.INVALID_URI, scriptAttribute.offset + 1, scriptSourcePath.length, [scriptSourcePath]);
+ reportValueError(HtmlWarningCode.INVALID_URI, scriptAttribute, [scriptSourcePath]);
}
}
_scripts.add(script);
@@ -1246,6 +1255,21 @@
void reportError(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
_errorListener.onError(new AnalysisError.con2(_htmlElement.source, offset, length, errorCode, arguments));
}
+
+ /**
+ * Report an error with the given error code at the location of the value of the given attribute.
+ * Use the given arguments to compose the error message.
+ *
+ * @param errorCode the error code of the error to be reported
+ * @param offset the offset of the first character to be highlighted
+ * @param length the number of characters to be highlighted
+ * @param arguments the arguments used to compose the error message
+ */
+ void reportValueError(ErrorCode errorCode, ht.XmlAttributeNode attribute, List<Object> arguments) {
+ int offset = attribute.value.offset + 1;
+ int length = attribute.value.length - 2;
+ reportError(errorCode, offset, length, arguments);
+ }
}
/**
* Instances of the class `DeadCodeVerifier` traverse an AST structure looking for cases of
@@ -1350,7 +1374,7 @@
}
Object visitTryStatement(TryStatement node) {
safelyVisit(node.body);
- safelyVisit(node.finallyClause);
+ safelyVisit(node.finallyBlock);
NodeList<CatchClause> catchClauses = node.catchClauses;
int numOfCatchClauses = catchClauses.length;
List<Type2> visitedTypes = new List<Type2>();
@@ -1594,7 +1618,7 @@
if (importDirective.asToken != null) {
SimpleIdentifier prefixIdentifier = importDirective.prefix;
if (prefixIdentifier != null) {
- Element element = prefixIdentifier.element;
+ Element element = prefixIdentifier.staticElement;
if (element is PrefixElement) {
PrefixElement prefixElementKey = element as PrefixElement;
_prefixElementMap[prefixElementKey] = importDirective;
@@ -1602,7 +1626,7 @@
}
}
putIntoLibraryMap(libraryElement, importDirective);
- addAdditionalLibrariesForExports(_libraryMap, libraryElement, importDirective, new List<LibraryElement>());
+ addAdditionalLibrariesForExports(libraryElement, importDirective, new List<LibraryElement>());
}
}
}
@@ -1617,14 +1641,14 @@
Object visitLibraryDirective(LibraryDirective node) => null;
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
SimpleIdentifier prefixIdentifier = node.prefix;
- Element element = prefixIdentifier.element;
+ Element element = prefixIdentifier.staticElement;
if (element is PrefixElement) {
_unusedImports.remove(_prefixElementMap[element]);
return null;
}
return visitIdentifier(element, prefixIdentifier.name);
}
- Object visitSimpleIdentifier(SimpleIdentifier node) => visitIdentifier(node.element, node.name);
+ Object visitSimpleIdentifier(SimpleIdentifier node) => visitIdentifier(node.staticElement, node.name);
void set inDefiningCompilationUnit(bool inDefiningCompilationUnit2) {
this._inDefiningCompilationUnit = inDefiningCompilationUnit2;
}
@@ -1632,14 +1656,14 @@
/**
* Recursively add any exported library elements into the [libraryMap].
*/
- void addAdditionalLibrariesForExports(Map<LibraryElement, List<ImportDirective>> map, LibraryElement library, ImportDirective importDirective, List<LibraryElement> exportPath) {
+ void addAdditionalLibrariesForExports(LibraryElement library, ImportDirective importDirective, List<LibraryElement> exportPath) {
if (exportPath.contains(library)) {
return;
}
+ exportPath.add(library);
for (LibraryElement exportedLibraryElt in library.exportedLibraries) {
putIntoLibraryMap(exportedLibraryElt, importDirective);
- exportPath.add(exportedLibraryElt);
- addAdditionalLibrariesForExports(map, exportedLibraryElt, importDirective, exportPath);
+ addAdditionalLibrariesForExports(exportedLibraryElt, importDirective, exportPath);
}
}
@@ -1688,6 +1712,9 @@
visitIdentifier(elt, name);
}
return null;
+ } else if (element is PrefixElement) {
+ _unusedImports.remove(_prefixElementMap[element]);
+ return null;
}
LibraryElement containingLibrary = element.library;
if (containingLibrary == null) {
@@ -1762,7 +1789,7 @@
if (JavaString.startsWithBefore(fullName, "/lib", fullNameIndex - 4)) {
String relativePubspecPath = path.substring(0, pathIndex + 3) + _PUBSPEC_YAML;
Source pubspecSource = _context.sourceFactory.resolveUri(source, relativePubspecPath);
- if (pubspecSource.exists()) {
+ if (pubspecSource != null && pubspecSource.exists()) {
_errorReporter.reportError2(PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE, uriLiteral, []);
}
return true;
@@ -1802,7 +1829,7 @@
Source source = getSource(uriLiteral);
String relativePubspecPath = path.substring(0, pathIndex) + _PUBSPEC_YAML;
Source pubspecSource = _context.sourceFactory.resolveUri(source, relativePubspecPath);
- if (!pubspecSource.exists()) {
+ if (pubspecSource == null || !pubspecSource.exists()) {
return false;
}
String fullName = getSourceFullName(source);
@@ -1953,7 +1980,7 @@
_enclosingExecutable = _enclosingClass.unnamedConstructor;
} else {
_enclosingExecutable = _enclosingClass.getNamedConstructor(constructorName.name);
- constructorName.element = _enclosingExecutable;
+ constructorName.staticElement = _enclosingExecutable;
}
node.element = _enclosingExecutable as ConstructorElement;
return super.visitConstructorDeclaration(node);
@@ -2029,7 +2056,7 @@
PropertyAccessorElement accessor = find3(_enclosingUnit.accessors, functionName);
if (identical(((property as sc.KeywordToken)).keyword, sc.Keyword.SET)) {
accessor = accessor.variable.setter;
- functionName.element = accessor;
+ functionName.staticElement = accessor;
}
_enclosingExecutable = accessor;
}
@@ -2108,12 +2135,12 @@
}
if (property == null) {
_enclosingExecutable = find4(_enclosingClass.methods, nameOfMethod, methodName.offset);
- methodName.element = _enclosingExecutable;
+ methodName.staticElement = _enclosingExecutable;
} else {
PropertyAccessorElement accessor = find3(_enclosingClass.accessors, methodName);
if (identical(((property as sc.KeywordToken)).keyword, sc.Keyword.SET)) {
accessor = accessor.variable.setter;
- methodName.element = accessor;
+ methodName.staticElement = accessor;
}
_enclosingExecutable = accessor;
}
@@ -2257,7 +2284,7 @@
*/
Element find3(List<Element> elements, SimpleIdentifier identifier) {
Element element = find4(elements, identifier.name, identifier.offset);
- identifier.element = element;
+ identifier.staticElement = element;
return element;
}
@@ -2499,6 +2526,16 @@
bool _strictMode = false;
/**
+ * The type representing the type 'dynamic'.
+ */
+ Type2 _dynamicType;
+
+ /**
+ * The type representing the type 'type'.
+ */
+ Type2 _typeType;
+
+ /**
* The name of the method that can be implemented by a class to allow its instances to be invoked
* as if they were a function.
*/
@@ -2518,6 +2555,8 @@
ElementResolver(ResolverVisitor resolver) {
this._resolver = resolver;
_strictMode = resolver.definingLibrary.context.analysisOptions.strictMode;
+ _dynamicType = resolver.typeProvider.dynamicType;
+ _typeType = resolver.typeProvider.typeType;
}
Object visitAssignmentExpression(AssignmentExpression node) {
sc.Token operator = node.operator;
@@ -2534,7 +2573,7 @@
MethodElement propagatedMethod = lookUpMethod(leftHandSide, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
- _resolver.reportError6(StaticTypeWarningCode.UNDEFINED_METHOD, operator, [methodName, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError3(staticType.element, StaticTypeWarningCode.UNDEFINED_METHOD, operator, [methodName, staticType.displayName]);
}
}
}
@@ -2553,7 +2592,7 @@
MethodElement propagatedMethod = lookUpMethod(leftOperand, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
- _resolver.reportError6(StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError3(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
}
}
}
@@ -2563,7 +2602,7 @@
SimpleIdentifier labelNode = node.label;
LabelElementImpl labelElement = lookupLabel(node, labelNode);
if (labelElement != null && labelElement.isOnSwitchMember) {
- _resolver.reportError(ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER, labelNode, []);
+ _resolver.reportError5(ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER, labelNode, []);
}
return null;
}
@@ -2590,13 +2629,13 @@
} else {
if (element.library == null || element.library != _resolver.definingLibrary) {
}
- recordResolution(simpleIdentifier, element);
+ simpleIdentifier.staticElement = element;
if (node.newKeyword != null) {
if (element is ClassElement) {
ConstructorElement constructor = ((element as ClassElement)).unnamedConstructor;
if (constructor == null) {
} else {
- recordResolution(simpleIdentifier, constructor);
+ simpleIdentifier.staticElement = constructor;
}
} else {
}
@@ -2610,9 +2649,9 @@
if (element == null) {
} else {
if (element is PrefixElement) {
- recordResolution(prefix, element);
+ prefix.staticElement = element;
element = _resolver.nameScope.lookup(identifier, _resolver.definingLibrary);
- recordResolution(name, element);
+ name.staticElement = element;
return null;
}
LibraryElement library = element.library;
@@ -2620,7 +2659,7 @@
AnalysisEngine.instance.logger.logError("Found element with null library: ${element.name}");
} else if (library != _resolver.definingLibrary) {
}
- recordResolution(name, element);
+ name.staticElement = element;
if (node.newKeyword == null) {
if (element is ClassElement) {
Element memberElement = lookupGetterOrMethod(((element as ClassElement)).type, name.name);
@@ -2632,7 +2671,7 @@
}
if (memberElement == null) {
} else {
- recordResolution(name, memberElement);
+ name.staticElement = memberElement;
}
} else {
}
@@ -2641,7 +2680,7 @@
ConstructorElement constructor = ((element as ClassElement)).getNamedConstructor(name.name);
if (constructor == null) {
} else {
- recordResolution(name, constructor);
+ name.staticElement = constructor;
}
} else {
}
@@ -2657,12 +2696,12 @@
ConstructorElementImpl constructorElement = element as ConstructorElementImpl;
ConstructorName redirectedNode = node.redirectedConstructor;
if (redirectedNode != null) {
- ConstructorElement redirectedElement = redirectedNode.element;
+ ConstructorElement redirectedElement = redirectedNode.staticElement;
constructorElement.redirectedConstructor = redirectedElement;
}
for (ConstructorInitializer initializer in node.initializers) {
if (initializer is RedirectingConstructorInvocation) {
- ConstructorElement redirectedElement = ((initializer as RedirectingConstructorInvocation)).element;
+ ConstructorElement redirectedElement = ((initializer as RedirectingConstructorInvocation)).staticElement;
constructorElement.redirectedConstructor = redirectedElement;
}
}
@@ -2674,11 +2713,11 @@
SimpleIdentifier fieldName = node.fieldName;
ClassElement enclosingClass = _resolver.enclosingClass;
FieldElement fieldElement = ((enclosingClass as ClassElementImpl)).getField(fieldName.name);
- recordResolution(fieldName, fieldElement);
+ fieldName.staticElement = fieldElement;
if (fieldElement == null || fieldElement.isSynthetic) {
- _resolver.reportError(CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
+ _resolver.reportError5(CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
} else if (fieldElement.isStatic) {
- _resolver.reportError(CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD, node, [fieldName]);
+ _resolver.reportError5(CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD, node, [fieldName]);
}
return null;
}
@@ -2705,17 +2744,15 @@
} else {
constructor = interfaceType.lookUpConstructor(name.name, definingLibrary);
name.staticElement = constructor;
- name.element = constructor;
}
node.staticElement = constructor;
- node.element = constructor;
return null;
}
Object visitContinueStatement(ContinueStatement node) {
SimpleIdentifier labelNode = node.label;
LabelElementImpl labelElement = lookupLabel(node, labelNode);
if (labelElement != null && labelElement.isOnSwitchStatement) {
- _resolver.reportError(ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH, labelNode, []);
+ _resolver.reportError5(ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH, labelNode, []);
}
return null;
}
@@ -2737,7 +2774,7 @@
if (classElement != null) {
FieldElement fieldElement = ((classElement as ClassElementImpl)).getField(fieldName);
if (fieldElement == null) {
- _resolver.reportError(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
+ _resolver.reportError5(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
} else {
ParameterElement parameterElement = node.element;
if (parameterElement is FieldFormalParameterElementImpl) {
@@ -2749,17 +2786,17 @@
fieldFormal.type = fieldType;
}
if (fieldElement.isSynthetic) {
- _resolver.reportError(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
+ _resolver.reportError5(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
} else if (fieldElement.isStatic) {
- _resolver.reportError(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, node, [fieldName]);
+ _resolver.reportError5(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, node, [fieldName]);
} else if (declaredType != null && fieldType != null && !declaredType.isAssignableTo(fieldType)) {
- _resolver.reportError(StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, node, [declaredType.displayName, fieldType.displayName]);
+ _resolver.reportError5(StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE, node, [declaredType.displayName, fieldType.displayName]);
}
} else {
if (fieldElement.isSynthetic) {
- _resolver.reportError(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
+ _resolver.reportError5(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTANT_FIELD, node, [fieldName]);
} else if (fieldElement.isStatic) {
- _resolver.reportError(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, node, [fieldName]);
+ _resolver.reportError5(CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, node, [fieldName]);
}
}
}
@@ -2781,7 +2818,7 @@
String prefixName = prefixNode.name;
for (PrefixElement prefixElement in _resolver.definingLibrary.prefixes) {
if (prefixElement.displayName == prefixName) {
- recordResolution(prefixNode, prefixElement);
+ prefixNode.staticElement = prefixElement;
break;
}
}
@@ -2801,23 +2838,39 @@
Expression target = node.realTarget;
Type2 staticType = getStaticType(target);
Type2 propagatedType = getPropagatedType(target);
- if (node.inGetterContext()) {
- String methodName = sc.TokenType.INDEX.lexeme;
- bool error = lookUpCheckIndexOperator(node, target, methodName, staticType, propagatedType);
- if (error) {
- return null;
- }
- }
- if (node.inSetterContext()) {
- String methodName = sc.TokenType.INDEX_EQ.lexeme;
- lookUpCheckIndexOperator(node, target, methodName, staticType, propagatedType);
+ String getterMethodName = sc.TokenType.INDEX.lexeme;
+ String setterMethodName = sc.TokenType.INDEX_EQ.lexeme;
+ bool isInGetterContext = node.inGetterContext();
+ bool isInSetterContext = node.inSetterContext();
+ if (isInGetterContext && isInSetterContext) {
+ MethodElement setterStaticMethod = lookUpMethod(target, staticType, setterMethodName);
+ MethodElement setterPropagatedMethod = lookUpMethod(target, propagatedType, setterMethodName);
+ node.staticElement = setterStaticMethod;
+ node.propagatedElement = setterPropagatedMethod;
+ checkForUndefinedIndexOperator(node, target, getterMethodName, setterStaticMethod, setterPropagatedMethod, staticType, propagatedType);
+ MethodElement getterStaticMethod = lookUpMethod(target, staticType, getterMethodName);
+ MethodElement getterPropagatedMethod = lookUpMethod(target, propagatedType, getterMethodName);
+ AuxiliaryElements auxiliaryElements = new AuxiliaryElements(getterStaticMethod, getterPropagatedMethod);
+ node.auxiliaryElements = auxiliaryElements;
+ checkForUndefinedIndexOperator(node, target, getterMethodName, getterStaticMethod, getterPropagatedMethod, staticType, propagatedType);
+ } else if (isInGetterContext) {
+ MethodElement staticMethod = lookUpMethod(target, staticType, getterMethodName);
+ MethodElement propagatedMethod = lookUpMethod(target, propagatedType, getterMethodName);
+ node.staticElement = staticMethod;
+ node.propagatedElement = propagatedMethod;
+ checkForUndefinedIndexOperator(node, target, getterMethodName, staticMethod, propagatedMethod, staticType, propagatedType);
+ } else if (isInSetterContext) {
+ MethodElement staticMethod = lookUpMethod(target, staticType, setterMethodName);
+ MethodElement propagatedMethod = lookUpMethod(target, propagatedType, setterMethodName);
+ node.staticElement = staticMethod;
+ node.propagatedElement = propagatedMethod;
+ checkForUndefinedIndexOperator(node, target, setterMethodName, staticMethod, propagatedMethod, staticType, propagatedType);
}
return null;
}
Object visitInstanceCreationExpression(InstanceCreationExpression node) {
- ConstructorElement invokedConstructor = node.constructorName.element;
+ ConstructorElement invokedConstructor = node.constructorName.staticElement;
node.staticElement = invokedConstructor;
- node.element = invokedConstructor;
ArgumentList argumentList = node.argumentList;
List<ParameterElement> parameters = resolveArgumentsToParameters(node.isConst, argumentList, invokedConstructor);
if (parameters != null) {
@@ -2836,22 +2889,22 @@
Object visitMethodInvocation(MethodInvocation node) {
SimpleIdentifier methodName = node.methodName;
Expression target = node.realTarget;
- Element staticElement;
- Element propagatedElement;
- if (target is SuperExpression && !isSuperInValidContext((target as SuperExpression))) {
+ if (target is SuperExpression && !isSuperInValidContext(target as SuperExpression)) {
return null;
}
+ Element staticElement;
+ Element propagatedElement;
if (target == null) {
staticElement = resolveInvokedElement2(methodName);
propagatedElement = null;
} else {
- Type2 targetType = getStaticType(target);
- staticElement = resolveInvokedElement(target, targetType, methodName);
+ staticElement = resolveInvokedElement(target, getStaticType(target), methodName);
propagatedElement = resolveInvokedElement(target, getPropagatedType(target), methodName);
}
staticElement = convertSetterToGetter(staticElement);
propagatedElement = convertSetterToGetter(propagatedElement);
- recordResolution2(methodName, staticElement, propagatedElement);
+ methodName.staticElement = staticElement;
+ methodName.propagatedElement = propagatedElement;
ArgumentList argumentList = node.argumentList;
if (staticElement != null) {
List<ParameterElement> parameters = computeCorrespondingParameters(argumentList, staticElement);
@@ -2867,29 +2920,30 @@
}
ErrorCode errorCode = checkForInvocationError(target, staticElement);
if (identical(errorCode, StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION)) {
- _resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName, [methodName.name]);
- } else if (identical(errorCode, StaticTypeWarningCode.UNDEFINED_FUNCTION)) {
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_FUNCTION, methodName, [methodName.name]);
+ _resolver.reportError5(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName, [methodName.name]);
+ } else if (identical(errorCode, CompileTimeErrorCode.UNDEFINED_FUNCTION)) {
+ _resolver.reportError5(CompileTimeErrorCode.UNDEFINED_FUNCTION, methodName, [methodName.name]);
} else if (identical(errorCode, StaticTypeWarningCode.UNDEFINED_METHOD)) {
String targetTypeName;
if (target == null) {
ClassElement enclosingClass = _resolver.enclosingClass;
targetTypeName = enclosingClass.displayName;
+ _resolver.reportErrorProxyConditionalAnalysisError(_resolver.enclosingClass, StaticTypeWarningCode.UNDEFINED_METHOD, methodName, [methodName.name, targetTypeName]);
} else {
Type2 targetType = getStaticType(target);
if (targetType != null && targetType.isDartCoreFunction && methodName.name == CALL_METHOD_NAME) {
return null;
}
targetTypeName = targetType == null ? null : targetType.displayName;
+ _resolver.reportErrorProxyConditionalAnalysisError(targetType.element, StaticTypeWarningCode.UNDEFINED_METHOD, methodName, [methodName.name, targetTypeName]);
}
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_METHOD, methodName, [methodName.name, targetTypeName]);
} else if (identical(errorCode, StaticTypeWarningCode.UNDEFINED_SUPER_METHOD)) {
Type2 targetType = getPropagatedType(target);
if (targetType == null) {
targetType = getStaticType(target);
}
String targetTypeName = targetType == null ? null : targetType.name;
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, methodName, [methodName.name, targetTypeName]);
+ _resolver.reportError5(StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, methodName, [methodName.name, targetTypeName]);
}
return null;
}
@@ -2911,18 +2965,25 @@
MethodElement propagatedMethod = lookUpMethod(operand, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
- _resolver.reportError6(StaticTypeWarningCode.UNDEFINED_OPERATOR, node.operator, [methodName, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError3(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, node.operator, [methodName, staticType.displayName]);
}
return null;
}
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
SimpleIdentifier prefix = node.prefix;
SimpleIdentifier identifier = node.identifier;
- Element prefixElement = prefix.element;
+ Element prefixElement = prefix.staticElement;
if (prefixElement is PrefixElement) {
Element element = _resolver.nameScope.lookup(node, _resolver.definingLibrary);
+ if (element == null && identifier.inSetterContext()) {
+ element = _resolver.nameScope.lookup(new ElementResolver_SyntheticIdentifier("${node.name}="), _resolver.definingLibrary);
+ }
if (element == null) {
- _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, identifier, [identifier.name, prefixElement.name]);
+ if (identifier.inSetterContext()) {
+ _resolver.reportError5(StaticWarningCode.UNDEFINED_SETTER, identifier, [identifier.name, prefixElement.name]);
+ } else {
+ _resolver.reportError5(StaticWarningCode.UNDEFINED_GETTER, identifier, [identifier.name, prefixElement.name]);
+ }
return null;
}
if (element is PropertyAccessorElement && identifier.inSetterContext()) {
@@ -2934,7 +2995,7 @@
}
}
}
- recordResolution(identifier, element);
+ identifier.staticElement = element;
if (node.parent is Annotation) {
Annotation annotation = node.parent as Annotation;
resolveAnnotationElement(annotation, element, null);
@@ -2944,7 +3005,7 @@
}
if (node.parent is Annotation) {
Annotation annotation = node.parent as Annotation;
- resolveAnnotationElement(annotation, prefixElement, node.identifier);
+ resolveAnnotationElement(annotation, prefixElement, identifier);
}
resolvePropertyAccess(prefix, identifier);
return null;
@@ -2962,14 +3023,14 @@
MethodElement propagatedMethod = lookUpMethod(operand, propagatedType, methodName);
node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
- _resolver.reportError6(StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError3(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
}
}
return null;
}
Object visitPropertyAccess(PropertyAccess node) {
Expression target = node.realTarget;
- if (target is SuperExpression && !isSuperInValidContext((target as SuperExpression))) {
+ if (target is SuperExpression && !isSuperInValidContext(target as SuperExpression)) {
return null;
}
SimpleIdentifier propertyName = node.propertyName;
@@ -2992,7 +3053,7 @@
return null;
}
if (name != null) {
- recordResolution(name, element);
+ name.staticElement = element;
}
node.staticElement = element;
node.element = element;
@@ -3004,20 +3065,34 @@
return null;
}
Object visitSimpleIdentifier(SimpleIdentifier node) {
- if (node.staticElement != null || node.element != null) {
+ if (node.staticElement != null) {
+ return null;
+ }
+ if (node.name == _dynamicType.name) {
+ node.staticElement = _dynamicType.element;
+ node.staticType = _typeType;
return null;
}
Element element = resolveSimpleIdentifier(node);
- if (isFactoryConstructorReturnType(node) && element != _resolver.enclosingClass) {
- _resolver.reportError(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS, node, []);
+ ClassElement enclosingClass = _resolver.enclosingClass;
+ if (isFactoryConstructorReturnType(node) && element != enclosingClass) {
+ _resolver.reportError5(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS, node, []);
+ } else if (isConstructorReturnType(node) && element != enclosingClass) {
+ _resolver.reportError5(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node, []);
+ element = null;
} else if (element == null || (element is PrefixElement && !isValidAsPrefix(node))) {
if (isConstructorReturnType(node)) {
- _resolver.reportError(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node, []);
+ _resolver.reportError5(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node, []);
} else {
- _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.name]);
+ _resolver.reportErrorProxyConditionalAnalysisError(_resolver.enclosingClass, StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.name]);
}
}
- recordResolution(node, element);
+ node.staticElement = element;
+ if (node.inSetterContext() && node.inGetterContext() && enclosingClass != null) {
+ InterfaceType enclosingType = enclosingClass.type;
+ AuxiliaryElements auxiliaryElements = new AuxiliaryElements(lookUpGetter(null, enclosingType, node.name), null);
+ node.auxiliaryElements = auxiliaryElements;
+ }
if (node.parent is Annotation) {
Annotation annotation = node.parent as Annotation;
resolveAnnotationElement(annotation, element, null);
@@ -3042,18 +3117,18 @@
}
if (element == null) {
if (name != null) {
- _resolver.reportError(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, node, [superclass.name, name]);
+ _resolver.reportError5(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, node, [superclass.name, name]);
} else {
- _resolver.reportError(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, node, [superclass.name]);
+ _resolver.reportError5(CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, node, [superclass.name]);
}
return null;
} else {
if (element.isFactory) {
- _resolver.reportError(CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, node, [element]);
+ _resolver.reportError5(CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, node, [element]);
}
}
if (name != null) {
- recordResolution(name, element);
+ name.staticElement = element;
}
node.staticElement = element;
node.element = element;
@@ -3066,14 +3141,14 @@
}
Object visitSuperExpression(SuperExpression node) {
if (!isSuperInValidContext(node)) {
- _resolver.reportError(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, node, []);
+ _resolver.reportError5(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, node, []);
}
return super.visitSuperExpression(node);
}
Object visitTypeParameter(TypeParameter node) {
TypeName bound = node.bound;
if (bound != null) {
- TypeVariableElementImpl variable = node.name.element as TypeVariableElementImpl;
+ TypeVariableElementImpl variable = node.name.staticElement as TypeVariableElementImpl;
if (variable != null) {
variable.bound = bound.type;
}
@@ -3111,6 +3186,9 @@
* @return the error code that should be reported
*/
ErrorCode checkForInvocationError(Expression target, Element element) {
+ if (element is PrefixElement) {
+ element = null;
+ }
if (element is PropertyAccessorElement) {
FunctionType getterType = ((element as PropertyAccessorElement)).type;
if (getterType != null) {
@@ -3142,7 +3220,7 @@
if (target == null) {
ClassElement enclosingClass = _resolver.enclosingClass;
if (enclosingClass == null) {
- return StaticTypeWarningCode.UNDEFINED_FUNCTION;
+ return CompileTimeErrorCode.UNDEFINED_FUNCTION;
} else if (element == null) {
return StaticTypeWarningCode.UNDEFINED_METHOD;
} else {
@@ -3151,7 +3229,7 @@
} else {
Type2 targetType = getStaticType(target);
if (targetType == null) {
- return StaticTypeWarningCode.UNDEFINED_FUNCTION;
+ return CompileTimeErrorCode.UNDEFINED_FUNCTION;
} else if (!targetType.isDynamic) {
return StaticTypeWarningCode.UNDEFINED_METHOD;
}
@@ -3162,6 +3240,32 @@
}
/**
+ * Check that the for some index expression that the method element was resolved, otherwise a
+ * [StaticWarningCode#UNDEFINED_OPERATOR] is generated.
+ *
+ * @param node the index expression to resolve
+ * @param target the target of the expression
+ * @param methodName the name of the operator associated with the context of using of the given
+ * index expression
+ * @return `true` if and only if an error code is generated on the passed node
+ */
+ bool checkForUndefinedIndexOperator(IndexExpression node, Expression target, String methodName, MethodElement staticMethod, MethodElement propagatedMethod, Type2 staticType, Type2 propagatedType) {
+ if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
+ sc.Token leftBracket = node.leftBracket;
+ sc.Token rightBracket = node.rightBracket;
+ if (leftBracket == null || rightBracket == null) {
+ _resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, node, [methodName, staticType.displayName]);
+ } else {
+ int offset = leftBracket.offset;
+ int length = rightBracket.offset - offset + 1;
+ _resolver.reportErrorProxyConditionalAnalysisError2(staticType.element, StaticTypeWarningCode.UNDEFINED_OPERATOR, offset, length, [methodName, staticType.displayName]);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Given a list of arguments and the element that will be invoked using those argument, compute
* the list of parameters that correspond to the list of arguments. Return the parameters that
* correspond to the arguments, or `null` if no correspondence could be computed.
@@ -3183,12 +3287,12 @@
} else if (getterReturnType is FunctionType) {
Element functionElement = ((getterReturnType as FunctionType)).element;
if (functionElement is ExecutableElement) {
- return resolveArgumentsToParameters(false, argumentList, (functionElement as ExecutableElement));
+ return resolveArgumentsToParameters(false, argumentList, functionElement as ExecutableElement);
}
}
}
} else if (element2 is ExecutableElement) {
- return resolveArgumentsToParameters(false, argumentList, (element2 as ExecutableElement));
+ return resolveArgumentsToParameters(false, argumentList, element2 as ExecutableElement);
} else if (element2 is VariableElement) {
VariableElement variable = element2 as VariableElement;
Type2 type = variable.type;
@@ -3389,37 +3493,6 @@
}
/**
- * Looks up the method element with the given name for index expression, reports
- * [StaticWarningCode#UNDEFINED_OPERATOR] if not found.
- *
- * @param node the index expression to resolve
- * @param target the target of the expression
- * @param methodName the name of the operator associated with the context of using of the given
- * index expression
- * @return `true` if and only if an error code is generated on the passed node
- */
- bool lookUpCheckIndexOperator(IndexExpression node, Expression target, String methodName, Type2 staticType, Type2 propagatedType) {
- MethodElement staticMethod = lookUpMethod(target, staticType, methodName);
- MethodElement propagatedMethod = lookUpMethod(target, propagatedType, methodName);
- node.staticElement = staticMethod;
- node.propagatedElement = propagatedMethod;
- if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
- sc.Token leftBracket = node.leftBracket;
- sc.Token rightBracket = node.rightBracket;
- if (leftBracket == null || rightBracket == null) {
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_OPERATOR, node, [methodName, staticType.displayName]);
- return true;
- } else {
- int offset = leftBracket.offset;
- int length = rightBracket.offset - offset + 1;
- _resolver.reportError5(StaticTypeWarningCode.UNDEFINED_OPERATOR, offset, length, [methodName, staticType.displayName]);
- return true;
- }
- }
- return false;
- }
-
- /**
* Look up the getter with the given name in the given type. Return the element representing the
* getter that was found, or `null` if there is no getter with the given name.
*
@@ -3582,20 +3655,20 @@
}
} else {
if (labelScope == null) {
- _resolver.reportError(CompileTimeErrorCode.LABEL_UNDEFINED, labelNode, [labelNode.name]);
+ _resolver.reportError5(CompileTimeErrorCode.LABEL_UNDEFINED, labelNode, [labelNode.name]);
} else {
labelElement = labelScope.lookup(labelNode) as LabelElementImpl;
if (labelElement == null) {
- _resolver.reportError(CompileTimeErrorCode.LABEL_UNDEFINED, labelNode, [labelNode.name]);
+ _resolver.reportError5(CompileTimeErrorCode.LABEL_UNDEFINED, labelNode, [labelNode.name]);
} else {
- recordResolution(labelNode, labelElement);
+ labelNode.staticElement = labelElement;
}
}
}
if (labelElement != null) {
ExecutableElement labelContainer = labelElement.getAncestor(ExecutableElement);
if (labelContainer != _resolver.enclosingFunction) {
- _resolver.reportError(CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, labelNode, [labelNode.name]);
+ _resolver.reportError5(CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE, labelNode, [labelNode.name]);
labelElement = null;
}
}
@@ -3778,32 +3851,6 @@
AnalysisEngine.instance.logger.logError("Failed to map ${operator.lexeme} to it's corresponding operator");
return operator;
}
-
- /**
- * Record the fact that the given AST node was resolved to the given element.
- *
- * @param node the AST node that was resolved
- * @param element the element to which the AST node was resolved
- */
- void recordResolution(SimpleIdentifier node, Element element2) {
- node.staticElement = element2;
- node.element = element2;
- }
-
- /**
- * Record the fact that the given AST node was resolved to the given elements.
- *
- * @param node the AST node that was resolved
- * @param staticElement the element to which the AST node was resolved using static type
- * information
- * @param propagatedElement the element to which the AST node was resolved using propagated type
- * information
- * @return the element that was associated with the node
- */
- void recordResolution2(SimpleIdentifier node, Element staticElement2, Element propagatedElement) {
- node.staticElement = staticElement2;
- node.element = propagatedElement == null ? staticElement2 : propagatedElement;
- }
void resolveAnnotationConstructorInvocationArguments(Annotation annotation, ConstructorElement constructor) {
ArgumentList argumentList = annotation.arguments;
if (argumentList == null) {
@@ -3828,12 +3875,12 @@
if (element2 is PropertyAccessorElement) {
PropertyAccessorElement accessorElement = element2 as PropertyAccessorElement;
if (!accessorElement.isSynthetic) {
- _resolver.reportError(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
+ _resolver.reportError5(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
return;
}
VariableElement variableElement = accessorElement.variable;
if (!variableElement.isConst) {
- _resolver.reportError(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
+ _resolver.reportError5(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
}
return;
}
@@ -3844,23 +3891,23 @@
String name = nameNode != null ? nameNode.name : null;
ConstructorElement constructor;
{
- InterfaceType interfaceType = new InterfaceTypeImpl.con1((element2 as ClassElement));
+ InterfaceType interfaceType = new InterfaceTypeImpl.con1(element2 as ClassElement);
LibraryElement definingLibrary = _resolver.definingLibrary;
constructor = interfaceType.lookUpConstructor(name, definingLibrary);
}
if (constructor == null) {
- _resolver.reportError(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
+ _resolver.reportError5(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
return;
}
annotation.element = constructor;
if (nameNode != null) {
- recordResolution(nameNode, constructor);
+ nameNode.staticElement = constructor;
}
resolveAnnotationConstructorInvocationArguments(annotation, constructor);
return;
}
if (element2 != null) {
- _resolver.reportError(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
+ _resolver.reportError5(CompileTimeErrorCode.INVALID_ANNOTATION, annotation, []);
}
}
@@ -3894,7 +3941,7 @@
* @param parameters the of the function that will be invoked with the arguments
* @return the parameters that correspond to the arguments
*/
- List<ParameterElement> resolveArgumentsToParameters2(bool reportError2, ArgumentList argumentList, List<ParameterElement> parameters) {
+ List<ParameterElement> resolveArgumentsToParameters2(bool reportError, ArgumentList argumentList, List<ParameterElement> parameters) {
List<ParameterElement> requiredParameters = new List<ParameterElement>();
List<ParameterElement> positionalParameters = new List<ParameterElement>();
Map<String, ParameterElement> namedParameters = new Map<String, ParameterElement>();
@@ -3924,14 +3971,14 @@
String name = nameNode.name;
ParameterElement element = namedParameters[name];
if (element == null) {
- ErrorCode errorCode = (reportError2 ? CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER : StaticWarningCode.UNDEFINED_NAMED_PARAMETER) as ErrorCode;
- _resolver.reportError(errorCode, nameNode, [name]);
+ ErrorCode errorCode = (reportError ? CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER : StaticWarningCode.UNDEFINED_NAMED_PARAMETER) as ErrorCode;
+ _resolver.reportError5(errorCode, nameNode, [name]);
} else {
resolvedParameters[i] = element;
- recordResolution(nameNode, element);
+ nameNode.staticElement = element;
}
if (!javaSetAdd(usedNames, name)) {
- _resolver.reportError(CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT, nameNode, [name]);
+ _resolver.reportError5(CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT, nameNode, [name]);
}
} else {
positionalArgumentCount++;
@@ -3941,11 +3988,11 @@
}
}
if (positionalArgumentCount < requiredParameters.length) {
- ErrorCode errorCode = (reportError2 ? CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS) as ErrorCode;
- _resolver.reportError(errorCode, argumentList, [requiredParameters.length, positionalArgumentCount]);
+ ErrorCode errorCode = (reportError ? CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS) as ErrorCode;
+ _resolver.reportError5(errorCode, argumentList, [requiredParameters.length, positionalArgumentCount]);
} else if (positionalArgumentCount > unnamedParameterCount) {
- ErrorCode errorCode = (reportError2 ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS) as ErrorCode;
- _resolver.reportError(errorCode, argumentList, [unnamedParameterCount, positionalArgumentCount]);
+ ErrorCode errorCode = (reportError ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS) as ErrorCode;
+ _resolver.reportError5(errorCode, argumentList, [unnamedParameterCount, positionalArgumentCount]);
}
return resolvedParameters;
}
@@ -3971,7 +4018,7 @@
for (SimpleIdentifier name in names) {
Element element = namespace.get(name.name);
if (element != null) {
- name.element = element;
+ name.staticElement = element;
}
}
}
@@ -3997,7 +4044,7 @@
}
return element;
} else if (target is SimpleIdentifier) {
- Element targetElement = ((target as SimpleIdentifier)).element;
+ Element targetElement = ((target as SimpleIdentifier)).staticElement;
if (targetElement is PrefixElement) {
String name = "${((target as SimpleIdentifier)).name}.${methodName}";
Identifier functionName = new ElementResolver_SyntheticIdentifier(name);
@@ -4061,31 +4108,31 @@
ExecutableElement staticElement = resolveProperty(target, staticType, propertyName);
if (target.parent.parent is Annotation) {
if (staticElement != null) {
- recordResolution(propertyName, staticElement);
+ propertyName.staticElement = staticElement;
}
return;
}
propertyName.staticElement = staticElement;
Type2 propagatedType = getPropagatedType(target);
ExecutableElement propagatedElement = resolveProperty(target, propagatedType, propertyName);
- Element selectedElement = select(staticElement, propagatedElement);
- propertyName.element = selectedElement;
+ propertyName.propagatedElement = propagatedElement;
if (shouldReportMissingMember(staticType, staticElement) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedElement))) {
+ Element selectedElement = select(staticElement, propagatedElement);
bool isStaticProperty = isStatic(selectedElement);
if (propertyName.inSetterContext()) {
if (isStaticProperty) {
- _resolver.reportError(StaticWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
} else {
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticTypeWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
}
} else if (propertyName.inGetterContext()) {
if (isStaticProperty) {
- _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
} else {
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
+ _resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticTypeWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
}
} else {
- _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, propertyName, [propertyName.name]);
+ _resolver.reportErrorProxyConditionalAnalysisError(staticType.element, StaticWarningCode.UNDEFINED_IDENTIFIER, propertyName, [propertyName.name]);
}
}
}
@@ -4162,15 +4209,6 @@
ExecutableElement select(ExecutableElement staticElement, ExecutableElement propagatedElement) => propagatedElement != null ? propagatedElement : staticElement;
/**
- * Return the propagated method if it is not `null`, or the static method if it is.
- *
- * @param staticMethod the method computed using static type information
- * @param propagatedMethod the method computed using propagated type information
- * @return the more specific of the two methods
- */
- MethodElement select2(MethodElement staticMethod, MethodElement propagatedMethod) => propagatedMethod != null ? propagatedMethod : staticMethod;
-
- /**
* Given a node that can have annotations associated with it and the element to which that node
* has been resolved, create the annotations in the element model representing the annotations on
* the node.
@@ -4238,11 +4276,12 @@
}
accept(ASTVisitor visitor) => null;
sc.Token get beginToken => null;
- Element get element => null;
+ Element get bestElement => null;
sc.Token get endToken => null;
String get name => _name;
+ Element get propagatedElement => null;
Element get staticElement => null;
- void visitChildren(ASTVisitor<Object> visitor) {
+ void visitChildren(ASTVisitor visitor) {
}
}
/**
@@ -4448,14 +4487,11 @@
_classLookup[superclassElt] = resultMap;
return resultMap;
}
- recordMapWithClassMembers(resultMap, superclassElt);
+ recordMapWithClassMembers(resultMap, supertype);
}
List<InterfaceType> mixins = classElt.mixins;
for (int i = mixins.length - 1; i >= 0; i--) {
- ClassElement mixinElement = mixins[i].element;
- if (mixinElement != null) {
- recordMapWithClassMembers(resultMap, mixinElement);
- }
+ recordMapWithClassMembers(resultMap, mixins[i]);
}
_classLookup[classElt] = resultMap;
return resultMap;
@@ -4530,16 +4566,26 @@
ClassElement superclassElement = supertype != null ? supertype.element : null;
List<InterfaceType> mixins = classElt.mixins;
List<InterfaceType> interfaces = classElt.interfaces;
- if ((superclassElement == null || supertype.isObject) && mixins.length == 0 && interfaces.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));
+ Map<String, ExecutableElement> map = computeInterfaceLookupMap(superclassElement, visitedInterfaces);
+ map = new Map<String, ExecutableElement>.from(map);
+ List<MethodElement> methods = supertype.methods;
+ for (MethodElement method in methods) {
+ if (method.isAccessibleIn(_library) && !method.isStatic) {
+ map[method.name] = method;
+ }
+ }
+ List<PropertyAccessorElement> accessors = supertype.accessors;
+ for (PropertyAccessorElement accessor in accessors) {
+ if (accessor.isAccessibleIn(_library) && !accessor.isStatic) {
+ map[accessor.name] = accessor;
+ }
+ }
+ lookupMaps.add(map);
} finally {
visitedInterfaces.remove(superclassElement);
}
@@ -4554,12 +4600,8 @@
}
}
for (InterfaceType mixinType in mixins) {
- ClassElement mixinElement = mixinType.element;
- if (mixinElement == null) {
- continue;
- }
Map<String, ExecutableElement> mapWithMixinMembers = new Map<String, ExecutableElement>();
- recordMapWithClassMembers(mapWithMixinMembers, mixinElement);
+ recordMapWithClassMembers(mapWithMixinMembers, mixinType);
lookupMaps.add(mapWithMixinMembers);
}
for (InterfaceType interfaceType in interfaces) {
@@ -4568,7 +4610,21 @@
if (!visitedInterfaces.contains(interfaceElement)) {
try {
javaSetAdd(visitedInterfaces, interfaceElement);
- lookupMaps.add(computeInterfaceLookupMap(interfaceElement, visitedInterfaces));
+ Map<String, ExecutableElement> map = computeInterfaceLookupMap(interfaceElement, visitedInterfaces);
+ map = new Map<String, ExecutableElement>.from(map);
+ List<MethodElement> methods = interfaceType.methods;
+ for (MethodElement method in methods) {
+ if (method.isAccessibleIn(_library) && !method.isStatic) {
+ map[method.name] = method;
+ }
+ }
+ List<PropertyAccessorElement> accessors = interfaceType.accessors;
+ for (PropertyAccessorElement accessor in accessors) {
+ if (accessor.isAccessibleIn(_library) && !accessor.isStatic) {
+ map[accessor.name] = accessor;
+ }
+ }
+ lookupMaps.add(map);
} finally {
visitedInterfaces.remove(interfaceElement);
}
@@ -4591,72 +4647,12 @@
for (Map<String, ExecutableElement> lookupMap in lookupMaps) {
for (MapEntry<String, ExecutableElement> entry in getMapEntrySet(lookupMap)) {
String key = entry.getKey();
- if (!unionMap.containsKey(key)) {
- Set<ExecutableElement> set = new Set<ExecutableElement>();
- javaSetAdd(set, entry.getValue());
+ Set<ExecutableElement> set = unionMap[key];
+ if (set == null) {
+ set = new Set<ExecutableElement>();
unionMap[key] = set;
- } else {
- javaSetAdd(unionMap[key], entry.getValue());
}
- }
- }
- if (superclassElement != null) {
- List<MethodElement> methods = superclassElement.methods;
- for (MethodElement method in methods) {
- 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> accessors = superclassElement.accessors;
- for (PropertyAccessorElement accessor in accessors) {
- 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 interfaces) {
- ClassElement interfaceElement = interfaceType.element;
- if (interfaceElement != null) {
- List<MethodElement> methods = interfaceElement.methods;
- for (MethodElement method in methods) {
- 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> accessors = interfaceElement.accessors;
- for (PropertyAccessorElement accessor in accessors) {
- 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);
- }
- }
- }
+ javaSetAdd(set, entry.getValue());
}
}
for (MapEntry<String, Set<ExecutableElement>> entry in getMapEntrySet(unionMap)) {
@@ -4750,21 +4746,21 @@
}
/**
- * Record the passed map with the set of all members (methods, getters and setters) in the class
+ * Record the passed map with the set of all members (methods, getters and setters) in the type
* into the passed map.
*
* @param map some non-`null` map to put the methods and accessors from the passed
* [ClassElement] into
- * @param classElt the class element that will be recorded into the passed map
+ * @param type the type that will be recorded into the passed map
*/
- void recordMapWithClassMembers(Map<String, ExecutableElement> map, ClassElement classElt) {
- List<MethodElement> methods = classElt.methods;
+ void recordMapWithClassMembers(Map<String, ExecutableElement> map, InterfaceType type) {
+ List<MethodElement> methods = type.methods;
for (MethodElement method in methods) {
if (method.isAccessibleIn(_library) && !method.isStatic) {
map[method.name] = method;
}
}
- List<PropertyAccessorElement> accessors = classElt.accessors;
+ List<PropertyAccessorElement> accessors = type.accessors;
for (PropertyAccessorElement accessor in accessors) {
if (accessor.isAccessibleIn(_library) && !accessor.isStatic) {
map[accessor.name] = accessor;
@@ -4850,7 +4846,7 @@
* A table mapping the sources for the compilation units in this library to their corresponding
* AST structures.
*/
- Map<Source, CompilationUnit> _astMap = new Map<Source, CompilationUnit>();
+ Map<Source, ResolvableCompilationUnit> _astMap = new Map<Source, ResolvableCompilationUnit>();
/**
* The library scope used when resolving elements within this library's compilation units.
@@ -4884,12 +4880,12 @@
* @throws AnalysisException if an AST structure could not be created for the compilation unit
*/
CompilationUnit getAST(Source source) {
- CompilationUnit unit = _astMap[source];
- if (unit == null) {
- unit = _analysisContext.computeResolvableCompilationUnit(source);
- _astMap[source] = unit;
+ ResolvableCompilationUnit holder = _astMap[source];
+ if (holder == null) {
+ holder = _analysisContext.computeResolvableCompilationUnit(source);
+ _astMap[source] = holder;
}
- return unit;
+ return holder.compilationUnit;
}
/**
@@ -5013,6 +5009,22 @@
Source get librarySource => _librarySource;
/**
+ * Return the modification stamp associated with the given source.
+ *
+ * @param source the source representing the compilation unit whose AST is to be returned
+ * @return the AST structure associated with the given source
+ * @throws AnalysisException if an AST structure could not be created for the compilation unit
+ */
+ int getModificationStamp(Source source) {
+ ResolvableCompilationUnit holder = _astMap[source];
+ if (holder == null) {
+ holder = _analysisContext.computeResolvableCompilationUnit(source);
+ _astMap[source] = holder;
+ }
+ return holder.modificationStamp;
+ }
+
+ /**
* Return the result of resolving the URI of the given URI-based directive against the URI of the
* library, or `null` if the URI is not valid. If the URI is not valid, report the error.
*
@@ -5030,7 +5042,7 @@
uriContent = Uri.encodeFull(uriContent);
try {
parseUriWithException(uriContent);
- Source source = getSource2(uriContent);
+ Source source = _analysisContext.sourceFactory.resolveUri(_librarySource, uriContent);
if (source == null || !source.exists()) {
_errorListener.onError(new AnalysisError.con2(_librarySource, uriLiteral.offset, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [uriContent]));
}
@@ -5050,10 +5062,12 @@
* Set the AST structure associated with the defining compilation unit for this library to the
* given AST structure.
*
+ * @param modificationStamp the modification time of the source from which the compilation unit
+ * was created
* @param unit the AST structure associated with the defining compilation unit for this library
*/
- void set definingCompilationUnit(CompilationUnit unit) {
- _astMap[_librarySource] = unit;
+ void setDefiningCompilationUnit(int modificationStamp, CompilationUnit unit) {
+ _astMap[_librarySource] = new ResolvableCompilationUnit(modificationStamp, unit);
}
/**
@@ -5095,20 +5109,6 @@
}
}
String toString() => _librarySource.shortName;
-
- /**
- * Return the result of resolving the given URI against the URI of the library, or `null` if
- * the URI is not valid.
- *
- * @param uri the URI to be resolved
- * @return the result of resolving the given URI against the URI of the library
- */
- Source getSource2(String uri) {
- if (uri == null) {
- return null;
- }
- return _analysisContext.sourceFactory.resolveUri(_librarySource, uri);
- }
}
/**
* Instances of the class `LibraryElementBuilder` build an element model for a single library.
@@ -5388,17 +5388,19 @@
*
* @param librarySource the source specifying the defining compilation unit of the library to be
* resolved
+ * @param modificationStamp the time stamp of the source from which the compilation unit was
+ * created
* @param unit the compilation unit representing the embedded library
* @param fullAnalysis `true` if a full analysis should be performed
* @return the element representing the resolved library
* @throws AnalysisException if the library could not be resolved for some reason
*/
- LibraryElement resolveEmbeddedLibrary(Source librarySource, CompilationUnit unit, bool fullAnalysis) {
+ LibraryElement resolveEmbeddedLibrary(Source librarySource, int modificationStamp, CompilationUnit unit, bool fullAnalysis) {
InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engine.LibraryResolver.resolveEmbeddedLibrary");
try {
instrumentation.metric("fullAnalysis", fullAnalysis);
instrumentation.data3("fullName", librarySource.fullName);
- Library targetLibrary = createLibrary2(librarySource, unit);
+ Library targetLibrary = createLibrary2(librarySource, modificationStamp, unit);
_coreLibrary = _libraryMap[_coreLibrarySource];
if (_coreLibrary == null) {
_coreLibrary = createLibrary(_coreLibrarySource);
@@ -5732,12 +5734,12 @@
Set<Source> importedSources = new Set<Source>();
for (Directive directive in unit.directives) {
if (directive is ExportDirective) {
- Source exportSource = resolveSource(librarySource, (directive as ExportDirective));
+ Source exportSource = resolveSource(librarySource, directive as ExportDirective);
if (exportSource != null) {
javaSetAdd(exportedSources, exportSource);
}
} else if (directive is ImportDirective) {
- Source importSource = resolveSource(librarySource, (directive as ImportDirective));
+ Source importSource = resolveSource(librarySource, directive as ImportDirective);
if (importSource != null) {
javaSetAdd(importedSources, importSource);
}
@@ -5820,12 +5822,15 @@
* with the given source.
*
* @param librarySource the source of the library's defining compilation unit
+ * @param modificationStamp the modification time of the source from which the compilation unit
+ * was created
+ * @param unit the compilation unit that defines the library
* @return the library object that was created
* @throws AnalysisException if the library source is not valid
*/
- Library createLibrary2(Source librarySource, CompilationUnit unit) {
+ Library createLibrary2(Source librarySource, int modificationStamp, CompilationUnit unit) {
Library library = new Library(_analysisContext, _errorListener, librarySource);
- library.definingCompilationUnit = unit;
+ library.setDefiningCompilationUnit(modificationStamp, unit);
_libraryMap[librarySource] = library;
return library;
}
@@ -5843,11 +5848,6 @@
return null;
}
Library library = new Library(_analysisContext, _errorListener, librarySource);
- try {
- library.definingCompilationUnit;
- } on AnalysisException catch (exception) {
- return null;
- }
_libraryMap[librarySource] = library;
return library;
}
@@ -5926,6 +5926,11 @@
for (Source source in library.compilationUnitSources) {
ResolverVisitor visitor = new ResolverVisitor.con1(library, source, _typeProvider);
library.getAST(source).accept(visitor);
+ for (ProxyConditionalAnalysisError conditionalCode in visitor.proxyConditionalAnalysisErrors) {
+ if (conditionalCode.shouldIncludeErrorCode()) {
+ visitor.reportError(conditionalCode.analysisError);
+ }
+ }
}
}
@@ -5943,16 +5948,11 @@
return null;
}
String uriContent = uriLiteral.stringValue.trim();
- if (uriContent == null) {
+ if (uriContent == null || uriContent.isEmpty) {
return null;
}
uriContent = Uri.encodeFull(uriContent);
- try {
- parseUriWithException(uriContent);
- return _analysisContext.sourceFactory.resolveUri(librarySource, uriContent);
- } on URISyntaxException catch (exception) {
- return null;
- }
+ return _analysisContext.sourceFactory.resolveUri(librarySource, uriContent);
}
/**
@@ -5992,6 +5992,87 @@
}
}
/**
+ * This class is a wrapper for an [AnalysisError] which can also be queried after resolution
+ * to find out if the error should actually be reported. In this case, these errors are conditional
+ * on the non-existence of an `@proxy` annotation.
+ *
+ * If we have other conditional error codes in the future, we should have this class implement some
+ * ConditionalErrorCode so that after resolution, a list of ConditionalErrorCode can be visited
+ * instead of multiple lists of *ConditionalErrorCodes.
+ */
+class ProxyConditionalAnalysisError {
+
+ /**
+ * The name of the proxy annotation, from the meta pub package.
+ */
+ static String _PROXY_ANNOTATION_NAME = "proxy";
+
+ /**
+ * The name of the meta library name, from the meta pub package.
+ */
+ static String _META_LIBRARY_NAME = "meta";
+
+ /**
+ * Return `true` if the given element represents a class that has the proxy annotation.
+ *
+ * @param element the class being tested
+ * @return `true` if the given element represents a class that has the proxy annotation
+ */
+ static bool classHasProxyAnnotation(Element element2) {
+ if (element2 is ClassElement) {
+ ClassElement classElement = element2 as ClassElement;
+ List<ElementAnnotation> annotations = classElement.metadata;
+ for (ElementAnnotation annotation in annotations) {
+ Element elementAnnotation = annotation.element;
+ if (elementAnnotation != null) {
+ LibraryElement lib = elementAnnotation.library;
+ if (elementAnnotation.name == _PROXY_ANNOTATION_NAME && lib != null && lib.name == _META_LIBRARY_NAME) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * The enclosing [ClassElement], this is what will determine if the error code should, or
+ * should not, be generated on the source.
+ */
+ Element _enclosingElement;
+
+ /**
+ * The conditional analysis error.
+ */
+ AnalysisError _analysisError;
+
+ /**
+ * Instantiate a new ProxyConditionalErrorCode with some enclosing element and the conditional
+ * analysis error.
+ *
+ * @param enclosingElement the enclosing element
+ * @param analysisError the conditional analysis error
+ */
+ ProxyConditionalAnalysisError(Element enclosingElement, AnalysisError analysisError) {
+ this._enclosingElement = enclosingElement;
+ this._analysisError = analysisError;
+ }
+
+ /**
+ * Return the analysis error.
+ *
+ * @return the analysis error
+ */
+ AnalysisError get analysisError => _analysisError;
+
+ /**
+ * Return `true` iff the enclosing class has the proxy annotation.
+ *
+ * @return `true` iff the enclosing class has the proxy annotation
+ */
+ bool shouldIncludeErrorCode() => !classHasProxyAnnotation(_enclosingElement);
+}
+/**
* Instances of the class `ResolverVisitor` are used to resolve the nodes within a single
* compilation unit.
*
@@ -6032,6 +6113,11 @@
TypeOverrideManager _overrideManager = new TypeOverrideManager();
/**
+ * Proxy conditional error codes.
+ */
+ List<ProxyConditionalAnalysisError> _proxyConditionalAnalysisErrors = new List<ProxyConditionalAnalysisError>();
+
+ /**
* Initialize a newly created visitor to resolve the nodes in a compilation unit.
*
* @param library the library containing the compilation unit being resolved
@@ -6066,12 +6152,10 @@
* @return the object keeping track of which elements have had their types overridden
*/
TypeOverrideManager get overrideManager => _overrideManager;
+ List<ProxyConditionalAnalysisError> get proxyConditionalAnalysisErrors => _proxyConditionalAnalysisErrors;
Object visitAsExpression(AsExpression node) {
super.visitAsExpression(node);
- VariableElement element = getOverridableElement(node.expression);
- if (element != null) {
- override(element, node.type.type);
- }
+ override(node.expression, node.type.type);
return null;
}
Object visitAssertStatement(AssertStatement node) {
@@ -6272,7 +6356,7 @@
ExecutableElement outerFunction = _enclosingFunction;
try {
SimpleIdentifier functionName = node.name;
- _enclosingFunction = functionName.element as ExecutableElement;
+ _enclosingFunction = functionName.staticElement as ExecutableElement;
super.visitFunctionDeclaration(node);
} finally {
_enclosingFunction = outerFunction;
@@ -6460,20 +6544,20 @@
ExecutableElement get enclosingFunction => _enclosingFunction;
/**
- * Return the element associated with the given expression whose type can be overridden, or
- * `null` if there is no element whose type can be overridden.
+ * Return the propagated element associated with the given expression whose type can be
+ * overridden, or `null` if there is no element whose type can be overridden.
*
* @param expression the expression with which the element is associated
* @return the element associated with the given expression
*/
- VariableElement getOverridableElement(Expression expression) {
+ VariableElement getOverridablePropagatedElement(Expression expression) {
Element element = null;
if (expression is SimpleIdentifier) {
- element = ((expression as SimpleIdentifier)).element;
+ element = ((expression as SimpleIdentifier)).propagatedElement;
} else if (expression is PrefixedIdentifier) {
- element = ((expression as PrefixedIdentifier)).element;
+ element = ((expression as PrefixedIdentifier)).propagatedElement;
} else if (expression is PropertyAccess) {
- element = ((expression as PropertyAccess)).propertyName.element;
+ element = ((expression as PropertyAccess)).propertyName.propagatedElement;
}
if (element is VariableElement) {
return element as VariableElement;
@@ -6482,6 +6566,48 @@
}
/**
+ * Return the static element associated with the given expression whose type can be overridden, or
+ * `null` if there is no element whose type can be overridden.
+ *
+ * @param expression the expression with which the element is associated
+ * @return the element associated with the given expression
+ */
+ VariableElement getOverridableStaticElement(Expression expression) {
+ Element element = null;
+ if (expression is SimpleIdentifier) {
+ element = ((expression as SimpleIdentifier)).staticElement;
+ } else if (expression is PrefixedIdentifier) {
+ element = ((expression as PrefixedIdentifier)).staticElement;
+ } else if (expression is PropertyAccess) {
+ element = ((expression as PropertyAccess)).propertyName.staticElement;
+ }
+ if (element is VariableElement) {
+ return element as VariableElement;
+ }
+ return null;
+ }
+
+ /**
+ * If it is appropriate to do so, override the current type of the static and propagated elements
+ * associated with the given expression with the given type. Generally speaking, it is appropriate
+ * if the given type is more specific than the current type.
+ *
+ * @param expression the expression used to access the static and propagated elements whose types
+ * might be overridden
+ * @param potentialType the potential type of the elements
+ */
+ void override(Expression expression, Type2 potentialType) {
+ VariableElement element = getOverridableStaticElement(expression);
+ if (element != null) {
+ override2(element, potentialType);
+ }
+ element = getOverridablePropagatedElement(expression);
+ if (element != null) {
+ override2(element, potentialType);
+ }
+ }
+
+ /**
* If it is appropriate to do so, override the current type of the given element with the given
* type. Generally speaking, it is appropriate if the given type is more specific than the current
* type.
@@ -6489,7 +6615,7 @@
* @param element the element whose type might be overridden
* @param potentialType the potential type of the element
*/
- void override(VariableElement element, Type2 potentialType) {
+ void override2(VariableElement element, Type2 potentialType) {
if (potentialType == null || identical(potentialType, BottomTypeImpl.instance)) {
return;
}
@@ -6504,6 +6630,43 @@
_overrideManager.setType(element, potentialType);
}
}
+
+ /**
+ * Report a conditional analysis error with the given error code and arguments.
+ *
+ * @param enclosingElement the enclosing element
+ * @param errorCode the error code of the error to be reported
+ * @param node the node specifying the location of the error
+ * @param arguments the arguments to the error, used to compose the error message
+ */
+ void reportErrorProxyConditionalAnalysisError(Element enclosingElement, ErrorCode errorCode, ASTNode node, List<Object> arguments) {
+ _proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, node.offset, node.length, errorCode, arguments)));
+ }
+
+ /**
+ * Report a conditional analysis error with the given error code and arguments.
+ *
+ * @param enclosingElement the enclosing element
+ * @param errorCode the error code of the error to be reported
+ * @param offset the offset of the location of the error
+ * @param length the length of the location of the error
+ * @param arguments the arguments to the error, used to compose the error message
+ */
+ void reportErrorProxyConditionalAnalysisError2(Element enclosingElement, ErrorCode errorCode, int offset, int length, List<Object> arguments) {
+ _proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, offset, length, errorCode, arguments)));
+ }
+
+ /**
+ * Report a conditional analysis error with the given error code and arguments.
+ *
+ * @param enclosingElement the enclosing element
+ * @param errorCode the error code of the error to be reported
+ * @param token the token specifying the location of the error
+ * @param arguments the arguments to the error, used to compose the error message
+ */
+ void reportErrorProxyConditionalAnalysisError3(Element enclosingElement, ErrorCode errorCode, sc.Token token, List<Object> arguments) {
+ _proxyConditionalAnalysisErrors.add(new ProxyConditionalAnalysisError(enclosingElement, new AnalysisError.con2(source, token.offset, token.length, errorCode, arguments)));
+ }
void visitForEachStatementInScope(ForEachStatement node) {
Expression iterator = node.iterator;
safelyVisit(iterator);
@@ -6517,7 +6680,7 @@
LocalVariableElement loopElement = loopVariable.element;
if (loopElement != null) {
Type2 iteratorElementType = getIteratorElementType(iterator);
- override(loopElement, iteratorElementType);
+ override2(loopElement, iteratorElementType);
recordPropagatedType(loopVariable.identifier, iteratorElementType);
}
}
@@ -6686,10 +6849,7 @@
} else if (condition is IsExpression) {
IsExpression is2 = condition as IsExpression;
if (is2.notOperator != null) {
- VariableElement element = getOverridableElement(is2.expression);
- if (element != null) {
- override(element, is2.type.type);
- }
+ override(is2.expression, is2.type.type);
}
} else if (condition is PrefixExpression) {
PrefixExpression prefix = condition as PrefixExpression;
@@ -6726,10 +6886,7 @@
} else if (condition is IsExpression) {
IsExpression is2 = condition as IsExpression;
if (is2.notOperator == null) {
- VariableElement element = getOverridableElement(is2.expression);
- if (element != null) {
- override(element, is2.type.type);
- }
+ override(is2.expression, is2.type.type);
}
} else if (condition is PrefixExpression) {
PrefixExpression prefix = condition as PrefixExpression;
@@ -6849,10 +7006,21 @@
* @return the object used to access the types from the core library
*/
TypeProvider get typeProvider => _typeProvider;
+
+ /**
+ * Report an error with the given analysis error.
+ *
+ * @param errorCode analysis error
+ */
+ void reportError(AnalysisError analysisError) {
+ _errorListener.onError(analysisError);
+ }
Object visitBlock(Block node) {
Scope outerScope = _nameScope;
try {
- _nameScope = new EnclosedScope(_nameScope);
+ EnclosedScope enclosedScope = new EnclosedScope(_nameScope);
+ hideNamesDefinedInBlock(enclosedScope, node);
+ _nameScope = enclosedScope;
super.visitBlock(node);
} finally {
_nameScope = outerScope;
@@ -6865,15 +7033,17 @@
Scope outerScope = _nameScope;
try {
_nameScope = new EnclosedScope(_nameScope);
- _nameScope.define(exception.element);
+ _nameScope.define(exception.staticElement);
SimpleIdentifier stackTrace = node.stackTraceParameter;
if (stackTrace != null) {
- _nameScope.define(stackTrace.element);
+ _nameScope.define(stackTrace.staticElement);
}
super.visitCatchClause(node);
} finally {
_nameScope = outerScope;
}
+ } else {
+ super.visitCatchClause(node);
}
return null;
}
@@ -7047,7 +7217,7 @@
for (SwitchMember member in node.members) {
for (Label label in member.labels) {
SimpleIdentifier labelName = label.label;
- LabelElement labelElement = labelName.element as LabelElement;
+ LabelElement labelElement = labelName.staticElement as LabelElement;
_labelScope = new LabelScope.con2(_labelScope, labelName.name, labelElement);
}
}
@@ -7094,13 +7264,20 @@
Scope get nameScope => _nameScope;
/**
+ * Return the source.
+ *
+ * @return the source
+ */
+ Source get source => _source;
+
+ /**
* Report an error with the given error code and arguments.
*
* @param errorCode the error code of the error to be reported
* @param node the node specifying the location of the error
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportError(ErrorCode errorCode, ASTNode node, List<Object> arguments) {
+ void reportError5(ErrorCode errorCode, ASTNode node, List<Object> arguments) {
_errorListener.onError(new AnalysisError.con2(_source, node.offset, node.length, errorCode, arguments));
}
@@ -7112,7 +7289,7 @@
* @param length the length of the location of the error
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportError5(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
+ void reportError6(ErrorCode errorCode, int offset, int length, List<Object> arguments) {
_errorListener.onError(new AnalysisError.con2(_source, offset, length, errorCode, arguments));
}
@@ -7123,7 +7300,7 @@
* @param token the token specifying the location of the error
* @param arguments the arguments to the error, used to compose the error message
*/
- void reportError6(ErrorCode errorCode, sc.Token token, List<Object> arguments) {
+ void reportError7(ErrorCode errorCode, sc.Token token, List<Object> arguments) {
_errorListener.onError(new AnalysisError.con2(_source, token.offset, token.length, errorCode, arguments));
}
@@ -7174,7 +7351,7 @@
*/
void visitStatementInScope(Statement node) {
if (node is Block) {
- visitBlock((node as Block));
+ visitBlock(node as Block);
} else if (node != null) {
Scope outerNameScope = _nameScope;
try {
@@ -7197,11 +7374,33 @@
for (Label label in labels) {
SimpleIdentifier labelNameNode = label.label;
String labelName = labelNameNode.name;
- LabelElement labelElement = labelNameNode.element as LabelElement;
+ LabelElement labelElement = labelNameNode.staticElement as LabelElement;
_labelScope = new LabelScope.con2(_labelScope, labelName, labelElement);
}
return outerScope;
}
+
+ /**
+ * Marks the local declarations of the given [Block] hidden in the enclosing scope.
+ * According to the scoping rules name is hidden if block defines it, but name is defined after
+ * its declaration statement.
+ */
+ void hideNamesDefinedInBlock(EnclosedScope scope, Block block) {
+ for (Statement statement in block.statements) {
+ if (statement is VariableDeclarationStatement) {
+ VariableDeclarationStatement vds = statement as VariableDeclarationStatement;
+ for (VariableDeclaration variableDeclaration in vds.variables.variables) {
+ Element element = variableDeclaration.element;
+ scope.hide(element);
+ }
+ }
+ if (statement is FunctionDeclarationStatement) {
+ FunctionDeclarationStatement fds = statement as FunctionDeclarationStatement;
+ Element element = fds.functionDeclaration.element;
+ scope.hide(element);
+ }
+ }
+ }
}
/**
* Instances of the class `StaticTypeAnalyzer` perform two type-related tasks. First, they
@@ -7427,10 +7626,7 @@
}
overrideType = propagatedType;
}
- VariableElement element = _resolver.getOverridableElement(node.leftHandSide);
- if (element != null) {
- _resolver.override(element, overrideType);
- }
+ _resolver.override(node.leftHandSide, overrideType);
} else {
ExecutableElement staticMethodElement = node.staticElement;
Type2 staticType = computeStaticReturnType(staticMethodElement);
@@ -7894,9 +8090,6 @@
Object visitMethodInvocation(MethodInvocation node) {
SimpleIdentifier methodNameNode = node.methodName;
Element staticMethodElement = methodNameNode.staticElement;
- if (staticMethodElement == null) {
- staticMethodElement = methodNameNode.element;
- }
Type2 staticStaticType = computeStaticReturnType(staticMethodElement);
recordStaticType(node, staticStaticType);
Type2 staticPropagatedType = computePropagatedReturnType(staticMethodElement);
@@ -7947,7 +8140,7 @@
} else if (methodName == "query") {
Expression target = node.realTarget;
if (target == null) {
- Element methodElement = methodNameNode.element;
+ Element methodElement = methodNameNode.bestElement;
if (methodElement != null) {
LibraryElement library = methodElement.library;
if (isHtmlLibrary(library)) {
@@ -7987,7 +8180,7 @@
recordPropagatedType2(node, returnType);
}
} else {
- Element propagatedElement = methodNameNode.element;
+ Element propagatedElement = methodNameNode.propagatedElement;
if (propagatedElement != staticMethodElement) {
Type2 propagatedStaticType = computeStaticReturnType(propagatedElement);
if (propagatedStaticType != null && (staticStaticType == null || propagatedStaticType.isMoreSpecificThan(staticStaticType)) && (staticPropagatedType == null || propagatedStaticType.isMoreSpecificThan(staticPropagatedType))) {
@@ -8069,7 +8262,7 @@
*/
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
SimpleIdentifier prefixedIdentifier = node.identifier;
- Element element = prefixedIdentifier.element;
+ Element element = prefixedIdentifier.staticElement;
Type2 staticType = _dynamicType;
if (element is ClassElement) {
if (isNotTypeLiteral(node)) {
@@ -8082,7 +8275,7 @@
} else if (element is MethodElement) {
staticType = ((element as MethodElement)).type;
} else if (element is PropertyAccessorElement) {
- staticType = getType((element as PropertyAccessorElement), node.prefix.staticType);
+ staticType = getType(element as PropertyAccessorElement, node.prefix.staticType);
} else if (element is ExecutableElement) {
staticType = ((element as ExecutableElement)).type;
} else if (element is TypeVariableElement) {
@@ -8175,12 +8368,12 @@
*/
Object visitPropertyAccess(PropertyAccess node) {
SimpleIdentifier propertyName = node.propertyName;
- Element element = propertyName.element;
+ Element element = propertyName.staticElement;
Type2 staticType = _dynamicType;
if (element is MethodElement) {
staticType = ((element as MethodElement)).type;
} else if (element is PropertyAccessorElement) {
- staticType = getType((element as PropertyAccessorElement), node.target != null ? getStaticType(node.target) : null);
+ staticType = getType(element as PropertyAccessorElement, node.target != null ? getStaticType(node.target) : null);
} else {
}
recordStaticType(propertyName, staticType);
@@ -8244,7 +8437,7 @@
* </blockquote>
*/
Object visitSimpleIdentifier(SimpleIdentifier node) {
- Element element = node.element;
+ Element element = node.staticElement;
Type2 staticType = _dynamicType;
if (element is ClassElement) {
if (isNotTypeLiteral(node)) {
@@ -8257,7 +8450,7 @@
} else if (element is MethodElement) {
staticType = ((element as MethodElement)).type;
} else if (element is PropertyAccessorElement) {
- staticType = getType((element as PropertyAccessorElement), null);
+ staticType = getType(element as PropertyAccessorElement, null);
} else if (element is ExecutableElement) {
staticType = ((element as ExecutableElement)).type;
} else if (element is TypeVariableElement) {
@@ -8334,9 +8527,9 @@
Type2 rightType = initializer.bestType;
SimpleIdentifier name = node.name;
recordPropagatedType2(name, rightType);
- VariableElement element = name.element as VariableElement;
+ VariableElement element = name.staticElement as VariableElement;
if (element != null) {
- _resolver.override(element, rightType);
+ _resolver.override2(element, rightType);
}
}
return null;
@@ -8606,7 +8799,7 @@
}
Type2 returnType = functionType.returnType;
if (returnType is TypeVariableType && context is InterfaceType) {
- InterfaceType interfaceTypeContext = (context as InterfaceType);
+ InterfaceType interfaceTypeContext = context as InterfaceType;
List<TypeVariableElement> parameterElements = interfaceTypeContext.element != null ? interfaceTypeContext.element.typeVariables : null;
if (parameterElements != null) {
for (int i = 0; i < parameterElements.length; i++) {
@@ -8966,6 +9159,13 @@
abstract class TypeProvider {
/**
+ * Return the type representing the built-in type 'Null'.
+ *
+ * @return the type representing the built-in type 'null'
+ */
+ InterfaceType get nullType;
+
+ /**
* Return the type representing the built-in type 'bool'.
*
* @return the type representing the built-in type 'bool'
@@ -9112,6 +9312,11 @@
InterfaceType _mapType;
/**
+ * The type representing the type 'Null'.
+ */
+ InterfaceType _nullType;
+
+ /**
* The type representing the built-in type 'num'.
*/
InterfaceType _numType;
@@ -9157,6 +9362,7 @@
InterfaceType get intType => _intType;
InterfaceType get listType => _listType;
InterfaceType get mapType => _mapType;
+ InterfaceType get nullType => _nullType;
InterfaceType get numType => _numType;
InterfaceType get objectType => _objectType;
InterfaceType get stackTraceType => _stackTraceType;
@@ -9196,6 +9402,7 @@
_intType = getType(namespace, "int");
_listType = getType(namespace, "List");
_mapType = getType(namespace, "Map");
+ _nullType = getType(namespace, "Null");
_numType = getType(namespace, "num");
_objectType = getType(namespace, "Object");
_stackTraceType = getType(namespace, "StackTrace");
@@ -9260,7 +9467,7 @@
exceptionType = getType3(exceptionTypeName);
}
recordType(exception, exceptionType);
- Element element = exception.element;
+ Element element = exception.staticElement;
if (element is VariableElementImpl) {
((element as VariableElementImpl)).type = exceptionType;
} else {
@@ -9341,7 +9548,7 @@
}
Object visitFieldFormalParameter(FieldFormalParameter node) {
super.visitFieldFormalParameter(node);
- Element element = node.identifier.element;
+ Element element = node.identifier.staticElement;
if (element is ParameterElementImpl) {
ParameterElementImpl parameter = element as ParameterElementImpl;
FormalParameterList parameterList = node.parameters;
@@ -9381,9 +9588,9 @@
}
Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
super.visitFunctionTypedFormalParameter(node);
- Element element = node.identifier.element;
+ Element element = node.identifier.staticElement;
if (element is ParameterElementImpl) {
- setFunctionTypedParameterType((element as ParameterElementImpl), node.returnType, node.parameters);
+ setFunctionTypedParameterType(element as ParameterElementImpl, node.returnType, node.parameters);
} else {
}
return null;
@@ -9421,7 +9628,7 @@
} else {
declaredType = getType3(typeName);
}
- Element element = node.identifier.element;
+ Element element = node.identifier.staticElement;
if (element is ParameterElement) {
((element as ParameterElementImpl)).type = declaredType;
} else {
@@ -9463,9 +9670,9 @@
element = nameScope.lookup(prefix, definingLibrary);
if (element is PrefixElement) {
if (parent.parent is InstanceCreationExpression && ((parent.parent as InstanceCreationExpression)).isConst) {
- reportError(CompileTimeErrorCode.CONST_WITH_NON_TYPE, prefixedIdentifier.identifier, [prefixedIdentifier.identifier.name]);
+ reportError5(CompileTimeErrorCode.CONST_WITH_NON_TYPE, prefixedIdentifier.identifier, [prefixedIdentifier.identifier.name]);
} else {
- reportError(StaticWarningCode.NEW_WITH_NON_TYPE, prefixedIdentifier.identifier, [prefixedIdentifier.identifier.name]);
+ reportError5(StaticWarningCode.NEW_WITH_NON_TYPE, prefixedIdentifier.identifier, [prefixedIdentifier.identifier.name]);
}
setElement(prefix, element);
return null;
@@ -9484,14 +9691,14 @@
InstanceCreationExpression creation = node.parent.parent as InstanceCreationExpression;
if (creation.isConst) {
if (element == null) {
- reportError(CompileTimeErrorCode.UNDEFINED_CLASS, typeNameSimple, [typeName]);
+ reportError5(CompileTimeErrorCode.UNDEFINED_CLASS, typeNameSimple, [typeName]);
} else {
- reportError(CompileTimeErrorCode.CONST_WITH_NON_TYPE, typeNameSimple, [typeName]);
+ reportError5(CompileTimeErrorCode.CONST_WITH_NON_TYPE, typeNameSimple, [typeName]);
}
elementValid = false;
} else {
if (element != null) {
- reportError(StaticWarningCode.NEW_WITH_NON_TYPE, typeNameSimple, [typeName]);
+ reportError5(StaticWarningCode.NEW_WITH_NON_TYPE, typeNameSimple, [typeName]);
elementValid = false;
}
}
@@ -9499,19 +9706,19 @@
if (elementValid && element == null) {
SimpleIdentifier typeNameSimple = getTypeSimpleIdentifier(typeName);
if (typeNameSimple.name == "boolean") {
- reportError(StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, typeNameSimple, []);
+ reportError5(StaticWarningCode.UNDEFINED_CLASS_BOOLEAN, typeNameSimple, []);
} else if (isTypeNameInCatchClause(node)) {
- reportError(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
} else if (isTypeNameInAsExpression(node)) {
- reportError(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
} else if (isTypeNameInIsExpression(node)) {
- reportError(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
} else if (isTypeNameTargetInRedirectedConstructor(node)) {
- reportError(StaticWarningCode.REDIRECT_TO_NON_CLASS, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.REDIRECT_TO_NON_CLASS, typeName, [typeName.name]);
} else if (isTypeNameInTypeArgumentList(node)) {
- reportError(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName, [typeName.name]);
+ reportError5(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName, [typeName.name]);
} else {
- reportError(StaticWarningCode.UNDEFINED_CLASS, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.UNDEFINED_CLASS, typeName, [typeName.name]);
}
elementValid = false;
}
@@ -9545,15 +9752,15 @@
}
} else {
if (isTypeNameInCatchClause(node)) {
- reportError(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE, typeName, [typeName.name]);
} else if (isTypeNameInAsExpression(node)) {
- reportError(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.CAST_TO_NON_TYPE, typeName, [typeName.name]);
} else if (isTypeNameInIsExpression(node)) {
- reportError(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.TYPE_TEST_NON_TYPE, typeName, [typeName.name]);
} else if (isTypeNameTargetInRedirectedConstructor(node)) {
- reportError(StaticWarningCode.REDIRECT_TO_NON_CLASS, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.REDIRECT_TO_NON_CLASS, typeName, [typeName.name]);
} else if (isTypeNameInTypeArgumentList(node)) {
- reportError(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName, [typeName.name]);
+ reportError5(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, typeName, [typeName.name]);
} else {
ASTNode parent = typeName.parent;
while (parent is TypeName) {
@@ -9561,7 +9768,7 @@
}
if (parent is ExtendsClause || parent is ImplementsClause || parent is WithClause || parent is ClassTypeAlias) {
} else {
- reportError(StaticWarningCode.NOT_A_TYPE, typeName, [typeName.name]);
+ reportError5(StaticWarningCode.NOT_A_TYPE, typeName, [typeName.name]);
}
}
setElement(typeName, _dynamicType.element);
@@ -9583,7 +9790,7 @@
}
}
if (argumentCount != parameterCount) {
- reportError(getInvalidTypeParametersErrorCode(node), node, [typeName.name, parameterCount, argumentCount]);
+ reportError5(getInvalidTypeParametersErrorCode(node), node, [typeName.name, parameterCount, argumentCount]);
}
argumentCount = typeArguments.length;
if (argumentCount < parameterCount) {
@@ -9624,7 +9831,7 @@
} else {
declaredType = getType3(typeName);
}
- Element element = node.name.element;
+ Element element = node.name.staticElement;
if (element is VariableElement) {
((element as VariableElementImpl)).type = declaredType;
if (element is PropertyInducingElement) {
@@ -9681,7 +9888,7 @@
if (identifier == null) {
return null;
}
- Element element = identifier.element;
+ Element element = identifier.staticElement;
if (element is! ClassElementImpl) {
return null;
}
@@ -9698,7 +9905,7 @@
List<ParameterElement> getElements(FormalParameterList parameterList) {
List<ParameterElement> elements = new List<ParameterElement>();
for (FormalParameter parameter in parameterList.parameters) {
- ParameterElement element = parameter.identifier.element as ParameterElement;
+ ParameterElement element = parameter.identifier.staticElement as ParameterElement;
if (element != null) {
elements.add(element);
}
@@ -9915,6 +10122,9 @@
if (implementsClause != null) {
NodeList<TypeName> interfaces = implementsClause.interfaces;
List<InterfaceType> interfaceTypes = resolveTypes(interfaces, CompileTimeErrorCode.IMPLEMENTS_NON_CLASS, CompileTimeErrorCode.IMPLEMENTS_DYNAMIC);
+ if (classElement != null) {
+ classElement.interfaces = interfaceTypes;
+ }
List<TypeName> typeNames = new List.from(interfaces);
List<bool> detectedRepeatOnIndex = new List<bool>.filled(typeNames.length, false);
for (int i = 0; i < detectedRepeatOnIndex.length; i++) {
@@ -9923,22 +10133,19 @@
for (int i = 0; i < typeNames.length; i++) {
TypeName typeName = typeNames[i];
if (!detectedRepeatOnIndex[i]) {
+ Element element = typeName.name.staticElement;
for (int j = i + 1; j < typeNames.length; j++) {
- Element element = typeName.name.element;
TypeName typeName2 = typeNames[j];
Identifier identifier2 = typeName2.name;
String name2 = identifier2.name;
- Element element2 = identifier2.element;
+ Element element2 = identifier2.staticElement;
if (element != null && element == element2) {
detectedRepeatOnIndex[j] = true;
- reportError(CompileTimeErrorCode.IMPLEMENTS_REPEATED, typeName2, [name2]);
+ reportError5(CompileTimeErrorCode.IMPLEMENTS_REPEATED, typeName2, [name2]);
}
}
}
}
- if (classElement != null) {
- classElement.interfaces = interfaceTypes;
- }
}
}
@@ -9958,9 +10165,9 @@
}
Identifier name = typeName.name;
if (name.name == sc.Keyword.DYNAMIC.syntax) {
- reportError(dynamicTypeError, name, [name.name]);
+ reportError5(dynamicTypeError, name, [name.name]);
} else {
- reportError(nonTypeError, name, [name.name]);
+ reportError5(nonTypeError, name, [name.name]);
}
return null;
}
@@ -9984,20 +10191,17 @@
}
return new List.from(types);
}
- void setElement(Identifier typeName, Element element2) {
- if (element2 != null) {
+ void setElement(Identifier typeName, Element element) {
+ if (element != null) {
if (typeName is SimpleIdentifier) {
- ((typeName as SimpleIdentifier)).staticElement = element2;
- ((typeName as SimpleIdentifier)).element = element2;
+ ((typeName as SimpleIdentifier)).staticElement = element;
} else if (typeName is PrefixedIdentifier) {
PrefixedIdentifier identifier = typeName as PrefixedIdentifier;
- identifier.identifier.staticElement = element2;
- identifier.identifier.element = element2;
+ identifier.identifier.staticElement = element;
SimpleIdentifier prefix = identifier.prefix;
Element prefixElement = nameScope.lookup(prefix, definingLibrary);
if (prefixElement != null) {
prefix.staticElement = prefixElement;
- prefix.element = prefixElement;
}
}
}
@@ -10105,6 +10309,13 @@
Scope _enclosingScope;
/**
+ * A set of names that will be defined in this scope, but right now are not defined. However
+ * according to the scoping rules these names are hidden, even if they were defined in an outer
+ * scope.
+ */
+ Set<String> _hiddenNames = new Set<String>();
+
+ /**
* Initialize a newly created scope enclosed within another scope.
*
* @param enclosingScope the scope in which this scope is lexically enclosed
@@ -10116,6 +10327,21 @@
AnalysisErrorListener get errorListener => _enclosingScope.errorListener;
/**
+ * Hides the name of the given element in this scope. If there is already an element with the
+ * given name defined in an outer scope, then it will become unavailable.
+ *
+ * @param element the element to be hidden in this scope
+ */
+ void hide(Element element) {
+ if (element != null) {
+ String name = element.name;
+ if (name != null && !name.isEmpty) {
+ javaSetAdd(_hiddenNames, name);
+ }
+ }
+ }
+
+ /**
* Return the scope in which this scope is lexically enclosed.
*
* @return the scope in which this scope is lexically enclosed
@@ -10126,6 +10352,9 @@
if (element != null) {
return element;
}
+ if (_hiddenNames.contains(name)) {
+ return null;
+ }
return _enclosingScope.lookup3(identifier, name, referencingLibrary);
}
}
@@ -10973,7 +11202,7 @@
}
Object visitListLiteral(ListLiteral node) {
super.visitListLiteral(node);
- if (node.modifier != null) {
+ if (node.constKeyword != null) {
for (Expression element in node.elements) {
validate(element, CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT);
}
@@ -10982,7 +11211,7 @@
}
Object visitMapLiteral(MapLiteral node) {
super.visitMapLiteral(node);
- bool isConst = node.modifier != null;
+ bool isConst = node.constKeyword != null;
bool reportEqualKeys = true;
Set<Object> keys = new Set<Object>();
List<Expression> invalidKeys = new List<Expression>();
@@ -11202,7 +11431,7 @@
List<ParameterElement> parameterElements;
ConstantVisitor_10(this.ConstantVerifier_this, this.parameterElements) : super();
EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) {
- Element element = node.element;
+ Element element = node.staticElement;
for (ParameterElement parameterElement in parameterElements) {
if (identical(parameterElement, element) && parameterElement != null) {
Type2 type = parameterElement.type;
@@ -11246,7 +11475,7 @@
static bool isTypeReference(Expression expr) {
if (expr is Identifier) {
Identifier identifier = expr as Identifier;
- return identifier.element is ClassElement;
+ return identifier.staticElement is ClassElement;
}
return false;
}
@@ -11300,6 +11529,12 @@
/**
* This is set to `true` iff the visitor is currently visiting children nodes of an
+ * [Comment].
+ */
+ bool _isInComment = false;
+
+ /**
+ * This is set to `true` iff the visitor is currently visiting children nodes of an
* [InstanceCreationExpression].
*/
bool _isInConstInstanceCreation = false;
@@ -11335,6 +11570,12 @@
bool _isInConstructorInitializer = false;
/**
+ * This is set to `true` iff the visitor is currently visiting a
+ * [FunctionTypedFormalParameter].
+ */
+ bool _isInFunctionTypedFormalParameter = false;
+
+ /**
* This is set to `true` iff the visitor is currently visiting a static method. By "method"
* here getter, setter and operator declarations are also implied since they are all represented
* with a [MethodDeclaration] in the AST structure.
@@ -11415,6 +11656,7 @@
_isInStaticMethod = false;
_dynamicType = typeProvider.dynamicType;
_DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType> [
+ typeProvider.nullType,
typeProvider.numType,
typeProvider.intType,
typeProvider.doubleType,
@@ -11511,6 +11753,14 @@
}
return super.visitClassTypeAlias(node);
}
+ Object visitComment(Comment node) {
+ _isInComment = true;
+ try {
+ return super.visitComment(node);
+ } finally {
+ _isInComment = false;
+ }
+ }
Object visitConditionalExpression(ConditionalExpression node) {
checkForNonBoolCondition(node.condition);
return super.visitConditionalExpression(node);
@@ -11521,13 +11771,15 @@
_enclosingFunction = node.element;
_isEnclosingConstructorConst = node.constKeyword != null;
checkForConstConstructorWithNonFinalField(node);
+ checkForConstConstructorWithNonConstSuper(node);
checkForConflictingConstructorNameAndMember(node);
checkForAllFinalInitializedErrorCodes(node);
checkForRedirectingConstructorErrorCodes(node);
checkForMultipleSuperInitializers(node);
checkForRecursiveConstructorRedirect(node);
- checkForRecursiveFactoryRedirect(node);
- checkForAllRedirectConstructorErrorCodes(node);
+ if (!checkForRecursiveFactoryRedirect(node)) {
+ checkForAllRedirectConstructorErrorCodes(node);
+ }
checkForUndefinedConstructorInInitializerImplicit(node);
checkForRedirectToNonConstConstructor(node);
checkForReturnInGenerativeConstructor(node);
@@ -11546,6 +11798,11 @@
_isInConstructorInitializer = false;
}
}
+ Object visitDefaultFormalParameter(DefaultFormalParameter node) {
+ checkForInvalidAssignment2(node.identifier, node.defaultValue);
+ checkForDefaultValueInFunctionTypedParameter(node);
+ return super.visitDefaultFormalParameter(node);
+ }
Object visitDoStatement(DoStatement node) {
checkForNonBoolCondition(node.condition);
return super.visitDoStatement(node);
@@ -11623,12 +11880,29 @@
return super.visitFunctionExpression(node);
}
}
+ Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
+ Expression functionExpression = node.function;
+ Type2 expressionType = functionExpression.staticType;
+ if (!isFunctionType(expressionType)) {
+ _errorReporter.reportError2(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, functionExpression, []);
+ }
+ return super.visitFunctionExpressionInvocation(node);
+ }
Object visitFunctionTypeAlias(FunctionTypeAlias node) {
checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
checkForDefaultValueInFunctionTypeAlias(node);
checkForTypeAliasCannotReferenceItself_function(node);
return super.visitFunctionTypeAlias(node);
}
+ Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
+ bool old = _isInFunctionTypedFormalParameter;
+ _isInFunctionTypedFormalParameter = true;
+ try {
+ return super.visitFunctionTypedFormalParameter(node);
+ } finally {
+ _isInFunctionTypedFormalParameter = old;
+ }
+ }
Object visitIfStatement(IfStatement node) {
checkForNonBoolCondition(node.condition);
return super.visitIfStatement(node);
@@ -11665,7 +11939,7 @@
}
}
Object visitListLiteral(ListLiteral node) {
- if (node.modifier != null) {
+ if (node.constKeyword != null) {
TypeArgumentList typeArguments = node.typeArguments;
if (typeArguments != null) {
NodeList<TypeName> arguments = typeArguments.arguments;
@@ -11682,8 +11956,7 @@
if (typeArguments != null) {
NodeList<TypeName> arguments = typeArguments.arguments;
if (arguments.length != 0) {
- checkForInvalidTypeArgumentForKey(arguments);
- if (node.modifier != null) {
+ if (node.constKeyword != null) {
checkForInvalidTypeArgumentInConstTypedLiteral(arguments, CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP);
}
}
@@ -11726,7 +11999,13 @@
}
}
Object visitMethodInvocation(MethodInvocation node) {
- checkForStaticAccessToInstanceMember(node.target, node.methodName);
+ Expression target = node.realTarget;
+ SimpleIdentifier methodName = node.methodName;
+ checkForStaticAccessToInstanceMember(target, methodName);
+ checkForInstanceAccessToStaticMember(target, methodName);
+ if (target == null) {
+ checkForUnqualifiedReferenceToNonLocalStaticMember(methodName);
+ }
return super.visitMethodInvocation(node);
}
Object visitNativeClause(NativeClause node) {
@@ -11747,6 +12026,7 @@
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
if (node.parent is! Annotation) {
checkForStaticAccessToInstanceMember(node.prefix, node.identifier);
+ checkForInstanceAccessToStaticMember(node.prefix, node.identifier);
}
return super.visitPrefixedIdentifier(node);
}
@@ -11759,7 +12039,9 @@
}
Object visitPropertyAccess(PropertyAccess node) {
Expression target = node.realTarget;
- checkForStaticAccessToInstanceMember(target, node.propertyName);
+ SimpleIdentifier propertyName = node.propertyName;
+ checkForStaticAccessToInstanceMember(target, propertyName);
+ checkForInstanceAccessToStaticMember(target, propertyName);
return super.visitPropertyAccess(node);
}
Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
@@ -11786,6 +12068,9 @@
Object visitSimpleIdentifier(SimpleIdentifier node) {
checkForReferenceToDeclaredVariableInInitializer(node);
checkForImplicitThisReferenceInInitializer(node);
+ if (!isUnqualifiedReferenceToNonLocalStaticMemberAllowed(node)) {
+ checkForUnqualifiedReferenceToNonLocalStaticMember(node);
+ }
return super.visitSimpleIdentifier(node);
}
Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
@@ -11886,7 +12171,7 @@
fieldElementsMap[fieldElement] = INIT_STATE.INIT_IN_FIELD_FORMAL;
} else if (identical(state, INIT_STATE.INIT_IN_DECLARATION)) {
if (fieldElement.isFinal || fieldElement.isConst) {
- _errorReporter.reportError2(CompileTimeErrorCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, formalParameter.identifier, [fieldElement.displayName]);
+ _errorReporter.reportError2(StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, formalParameter.identifier, [fieldElement.displayName]);
foundError = true;
}
} else if (identical(state, INIT_STATE.INIT_IN_FIELD_FORMAL)) {
@@ -11905,7 +12190,7 @@
if (constructorInitializer is ConstructorFieldInitializer) {
ConstructorFieldInitializer constructorFieldInitializer = constructorInitializer as ConstructorFieldInitializer;
SimpleIdentifier fieldName = constructorFieldInitializer.fieldName;
- Element element = fieldName.element;
+ Element element = fieldName.staticElement;
if (element is FieldElement) {
FieldElement fieldElement = element as FieldElement;
INIT_STATE state = fieldElementsMap[fieldElement];
@@ -11913,7 +12198,7 @@
fieldElementsMap[fieldElement] = INIT_STATE.INIT_IN_INITIALIZERS;
} else if (identical(state, INIT_STATE.INIT_IN_DECLARATION)) {
if (fieldElement.isFinal || fieldElement.isConst) {
- _errorReporter.reportError2(CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, fieldName, []);
+ _errorReporter.reportError2(StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, fieldName, []);
foundError = true;
}
} else if (identical(state, INIT_STATE.INIT_IN_FIELD_FORMAL)) {
@@ -11941,7 +12226,7 @@
/**
* This checks the passed executable element against override-error codes.
*
- * @param executableElement the [ExecutableElement] to evaluate
+ * @param executableElement a non-null [ExecutableElement] to evaluate
* @param parameters the parameters of the executable element
* @param errorNameTarget the node to report problems on
* @return `true` if and only if an error code is generated on the passed node
@@ -11959,7 +12244,7 @@
*/
bool checkForAllInvalidOverrideErrorCodes(ExecutableElement executableElement, List<ParameterElement> parameters2, List<ASTNode> parameterLocations, SimpleIdentifier errorNameTarget) {
String executableElementName = executableElement.name;
- ExecutableElement overriddenExecutable = _inheritanceManager.lookupInheritance(_enclosingClass, executableElement.name);
+ ExecutableElement overriddenExecutable = _inheritanceManager.lookupInheritance(_enclosingClass, executableElementName);
bool isGetter = false;
bool isSetter = false;
if (executableElement is PropertyAccessorElement) {
@@ -12014,13 +12299,13 @@
Map<String, Type2> overridingNamedPT = overridingFT.namedParameterTypes;
Map<String, Type2> overriddenNamedPT = overriddenFT.namedParameterTypes;
if (overridingNormalPT.length != overriddenNormalPT.length) {
- _errorReporter.reportError2(CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED, errorNameTarget, [
+ _errorReporter.reportError2(StaticWarningCode.INVALID_OVERRIDE_REQUIRED, errorNameTarget, [
overriddenNormalPT.length,
overriddenExecutable.enclosingElement.displayName]);
return true;
}
if (overridingPositionalPT.length < overriddenPositionalPT.length) {
- _errorReporter.reportError2(CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL, errorNameTarget, [
+ _errorReporter.reportError2(StaticWarningCode.INVALID_OVERRIDE_POSITIONAL, errorNameTarget, [
overriddenPositionalPT.length,
overriddenExecutable.enclosingElement.displayName]);
return true;
@@ -12030,7 +12315,7 @@
while (overriddenParameterNameIterator.hasNext) {
String overriddenParamName = overriddenParameterNameIterator.next();
if (!overridingParameterNameSet.contains(overriddenParamName)) {
- _errorReporter.reportError2(CompileTimeErrorCode.INVALID_OVERRIDE_NAMED, errorNameTarget, [
+ _errorReporter.reportError2(StaticWarningCode.INVALID_OVERRIDE_NAMED, errorNameTarget, [
overriddenParamName,
overriddenExecutable.enclosingElement.displayName]);
return true;
@@ -12103,12 +12388,16 @@
ParameterElement parameter = parameters2[i];
if (parameter.parameterKind.isOptional) {
formalParameters.add(parameterLocations[i]);
- parameterElts.add((parameter as ParameterElementImpl));
+ parameterElts.add(parameter as ParameterElementImpl);
}
}
for (ParameterElement parameterElt in overriddenPEs) {
if (parameterElt.parameterKind.isOptional) {
- overriddenParameterElts.add((parameterElt as ParameterElementImpl));
+ if (parameterElt is ParameterElementImpl) {
+ overriddenParameterElts.add(parameterElt as ParameterElementImpl);
+ } else if (parameterElt is ParameterMember) {
+ overriddenParameterElts.add(((parameterElt as ParameterMember)).baseElement as ParameterElementImpl);
+ }
}
}
if (parameterElts.length > 0) {
@@ -12237,10 +12526,14 @@
if (mixinType is! InterfaceType) {
continue;
}
- ClassElement mixinElement = ((mixinType as InterfaceType)).element;
- problemReported = javaBooleanOr(problemReported, checkForMixinDeclaresConstructor(mixinName, mixinElement));
- problemReported = javaBooleanOr(problemReported, checkForMixinInheritsNotFromObject(mixinName, mixinElement));
- problemReported = javaBooleanOr(problemReported, checkForMixinReferencesSuper(mixinName, mixinElement));
+ if (checkForExtendsOrImplementsDisallowedClass(mixinName, CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS)) {
+ problemReported = true;
+ } else {
+ ClassElement mixinElement = ((mixinType as InterfaceType)).element;
+ problemReported = javaBooleanOr(problemReported, checkForMixinDeclaresConstructor(mixinName, mixinElement));
+ problemReported = javaBooleanOr(problemReported, checkForMixinInheritsNotFromObject(mixinName, mixinElement));
+ problemReported = javaBooleanOr(problemReported, checkForMixinReferencesSuper(mixinName, mixinElement));
+ }
}
return problemReported;
}
@@ -12259,7 +12552,7 @@
if (redirectedNode == null) {
return false;
}
- ConstructorElement redirectedElement = redirectedNode.element;
+ ConstructorElement redirectedElement = redirectedNode.staticElement;
if (redirectedElement == null) {
TypeName constructorTypeName = redirectedNode.type;
Type2 redirectedType = constructorTypeName.type;
@@ -12370,7 +12663,7 @@
*/
bool checkForArgumentDefinitionTestNonParameter(ArgumentDefinitionTest node) {
SimpleIdentifier identifier = node.identifier;
- Element element = identifier.element;
+ Element element = identifier.staticElement;
if (element != null && element is! ParameterElement) {
_errorReporter.reportError2(CompileTimeErrorCode.ARGUMENT_DEFINITION_TEST_NON_PARAMETER, identifier, [identifier.name]);
return true;
@@ -12501,10 +12794,10 @@
bool checkForAssignmentToFinal2(Expression expression) {
Element element = null;
if (expression is Identifier) {
- element = ((expression as Identifier)).element;
+ element = ((expression as Identifier)).staticElement;
}
if (expression is PropertyAccess) {
- element = ((expression as PropertyAccess)).propertyName.element;
+ element = ((expression as PropertyAccess)).propertyName.staticElement;
}
if (element is PropertyAccessorElement) {
PropertyAccessorElement accessor = element as PropertyAccessorElement;
@@ -12629,7 +12922,7 @@
for (int i = 0; i < lastMember; i++) {
SwitchMember member = members[i];
if (member is SwitchCase) {
- foundError = javaBooleanOr(foundError, checkForCaseBlockNotTerminated((member as SwitchCase)));
+ foundError = javaBooleanOr(foundError, checkForCaseBlockNotTerminated(member as SwitchCase));
}
}
return foundError;
@@ -12892,7 +13185,51 @@
}
/**
- * This verifies that the passed constructor declaration is 'const' then there are no non-final
+ * This verifies that if the passed constructor declaration is 'const' then there are no
+ * invocations of non-'const' super constructors.
+ *
+ * @param node the constructor declaration to evaluate
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see CompileTimeErrorCode#CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER
+ */
+ bool checkForConstConstructorWithNonConstSuper(ConstructorDeclaration node) {
+ if (!_isEnclosingConstructorConst) {
+ return false;
+ }
+ if (node.factoryKeyword != null) {
+ return false;
+ }
+ for (ConstructorInitializer initializer in node.initializers) {
+ if (initializer is SuperConstructorInvocation) {
+ SuperConstructorInvocation superInvocation = initializer as SuperConstructorInvocation;
+ ConstructorElement element = superInvocation.staticElement;
+ if (element.isConst) {
+ return false;
+ }
+ _errorReporter.reportError2(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, superInvocation, []);
+ return true;
+ }
+ }
+ InterfaceType supertype = _enclosingClass.supertype;
+ if (supertype == null) {
+ return false;
+ }
+ if (supertype.isObject) {
+ return false;
+ }
+ ConstructorElement unnamedConstructor = supertype.element.unnamedConstructor;
+ if (unnamedConstructor == null) {
+ return false;
+ }
+ if (unnamedConstructor.isConst) {
+ return false;
+ }
+ _errorReporter.reportError2(CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER, node, []);
+ return true;
+ }
+
+ /**
+ * This verifies that if the passed constructor declaration is 'const' then there are no non-final
* instance variable.
*
* @param node the constructor declaration to evaluate
@@ -12957,7 +13294,7 @@
*/
bool checkForConstOrNewWithAbstractClass(InstanceCreationExpression node, TypeName typeName, InterfaceType type) {
if (type.element.isAbstract) {
- ConstructorElement element = node.element;
+ ConstructorElement element = node.staticElement;
if (element != null && !element.isFactory) {
if (identical(((node.keyword as sc.KeywordToken)).keyword, sc.Keyword.CONST)) {
_errorReporter.reportError2(StaticWarningCode.CONST_WITH_ABSTRACT_CLASS, typeName, []);
@@ -12981,7 +13318,7 @@
* @see CompileTimeErrorCode#CONST_WITH_NON_CONST
*/
bool checkForConstWithNonConst(InstanceCreationExpression node) {
- ConstructorElement constructorElement = node.element;
+ ConstructorElement constructorElement = node.staticElement;
if (constructorElement != null && !constructorElement.isConst) {
_errorReporter.reportError2(CompileTimeErrorCode.CONST_WITH_NON_CONST, node, []);
return true;
@@ -13023,7 +13360,7 @@
if (name == null) {
return false;
}
- if (name.element is TypeVariableElement) {
+ if (name.staticElement is TypeVariableElement) {
_errorReporter.reportError2(CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS, name, []);
}
TypeArgumentList typeArguments = typeName.typeArguments;
@@ -13049,7 +13386,7 @@
* @see CompileTimeErrorCode#CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT
*/
bool checkForConstWithUndefinedConstructor(InstanceCreationExpression node) {
- if (node.element != null) {
+ if (node.staticElement != null) {
return false;
}
ConstructorName constructorName = node.constructorName;
@@ -13094,6 +13431,25 @@
}
/**
+ * This verifies that the given default formal parameter is not part of a function typed
+ * parameter.
+ *
+ * @param node the default formal parameter to evaluate
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see CompileTimeErrorCode#DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER
+ */
+ bool checkForDefaultValueInFunctionTypedParameter(DefaultFormalParameter node) {
+ if (!_isInFunctionTypedFormalParameter) {
+ return false;
+ }
+ if (node.defaultValue == null) {
+ return false;
+ }
+ _errorReporter.reportError2(CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER, node, []);
+ return true;
+ }
+
+ /**
* This verifies that the enclosing class does not have an instance member with the given name of
* the static member.
*
@@ -13105,11 +13461,17 @@
return false;
}
bool hasProblem = false;
- for (MethodElement method in _enclosingClass.methods) {
- if (!method.isStatic) {
+ for (ExecutableElement member in _enclosingClass.methods) {
+ if (!member.isStatic) {
continue;
}
- hasProblem = javaBooleanOr(hasProblem, checkForDuplicateDefinitionInheritance2(method));
+ hasProblem = javaBooleanOr(hasProblem, checkForDuplicateDefinitionInheritance2(member));
+ }
+ for (ExecutableElement member in _enclosingClass.accessors) {
+ if (!member.isStatic) {
+ continue;
+ }
+ hasProblem = javaBooleanOr(hasProblem, checkForDuplicateDefinitionInheritance2(member));
}
return hasProblem;
}
@@ -13260,7 +13622,7 @@
* @see StaticWarningCode#FIELD_INITIALIZER_NOT_ASSIGNABLE
*/
bool checkForFieldInitializerNotAssignable(ConstructorFieldInitializer node) {
- Element fieldNameElement = node.fieldName.element;
+ Element fieldNameElement = node.fieldName.staticElement;
if (fieldNameElement is! FieldElement) {
return false;
}
@@ -13412,7 +13774,7 @@
if (!_isInConstructorInitializer && !_isInStaticMethod && !_isInInstanceVariableInitializer && !_isInStaticVariableDeclaration) {
return false;
}
- Element element = node.element;
+ Element element = node.staticElement;
if (!(element is MethodElement || element is PropertyAccessorElement)) {
return false;
}
@@ -13569,6 +13931,40 @@
}
/**
+ * This checks that if the given "target" is not a type reference then the "name" is reference to
+ * an instance member.
+ *
+ * @param target the target of the name access to evaluate
+ * @param name the accessed name to evaluate
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see StaticTypeWarningCode#INSTANCE_ACCESS_TO_STATIC_MEMBER
+ */
+ bool checkForInstanceAccessToStaticMember(Expression target, SimpleIdentifier name2) {
+ if (target == null) {
+ return false;
+ }
+ if (_isInComment) {
+ return false;
+ }
+ Element element = name2.staticElement;
+ if (element is! ExecutableElement) {
+ return false;
+ }
+ ExecutableElement executableElement = element as ExecutableElement;
+ if (executableElement.enclosingElement is! ClassElement) {
+ return false;
+ }
+ if (!executableElement.isStatic) {
+ return false;
+ }
+ if (isTypeReference(target)) {
+ return false;
+ }
+ _errorReporter.reportError2(StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, name2, [name2.name]);
+ return true;
+ }
+
+ /**
* This verifies that an 'int' can be assigned to the parameter corresponding to the given
* expression. This is used for prefix and postfix expressions where the argument value is
* implicit.
@@ -13673,24 +14069,6 @@
}
/**
- * Checks to ensure that first type argument to a map literal must be the 'String' type.
- *
- * @param arguments a non-`null`, non-empty [TypeName] node list from the respective
- * [MapLiteral]
- * @return `true` if and only if an error code is generated on the passed node
- * @see CompileTimeErrorCode#INVALID_TYPE_ARGUMENT_FOR_KEY
- */
- bool checkForInvalidTypeArgumentForKey(NodeList<TypeName> arguments) {
- TypeName firstArgument = arguments[0];
- Type2 firstArgumentType = firstArgument.type;
- if (firstArgumentType != null && firstArgumentType != _typeProvider.stringType) {
- _errorReporter.reportError2(CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_FOR_KEY, firstArgument, []);
- return true;
- }
- return false;
- }
-
- /**
* Checks to ensure that the passed [ListLiteral] or [MapLiteral] does not have a type
* parameter as a type argument.
*
@@ -13731,7 +14109,7 @@
}
Type2 listElementType = typeArguments[0].type;
ErrorCode errorCode;
- if (node.modifier != null) {
+ if (node.constKeyword != null) {
errorCode = CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE;
} else {
errorCode = StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE;
@@ -13767,7 +14145,7 @@
Type2 valueType = typeArguments[1].type;
ErrorCode keyErrorCode;
ErrorCode valueErrorCode;
- if (node.modifier != null) {
+ if (node.constKeyword != null) {
keyErrorCode = CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE;
valueErrorCode = CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE;
} else {
@@ -13952,7 +14330,7 @@
* @see StaticWarningCode#NEW_WITH_UNDEFINED_CONSTRUCTOR
*/
bool checkForNewWithUndefinedConstructor(InstanceCreationExpression node) {
- if (node.element != null) {
+ if (node.staticElement != null) {
return false;
}
ConstructorName constructorName = node.constructorName;
@@ -14156,7 +14534,7 @@
* @see CompileTimeErrorCode#NON_CONST_MAP_AS_EXPRESSION_STATEMENT
*/
bool checkForNonConstMapAsExpressionStatement(MapLiteral node) {
- if (node.modifier != null) {
+ if (node.constKeyword != null) {
return false;
}
if (node.typeArguments != null) {
@@ -14578,7 +14956,7 @@
* @see StaticWarningCode#STATIC_ACCESS_TO_INSTANCE_MEMBER
*/
bool checkForStaticAccessToInstanceMember(Expression target, SimpleIdentifier name2) {
- Element element = name2.element;
+ Element element = name2.staticElement;
if (element is! ExecutableElement) {
return false;
}
@@ -14692,7 +15070,7 @@
} else {
errorCode = StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
}
- _errorReporter.reportError2(errorCode, argTypeName, [argTypeName.name, boundType.displayName]);
+ _errorReporter.reportError2(errorCode, argTypeName, [argType.displayName, boundType.displayName]);
foundError = true;
}
}
@@ -14771,6 +15149,33 @@
}
/**
+ * This checks that if the given name is a reference to a static member it is defined in the
+ * enclosing class rather than in a superclass.
+ *
+ * @param name the name to be evaluated
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see StaticTypeWarningCode#UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER
+ */
+ bool checkForUnqualifiedReferenceToNonLocalStaticMember(SimpleIdentifier name2) {
+ Element element = name2.staticElement;
+ if (element == null || element is TypeVariableElement) {
+ return false;
+ }
+ Element enclosingElement = element.enclosingElement;
+ if (enclosingElement is! ClassElement) {
+ return false;
+ }
+ if ((element is MethodElement && !((element as MethodElement)).isStatic) || (element is PropertyAccessorElement && !((element as PropertyAccessorElement)).isStatic)) {
+ return false;
+ }
+ if (identical(enclosingElement, _enclosingClass)) {
+ return false;
+ }
+ _errorReporter.reportError2(StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, name2, [name2.name]);
+ return true;
+ }
+
+ /**
* This verifies the passed operator-method declaration, has correct number of parameters.
*
* This method assumes that the method declaration was tested to be an operator declaration before
@@ -14913,7 +15318,7 @@
*/
VariableElement getVariableElement(Expression expression) {
if (expression is Identifier) {
- Element element = ((expression as Identifier)).element;
+ Element element = ((expression as Identifier)).staticElement;
if (element is VariableElement) {
return element as VariableElement;
}
@@ -14972,6 +15377,20 @@
javaSetAdd(checked, current);
}
}
+ bool isFunctionType(Type2 type) {
+ if (type.isDynamic || identical(type, BottomTypeImpl.instance)) {
+ return true;
+ } else if (type is InterfaceType) {
+ if (identical(type, _typeProvider.functionType)) {
+ return true;
+ }
+ MethodElement callMethod = ((type as InterfaceType)).lookUpMethod(ElementResolver.CALL_METHOD_NAME, _currentLibrary);
+ return callMethod != null;
+ } else if (type is FunctionType || type.isDartCoreFunction) {
+ return true;
+ }
+ return false;
+ }
/**
* @return `true` if the given [ASTNode] is the part of constant constructor
@@ -14998,7 +15417,7 @@
ConstructorDeclaration constructor = n as ConstructorDeclaration;
return constructor.factoryKeyword == null;
}
- if (n is ConstructorFieldInitializer) {
+ if (n is ConstructorInitializer) {
return false;
}
if (n is MethodDeclaration) {
@@ -15010,6 +15429,31 @@
}
/**
+ * Return `true` if the given identifier is in a location where it is allowed to resolve to
+ * a static member of a supertype.
+ *
+ * @param node the node being tested
+ * @return `true` if the given identifier is in a location where it is allowed to resolve to
+ * a static member of a supertype
+ */
+ bool isUnqualifiedReferenceToNonLocalStaticMemberAllowed(SimpleIdentifier node) {
+ if (node.inDeclarationContext()) {
+ return true;
+ }
+ ASTNode parent = node.parent;
+ if (parent is ConstructorName || parent is MethodInvocation || parent is PropertyAccess || parent is SuperConstructorInvocation) {
+ return true;
+ }
+ if (parent is PrefixedIdentifier && identical(((parent as PrefixedIdentifier)).identifier, node)) {
+ return true;
+ }
+ if (parent is Annotation && identical(((parent as Annotation)).constructorName, node)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Return `true` iff the passed [ClassElement] has a concrete implementation of the
* passed accessor name in the superclass chain.
*/
@@ -15096,7 +15540,7 @@
* signature, not initialized, initialized in the field declaration, initialized in the field
* formal, and finally, initialized in the initializers list.
*/
-class INIT_STATE implements Enum<INIT_STATE> {
+class INIT_STATE extends Enum<INIT_STATE> {
static final INIT_STATE NOT_INIT = new INIT_STATE('NOT_INIT', 0);
static final INIT_STATE INIT_IN_DECLARATION = new INIT_STATE('INIT_IN_DECLARATION', 1);
static final INIT_STATE INIT_IN_FIELD_FORMAL = new INIT_STATE('INIT_IN_FIELD_FORMAL', 2);
@@ -15106,16 +15550,7 @@
INIT_IN_DECLARATION,
INIT_IN_FIELD_FORMAL,
INIT_IN_INITIALIZERS];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- INIT_STATE(this.name, this.ordinal);
- int compareTo(INIT_STATE other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ INIT_STATE(String name, int ordinal) : super(name, ordinal);
}
class GeneralizingElementVisitor_11 extends GeneralizingElementVisitor<Object> {
Element target;
@@ -15179,45 +15614,56 @@
*
* @coverage dart.engine.resolver
*/
-class ResolverErrorCode implements Enum<ResolverErrorCode>, ErrorCode {
- static final ResolverErrorCode BREAK_LABEL_ON_SWITCH_MEMBER = new ResolverErrorCode('BREAK_LABEL_ON_SWITCH_MEMBER', 0, ErrorType.COMPILE_TIME_ERROR, "Break label resolves to case or default statement");
- static final ResolverErrorCode CONTINUE_LABEL_ON_SWITCH = new ResolverErrorCode('CONTINUE_LABEL_ON_SWITCH', 1, ErrorType.COMPILE_TIME_ERROR, "A continue label resolves to switch, must be loop or switch member");
- static final ResolverErrorCode MISSING_LIBRARY_DIRECTIVE_WITH_PART = new ResolverErrorCode('MISSING_LIBRARY_DIRECTIVE_WITH_PART', 2, ErrorType.COMPILE_TIME_ERROR, "Libraries that have parts must have a library directive");
+class ResolverErrorCode extends Enum<ResolverErrorCode> implements ErrorCode {
+ static final ResolverErrorCode BREAK_LABEL_ON_SWITCH_MEMBER = new ResolverErrorCode.con1('BREAK_LABEL_ON_SWITCH_MEMBER', 0, ErrorType.COMPILE_TIME_ERROR, "Break label resolves to case or default statement");
+ static final ResolverErrorCode CONTINUE_LABEL_ON_SWITCH = new ResolverErrorCode.con1('CONTINUE_LABEL_ON_SWITCH', 1, ErrorType.COMPILE_TIME_ERROR, "A continue label resolves to switch, must be loop or switch member");
+ static final ResolverErrorCode MISSING_LIBRARY_DIRECTIVE_WITH_PART = new ResolverErrorCode.con1('MISSING_LIBRARY_DIRECTIVE_WITH_PART', 2, ErrorType.COMPILE_TIME_ERROR, "Libraries that have parts must have a library directive");
static final List<ResolverErrorCode> values = [
BREAK_LABEL_ON_SWITCH_MEMBER,
CONTINUE_LABEL_ON_SWITCH,
MISSING_LIBRARY_DIRECTIVE_WITH_PART];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The type of this error.
*/
ErrorType _type;
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction9;
+
+ /**
* Initialize a newly created error code to have the given type and message.
*
* @param type the type of this error
* @param message the message template used to create the message to be displayed for the error
*/
- ResolverErrorCode(this.name, this.ordinal, ErrorType type, String message) {
+ ResolverErrorCode.con1(String name, int ordinal, ErrorType type, String message) : super(name, ordinal) {
this._type = type;
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given type, message and correction.
+ *
+ * @param type the type of this error
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ ResolverErrorCode.con2(String name, int ordinal, ErrorType type, String message, String correction) : super(name, ordinal) {
+ this._type = type;
+ this._message = message;
+ this.correction9 = correction;
+ }
+ String get correction => correction9;
ErrorSeverity get errorSeverity => _type.severity;
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 0f816df..89c7df4 100644
--- a/pkg/analyzer_experimental/lib/src/generated/scanner.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
@@ -135,14 +135,14 @@
*
* @coverage dart.engine.parser
*/
-class ScannerErrorCode implements Enum<ScannerErrorCode>, ErrorCode {
- static final ScannerErrorCode CHARACTER_EXPECTED_AFTER_SLASH = new ScannerErrorCode('CHARACTER_EXPECTED_AFTER_SLASH', 0, "Character expected after slash");
- static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode('ILLEGAL_CHARACTER', 1, "Illegal character %x");
- static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode('MISSING_DIGIT', 2, "Decimal digit expected");
- static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode('MISSING_HEX_DIGIT', 3, "Hexidecimal digit expected");
- static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode('MISSING_QUOTE', 4, "Expected quote (' or \")");
- static final ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = new ScannerErrorCode('UNTERMINATED_MULTI_LINE_COMMENT', 5, "Unterminated multi-line comment");
- static final ScannerErrorCode UNTERMINATED_STRING_LITERAL = new ScannerErrorCode('UNTERMINATED_STRING_LITERAL', 6, "Unterminated string literal");
+class ScannerErrorCode extends Enum<ScannerErrorCode> implements ErrorCode {
+ static final ScannerErrorCode CHARACTER_EXPECTED_AFTER_SLASH = new ScannerErrorCode.con1('CHARACTER_EXPECTED_AFTER_SLASH', 0, "Character expected after slash");
+ static final ScannerErrorCode ILLEGAL_CHARACTER = new ScannerErrorCode.con1('ILLEGAL_CHARACTER', 1, "Illegal character %x");
+ static final ScannerErrorCode MISSING_DIGIT = new ScannerErrorCode.con1('MISSING_DIGIT', 2, "Decimal digit expected");
+ static final ScannerErrorCode MISSING_HEX_DIGIT = new ScannerErrorCode.con1('MISSING_HEX_DIGIT', 3, "Hexidecimal digit expected");
+ static final ScannerErrorCode MISSING_QUOTE = new ScannerErrorCode.con1('MISSING_QUOTE', 4, "Expected quote (' or \")");
+ static final ScannerErrorCode UNTERMINATED_MULTI_LINE_COMMENT = new ScannerErrorCode.con1('UNTERMINATED_MULTI_LINE_COMMENT', 5, "Unterminated multi-line comment");
+ static final ScannerErrorCode UNTERMINATED_STRING_LITERAL = new ScannerErrorCode.con1('UNTERMINATED_STRING_LITERAL', 6, "Unterminated string literal");
static final List<ScannerErrorCode> values = [
CHARACTER_EXPECTED_AFTER_SLASH,
ILLEGAL_CHARACTER,
@@ -152,31 +152,40 @@
UNTERMINATED_MULTI_LINE_COMMENT,
UNTERMINATED_STRING_LITERAL];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
- * The message template used to create the message to be displayed for this error.
+ * The template used to create the message to be displayed for this error.
*/
String _message;
/**
+ * The template used to create the correction to be displayed for this error, or `null` if
+ * there is no correction information for this error.
+ */
+ String correction10;
+
+ /**
* Initialize a newly created error code to have the given message.
*
* @param message the message template used to create the message to be displayed for this error
*/
- ScannerErrorCode(this.name, this.ordinal, String message) {
+ ScannerErrorCode.con1(String name, int ordinal, String message) : super(name, ordinal) {
this._message = message;
}
+
+ /**
+ * Initialize a newly created error code to have the given message and correction.
+ *
+ * @param message the template used to create the message to be displayed for the error
+ * @param correction the template used to create the correction to be displayed for the error
+ */
+ ScannerErrorCode.con2(String name, int ordinal, String message, String correction) : super(name, ordinal) {
+ this._message = message;
+ this.correction10 = correction;
+ }
+ String get correction => correction10;
ErrorSeverity get errorSeverity => ErrorSeverity.ERROR;
String get message => _message;
ErrorType get type => ErrorType.SYNTACTIC_ERROR;
- int compareTo(ScannerErrorCode other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* Instances of the class `TokenWithComment` represent a string token that is preceded by
@@ -209,7 +218,7 @@
*
* @coverage dart.engine.parser
*/
-class Keyword implements Enum<Keyword> {
+class Keyword extends Enum<Keyword> {
static final Keyword ASSERT = new Keyword.con1('ASSERT', 0, "assert");
static final Keyword BREAK = new Keyword.con1('BREAK', 1, "break");
static final Keyword CASE = new Keyword.con1('CASE', 2, "case");
@@ -308,12 +317,6 @@
STATIC,
TYPEDEF];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The lexeme for the keyword.
*/
@@ -358,7 +361,7 @@
* @param syntax the lexeme for the keyword
* @param isPseudoKeyword `true` if this keyword is a pseudo-keyword
*/
- Keyword.con2(this.name, this.ordinal, String syntax, bool isPseudoKeyword) {
+ Keyword.con2(String name, int ordinal, String syntax, bool isPseudoKeyword) : super(name, ordinal) {
this._syntax = syntax;
this._isPseudoKeyword2 = isPseudoKeyword;
}
@@ -377,9 +380,6 @@
* @return `true` if this keyword is a pseudo-keyword
*/
bool get isPseudoKeyword => _isPseudoKeyword2;
- int compareTo(Keyword other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* The abstract class `AbstractScanner` implements a scanner for Dart code. Subclasses are
@@ -830,7 +830,7 @@
return next;
}
}
- int select3(int choice, TokenType yesType, TokenType noType, int offset) {
+ int select2(int choice, TokenType yesType, TokenType noType, int offset) {
int next = advance();
if (next == choice) {
appendToken2(yesType, offset);
@@ -937,7 +937,7 @@
if (!hasDigit) {
appendStringToken(TokenType.INT, getString(start, -2));
if (0x2E == next) {
- return select3(0x2E, TokenType.PERIOD_PERIOD_PERIOD, TokenType.PERIOD_PERIOD, offset - 1);
+ return select2(0x2E, TokenType.PERIOD_PERIOD_PERIOD, TokenType.PERIOD_PERIOD, offset - 1);
}
appendToken2(TokenType.PERIOD, offset - 1);
return bigSwitch(next);
@@ -1046,7 +1046,7 @@
KeywordState state = KeywordState.KEYWORD_STATE;
int start = offset;
while (state != null && 0x61 <= next2 && next2 <= 0x7A) {
- state = state.next((next2 as int));
+ state = state.next(next2 as int);
next2 = advance();
}
if (state == null || state.keyword() == null) {
@@ -1232,7 +1232,10 @@
int tokenizeSingleLineComment(int next) {
while (true) {
next = advance();
- if (0xA == next || 0xD == next || -1 == next) {
+ if (-1 == next) {
+ appendCommentToken(TokenType.SINGLE_LINE_COMMENT, getString(_tokenStart, 0));
+ return next;
+ } else if (0xA == next || 0xD == next) {
appendCommentToken(TokenType.SINGLE_LINE_COMMENT, getString(_tokenStart, -1));
return next;
}
@@ -1800,7 +1803,7 @@
*
* @coverage dart.engine.parser
*/
-class TokenClass implements Enum<TokenClass> {
+class TokenClass extends Enum<TokenClass> {
/**
* A value used to indicate that the token type is not part of any specific class of token.
@@ -1899,19 +1902,13 @@
UNARY_POSTFIX_OPERATOR,
UNARY_PREFIX_OPERATOR];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The precedence of tokens of this class, or `0` if the such tokens do not represent an
* operator.
*/
int _precedence = 0;
TokenClass.con1(String name, int ordinal) : this.con2(name, ordinal, 0);
- TokenClass.con2(this.name, this.ordinal, int precedence) {
+ TokenClass.con2(String name, int ordinal, int precedence) : super(name, ordinal) {
this._precedence = precedence;
}
@@ -1922,9 +1919,6 @@
* @return the precedence of tokens of this class
*/
int get precedence => _precedence;
- int compareTo(TokenClass other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* Instances of the class `KeywordTokenWithComment` implement a keyword token that is preceded
@@ -1958,7 +1952,7 @@
*
* @coverage dart.engine.parser
*/
-class TokenType implements Enum<TokenType> {
+class TokenType extends Enum<TokenType> {
/**
* The type of the token that marks the end of the input.
@@ -2101,12 +2095,6 @@
BACKSLASH,
PERIOD_PERIOD_PERIOD];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The class of the token.
*/
@@ -2118,7 +2106,7 @@
*/
String _lexeme;
TokenType.con1(String name, int ordinal) : this.con2(name, ordinal, TokenClass.NO_CLASS, null);
- TokenType.con2(this.name, this.ordinal, TokenClass tokenClass, String lexeme) {
+ TokenType.con2(String name, int ordinal, TokenClass tokenClass, String lexeme) : super(name, ordinal) {
this._tokenClass = tokenClass == null ? TokenClass.NO_CLASS : tokenClass;
this._lexeme = lexeme;
}
@@ -2228,9 +2216,6 @@
* @return `true` if this token type represents an operator that can be defined by users
*/
bool get 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 {
TokenType_EOF(String name, int ordinal, TokenClass arg0, String arg1) : super.con2(name, ordinal, arg0, arg1);
diff --git a/pkg/analyzer_experimental/lib/src/generated/sdk.dart b/pkg/analyzer_experimental/lib/src/generated/sdk.dart
index 364d40a..2accc54 100644
--- a/pkg/analyzer_experimental/lib/src/generated/sdk.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/sdk.dart
@@ -1,8 +1,6 @@
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.sdk;
-import 'java_core.dart';
-import 'java_engine.dart';
import 'source.dart' show ContentCache, Source, UriKind;
import 'engine.dart' show AnalysisContext;
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
index 71f1e68..47d9a8f 100644
--- a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
@@ -1,10 +1,8 @@
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.sdk.io;
-import 'dart:io';
import 'java_core.dart';
import 'java_io.dart';
-import 'java_engine.dart';
import 'java_engine_io.dart';
import 'source_io.dart';
import 'error.dart';
@@ -115,6 +113,16 @@
static String _LIBRARIES_FILE = "libraries.dart";
/**
+ * The name of the pub executable on windows.
+ */
+ static String _PUB_EXECUTABLE_NAME_WIN = "pub.bat";
+
+ /**
+ * The name of the pub executable on non-windows operating systems.
+ */
+ static String _PUB_EXECUTABLE_NAME = "pub";
+
+ /**
* The name of the file within the SDK directory that contains the revision number of the SDK.
*/
static String _REVISION_FILE_NAME = "revision";
@@ -253,6 +261,17 @@
* @return the directory that contains the libraries
*/
JavaFile get libraryDirectory => new JavaFile.relative(_sdkDirectory, _LIB_DIRECTORY_NAME);
+
+ /**
+ * Return the file containing the Pub executable, or `null` if it does not exist.
+ *
+ * @return the file containing the Pub executable
+ */
+ JavaFile get pubExecutable {
+ String pubBinaryName = OSUtilities.isWindows() ? _PUB_EXECUTABLE_NAME_WIN : _PUB_EXECUTABLE_NAME;
+ JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), pubBinaryName);
+ return file.exists() ? file : null;
+ }
List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries;
SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri);
@@ -294,7 +313,7 @@
JavaFile get vmExecutable {
{
if (_vmExecutable == null) {
- JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), binaryName);
+ JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirectory, _BIN_DIRECTORY_NAME), vmBinaryName);
if (file.exists()) {
_vmExecutable = file;
}
@@ -332,19 +351,6 @@
}
/**
- * Return the name of the file containing the VM executable.
- *
- * @return the name of the file containing the VM executable
- */
- String get binaryName {
- if (OSUtilities.isWindows()) {
- return _VM_EXECUTABLE_NAME_WIN;
- } else {
- return _VM_EXECUTABLE_NAME;
- }
- }
-
- /**
* Return the name of the file containing the Dartium executable.
*
* @return the name of the file containing the Dartium executable
@@ -360,6 +366,19 @@
}
/**
+ * Return the name of the file containing the VM executable.
+ *
+ * @return the name of the file containing the VM executable
+ */
+ String get vmBinaryName {
+ if (OSUtilities.isWindows()) {
+ return _VM_EXECUTABLE_NAME_WIN;
+ } else {
+ return _VM_EXECUTABLE_NAME;
+ }
+ }
+
+ /**
* Read all of the configuration files to initialize the library maps.
*/
void initializeLibraryMap() {
diff --git a/pkg/analyzer_experimental/lib/src/generated/source.dart b/pkg/analyzer_experimental/lib/src/generated/source.dart
index cf901a3..128cf1f 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source.dart
@@ -135,7 +135,7 @@
* @return the source representing the contained URI
*/
Source resolveUri(Source containingSource, String containedUri) {
- if (containedUri == null) {
+ if (containedUri == null || containedUri.isEmpty) {
return null;
}
try {
@@ -422,7 +422,7 @@
*
* @coverage dart.engine.source
*/
-class SourceKind implements Enum<SourceKind> {
+class SourceKind extends Enum<SourceKind> {
/**
* A source containing HTML. The HTML might or might not contain Dart scripts.
@@ -447,16 +447,7 @@
*/
static final SourceKind UNKNOWN = new SourceKind('UNKNOWN', 3);
static final List<SourceKind> values = [HTML, LIBRARY, PART, UNKNOWN];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- SourceKind(this.name, this.ordinal);
- int compareTo(SourceKind other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ SourceKind(String name, int ordinal) : super(name, ordinal);
}
/**
* The enumeration `UriKind` defines the different kinds of URI's that are known to the
@@ -464,7 +455,7 @@
*
* @coverage dart.engine.source
*/
-class UriKind implements Enum<UriKind> {
+class UriKind extends Enum<UriKind> {
/**
* A 'dart:' URI.
@@ -482,12 +473,6 @@
static final UriKind PACKAGE_URI = new UriKind('PACKAGE_URI', 2, 0x70);
static final List<UriKind> values = [DART_URI, FILE_URI, PACKAGE_URI];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* The single character encoding used to identify this kind of URI.
*/
@@ -498,7 +483,7 @@
*
* @param encoding the single character encoding used to identify this kind of URI.
*/
- UriKind(this.name, this.ordinal, int encoding) {
+ UriKind(String name, int ordinal, int encoding) : super(name, ordinal) {
this._encoding = encoding;
}
@@ -529,9 +514,6 @@
* @return the single character encoding used to identify this kind of URI
*/
int get encoding => _encoding;
- int compareTo(UriKind other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
}
/**
* A source range defines an [Element]'s source coordinates relative to its [Source].
diff --git a/pkg/analyzer_experimental/lib/src/generated/source_io.dart b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
index 23f6c1b..fd374b5 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
@@ -2,10 +2,8 @@
// significant change. Please see the README file for more information.
library engine.source.io;
import 'source.dart';
-import 'dart:io';
import 'java_core.dart';
import 'java_io.dart';
-import 'sdk.dart' show DartSdk;
import 'engine.dart' show AnalysisContext, AnalysisEngine;
export 'source.dart';
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart b/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
index 9e33a1a..4dd72cb 100644
--- a/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
@@ -16,7 +16,7 @@
* @return the value of the element at the given index
* @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
*/
- static bool get(int array, Enum<Object> index) => get2(array, index.ordinal);
+ static bool get(int array, Enum index) => get2(array, index.ordinal);
/**
* Return the value of the element at the given index.
@@ -40,7 +40,7 @@
* @return the updated value of the array
* @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
*/
- static int set(int array, Enum<Object> index, bool value) => set2(array, index.ordinal, value);
+ static int set(int array, Enum index, bool value) => set2(array, index.ordinal, value);
/**
* Set the value of the element at the given index to the given value.
diff --git a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
index c7879f6..726e294 100644
--- a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
@@ -9,18 +9,12 @@
*
* @coverage dart.engine.utilities
*/
-class ParameterKind implements Enum<ParameterKind> {
+class ParameterKind extends Enum<ParameterKind> {
static final ParameterKind REQUIRED = new ParameterKind('REQUIRED', 0, false);
static final ParameterKind POSITIONAL = new ParameterKind('POSITIONAL', 1, true);
static final ParameterKind NAMED = new ParameterKind('NAMED', 2, true);
static final List<ParameterKind> values = [REQUIRED, POSITIONAL, NAMED];
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
-
/**
* A flag indicating whether this is an optional parameter.
*/
@@ -31,7 +25,7 @@
*
* @param isOptional `true` if this is an optional parameter
*/
- ParameterKind(this.name, this.ordinal, bool isOptional) {
+ ParameterKind(String name, int ordinal, bool isOptional) : super(name, ordinal) {
this._isOptional2 = isOptional;
}
@@ -41,7 +35,4 @@
* @return `true` if this is an optional parameter
*/
bool get 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/lib/src/services/formatter.dart b/pkg/analyzer_experimental/lib/src/services/formatter.dart
index 51141dd..1ea1b36 100644
--- a/pkg/analyzer_experimental/lib/src/services/formatter.dart
+++ b/pkg/analyzer_experimental/lib/src/services/formatter.dart
@@ -4,7 +4,7 @@
library formatter;
-import 'package:analyzer_experimental/src/services/formatter_impl.dart';
+//import 'package:analyzer_experimental/src/services/formatter_impl.dart';
//export 'package:analyzer_experimental/src/services/formatter_impl.dart'
// show CodeFormatter;
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart b/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
index 4a17d67..ce7da334 100644
--- a/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
+++ b/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
@@ -452,7 +452,7 @@
}
visitFieldDeclaration(FieldDeclaration node) {
- modifier(node.keyword);
+ modifier(node.staticKeyword);
visit(node.fields);
token(node.semicolon);
}
@@ -671,7 +671,7 @@
}
visitListLiteral(ListLiteral node) {
- modifier(node.modifier);
+ modifier(node.constKeyword);
visit(node.typeArguments);
token(node.leftBracket);
visitNodes(node.elements, separatedBy: commaSeperator);
@@ -679,7 +679,7 @@
}
visitMapLiteral(MapLiteral node) {
- modifier(node.modifier);
+ modifier(node.constKeyword);
visitNode(node.typeArguments, followedBy: space);
token(node.leftBracket);
visitNodes(node.entries, separatedBy: commaSeperator);
@@ -906,7 +906,7 @@
visit(node.body);
visitNodes(node.catchClauses, precededBy: space, separatedBy: space);
token(node.finallyKeyword, precededBy: space, followedBy: space);
- visit(node.finallyClause);
+ visit(node.finallyBlock);
}
visitTypeArgumentList(TypeArgumentList node) {
diff --git a/pkg/analyzer_experimental/lib/src/string_source.dart b/pkg/analyzer_experimental/lib/src/string_source.dart
index b473365..ab21809 100644
--- a/pkg/analyzer_experimental/lib/src/string_source.dart
+++ b/pkg/analyzer_experimental/lib/src/string_source.dart
@@ -15,26 +15,31 @@
StringSource(this._contents, this.fullName)
: modificationStamp = new DateTime.now().millisecondsSinceEpoch;
- bool operator==(Object object) => object is StringSource &&
- object._contents == _contents && object._name == _name;
+ bool operator==(Object object) {
+ if (object is StringSource) {
+ StringSource ssObject = object;
+ return ssObject._contents == _contents && ssObject.fullName == fullName;
+ }
+ return false;
+ }
bool exists() => true;
void getContents(Source_ContentReceiver receiver) =>
receiver.accept2(_contents, modificationStamp);
- String get encoding => throw UnsupportedError("StringSource doesn't support "
+ String get encoding => throw new UnsupportedError("StringSource doesn't support "
"encoding.");
String get shortName => fullName;
- String get uriKind => throw UnsupportedError("StringSource doesn't support "
+ UriKind get uriKind => throw new UnsupportedError("StringSource doesn't support "
"uriKind.");
- int get hashCode => _contents.hashCode ^ _name.hashCode;
+ int get hashCode => _contents.hashCode ^ fullName.hashCode;
bool get isInSystemLibrary => false;
- Source resolveRelative(Uri relativeUri) => throw UnsupportedError(
+ Source resolveRelative(Uri relativeUri) => throw new UnsupportedError(
"StringSource doesn't support resolveRelative.");
}
diff --git a/pkg/analyzer_experimental/test/generated/ast_test.dart b/pkg/analyzer_experimental/test/generated/ast_test.dart
index a839e84..06dcee9 100644
--- a/pkg/analyzer_experimental/test/generated/ast_test.dart
+++ b/pkg/analyzer_experimental/test/generated/ast_test.dart
@@ -1,12 +1,8 @@
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.ast_test;
-import 'dart:collection';
import 'package:analyzer_experimental/src/generated/java_core.dart';
-import 'package:analyzer_experimental/src/generated/java_engine.dart';
import 'package:analyzer_experimental/src/generated/java_junit.dart';
-import 'package:analyzer_experimental/src/generated/source.dart';
-import 'package:analyzer_experimental/src/generated/error.dart';
import 'package:analyzer_experimental/src/generated/scanner.dart';
import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:analyzer_experimental/src/generated/utilities_dart.dart';
@@ -427,11 +423,11 @@
* @param element the element defining the type represented by the type name
* @return the type name that was created
*/
- static TypeName typeName(ClassElement element2, List<TypeName> arguments) {
- SimpleIdentifier name = identifier3(element2.name);
- name.element = element2;
+ static TypeName typeName(ClassElement element, List<TypeName> arguments) {
+ SimpleIdentifier name = identifier3(element.name);
+ name.staticElement = element;
TypeName typeName = typeName3(name, arguments);
- typeName.type = element2.type;
+ typeName.type = element.type;
return typeName;
}
static TypeName typeName3(Identifier name, List<TypeName> arguments) {
@@ -717,7 +713,7 @@
});
}
}
-class AssignmentKind implements Enum<AssignmentKind> {
+class AssignmentKind extends Enum<AssignmentKind> {
static final AssignmentKind BINARY = new AssignmentKind('BINARY', 0);
static final AssignmentKind COMPOUND_LEFT = new AssignmentKind('COMPOUND_LEFT', 1);
static final AssignmentKind COMPOUND_RIGHT = new AssignmentKind('COMPOUND_RIGHT', 2);
@@ -739,18 +735,9 @@
SIMPLE_LEFT,
SIMPLE_RIGHT,
NONE];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- AssignmentKind(this.name, this.ordinal);
- int compareTo(AssignmentKind other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ AssignmentKind(String name, int ordinal) : super(name, ordinal);
}
-class WrapperKind implements Enum<WrapperKind> {
+class WrapperKind extends Enum<WrapperKind> {
static final WrapperKind PREFIXED_LEFT = new WrapperKind('PREFIXED_LEFT', 0);
static final WrapperKind PREFIXED_RIGHT = new WrapperKind('PREFIXED_RIGHT', 1);
static final WrapperKind PROPERTY_LEFT = new WrapperKind('PROPERTY_LEFT', 2);
@@ -762,16 +749,7 @@
PROPERTY_LEFT,
PROPERTY_RIGHT,
NONE];
-
- /// The name of this enum constant, as declared in the enum declaration.
- final String name;
-
- /// The position in the enum declaration.
- final int ordinal;
- WrapperKind(this.name, this.ordinal);
- int compareTo(WrapperKind other) => ordinal - other.ordinal;
- int get hashCode => ordinal;
- String toString() => name;
+ WrapperKind(String name, int ordinal) : super(name, ordinal);
}
class BreadthFirstVisitorTest extends ParserTestCase {
void testIt() {
@@ -854,27 +832,27 @@
void test_binary_bitAnd() {
Object value = getConstantValue("74 & 42");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(74 & 42, ((value as int)));
+ JUnitTestCase.assertEquals(74 & 42, value as int);
}
void test_binary_bitOr() {
Object value = getConstantValue("74 | 42");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(74 | 42, ((value as int)));
+ JUnitTestCase.assertEquals(74 | 42, value as int);
}
void test_binary_bitXor() {
Object value = getConstantValue("74 ^ 42");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(74 ^ 42, ((value as int)));
+ JUnitTestCase.assertEquals(74 ^ 42, value as int);
}
void test_binary_divide_double() {
Object value = getConstantValue("3.2 / 2.3");
EngineTestCase.assertInstanceOf(double, value);
- JUnitTestCase.assertEquals(3.2 / 2.3, ((value as double)));
+ JUnitTestCase.assertEquals(3.2 / 2.3, value as double);
}
void test_binary_divide_integer() {
Object value = getConstantValue("3 / 2");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(1, ((value as int)));
+ JUnitTestCase.assertEquals(1, value as int);
}
void test_binary_equal_boolean() {
Object value = getConstantValue("true == false");
@@ -907,7 +885,7 @@
void test_binary_leftShift() {
Object value = getConstantValue("16 << 2");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(64, ((value as int)));
+ JUnitTestCase.assertEquals(64, value as int);
}
void test_binary_lessThan() {
Object value = getConstantValue("2 < 3");
@@ -928,12 +906,12 @@
void test_binary_minus_double() {
Object value = getConstantValue("3.2 - 2.3");
EngineTestCase.assertInstanceOf(double, value);
- JUnitTestCase.assertEquals(3.2 - 2.3, ((value as double)));
+ JUnitTestCase.assertEquals(3.2 - 2.3, value as double);
}
void test_binary_minus_integer() {
Object value = getConstantValue("3 - 2");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(1, ((value as int)));
+ JUnitTestCase.assertEquals(1, value as int);
}
void test_binary_notEqual_boolean() {
Object value = getConstantValue("true != false");
@@ -958,47 +936,47 @@
void test_binary_plus_double() {
Object value = getConstantValue("2.3 + 3.2");
EngineTestCase.assertInstanceOf(double, value);
- JUnitTestCase.assertEquals(2.3 + 3.2, ((value as double)));
+ JUnitTestCase.assertEquals(2.3 + 3.2, value as double);
}
void test_binary_plus_integer() {
Object value = getConstantValue("2 + 3");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(5, ((value as int)));
+ JUnitTestCase.assertEquals(5, value as int);
}
void test_binary_remainder_double() {
Object value = getConstantValue("3.2 % 2.3");
EngineTestCase.assertInstanceOf(double, value);
- JUnitTestCase.assertEquals(3.2 % 2.3, ((value as double)));
+ JUnitTestCase.assertEquals(3.2 % 2.3, value as double);
}
void test_binary_remainder_integer() {
Object value = getConstantValue("8 % 3");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(2, ((value as int)));
+ JUnitTestCase.assertEquals(2, value as int);
}
void test_binary_rightShift() {
Object value = getConstantValue("64 >> 2");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(16, ((value as int)));
+ JUnitTestCase.assertEquals(16, value as int);
}
void test_binary_times_double() {
Object value = getConstantValue("2.3 * 3.2");
EngineTestCase.assertInstanceOf(double, value);
- JUnitTestCase.assertEquals(2.3 * 3.2, ((value as double)));
+ JUnitTestCase.assertEquals(2.3 * 3.2, value as double);
}
void test_binary_times_integer() {
Object value = getConstantValue("2 * 3");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(6, ((value as int)));
+ JUnitTestCase.assertEquals(6, value as int);
}
void test_binary_truncatingDivide_double() {
Object value = getConstantValue("3.2 ~/ 2.3");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(1, ((value as int)));
+ JUnitTestCase.assertEquals(1, value as int);
}
void test_binary_truncatingDivide_integer() {
Object value = getConstantValue("10 ~/ 3");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(3, ((value as int)));
+ JUnitTestCase.assertEquals(3, value as int);
}
void test_literal_boolean_false() {
Object value = getConstantValue("false");
@@ -1011,7 +989,7 @@
void test_literal_list() {
Object value = getConstantValue("['a', 'b', 'c']");
EngineTestCase.assertInstanceOf(List, value);
- List<Object> list = value as List<Object>;
+ List list = value as List;
JUnitTestCase.assertEquals(3, list.length);
JUnitTestCase.assertEquals("a", list[0]);
JUnitTestCase.assertEquals("b", list[1]);
@@ -1020,7 +998,7 @@
void test_literal_map() {
Object value = getConstantValue("{'a' : 'm', 'b' : 'n', 'c' : 'o'}");
EngineTestCase.assertInstanceOf(Map, value);
- Map<Object, Object> map = value as Map<Object, Object>;
+ Map map = value as Map;
JUnitTestCase.assertEquals(3, map.length);
JUnitTestCase.assertEquals("m", map["a"]);
JUnitTestCase.assertEquals("n", map["b"]);
@@ -1033,12 +1011,12 @@
void test_literal_number_double() {
Object value = getConstantValue("3.45");
EngineTestCase.assertInstanceOf(double, value);
- JUnitTestCase.assertEquals(3.45, ((value as double)));
+ JUnitTestCase.assertEquals(3.45, value as double);
}
void test_literal_number_integer() {
Object value = getConstantValue("42");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(42, ((value as int)));
+ JUnitTestCase.assertEquals(42, value as int);
}
void test_literal_string_adjacent() {
Object value = getConstantValue("'abc' 'def'");
@@ -1063,7 +1041,7 @@
void test_unary_bitNot() {
Object value = getConstantValue("~42");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(~42, ((value as int)));
+ JUnitTestCase.assertEquals(~42, value as int);
}
void test_unary_logicalNot() {
Object value = getConstantValue("!true");
@@ -1072,12 +1050,12 @@
void test_unary_negated_double() {
Object value = getConstantValue("-42.3");
EngineTestCase.assertInstanceOf(double, value);
- JUnitTestCase.assertEquals(-42.3, ((value as double)));
+ JUnitTestCase.assertEquals(-42.3, value as double);
}
void test_unary_negated_integer() {
Object value = getConstantValue("-42");
EngineTestCase.assertInstanceOf(int, value);
- JUnitTestCase.assertEquals(-42, ((value as int)));
+ JUnitTestCase.assertEquals(-42, value as int);
}
Object getConstantValue(String source) => ParserTestCase.parseExpression(source, []).accept(new ConstantEvaluator());
static dartSuite() {
@@ -1648,10 +1626,10 @@
ASTFactory.positionalFormalParameter(ASTFactory.simpleFormalParameter3("d"), ASTFactory.integer(4))]));
}
void test_visitForStatement_c() {
- assertSource("for (; c;) {}", ASTFactory.forStatement((null as Expression), ASTFactory.identifier3("c"), null, ASTFactory.block([])));
+ assertSource("for (; c;) {}", ASTFactory.forStatement(null as Expression, ASTFactory.identifier3("c"), null, ASTFactory.block([])));
}
void test_visitForStatement_cu() {
- assertSource("for (; c; u) {}", ASTFactory.forStatement((null as Expression), ASTFactory.identifier3("c"), ASTFactory.list([(ASTFactory.identifier3("u") as Expression)]), ASTFactory.block([])));
+ assertSource("for (; c; u) {}", ASTFactory.forStatement(null as Expression, ASTFactory.identifier3("c"), ASTFactory.list([(ASTFactory.identifier3("u") as Expression)]), ASTFactory.block([])));
}
void test_visitForStatement_e() {
assertSource("for (e;;) {}", ASTFactory.forStatement(ASTFactory.identifier3("e"), null, null, ASTFactory.block([])));
@@ -1678,7 +1656,7 @@
assertSource("for (var i;; u) {}", ASTFactory.forStatement2(ASTFactory.variableDeclarationList2(Keyword.VAR, [ASTFactory.variableDeclaration("i")]), null, ASTFactory.list([(ASTFactory.identifier3("u") as Expression)]), ASTFactory.block([])));
}
void test_visitForStatement_u() {
- assertSource("for (;; u) {}", ASTFactory.forStatement((null as Expression), null, ASTFactory.list([(ASTFactory.identifier3("u") as Expression)]), ASTFactory.block([])));
+ assertSource("for (;; u) {}", ASTFactory.forStatement(null as Expression, null, ASTFactory.list([(ASTFactory.identifier3("u") as Expression)]), ASTFactory.block([])));
}
void test_visitFunctionDeclaration_getter() {
assertSource("get f() {}", ASTFactory.functionDeclaration(null, Keyword.GET, "f", ASTFactory.functionExpression()));
diff --git a/pkg/analyzer_experimental/test/generated/element_test.dart b/pkg/analyzer_experimental/test/generated/element_test.dart
index c5d24f1..3619510 100644
--- a/pkg/analyzer_experimental/test/generated/element_test.dart
+++ b/pkg/analyzer_experimental/test/generated/element_test.dart
@@ -1,22 +1,16 @@
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.element_test;
-import 'dart:collection';
-import 'dart:io';
import 'package:analyzer_experimental/src/generated/java_core.dart';
-import 'package:analyzer_experimental/src/generated/java_engine.dart';
import 'package:analyzer_experimental/src/generated/java_engine_io.dart';
import 'package:analyzer_experimental/src/generated/java_junit.dart';
import 'package:analyzer_experimental/src/generated/source_io.dart';
-import 'package:analyzer_experimental/src/generated/error.dart';
-import 'package:analyzer_experimental/src/generated/scanner.dart';
import 'package:analyzer_experimental/src/generated/utilities_dart.dart';
import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:analyzer_experimental/src/generated/element.dart';
import 'package:analyzer_experimental/src/generated/engine.dart' show AnalysisContext, AnalysisContextImpl;
import 'package:unittest/unittest.dart' as _ut;
import 'test_support.dart';
-import 'scanner_test.dart' show TokenFactory;
import 'ast_test.dart' show ASTFactory;
import 'resolver_test.dart' show TestTypeProvider;
class ElementLocationImplTest extends EngineTestCase {
@@ -1619,6 +1613,16 @@
}
}
class TypeVariableTypeImplTest extends EngineTestCase {
+ void fail_isMoreSpecificThan_typeArguments_object() {
+ TypeVariableElementImpl element = new TypeVariableElementImpl(ASTFactory.identifier3("E"));
+ TypeVariableTypeImpl type = new TypeVariableTypeImpl(element);
+ JUnitTestCase.assertTrue(type.isMoreSpecificThan(ElementFactory.object.type));
+ }
+ void fail_isMoreSpecificThan_typeArguments_self() {
+ TypeVariableElementImpl element = new TypeVariableElementImpl(ASTFactory.identifier3("E"));
+ TypeVariableTypeImpl type = new TypeVariableTypeImpl(element);
+ JUnitTestCase.assertTrue(type.isMoreSpecificThan(type));
+ }
void test_creation() {
JUnitTestCase.assertNotNull(new TypeVariableTypeImpl(new TypeVariableElementImpl(ASTFactory.identifier3("E"))));
}
@@ -1627,6 +1631,13 @@
TypeVariableTypeImpl type = new TypeVariableTypeImpl(element);
JUnitTestCase.assertEquals(element, type.element);
}
+ void test_isMoreSpecificThan_typeArguments_upperBound() {
+ ClassElementImpl classS = ElementFactory.classElement2("A", []);
+ TypeVariableElementImpl typeVarT = new TypeVariableElementImpl(ASTFactory.identifier3("T"));
+ typeVarT.bound = classS.type;
+ TypeVariableTypeImpl typeVarTypeT = new TypeVariableTypeImpl(typeVarT);
+ JUnitTestCase.assertTrue(typeVarTypeT.isMoreSpecificThan(classS.type));
+ }
void test_substitute_equal() {
TypeVariableElementImpl element = new TypeVariableElementImpl(ASTFactory.identifier3("E"));
TypeVariableTypeImpl type = new TypeVariableTypeImpl(element);
@@ -1650,6 +1661,10 @@
final __test = new TypeVariableTypeImplTest();
runJUnitTest(__test, __test.test_getElement);
});
+ _ut.test('test_isMoreSpecificThan_typeArguments_upperBound', () {
+ final __test = new TypeVariableTypeImplTest();
+ runJUnitTest(__test, __test.test_isMoreSpecificThan_typeArguments_upperBound);
+ });
_ut.test('test_substitute_equal', () {
final __test = new TypeVariableTypeImplTest();
runJUnitTest(__test, __test.test_substitute_equal);
@@ -1803,7 +1818,7 @@
static FunctionElementImpl functionElement7(String functionName, List<ClassElement> normalParameters, List<String> names, List<ClassElement> namedParameters) => functionElement4(functionName, null, normalParameters, names, namedParameters);
static ClassElementImpl get object {
if (_objectElement == null) {
- _objectElement = classElement("Object", (null as InterfaceType), []);
+ _objectElement = classElement("Object", null as InterfaceType, []);
}
return _objectElement;
}
@@ -2353,9 +2368,18 @@
type.hashCode;
}
void test_hashCode_noElement() {
- FunctionTypeImpl type = new FunctionTypeImpl.con1((null as ExecutableElement));
+ FunctionTypeImpl type = new FunctionTypeImpl.con1(null as ExecutableElement);
type.hashCode;
}
+ void test_isAssignableTo_normalAndPositionalArgs() {
+ 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));
+ JUnitTestCase.assertTrue(t.isAssignableTo(s));
+ JUnitTestCase.assertFalse(s.isAssignableTo(t));
+ }
void test_isSubtypeOf_baseCase_classFunction() {
ClassElementImpl functionElement = ElementFactory.classElement2("Function", []);
InterfaceTypeImpl functionType = new InterfaceTypeImpl_21(functionElement);
@@ -2679,6 +2703,10 @@
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_hashCode_noElement);
});
+ _ut.test('test_isAssignableTo_normalAndPositionalArgs', () {
+ final __test = new FunctionTypeImplTest();
+ runJUnitTest(__test, __test.test_isAssignableTo_normalAndPositionalArgs);
+ });
_ut.test('test_isSubtypeOf_Object', () {
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_Object);
diff --git a/pkg/analyzer_experimental/test/generated/parser_test.dart b/pkg/analyzer_experimental/test/generated/parser_test.dart
index 077e787..c4b11b8 100644
--- a/pkg/analyzer_experimental/test/generated/parser_test.dart
+++ b/pkg/analyzer_experimental/test/generated/parser_test.dart
@@ -1,11 +1,8 @@
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.parser_test;
-import 'dart:collection';
import 'package:analyzer_experimental/src/generated/java_core.dart';
-import 'package:analyzer_experimental/src/generated/java_engine.dart';
import 'package:analyzer_experimental/src/generated/java_junit.dart';
-import 'package:analyzer_experimental/src/generated/source.dart';
import 'package:analyzer_experimental/src/generated/error.dart';
import 'package:analyzer_experimental/src/generated/scanner.dart';
import 'package:analyzer_experimental/src/generated/ast.dart';
@@ -676,7 +673,7 @@
FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "p.A f;");
JUnitTestCase.assertNull(field.documentationComment);
EngineTestCase.assertSize(0, field.metadata);
- JUnitTestCase.assertNull(field.keyword);
+ JUnitTestCase.assertNull(field.staticKeyword);
VariableDeclarationList list = field.fields;
JUnitTestCase.assertNotNull(list);
NodeList<VariableDeclaration> variables = list.variables;
@@ -688,7 +685,7 @@
FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "var get;");
JUnitTestCase.assertNull(field.documentationComment);
EngineTestCase.assertSize(0, field.metadata);
- JUnitTestCase.assertNull(field.keyword);
+ JUnitTestCase.assertNull(field.staticKeyword);
VariableDeclarationList list = field.fields;
JUnitTestCase.assertNotNull(list);
NodeList<VariableDeclaration> variables = list.variables;
@@ -700,7 +697,7 @@
FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "var operator;");
JUnitTestCase.assertNull(field.documentationComment);
EngineTestCase.assertSize(0, field.metadata);
- JUnitTestCase.assertNull(field.keyword);
+ JUnitTestCase.assertNull(field.staticKeyword);
VariableDeclarationList list = field.fields;
JUnitTestCase.assertNotNull(list);
NodeList<VariableDeclaration> variables = list.variables;
@@ -712,7 +709,7 @@
FieldDeclaration field = ParserTestCase.parse("parseClassMember", <Object> ["C"], "var set;");
JUnitTestCase.assertNull(field.documentationComment);
EngineTestCase.assertSize(0, field.metadata);
- JUnitTestCase.assertNull(field.keyword);
+ JUnitTestCase.assertNull(field.staticKeyword);
VariableDeclarationList list = field.fields;
JUnitTestCase.assertNotNull(list);
NodeList<VariableDeclaration> variables = list.variables;
@@ -1424,7 +1421,7 @@
}
void test_parseConstExpression_listLiteral_typed() {
ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const <A> []", []);
- JUnitTestCase.assertNotNull(literal.modifier);
+ JUnitTestCase.assertNotNull(literal.constKeyword);
JUnitTestCase.assertNotNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(0, literal.elements);
@@ -1432,7 +1429,7 @@
}
void test_parseConstExpression_listLiteral_untyped() {
ListLiteral literal = ParserTestCase.parse5("parseConstExpression", "const []", []);
- JUnitTestCase.assertNotNull(literal.modifier);
+ JUnitTestCase.assertNotNull(literal.constKeyword);
JUnitTestCase.assertNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(0, literal.elements);
@@ -2346,7 +2343,7 @@
JUnitTestCase.assertNull(fields.keyword);
JUnitTestCase.assertEquals(type, fields.type);
EngineTestCase.assertSize(3, fields.variables);
- JUnitTestCase.assertEquals(staticKeyword, declaration.keyword);
+ JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword);
JUnitTestCase.assertNotNull(declaration.semicolon);
}
void test_parseInitializedIdentifierList_var() {
@@ -2364,7 +2361,7 @@
JUnitTestCase.assertEquals(varKeyword, fields.keyword);
JUnitTestCase.assertNull(fields.type);
EngineTestCase.assertSize(3, fields.variables);
- JUnitTestCase.assertEquals(staticKeyword, declaration.keyword);
+ JUnitTestCase.assertEquals(staticKeyword, declaration.staticKeyword);
JUnitTestCase.assertNotNull(declaration.semicolon);
}
void test_parseInstanceCreationExpression_qualifiedType() {
@@ -2431,7 +2428,7 @@
Token token = TokenFactory.token(Keyword.CONST);
TypeArgumentList typeArguments = null;
ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [token, typeArguments], "[]");
- JUnitTestCase.assertEquals(token, literal.modifier);
+ JUnitTestCase.assertEquals(token, literal.constKeyword);
JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(0, literal.elements);
@@ -2441,7 +2438,7 @@
Token token = TokenFactory.token(Keyword.CONST);
TypeArgumentList typeArguments = null;
ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [token, typeArguments], "[ ]");
- JUnitTestCase.assertEquals(token, literal.modifier);
+ JUnitTestCase.assertEquals(token, literal.constKeyword);
JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(0, literal.elements);
@@ -2449,7 +2446,7 @@
}
void test_parseListLiteral_multiple() {
ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [null, null], "[1, 2, 3]");
- JUnitTestCase.assertNull(literal.modifier);
+ JUnitTestCase.assertNull(literal.constKeyword);
JUnitTestCase.assertNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(3, literal.elements);
@@ -2457,7 +2454,7 @@
}
void test_parseListLiteral_single() {
ListLiteral literal = ParserTestCase.parse("parseListLiteral", <Object> [null, null], "[1]");
- JUnitTestCase.assertNull(literal.modifier);
+ JUnitTestCase.assertNull(literal.constKeyword);
JUnitTestCase.assertNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(1, literal.elements);
@@ -2465,7 +2462,7 @@
}
void test_parseListOrMapLiteral_list_noType() {
ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "[1]");
- JUnitTestCase.assertNull(literal.modifier);
+ JUnitTestCase.assertNull(literal.constKeyword);
JUnitTestCase.assertNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(1, literal.elements);
@@ -2473,7 +2470,7 @@
}
void test_parseListOrMapLiteral_list_type() {
ListLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<int> [1]");
- JUnitTestCase.assertNull(literal.modifier);
+ JUnitTestCase.assertNull(literal.constKeyword);
JUnitTestCase.assertNotNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(1, literal.elements);
@@ -2481,7 +2478,7 @@
}
void test_parseListOrMapLiteral_map_noType() {
MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "{'1' : 1}");
- JUnitTestCase.assertNull(literal.modifier);
+ JUnitTestCase.assertNull(literal.constKeyword);
JUnitTestCase.assertNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(1, literal.entries);
@@ -2489,7 +2486,7 @@
}
void test_parseListOrMapLiteral_map_type() {
MapLiteral literal = ParserTestCase.parse("parseListOrMapLiteral", <Object> [null], "<String, int> {'1' : 1}");
- JUnitTestCase.assertNull(literal.modifier);
+ JUnitTestCase.assertNull(literal.constKeyword);
JUnitTestCase.assertNotNull(literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(1, literal.entries);
@@ -2515,7 +2512,7 @@
ASTFactory.typeName4("String", []),
ASTFactory.typeName4("int", [])]);
MapLiteral literal = ParserTestCase.parse("parseMapLiteral", <Object> [token, typeArguments], "{}");
- JUnitTestCase.assertEquals(token, literal.modifier);
+ JUnitTestCase.assertEquals(token, literal.constKeyword);
JUnitTestCase.assertEquals(typeArguments, literal.typeArguments);
JUnitTestCase.assertNotNull(literal.leftBracket);
EngineTestCase.assertSize(0, literal.entries);
@@ -3254,7 +3251,7 @@
JUnitTestCase.assertNull(clause.stackTraceParameter);
JUnitTestCase.assertNotNull(clause.body);
JUnitTestCase.assertNull(statement.finallyKeyword);
- JUnitTestCase.assertNull(statement.finallyClause);
+ JUnitTestCase.assertNull(statement.finallyBlock);
}
void test_parseTryStatement_catch_finally() {
TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} catch (e, s) {} finally {}", []);
@@ -3271,7 +3268,7 @@
JUnitTestCase.assertNotNull(clause.stackTraceParameter);
JUnitTestCase.assertNotNull(clause.body);
JUnitTestCase.assertNotNull(statement.finallyKeyword);
- JUnitTestCase.assertNotNull(statement.finallyClause);
+ JUnitTestCase.assertNotNull(statement.finallyBlock);
}
void test_parseTryStatement_finally() {
TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} finally {}", []);
@@ -3279,7 +3276,7 @@
JUnitTestCase.assertNotNull(statement.body);
EngineTestCase.assertSize(0, statement.catchClauses);
JUnitTestCase.assertNotNull(statement.finallyKeyword);
- JUnitTestCase.assertNotNull(statement.finallyClause);
+ JUnitTestCase.assertNotNull(statement.finallyBlock);
}
void test_parseTryStatement_multiple() {
TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on NPE catch (e) {} on Error {} catch (e) {}", []);
@@ -3287,7 +3284,7 @@
JUnitTestCase.assertNotNull(statement.body);
EngineTestCase.assertSize(3, statement.catchClauses);
JUnitTestCase.assertNull(statement.finallyKeyword);
- JUnitTestCase.assertNull(statement.finallyClause);
+ JUnitTestCase.assertNull(statement.finallyBlock);
}
void test_parseTryStatement_on() {
TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error {}", []);
@@ -3304,7 +3301,7 @@
JUnitTestCase.assertNull(clause.stackTraceParameter);
JUnitTestCase.assertNotNull(clause.body);
JUnitTestCase.assertNull(statement.finallyKeyword);
- JUnitTestCase.assertNull(statement.finallyClause);
+ JUnitTestCase.assertNull(statement.finallyBlock);
}
void test_parseTryStatement_on_catch() {
TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error catch (e, s) {}", []);
@@ -3321,7 +3318,7 @@
JUnitTestCase.assertNotNull(clause.stackTraceParameter);
JUnitTestCase.assertNotNull(clause.body);
JUnitTestCase.assertNull(statement.finallyKeyword);
- JUnitTestCase.assertNull(statement.finallyClause);
+ JUnitTestCase.assertNull(statement.finallyBlock);
}
void test_parseTryStatement_on_catch_finally() {
TryStatement statement = ParserTestCase.parse5("parseTryStatement", "try {} on Error catch (e, s) {} finally {}", []);
@@ -3338,7 +3335,7 @@
JUnitTestCase.assertNotNull(clause.stackTraceParameter);
JUnitTestCase.assertNotNull(clause.body);
JUnitTestCase.assertNotNull(statement.finallyKeyword);
- JUnitTestCase.assertNotNull(statement.finallyClause);
+ JUnitTestCase.assertNotNull(statement.finallyBlock);
}
void test_parseTypeAlias_class_implementsC() {
ClassTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef A = Object with B implements C;");
@@ -9438,7 +9435,7 @@
'peek_0': new MethodTrampoline(0, (Parser target) => target.peek()),
'peek_1': new MethodTrampoline(1, (Parser target, arg0) => target.peek2(arg0)),
'reportError_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.reportError(arg0, arg1, arg2)),
- 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.reportError7(arg0, arg1)),
+ 'reportError_2': new MethodTrampoline(2, (Parser target, arg0, arg1) => target.reportError8(arg0, arg1)),
'skipFinalConstVarOrType_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFinalConstVarOrType(arg0)),
'skipFormalParameterList_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipFormalParameterList(arg0)),
'skipPastMatchingToken_1': new MethodTrampoline(1, (Parser target, arg0) => target.skipPastMatchingToken(arg0)),
diff --git a/pkg/analyzer_experimental/test/generated/resolver_test.dart b/pkg/analyzer_experimental/test/generated/resolver_test.dart
index 99404c3..7cc689b 100644
--- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
+++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
@@ -1,9 +1,7 @@
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.resolver_test;
-import 'dart:collection';
import 'package:analyzer_experimental/src/generated/java_core.dart';
-import 'package:analyzer_experimental/src/generated/java_engine.dart';
import 'package:analyzer_experimental/src/generated/java_junit.dart';
import 'package:analyzer_experimental/src/generated/source_io.dart';
import 'package:analyzer_experimental/src/generated/error.dart';
@@ -427,14 +425,13 @@
"}"]));
LibraryElement library = resolve(source);
assertErrors([StaticTypeWarningCode.UNDEFINED_METHOD]);
- verify([source]);
CompilationUnit unit = resolveCompilationUnit(source, library);
FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration;
BlockFunctionBody body = function.functionExpression.body as BlockFunctionBody;
IfStatement ifStatement = body.block.statements[0] as IfStatement;
ReturnStatement statement = ((ifStatement.thenStatement as Block)).statements[0] as ReturnStatement;
MethodInvocation invocation = statement.expression as MethodInvocation;
- JUnitTestCase.assertNotNull(invocation.methodName.element);
+ JUnitTestCase.assertNotNull(invocation.methodName.propagatedElement);
}
void test_is_while() {
Source source = addSource(EngineTestCase.createSource([
@@ -1155,6 +1152,21 @@
assertNoErrors();
verify([source]);
}
+ void test_constConstructorWithNonConstSuper_redirectingFactory() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " A();",
+ "}",
+ "class B implements C {",
+ " const B();",
+ "}",
+ "class C extends A {",
+ " const factory C() = B;",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_constConstructorWithNonFinalField_finalInstanceVar() {
Source source = addSource(EngineTestCase.createSource(["class A {", " final int x = 0;", " const A();", "}"]));
resolve(source);
@@ -1316,6 +1328,18 @@
assertErrors([]);
verify([source]);
}
+ void test_defaultValueInFunctionTypedParameter_named() {
+ Source source = addSource(EngineTestCase.createSource(["f(g({p})) {}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_defaultValueInFunctionTypedParameter_optional() {
+ Source source = addSource(EngineTestCase.createSource(["f(g([p])) {}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_duplicateDefinition_emptyName() {
Source source = addSource(EngineTestCase.createSource([
"Map _globalMap = {",
@@ -1332,6 +1356,12 @@
assertNoErrors();
verify([source]);
}
+ void test_dynamicIdentifier() {
+ Source source = addSource(EngineTestCase.createSource(["main() {", " var v = dynamic;", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_exportOfNonLibrary_libraryDeclared() {
Source source = addSource(EngineTestCase.createSource(["library L;", "export 'lib1.dart';"]));
addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"]));
@@ -1418,7 +1448,7 @@
"}",
"class B extends A {",
" int x;",
- " A(this.x) : super();",
+ " B(this.x) : super();",
"}"]));
resolve(source);
assertNoErrors();
@@ -1543,19 +1573,6 @@
assertNoErrors();
verify([source]);
}
- void test_implicitThisReferenceInInitializer_staticField_superClass() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " static var f;",
- "}",
- "class B extends A {",
- " var v;",
- " B() : v = f;",
- "}"]));
- resolve(source);
- assertNoErrors();
- verify([source]);
- }
void test_implicitThisReferenceInInitializer_staticField_thisClass() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -1666,12 +1683,122 @@
assertNoErrors();
verify([source]);
}
+ void test_inconsistentMethodInheritance_accessors_typeVariables_diamond() {
+ Source source = addSource(EngineTestCase.createSource([
+ "abstract class F<E> extends B<E> {}",
+ "class D<E> extends F<E> {",
+ " external E get g;",
+ "}",
+ "abstract class C<E> {",
+ " E get g;",
+ "}",
+ "abstract class B<E> implements C<E> {",
+ " E get g { return null; }",
+ "}",
+ "class A<E> extends B<E> implements D<E> {",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_inconsistentMethodInheritance_accessors_typeVariables1() {
+ Source source = addSource(EngineTestCase.createSource([
+ "abstract class A<E> {",
+ " E get x;",
+ "}",
+ "abstract class B<E> {",
+ " E get x;",
+ "}",
+ "class C<E> implements A<E>, B<E> {",
+ " E get x => 1;",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_inconsistentMethodInheritance_accessors_typeVariables2() {
+ Source source = addSource(EngineTestCase.createSource([
+ "abstract class A<E> {",
+ " E get x {return 1;}",
+ "}",
+ "class B<E> {",
+ " E get x {return 1;}",
+ "}",
+ "class C<E> extends A<E> implements B<E> {",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_inconsistentMethodInheritance_methods_typeVariables1() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A<E> {",
+ " x(E e) {}",
+ "}",
+ "class B<E> {",
+ " x(E e) {}",
+ "}",
+ "class C<E> implements A<E>, B<E> {",
+ " x(E e) {}",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_inconsistentMethodInheritance_methods_typeVariables2() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A<E> {",
+ " x(E e) {}",
+ "}",
+ "class B<E> {",
+ " x(E e) {}",
+ "}",
+ "class C<E> extends A<E> implements B<E> {",
+ " x(E e) {}",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_inconsistentMethodInheritance_simple() {
+ Source source = addSource(EngineTestCase.createSource([
+ "abstract class A {",
+ " x();",
+ "}",
+ "abstract class B {",
+ " x();",
+ "}",
+ "class C implements A, B {",
+ " x() {}",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_initializingFormalForNonExistantField() {
Source source = addSource(EngineTestCase.createSource(["class A {", " int x;", " A(this.x) {}", "}"]));
resolve(source);
assertNoErrors();
verify([source]);
}
+ void test_instanceAccessToStaticMember_fromComment() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static m() {}",
+ "}",
+ "/// [A.m]",
+ "main() {",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_instanceAccessToStaticMember_topLevel() {
+ Source source = addSource(EngineTestCase.createSource(["m() {}", "main() {", " m();", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_instanceMemberAccessFromStatic_fromComment() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -1734,6 +1861,18 @@
assertNoErrors();
verify([source]);
}
+ void test_invalidAssignment_defaultValue_named() {
+ Source source = addSource(EngineTestCase.createSource(["f({String x: '0'}) {", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_invalidAssignment_defaultValue_optional() {
+ Source source = addSource(EngineTestCase.createSource(["f([String x = '0']) {", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_invalidAssignment_toDynamic() {
Source source = addSource(EngineTestCase.createSource(["f() {", " var g;", " g = () => 0;", "}"]));
resolve(source);
@@ -1918,6 +2057,17 @@
assertNoErrors();
verify([source]);
}
+ void test_invalidTypeArgumentForKey() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " m() {",
+ " return const <int, int>{};",
+ " }",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_invalidTypeArgumentInConstList() {
Source source = addSource(EngineTestCase.createSource([
"class A<E> {",
@@ -2170,18 +2320,6 @@
assertNoErrors();
verify([source]);
}
- void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod() {
- Source source = addSource(EngineTestCase.createSource([
- "abstract class A {",
- " m(p);",
- "}",
- "class B extends A {",
- " noSuchMethod(invocation) {}",
- "}"]));
- resolve(source);
- assertNoErrors();
- verify([source]);
- }
void test_nonBoolExpression_functionType() {
Source source = addSource(EngineTestCase.createSource([
"bool makeAssertion() => true;",
@@ -2234,6 +2372,19 @@
assertNoErrors();
verify([source]);
}
+ void test_nonConstantValueInInitializer_namedArgument() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " final a;",
+ " const A({this.a});",
+ "}",
+ "class B extends A {",
+ " const B({b}) : super(a: b);",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_nonConstCaseExpression() {
Source source = addSource(EngineTestCase.createSource([
"f(Type t) {",
@@ -2510,6 +2661,93 @@
assertNoErrors();
verify([source]);
}
+ void test_proxy_annotation_prefixed() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'meta.dart';",
+ "@proxy",
+ "class A {}",
+ "f(A a) {",
+ " a.m();",
+ " var x = a.g;",
+ " a.s = 1;",
+ " var y = a + a;",
+ " a++;",
+ " ++a;",
+ "}"]));
+ addSource2("/meta.dart", EngineTestCase.createSource([
+ "library meta;",
+ "const proxy = const _Proxy();",
+ "class _Proxy { const _Proxy(); }"]));
+ resolve(source);
+ assertNoErrors();
+ }
+ void test_proxy_annotation_prefixed2() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'meta.dart';",
+ "@proxy",
+ "class A {}",
+ "class B {",
+ " f(A a) {",
+ " a.m();",
+ " var x = a.g;",
+ " a.s = 1;",
+ " var y = a + a;",
+ " a++;",
+ " ++a;",
+ " }",
+ "}"]));
+ addSource2("/meta.dart", EngineTestCase.createSource([
+ "library meta;",
+ "const proxy = const _Proxy();",
+ "class _Proxy { const _Proxy(); }"]));
+ resolve(source);
+ assertNoErrors();
+ }
+ void test_proxy_annotation_prefixed3() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'meta.dart';",
+ "class B {",
+ " f(A a) {",
+ " a.m();",
+ " var x = a.g;",
+ " a.s = 1;",
+ " var y = a + a;",
+ " a++;",
+ " ++a;",
+ " }",
+ "}",
+ "@proxy",
+ "class A {}"]));
+ addSource2("/meta.dart", EngineTestCase.createSource([
+ "library meta;",
+ "const proxy = const _Proxy();",
+ "class _Proxy { const _Proxy(); }"]));
+ resolve(source);
+ assertNoErrors();
+ }
+ void test_proxy_annotation_simple() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'meta.dart';",
+ "@proxy",
+ "class B {",
+ " m() {",
+ " n();",
+ " var x = g;",
+ " s = 1;",
+ " var y = this + this;",
+ " }",
+ "}"]));
+ addSource2("/meta.dart", EngineTestCase.createSource([
+ "library meta;",
+ "const proxy = const _Proxy();",
+ "class _Proxy { const _Proxy(); }"]));
+ resolve(source);
+ assertNoErrors();
+ }
void test_recursiveConstructorRedirect() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -2935,6 +3173,13 @@
assertNoErrors();
verify([source]);
}
+ void test_undefinedSetter_importWithPrefix() {
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "set y(int value) {}"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as x;", "main() {", " x.y = 0;", "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_undefinedSuperMethod_field() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -3108,6 +3353,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_conflictingStaticSetterAndInstanceMember_thisClass_method);
});
+ _ut.test('test_constConstructorWithNonConstSuper_redirectingFactory', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_constConstructorWithNonConstSuper_redirectingFactory);
+ });
_ut.test('test_constConstructorWithNonFinalField_finalInstanceVar', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_finalInstanceVar);
@@ -3160,6 +3409,14 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias);
});
+ _ut.test('test_defaultValueInFunctionTypedParameter_named', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_named);
+ });
+ _ut.test('test_defaultValueInFunctionTypedParameter_optional', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_optional);
+ });
_ut.test('test_duplicateDefinition_emptyName', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_duplicateDefinition_emptyName);
@@ -3168,6 +3425,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_duplicateDefinition_getter);
});
+ _ut.test('test_dynamicIdentifier', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_dynamicIdentifier);
+ });
_ut.test('test_exportOfNonLibrary_libraryDeclared', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_exportOfNonLibrary_libraryDeclared);
@@ -3268,10 +3529,6 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_qualifiedPropertyAccess);
});
- _ut.test('test_implicitThisReferenceInInitializer_staticField_superClass', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_staticField_superClass);
- });
_ut.test('test_implicitThisReferenceInInitializer_staticField_thisClass', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_implicitThisReferenceInInitializer_staticField_thisClass);
@@ -3316,10 +3573,42 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_inconsistentCaseExpressionTypes);
});
+ _ut.test('test_inconsistentMethodInheritance_accessors_typeVariables1', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors_typeVariables1);
+ });
+ _ut.test('test_inconsistentMethodInheritance_accessors_typeVariables2', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors_typeVariables2);
+ });
+ _ut.test('test_inconsistentMethodInheritance_accessors_typeVariables_diamond', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_accessors_typeVariables_diamond);
+ });
+ _ut.test('test_inconsistentMethodInheritance_methods_typeVariables1', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_methods_typeVariables1);
+ });
+ _ut.test('test_inconsistentMethodInheritance_methods_typeVariables2', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_methods_typeVariables2);
+ });
+ _ut.test('test_inconsistentMethodInheritance_simple', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_inconsistentMethodInheritance_simple);
+ });
_ut.test('test_initializingFormalForNonExistantField', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_initializingFormalForNonExistantField);
});
+ _ut.test('test_instanceAccessToStaticMember_fromComment', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_instanceAccessToStaticMember_fromComment);
+ });
+ _ut.test('test_instanceAccessToStaticMember_topLevel', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_instanceAccessToStaticMember_topLevel);
+ });
_ut.test('test_instanceMemberAccessFromStatic_fromComment', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_instanceMemberAccessFromStatic_fromComment);
@@ -3344,6 +3633,14 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invalidAssignment_compoundAssignment);
});
+ _ut.test('test_invalidAssignment_defaultValue_named', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_named);
+ });
+ _ut.test('test_invalidAssignment_defaultValue_optional', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_optional);
+ });
_ut.test('test_invalidAssignment_toDynamic', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invalidAssignment_toDynamic);
@@ -3412,6 +3709,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invalidReferenceToThis_instanceMethod);
});
+ _ut.test('test_invalidTypeArgumentForKey', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_invalidTypeArgumentForKey);
+ });
_ut.test('test_invalidTypeArgumentInConstList', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_invalidTypeArgumentInConstList);
@@ -3524,10 +3825,6 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_method);
});
- _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod);
- });
_ut.test('test_nonBoolExpression_functionType', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_nonBoolExpression_functionType);
@@ -3608,6 +3905,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_nonConstantDefaultValue_method_positional);
});
+ _ut.test('test_nonConstantValueInInitializer_namedArgument', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_nonConstantValueInInitializer_namedArgument);
+ });
_ut.test('test_nonGenerativeConstructor', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_nonGenerativeConstructor);
@@ -3660,6 +3961,22 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_prefixCollidesWithTopLevelMembers);
});
+ _ut.test('test_proxy_annotation_prefixed', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_proxy_annotation_prefixed);
+ });
+ _ut.test('test_proxy_annotation_prefixed2', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_proxy_annotation_prefixed2);
+ });
+ _ut.test('test_proxy_annotation_prefixed3', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_proxy_annotation_prefixed3);
+ });
+ _ut.test('test_proxy_annotation_simple', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_proxy_annotation_simple);
+ });
_ut.test('test_recursiveConstructorRedirect', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_recursiveConstructorRedirect);
@@ -3824,6 +4141,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedOperator_tilde);
});
+ _ut.test('test_undefinedSetter_importWithPrefix', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_undefinedSetter_importWithPrefix);
+ });
_ut.test('test_undefinedSuperMethod_field', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedSuperMethod_field);
@@ -3986,19 +4307,6 @@
assertErrors([StaticTypeWarningCode.INACCESSIBLE_SETTER]);
verify([source]);
}
- void fail_invocationOfNonFunction_staticInSuperclass() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " static void a() {}",
- "}",
- "",
- "class B extends A {",
- " void b() { a(); }",
- "}"]));
- resolve(source);
- assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
- verify([source]);
- }
void test_inconsistentMethodInheritance_paramCount() {
Source source = addSource(EngineTestCase.createSource([
"abstract class A {",
@@ -4039,6 +4347,66 @@
assertErrors([StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
verify([source]);
}
+ void test_instanceAccessToStaticMember_method_invocation() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static m() {}",
+ "}",
+ "main(A a) {",
+ " a.m();",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
+ verify([source]);
+ }
+ void test_instanceAccessToStaticMember_method_reference() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static m() {}",
+ "}",
+ "main(A a) {",
+ " a.m;",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
+ verify([source]);
+ }
+ void test_instanceAccessToStaticMember_propertyAccess_field() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static var f;",
+ "}",
+ "main(A a) {",
+ " a.f;",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
+ verify([source]);
+ }
+ void test_instanceAccessToStaticMember_propertyAccess_getter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static get f => 42;",
+ "}",
+ "main(A a) {",
+ " a.f;",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
+ verify([source]);
+ }
+ void test_instanceAccessToStaticMember_propertyAccess_setter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static set f(x) {}",
+ "}",
+ "main(A a) {",
+ " a.f = 42;",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
+ verify([source]);
+ }
void test_invalidAssignment_compoundAssignment() {
Source source = addSource(EngineTestCase.createSource([
"class byte {",
@@ -4055,6 +4423,18 @@
assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]);
verify([source]);
}
+ void test_invalidAssignment_defaultValue_named() {
+ Source source = addSource(EngineTestCase.createSource(["f({String x: 0}) {", "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ verify([source]);
+ }
+ void test_invalidAssignment_defaultValue_optional() {
+ Source source = addSource(EngineTestCase.createSource(["f([String x = 0]) {", "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ verify([source]);
+ }
void test_invalidAssignment_instanceVariable() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -4147,6 +4527,12 @@
assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
verify([source]);
}
+ void test_invocationOfNonFunctionExpression_literal() {
+ Source source = addSource(EngineTestCase.createSource(["f() {", " 3(5);", "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION]);
+ verify([source]);
+ }
void test_nonBoolCondition_conditional() {
Source source = addSource(EngineTestCase.createSource(["f() { return 3 ? 2 : 1; }"]));
resolve(source);
@@ -4450,11 +4836,6 @@
assertErrors([StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
verify([source]);
}
- void test_undefinedFunction() {
- Source source = addSource(EngineTestCase.createSource(["void f() {", " g();", "}"]));
- resolve(source);
- assertErrors([StaticTypeWarningCode.UNDEFINED_FUNCTION]);
- }
void test_undefinedGetter() {
Source source = addSource(EngineTestCase.createSource(["class T {}", "f(T e) { return e.m; }"]));
resolve(source);
@@ -4488,7 +4869,9 @@
void test_undefinedOperator_indexBoth() {
Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a) {", " a[0]++;", "}"]));
resolve(source);
- assertErrors([StaticTypeWarningCode.UNDEFINED_OPERATOR]);
+ assertErrors([
+ StaticTypeWarningCode.UNDEFINED_OPERATOR,
+ StaticTypeWarningCode.UNDEFINED_OPERATOR]);
}
void test_undefinedOperator_indexGetter() {
Source source = addSource(EngineTestCase.createSource(["class A {}", "f(A a) {", " a[0];", "}"]));
@@ -4524,6 +4907,48 @@
resolve(source);
assertErrors([StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]);
}
+ void test_unqualifiedReferenceToNonLocalStaticMember_getter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static int get a => 0;",
+ "}",
+ "class B extends A {",
+ " int b() {",
+ " return a;",
+ " }",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER]);
+ verify([source]);
+ }
+ void test_unqualifiedReferenceToNonLocalStaticMember_method() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static void a() {}",
+ "}",
+ "class B extends A {",
+ " void b() {",
+ " a();",
+ " }",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER]);
+ verify([source]);
+ }
+ void test_unqualifiedReferenceToNonLocalStaticMember_setter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static set a(x) {}",
+ "}",
+ "class B extends A {",
+ " b(y) {",
+ " a = y;",
+ " }",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER]);
+ verify([source]);
+ }
void test_wrongNumberOfTypeArguments_tooFew() {
Source source = addSource(EngineTestCase.createSource(["class A<E, F> {}", "A<A> a = null;"]));
resolve(source);
@@ -4572,10 +4997,38 @@
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_inconsistentMethodInheritance_returnType);
});
+ _ut.test('test_instanceAccessToStaticMember_method_invocation', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_instanceAccessToStaticMember_method_invocation);
+ });
+ _ut.test('test_instanceAccessToStaticMember_method_reference', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_instanceAccessToStaticMember_method_reference);
+ });
+ _ut.test('test_instanceAccessToStaticMember_propertyAccess_field', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_instanceAccessToStaticMember_propertyAccess_field);
+ });
+ _ut.test('test_instanceAccessToStaticMember_propertyAccess_getter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_instanceAccessToStaticMember_propertyAccess_getter);
+ });
+ _ut.test('test_instanceAccessToStaticMember_propertyAccess_setter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_instanceAccessToStaticMember_propertyAccess_setter);
+ });
_ut.test('test_invalidAssignment_compoundAssignment', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_invalidAssignment_compoundAssignment);
});
+ _ut.test('test_invalidAssignment_defaultValue_named', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_named);
+ });
+ _ut.test('test_invalidAssignment_defaultValue_optional', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_invalidAssignment_defaultValue_optional);
+ });
_ut.test('test_invalidAssignment_instanceVariable', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_invalidAssignment_instanceVariable);
@@ -4596,6 +5049,10 @@
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_invalidAssignment_variableDeclaration);
});
+ _ut.test('test_invocationOfNonFunctionExpression_literal', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_invocationOfNonFunctionExpression_literal);
+ });
_ut.test('test_invocationOfNonFunction_class', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_invocationOfNonFunction_class);
@@ -4756,10 +5213,6 @@
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_with);
});
- _ut.test('test_undefinedFunction', () {
- final __test = new StaticTypeWarningCodeTest();
- runJUnitTest(__test, __test.test_undefinedFunction);
- });
_ut.test('test_undefinedGetter', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedGetter);
@@ -4804,6 +5257,18 @@
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedSuperMethod);
});
+ _ut.test('test_unqualifiedReferenceToNonLocalStaticMember_getter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_unqualifiedReferenceToNonLocalStaticMember_getter);
+ });
+ _ut.test('test_unqualifiedReferenceToNonLocalStaticMember_method', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_unqualifiedReferenceToNonLocalStaticMember_method);
+ });
+ _ut.test('test_unqualifiedReferenceToNonLocalStaticMember_setter', () {
+ final __test = new StaticTypeWarningCodeTest();
+ runJUnitTest(__test, __test.test_unqualifiedReferenceToNonLocalStaticMember_setter);
+ });
_ut.test('test_wrongNumberOfTypeArguments_tooFew', () {
final __test = new StaticTypeWarningCodeTest();
runJUnitTest(__test, __test.test_wrongNumberOfTypeArguments_tooFew);
@@ -5256,16 +5721,16 @@
void test_visitCatchClause_exception() {
CatchClause clause = ASTFactory.catchClause("e", []);
SimpleIdentifier exceptionParameter = clause.exceptionParameter;
- exceptionParameter.element = new LocalVariableElementImpl(exceptionParameter);
+ exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionParameter);
resolve(clause, _typeProvider.objectType, null, []);
_listener.assertNoErrors();
}
void test_visitCatchClause_exception_stackTrace() {
CatchClause clause = ASTFactory.catchClause2("e", "s", []);
SimpleIdentifier exceptionParameter = clause.exceptionParameter;
- exceptionParameter.element = new LocalVariableElementImpl(exceptionParameter);
+ exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionParameter);
SimpleIdentifier stackTraceParameter = clause.stackTraceParameter;
- stackTraceParameter.element = new LocalVariableElementImpl(stackTraceParameter);
+ stackTraceParameter.staticElement = new LocalVariableElementImpl(stackTraceParameter);
resolve(clause, _typeProvider.objectType, _typeProvider.stackTraceType, []);
_listener.assertNoErrors();
}
@@ -5274,19 +5739,19 @@
TypeName exceptionType = ASTFactory.typeName(exceptionElement, []);
CatchClause clause = ASTFactory.catchClause4(exceptionType, "e", []);
SimpleIdentifier exceptionParameter = clause.exceptionParameter;
- exceptionParameter.element = new LocalVariableElementImpl(exceptionParameter);
+ exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionParameter);
resolve(clause, exceptionElement.type, null, [exceptionElement]);
_listener.assertNoErrors();
}
void test_visitCatchClause_on_exception_stackTrace() {
ClassElement exceptionElement = ElementFactory.classElement2("E", []);
TypeName exceptionType = ASTFactory.typeName(exceptionElement, []);
- ((exceptionType.name as SimpleIdentifier)).element = exceptionElement;
+ ((exceptionType.name as SimpleIdentifier)).staticElement = exceptionElement;
CatchClause clause = ASTFactory.catchClause5(exceptionType, "e", "s", []);
SimpleIdentifier exceptionParameter = clause.exceptionParameter;
- exceptionParameter.element = new LocalVariableElementImpl(exceptionParameter);
+ exceptionParameter.staticElement = new LocalVariableElementImpl(exceptionParameter);
SimpleIdentifier stackTraceParameter = clause.stackTraceParameter;
- stackTraceParameter.element = new LocalVariableElementImpl(stackTraceParameter);
+ stackTraceParameter.staticElement = new LocalVariableElementImpl(stackTraceParameter);
resolve(clause, exceptionElement.type, _typeProvider.stackTraceType, [exceptionElement]);
_listener.assertNoErrors();
}
@@ -5299,7 +5764,7 @@
WithClause withClause = ASTFactory.withClause([ASTFactory.typeName(elementC, [])]);
ImplementsClause implementsClause = ASTFactory.implementsClause([ASTFactory.typeName(elementD, [])]);
ClassDeclaration declaration = ASTFactory.classDeclaration(null, "A", null, extendsClause, withClause, implementsClause, []);
- declaration.name.element = elementA;
+ declaration.name.staticElement = elementA;
resolveNode(declaration, [elementA, elementB, elementC, elementD]);
JUnitTestCase.assertSame(elementB.type, elementA.supertype);
List<InterfaceType> mixins = elementA.mixins;
@@ -5318,7 +5783,7 @@
WithClause withClause = ASTFactory.withClause([ASTFactory.typeName(elementC, [])]);
ImplementsClause implementsClause = ASTFactory.implementsClause([ASTFactory.typeName(elementD, [])]);
ClassTypeAlias alias = ASTFactory.classTypeAlias("A", null, null, ASTFactory.typeName(elementB, []), withClause, implementsClause);
- alias.name.element = elementA;
+ alias.name.staticElement = elementA;
resolveNode(alias, [elementA, elementB, elementC, elementD]);
JUnitTestCase.assertSame(elementB.type, elementA.supertype);
List<InterfaceType> mixins = elementA.mixins;
@@ -5334,10 +5799,10 @@
TypeName intTypeName = ASTFactory.typeName4("int", []);
String innerParameterName = "a";
SimpleFormalParameter parameter = ASTFactory.simpleFormalParameter3(innerParameterName);
- parameter.identifier.element = ElementFactory.requiredParameter(innerParameterName);
+ parameter.identifier.staticElement = ElementFactory.requiredParameter(innerParameterName);
String outerParameterName = "p";
FormalParameter node = ASTFactory.fieldFormalParameter2(null, intTypeName, outerParameterName, ASTFactory.formalParameterList([parameter]));
- node.identifier.element = ElementFactory.requiredParameter(outerParameterName);
+ node.identifier.staticElement = ElementFactory.requiredParameter(outerParameterName);
Type2 parameterType = resolve6(node, [intType.element]);
EngineTestCase.assertInstanceOf(FunctionType, parameterType);
FunctionType functionType = parameterType as FunctionType;
@@ -5348,7 +5813,7 @@
void test_visitFieldFormalParameter_noType() {
String parameterName = "p";
FormalParameter node = ASTFactory.fieldFormalParameter(Keyword.VAR, null, parameterName);
- node.identifier.element = ElementFactory.requiredParameter(parameterName);
+ node.identifier.staticElement = ElementFactory.requiredParameter(parameterName);
JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve6(node, []));
_listener.assertNoErrors();
}
@@ -5357,13 +5822,13 @@
TypeName intTypeName = ASTFactory.typeName4("int", []);
String parameterName = "p";
FormalParameter node = ASTFactory.fieldFormalParameter(null, intTypeName, parameterName);
- node.identifier.element = ElementFactory.requiredParameter(parameterName);
+ node.identifier.staticElement = ElementFactory.requiredParameter(parameterName);
JUnitTestCase.assertSame(intType, resolve6(node, [intType.element]));
_listener.assertNoErrors();
}
void test_visitSimpleFormalParameter_noType() {
FormalParameter node = ASTFactory.simpleFormalParameter3("p");
- node.identifier.element = new ParameterElementImpl.con1(ASTFactory.identifier3("p"));
+ node.identifier.staticElement = new ParameterElementImpl.con1(ASTFactory.identifier3("p"));
JUnitTestCase.assertSame(_typeProvider.dynamicType, resolve6(node, []));
_listener.assertNoErrors();
}
@@ -5373,7 +5838,7 @@
FormalParameter node = ASTFactory.simpleFormalParameter4(ASTFactory.typeName(intElement, []), "p");
SimpleIdentifier identifier = node.identifier;
ParameterElementImpl element = new ParameterElementImpl.con1(identifier);
- identifier.element = element;
+ identifier.staticElement = element;
JUnitTestCase.assertSame(intType, resolve6(node, [intElement]));
_listener.assertNoErrors();
}
@@ -5452,7 +5917,7 @@
*/
Type2 resolve6(FormalParameter node, List<Element> definedElements) {
resolveNode(node, definedElements);
- return ((node.identifier.element as ParameterElement)).type;
+ return ((node.identifier.staticElement as ParameterElement)).type;
}
/**
@@ -5822,19 +6287,28 @@
* The inheritance manager being tested.
*/
InheritanceManager _inheritanceManager;
+
+ /**
+ * The number of members that Object implements (as determined by [TestTypeProvider]).
+ */
+ int _numOfMembersInObject = 0;
void setUp() {
_typeProvider = new TestTypeProvider();
_inheritanceManager = createInheritanceManager();
+ InterfaceType objectType = _typeProvider.objectType;
+ _numOfMembersInObject = objectType.methods.length + objectType.accessors.length;
}
void test_getMapOfMembersInheritedFromClasses_accessor_extends() {
ClassElementImpl classA = ElementFactory.classElement2("A", []);
String getterName = "g";
PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, false, _typeProvider.intType);
classA.accessors = <PropertyAccessorElement> [getterG];
- ClassElementImpl classB = ElementFactory.classElement2("B", []);
- classB.supertype = classA.type;
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
- JUnitTestCase.assertSame(getterG, map[getterName]);
+ ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(getterG, mapB[getterName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5845,8 +6319,11 @@
classA.accessors = <PropertyAccessorElement> [getterG];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.interfaces = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
- JUnitTestCase.assertNull(map[getterName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapB);
+ JUnitTestCase.assertNull(mapB[getterName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5857,8 +6334,11 @@
classA.accessors = <PropertyAccessorElement> [getterG];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.mixins = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
- JUnitTestCase.assertSame(getterG, map[getterName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(getterG, mapB[getterName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5869,8 +6349,11 @@
classA.methods = <MethodElement> [methodM];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.supertype = classA.type;
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
- JUnitTestCase.assertSame(methodM, map[methodName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(methodM, mapB[methodName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5881,8 +6364,11 @@
classA.methods = <MethodElement> [methodM];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.interfaces = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
- JUnitTestCase.assertNull(map[methodName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapB);
+ JUnitTestCase.assertNull(mapB[methodName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5893,8 +6379,11 @@
classA.methods = <MethodElement> [methodM];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.mixins = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
- JUnitTestCase.assertSame(methodM, map[methodName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromClasses(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(methodM, mapB[methodName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5903,10 +6392,12 @@
String getterName = "g";
PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, false, _typeProvider.intType);
classA.accessors = <PropertyAccessorElement> [getterG];
- ClassElementImpl classB = ElementFactory.classElement2("B", []);
- classB.supertype = classA.type;
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
- JUnitTestCase.assertSame(getterG, map[getterName]);
+ ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(getterG, mapB[getterName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5917,8 +6408,11 @@
classA.accessors = <PropertyAccessorElement> [getterG];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.interfaces = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
- JUnitTestCase.assertSame(getterG, map[getterName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(getterG, mapB[getterName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5929,8 +6423,11 @@
classA.accessors = <PropertyAccessorElement> [getterG];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.mixins = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
- JUnitTestCase.assertSame(getterG, map[getterName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(getterG, mapB[getterName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5939,10 +6436,12 @@
String methodName = "m";
MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvider.intType, []);
classA.methods = <MethodElement> [methodM];
- ClassElementImpl classB = ElementFactory.classElement2("B", []);
- classB.supertype = classA.type;
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
- JUnitTestCase.assertSame(methodM, map[methodName]);
+ ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(methodM, mapB[methodName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5953,8 +6452,11 @@
classA.methods = <MethodElement> [methodM];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.interfaces = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
- JUnitTestCase.assertSame(methodM, map[methodName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(methodM, mapB[methodName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -5965,8 +6467,11 @@
classA.methods = <MethodElement> [methodM];
ClassElementImpl classB = ElementFactory.classElement2("B", []);
classB.mixins = <InterfaceType> [classA.type];
- Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
- JUnitTestCase.assertSame(methodM, map[methodName]);
+ Map<String, ExecutableElement> mapB = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ Map<String, ExecutableElement> mapA = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
+ EngineTestCase.assertSize2(_numOfMembersInObject, mapA);
+ EngineTestCase.assertSize2(_numOfMembersInObject + 1, mapB);
+ JUnitTestCase.assertSame(methodM, mapB[methodName]);
assertNoErrors(classA);
assertNoErrors(classB);
}
@@ -6465,18 +6970,6 @@
assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]);
verify([source]);
}
- void fail_extendsOrImplementsDisallowedClass_extends_null() {
- Source source = addSource(EngineTestCase.createSource(["class A extends Null {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
- verify([source]);
- }
- void fail_extendsOrImplementsDisallowedClass_implements_null() {
- Source source = addSource(EngineTestCase.createSource(["class A implements Null {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
- verify([source]);
- }
void fail_mixinDeclaresConstructor() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -6532,6 +7025,18 @@
assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
verify([source]);
}
+ void test_ambiguousImport_function() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "g() { return f(); }"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f() {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f() {}"]));
+ resolve(source);
+ assertErrors([
+ StaticWarningCode.AMBIGUOUS_IMPORT,
+ CompileTimeErrorCode.UNDEFINED_FUNCTION]);
+ }
void test_argumentDefinitionTestNonParameter() {
Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;", " return ?v;", "}"]));
resolve(source);
@@ -6676,6 +7181,30 @@
assertErrors([CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
verify([source]);
}
+ void test_constConstructorWithNonConstSuper_explicit() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " A();",
+ "}",
+ "class B extends A {",
+ " const B(): super();",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
+ verify([source]);
+ }
+ void test_constConstructorWithNonConstSuper_implicit() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " A();",
+ "}",
+ "class B extends A {",
+ " const B();",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
+ verify([source]);
+ }
void test_constConstructorWithNonFinalField_mixin() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -6697,7 +7226,9 @@
" const B();",
"}"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]);
+ assertErrors([
+ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
+ CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
verify([source]);
}
void test_constConstructorWithNonFinalField_this() {
@@ -6712,7 +7243,7 @@
assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
verify([source]);
}
- void test_constEval_propertyExtraction_methodInstance() {
+ void test_constEval_propertyExtraction_targetNotConst() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
" const A();",
@@ -6724,18 +7255,6 @@
assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
verify([source]);
}
- void test_constEval_propertyExtraction_methodStatic_targetInstance() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " const A();",
- " static m() {}",
- "}",
- "final a = const A();",
- "const C = a.m;"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
- verify([source]);
- }
void test_constEvalThrowsException_binaryMinus_null() {
check_constEvalThrowsException_binary_null("null - 5", false);
check_constEvalThrowsException_binary_null("5 - null", true);
@@ -7009,6 +7528,18 @@
assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]);
verify([source]);
}
+ void test_defaultValueInFunctionTypedParameter_named() {
+ Source source = addSource(EngineTestCase.createSource(["f(g({p: null})) {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
+ verify([source]);
+ }
+ void test_defaultValueInFunctionTypedParameter_optional() {
+ Source source = addSource(EngineTestCase.createSource(["f(g([p = null])) {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
+ verify([source]);
+ }
void test_duplicateConstructorName_named() {
Source source = addSource(EngineTestCase.createSource(["class A {", " A.a() {}", " A.a() {}", "}"]));
resolve(source);
@@ -7099,6 +7630,30 @@
CompileTimeErrorCode.DUPLICATE_DEFINITION]);
verify([source]);
}
+ void test_duplicateDefinitionInheritance_instanceGetter_staticGetter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " int get x => 0;",
+ "}",
+ "class B extends A {",
+ " static int get x => 0;",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
+ verify([source]);
+ }
+ void test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "abstract class A {",
+ " int get x;",
+ "}",
+ "class B extends A {",
+ " static int get x => 0;",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
+ verify([source]);
+ }
void test_duplicateDefinitionInheritance_instanceMethod_staticMethod() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -7123,6 +7678,30 @@
assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
verify([source]);
}
+ void test_duplicateDefinitionInheritance_instanceSetter_staticSetter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " set x(value) {}",
+ "}",
+ "class B extends A {",
+ " static set x(value) {}",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
+ verify([source]);
+ }
+ void test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "abstract class A {",
+ " set x(value);",
+ "}",
+ "class B extends A {",
+ " static set x(value) {}",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
+ verify([source]);
+ }
void test_duplicateNamedArgument() {
Source source = addSource(EngineTestCase.createSource(["f({a, b}) {}", "main() {", " f(a: 1, a: 2);", "}"]));
resolve(source);
@@ -7142,6 +7721,54 @@
assertErrors([CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]);
verify([source]);
}
+ void test_extendsDisallowedClass_bool() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends bool {}"]));
+ resolve(source);
+ assertErrors([
+ CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
+ void test_extendsDisallowedClass_double() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends double {}"]));
+ resolve(source);
+ assertErrors([
+ CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
+ void test_extendsDisallowedClass_int() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends int {}"]));
+ resolve(source);
+ assertErrors([
+ CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
+ void test_extendsDisallowedClass_Null() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends Null {}"]));
+ resolve(source);
+ assertErrors([
+ CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
+ void test_extendsDisallowedClass_num() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends num {}"]));
+ resolve(source);
+ assertErrors([
+ CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
+ void test_extendsDisallowedClass_String() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends String {}"]));
+ resolve(source);
+ assertErrors([
+ CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
+ CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
+ verify([source]);
+ }
void test_extendsNonClass_class() {
Source source = addSource(EngineTestCase.createSource(["int A;", "class B extends A {}"]));
resolve(source);
@@ -7154,76 +7781,6 @@
assertErrors([CompileTimeErrorCode.EXTENDS_NON_CLASS]);
verify([source]);
}
- void test_extendsOrImplementsDisallowedClass_extends_bool() {
- Source source = addSource(EngineTestCase.createSource(["class A extends bool {}"]));
- resolve(source);
- assertErrors([
- CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
- CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_extends_double() {
- Source source = addSource(EngineTestCase.createSource(["class A extends double {}"]));
- resolve(source);
- assertErrors([
- CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
- CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_extends_int() {
- Source source = addSource(EngineTestCase.createSource(["class A extends int {}"]));
- resolve(source);
- assertErrors([
- CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
- CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_extends_num() {
- Source source = addSource(EngineTestCase.createSource(["class A extends num {}"]));
- resolve(source);
- assertErrors([
- CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
- CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_extends_String() {
- Source source = addSource(EngineTestCase.createSource(["class A extends String {}"]));
- resolve(source);
- assertErrors([
- CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
- CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_implements_bool() {
- Source source = addSource(EngineTestCase.createSource(["class A implements bool {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_implements_double() {
- Source source = addSource(EngineTestCase.createSource(["class A implements double {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_implements_int() {
- Source source = addSource(EngineTestCase.createSource(["class A implements int {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_implements_num() {
- Source source = addSource(EngineTestCase.createSource(["class A implements num {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
- verify([source]);
- }
- void test_extendsOrImplementsDisallowedClass_implements_String() {
- Source source = addSource(EngineTestCase.createSource(["class A implements String {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
- verify([source]);
- }
void test_extraPositionalArguments_const() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -7279,16 +7836,6 @@
CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
verify([source]);
}
- void test_fieldInitializedInInitializerAndDeclaration_final() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " final int x = 0;",
- " A() : x = 1 {}",
- "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
- verify([source]);
- }
void test_fieldInitializedInParameterAndInitializer() {
Source source = addSource(EngineTestCase.createSource(["class A {", " int x;", " A(this.x) : x = 1 {}", "}"]));
resolve(source);
@@ -7358,28 +7905,6 @@
assertErrors([CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
verify([source]);
}
-
- /**
- * This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR code, but tests the
- * FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provided here to show
- * coverage over all of the permutations of initializers in constructor declarations.
- *
- * Note: FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION covers a subset of
- * FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, since it more specific, we use it instead of
- * the broader code
- */
- void test_finalInitializedInDeclarationAndConstructor_initializers() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " final x = 0;", " A() : x = 0 {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
- verify([source]);
- }
- void test_finalInitializedInDeclarationAndConstructor_initializingFormal() {
- Source source = addSource(EngineTestCase.createSource(["class A {", " final x = 0;", " A(this.x) {}", "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR]);
- verify([source]);
- }
void test_finalInitializedMultipleTimes_initializers() {
Source source = addSource(EngineTestCase.createSource(["class A {", " final x;", " A() : x = 0, x = 0 {}", "}"]));
resolve(source);
@@ -7415,6 +7940,42 @@
CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]);
verify([source]);
}
+ void test_implementsDisallowedClass_bool() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements bool {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_implementsDisallowedClass_double() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements double {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_implementsDisallowedClass_int() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements int {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_implementsDisallowedClass_Null() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements Null {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_implementsDisallowedClass_num() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements num {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_implementsDisallowedClass_String() {
+ Source source = addSource(EngineTestCase.createSource(["class A implements String {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
+ verify([source]);
+ }
void test_implementsDynamic() {
Source source = addSource(EngineTestCase.createSource(["class A implements dynamic {}"]));
resolve(source);
@@ -7709,7 +8270,12 @@
assertErrors([CompileTimeErrorCode.INVALID_ANNOTATION]);
verify([source]);
}
- void test_invalidConstructorName_notEnclosingClassName() {
+ void test_invalidConstructorName_notEnclosingClassName_defined() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " B() : super();", "}", "class B {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
+ }
+ void test_invalidConstructorName_notEnclosingClassName_undefined() {
Source source = addSource(EngineTestCase.createSource(["class A {", " B() : super();", "}"]));
resolve(source);
assertErrors([CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
@@ -7725,54 +8291,6 @@
resolve(source);
assertErrors([CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
}
- void test_invalidOverrideNamed_fewerNamedParameters() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " m({a, b}) {}",
- "}",
- "class B extends A {",
- " m({a}) {}",
- "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]);
- verify([source]);
- }
- void test_invalidOverrideNamed_missingNamedParameter() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " m({a, b}) {}",
- "}",
- "class B extends A {",
- " m({a, c}) {}",
- "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_NAMED]);
- verify([source]);
- }
- void test_invalidOverridePositional() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " m([a, b]) {}",
- "}",
- "class B extends A {",
- " m([a]) {}",
- "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_POSITIONAL]);
- verify([source]);
- }
- void test_invalidOverrideRequired() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " m(a) {}",
- "}",
- "class B extends A {",
- " m(a, b) {}",
- "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.INVALID_OVERRIDE_REQUIRED]);
- verify([source]);
- }
void test_invalidReferenceToThis_factoryConstructor() {
Source source = addSource(EngineTestCase.createSource(["class A {", " factory A() { return this; }", "}"]));
resolve(source);
@@ -7803,6 +8321,18 @@
assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
verify([source]);
}
+ void test_invalidReferenceToThis_superInitializer() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " A(var x) {}",
+ "}",
+ "class B extends A {",
+ " B() : super(this);",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
+ verify([source]);
+ }
void test_invalidReferenceToThis_topLevelFunction() {
Source source = addSource("f() { return this; }");
resolve(source);
@@ -7815,17 +8345,6 @@
assertErrors([CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
verify([source]);
}
- void test_invalidTypeArgumentForKey() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " m() {",
- " return const <int, int>{};",
- " }",
- "}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_FOR_KEY]);
- verify([source]);
- }
void test_invalidTypeArgumentInConstList() {
Source source = addSource(EngineTestCase.createSource([
"class A<E> {",
@@ -7999,6 +8518,42 @@
assertErrors([CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
verify([source]);
}
+ void test_mixinOfDisallowedClass_bool() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends Object with bool {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_mixinOfDisallowedClass_double() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends Object with double {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_mixinOfDisallowedClass_int() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends Object with int {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_mixinOfDisallowedClass_Null() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends Object with Null {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_mixinOfDisallowedClass_num() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends Object with num {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
+ verify([source]);
+ }
+ void test_mixinOfDisallowedClass_String() {
+ Source source = addSource(EngineTestCase.createSource(["class A extends Object with String {}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
+ verify([source]);
+ }
void test_mixinOfNonClass_class() {
Source source = addSource(EngineTestCase.createSource(["int A;", "class B extends Object with A {}"]));
resolve(source);
@@ -8852,6 +9407,28 @@
assertErrors([CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
verify([source]);
}
+ void test_undefinedFunction() {
+ Source source = addSource(EngineTestCase.createSource(["void f() {", " g();", "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.UNDEFINED_FUNCTION]);
+ }
+ void test_undefinedFunction_hasImportPrefix() {
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as f;", "main() { return f(); }"]));
+ addSource2("/lib.dart", "library lib;");
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.UNDEFINED_FUNCTION]);
+ }
+ void test_undefinedFunction_inCatch() {
+ Source source = addSource(EngineTestCase.createSource([
+ "void f() {",
+ " try {",
+ " } on Object {",
+ " g();",
+ " }",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.UNDEFINED_FUNCTION]);
+ }
void test_undefinedNamedParameter() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -9033,6 +9610,10 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_ambiguousExport);
});
+ _ut.test('test_ambiguousImport_function', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_function);
+ });
_ut.test('test_argumentDefinitionTestNonParameter', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter);
@@ -9093,6 +9674,14 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_conflictingGetterAndMethod_method_getter);
});
+ _ut.test('test_constConstructorWithNonConstSuper_explicit', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constConstructorWithNonConstSuper_explicit);
+ });
+ _ut.test('test_constConstructorWithNonConstSuper_implicit', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_constConstructorWithNonConstSuper_implicit);
+ });
_ut.test('test_constConstructorWithNonFinalField_mixin', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constConstructorWithNonFinalField_mixin);
@@ -9161,13 +9750,9 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_constEval_newInstance_constConstructor);
});
- _ut.test('test_constEval_propertyExtraction_methodInstance', () {
+ _ut.test('test_constEval_propertyExtraction_targetNotConst', () {
final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodInstance);
- });
- _ut.test('test_constEval_propertyExtraction_methodStatic_targetInstance', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_constEval_propertyExtraction_methodStatic_targetInstance);
+ runJUnitTest(__test, __test.test_constEval_propertyExtraction_targetNotConst);
});
_ut.test('test_constFormalParameter_fieldFormalParameter', () {
final __test = new CompileTimeErrorCodeTest();
@@ -9245,6 +9830,14 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_defaultValueInFunctionTypeAlias);
});
+ _ut.test('test_defaultValueInFunctionTypedParameter_named', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_named);
+ });
+ _ut.test('test_defaultValueInFunctionTypedParameter_optional', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_defaultValueInFunctionTypedParameter_optional);
+ });
_ut.test('test_duplicateConstructorName_named', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_duplicateConstructorName_named);
@@ -9257,6 +9850,14 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_duplicateDefinition);
});
+ _ut.test('test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter);
+ });
+ _ut.test('test_duplicateDefinitionInheritance_instanceGetter_staticGetter', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceGetter_staticGetter);
+ });
_ut.test('test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod);
@@ -9265,6 +9866,14 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceMethod_staticMethod);
});
+ _ut.test('test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter);
+ });
+ _ut.test('test_duplicateDefinitionInheritance_instanceSetter_staticSetter', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_duplicateDefinitionInheritance_instanceSetter_staticSetter);
+ });
_ut.test('test_duplicateDefinition_acrossLibraries', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_duplicateDefinition_acrossLibraries);
@@ -9305,6 +9914,30 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_exportOfNonLibrary);
});
+ _ut.test('test_extendsDisallowedClass_Null', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_extendsDisallowedClass_Null);
+ });
+ _ut.test('test_extendsDisallowedClass_String', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_extendsDisallowedClass_String);
+ });
+ _ut.test('test_extendsDisallowedClass_bool', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_extendsDisallowedClass_bool);
+ });
+ _ut.test('test_extendsDisallowedClass_double', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_extendsDisallowedClass_double);
+ });
+ _ut.test('test_extendsDisallowedClass_int', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_extendsDisallowedClass_int);
+ });
+ _ut.test('test_extendsDisallowedClass_num', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_extendsDisallowedClass_num);
+ });
_ut.test('test_extendsNonClass_class', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_extendsNonClass_class);
@@ -9313,46 +9946,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_extendsNonClass_dynamic);
});
- _ut.test('test_extendsOrImplementsDisallowedClass_extends_String', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_extends_String);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_extends_bool', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_extends_bool);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_extends_double', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_extends_double);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_extends_int', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_extends_int);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_extends_num', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_extends_num);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_implements_String', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_implements_String);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_implements_bool', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_implements_bool);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_implements_double', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_implements_double);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_implements_int', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_implements_int);
- });
- _ut.test('test_extendsOrImplementsDisallowedClass_implements_num', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_extendsOrImplementsDisallowedClass_implements_num);
- });
_ut.test('test_extraPositionalArguments_const', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_extraPositionalArguments_const);
@@ -9373,10 +9966,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_fieldInitializedByMultipleInitializers_multipleNames);
});
- _ut.test('test_fieldInitializedInInitializerAndDeclaration_final', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclaration_final);
- });
_ut.test('test_fieldInitializedInParameterAndInitializer', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_fieldInitializedInParameterAndInitializer);
@@ -9409,14 +9998,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_fieldInitializingFormalRedirectingConstructor);
});
- _ut.test('test_finalInitializedInDeclarationAndConstructor_initializers', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstructor_initializers);
- });
- _ut.test('test_finalInitializedInDeclarationAndConstructor_initializingFormal', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstructor_initializingFormal);
- });
_ut.test('test_finalInitializedMultipleTimes_initializers', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_finalInitializedMultipleTimes_initializers);
@@ -9433,6 +10014,30 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_getterAndMethodWithSameName);
});
+ _ut.test('test_implementsDisallowedClass_Null', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_implementsDisallowedClass_Null);
+ });
+ _ut.test('test_implementsDisallowedClass_String', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_implementsDisallowedClass_String);
+ });
+ _ut.test('test_implementsDisallowedClass_bool', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_implementsDisallowedClass_bool);
+ });
+ _ut.test('test_implementsDisallowedClass_double', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_implementsDisallowedClass_double);
+ });
+ _ut.test('test_implementsDisallowedClass_int', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_implementsDisallowedClass_int);
+ });
+ _ut.test('test_implementsDisallowedClass_num', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_implementsDisallowedClass_num);
+ });
_ut.test('test_implementsDynamic', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_implementsDynamic);
@@ -9573,9 +10178,13 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidAnnotation_staticMethodReference);
});
- _ut.test('test_invalidConstructorName_notEnclosingClassName', () {
+ _ut.test('test_invalidConstructorName_notEnclosingClassName_defined', () {
final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClassName);
+ runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClassName_defined);
+ });
+ _ut.test('test_invalidConstructorName_notEnclosingClassName_undefined', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_invalidConstructorName_notEnclosingClassName_undefined);
});
_ut.test('test_invalidFactoryNameNotAClass_notClassName', () {
final __test = new CompileTimeErrorCodeTest();
@@ -9585,22 +10194,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidFactoryNameNotAClass_notEnclosingClassName);
});
- _ut.test('test_invalidOverrideNamed_fewerNamedParameters', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_invalidOverrideNamed_fewerNamedParameters);
- });
- _ut.test('test_invalidOverrideNamed_missingNamedParameter', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_invalidOverrideNamed_missingNamedParameter);
- });
- _ut.test('test_invalidOverridePositional', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_invalidOverridePositional);
- });
- _ut.test('test_invalidOverrideRequired', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_invalidOverrideRequired);
- });
_ut.test('test_invalidReferenceToThis_factoryConstructor', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidReferenceToThis_factoryConstructor);
@@ -9621,6 +10214,10 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidReferenceToThis_staticVariableInitializer);
});
+ _ut.test('test_invalidReferenceToThis_superInitializer', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_invalidReferenceToThis_superInitializer);
+ });
_ut.test('test_invalidReferenceToThis_topLevelFunction', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidReferenceToThis_topLevelFunction);
@@ -9629,10 +10226,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidReferenceToThis_variableInitializer);
});
- _ut.test('test_invalidTypeArgumentForKey', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_invalidTypeArgumentForKey);
- });
_ut.test('test_invalidTypeArgumentInConstList', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_invalidTypeArgumentInConstList);
@@ -9721,6 +10314,30 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_mixinInheritsFromNotObject_typedef_with);
});
+ _ut.test('test_mixinOfDisallowedClass_Null', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_mixinOfDisallowedClass_Null);
+ });
+ _ut.test('test_mixinOfDisallowedClass_String', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_mixinOfDisallowedClass_String);
+ });
+ _ut.test('test_mixinOfDisallowedClass_bool', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_mixinOfDisallowedClass_bool);
+ });
+ _ut.test('test_mixinOfDisallowedClass_double', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_mixinOfDisallowedClass_double);
+ });
+ _ut.test('test_mixinOfDisallowedClass_int', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_mixinOfDisallowedClass_int);
+ });
+ _ut.test('test_mixinOfDisallowedClass_num', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_mixinOfDisallowedClass_num);
+ });
_ut.test('test_mixinOfNonClass_class', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_mixinOfNonClass_class);
@@ -10113,6 +10730,18 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_implicit);
});
+ _ut.test('test_undefinedFunction', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_undefinedFunction);
+ });
+ _ut.test('test_undefinedFunction_hasImportPrefix', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_undefinedFunction_hasImportPrefix);
+ });
+ _ut.test('test_undefinedFunction_inCatch', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_undefinedFunction_inCatch);
+ });
_ut.test('test_undefinedNamedParameter', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_undefinedNamedParameter);
@@ -10328,7 +10957,7 @@
return null;
} else if (parent is ConstructorFieldInitializer && identical(node, ((parent as ConstructorFieldInitializer)).fieldName)) {
return null;
- } else if (node.element is PrefixElement) {
+ } else if (node.staticElement is PrefixElement) {
return null;
}
return super.visitSimpleIdentifier(node);
@@ -10345,7 +10974,7 @@
if (node != null) {
ASTNode root = node.root;
if (root is CompilationUnit) {
- CompilationUnit rootCU = (root as CompilationUnit);
+ CompilationUnit rootCU = root as CompilationUnit;
if (rootCU.element != null) {
return rootCU.element.source.fullName;
} else {
@@ -10667,7 +11296,7 @@
classA.constructors = <ConstructorElement> [constructor];
ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA, []), constructorName);
resolveNode(name, []);
- JUnitTestCase.assertSame(constructor, name.element);
+ JUnitTestCase.assertSame(constructor, name.staticElement);
_listener.assertNoErrors();
}
void test_visitConstructorName_unnamed() {
@@ -10677,7 +11306,7 @@
classA.constructors = <ConstructorElement> [constructor];
ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA, []), constructorName);
resolveNode(name, []);
- JUnitTestCase.assertSame(constructor, name.element);
+ JUnitTestCase.assertSame(constructor, name.staticElement);
_listener.assertNoErrors();
}
void test_visitContinueStatement_withLabel() {
@@ -10704,7 +11333,7 @@
ClassElementImpl classA = ElementFactory.classElement2("A", []);
classA.fields = <FieldElement> [ElementFactory.fieldElement(fieldName, false, false, false, intType)];
FieldFormalParameter parameter = ASTFactory.fieldFormalParameter3(fieldName);
- parameter.identifier.element = ElementFactory.fieldFormalParameter(parameter.identifier);
+ parameter.identifier.staticElement = ElementFactory.fieldFormalParameter(parameter.identifier);
resolveInClass(parameter, classA);
JUnitTestCase.assertSame(intType, parameter.element.type);
}
@@ -10752,10 +11381,10 @@
ConstructorElement constructor = ElementFactory.constructorElement(classA, constructorName);
classA.constructors = <ConstructorElement> [constructor];
ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA, []), constructorName);
- name.element = constructor;
+ name.staticElement = constructor;
InstanceCreationExpression creation = ASTFactory.instanceCreationExpression(Keyword.NEW, name, []);
resolveNode(creation, []);
- JUnitTestCase.assertSame(constructor, creation.element);
+ JUnitTestCase.assertSame(constructor, creation.staticElement);
_listener.assertNoErrors();
}
void test_visitInstanceCreationExpression_unnamed() {
@@ -10764,10 +11393,10 @@
ConstructorElement constructor = ElementFactory.constructorElement(classA, constructorName);
classA.constructors = <ConstructorElement> [constructor];
ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA, []), constructorName);
- name.element = constructor;
+ name.staticElement = constructor;
InstanceCreationExpression creation = ASTFactory.instanceCreationExpression(Keyword.NEW, name, []);
resolveNode(creation, []);
- JUnitTestCase.assertSame(constructor, creation.element);
+ JUnitTestCase.assertSame(constructor, creation.staticElement);
_listener.assertNoErrors();
}
void test_visitInstanceCreationExpression_unnamed_namedParameter() {
@@ -10779,11 +11408,11 @@
constructor.parameters = <ParameterElement> [parameter];
classA.constructors = <ConstructorElement> [constructor];
ConstructorName name = ASTFactory.constructorName(ASTFactory.typeName(classA, []), constructorName);
- name.element = constructor;
+ name.staticElement = constructor;
InstanceCreationExpression creation = ASTFactory.instanceCreationExpression(Keyword.NEW, name, [ASTFactory.namedExpression2(parameterName, ASTFactory.integer(0))]);
resolveNode(creation, []);
- JUnitTestCase.assertSame(constructor, creation.element);
- JUnitTestCase.assertSame(parameter, ((creation.argumentList.arguments[0] as NamedExpression)).name.label.element);
+ JUnitTestCase.assertSame(constructor, creation.staticElement);
+ JUnitTestCase.assertSame(parameter, ((creation.argumentList.arguments[0] as NamedExpression)).name.label.staticElement);
_listener.assertNoErrors();
}
void test_visitMethodInvocation() {
@@ -10793,7 +11422,7 @@
String methodName = "abs";
MethodInvocation invocation = ASTFactory.methodInvocation(left, methodName, []);
resolveNode(invocation, []);
- JUnitTestCase.assertSame(getMethod(numType, methodName), invocation.methodName.element);
+ JUnitTestCase.assertSame(getMethod(numType, methodName), invocation.methodName.staticElement);
_listener.assertNoErrors();
}
void test_visitMethodInvocation_namedParameter() {
@@ -10808,8 +11437,8 @@
left.staticType = classA.type;
MethodInvocation invocation = ASTFactory.methodInvocation(left, methodName, [ASTFactory.namedExpression2(parameterName, ASTFactory.integer(0))]);
resolveNode(invocation, []);
- JUnitTestCase.assertSame(method, invocation.methodName.element);
- JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] as NamedExpression)).name.label.element);
+ JUnitTestCase.assertSame(method, invocation.methodName.staticElement);
+ JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] as NamedExpression)).name.label.staticElement);
_listener.assertNoErrors();
}
void test_visitPostfixExpression() {
@@ -10826,12 +11455,12 @@
SimpleIdentifier target = ASTFactory.identifier3("a");
VariableElementImpl variable = ElementFactory.localVariableElement(target);
variable.type = dynamicType;
- target.element = variable;
+ target.staticElement = variable;
target.staticType = dynamicType;
PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.identifier3("b"));
resolveNode(identifier, []);
- JUnitTestCase.assertNull(identifier.element);
- JUnitTestCase.assertNull(identifier.identifier.element);
+ JUnitTestCase.assertNull(identifier.staticElement);
+ JUnitTestCase.assertNull(identifier.identifier.staticElement);
_listener.assertNoErrors();
}
void test_visitPrefixedIdentifier_nonDynamic() {
@@ -10842,12 +11471,12 @@
SimpleIdentifier target = ASTFactory.identifier3("a");
VariableElementImpl variable = ElementFactory.localVariableElement(target);
variable.type = classA.type;
- target.element = variable;
+ target.staticElement = variable;
target.staticType = classA.type;
PrefixedIdentifier identifier = ASTFactory.identifier(target, ASTFactory.identifier3(getterName));
resolveNode(identifier, []);
- JUnitTestCase.assertSame(getter, identifier.element);
- JUnitTestCase.assertSame(getter, identifier.identifier.element);
+ JUnitTestCase.assertSame(getter, identifier.staticElement);
+ JUnitTestCase.assertSame(getter, identifier.identifier.staticElement);
_listener.assertNoErrors();
}
void test_visitPrefixExpression() {
@@ -10868,7 +11497,7 @@
target.staticType = classA.type;
PropertyAccess access = ASTFactory.propertyAccess2(target, getterName);
resolveNode(access, []);
- JUnitTestCase.assertSame(getter, access.propertyName.element);
+ JUnitTestCase.assertSame(getter, access.propertyName.staticElement);
_listener.assertNoErrors();
}
void test_visitPropertyAccess_getter_super() {
@@ -10881,7 +11510,7 @@
PropertyAccess access = ASTFactory.propertyAccess2(target, getterName);
ASTFactory.methodDeclaration2(null, null, null, null, ASTFactory.identifier3("m"), ASTFactory.formalParameterList([]), ASTFactory.expressionFunctionBody(access));
resolveNode(access, []);
- JUnitTestCase.assertSame(getter, access.propertyName.element);
+ JUnitTestCase.assertSame(getter, access.propertyName.staticElement);
_listener.assertNoErrors();
}
void test_visitPropertyAccess_setter_this() {
@@ -10894,7 +11523,7 @@
PropertyAccess access = ASTFactory.propertyAccess2(target, setterName);
ASTFactory.assignmentExpression(access, TokenType.EQ, ASTFactory.integer(0));
resolveNode(access, []);
- JUnitTestCase.assertSame(setter, access.propertyName.element);
+ JUnitTestCase.assertSame(setter, access.propertyName.staticElement);
_listener.assertNoErrors();
}
void test_visitSimpleIdentifier_classScope() {
@@ -10902,7 +11531,14 @@
String fieldName = "NAN";
SimpleIdentifier node = ASTFactory.identifier3(fieldName);
resolveInClass(node, doubleType.element);
- JUnitTestCase.assertEquals(getGetter(doubleType, fieldName), node.element);
+ JUnitTestCase.assertEquals(getGetter(doubleType, fieldName), node.staticElement);
+ _listener.assertNoErrors();
+ }
+ void test_visitSimpleIdentifier_dynamic() {
+ SimpleIdentifier node = ASTFactory.identifier3("dynamic");
+ resolve4(node, []);
+ JUnitTestCase.assertSame(_typeProvider.dynamicType.element, node.staticElement);
+ JUnitTestCase.assertSame(_typeProvider.typeType, node.staticType);
_listener.assertNoErrors();
}
void test_visitSimpleIdentifier_lexicalScope() {
@@ -10921,7 +11557,7 @@
SimpleIdentifier node = ASTFactory.identifier3(fieldName);
ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0));
resolveInClass(node, classA);
- Element element = node.element;
+ Element element = node.staticElement;
EngineTestCase.assertInstanceOf(PropertyAccessorElement, element);
JUnitTestCase.assertTrue(((element as PropertyAccessorElement)).isSetter);
_listener.assertNoErrors();
@@ -10951,7 +11587,7 @@
SuperConstructorInvocation invocation = ASTFactory.superConstructorInvocation([ASTFactory.namedExpression2(parameterName, ASTFactory.integer(0))]);
resolveInClass(invocation, subclass);
JUnitTestCase.assertEquals(superConstructor, invocation.element);
- JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] as NamedExpression)).name.label.element);
+ JUnitTestCase.assertSame(parameter, ((invocation.argumentList.arguments[0] as NamedExpression)).name.label.staticElement);
_listener.assertNoErrors();
}
@@ -10990,7 +11626,7 @@
*/
Element resolve(BreakStatement statement, LabelElementImpl labelElement) {
resolveStatement(statement, labelElement);
- return statement.label.element;
+ return statement.label.staticElement;
}
/**
@@ -11003,7 +11639,7 @@
*/
Element resolve3(ContinueStatement statement, LabelElementImpl labelElement) {
resolveStatement(statement, labelElement);
- return statement.label.element;
+ return statement.label.staticElement;
}
/**
@@ -11017,7 +11653,7 @@
*/
Element resolve4(Identifier node, List<Element> definedElements) {
resolveNode(node, definedElements);
- return node.element;
+ return node.staticElement;
}
/**
@@ -11231,6 +11867,10 @@
final __test = new ElementResolverTest();
runJUnitTest(__test, __test.test_visitSimpleIdentifier_classScope);
});
+ _ut.test('test_visitSimpleIdentifier_dynamic', () {
+ final __test = new ElementResolverTest();
+ runJUnitTest(__test, __test.test_visitSimpleIdentifier_dynamic);
+ });
_ut.test('test_visitSimpleIdentifier_lexicalScope', () {
final __test = new ElementResolverTest();
runJUnitTest(__test, __test.test_visitSimpleIdentifier_lexicalScope);
@@ -11573,18 +12213,6 @@
StaticWarningCode.AMBIGUOUS_IMPORT,
CompileTimeErrorCode.EXTENDS_NON_CLASS]);
}
- void test_ambiguousImport_function() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "g() { return f(); }"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "f() {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "f() {}"]));
- resolve(source);
- assertErrors([
- StaticWarningCode.AMBIGUOUS_IMPORT,
- StaticTypeWarningCode.UNDEFINED_FUNCTION]);
- }
void test_ambiguousImport_implements() {
Source source = addSource(EngineTestCase.createSource([
"import 'lib1.dart';",
@@ -11774,6 +12402,17 @@
assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
verify([source]);
}
+ void test_argumentTypeNotAssignable_invocation_functionTypes_optional() {
+ Source source = addSource(EngineTestCase.createSource([
+ "void acceptFunNumOptBool(void funNumOptBool([bool b])) {}",
+ "void funNumBool(bool b) {}",
+ "main() {",
+ " acceptFunNumOptBool(funNumBool);",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
+ verify([source]);
+ }
void test_argumentTypeNotAssignable_invocation_generic() {
Source source = addSource(EngineTestCase.createSource([
"class A<T> {",
@@ -11870,8 +12509,7 @@
" static const v = 0;",
"}",
"f() {",
- " A a = new A();",
- " a.v = 1;",
+ " A.v = 1;",
"}"]));
resolve(source);
assertErrors([StaticWarningCode.ASSIGNMENT_TO_CONST]);
@@ -12155,6 +12793,16 @@
assertErrors([StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]);
verify([source]);
}
+ void test_fieldInitializedInInitializerAndDeclaration_final() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " final int x = 0;",
+ " A() : x = 1 {}",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
+ verify([source]);
+ }
void test_fieldInitializerNotAssignable() {
Source source = addSource(EngineTestCase.createSource(["class A {", " int x;", " A() : x = '';", "}"]));
resolve(source);
@@ -12167,6 +12815,28 @@
assertErrors([StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE]);
verify([source]);
}
+
+ /**
+ * This test doesn't test the FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR code, but tests the
+ * FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION code instead. It is provided here to show
+ * coverage over all of the permutations of initializers in constructor declarations.
+ *
+ * Note: FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION covers a subset of
+ * FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, since it more specific, we use it instead of
+ * the broader code
+ */
+ void test_finalInitializedInDeclarationAndConstructor_initializers() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " final x = 0;", " A() : x = 0 {}", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
+ verify([source]);
+ }
+ void test_finalInitializedInDeclarationAndConstructor_initializingFormal() {
+ Source source = addSource(EngineTestCase.createSource(["class A {", " final x = 0;", " A(this.x) {}", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR]);
+ verify([source]);
+ }
void test_finalNotInitialized_inConstructor() {
Source source = addSource(EngineTestCase.createSource(["class A {", " final int x;", " A() {}", "}"]));
resolve(source);
@@ -12509,6 +13179,54 @@
assertErrors([StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL]);
verify([source]);
}
+ void test_invalidOverrideNamed_fewerNamedParameters() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " m({a, b}) {}",
+ "}",
+ "class B extends A {",
+ " m({a}) {}",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.INVALID_OVERRIDE_NAMED]);
+ verify([source]);
+ }
+ void test_invalidOverrideNamed_missingNamedParameter() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " m({a, b}) {}",
+ "}",
+ "class B extends A {",
+ " m({a, c}) {}",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.INVALID_OVERRIDE_NAMED]);
+ verify([source]);
+ }
+ void test_invalidOverridePositional() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " m([a, b]) {}",
+ "}",
+ "class B extends A {",
+ " m([a]) {}",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.INVALID_OVERRIDE_POSITIONAL]);
+ verify([source]);
+ }
+ void test_invalidOverrideRequired() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " m(a) {}",
+ "}",
+ "class B extends A {",
+ " m(a, b) {}",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.INVALID_OVERRIDE_REQUIRED]);
+ verify([source]);
+ }
void test_invalidSetterOverrideNormalParamType() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -13041,6 +13759,41 @@
assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
verify([source]);
}
+ void test_undefinedIdentifier_hideInBlock_function() {
+ Source source = addSource(EngineTestCase.createSource([
+ "var v = 1;",
+ "main() {",
+ " print(v);",
+ " v() {}",
+ "}",
+ "print(x) {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
+ }
+ void test_undefinedIdentifier_hideInBlock_local() {
+ Source source = addSource(EngineTestCase.createSource([
+ "var v = 1;",
+ "main() {",
+ " print(v);",
+ " var v = 2;",
+ "}",
+ "print(x) {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
+ }
+ void test_undefinedIdentifier_hideInBlock_subBlock() {
+ Source source = addSource(EngineTestCase.createSource([
+ "var v = 1;",
+ "main() {",
+ " {",
+ " print(v);",
+ " }",
+ " var v = 2;",
+ "}",
+ "print(x) {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
+ }
void test_undefinedIdentifier_initializer() {
Source source = addSource(EngineTestCase.createSource(["var a = b;"]));
resolve(source);
@@ -13067,6 +13820,17 @@
resolve(source);
assertErrors([StaticWarningCode.UNDEFINED_NAMED_PARAMETER]);
}
+ void test_undefinedSetter() {
+ Source source1 = addSource2("lib.dart", "");
+ Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([
+ "import 'lib.dart' as lib;",
+ "void f() {",
+ " lib.gg = null;",
+ "}"]));
+ resolve(source1);
+ resolve(source2);
+ assertErrors([StaticWarningCode.UNDEFINED_SETTER]);
+ }
static dartSuite() {
_ut.group('StaticWarningCodeTest', () {
_ut.test('test_ambiguousImport_as', () {
@@ -13077,10 +13841,6 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_ambiguousImport_extends);
});
- _ut.test('test_ambiguousImport_function', () {
- final __test = new StaticWarningCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_function);
- });
_ut.test('test_ambiguousImport_implements', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_ambiguousImport_implements);
@@ -13145,6 +13905,10 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_functionParameter);
});
+ _ut.test('test_argumentTypeNotAssignable_invocation_functionTypes_optional', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_functionTypes_optional);
+ });
_ut.test('test_argumentTypeNotAssignable_invocation_generic', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_argumentTypeNotAssignable_invocation_generic);
@@ -13305,6 +14069,10 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_extraPositionalArguments);
});
+ _ut.test('test_fieldInitializedInInitializerAndDeclaration_final', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_fieldInitializedInInitializerAndDeclaration_final);
+ });
_ut.test('test_fieldInitializerNotAssignable', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_fieldInitializerNotAssignable);
@@ -13313,6 +14081,14 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_fieldInitializingFormalNotAssignable);
});
+ _ut.test('test_finalInitializedInDeclarationAndConstructor_initializers', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstructor_initializers);
+ });
+ _ut.test('test_finalInitializedInDeclarationAndConstructor_initializingFormal', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_finalInitializedInDeclarationAndConstructor_initializingFormal);
+ });
_ut.test('test_finalNotInitialized_inConstructor', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_finalNotInitialized_inConstructor);
@@ -13437,6 +14213,22 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_invalidOverrideDifferentDefaultValues_positional);
});
+ _ut.test('test_invalidOverrideNamed_fewerNamedParameters', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_invalidOverrideNamed_fewerNamedParameters);
+ });
+ _ut.test('test_invalidOverrideNamed_missingNamedParameter', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_invalidOverrideNamed_missingNamedParameter);
+ });
+ _ut.test('test_invalidOverridePositional', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_invalidOverridePositional);
+ });
+ _ut.test('test_invalidOverrideRequired', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_invalidOverrideRequired);
+ });
_ut.test('test_invalidSetterOverrideNormalParamType', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_invalidSetterOverrideNormalParamType);
@@ -13677,6 +14469,18 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix);
});
+ _ut.test('test_undefinedIdentifier_hideInBlock_function', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_function);
+ });
+ _ut.test('test_undefinedIdentifier_hideInBlock_local', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_local);
+ });
+ _ut.test('test_undefinedIdentifier_hideInBlock_subBlock', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedIdentifier_hideInBlock_subBlock);
+ });
_ut.test('test_undefinedIdentifier_initializer', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_initializer);
@@ -13697,6 +14501,10 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedNamedParameter);
});
+ _ut.test('test_undefinedSetter', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedSetter);
+ });
});
}
}
@@ -13801,6 +14609,11 @@
InterfaceType _mapType;
/**
+ * The type representing the built-in type 'Null'.
+ */
+ InterfaceType _nullType;
+
+ /**
* The type representing the built-in type 'num'.
*/
InterfaceType _numType;
@@ -13913,6 +14726,12 @@
}
return _mapType;
}
+ InterfaceType get nullType {
+ if (_nullType == null) {
+ _nullType = ElementFactory.classElement2("Null", []).type;
+ }
+ return _nullType;
+ }
InterfaceType get numType {
if (_numType == null) {
initializeNumericTypes();
@@ -13923,16 +14742,14 @@
if (_objectType == null) {
ClassElementImpl objectElement = ElementFactory.object;
_objectType = objectElement.type;
- if (objectElement.methods.length == 0) {
- objectElement.constructors = <ConstructorElement> [ElementFactory.constructorElement(objectElement, null)];
- objectElement.methods = <MethodElement> [
- ElementFactory.methodElement("toString", stringType, []),
- ElementFactory.methodElement("==", boolType, [_objectType]),
- ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicType])];
- objectElement.accessors = <PropertyAccessorElement> [
- ElementFactory.getterElement("hashCode", false, intType),
- ElementFactory.getterElement("runtimeType", false, typeType)];
- }
+ objectElement.constructors = <ConstructorElement> [ElementFactory.constructorElement(objectElement, null)];
+ objectElement.methods = <MethodElement> [
+ ElementFactory.methodElement("toString", stringType, []),
+ ElementFactory.methodElement("==", boolType, [_objectType]),
+ ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicType])];
+ objectElement.accessors = <PropertyAccessorElement> [
+ ElementFactory.getterElement("hashCode", false, intType),
+ ElementFactory.getterElement("runtimeType", false, typeType)];
}
return _objectType;
}
@@ -14102,6 +14919,7 @@
provider.intType.element,
provider.listType.element,
provider.mapType.element,
+ provider.nullType.element,
provider.numType.element,
provider.objectType.element,
provider.stackTraceType.element,
@@ -14368,7 +15186,7 @@
if (prefix == null) {
return null;
}
- return checkResolved2(prefix, prefix.element, PrefixElement);
+ return checkResolved2(prefix, prefix.staticElement, PrefixElement);
}
Object visitIndexExpression(IndexExpression node) {
node.visitChildren(this);
@@ -14400,7 +15218,7 @@
if (prefixType == null || prefixType.isDynamic) {
return null;
}
- return checkResolved(node, node.element);
+ return checkResolved(node, node.staticElement);
}
Object visitPrefixExpression(PrefixExpression node) {
node.visitChildren(this);
@@ -14428,7 +15246,7 @@
}
ASTNode parent = node.parent;
if (parent is MethodInvocation) {
- MethodInvocation invocation = (parent as MethodInvocation);
+ MethodInvocation invocation = parent as MethodInvocation;
if (identical(invocation.methodName, node)) {
Expression target = invocation.realTarget;
Type2 targetType = target == null ? null : target.staticType;
@@ -14437,7 +15255,7 @@
}
}
}
- return checkResolved(node, node.element);
+ return checkResolved(node, node.staticElement);
}
Object checkResolved(ASTNode node, Element element) => checkResolved2(node, element, null);
Object checkResolved2(ASTNode node, Element element, Type expectedClass) {
@@ -14456,7 +15274,7 @@
if (node != null) {
ASTNode root = node.root;
if (root is CompilationUnit) {
- CompilationUnit rootCU = (root as CompilationUnit);
+ CompilationUnit rootCU = root as CompilationUnit;
if (rootCU.element != null) {
return rootCU.element.source.fullName;
} else {
@@ -14978,7 +15796,7 @@
Type2 boolType = _typeProvider.boolType;
PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false, boolType);
PrefixedIdentifier node = ASTFactory.identifier5("a", "b");
- node.identifier.element = getter;
+ node.identifier.staticElement = getter;
JUnitTestCase.assertSame(boolType, analyze(node));
_listener.assertNoErrors();
}
@@ -14987,7 +15805,7 @@
FieldElementImpl field = ElementFactory.fieldElement("b", false, false, false, boolType);
PropertyAccessorElement setter = field.setter;
PrefixedIdentifier node = ASTFactory.identifier5("a", "b");
- node.identifier.element = setter;
+ node.identifier.staticElement = setter;
JUnitTestCase.assertSame(boolType, analyze(node));
_listener.assertNoErrors();
}
@@ -14995,7 +15813,7 @@
VariableElementImpl variable = ElementFactory.localVariableElement2("b");
variable.type = _typeProvider.boolType;
PrefixedIdentifier node = ASTFactory.identifier5("a", "b");
- node.identifier.element = variable;
+ node.identifier.staticElement = variable;
JUnitTestCase.assertSame(_typeProvider.boolType, analyze(node));
_listener.assertNoErrors();
}
@@ -15041,7 +15859,7 @@
Type2 boolType = _typeProvider.boolType;
PropertyAccessorElementImpl getter = ElementFactory.getterElement("b", false, boolType);
PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier3("a"), "b");
- node.propertyName.element = getter;
+ node.propertyName.staticElement = getter;
JUnitTestCase.assertSame(boolType, analyze(node));
_listener.assertNoErrors();
}
@@ -15050,7 +15868,7 @@
FieldElementImpl field = ElementFactory.fieldElement("b", false, false, false, boolType);
PropertyAccessorElement setter = field.setter;
PropertyAccess node = ASTFactory.propertyAccess2(ASTFactory.identifier3("a"), "b");
- node.propertyName.element = setter;
+ node.propertyName.staticElement = setter;
JUnitTestCase.assertSame(boolType, analyze(node));
_listener.assertNoErrors();
}
@@ -15130,7 +15948,7 @@
*/
Type2 analyze3(FormalParameter node) {
node.accept(_analyzer);
- return ((node.identifier.element as ParameterElement)).type;
+ return ((node.identifier.staticElement as ParameterElement)).type;
}
/**
@@ -15190,7 +16008,7 @@
void assertType2(Type2 expectedType, Type2 actualType) {
if (expectedType is InterfaceTypeImpl) {
EngineTestCase.assertInstanceOf(InterfaceTypeImpl, actualType);
- assertType((expectedType as InterfaceTypeImpl), (actualType as InterfaceTypeImpl));
+ assertType(expectedType as InterfaceTypeImpl, actualType as InterfaceTypeImpl);
}
}
@@ -15247,7 +16065,7 @@
ParameterElementImpl element = new ParameterElementImpl.con1(parameter.identifier);
element.parameterKind = parameter.kind;
element.type = _typeProvider.dynamicType;
- parameter.identifier.element = element;
+ parameter.identifier.staticElement = element;
parameterElements.add(element);
}
FunctionExpression node = ASTFactory.functionExpression2(parameters2, body);
@@ -15293,7 +16111,7 @@
SimpleIdentifier identifier = ASTFactory.identifier3(variableName);
VariableElementImpl element = ElementFactory.localVariableElement(identifier);
element.type = type2;
- identifier.element = element;
+ identifier.staticElement = element;
identifier.staticType = type2;
return identifier;
}
@@ -15306,10 +16124,10 @@
*/
void setType(FormalParameter parameter, Type2 type2) {
SimpleIdentifier identifier = parameter.identifier;
- Element element = identifier.element;
+ Element element = identifier.staticElement;
if (element is! ParameterElement) {
element = new ParameterElementImpl.con1(identifier);
- identifier.element = element;
+ identifier.staticElement = element;
}
((element as ParameterElementImpl)).type = type2;
}
@@ -15611,7 +16429,7 @@
verify([source]);
}
void test_unusedImport_export_infiniteLoop() {
- Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two one;"]));
+ Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two two;"]));
addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "export 'lib2.dart';", "class One {}"]));
addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "export 'lib3.dart';", "class Two {}"]));
addSource2("/lib3.dart", EngineTestCase.createSource(["library lib3;", "export 'lib2.dart';", "class Three {}"]));
@@ -15620,7 +16438,7 @@
verify([source]);
}
void test_unusedImport_export2() {
- Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two one;"]));
+ Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Three three;"]));
addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "export 'lib2.dart';", "class One {}"]));
addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "export 'lib3.dart';", "class Two {}"]));
addSource2("/lib3.dart", EngineTestCase.createSource(["library lib3;", "class Three {}"]));
@@ -15628,6 +16446,22 @@
assertNoErrors();
verify([source]);
}
+ void test_unusedImport_prefix_topLevelFunction() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'lib1.dart' hide topLevelFunction;",
+ "import 'lib1.dart' as one show topLevelFunction;",
+ "class A {",
+ " static void x() {",
+ " One o;",
+ " one.topLevelFunction();",
+ " }",
+ "}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class One {}", "topLevelFunction() {}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
static dartSuite() {
_ut.group('NonHintCodeTest', () {
_ut.test('test_deadCode_deadCatch_onCatchSubtype', () {
@@ -15646,6 +16480,10 @@
final __test = new NonHintCodeTest();
runJUnitTest(__test, __test.test_unusedImport_export_infiniteLoop);
});
+ _ut.test('test_unusedImport_prefix_topLevelFunction', () {
+ final __test = new NonHintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport_prefix_topLevelFunction);
+ });
});
}
}
@@ -16555,7 +17393,7 @@
CompilationUnit unit = resolveCompilationUnit(source, library);
JUnitTestCase.assertNotNull(unit);
ClassDeclaration classDeclaration = unit.declarations[0] as ClassDeclaration;
- MethodDeclaration methodDeclaration = (classDeclaration.members[0] as MethodDeclaration);
+ MethodDeclaration methodDeclaration = classDeclaration.members[0] as MethodDeclaration;
Block block = ((methodDeclaration.body as BlockFunctionBody)).block;
ExpressionStatement statement = block.statements[0] as ExpressionStatement;
MethodInvocation invocation = statement.expression as MethodInvocation;
diff --git a/pkg/analyzer_experimental/test/generated/scanner_test.dart b/pkg/analyzer_experimental/test/generated/scanner_test.dart
index e3dbb64..6317f92 100644
--- a/pkg/analyzer_experimental/test/generated/scanner_test.dart
+++ b/pkg/analyzer_experimental/test/generated/scanner_test.dart
@@ -2147,7 +2147,7 @@
}
Token scan(String source, GatheringErrorListener listener);
void assertComment(TokenType commentType, String source) {
- Token token = scan2("${source}\n");
+ Token token = scan2(source);
JUnitTestCase.assertNotNull(token);
JUnitTestCase.assertEquals(TokenType.EOF, token.type);
Token comment = token.precedingComments;
@@ -2156,6 +2156,15 @@
JUnitTestCase.assertEquals(0, comment.offset);
JUnitTestCase.assertEquals(source.length, comment.length);
JUnitTestCase.assertEquals(source, comment.lexeme);
+ token = scan2("${source}\n");
+ JUnitTestCase.assertNotNull(token);
+ JUnitTestCase.assertEquals(TokenType.EOF, token.type);
+ comment = token.precedingComments;
+ JUnitTestCase.assertNotNull(comment);
+ JUnitTestCase.assertEquals(commentType, comment.type);
+ JUnitTestCase.assertEquals(0, comment.offset);
+ JUnitTestCase.assertEquals(source.length, comment.length);
+ JUnitTestCase.assertEquals(source, comment.lexeme);
}
/**
diff --git a/pkg/analyzer_experimental/test/generated/test_support.dart b/pkg/analyzer_experimental/test/generated/test_support.dart
index 8ec0c66..6d7ae8f 100644
--- a/pkg/analyzer_experimental/test/generated/test_support.dart
+++ b/pkg/analyzer_experimental/test/generated/test_support.dart
@@ -1,9 +1,7 @@
// This code was auto-generated, is not intended to be edited, and is subject to
// significant change. Please see the README file for more information.
library engine.test_support;
-import 'dart:collection';
import 'package:analyzer_experimental/src/generated/java_core.dart';
-import 'package:analyzer_experimental/src/generated/java_engine.dart';
import 'package:analyzer_experimental/src/generated/java_junit.dart';
import 'package:analyzer_experimental/src/generated/source.dart';
import 'package:analyzer_experimental/src/generated/error.dart';
@@ -506,7 +504,7 @@
* @param expectedElements the expected elements
* @throws AssertionFailedError if the list is `null` or does not have the expected elements
*/
- static void assertExactElements(List<Object> list, List<Object> expectedElements) {
+ static void assertExactElements(List list, List<Object> expectedElements) {
int expectedSize = expectedElements.length;
if (list == null) {
JUnitTestCase.fail("Expected list of size ${expectedSize}; found null");
@@ -555,7 +553,7 @@
* @param expectedElements the expected elements
* @throws AssertionFailedError if the list is `null` or does not have the expected elements
*/
- static void assertExactElements3(Set<Object> set, List<Object> expectedElements) {
+ static void assertExactElements3(Set set, List<Object> expectedElements) {
int expectedSize = expectedElements.length;
if (set == null) {
JUnitTestCase.fail("Expected list of size ${expectedSize}; found null");
@@ -629,7 +627,7 @@
* @throws AssertionFailedError if the list is `null` or does not have the expected number
* of elements
*/
- static void assertSize(int expectedSize, List<Object> list) {
+ static void assertSize(int expectedSize, List list) {
if (list == null) {
JUnitTestCase.fail("Expected list of size ${expectedSize}; found null");
} else if (list.length != expectedSize) {
@@ -645,7 +643,7 @@
* @throws AssertionFailedError if the map is `null` or does not have the expected number of
* elements
*/
- static void assertSize2(int expectedSize, Map<Object, Object> map) {
+ static void assertSize2(int expectedSize, Map map) {
if (map == null) {
JUnitTestCase.fail("Expected map of size ${expectedSize}; found null");
} else if (map.length != expectedSize) {
@@ -661,7 +659,7 @@
* @throws AssertionFailedError if the set is `null` or does not have the expected number of
* elements
*/
- static void assertSize3(int expectedSize, Set<Object> set) {
+ static void assertSize3(int expectedSize, Set set) {
if (set == null) {
JUnitTestCase.fail("Expected set of size ${expectedSize}; found null");
} else if (set.length != expectedSize) {
diff --git a/pkg/analyzer_experimental/test/options_test.dart b/pkg/analyzer_experimental/test/options_test.dart
index e885cda..67b8467 100644
--- a/pkg/analyzer_experimental/test/options_test.dart
+++ b/pkg/analyzer_experimental/test/options_test.dart
@@ -5,7 +5,7 @@
library options_test;
import 'package:unittest/unittest.dart';
-import 'package:analyzer_experimental/options.dart';
+//import 'package:analyzer_experimental/options.dart';
main() {
diff --git a/pkg/barback/lib/src/phase.dart b/pkg/barback/lib/src/phase.dart
index a73ee00..48fd46f 100644
--- a/pkg/barback/lib/src/phase.dart
+++ b/pkg/barback/lib/src/phase.dart
@@ -165,7 +165,7 @@
}
/// Remove all phases after this one.
- Phase removeFollowing() {
+ void removeFollowing() {
if (_next == null) return;
_next.remove();
_next = null;
diff --git a/pkg/barback/lib/src/phase_input.dart b/pkg/barback/lib/src/phase_input.dart
index 7ba6c20..840b564 100644
--- a/pkg/barback/lib/src/phase_input.dart
+++ b/pkg/barback/lib/src/phase_input.dart
@@ -11,6 +11,7 @@
import 'asset_forwarder.dart';
import 'asset_node.dart';
import 'errors.dart';
+import 'phase.dart';
import 'stream_pool.dart';
import 'transform_node.dart';
import 'transformer.dart';
diff --git a/pkg/barback/lib/src/phase_output.dart b/pkg/barback/lib/src/phase_output.dart
index 8082e54..1bfb8d4 100644
--- a/pkg/barback/lib/src/phase_output.dart
+++ b/pkg/barback/lib/src/phase_output.dart
@@ -8,12 +8,9 @@
import 'dart:collection';
import 'asset_cascade.dart';
-import 'asset_id.dart';
import 'asset_node.dart';
import 'errors.dart';
-import 'phase_input.dart';
-import 'stream_pool.dart';
-import 'transformer.dart';
+import 'phase.dart';
import 'utils.dart';
/// A class that handles a single output of a phase.
@@ -113,7 +110,7 @@
_outputController.setAvailable(newOutput.asset);
} else {
assert(newOutput.isDirty);
- if (!output.isDirty) _outputController.setDirty();
+ if (!output.state.isDirty) _outputController.setDirty();
}
}
diff --git a/pkg/barback/lib/src/transform.dart b/pkg/barback/lib/src/transform.dart
index d5d7176..304618f 100644
--- a/pkg/barback/lib/src/transform.dart
+++ b/pkg/barback/lib/src/transform.dart
@@ -5,6 +5,7 @@
library barback.transform;
import 'dart:async';
+import 'dart:convert';
import 'asset.dart';
import 'asset_id.dart';
@@ -13,6 +14,7 @@
import 'errors.dart';
import 'transform_logger.dart';
import 'transform_node.dart';
+import 'utils.dart';
/// Creates a [Transform] by forwarding to the private constructor.
///
@@ -34,7 +36,10 @@
final AssetSet _outputs;
- /// Gets the ID of the primary input for this transformation.
+ /// A logger so that the [Transformer] can report build details.
+ TransformLogger get logger => _logger;
+
+ /// Gets the primary input asset.
///
/// While a transformation can use multiple input assets, one must be a
/// special "primary" asset. This will be the "entrypoint" or "main" input
@@ -43,13 +48,19 @@
/// For example, with a dart2js transform, the primary input would be the
/// entrypoint Dart file. All of the other Dart files that that imports
/// would be secondary inputs.
- AssetId get primaryId => _node.primary.id;
+ ///
+ /// This method may fail at runtime if called asynchronously after the
+ /// transform begins running. The primary input may become unavailable while
+ /// this transformer is running due to asset changes earlier in the graph.
+ /// You can ignore the error if this happens: the transformer will be re-run
+ /// automatically for you.
+ Asset get primaryInput {
+ if (_node.primary.state != AssetState.AVAILABLE) {
+ throw new AssetNotFoundException(_node.primary.id);
+ }
- /// A logger so that the [Transformer] can report build details.
- TransformLogger get logger => _logger;
-
- /// Gets the asset for the primary input.
- Future<Asset> get primaryInput => getInput(primaryId);
+ return _node.primary.asset;
+ }
Transform._(this._node, this._outputs);
@@ -59,6 +70,26 @@
/// [AssetNotFoundException].
Future<Asset> getInput(AssetId id) => _node.getInput(id);
+ /// A convenience method to the contents of the input with [id] as a string.
+ ///
+ /// This is equivalent to calling `getInput()` followed by `readAsString()`.
+ ///
+ /// If the asset was created from a [String] the original string is always
+ /// returned and [encoding] is ignored. Otherwise, the binary data of the
+ /// asset is decoded using [encoding], which defaults to [UTF8].
+ Future<String> readInputAsString(AssetId id, {Encoding encoding}) {
+ if (encoding == null) encoding = UTF8;
+ return getInput(id).then((input) => input.readAsString(encoding: encoding));
+ }
+
+ /// A convenience method to the contents of the input with [id].
+ ///
+ /// This is equivalent to calling `getInput()` followed by `read()`.
+ ///
+ /// If the asset was created from a [String], this returns its UTF-8 encoding.
+ Stream<List<int>> readInput(AssetId id) =>
+ futureStream(getInput(id).then((input) => input.read()));
+
/// Stores [output] as the output created by this transformation.
///
/// A transformation can output as many assets as it wants.
diff --git a/pkg/barback/lib/src/utils.dart b/pkg/barback/lib/src/utils.dart
index 0a41c8e..37816bc 100644
--- a/pkg/barback/lib/src/utils.dart
+++ b/pkg/barback/lib/src/utils.dart
@@ -179,3 +179,20 @@
/// Like [new Future], but avoids issue 11911 by using [new Future.value] under
/// the covers.
Future newFuture(callback()) => new Future.value().then((_) => callback());
+
+/// Returns a buffered stream that will emit the same values as the stream
+/// returned by [future] once [future] completes. If [future] completes to an
+/// error, the return value will emit that error and then close.
+Stream futureStream(Future<Stream> future) {
+ var controller = new StreamController(sync: true);
+ future.then((stream) {
+ stream.listen(
+ controller.add,
+ onError: (error) => controller.addError(error),
+ onDone: controller.close);
+ }).catchError((e) {
+ controller.addError(e);
+ controller.close();
+ });
+ return controller.stream;
+}
diff --git a/pkg/barback/test/package_graph/transform_test.dart b/pkg/barback/test/package_graph/transform_test.dart
index 8c108b3..af8df48 100644
--- a/pkg/barback/test/package_graph/transform_test.dart
+++ b/pkg/barback/test/package_graph/transform_test.dart
@@ -1095,5 +1095,38 @@
expectAsset("pkg1|a.out", "b");
buildShouldSucceed();
});
+
+ test("re-runs if the primary input is invalidated before accessing", () {
+ var transformer1 = new RewriteTransformer("txt", "mid");
+ var transformer2 = new RewriteTransformer("mid", "out");
+
+ initGraph([
+ "app|foo.txt"
+ ], {"app": [
+ [transformer1],
+ [transformer2]
+ ]});
+
+ transformer2.pausePrimaryInput();
+ updateSources(["app|foo.txt"]);
+
+ // Wait long enough to ensure that transformer1 has completed and
+ // transformer2 has started.
+ schedule(pumpEventQueue);
+
+ // Update the source again so that transformer1 invalidates the primary
+ // input of transformer2.
+ transformer1.pauseApply();
+ updateSources(["app|foo.txt"]);
+
+ transformer2.resumePrimaryInput();
+ transformer1.resumeApply();
+
+ expectAsset("app|foo.out", "foo.mid.out");
+ buildShouldSucceed();
+
+ expect(transformer1.numRuns, completion(equals(2)));
+ expect(transformer2.numRuns, completion(equals(2)));
+ });
});
}
diff --git a/pkg/barback/test/transformer/many_to_one.dart b/pkg/barback/test/transformer/many_to_one.dart
index 59a190c..ab56202 100644
--- a/pkg/barback/test/transformer/many_to_one.dart
+++ b/pkg/barback/test/transformer/many_to_one.dart
@@ -36,12 +36,12 @@
if (path.contains("|")) {
id = new AssetId.parse(path);
} else {
- id = new AssetId(transform.primaryId.package, path);
+ id = new AssetId(transform.primaryInput.id.package, path);
}
return getInput(transform, id).then((input) => input.readAsString());
}));
}).then((outputs) {
- var id = transform.primaryId.changeExtension(".out");
+ var id = transform.primaryInput.id.changeExtension(".out");
transform.addOutput(new Asset.fromString(id, outputs.join()));
});
}
diff --git a/pkg/barback/test/transformer/mock.dart b/pkg/barback/test/transformer/mock.dart
index 0887002..57d3f07 100644
--- a/pkg/barback/test/transformer/mock.dart
+++ b/pkg/barback/test/transformer/mock.dart
@@ -30,17 +30,20 @@
/// The number of currently running transforms.
int _runningTransforms = 0;
- // A completer for pausing the transformer before it finishes running [apply].
+ /// A completer for pausing the transformer before it finishes running [apply].
Completer _apply;
- // Completers for pausing the transformer before it finishes running
- // [isPrimary].
+ /// Completers for pausing the transformer before it finishes running
+ /// [isPrimary].
final _isPrimary = new Map<AssetId, Completer>();
- // Completers for pausing the transformer before it finishes getting inputs
- // the [Transform].
+ /// Completers for pausing the transformer before it finishes getting inputs
+ /// the [Transform].
final _getInput = new Map<AssetId, Completer>();
+ /// Completer for pausing the transformer before it accesses [primaryInput].
+ Completer _primaryInput;
+
/// A completer that completes once this transformer begins running.
///
/// Once this transformer finishes running, this is reset to a new completer,
@@ -99,8 +102,8 @@
}, "resume isPrimary($name) for $this");
}
- /// Causes the transformer to pause while loading the input with the given
- /// [name]. This can be the primary input or a secondary input.
+ /// Causes the transformer to pause while loading the secondary input with
+ /// the given [name].
///
/// This can be resumed by calling [resumeGetInput]. This operation is
/// scheduled.
@@ -120,6 +123,27 @@
}, "resume getInput($name) for $this");
}
+ /// Causes the transformer to pause before accessing [primaryInput].
+ ///
+ /// This can be resumed by calling [resumeGetPrimary]. This operation is
+ /// scheduled.
+ void pausePrimaryInput() {
+ schedule(() {
+ _primaryInput = new Completer();
+ }, "pause primaryInput for $this");
+ }
+
+ /// Resumes the transformer's invocation of [primaryInput] after
+ /// [pauseGetPrimary] was called.
+ ///
+ /// This operation is scheduled.
+ void resumePrimaryInput() {
+ schedule(() {
+ _primaryInput.complete();
+ _primaryInput = null;
+ }, "resume getPrimary() for $this");
+ }
+
/// Like [Transform.getInput], but respects [pauseGetInput].
///
/// This is intended for use by subclasses of [MockTransformer].
@@ -129,11 +153,14 @@
}).then((_) => transform.getInput(id));
}
- /// Like [Transform.primaryInput], but respects [pauseGetInput].
+ /// Like [Transform.primaryInput], but respects [pauseGetPrimary].
///
/// This is intended for use by subclasses of [MockTransformer].
- Future<Asset> getPrimary(Transform transform) =>
- getInput(transform, transform.primaryId);
+ Future<Asset> getPrimary(Transform transform) {
+ return newFuture(() {
+ if (_primaryInput != null) return _primaryInput.future;
+ }).then((_) => transform.primaryInput);
+ }
Future<bool> isPrimary(Asset asset) {
return newFuture(() => doIsPrimary(asset)).then((result) {
diff --git a/pkg/barback/test/transformer/one_to_many.dart b/pkg/barback/test/transformer/one_to_many.dart
index e9d301d..b3b2f5e 100644
--- a/pkg/barback/test/transformer/one_to_many.dart
+++ b/pkg/barback/test/transformer/one_to_many.dart
@@ -29,7 +29,7 @@
.then((input) => input.readAsString())
.then((lines) {
for (var line in lines.split(",")) {
- var id = new AssetId(transform.primaryId.package, line);
+ var id = new AssetId(transform.primaryInput.id.package, line);
transform.addOutput(new Asset.fromString(id, "spread $extension"));
}
});
diff --git a/pkg/barback/test/transformer/rewrite.dart b/pkg/barback/test/transformer/rewrite.dart
index 4d3faa88..6525b07 100644
--- a/pkg/barback/test/transformer/rewrite.dart
+++ b/pkg/barback/test/transformer/rewrite.dart
@@ -31,7 +31,7 @@
Future doApply(Transform transform) {
return getPrimary(transform).then((input) {
return Future.wait(to.split(" ").map((extension) {
- var id = transform.primaryId.changeExtension(".$extension");
+ var id = input.id.changeExtension(".$extension");
return input.readAsString().then((content) {
transform.addOutput(new Asset.fromString(id, "$content.$extension"));
});
diff --git a/pkg/barback/test/utils.dart b/pkg/barback/test/utils.dart
index 798b958..7fb1a23 100644
--- a/pkg/barback/test/utils.dart
+++ b/pkg/barback/test/utils.dart
@@ -7,7 +7,6 @@
import 'dart:async';
import 'dart:collection';
import 'dart:convert' show Encoding;
-import 'dart:io';
import 'package:barback/barback.dart';
import 'package:barback/src/cancelable_future.dart';
diff --git a/pkg/custom_element/lib/custom_element.dart b/pkg/custom_element/lib/custom_element.dart
index db0c3b8..202a0ee 100644
--- a/pkg/custom_element/lib/custom_element.dart
+++ b/pkg/custom_element/lib/custom_element.dart
@@ -471,17 +471,6 @@
int get scrollWidth => host.scrollWidth;
- String $dom_getAttribute(String name) =>
- host.$dom_getAttribute(name);
-
- String $dom_getAttributeNS(String namespaceUri, String localName) =>
- host.$dom_getAttributeNS(namespaceUri, localName);
-
- String $dom_setAttributeNS(
- String namespaceUri, String localName, String value) {
- host.$dom_setAttributeNS(namespaceUri, localName, value);
- }
-
Rect getBoundingClientRect() => host.getBoundingClientRect();
List<Rect> getClientRects() => host.getClientRects();
@@ -489,11 +478,6 @@
List<Node> getElementsByClassName(String name) =>
host.getElementsByClassName(name);
- void $dom_setAttribute(String name, String value) =>
- host.$dom_setAttribute(name, value);
-
- List<Node> get $dom_childNodes => host.$dom_childNodes;
-
Node get firstChild => host.firstChild;
Node get lastChild => host.lastChild;
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index 6faca3f5..13f83af 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -15,8 +15,8 @@
*/
library docgen;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json';
import 'dart:async';
import 'package:logging/logging.dart';
@@ -253,7 +253,8 @@
if (!docsDir.contains('docs/library_list.json')) {
throw new StateError('No library_list.json');
}
- libraryMap = parse(new File('docs/library_list.json').readAsStringSync());
+ libraryMap =
+ JSON.decode(new File('docs/library_list.json').readAsStringSync());
libraryMap['libraries'].addAll(filteredEntities
.where((e) => e is Library)
.map((e) => e.previewMap));
@@ -277,7 +278,7 @@
'filetype' : outputToYaml ? 'yaml' : 'json'
};
}
- _writeToFile(stringify(libraryMap), 'library_list.json');
+ _writeToFile(JSON.encode(libraryMap), 'library_list.json');
// Output libraries and classes to file after all information is generated.
filteredEntities.where((e) => e is Class || e is Library).forEach((output) {
_writeIndexableToFile(output, outputToYaml);
@@ -303,7 +304,7 @@
if (outputToYaml) {
_writeToFile(getYamlString(result.toMap()), '${result.qualifiedName}.yaml');
} else {
- _writeToFile(stringify(result.toMap()), '${result.qualifiedName}.json');
+ _writeToFile(JSON.encode(result.toMap()), '${result.qualifiedName}.json');
}
}
@@ -399,7 +400,7 @@
// Reading in MDN related json file.
var mdnDir = path.join(path.dirname(path.dirname(path.dirname(path.dirname(
path.absolute(new Options().script))))), 'utils', 'apidoc', 'mdn');
- _mdn = parse(new File(path.join(mdnDir, 'database.json'))
+ _mdn = JSON.decode(new File(path.join(mdnDir, 'database.json'))
.readAsStringSync());
}
if (item.comment.isNotEmpty) return;
diff --git a/pkg/fixnum/lib/src/int64.dart b/pkg/fixnum/lib/src/int64.dart
index 036a06b..f5a0810 100644
--- a/pkg/fixnum/lib/src/int64.dart
+++ b/pkg/fixnum/lib/src/int64.dart
@@ -794,7 +794,7 @@
r = d0 - q * fatRadix;
d0 = q;
- assert(chunk2 == "");
+ assert(chunk3 == "");
chunk3 = chunk2;
chunk2 = chunk1;
// Adding [fatRadix] Forces an extra digit which we discard to get a fixed
diff --git a/pkg/fixnum/test/int_64_test.dart b/pkg/fixnum/test/int_64_test.dart
index 20f2822..d781984 100644
--- a/pkg/fixnum/test/int_64_test.dart
+++ b/pkg/fixnum/test/int_64_test.dart
@@ -562,6 +562,13 @@
// Overflow during parsing.
check("9223372036854775808", 10, "-9223372036854775808");
});
+
+ test("parseRadixN", () {
+ check(String s, int r) {
+ expect(Int64.parseRadix(s, r).toRadixString(r), s);
+ }
+ check("2ppp111222333", 33); // This value & radix requires three chunks.
+ });
});
group("string representation", () {
diff --git a/pkg/http/lib/testing.dart b/pkg/http/lib/testing.dart
index 9fe7b06..45d2c61 100644
--- a/pkg/http/lib/testing.dart
+++ b/pkg/http/lib/testing.dart
@@ -8,14 +8,14 @@
/// allows test code to set up a local request handler in order to fake a server
/// that responds to HTTP requests:
///
-/// import 'dart:json' as json;
+/// import 'dart:convert';
/// import 'package:http/testing.dart';
///
/// var client = new MockClient((request) {
/// if (request.url.path != "/data.json") {
/// return new Response("", 404);
/// }
-/// return new Response(json.stringify({
+/// return new Response(JSON.encode({
/// 'numbers': [1, 4, 15, 19, 214]
/// }, 200, headers: {
/// 'content-type': 'application/json'
diff --git a/pkg/http/test/mock_client_test.dart b/pkg/http/test/mock_client_test.dart
index 997f0bb..07066ec 100644
--- a/pkg/http/test/mock_client_test.dart
+++ b/pkg/http/test/mock_client_test.dart
@@ -5,7 +5,7 @@
library mock_client_test;
import 'dart:async';
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:http/src/utils.dart';
@@ -18,7 +18,7 @@
test('handles a request', () {
var client = new MockClient((request) {
return new Future.value(new http.Response(
- json.stringify(request.bodyFields), 200,
+ JSON.encode(request.bodyFields), 200,
request: request, headers: {'content-type': 'application/json'}));
});
diff --git a/pkg/http/test/utils.dart b/pkg/http/test/utils.dart
index 7b42bec..f9a7381 100644
--- a/pkg/http/test/utils.dart
+++ b/pkg/http/test/utils.dart
@@ -7,7 +7,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:http/src/byte_stream.dart';
import 'package:http/src/utils.dart';
@@ -96,7 +95,7 @@
content['headers'][name] = values;
});
- var body = json.stringify(content);
+ var body = JSON.encode(content);
response.contentLength = body.length;
response.write(body);
response.close();
@@ -154,7 +153,7 @@
var parsed;
try {
- parsed = json.parse(item);
+ parsed = JSON.decode(item);
} catch (e) {
return false;
}
diff --git a/pkg/http_server/lib/http_server.dart b/pkg/http_server/lib/http_server.dart
index 7176330..aad6401 100644
--- a/pkg/http_server/lib/http_server.dart
+++ b/pkg/http_server/lib/http_server.dart
@@ -7,7 +7,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
-import 'dart:json' as JSON;
import 'package:mime/mime.dart';
import "package:path/path.dart";
diff --git a/pkg/http_server/lib/src/http_body_impl.dart b/pkg/http_server/lib/src/http_body_impl.dart
index c48db03..b1186405 100644
--- a/pkg/http_server/lib/src/http_body_impl.dart
+++ b/pkg/http_server/lib/src/http_body_impl.dart
@@ -115,7 +115,7 @@
return asText(UTF8)
.then((body) => new _HttpBody(contentType,
"json",
- JSON.parse(body.body)));
+ JSON.decode(body.body)));
case "x-www-form-urlencoded":
return asText(ASCII)
diff --git a/pkg/intl/lib/date_format.dart b/pkg/intl/lib/date_format.dart
index 202ae1b..17aca41 100644
--- a/pkg/intl/lib/date_format.dart
+++ b/pkg/intl/lib/date_format.dart
@@ -252,7 +252,8 @@
/**
* Given user input, attempt to parse the [inputString] into the anticipated
- * format, treating it as being in the local timezone.
+ * format, treating it as being in the local timezone. If [inputString] does
+ * not match our format, throws a [FormatException].
*/
DateTime parse(String inputString, [utc = false]) {
// TODO(alanknight): The Closure code refers to special parsing of numeric
diff --git a/pkg/intl/lib/generate_localized.dart b/pkg/intl/lib/generate_localized.dart
index 5f9639f..285e05e 100644
--- a/pkg/intl/lib/generate_localized.dart
+++ b/pkg/intl/lib/generate_localized.dart
@@ -159,19 +159,22 @@
for (var locale in allLocales) {
var baseFile = '${generatedFilePrefix}messages_$locale.dart';
var file = importForGeneratedFile(baseFile);
- output.write("@${_deferredName(locale)}\n");
+ // TODO(alanknight): Restore this once deferred loading works in dartj2s.
+ // Issue 12824
+ // output.write("@${_deferredName(locale)}\n");
output.write("import '$file' as ${_libraryName(locale)};\n");
}
output.write("\n");
- for (var locale in allLocales) {
- output.write("const ${_deferredName(locale)} = const DeferredLibrary");
- output.write("('${_libraryName(locale)}');\n");
- }
- output.write("\nconst deferredLibraries = const {\n");
- for (var locale in allLocales) {
- output.write(" '$locale' : ${_deferredName(locale)},\n");
- }
- output.write("};\n");
+ // Issue 12824
+ //for (var locale in allLocales) {
+ // output.write("const ${_deferredName(locale)} = const DeferredLibrary");
+ // output.write("('${_libraryName(locale)}');\n");
+ //}
+ //output.write("\nconst deferredLibraries = const {\n");
+ //for (var locale in allLocales) {
+ // output.write(" '$locale' : ${_deferredName(locale)},\n");
+ //}
+ //output.write("};\n");
output.write(
"\nMessageLookupByLibrary _findExact(localeName) {\n"
" switch (localeName) {\n");
@@ -215,8 +218,10 @@
Future initializeMessages(String localeName) {
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
- var lib = deferredLibraries[localeName];
- return lib == null ? new Future.value(false) : lib.load();
+ // TODO(alanknight): Restore once Issue 12824 is fixed.
+ // var lib = deferredLibraries[localeName];
+ // return lib == null ? new Future.value(false) : lib.load();
+ return new Future.value(true);
}
MessageLookupByLibrary _findGeneratedMessagesFor(locale) {
diff --git a/pkg/intl/lib/src/lazy_locale_data.dart b/pkg/intl/lib/src/lazy_locale_data.dart
index 90ff3a1..ecef1ab 100644
--- a/pkg/intl/lib/src/lazy_locale_data.dart
+++ b/pkg/intl/lib/src/lazy_locale_data.dart
@@ -10,8 +10,8 @@
library lazy_locale_data;
import 'dart:async';
+import 'dart:convert';
import 'intl_helpers.dart';
-import 'dart:json' as json;
/**
* This implements the very basic map-type operations which are used
@@ -108,6 +108,6 @@
* return another future that parses the JSON into a usable format.
*/
Future jsonData(Future input) {
- return input.then( (response) => json.parse(response));
+ return input.then( (response) => JSON.decode(response));
}
}
diff --git a/pkg/intl/test/message_extraction/extract_to_json.dart b/pkg/intl/test/message_extraction/extract_to_json.dart
index 9720506..ea7695e 100644
--- a/pkg/intl/test/message_extraction/extract_to_json.dart
+++ b/pkg/intl/test/message_extraction/extract_to_json.dart
@@ -20,9 +20,9 @@
*/
library extract_to_json;
+import 'dart:convert';
import 'dart:io';
import 'package:intl/extract_messages.dart';
-import 'dart:json' as json;
import 'package:path/path.dart' as path;
import 'package:intl/src/intl_message.dart';
import 'package:args/args.dart';
@@ -50,7 +50,7 @@
messages.forEach((k, v) => allMessages.add(toJson(v)));
}
var file = new File(path.join(targetDir, 'intl_messages.json'));
- file.writeAsStringSync(json.stringify(allMessages));
+ file.writeAsStringSync(JSON.encode(allMessages));
if (hasWarnings && warningsAreErrors) {
exit(1);
}
diff --git a/pkg/intl/test/message_extraction/foo_messages_all.dart b/pkg/intl/test/message_extraction/foo_messages_all.dart
new file mode 100644
index 0000000..829df89
--- /dev/null
+++ b/pkg/intl/test/message_extraction/foo_messages_all.dart
@@ -0,0 +1,40 @@
+/**
+ * DO NOT EDIT. This is code generated via pkg/intl/generate_localized.dart
+ * This is a library that looks up messages for specific locales by
+ * delegating to the appropriate library.
+ */
+
+library messages_all;
+
+import 'dart:async';
+import 'package:intl/message_lookup_by_library.dart';
+import 'package:intl/src/intl_helpers.dart';
+import 'package:intl/intl.dart';
+
+import 'foo_messages_fr.dart' as fr;
+import 'foo_messages_de_DE.dart' as de_DE;
+
+
+MessageLookupByLibrary _findExact(localeName) {
+ switch (localeName) {
+ case 'fr' : return fr.messages;
+ case 'de_DE' : return de_DE.messages;
+ default: return null;
+ }
+}
+
+/** User programs should call this before using [localeName] for messages.*/
+Future initializeMessages(String localeName) {
+ initializeInternalMessageLookup(() => new CompositeMessageLookup());
+ messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
+ // TODO(alanknight): Restore once Issue 12824 is fixed.
+ // var lib = deferredLibraries[localeName];
+ // return lib == null ? new Future.value(false) : lib.load();
+ return new Future.value(true);
+}
+
+MessageLookupByLibrary _findGeneratedMessagesFor(locale) {
+ var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null);
+ if (actualLocale == null) return null;
+ return _findExact(actualLocale);
+}
diff --git a/pkg/intl/test/message_extraction/foo_messages_de_DE.dart b/pkg/intl/test/message_extraction/foo_messages_de_DE.dart
new file mode 100644
index 0000000..18f321c
--- /dev/null
+++ b/pkg/intl/test/message_extraction/foo_messages_de_DE.dart
@@ -0,0 +1,83 @@
+/**
+ * DO NOT EDIT. This is code generated via pkg/intl/generate_localized.dart
+ * This is a library that provides messages for a de_DE locale. All the
+ * messages from the main program should be duplicated here with the same
+ * function name.
+ */
+
+library messages_de_DE;
+import 'package:intl/intl.dart';
+import 'package:intl/message_lookup_by_library.dart';
+
+final messages = new MessageLookup();
+
+class MessageLookup extends MessageLookupByLibrary {
+
+ get localeName => 'de_DE';
+ static alwaysTranslated() => "Diese Zeichenkette wird immer übersetzt";
+
+ static escapable() => "Escapes: \n\r\f\b\t\v.";
+
+ static leadingQuotes() => "\"Sogenannt\"";
+
+ static message1() => "Dies ist eine Nachricht";
+
+ static message2(x) => "Eine weitere Meldung mit dem Parameter $x";
+
+ static message3(a, b, c) => "Zeichen, die Flucht benötigen, zB Schrägstriche \\ Dollar \${ (geschweiften Klammern sind ok) und xml reservierte Zeichen <& und Zitate \" Parameter $a, $b und $c";
+
+ static method() => "Dies ergibt sich aus einer Methode";
+
+ static multiLine() => "Dieser String erstreckt sich über mehrere Zeilen erstrecken.";
+
+ static nestedMessage(names, number, combinedGender, place) => "${Intl.gender(combinedGender, female: '${Intl.plural(number, one: '$names ging in dem $place', other: '$names gingen zum $place')}', other: '${Intl.plural(number, zero: 'Niemand ging zu $place', one: '${names} ging zum $place', other: '${names} gingen zum $place')}')}";
+
+ static nestedOuter(number, gen) => "${Intl.plural(number, other: '${Intl.gender(gen, male: '$number Mann', other: '$number andere')}')}";
+
+ static nestedSelect(currency, amount) => "${Intl.select(currency, {'CDN': '${Intl.plural(amount, one: '$amount Kanadischer dollar', other: '$amount Kanadischen dollar')}', 'other': 'whatever', })}";
+
+ static nonLambda() => "Diese Methode ist nicht eine Lambda";
+
+ static originalNotInBMP() => "Antike griechische Galgenmännchen Zeichen: 𐅆𐅇";
+
+ static outerGender(g) => "${Intl.gender(g, female: 'Frau', male: 'Mann', other: 'andere')}";
+
+ static outerPlural(n) => "${Intl.plural(n, zero: 'Null', one: 'ein', other: 'einige')}";
+
+ static outerSelect(currency, amount) => "${Intl.select(currency, {'CDN': '$amount Kanadischen dollar', 'other': '$amount einige Währung oder anderen.', })}";
+
+ static plurals(num) => "${Intl.plural(num, zero: 'Ist Null Plural?', one: 'Dies ist einmalig', other: 'Dies ist Plural ($num).')}";
+
+ static staticMessage() => "Dies ergibt sich aus einer statischen Methode";
+
+ static trickyInterpolation(s) => "Interpolation ist schwierig, wenn es einen Satz wie dieser endet ${s}.";
+
+ static types(a, b, c) => "$a, $b, $c";
+
+ static whereTheyWentMessage(name, gender, place) => "${Intl.gender(gender, female: '${name} ging zu ihrem ${place}', male: '${name} ging zu seinem ${place}', other: '${name} ging zu seinem ${place}')}";
+
+
+ final messages = const {
+ "alwaysTranslated" : alwaysTranslated,
+ "escapable" : escapable,
+ "leadingQuotes" : leadingQuotes,
+ "message1" : message1,
+ "message2" : message2,
+ "message3" : message3,
+ "method" : method,
+ "multiLine" : multiLine,
+ "nestedMessage" : nestedMessage,
+ "nestedOuter" : nestedOuter,
+ "nestedSelect" : nestedSelect,
+ "nonLambda" : nonLambda,
+ "originalNotInBMP" : originalNotInBMP,
+ "outerGender" : outerGender,
+ "outerPlural" : outerPlural,
+ "outerSelect" : outerSelect,
+ "plurals" : plurals,
+ "staticMessage" : staticMessage,
+ "trickyInterpolation" : trickyInterpolation,
+ "types" : types,
+ "whereTheyWentMessage" : whereTheyWentMessage
+ };
+}
\ No newline at end of file
diff --git a/pkg/intl/test/message_extraction/foo_messages_fr.dart b/pkg/intl/test/message_extraction/foo_messages_fr.dart
new file mode 100644
index 0000000..723d362
--- /dev/null
+++ b/pkg/intl/test/message_extraction/foo_messages_fr.dart
@@ -0,0 +1,86 @@
+/**
+ * DO NOT EDIT. This is code generated via pkg/intl/generate_localized.dart
+ * This is a library that provides messages for a fr locale. All the
+ * messages from the main program should be duplicated here with the same
+ * function name.
+ */
+
+library messages_fr;
+import 'package:intl/intl.dart';
+import 'package:intl/message_lookup_by_library.dart';
+
+final messages = new MessageLookup();
+
+class MessageLookup extends MessageLookupByLibrary {
+
+ get localeName => 'fr';
+ static alwaysTranslated() => "Cette chaîne est toujours traduit";
+
+ static escapable() => "Escapes: \n\r\f\b\t\v.";
+
+ static leadingQuotes() => "\"Soi-disant\"";
+
+ static message1() => "Il s\'agit d\'un message";
+
+ static message2(x) => "Un autre message avec un seul paramètre $x";
+
+ static message3(a, b, c) => "Caractères qui doivent être échapper, par exemple barres \\ dollars \${ (les accolades sont ok), et xml/html réservés <& et des citations \" avec quelques paramètres ainsi $a, $b, et $c";
+
+ static method() => "Cela vient d\'une méthode";
+
+ static multiLine() => "Cette message prend plusiers lignes.";
+
+ static nestedMessage(names, number, combinedGender, place) => "${Intl.gender(combinedGender, female: '${Intl.plural(number, one: '$names était allée à la $place', other: '$names étaient allées à la $place')}', other: '${Intl.plural(number, zero: 'Personne n\'avait allé à la $place', one: '${names} était allé à la $place', other: '${names} étaient allés à la $place')}')}";
+
+ static nestedOuter(number, gen) => "${Intl.plural(number, other: '${Intl.gender(gen, male: '$number homme', other: '$number autre')}')}";
+
+ static nestedSelect(currency, amount) => "${Intl.select(currency, {'CDN': '${Intl.plural(amount, one: '$amount dollar Canadien', other: '$amount dollars Canadiens')}', 'other': 'Nimporte quoi', })}";
+
+ static nonLambda() => "Cette méthode n\'est pas un lambda";
+
+ static notAlwaysTranslated() => "Ce manque certaines traductions";
+
+ static originalNotInBMP() => "Anciens caractères grecs jeux du pendu: 𐅆𐅇.";
+
+ static outerGender(g) => "${Intl.gender(g, female: 'femme', male: 'homme', other: 'autre')}";
+
+ static outerPlural(n) => "${Intl.plural(n, zero: 'rien', one: 'un', other: 'quelques-uns')}";
+
+ static outerSelect(currency, amount) => "${Intl.select(currency, {'CDN': '$amount dollars Canadiens', 'other': '$amount certaine devise ou autre.', })}";
+
+ static plurals(num) => "${Intl.plural(num, zero: 'Est-ce que nulle est pluriel?', one: 'C\'est singulier', other: 'C\'est pluriel ($num).')}";
+
+ static staticMessage() => "Cela vient d\'une méthode statique";
+
+ static trickyInterpolation(s) => "L\'interpolation est délicate quand elle se termine une phrase comme ${s}.";
+
+ static types(a, b, c) => "$a, $b, $c";
+
+ static whereTheyWentMessage(name, gender, place) => "${Intl.gender(gender, female: '${name} est allée à sa ${place}', male: '${name} est allé à sa ${place}', other: '${name} est allé à sa ${place}')}";
+
+
+ final messages = const {
+ "alwaysTranslated" : alwaysTranslated,
+ "escapable" : escapable,
+ "leadingQuotes" : leadingQuotes,
+ "message1" : message1,
+ "message2" : message2,
+ "message3" : message3,
+ "method" : method,
+ "multiLine" : multiLine,
+ "nestedMessage" : nestedMessage,
+ "nestedOuter" : nestedOuter,
+ "nestedSelect" : nestedSelect,
+ "nonLambda" : nonLambda,
+ "notAlwaysTranslated" : notAlwaysTranslated,
+ "originalNotInBMP" : originalNotInBMP,
+ "outerGender" : outerGender,
+ "outerPlural" : outerPlural,
+ "outerSelect" : outerSelect,
+ "plurals" : plurals,
+ "staticMessage" : staticMessage,
+ "trickyInterpolation" : trickyInterpolation,
+ "types" : types,
+ "whereTheyWentMessage" : whereTheyWentMessage
+ };
+}
\ No newline at end of file
diff --git a/pkg/intl/test/message_extraction/generate_from_json.dart b/pkg/intl/test/message_extraction/generate_from_json.dart
index ef79fb6..9ca99b2 100644
--- a/pkg/intl/test/message_extraction/generate_from_json.dart
+++ b/pkg/intl/test/message_extraction/generate_from_json.dart
@@ -15,11 +15,11 @@
*/
library generate_from_json;
+import 'dart:convert';
import 'dart:io';
import 'package:intl/extract_messages.dart';
import 'package:intl/src/intl_message.dart';
import 'package:intl/generate_localized.dart';
-import 'dart:json' as json;
import 'package:path/path.dart' as path;
import 'package:args/args.dart';
import 'package:serialization/serialization.dart';
@@ -91,7 +91,7 @@
*/
void generateLocaleFile(File file, String targetDir) {
var src = file.readAsStringSync();
- var data = json.parse(src);
+ var data = JSON.decode(src);
data.forEach((k, v) => data[k] = recreateIntlObjects(k, v));
var locale = data["_locale"].string;
allLocales.add(locale);
diff --git a/pkg/intl/test/message_extraction/generated_messages_js_test.dart b/pkg/intl/test/message_extraction/generated_messages_js_test.dart
new file mode 100644
index 0000000..a036d7f
--- /dev/null
+++ b/pkg/intl/test/message_extraction/generated_messages_js_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.
+
+// This test is intended to be run when compiled to Javascript, though it will
+// also work if run from the VM, it just won't test anything different from
+// message_extraction_test. It runs the generated code without going through
+// the message extraction or translation, which can't be done in JS. This tells
+// us if the generated code works in JS.
+
+library generated_messages_js_test.dart;
+
+import 'package:unittest/unittest.dart';
+import 'sample_with_messages.dart' as sample;
+import 'print_to_list.dart';
+import 'verify_messages.dart';
+
+main() {
+ test("Test generated code running in JS", () =>
+ sample.main().then((_) => verifyResult(lines)));
+}
diff --git a/pkg/intl/test/message_extraction/make_hardcoded_translation.dart b/pkg/intl/test/message_extraction/make_hardcoded_translation.dart
index 9da9dce..9b3e03d 100644
--- a/pkg/intl/test/message_extraction/make_hardcoded_translation.dart
+++ b/pkg/intl/test/message_extraction/make_hardcoded_translation.dart
@@ -10,8 +10,8 @@
* German and French locales.
*/
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:path/path.dart' as path;
import 'package:args/args.dart';
import 'package:intl/src/intl_message.dart';
@@ -220,7 +220,7 @@
translated[name] = translations[name];
}
var file = new File(path.join(targetDir, 'translation_$locale.json'));
- file.writeAsStringSync(json.stringify(translated));
+ file.writeAsStringSync(JSON.encode(translated));
}
main() {
@@ -237,7 +237,7 @@
var fileArgs = args.where((x) => x.contains('.json'));
- var messages = json.parse(new File(fileArgs.first).readAsStringSync());
+ var messages = JSON.decode(new File(fileArgs.first).readAsStringSync());
translate(messages, "fr", french);
translate(messages, "de_DE", german);
}
diff --git a/pkg/intl/test/message_extraction/message_extraction_test.dart b/pkg/intl/test/message_extraction/message_extraction_test.dart
index e472cda..f64153d 100644
--- a/pkg/intl/test/message_extraction/message_extraction_test.dart
+++ b/pkg/intl/test/message_extraction/message_extraction_test.dart
@@ -10,6 +10,8 @@
import 'dart:convert';
import 'package:path/path.dart' as path;
import '../data_directory.dart';
+import 'verify_messages.dart';
+import 'sample_with_messages.dart' as sample;
final dart = Platform.executable;
@@ -36,17 +38,15 @@
return generateTranslationFiles(result);
}).then((result) {
return generateCodeFromTranslation(result);
- }).then((result) {
- return runGeneratedCode(result);
- }).then(verifyResult)
+ }).then((_) => sample.main())
+ .then(verifyResult)
.whenComplete(deleteGeneratedFiles);
});
}
void deleteGeneratedFiles() {
var files = [dir('intl_messages.json'), dir('translation_fr.json'),
- dir('foo_messages_fr.dart'), dir('foo_messages_de_DE.dart'),
- dir('translation_de_DE.json'), dir('foo_messages_all.dart')];
+ dir('translation_de_DE.json')];
files.map((name) => new File(name)).forEach((x) {
if (x.existsSync()) x.deleteSync();});
}
@@ -98,154 +98,3 @@
'part_of_sample_with_messages.dart', 'translation_fr.json',
'translation_de_DE.json' ]);
-Future<ProcessResult> runGeneratedCode(ProcessResult previousResult) =>
- run(previousResult, ['sample_with_messages.dart']);
-
-verifyResult(results) {
- var lineIterator;
- verify(String s) {
- lineIterator.moveNext();
- var value = lineIterator.current;
- expect(value, s);
- }
-
- var output = results.stdout;
- var lines = output.split("\n");
- // If it looks like these are CRLF delimited, then use that.
- if (lines.first.endsWith("\r")) {
- lines = output.split("\r\n");
- }
- lineIterator = lines.iterator..moveNext();
- verify("Printing messages for en_US");
- verify("This is a message");
- verify("Another message with parameter hello");
- verify("Characters that need escaping, e.g slashes \\ dollars \${ "
- "(curly braces are ok) and xml reserved characters <& and "
- "quotes \" parameters 1, 2, and 3");
- verify("This string extends across multiple lines.");
- verify("1, b, [c, d]");
- verify('"So-called"');
- verify("Cette chaîne est toujours traduit");
- verify("Interpolation is tricky when it ends a sentence like this.");
- verify("This comes from a method");
- verify("This method is not a lambda");
- verify("This comes from a static method");
- verify("This is missing some translations");
- verify("Ancient Greek hangman characters: 𐅆𐅇.");
- verify("Escapable characters here: ");
-
- verify('Is zero plural?');
- verify('This is singular.');
- verify('This is plural (2).');
- verify('Alice went to her house');
- verify('Bob went to his house');
- verify('cat went to its litter box');
- verify('Alice, Bob sont allés au magasin');
- verify('Alice est allée au magasin');
- verify('Personne n\'est allé au magasin');
- verify('Bob, Bob sont allés au magasin');
- verify('Alice, Alice sont allées au magasin');
- verify('none');
- verify('one');
- verify('m');
- verify('f');
- verify('7 male');
- verify('7 Canadian dollars');
- verify('5 some currency or other.');
- verify('1 Canadian dollar');
- verify('2 Canadian dollars');
-
- var fr_lines = lines.skip(1).skipWhile(
- (line) => !line.contains('----')).toList();
- lineIterator = fr_lines.iterator..moveNext();
- verify("Printing messages for fr");
- verify("Il s'agit d'un message");
- verify("Un autre message avec un seul paramètre hello");
- verify(
- "Caractères qui doivent être échapper, par exemple barres \\ "
- "dollars \${ (les accolades sont ok), et xml/html réservés <& et "
- "des citations \" "
- "avec quelques paramètres ainsi 1, 2, et 3");
- verify("Cette message prend plusiers lignes.");
- verify("1, b, [c, d]");
- verify('"Soi-disant"');
- verify("Cette chaîne est toujours traduit");
- verify(
- "L'interpolation est délicate quand elle se termine une "
- "phrase comme this.");
- verify("Cela vient d'une méthode");
- verify("Cette méthode n'est pas un lambda");
- verify("Cela vient d'une méthode statique");
- verify("Ce manque certaines traductions");
- verify("Anciens caractères grecs jeux du pendu: 𐅆𐅇.");
- verify("Escapes: ");
- verify("\r\f\b\t\v.");
-
- verify('Est-ce que nulle est pluriel?');
- verify('C\'est singulier');
- verify('C\'est pluriel (2).');
- verify('Alice est allée à sa house');
- verify('Bob est allé à sa house');
- verify('cat est allé à sa litter box');
- verify('Alice, Bob étaient allés à la magasin');
- verify('Alice était allée à la magasin');
- verify('Personne n\'avait allé à la magasin');
- verify('Bob, Bob étaient allés à la magasin');
- verify('Alice, Alice étaient allées à la magasin');
- verify('rien');
- verify('un');
- verify('homme');
- verify('femme');
- verify('7 homme');
- verify('7 dollars Canadiens');
- verify('5 certaine devise ou autre.');
- verify('1 dollar Canadien');
- verify('2 dollars Canadiens');
-
- var de_lines = fr_lines.skip(1).skipWhile(
- (line) => !line.contains('----')).toList();
- lineIterator = de_lines.iterator..moveNext();
- verify("Printing messages for de_DE");
- verify("Dies ist eine Nachricht");
- verify("Eine weitere Meldung mit dem Parameter hello");
- verify(
- "Zeichen, die Flucht benötigen, zB Schrägstriche \\ Dollar "
- "\${ (geschweiften Klammern sind ok) und xml reservierte Zeichen <& und "
- "Zitate \" Parameter 1, 2 und 3");
- verify("Dieser String erstreckt sich über mehrere "
- "Zeilen erstrecken.");
- verify("1, b, [c, d]");
- verify('"Sogenannt"');
- // This is correct, the message is forced to French, even in a German locale.
- verify("Cette chaîne est toujours traduit");
- verify(
- "Interpolation ist schwierig, wenn es einen Satz wie dieser endet this.");
- verify("Dies ergibt sich aus einer Methode");
- verify("Diese Methode ist nicht eine Lambda");
- verify("Dies ergibt sich aus einer statischen Methode");
- verify("This is missing some translations");
- verify("Antike griechische Galgenmännchen Zeichen: 𐅆𐅇");
- verify("Escapes: ");
- verify("\r\f\b\t\v.");
-
- verify('Ist Null Plural?');
- verify('Dies ist einmalig');
- verify('Dies ist Plural (2).');
- verify('Alice ging zu ihrem house');
- verify('Bob ging zu seinem house');
- verify('cat ging zu seinem litter box');
- verify('Alice, Bob gingen zum magasin');
- verify('Alice ging in dem magasin');
- verify('Niemand ging zu magasin');
- verify('Bob, Bob gingen zum magasin');
- verify('Alice, Alice gingen zum magasin');
- verify('Null');
- verify('ein');
- verify('Mann');
- verify('Frau');
- verify('7 Mann');
- verify('7 Kanadischen dollar');
- verify('5 einige Währung oder anderen.');
- verify('1 Kanadischer dollar');
- verify('2 Kanadischen dollar');
-}
diff --git a/pkg/intl/test/message_extraction/print_to_list.dart b/pkg/intl/test/message_extraction/print_to_list.dart
new file mode 100644
index 0000000..e718fc4
--- /dev/null
+++ b/pkg/intl/test/message_extraction/print_to_list.dart
@@ -0,0 +1,10 @@
+/// This provides a way for a test to print to an internal list so the
+/// results can be verified rather than writing to and reading a file.
+
+library print_to_list.dart;
+
+List<String> lines = [];
+
+void printOut(String s) {
+ lines.add(s);
+}
\ No newline at end of file
diff --git a/pkg/intl/test/message_extraction/sample_with_messages.dart b/pkg/intl/test/message_extraction/sample_with_messages.dart
index 753f39c..8fc65c7 100644
--- a/pkg/intl/test/message_extraction/sample_with_messages.dart
+++ b/pkg/intl/test/message_extraction/sample_with_messages.dart
@@ -11,6 +11,8 @@
import "package:intl/intl.dart";
import "foo_messages_all.dart";
+import "print_to_list.dart";
+import "dart:async";
part 'part_of_sample_with_messages.dart';
@@ -125,50 +127,50 @@
args: [a, b, c]);
var messageVariable = message3;
- print("-------------------------------------------");
- print("Printing messages for ${locale.locale}");
+ printOut("-------------------------------------------");
+ printOut("Printing messages for ${locale.locale}");
Intl.withLocale(locale.locale, () {
- print(message1());
- print(message2("hello"));
- print(messageVariable(1,2,3));
- print(multiLine());
- print(types(1, "b", ["c", "d"]));
- print(leadingQuotes());
- print(alwaysTranslated());
- print(trickyInterpolation("this"));
+ printOut(message1());
+ printOut(message2("hello"));
+ printOut(messageVariable(1,2,3));
+ printOut(multiLine());
+ printOut(types(1, "b", ["c", "d"]));
+ printOut(leadingQuotes());
+ printOut(alwaysTranslated());
+ printOut(trickyInterpolation("this"));
var thing = new YouveGotMessages();
- print(thing.method());
- print(thing.nonLambda());
+ printOut(thing.method());
+ printOut(thing.nonLambda());
var x = YouveGotMessages.staticMessage();
- print(YouveGotMessages.staticMessage());
- print(notAlwaysTranslated());
- print(originalNotInBMP());
- print(escapable());
+ printOut(YouveGotMessages.staticMessage());
+ printOut(notAlwaysTranslated());
+ printOut(originalNotInBMP());
+ printOut(escapable());
- print(thing.plurals(0));
- print(thing.plurals(1));
- print(thing.plurals(2));
+ printOut(thing.plurals(0));
+ printOut(thing.plurals(1));
+ printOut(thing.plurals(2));
var alice = new Person("Alice", "female");
var bob = new Person("Bob", "male");
var cat = new Person("cat", null);
- print(thing.whereTheyWent(alice, "house"));
- print(thing.whereTheyWent(bob, "house"));
- print(thing.whereTheyWent(cat, "litter box"));
- print(thing.nested([alice, bob], "magasin"));
- print(thing.nested([alice], "magasin"));
- print(thing.nested([], "magasin"));
- print(thing.nested([bob, bob], "magasin"));
- print(thing.nested([alice, alice], "magasin"));
+ printOut(thing.whereTheyWent(alice, "house"));
+ printOut(thing.whereTheyWent(bob, "house"));
+ printOut(thing.whereTheyWent(cat, "litter box"));
+ printOut(thing.nested([alice, bob], "magasin"));
+ printOut(thing.nested([alice], "magasin"));
+ printOut(thing.nested([], "magasin"));
+ printOut(thing.nested([bob, bob], "magasin"));
+ printOut(thing.nested([alice, alice], "magasin"));
- print(outerPlural(0));
- print(outerPlural(1));
- print(outerGender("male"));
- print(outerGender("female"));
- print(nestedOuter(7, "male"));
- print(outerSelect("CDN", 7));
- print(outerSelect("EUR", 5));
- print(nestedSelect("CDN", 1));
- print(nestedSelect("CDN", 2));
+ printOut(outerPlural(0));
+ printOut(outerPlural(1));
+ printOut(outerGender("male"));
+ printOut(outerGender("female"));
+ printOut(nestedOuter(7, "male"));
+ printOut(outerSelect("CDN", 7));
+ printOut(outerSelect("EUR", 5));
+ printOut(nestedSelect("CDN", 1));
+ printOut(nestedSelect("CDN", 2));
});
}
@@ -180,7 +182,8 @@
var de = new Intl("de_DE");
// Throw in an initialize of a null locale to make sure it doesn't throw.
initializeMessages(null);
- initializeMessages(fr.locale).then((_) => printStuff(fr));
- initializeMessages(de.locale).then((_) => printStuff(de));
+ var f1 = initializeMessages(fr.locale).then((_) => printStuff(fr));
+ var f2 = initializeMessages(de.locale).then((_) => printStuff(de));
printStuff(english);
+ return Future.wait([f1, f2]);
}
\ No newline at end of file
diff --git a/pkg/intl/test/message_extraction/verify_messages.dart b/pkg/intl/test/message_extraction/verify_messages.dart
new file mode 100644
index 0000000..2203be6
--- /dev/null
+++ b/pkg/intl/test/message_extraction/verify_messages.dart
@@ -0,0 +1,148 @@
+library verify_messages;
+
+import "print_to_list.dart";
+import "package:unittest/unittest.dart";
+
+verifyResult(ignored) {
+ var lineIterator;
+ verify(String s) {
+ lineIterator.moveNext();
+ var value = lineIterator.current;
+ expect(value, s);
+ }
+
+ var expanded = lines.expand((line) => line.split("\n")).toList();
+ lineIterator = expanded.iterator..moveNext();
+ verify("Printing messages for en_US");
+ verify("This is a message");
+ verify("Another message with parameter hello");
+ verify("Characters that need escaping, e.g slashes \\ dollars \${ "
+ "(curly braces are ok) and xml reserved characters <& and "
+ "quotes \" parameters 1, 2, and 3");
+ verify("This string extends across multiple lines.");
+ verify("1, b, [c, d]");
+ verify('"So-called"');
+ verify("Cette chaîne est toujours traduit");
+ verify("Interpolation is tricky when it ends a sentence like this.");
+ verify("This comes from a method");
+ verify("This method is not a lambda");
+ verify("This comes from a static method");
+ verify("This is missing some translations");
+ verify("Ancient Greek hangman characters: 𐅆𐅇.");
+ verify("Escapable characters here: ");
+
+ verify('Is zero plural?');
+ verify('This is singular.');
+ verify('This is plural (2).');
+ verify('Alice went to her house');
+ verify('Bob went to his house');
+ verify('cat went to its litter box');
+ verify('Alice, Bob sont allés au magasin');
+ verify('Alice est allée au magasin');
+ verify('Personne n\'est allé au magasin');
+ verify('Bob, Bob sont allés au magasin');
+ verify('Alice, Alice sont allées au magasin');
+ verify('none');
+ verify('one');
+ verify('m');
+ verify('f');
+ verify('7 male');
+ verify('7 Canadian dollars');
+ verify('5 some currency or other.');
+ verify('1 Canadian dollar');
+ verify('2 Canadian dollars');
+
+ var fr_lines = expanded.skip(1).skipWhile(
+ (line) => !line.contains('----')).toList();
+ lineIterator = fr_lines.iterator..moveNext();
+ verify("Printing messages for fr");
+ verify("Il s'agit d'un message");
+ verify("Un autre message avec un seul paramètre hello");
+ verify(
+ "Caractères qui doivent être échapper, par exemple barres \\ "
+ "dollars \${ (les accolades sont ok), et xml/html réservés <& et "
+ "des citations \" "
+ "avec quelques paramètres ainsi 1, 2, et 3");
+ verify("Cette message prend plusiers lignes.");
+ verify("1, b, [c, d]");
+ verify('"Soi-disant"');
+ verify("Cette chaîne est toujours traduit");
+ verify(
+ "L'interpolation est délicate quand elle se termine une "
+ "phrase comme this.");
+ verify("Cela vient d'une méthode");
+ verify("Cette méthode n'est pas un lambda");
+ verify("Cela vient d'une méthode statique");
+ verify("Ce manque certaines traductions");
+ verify("Anciens caractères grecs jeux du pendu: 𐅆𐅇.");
+ verify("Escapes: ");
+ verify("\r\f\b\t\v.");
+
+ verify('Est-ce que nulle est pluriel?');
+ verify('C\'est singulier');
+ verify('C\'est pluriel (2).');
+ verify('Alice est allée à sa house');
+ verify('Bob est allé à sa house');
+ verify('cat est allé à sa litter box');
+ verify('Alice, Bob étaient allés à la magasin');
+ verify('Alice était allée à la magasin');
+ verify('Personne n\'avait allé à la magasin');
+ verify('Bob, Bob étaient allés à la magasin');
+ verify('Alice, Alice étaient allées à la magasin');
+ verify('rien');
+ verify('un');
+ verify('homme');
+ verify('femme');
+ verify('7 homme');
+ verify('7 dollars Canadiens');
+ verify('5 certaine devise ou autre.');
+ verify('1 dollar Canadien');
+ verify('2 dollars Canadiens');
+
+ var de_lines = fr_lines.skip(1).skipWhile(
+ (line) => !line.contains('----')).toList();
+ lineIterator = de_lines.iterator..moveNext();
+ verify("Printing messages for de_DE");
+ verify("Dies ist eine Nachricht");
+ verify("Eine weitere Meldung mit dem Parameter hello");
+ verify(
+ "Zeichen, die Flucht benötigen, zB Schrägstriche \\ Dollar "
+ "\${ (geschweiften Klammern sind ok) und xml reservierte Zeichen <& und "
+ "Zitate \" Parameter 1, 2 und 3");
+ verify("Dieser String erstreckt sich über mehrere "
+ "Zeilen erstrecken.");
+ verify("1, b, [c, d]");
+ verify('"Sogenannt"');
+ // This is correct, the message is forced to French, even in a German locale.
+ verify("Cette chaîne est toujours traduit");
+ verify(
+ "Interpolation ist schwierig, wenn es einen Satz wie dieser endet this.");
+ verify("Dies ergibt sich aus einer Methode");
+ verify("Diese Methode ist nicht eine Lambda");
+ verify("Dies ergibt sich aus einer statischen Methode");
+ verify("This is missing some translations");
+ verify("Antike griechische Galgenmännchen Zeichen: 𐅆𐅇");
+ verify("Escapes: ");
+ verify("\r\f\b\t\v.");
+
+ verify('Ist Null Plural?');
+ verify('Dies ist einmalig');
+ verify('Dies ist Plural (2).');
+ verify('Alice ging zu ihrem house');
+ verify('Bob ging zu seinem house');
+ verify('cat ging zu seinem litter box');
+ verify('Alice, Bob gingen zum magasin');
+ verify('Alice ging in dem magasin');
+ verify('Niemand ging zu magasin');
+ verify('Bob, Bob gingen zum magasin');
+ verify('Alice, Alice gingen zum magasin');
+ verify('Null');
+ verify('ein');
+ verify('Mann');
+ verify('Frau');
+ verify('7 Mann');
+ verify('7 Kanadischen dollar');
+ verify('5 einige Währung oder anderen.');
+ verify('1 Kanadischer dollar');
+ verify('2 Kanadischen dollar');
+}
\ No newline at end of file
diff --git a/pkg/intl/tool/generate_locale_data_files.dart b/pkg/intl/tool/generate_locale_data_files.dart
index b1ffb3f..4934d66 100644
--- a/pkg/intl/tool/generate_locale_data_files.dart
+++ b/pkg/intl/tool/generate_locale_data_files.dart
@@ -15,8 +15,8 @@
import '../lib/date_symbol_data_local.dart';
import '../lib/date_time_patterns.dart';
import '../lib/intl.dart';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import '../test/data_directory.dart';
import 'package:path/path.dart' as path;
@@ -70,10 +70,10 @@
void writePatterns(locale, patterns) {
var file = new File(path.join(dataDirectory, 'patterns', '${locale}.json'));
var output = file.openWrite();
- output.write(json.stringify(patterns));
+ output.write(JSON.encode(patterns));
output.close();
}
void writeToJSON(dynamic data, IOSink out) {
- out.write(json.stringify(data.serializeToMap()));
+ out.write(JSON.encode(data.serializeToMap()));
}
diff --git a/pkg/oauth2/lib/src/credentials.dart b/pkg/oauth2/lib/src/credentials.dart
index 5bbec16..13d3320 100644
--- a/pkg/oauth2/lib/src/credentials.dart
+++ b/pkg/oauth2/lib/src/credentials.dart
@@ -5,7 +5,7 @@
library credentials;
import 'dart:async';
-import 'dart:json' as JSON;
+import 'dart:convert';
import 'package:http/http.dart' as http;
@@ -80,7 +80,7 @@
var parsed;
try {
- parsed = JSON.parse(json);
+ parsed = JSON.decode(json);
} on FormatException catch (e) {
validate(false, 'invalid JSON');
}
@@ -125,7 +125,7 @@
/// Serializes a set of credentials to JSON. Nothing is guaranteed about the
/// output except that it's valid JSON and compatible with
/// [Credentials.toJson].
- String toJson() => JSON.stringify({
+ String toJson() => JSON.encode({
'accessToken': accessToken,
'refreshToken': refreshToken,
'tokenEndpoint': tokenEndpoint == null ? null : tokenEndpoint.toString(),
diff --git a/pkg/oauth2/lib/src/handle_access_token_response.dart b/pkg/oauth2/lib/src/handle_access_token_response.dart
index c14b8d1e..129f259 100644
--- a/pkg/oauth2/lib/src/handle_access_token_response.dart
+++ b/pkg/oauth2/lib/src/handle_access_token_response.dart
@@ -5,7 +5,7 @@
library handle_access_token_response;
import 'dart:io';
-import 'dart:json' as JSON;
+import 'dart:convert';
import 'package:http/http.dart' as http;
@@ -39,7 +39,7 @@
var parameters;
try {
- parameters = JSON.parse(response.body);
+ parameters = JSON.decode(response.body);
} on FormatException catch (e) {
validate(false, 'invalid JSON');
}
@@ -108,7 +108,7 @@
var parameters;
try {
- parameters = JSON.parse(response.body);
+ parameters = JSON.decode(response.body);
} on FormatException catch (e) {
validate(false, 'invalid JSON');
}
diff --git a/pkg/oauth2/test/authorization_code_grant_test.dart b/pkg/oauth2/test/authorization_code_grant_test.dart
index 473fee1..85c54e7 100644
--- a/pkg/oauth2/test/authorization_code_grant_test.dart
+++ b/pkg/oauth2/test/authorization_code_grant_test.dart
@@ -5,7 +5,7 @@
library authorization_code_grant_test;
import 'dart:async';
-import 'dart:json' as JSON;
+import 'dart:convert';
import 'package:unittest/unittest.dart';
import 'package:http/http.dart' as http;
@@ -151,7 +151,7 @@
'client_secret': 'secret'
}));
- return new Future.value(new http.Response(JSON.stringify({
+ return new Future.value(new http.Response(JSON.encode({
'access_token': 'access token',
'token_type': 'bearer',
}), 200, headers: {'content-type': 'application/json'}));
@@ -195,7 +195,7 @@
'client_secret': 'secret'
}));
- return new Future.value(new http.Response(JSON.stringify({
+ return new Future.value(new http.Response(JSON.encode({
'access_token': 'access token',
'token_type': 'bearer',
}), 200, headers: {'content-type': 'application/json'}));
diff --git a/pkg/oauth2/test/client_test.dart b/pkg/oauth2/test/client_test.dart
index 922302d..56dd789 100644
--- a/pkg/oauth2/test/client_test.dart
+++ b/pkg/oauth2/test/client_test.dart
@@ -5,7 +5,7 @@
library client_test;
import 'dart:async';
-import 'dart:json' as JSON;
+import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:oauth2/oauth2.dart' as oauth2;
@@ -49,7 +49,7 @@
httpClient.expectRequest((request) {
expect(request.method, equals('POST'));
expect(request.url.toString(), equals(tokenEndpoint.toString()));
- return new Future.value(new http.Response(JSON.stringify({
+ return new Future.value(new http.Response(JSON.encode({
'access_token': 'new access token',
'token_type': 'bearer'
}), 200, headers: {'content-type': 'application/json'}));
@@ -99,7 +99,7 @@
httpClient.expectRequest((request) {
expect(request.method, equals('POST'));
expect(request.url.toString(), equals(tokenEndpoint.toString()));
- return new Future.value(new http.Response(JSON.stringify({
+ return new Future.value(new http.Response(JSON.encode({
'access_token': 'new access token',
'token_type': 'bearer'
}), 200, headers: {'content-type': 'application/json'}));
diff --git a/pkg/oauth2/test/credentials_test.dart b/pkg/oauth2/test/credentials_test.dart
index 6a873f2..f3e303b 100644
--- a/pkg/oauth2/test/credentials_test.dart
+++ b/pkg/oauth2/test/credentials_test.dart
@@ -5,7 +5,7 @@
library credentials_test;
import 'dart:async';
-import 'dart:json' as JSON;
+import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:oauth2/oauth2.dart' as oauth2;
@@ -74,7 +74,7 @@
"client_secret": "secret"
}));
- return new Future.value(new http.Response(JSON.stringify({
+ return new Future.value(new http.Response(JSON.encode({
'access_token': 'new access token',
'token_type': 'bearer',
'refresh_token': 'new refresh token'
@@ -104,7 +104,7 @@
"client_secret": "secret"
}));
- return new Future.value(new http.Response(JSON.stringify({
+ return new Future.value(new http.Response(JSON.encode({
'access_token': 'new access token',
'token_type': 'bearer'
}), 200, headers: {'content-type': 'application/json'}));
@@ -120,7 +120,7 @@
group("fromJson", () {
oauth2.Credentials fromMap(Map map) =>
- new oauth2.Credentials.fromJson(JSON.stringify(map));
+ new oauth2.Credentials.fromJson(JSON.encode(map));
test("should load the same credentials from toJson", () {
var expiration = new DateTime.now().subtract(new Duration(hours: 1));
diff --git a/pkg/oauth2/test/handle_access_token_response_test.dart b/pkg/oauth2/test/handle_access_token_response_test.dart
index 10e6f75..a99d8ea 100644
--- a/pkg/oauth2/test/handle_access_token_response_test.dart
+++ b/pkg/oauth2/test/handle_access_token_response_test.dart
@@ -4,7 +4,7 @@
library handle_access_token_response_test;
-import 'dart:json' as JSON;
+import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:oauth2/oauth2.dart' as oauth2;
@@ -70,28 +70,28 @@
});
test('with a non-string error_description causes a FormatException', () {
- expect(() => handleError(body: JSON.stringify({
+ expect(() => handleError(body: JSON.encode({
"error": "invalid_request",
"error_description": 12
})), throwsFormatException);
});
test('with a non-string error_uri causes a FormatException', () {
- expect(() => handleError(body: JSON.stringify({
+ expect(() => handleError(body: JSON.encode({
"error": "invalid_request",
"error_uri": 12
})), throwsFormatException);
});
test('with a string error_description causes a AuthorizationException', () {
- expect(() => handleError(body: JSON.stringify({
+ expect(() => handleError(body: JSON.encode({
"error": "invalid_request",
"error_description": "description"
})), throwsAuthorizationException);
});
test('with a string error_uri causes a AuthorizationException', () {
- expect(() => handleError(body: JSON.stringify({
+ expect(() => handleError(body: JSON.encode({
"error": "invalid_request",
"error_uri": "http://example.com/error"
})), throwsAuthorizationException);
@@ -106,7 +106,7 @@
expiresIn,
refreshToken,
scope}) {
- return handle(new http.Response(JSON.stringify({
+ return handle(new http.Response(JSON.encode({
'access_token': accessToken,
'token_type': tokenType,
'expires_in': expiresIn,
diff --git a/pkg/polymer/lib/observe_html.dart b/pkg/observe/lib/html.dart
similarity index 96%
rename from pkg/polymer/lib/observe_html.dart
rename to pkg/observe/lib/html.dart
index 7280b0e..4cae31c 100644
--- a/pkg/polymer/lib/observe_html.dart
+++ b/pkg/observe/lib/html.dart
@@ -7,10 +7,11 @@
// getter and convert this into an Observable.
/** Helpers for exposing dart:html as observable data. */
-library polymer.observe_html;
+library observe.html;
import 'dart:html';
-import 'package:observe/observe.dart';
+
+import 'observe.dart';
/** An observable version of [window.location.hash]. */
final ObservableLocationHash windowLocation = new ObservableLocationHash._();
diff --git a/pkg/observe/lib/observe.dart b/pkg/observe/lib/observe.dart
index f2f8283..c1a2f80 100644
--- a/pkg/observe/lib/observe.dart
+++ b/pkg/observe/lib/observe.dart
@@ -80,9 +80,11 @@
// above.
import 'src/dirty_check.dart';
+part 'src/bind_property.dart';
part 'src/change_notifier.dart';
part 'src/change_record.dart';
part 'src/compound_binding.dart';
+part 'src/list_path_observer.dart';
part 'src/observable.dart';
part 'src/observable_box.dart';
part 'src/observable_list.dart';
diff --git a/pkg/observe/lib/src/bind_property.dart b/pkg/observe/lib/src/bind_property.dart
new file mode 100644
index 0000000..c8524e7
--- /dev/null
+++ b/pkg/observe/lib/src/bind_property.dart
@@ -0,0 +1,35 @@
+// 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.
+
+part of observe;
+
+/**
+ * Forwards an observable property from one object to another. For example:
+ *
+ * class MyModel extends ObservableBase {
+ * StreamSubscription _sub;
+ * MyOtherModel _otherModel;
+ *
+ * MyModel() {
+ * ...
+ * _sub = bindProperty(_otherModel, const Symbol('value'),
+ * () => notifyProperty(this, const Symbol('prop'));
+ * }
+ *
+ * String get prop => _otherModel.value;
+ * set prop(String value) { _otherModel.value = value; }
+ * }
+ *
+ * See also [notifyProperty].
+ */
+StreamSubscription bindProperty(Observable source, Symbol sourceName,
+ void callback()) {
+ return source.changes.listen((records) {
+ for (var record in records) {
+ if (record.changes(sourceName)) {
+ callback();
+ }
+ }
+ });
+}
diff --git a/pkg/polymer/lib/observe.dart b/pkg/observe/lib/src/list_path_observer.dart
similarity index 63%
rename from pkg/polymer/lib/observe.dart
rename to pkg/observe/lib/src/list_path_observer.dart
index 0a02a90..5b83a25 100644
--- a/pkg/polymer/lib/observe.dart
+++ b/pkg/observe/lib/src/list_path_observer.dart
@@ -2,57 +2,10 @@
// 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.
-/**
- * Helpers for observable objects.
- * Intended for use with `package:observe`.
- */
-library polymer.observe;
-
-import 'dart:async';
-import 'package:observe/observe.dart';
+part of observe;
const _VALUE = const Symbol('value');
-/**
- * Forwards an observable property from one object to another. For example:
- *
- * class MyModel extends ObservableBase {
- * StreamSubscription _sub;
- * MyOtherModel _otherModel;
- *
- * MyModel() {
- * ...
- * _sub = bindProperty(_otherModel, const Symbol('value'),
- * () => notifyProperty(this, const Symbol('prop'));
- * }
- *
- * String get prop => _otherModel.value;
- * set prop(String value) { _otherModel.value = value; }
- * }
- *
- * See also [notifyProperty].
- */
-StreamSubscription bindProperty(Observable source, Symbol sourceName,
- void callback()) {
- return source.changes.listen((records) {
- for (var record in records) {
- if (record.changes(sourceName)) {
- callback();
- }
- }
- });
-}
-
-/**
- * Notify the property change. Shorthand for:
- *
- * target.notifyChange(new PropertyChangeRecord(targetName));
- */
-void notifyProperty(Observable target, Symbol targetName) {
- target.notifyChange(new PropertyChangeRecord(targetName));
-}
-
-
// Inspired by ArrayReduction at:
// https://raw.github.com/rafaelw/ChangeSummary/master/util/array_reduction.js
// The main difference is we support anything on the rich Dart Iterable API.
diff --git a/pkg/observe/lib/src/microtask.dart b/pkg/observe/lib/src/microtask.dart
index e56fb62..6689a8c 100644
--- a/pkg/observe/lib/src/microtask.dart
+++ b/pkg/observe/lib/src/microtask.dart
@@ -11,6 +11,7 @@
library observe.src.microtask;
import 'dart:async' show Completer, runZonedExperimental;
+import 'dart:collection';
import 'package:observe/observe.dart' show Observable;
// TODO(jmesserly): remove "microtask" from these names and instead import
@@ -24,14 +25,17 @@
* performing [Observable.dirtyCheck], until there are no more pending events.
* It will always dirty check at least once.
*/
+// TODO(jmesserly): do we want to support nested microtasks similar to nested
+// zones? Instead of a single pending list we'd need one per wrapMicrotask,
+// and [performMicrotaskCheckpoint] would only run pending callbacks
+// corresponding to the innermost wrapMicrotask body.
void performMicrotaskCheckpoint() {
Observable.dirtyCheck();
- while (_pending.length > 0) {
- var pending = _pending;
- _pending = [];
+ while (_pending.isNotEmpty) {
- for (var callback in pending) {
+ for (int len = _pending.length; len > 0 && _pending.isNotEmpty; len--) {
+ final callback = _pending.removeFirst();
try {
callback();
} catch (e, s) {
@@ -43,20 +47,23 @@
}
}
-List<Function> _pending = [];
+final Queue<Function> _pending = new Queue<Function>();
/**
- * Wraps the [testCase] in a zone that supports [performMicrotaskCheckpoint],
- * and returns the test case.
+ * Wraps the [body] in a zone that supports [performMicrotaskCheckpoint],
+ * and returns the body.
*/
-wrapMicrotask(void testCase()) {
- return () {
- runZonedExperimental(() {
- try {
- testCase();
- } finally {
- performMicrotaskCheckpoint();
- }
- }, onRunAsync: (callback) => _pending.add(callback));
- };
-}
+// TODO(jmesserly): deprecate? this doesn't add much over runMicrotask.
+wrapMicrotask(body()) => () => runMicrotask(body);
+
+/**
+ * Runs the [body] in a zone that supports [performMicrotaskCheckpoint],
+ * and returns the result.
+ */
+runMicrotask(body()) => runZonedExperimental(() {
+ try {
+ return body();
+ } finally {
+ performMicrotaskCheckpoint();
+ }
+}, onRunAsync: (callback) => _pending.add(callback));
diff --git a/pkg/observe/lib/src/observable.dart b/pkg/observe/lib/src/observable.dart
index 7610a0f..0127d6e 100644
--- a/pkg/observe/lib/src/observable.dart
+++ b/pkg/observe/lib/src/observable.dart
@@ -192,6 +192,15 @@
}
}
+/**
+ * Notify the property change. Shorthand for:
+ *
+ * target.notifyChange(new PropertyChangeRecord(targetName));
+ */
+void notifyProperty(Observable target, Symbol targetName) {
+ target.notifyChange(new PropertyChangeRecord(targetName));
+}
+
// TODO(jmesserly): remove the instance method and make this top-level method
// public instead?
_notifyPropertyChange(Observable obj, Symbol field, Object oldValue,
diff --git a/pkg/observe/lib/src/path_observer.dart b/pkg/observe/lib/src/path_observer.dart
index 6e31b55..931ee04 100644
--- a/pkg/observe/lib/src/path_observer.dart
+++ b/pkg/observe/lib/src/path_observer.dart
@@ -171,6 +171,10 @@
}
_getObjectProperty(object, property) {
+ if (object == null) {
+ return null;
+ }
+
if (object is List && property is int) {
if (property >= 0 && property < object.length) {
return object[property];
diff --git a/pkg/observe/lib/transform.dart b/pkg/observe/lib/transform.dart
index 99cb13b..029a017 100644
--- a/pkg/observe/lib/transform.dart
+++ b/pkg/observe/lib/transform.dart
@@ -9,7 +9,7 @@
library observe.transform;
import 'dart:async';
-import 'package:path/path.dart' as path;
+
import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:analyzer_experimental/src/generated/error.dart';
import 'package:analyzer_experimental/src/generated/parser.dart';
@@ -20,7 +20,7 @@
/**
* A [Transformer] that replaces observables based on dirty-checking with an
- * implementation based on change notifications.
+ * implementation based on change notifications.
*
* The transformation adds hooks for field setters and notifies the observation
* system of the change.
@@ -38,9 +38,8 @@
}
Future apply(Transform transform) {
- return transform.primaryInput
- .then((input) => input.readAsString().then((content) {
- var id = transform.primaryId;
+ return transform.primaryInput.readAsString().then((content) {
+ var id = transform.primaryInput.id;
// TODO(sigmund): improve how we compute this url
var url = id.path.startsWith('lib/')
? 'package:${id.package}/${id.path.substring(4)}' : id.path;
@@ -48,7 +47,7 @@
var transaction = _transformCompilationUnit(
content, sourceFile, transform.logger);
if (!transaction.hasEdits) {
- transform.addOutput(input);
+ transform.addOutput(transform.primaryInput);
return;
}
var printer = transaction.commit();
@@ -56,22 +55,14 @@
// dartbug.com/12340)
printer.build(url);
transform.addOutput(new Asset.fromString(id, printer.text));
- }));
+ });
}
}
TextEditTransaction _transformCompilationUnit(
String inputCode, SourceFile sourceFile, TransformLogger logger) {
var unit = _parseCompilationUnit(inputCode);
- return transformObservables(unit, sourceFile, inputCode, logger);
-}
-
-// TODO(sigmund): make this private. This is currently public so it can be used
-// by the polymer.dart package which is not yet entirely migrated to use
-// pub-serve and pub-deploy.
-TextEditTransaction transformObservables(CompilationUnit unit,
- SourceFile sourceFile, String content, TransformLogger logger) {
- var code = new TextEditTransaction(content, sourceFile);
+ var code = new TextEditTransaction(inputCode, sourceFile);
for (var directive in unit.directives) {
if (directive is LibraryDirective && _hasObservable(directive)) {
logger.warning('@observable on a library no longer has any effect. '
@@ -182,8 +173,7 @@
for (var member in cls.members) {
if (member is FieldDeclaration) {
- bool isStatic = _hasKeyword(member.keyword, Keyword.STATIC);
- if (isStatic) {
+ if (member.isStatic) {
if (_hasObservable(member)){
logger.warning('Static fields can no longer be observable. '
'Observable fields should be put in an observable objects.',
diff --git a/pkg/observe/test/observe_test.dart b/pkg/observe/test/observe_test.dart
index 8b07d4b..b181ccb 100644
--- a/pkg/observe/test/observe_test.dart
+++ b/pkg/observe/test/observe_test.dart
@@ -14,7 +14,7 @@
const _VALUE = const Symbol('value');
-main() {
+void main() {
// Note: to test the basic Observable system, we use ObservableBox due to its
// simplicity. We also test a variant that is based on dirty-checking.
@@ -22,9 +22,9 @@
expect(dirty_check.allObservablesCount, 0);
});
- group('WatcherModel', () { observeTests(watch: true); });
+ group('WatcherModel', () { _observeTests(watch: true); });
- group('ObservableBox', () { observeTests(); });
+ group('ObservableBox', () { _observeTests(); });
group('dirtyCheck loops can be debugged', () {
var messages;
@@ -60,8 +60,7 @@
});
}
-observeTests({bool watch: false}) {
-
+void _observeTests({bool watch: false}) {
final createModel = watch ? (x) => new WatcherModel(x)
: (x) => new ObservableBox(x);
@@ -84,6 +83,11 @@
reason: 'Observable object leaked');
});
+ observeTest('handle future result', () {
+ var callback = expectAsync0((){});
+ return new Future(callback);
+ });
+
observeTest('no observers', () {
var t = createModel(123);
expect(t.value, 123);
diff --git a/pkg/observe/test/path_observer_test.dart b/pkg/observe/test/path_observer_test.dart
index 581b684..9ed8945 100644
--- a/pkg/observe/test/path_observer_test.dart
+++ b/pkg/observe/test/path_observer_test.dart
@@ -2,7 +2,6 @@
// 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 'dart:async';
import 'package:observe/observe.dart';
import 'package:unittest/unittest.dart';
import 'observe_test_utils.dart';
diff --git a/pkg/observe/test/transform_test.dart b/pkg/observe/test/transform_test.dart
index 13b67cd..9a64fac 100644
--- a/pkg/observe/test/transform_test.dart
+++ b/pkg/observe/test/transform_test.dart
@@ -46,6 +46,18 @@
_testInitializers('this.a, [this.b]', '(a, [b]) : __\$a = a, __\$b = b');
_testInitializers('this.a, {this.b}', '(a, {b}) : __\$a = a, __\$b = b');
});
+
+ group('test full text', () {
+ test('with changes', () {
+ return _transform(_sampleObservable('A', 'foo'))
+ .then((output) => expect(output, _sampleObservableOutput('A', 'foo')));
+ });
+
+ test('no changes', () {
+ var input = 'class A {/*@observable annotation to trigger transform */;}';
+ return _transform(input).then((output) => expect(output, input));
+ });
+ });
}
_testClause(String clauses, String expected) {
@@ -105,13 +117,12 @@
class _MockTransform implements Transform {
List<Asset> outs = [];
Asset _asset;
- AssetId get primaryId => _asset.id;
TransformLogger logger = new TransformLogger(false);
- Future<Asset> get primaryInput => new Future.value(_asset);
+ Asset get primaryInput => _asset;
_MockTransform(this._asset);
Future<Asset> getInput(Asset id) {
- if (id == primaryId) return primaryInput;
+ if (id == primaryInput.id) return new Future.value(primaryInput);
fail();
}
@@ -119,3 +130,28 @@
outs.add(output);
}
}
+
+String _sampleObservable(String className, String fieldName) => '''
+library ${className}_$fieldName;
+import 'package:observe/observe.dart';
+
+class $className extends ObservableBase {
+ @observable int $fieldName;
+ $className(this.$fieldName);
+}
+''';
+
+String _sampleObservableOutput(String className, String fieldName) => '''
+library ${className}_$fieldName;
+import 'package:observe/observe.dart';
+
+class $className extends ChangeNotifierBase {
+ int __\$$fieldName;
+ int get $fieldName => __\$$fieldName;
+ set $fieldName(int value) {
+ __\$$fieldName = notifyPropertyChange(const Symbol('$fieldName'), __\$$fieldName, value);
+ }
+
+ $className($fieldName) : __\$$fieldName = $fieldName;
+}
+''';
diff --git a/pkg/pkg.status b/pkg/pkg.status
index f70e05a..af24990 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -20,6 +20,9 @@
# Skip test not runnable via test.dart
third_party/html5lib/test/dom_compat_test: Skip
+third_party/html5lib/test/browser/browser_test: Skip
+
+polymer_expressions/test/syntax_test: Skip # Issue 12954
[ $compiler == dart2js && $runtime == d8 ]
unmodifiable_collection/test/unmodifiable_collection_test: Pass, Fail # Issue 12429
@@ -56,6 +59,7 @@
[ $runtime == ie9 ]
intl/test/date_time_format_http_request_test: Fail # Issue 8983
mime/test/mime_multipart_transformer_test: Skip # No typed_data on IE9.
+sequence_zip/test/stream_test: Pass, Fail # Flaky, issue 12873
[ $runtime == safari ]
fixnum/test/int_64_test: Pass, Fail # Bug in JSC.
@@ -111,7 +115,7 @@
analyzer_experimental/test/error_test: Fail, OK # Uses dart:io.
analyzer_experimental/test/generated/element_test: Fail, OK # Uses dart:io.
analyzer_experimental/test/generated/resolver_test: Fail, OK # Uses dart:io.
-analyzer_experimental/test/options_test: Fail, OK # Uses dart:io.
+analyzer_experimental/test/options_test: Fail, OK, Pass # Uses dart:io.
analyzer_experimental/test/services/formatter_test: Fail, OK # Uses dart:io.
analyzer_experimental/test/parse_compilation_unit_test: Fail, OK # Uses dart:io.
barback/test/*: Fail, OK # Uses dart:io.
@@ -203,3 +207,13 @@
[ $runtime == safari || $runtime == chrome || $runtime == ie9 || $runtime == ff || $runtime == dartium || $runtime == drt ]
docgen/test/single_library_test: Skip # Uses dart:io
+
+[ $browser || $runtime == vm ]
+unittest/test/missing_tick_test: Fail, OK # This test should fail, not time out.
+
+# Issue http://dartbug.com/12930
+[ $runtime == vm ]
+intl/test/message_extraction/message_extraction_test: Pass, Fail # Issue 12930
+
+[ $compiler == none && $runtime == drt && $arch == ia32 ]
+custom_element/test/custom_element_test: Fail, Pass # http://dartbug.com/12964
diff --git a/pkg/polymer/bin/dwc.dart b/pkg/polymer/bin/dwc.dart
deleted file mode 100755
index 3d3a0a2..0000000
--- a/pkg/polymer/bin/dwc.dart
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env dart
-// 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.
-
-import 'package:polymer/dwc.dart' as dwc;
-
-void main() => dwc.main();
diff --git a/pkg/polymer/build.dart b/pkg/polymer/build.dart
index 5e863b8..4599716 100755
--- a/pkg/polymer/build.dart
+++ b/pkg/polymer/build.dart
@@ -9,9 +9,7 @@
import 'dart:io';
void main() {
- var args = new Options().arguments.toList()..addAll(['--', '--deploy']);
- build(args, [
+ build(new Options().arguments, [
'example/component/news/web/index.html',
- 'example/scoped_style/index.html',
- '../../samples/third_party/todomvc/web/index.html']);
+ 'example/scoped_style/index.html']);
}
diff --git a/pkg/polymer/example/component/news/test/expected/news_index_test.html.txt b/pkg/polymer/example/component/news/test/expected/news_index_test.html.txt
index 8a45ae6..0850734 100644
--- a/pkg/polymer/example/component/news/test/expected/news_index_test.html.txt
+++ b/pkg/polymer/example/component/news/test/expected/news_index_test.html.txt
@@ -1,8 +1,8 @@
Content-Type: text/plain
-<html><head><style shadowcssshim="">template { display: none; }</style>
+<html><head>
<title>Simple Web Components Example</title>
- <script src="../../packages/polymer/testing/testing.js"></script>
+ <script src="packages/polymer/testing/testing.js"></script>
<style>template,
thead[template],
tbody[template],
@@ -16,7 +16,9 @@
option[template] {
display: none;
}</style></head>
-<body><polymer-element name="x-news" extends="ul">
+<body><script src="packages/shadow_dom/shadow_dom.min.js"></script>
+<script src="packages/browser/interop.js"></script>
+<polymer-element name="x-news" extends="ul">
<template>
<style scoped="">
div.breaking {
@@ -44,20 +46,9 @@
</template>
</polymer-element>
-
<h1>Simple Web Components Example</h1>
<ul is="x-news"><shadow-root>
- <style scoped="">
- div.breaking {
- color: Red;
- font-size: 20px;
- border: 1px dashed Purple;
- }
- div.other {
- padding: 2px 0 0 0;
- border: 1px solid Cyan;
- }
- </style>
+ <style scoped="">/* style hidden by testing.js */</style>
<div class="breaking">
<h2>Breaking Stories</h2>
<ul>
@@ -81,6 +72,4 @@
-<script type="text/javascript" src="packages/shadow_dom/shadow_dom.debug.js"></script>
-<script type="text/javascript" src="packages/browser/interop.js"></script>
<script type="application/dart" src="news_index_test.html_bootstrap.dart"></script></body></html>
diff --git a/pkg/polymer/example/component/news/web/news-component.html b/pkg/polymer/example/component/news/web/news-component.html
index 8e604d2..7f63f54 100644
--- a/pkg/polymer/example/component/news/web/news-component.html
+++ b/pkg/polymer/example/component/news/web/news-component.html
@@ -1,49 +1,37 @@
-<!DOCTYPE html>
-<!--
-This example is from
-https://github.com/dglazkov/Web-Components-Polyfill/blob/master/samples/news
--->
-<html>
-<head>
- <title>News Component</title>
-</head>
-<body>
<polymer-element name="x-news" extends="ul">
- <template>
- <style scoped>
- div.breaking {
- color: Red;
- font-size: 20px;
- border: 1px dashed Purple;
- }
- div.other {
- padding: 2px 0 0 0;
- border: 1px solid Cyan;
- }
- </style>
- <div class="breaking">
- <h2>Breaking Stories</h2>
- <ul>
- <content select=".breaking"></content>
- </ul>
- </div>
- <div class="other">
- <h2>Other News</h2>
- <ul>
- <content></content>
- </ul>
- </div>
- </template>
- <script type="application/dart">
- import 'package:polymer/polymer.dart';
-
- class XNews extends PolymerElement {}
-
- @initMethod
- _init() {
- registerPolymerElement('x-news', () => new XNews());
+ <template>
+ <style scoped>
+ div.breaking {
+ color: Red;
+ font-size: 20px;
+ border: 1px dashed Purple;
}
- </script>
+ div.other {
+ padding: 2px 0 0 0;
+ border: 1px solid Cyan;
+ }
+ </style>
+ <div class="breaking">
+ <h2>Breaking Stories</h2>
+ <ul>
+ <content select=".breaking"></content>
+ </ul>
+ </div>
+ <div class="other">
+ <h2>Other News</h2>
+ <ul>
+ <content></content>
+ </ul>
+ </div>
+ </template>
+ <script type="application/dart">
+ import 'package:polymer/polymer.dart';
+
+ class XNews extends PolymerElement {}
+
+ @initMethod
+ _init() {
+ registerPolymerElement('x-news', () => new XNews());
+ }
+ </script>
</polymer-element>
-</body>
-</html>
diff --git a/pkg/polymer/example/scoped_style/my_test.html b/pkg/polymer/example/scoped_style/my_test.html
index 2713a3f..c759c66 100644
--- a/pkg/polymer/example/scoped_style/my_test.html
+++ b/pkg/polymer/example/scoped_style/my_test.html
@@ -1,9 +1,3 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Test Compopnent</title>
-</head>
-<body>
<polymer-element name="my-test">
<template>
<style>
@@ -18,5 +12,3 @@
class MyTest extends PolymerElement {}
</script>
</polymer-element>
-</body>
-</html>
diff --git a/pkg/polymer/lib/boot.js b/pkg/polymer/lib/boot.js
index 84bb489..0a3fe62 100644
--- a/pkg/polymer/lib/boot.js
+++ b/pkg/polymer/lib/boot.js
@@ -82,7 +82,11 @@
if (!seen) seen = {};
var links = content.querySelectorAll('link[rel="import"]');
for (var i = 0; i < links.length; i++) {
- var link = links[i].import;
+ var link = links[i];
+ // TODO(jmesserly): figure out why ".import" fails in content_shell but
+ // works in Dartium.
+ if (link.import && link.import.href) link = link.import;
+
if (seen[link.href]) continue;
seen[link.href] = link;
inlinePolymerElements(link.content, ref, seen);
diff --git a/pkg/polymer/lib/component_build.dart b/pkg/polymer/lib/component_build.dart
index 316124e..7184787 100644
--- a/pkg/polymer/lib/component_build.dart
+++ b/pkg/polymer/lib/component_build.dart
@@ -19,8 +19,8 @@
library build_utils;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:args/args.dart';
import 'dwc.dart' as dwc;
@@ -32,8 +32,7 @@
* [entryPoints] listed. On clean commands, the directory where [entryPoints]
* live will be scanned for generated files to delete them.
*/
-// TODO(jmesserly): we need a better way to automatically detect input files
-Future<List<dwc.CompilerResult>> build(List<String> arguments,
+Future<List<dwc.AnalysisResults>> build(List<String> arguments,
List<String> entryPoints,
{bool printTime: true, bool shouldPrint: true}) {
bool useColors = stdioType(stdout) == StdioType.TERMINAL;
@@ -54,29 +53,11 @@
var options = CompilerOptions.parse(args.rest, checkUsage: false);
- // [outputOnlyDirs] contains directories known to only have output files.
- // When outputDir is not specified, we create a new directory which only
- // contains output files. If options.outputDir is specified, we don't know
- // if the output directory may also have input files. In which case,
- // [_handleCleanCommand] and [_isInputFile] are more conservative.
- //
- // TODO(sigmund): get rid of this. Instead, use the compiler to understand
- // which files are input or output files.
- var outputOnlyDirs = options.outputDir == null ? []
- : entryPoints.map((e) => _outDir(e)).toList();
-
- if (cleanBuild) {
- _handleCleanCommand(outputOnlyDirs);
- } else if (fullBuild
- || changedFiles.any((f) => _isInputFile(f, outputOnlyDirs))
- || removedFiles.any((f) => _isInputFile(f, outputOnlyDirs))) {
+ if (fullBuild || !changedFiles.isEmpty || !removedFiles.isEmpty) {
for (var file in entryPoints) {
var dwcArgs = new List.from(args.rest);
if (machineFormat) dwcArgs.add('--json_format');
if (!useColors) dwcArgs.add('--no-colors');
- // We'll set 'out/' as the out folder, unless an output directory was
- // already specified in the command line.
- if (options.outputDir == null) dwcArgs.addAll(['-o', _outDir(file)]);
dwcArgs.add(file);
// Chain tasks to that we run one at a time.
lastTask = lastTask.then((_) => dwc.run(dwcArgs, printTime: printTime,
@@ -84,20 +65,10 @@
if (machineFormat) {
lastTask = lastTask.then((res) {
appendMessage(Map jsonMessage) {
- var message = json.stringify([jsonMessage]);
+ var message = JSON.encode([jsonMessage]);
if (shouldPrint) print(message);
res.messages.add(message);
}
- // Print for the Editor messages about mappings and generated files
- res.outputs.forEach((out, input) {
- if (out.endsWith(".html") && input != null) {
- appendMessage({
- "method": "mapping",
- "params": {"from": input, "to": out},
- });
- }
- appendMessage({"method": "generated", "params": {"file": out}});
- });
return res;
});
}
@@ -108,38 +79,6 @@
}, printTime: printTime, useColors: useColors);
}
-String _outDir(String file) => path.join(path.dirname(file), 'out');
-
-/** Tell whether [filePath] is a generated file. */
-bool _isGeneratedFile(String filePath, List<String> outputOnlyDirs) {
- var dirPrefix = path.dirname(filePath);
- for (var outDir in outputOnlyDirs) {
- if (dirPrefix.startsWith(outDir)) return true;
- }
- return path.basename(filePath).startsWith('_');
-}
-
-/** Tell whether [filePath] is an input file. */
-bool _isInputFile(String filePath, List<String> outputOnlyDirs) {
- var ext = path.extension(filePath);
- return (ext == '.dart' || ext == '.html') &&
- !_isGeneratedFile(filePath, outputOnlyDirs);
-}
-
-/**
- * Delete all generated files. Currently we only delete files under directories
- * that are known to contain only generated code.
- */
-void _handleCleanCommand(List<String> outputOnlyDirs) {
- for (var dirPath in outputOnlyDirs) {
- var dir = new Directory(dirPath);
- if (!dir.existsSync()) continue;
- for (var f in dir.listSync(recursive: false)) {
- if (f is File && _isGeneratedFile(f.path, outputOnlyDirs)) f.deleteSync();
- }
- }
-}
-
/** Process the command-line arguments. */
ArgResults _processArgs(List<String> arguments) {
var parser = new ArgParser()
@@ -147,7 +86,8 @@
allowMultiple: true)
..addOption("removed", help: "the file was removed since the last build",
allowMultiple: true)
- ..addFlag("clean", negatable: false, help: "remove any build artifacts")
+ ..addFlag("clean", negatable: false, help: "currently a noop, may be used "
+ "in the future to remove any build artifacts")
..addFlag("full", negatable: false, help: "perform a full build")
..addFlag("machine", negatable: false,
help: "produce warnings in a machine parseable format")
diff --git a/pkg/polymer/lib/deploy.dart b/pkg/polymer/lib/deploy.dart
index 86f157b..73051c4 100644
--- a/pkg/polymer/lib/deploy.dart
+++ b/pkg/polymer/lib/deploy.dart
@@ -15,8 +15,8 @@
library polymer.deploy;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:barback/barback.dart';
import 'package:path/path.dart' as path;
@@ -26,17 +26,43 @@
import 'package:args/args.dart';
main() {
- var args = _parseArgs();
+ var args = _parseArgs(new Options().arguments);
if (args == null) return;
print('polymer/deploy.dart: creating a deploy target for "$_currentPackage"');
+ var outDir = args['out'];
+ _run(args['webdir'], outDir).then(
+ (_) => print('Done! All files written to "$outDir"'));
+}
+
+/**
+ * API exposed for testing purposes. Runs this deploy command but prentend that
+ * the sources under [webDir] belong to package 'test'.
+ */
+Future runForTest(String webDir, String outDir) {
+ _currentPackage = 'test';
+
+ // associate package dirs with their location in the repo:
+ _packageDirs = {'test' : '.'};
+ addPackages(String dir) {
+ for (var packageDir in new Directory(dir).listSync().map((d) => d.path)) {
+ _packageDirs[path.basename(packageDir)] = packageDir;
+ }
+ }
+ addPackages('..');
+ addPackages('../third_party');
+ addPackages('../../third_party/pkg');
+ return _run(webDir, outDir);
+}
+
+Future _run(String webDir, String outDir) {
var barback = new Barback(new _PolymerDeployProvider());
- _initializeBarback(barback);
+ _initializeBarback(barback, webDir);
_attachListeners(barback);
- _emitAllFiles(barback, args['out']);
+ return _emitAllFiles(barback, webDir, outDir);
}
/** Tell barback which transformers to use and which assets to process. */
-void _initializeBarback(Barback barback) {
+void _initializeBarback(Barback barback, String webDir) {
var assets = [];
for (var package in _packageDirs.keys) {
// Do not process packages like 'polymer' where there is nothing to do.
@@ -54,7 +80,7 @@
}
// In case of the current package, include also 'web'.
- for (var filepath in _listDir(_currentPackage, 'web')) {
+ for (var filepath in _listDir(_currentPackage, webDir)) {
assets.add(new AssetId(_currentPackage, filepath));
}
barback.updateSources(assets);
@@ -100,17 +126,17 @@
* Emits all outputs of [barback] and copies files that we didn't process (like
* polymer's libraries).
*/
-Future _emitAllFiles(Barback barback, String outDir) {
+Future _emitAllFiles(Barback barback, String webDir, String outDir) {
return barback.getAllAssets().then((assets) {
// Copy all the assets we transformed
var futures = [];
for (var asset in assets) {
var id = asset.id;
var filepath;
- if (id.package == _currentPackage && id.path.startsWith('web/')) {
+ if (id.package == _currentPackage && id.path.startsWith('$webDir/')) {
filepath = path.join(outDir, id.path);
} else if (id.path.startsWith('lib/')) {
- filepath = path.join(outDir, 'web', 'packages', id.package,
+ filepath = path.join(outDir, webDir, 'packages', id.package,
id.path.substring(4));
} else {
// TODO(sigmund): do something about other assets?
@@ -128,7 +154,7 @@
for (var package in _ignoredPackages) {
for (var relpath in _listDir(package, 'lib')) {
var inpath = path.join(_packageDirs[package], relpath);
- var outpath = path.join(outDir, 'web', 'packages', package,
+ var outpath = path.join(outDir, webDir, 'packages', package,
relpath.substring(4));
_ensureDir(path.dirname(outpath));
@@ -137,8 +163,7 @@
.then((_) => writer.close()));
}
}
- return Future.wait(futures)
- .then((_) => print('Done! All files written to "$outDir"'));
+ return Future.wait(futures);
});
}
@@ -182,7 +207,7 @@
print(result.stderr);
exit(result.exitCode);
}
- var map = json.parse(result.stdout)["packages"];
+ var map = JSON.decode(result.stdout)["packages"];
map.forEach((k, v) { map[k] = path.dirname(v); });
map[_currentPackage] = '.';
return map;
@@ -194,7 +219,7 @@
*/
// TODO(sigmund): consider computing this list by recursively parsing
// pubspec.yaml files in the [_packageDirs].
-Set<String> _ignoredPackages =
+final Set<String> _ignoredPackages =
(const [ 'analyzer_experimental', 'args', 'barback', 'browser', 'csslib',
'custom_element', 'fancy_syntax', 'html5lib', 'html_import', 'js',
'logging', 'mdv', 'meta', 'mutation_observer', 'observe', 'path',
@@ -203,14 +228,16 @@
'unmodifiable_collection', 'yaml'
]).toSet();
-ArgResults _parseArgs() {
+ArgResults _parseArgs(arguments) {
var parser = new ArgParser()
..addFlag('help', abbr: 'h', help: 'Displays this help message',
defaultsTo: false, negatable: false)
+ ..addOption('webdir', help: 'Directory containing the application',
+ defaultsTo: 'web')
..addOption('out', abbr: 'o', help: 'Directory where to generated files',
defaultsTo: 'out');
try {
- var results = parser.parse(new Options().arguments);
+ var results = parser.parse(arguments);
if (results['help']) {
_showUsage(parser);
return null;
diff --git a/pkg/polymer/lib/dwc.dart b/pkg/polymer/lib/dwc.dart
old mode 100755
new mode 100644
index b70f29b..b0cc4db
--- a/pkg/polymer/lib/dwc.dart
+++ b/pkg/polymer/lib/dwc.dart
@@ -10,15 +10,11 @@
import 'package:logging/logging.dart' show Level;
import 'src/compiler.dart';
-import 'src/file_system.dart';
import 'src/file_system/console.dart';
-import 'src/files.dart';
import 'src/messages.dart';
import 'src/compiler_options.dart';
import 'src/utils.dart';
-FileSystem _fileSystem;
-
void main() {
run(new Options().arguments).then((result) {
exit(result.success ? 0 : 1);
@@ -26,173 +22,37 @@
}
/** Contains the result of a compiler run. */
-class CompilerResult {
+class AnalysisResults {
+
+ /** False when errors were found by our polymer analyzer. */
final bool success;
- /** Map of output path to source, if there is one */
- final Map<String, String> outputs;
-
- /** List of files read during compilation */
- final List<String> inputs;
-
+ /** Error and warning messages collected by the analyzer. */
final List<String> messages;
- String bootstrapFile;
- CompilerResult([this.success = true,
- this.outputs,
- this.inputs,
- this.messages = const [],
- this.bootstrapFile]);
-
- factory CompilerResult._(bool success,
- List<String> messages, List<OutputFile> outputs, List<SourceFile> files) {
- var file;
- var outs = new Map<String, String>();
- for (var out in outputs) {
- if (path.basename(out.path).endsWith('_bootstrap.dart')) {
- file = out.path;
- }
- outs[out.path] = out.source;
- }
- var inputs = files.map((f) => f.path).toList();
- return new CompilerResult(success, outs, inputs, messages, file);
- }
+ AnalysisResults(this.success, this.messages);
}
/**
- * Runs the web components compiler with the command-line options in [args].
+ * Runs the polymer analyzer with the command-line options in [args].
* See [CompilerOptions] for the definition of valid arguments.
*/
-// TODO(jmesserly): fix this to return a proper exit code
-// TODO(justinfagnani): return messages in the result
-Future<CompilerResult> run(List<String> args, {bool printTime,
+// TODO(sigmund): rename to analyze? and rename file as analyzer.dart
+Future<AnalysisResults> run(List<String> args, {bool printTime,
bool shouldPrint: true}) {
var options = CompilerOptions.parse(args);
- if (options == null) return new Future.value(new CompilerResult());
+ if (options == null) return new Future.value(new AnalysisResults(true, []));
if (printTime == null) printTime = options.verbose;
- _fileSystem = new ConsoleFileSystem();
- var messages = new Messages(options: options, shouldPrint: shouldPrint);
-
return asyncTime('Total time spent on ${options.inputFile}', () {
- var compiler = new Compiler(_fileSystem, options, messages);
- var res;
- return compiler.run()
- .then((_) {
- var success = messages.messages.every((m) => m.level != Level.SEVERE);
- var msgs = options.jsonFormat
- ? messages.messages.map((m) => m.toJson())
- : messages.messages.map((m) => m.toString());
- res = new CompilerResult._(success, msgs.toList(),
- compiler.output, compiler.files);
- })
- .then((_) => _symlinkPubPackages(res, options, messages))
- .then((_) => _emitFiles(compiler.output, options.clean))
- .then((_) => res);
+ var messages = new Messages(options: options, shouldPrint: shouldPrint);
+ var compiler = new Compiler(new ConsoleFileSystem(), options, messages);
+ return compiler.run().then((_) {
+ var success = messages.messages.every((m) => m.level != Level.SEVERE);
+ var msgs = options.jsonFormat
+ ? messages.messages.map((m) => m.toJson())
+ : messages.messages.map((m) => m.toString());
+ return new AnalysisResults(success, msgs.toList());
+ });
}, printTime: printTime, useColors: options.useColors);
}
-
-Future _emitFiles(List<OutputFile> outputs, bool clean) {
- outputs.forEach((f) => _writeFile(f.path, f.contents, clean));
- return _fileSystem.flush();
-}
-
-void _writeFile(String filePath, String contents, bool clean) {
- if (clean) {
- File fileOut = new File(filePath);
- if (fileOut.existsSync()) {
- fileOut.deleteSync();
- }
- } else {
- _createIfNeeded(path.dirname(filePath));
- _fileSystem.writeString(filePath, contents);
- }
-}
-
-void _createIfNeeded(String outdir) {
- if (outdir.isEmpty) return;
- var outDirectory = new Directory(outdir);
- if (!outDirectory.existsSync()) {
- _createIfNeeded(path.dirname(outdir));
- outDirectory.createSync();
- }
-}
-
-/**
- * Creates a symlink to the pub packages directory in the output location. The
- * returned future completes when the symlink was created (or immediately if it
- * already exists).
- */
-Future _symlinkPubPackages(CompilerResult result, CompilerOptions options,
- Messages messages) {
- if (options.outputDir == null || result.bootstrapFile == null
- || options.packageRoot != null) {
- // We don't need to copy the packages directory if the output was generated
- // in-place where the input lives, if the compiler was called without an
- // entry-point file, or if the compiler was called with a package-root
- // option.
- return new Future.value(null);
- }
-
- var linkDir = path.dirname(result.bootstrapFile);
- _createIfNeeded(linkDir);
- var linkPath = path.join(linkDir, 'packages');
- // A resolved symlink works like a directory
- // TODO(sigmund): replace this with something smarter once we have good
- // symlink support in dart:io
- if (new Directory(linkPath).existsSync()) {
- // Packages directory already exists.
- return new Future.value(null);
- }
-
- // A broken symlink works like a file
- var toFile = new File(linkPath);
- if (toFile.existsSync()) {
- toFile.deleteSync();
- }
-
- var targetPath = path.join(path.dirname(options.inputFile), 'packages');
- // [fullPathSync] will canonicalize the path, resolving any symlinks.
- // TODO(sigmund): once it's possible in dart:io, we just want to use a full
- // path, but not necessarily resolve symlinks.
- var target = new File(targetPath).fullPathSync().toString();
- return createSymlink(target, linkPath, messages: messages);
-}
-
-
-// TODO(jmesserly): this code was taken from Pub's io library.
-// Added error handling and don't return the file result, to match the code
-// we had previously. Also "target" and "link" only accept strings. And inlined
-// the relevant parts of runProcess. Note that it uses "cmd" to get the path
-// on Windows.
-/**
- * Creates a new symlink that creates an alias of [target] at [link], both of
- * which can be a [String], [File], or [Directory]. Returns a [Future] which
- * completes to the symlink file (i.e. [link]).
- */
-Future createSymlink(String target, String link, {Messages messages: null}) {
- messages = messages == null? new Messages.silent() : messages;
- var command = 'ln';
- var args = ['-s', target, link];
-
- if (Platform.operatingSystem == 'windows') {
- // Call mklink on Windows to create an NTFS junction point. Only works on
- // Vista or later. (Junction points are available earlier, but the "mklink"
- // command is not.) I'm using a junction point (/j) here instead of a soft
- // link (/d) because the latter requires some privilege shenanigans that
- // I'm not sure how to specify from the command line.
- command = 'cmd';
- args = ['/c', 'mklink', '/j', link, target];
- }
-
- return Process.run(command, args).then((result) {
- if (result.exitCode != 0) {
- var details = 'subprocess stdout:\n${result.stdout}\n'
- 'subprocess stderr:\n${result.stderr}';
- messages.error(
- 'unable to create symlink\n target: $target\n link:$link\n$details',
- null);
- }
- return null;
- });
-}
diff --git a/pkg/polymer/lib/polymer.dart b/pkg/polymer/lib/polymer.dart
index 575619b..2e4dd0e 100644
--- a/pkg/polymer/lib/polymer.dart
+++ b/pkg/polymer/lib/polymer.dart
@@ -21,12 +21,10 @@
export 'package:custom_element/custom_element.dart';
export 'package:observe/observe.dart';
+export 'package:observe/html.dart';
export 'package:observe/src/microtask.dart';
-export 'observe.dart';
-export 'observe_html.dart';
export 'polymer_element.dart';
-export 'safe_html.dart';
/** Annotation used to automatically register polymer elements. */
diff --git a/pkg/polymer/lib/safe_html.dart b/pkg/polymer/lib/safe_html.dart
deleted file mode 100644
index c15dd5c..0000000
--- a/pkg/polymer/lib/safe_html.dart
+++ /dev/null
@@ -1,39 +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.
-
-// TODO(sigmund): move this library to a shared package? or make part of
-// dart:html?
-library polymer.safe_html;
-
-/** Declares a string that is a well-formed HTML fragment. */
-class SafeHtml {
-
- /** Underlying html string. */
- final String _html;
-
- // TODO(sigmund): provide a constructor that does html validation
- SafeHtml.unsafe(this._html);
-
- String toString() => _html;
-
- operator ==(other) => other is SafeHtml && _html == other._html;
- int get hashCode => _html.hashCode;
-}
-
-/**
- * Declares a string that is safe to use in a Uri attribute, such as `<a href=`,
- * to avoid cross-site scripting (XSS) attacks.
- */
-class SafeUri {
- final String _uri;
-
- // TODO(sigmund): provide a constructor that takes or creates a Uri and
- // validates that it is safe (not a javascript: scheme, for example)
- SafeUri.unsafe(this._uri);
-
- String toString() => _uri;
-
- operator ==(other) => other is SafeUri && _uri == other._uri;
- int get hashCode => _uri.hashCode;
-}
diff --git a/pkg/polymer/lib/src/analyzer.dart b/pkg/polymer/lib/src/analyzer.dart
index 193e139..b8011a0 100644
--- a/pkg/polymer/lib/src/analyzer.dart
+++ b/pkg/polymer/lib/src/analyzer.dart
@@ -10,14 +10,11 @@
import 'package:html5lib/dom.dart';
import 'package:html5lib/dom_parsing.dart';
-import 'package:source_maps/span.dart' hide SourceFile;
import 'custom_tag_name.dart';
-import 'dart_parser.dart' show parseDartCode;
import 'files.dart';
import 'info.dart';
import 'messages.dart';
-import 'summary.dart';
/**
* Finds custom elements in this file and the list of referenced files with
@@ -27,9 +24,8 @@
* supplied.
*/
FileInfo analyzeDefinitions(GlobalInfo global, UrlInfo inputUrl,
- Document document, String packageRoot,
- Messages messages, {bool isEntryPoint: false}) {
- var result = new FileInfo(inputUrl, isEntryPoint);
+ Document document, String packageRoot, Messages messages) {
+ var result = new FileInfo(inputUrl);
var loader = new _ElementLoader(global, result, packageRoot, messages);
loader.visit(document);
return result;
@@ -139,10 +135,6 @@
_keepIndentationSpaces = keepSpaces;
_currentInfo = lastInfo;
-
- if (node.tagName == 'body' || node.parent == null) {
- _fileInfo.body = node;
- }
}
void _analyzeComponent(ComponentInfo component) {
@@ -154,10 +146,6 @@
'custom element with tag name ${component.extendsTag} not found.',
component.element.sourceSpan);
}
-
- // Now that the component's code has been loaded, we can validate that the
- // class exists.
- component.findClassDeclaration(_messages);
}
void _bindCustomElement(Element node) {
@@ -182,10 +170,6 @@
}
if (component != null) {
- if (!component.hasConflict) {
- _currentInfo.usedComponents[component] = true;
- }
-
var baseTag = component.baseExtendsTag;
var nodeTag = node.tagName;
var hasIsAttribute = node.attributes.containsKey('is');
@@ -271,15 +255,10 @@
* * we scan all [info.componentLinks] and import their
* [info.declaredComponents], using [files] to map the href to the file
* info. Names in [info] will shadow names from imported files.
- * * we fill [LibraryInfo.externalCode] on each component declared in
- * [info].
*/
void _normalize(FileInfo info, Map<String, FileInfo> files) {
- _attachExtenalScript(info, files);
-
for (var component in info.declaredComponents) {
_addComponent(info, component);
- _attachExtenalScript(component, files);
}
for (var link in info.componentLinks) {
@@ -290,20 +269,8 @@
}
}
- /**
- * Stores a direct reference in [info] to a dart source file that was loaded
- * in a script tag with the 'src' attribute.
- */
- void _attachExtenalScript(LibraryInfo info, Map<String, FileInfo> files) {
- var externalFile = info.externalFile;
- if (externalFile != null) {
- info.externalCode = files[externalFile.resolvedPath];
- if (info.externalCode != null) info.externalCode.htmlFile = info;
- }
- }
-
/** Adds a component's tag name to the names in scope for [fileInfo]. */
- void _addComponent(FileInfo fileInfo, ComponentSummary component) {
+ void _addComponent(FileInfo fileInfo, ComponentInfo component) {
var existing = fileInfo.components[component.tagName];
if (existing != null) {
if (existing == component) {
@@ -439,7 +406,7 @@
return;
}
- var component = new ComponentInfo(node, _fileInfo, tagName, extendsTag);
+ var component = new ComponentInfo(node, tagName, extendsTag);
_fileInfo.declaredComponents.add(component);
_addComponent(component);
@@ -496,20 +463,7 @@
return;
}
- if (scriptType != 'application/dart') {
- if (_currentInfo is ComponentInfo) {
- // TODO(jmesserly): this warning should not be here, but our compiler
- // does the wrong thing and it could cause surprising behavior, so let
- // the user know! See issue #340 for more info.
- // What we should be doing: leave JS component untouched by compiler.
- _messages.warning('our custom element implementation does not support '
- 'JavaScript components yet. If this is affecting you please let us '
- 'know at https://github.com/dart-lang/web-ui/issues/340.',
- node.sourceSpan);
- }
-
- return;
- }
+ if (scriptType != 'application/dart') return;
if (src != null) {
if (!src.endsWith('.dart')) {
@@ -522,45 +476,6 @@
_messages.error('script tag has "src" attribute and also has script '
'text.', node.sourceSpan);
}
-
- if (_currentInfo.codeAttached) {
- _tooManyScriptsError(node);
- } else {
- _currentInfo.externalFile = UrlInfo.resolve(src, _fileInfo.inputUrl,
- node.sourceSpan, _packageRoot, _messages);
- }
- return;
}
-
- if (node.nodes.length == 0) return;
-
- // I don't think the html5 parser will emit a tree with more than
- // one child of <script>
- assert(node.nodes.length == 1);
- Text text = node.nodes[0];
-
- if (_currentInfo.codeAttached) {
- _tooManyScriptsError(node);
- } else if (_currentInfo == _fileInfo && !_fileInfo.isEntryPoint) {
- _messages.warning('top-level dart code is ignored on '
- ' HTML pages that define components, but are not the entry HTML '
- 'file.', node.sourceSpan);
- } else {
- _currentInfo.inlinedCode = parseDartCode(
- _currentInfo.dartCodeUrl.resolvedPath, text.value,
- text.sourceSpan.start);
- if (_currentInfo.userCode.partOf != null) {
- _messages.error('expected a library, not a part.',
- node.sourceSpan);
- }
- }
- }
-
- void _tooManyScriptsError(Node node) {
- var location = _currentInfo is ComponentInfo ?
- 'a custom element declaration' : 'the top-level HTML page';
-
- _messages.error('there should be only one dart script tag in $location.',
- node.sourceSpan);
}
}
diff --git a/pkg/polymer/lib/src/compiler.dart b/pkg/polymer/lib/src/compiler.dart
index 5e2c98f..9d5d10d 100644
--- a/pkg/polymer/lib/src/compiler.dart
+++ b/pkg/polymer/lib/src/compiler.dart
@@ -6,30 +6,21 @@
import 'dart:async';
import 'dart:collection' show SplayTreeMap;
-import 'dart:json' as json;
-import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, UriBasedDirective;
import 'package:csslib/visitor.dart' show StyleSheet, treeToDebugString;
import 'package:html5lib/dom.dart';
import 'package:html5lib/parser.dart';
-import 'package:observe/transform.dart' show transformObservables;
-import 'package:source_maps/span.dart' show Span;
-import 'package:source_maps/refactor.dart' show TextEditTransaction;
-import 'package:source_maps/printer.dart';
import 'analyzer.dart';
import 'css_analyzer.dart' show analyzeCss, findUrlsImported,
findImportsInStyleSheet, parseCss;
import 'css_emitters.dart' show rewriteCssUris,
emitComponentStyleSheet, emitOriginalCss, emitStyleSheet;
-import 'dart_parser.dart';
-import 'emitters.dart';
import 'file_system.dart';
import 'files.dart';
import 'info.dart';
import 'messages.dart';
import 'compiler_options.dart';
-import 'paths.dart';
import 'utils.dart';
/**
@@ -39,7 +30,8 @@
*
* Adds emitted error/warning to [messages], if [messages] is supplied.
*/
-Document parseHtml(contents, String sourcePath, Messages messages) {
+Document parseHtml(contents, String sourcePath, Messages messages,
+ bool checkDocType) {
var parser = new HtmlParser(contents, generateSpans: true,
sourceUrl: sourcePath);
var document = parser.parse();
@@ -47,7 +39,9 @@
// Note: errors aren't fatal in HTML (unless strict mode is on).
// So just print them as warnings.
for (var e in parser.errors) {
- messages.warning(e.message, e.span);
+ if (checkDocType || e.errorCode != 'expected-doctype-but-got-start-tag') {
+ messages.warning(e.message, e.span);
+ }
}
return document;
}
@@ -57,12 +51,11 @@
final FileSystem fileSystem;
final CompilerOptions options;
final List<SourceFile> files = <SourceFile>[];
- final List<OutputFile> output = <OutputFile>[];
String _mainPath;
+ String _packageRoot;
String _resetCssFile;
StyleSheet _cssResetStyleSheet;
- PathMapper _pathMapper;
Messages _messages;
FutureGroup _tasks;
@@ -70,7 +63,6 @@
/** Information about source [files] given their href. */
final Map<String, FileInfo> info = new SplayTreeMap<String, FileInfo>();
- final _edits = new Map<DartCodeInfo, TextEditTransaction>();
final GlobalInfo global = new GlobalInfo();
@@ -79,8 +71,7 @@
_mainPath = options.inputFile;
var mainDir = path.dirname(_mainPath);
var baseDir = options.baseDir != null ? options.baseDir : mainDir;
- var outputDir = options.outputDir != null ? options.outputDir : mainDir;
- var packageRoot = options.packageRoot != null ? options.packageRoot
+ _packageRoot = options.packageRoot != null ? options.packageRoot
: path.join(path.dirname(_mainPath), 'packages');
if (options.resetCssFile != null) {
@@ -92,18 +83,14 @@
}
// Normalize paths - all should be relative or absolute paths.
- if (path.isAbsolute(_mainPath) || path.isAbsolute(baseDir) ||
- path.isAbsolute(outputDir) || path.isAbsolute(packageRoot)) {
+ if (path.isAbsolute(_mainPath) || path.isAbsolute(baseDir)
+ || path.isAbsolute(_packageRoot)) {
if (path.isRelative(_mainPath)) _mainPath = path.resolve(_mainPath);
if (path.isRelative(baseDir)) baseDir = path.resolve(baseDir);
- if (path.isRelative(outputDir)) outputDir = path.resolve(outputDir);
- if (path.isRelative(packageRoot)) {
- packageRoot = path.resolve(packageRoot);
+ if (path.isRelative(_packageRoot)) {
+ _packageRoot = path.resolve(_packageRoot);
}
}
- _pathMapper = new PathMapper(
- baseDir, outputDir, packageRoot, options.forceMangle,
- options.rewriteUrls);
}
/** Compile the application starting from the given input file. */
@@ -118,15 +105,9 @@
// Analyze all CSS files.
_time('Analyzed Style Sheets', '', () =>
- analyzeCss(_pathMapper.packageRoot, files, info,
+ analyzeCss(_packageRoot, files, info,
global.pseudoElements, _messages,
warningsAsErrors: options.warningsAsErrors));
-
- // TODO(jmesserly): need to go through our errors, and figure out if some
- // of them should be warnings instead.
- if (_messages.hasErrors || options.analysisOnly) return;
- _transformDart();
- _emit();
});
}
@@ -139,7 +120,7 @@
_tasks = new FutureGroup();
_processed = new Set();
_processed.add(inputFile);
- _tasks.add(_parseHtmlFile(new UrlInfo(inputFile, inputFile, null)));
+ _tasks.add(_parseHtmlFile(new UrlInfo(inputFile, inputFile, null), true));
return _tasks.future;
}
@@ -151,8 +132,8 @@
files.add(file);
var fileInfo = _time('Analyzed definitions', inputUrl.url, () {
- return analyzeDefinitions(global, inputUrl, file.document,
- _pathMapper.packageRoot, _messages, isEntryPoint: isEntryPoint);
+ return analyzeDefinitions(global, inputUrl, file.document, _packageRoot,
+ _messages);
});
info[inputUrl.resolvedPath] = fileInfo;
@@ -162,9 +143,6 @@
null)));
}
- _setOutputFilenames(fileInfo);
- _processImports(fileInfo);
-
// Load component files referenced by [file].
for (var link in fileInfo.componentLinks) {
_loadFile(link, _parseHtmlFile);
@@ -175,28 +153,18 @@
_loadFile(link, _parseCssFile);
}
- // Load .dart files being referenced in the page.
- _loadFile(fileInfo.externalFile, _parseDartFile);
-
// Process any @imports inside of a <style> tag.
- var urlInfos = findUrlsImported(fileInfo, fileInfo.inputUrl,
- _pathMapper.packageRoot, file.document, _messages, options);
+ var urlInfos = findUrlsImported(fileInfo, fileInfo.inputUrl, _packageRoot,
+ file.document, _messages, options);
for (var urlInfo in urlInfos) {
_loadFile(urlInfo, _parseCssFile);
}
// Load .dart files being referenced in components.
for (var component in fileInfo.declaredComponents) {
- if (component.externalFile != null) {
- _loadFile(component.externalFile, _parseDartFile);
- } else if (component.userCode != null) {
- _processImports(component);
- }
-
// Process any @imports inside of the <style> tag in a component.
- var urlInfos = findUrlsImported(component,
- component.declaringFile.inputUrl, _pathMapper.packageRoot,
- component.element, _messages, options);
+ var urlInfos = findUrlsImported(component, fileInfo.inputUrl,
+ _packageRoot, component.element, _messages, options);
for (var urlInfo in urlInfos) {
_loadFile(urlInfo, _parseCssFile);
}
@@ -216,36 +184,8 @@
}
}
- void _setOutputFilenames(FileInfo fileInfo) {
- var filePath = fileInfo.dartCodeUrl.resolvedPath;
- fileInfo.outputFilename = _pathMapper.mangle(path.basename(filePath),
- '.dart', path.extension(filePath) == '.html');
- for (var component in fileInfo.declaredComponents) {
- var externalFile = component.externalFile;
- var name = null;
- if (externalFile != null) {
- name = _pathMapper.mangle(
- path.basename(externalFile.resolvedPath), '.dart');
- } else {
- var declaringFile = component.declaringFile;
- var prefix = path.basename(declaringFile.inputUrl.resolvedPath);
- if (declaringFile.declaredComponents.length == 1
- && !declaringFile.codeAttached && !declaringFile.isEntryPoint) {
- name = _pathMapper.mangle(prefix, '.dart', true);
- } else {
- var componentName = component.tagName.replaceAll('-', '_');
- name = _pathMapper.mangle('${prefix}_$componentName', '.dart', true);
- }
- }
- component.outputFilename = name;
- }
- }
-
/** Parse an HTML file. */
- Future _parseHtmlFile(UrlInfo inputUrl) {
- if (!_pathMapper.checkInputPath(inputUrl, _messages)) {
- return new Future<SourceFile>.value(null);
- }
+ Future _parseHtmlFile(UrlInfo inputUrl, [bool checkDocType = false]) {
var filePath = inputUrl.resolvedPath;
return fileSystem.readTextOrBytes(filePath)
.catchError((e) => _readError(e, inputUrl))
@@ -253,31 +193,14 @@
if (source == null) return;
var file = new SourceFile(filePath);
file.document = _time('Parsed', filePath,
- () => parseHtml(source, filePath, _messages));
+ () => parseHtml(source, filePath, _messages, checkDocType));
_processHtmlFile(inputUrl, file);
});
}
- /** Parse a Dart file. */
- Future _parseDartFile(UrlInfo inputUrl) {
- if (!_pathMapper.checkInputPath(inputUrl, _messages)) {
- return new Future<SourceFile>.value(null);
- }
- var filePath = inputUrl.resolvedPath;
- return fileSystem.readText(filePath)
- .catchError((e) => _readError(e, inputUrl))
- .then((code) {
- if (code == null) return;
- var file = new SourceFile(filePath, type: SourceFile.DART);
- file.code = code;
- _processDartFile(inputUrl, file);
- });
- }
-
/** Parse a stylesheet file. */
Future _parseCssFile(UrlInfo inputUrl) {
- if (!options.emulateScopedCss ||
- !_pathMapper.checkInputPath(inputUrl, _messages)) {
+ if (!options.emulateScopedCss) {
return new Future<SourceFile>.value(null);
}
var filePath = inputUrl.resolvedPath;
@@ -305,29 +228,6 @@
return null;
}
- void _processDartFile(UrlInfo inputUrl, SourceFile dartFile) {
- if (dartFile == null) return;
-
- files.add(dartFile);
-
- var resolvedPath = inputUrl.resolvedPath;
- var fileInfo = new FileInfo(inputUrl);
- info[resolvedPath] = fileInfo;
- fileInfo.inlinedCode = parseDartCode(resolvedPath, dartFile.code);
- fileInfo.outputFilename =
- _pathMapper.mangle(path.basename(resolvedPath), '.dart', false);
-
- _processImports(fileInfo);
- }
-
- void _processImports(LibraryInfo library) {
- if (library.userCode == null) return;
-
- for (var directive in library.userCode.directives) {
- _loadFile(_getDirectiveUrlInfo(library, directive), _parseDartFile);
- }
- }
-
void _processCssFile(UrlInfo inputUrl, SourceFile cssFile) {
if (cssFile == null) return;
@@ -349,8 +249,7 @@
void _resolveStyleSheetImports(UrlInfo inputUrl, String processingFile,
StyleSheet styleSheet) {
var urlInfos = _time('CSS imports', processingFile, () =>
- findImportsInStyleSheet(styleSheet, _pathMapper.packageRoot, inputUrl,
- _messages));
+ findImportsInStyleSheet(styleSheet, _packageRoot, inputUrl, _messages));
for (var urlInfo in urlInfos) {
if (urlInfo == null) break;
@@ -359,187 +258,6 @@
}
}
- String _directiveUri(Directive directive) {
- var uriDirective = (directive as UriBasedDirective).uri;
- return (uriDirective as dynamic).value;
- }
-
- UrlInfo _getDirectiveUrlInfo(LibraryInfo library, Directive directive) {
- var uri = _directiveUri(directive);
- if (uri.startsWith('dart:')) return null;
- if (uri.startsWith('package:') && uri.startsWith('package:polymer/')) {
- // Don't process our own package -- we'll implement @observable manually.
- return null;
- }
-
- var span = library.userCode.sourceFile.span(
- directive.offset, directive.end);
- return UrlInfo.resolve(uri, library.dartCodeUrl, span,
- _pathMapper.packageRoot, _messages);
- }
-
- /**
- * Transform Dart source code.
- * Currently, the only transformation is [transformObservables].
- * Calls _emitModifiedDartFiles to write the transformed files.
- */
- void _transformDart() {
- var libraries = _findAllDartLibraries();
-
- var transformed = [];
- for (var lib in libraries) {
- var userCode = lib.userCode;
- var transaction = transformObservables(userCode.compilationUnit,
- userCode.sourceFile, userCode.code, _messages);
- if (transaction != null) {
- _edits[lib.userCode] = transaction;
- if (transaction.hasEdits) {
- transformed.add(lib);
- } else if (lib.htmlFile != null) {
- // All web components will be transformed too. Track that.
- transformed.add(lib);
- }
- }
- }
-
- _findModifiedDartFiles(libraries, transformed);
-
- libraries.forEach(_fixImports);
-
- _emitModifiedDartFiles(libraries);
- }
-
- /**
- * Finds all Dart code libraries.
- * Each library will have [LibraryInfo.inlinedCode] that is non-null.
- * Also each inlinedCode will be unique.
- */
- List<LibraryInfo> _findAllDartLibraries() {
- var libs = <LibraryInfo>[];
- void _addLibrary(LibraryInfo lib) {
- if (lib.inlinedCode != null) libs.add(lib);
- }
-
- for (var sourceFile in files) {
- var file = info[sourceFile.path];
- _addLibrary(file);
- file.declaredComponents.forEach(_addLibrary);
- }
-
- // Assert that each file path is unique.
- assert(_uniquePaths(libs));
- return libs;
- }
-
- bool _uniquePaths(List<LibraryInfo> libs) {
- var seen = new Set();
- for (var lib in libs) {
- if (seen.contains(lib.inlinedCode)) {
- throw new StateError('internal error: '
- 'duplicate user code for ${lib.dartCodeUrl.resolvedPath}.'
- ' Files were: $files');
- }
- seen.add(lib.inlinedCode);
- }
- return true;
- }
-
- /**
- * Queue modified Dart files to be written.
- * This will not write files that are handled by [WebComponentEmitter] and
- * [EntryPointEmitter].
- */
- void _emitModifiedDartFiles(List<LibraryInfo> libraries) {
- for (var lib in libraries) {
- // Components will get emitted by WebComponentEmitter, and the
- // entry point will get emitted by MainPageEmitter.
- // So we only need to worry about other .dart files.
- if (lib.modified && lib is FileInfo &&
- lib.htmlFile == null && !lib.isEntryPoint) {
- var transaction = _edits[lib.userCode];
-
- // Save imports that were modified by _fixImports.
- for (var d in lib.userCode.directives) {
- transaction.edit(d.offset, d.end, d.toString());
- }
-
- if (!lib.userCode.isPart) {
- var pos = lib.userCode.firstPartOffset;
- // Note: we use a different prefix than "autogenerated" to make
- // ChangeRecord unambiguous. Otherwise it would be imported by this
- // and polymer, resulting in a collision.
- // TODO(jmesserly): only generate this for libraries that need it.
- transaction.edit(pos, pos, "\nimport "
- "'package:observe/observe.dart' as __observe;\n");
- }
- _emitFileAndSourceMaps(lib, transaction.commit(), lib.dartCodeUrl);
- }
- }
- }
-
- /**
- * This method computes which Dart files have been modified, starting
- * from [transformed] and marking recursively through all files that import
- * the modified files.
- */
- void _findModifiedDartFiles(List<LibraryInfo> libraries,
- List<FileInfo> transformed) {
-
- if (transformed.length == 0) return;
-
- // Compute files that reference each file, then use this information to
- // flip the modified bit transitively. This is a lot simpler than trying
- // to compute it the other way because of circular references.
- for (var lib in libraries) {
- for (var directive in lib.userCode.directives) {
- var importPath = _getDirectiveUrlInfo(lib, directive);
- if (importPath == null) continue;
-
- var importInfo = info[importPath.resolvedPath];
- if (importInfo != null) {
- importInfo.referencedBy.add(lib);
- }
- }
- }
-
- // Propegate the modified bit to anything that references a modified file.
- void setModified(LibraryInfo library) {
- if (library.modified) return;
- library.modified = true;
- library.referencedBy.forEach(setModified);
- }
- transformed.forEach(setModified);
-
- for (var lib in libraries) {
- // We don't need this anymore, so free it.
- lib.referencedBy = null;
- }
- }
-
- void _fixImports(LibraryInfo library) {
- // Fix imports. Modified files must use the generated path, otherwise
- // we need to make the path relative to the input.
- for (var directive in library.userCode.directives) {
- var importPath = _getDirectiveUrlInfo(library, directive);
- if (importPath == null) continue;
- var importInfo = info[importPath.resolvedPath];
- if (importInfo == null) continue;
-
- String newUri = null;
- if (importInfo.modified) {
- // Use the generated URI for this file.
- newUri = _pathMapper.importUrlFor(library, importInfo);
- } else if (options.rewriteUrls) {
- // Get the relative path to the input file.
- newUri = _pathMapper.transformUrl(
- library.dartCodeUrl.resolvedPath, directive.uri.value);
- }
- if (newUri != null) {
- directive.uri = createStringLiteral(newUri);
- }
- }
- }
-
/** Run the analyzer on every input html file. */
void _analyze() {
var uniqueIds = new IntIterator();
@@ -552,75 +270,6 @@
}
}
- /** Emit the generated code corresponding to each input file. */
- void _emit() {
- for (var file in files) {
- if (file.isDart || file.isStyleSheet) continue;
- _time('Codegen', file.path, () {
- var fileInfo = info[file.path];
- _emitComponents(fileInfo);
- });
- }
-
- var entryPoint = files[0];
- assert(info[entryPoint.path].isEntryPoint);
- _emitMainDart(entryPoint);
- _emitMainHtml(entryPoint);
-
- assert(_unqiueOutputs());
- }
-
- bool _unqiueOutputs() {
- var seen = new Set();
- for (var file in output) {
- if (seen.contains(file.path)) {
- throw new StateError('internal error: '
- 'duplicate output file ${file.path}. Files were: $output');
- }
- seen.add(file.path);
- }
- return true;
- }
-
- /** Emit the main .dart file. */
- void _emitMainDart(SourceFile file) {
- var fileInfo = info[file.path];
-
- var codeInfo = fileInfo.userCode;
- if (codeInfo != null) {
- var printer = new NestedPrinter(0);
- if (codeInfo.libraryName == null) {
- printer.addLine('library ${fileInfo.libraryName};');
- }
- printer.add(codeInfo.code);
- _emitFileAndSourceMaps(fileInfo, printer, fileInfo.dartCodeUrl);
- }
- }
-
- // TODO(jmesserly): refactor this out of Compiler.
- /** Generate an html file with the (trimmed down) main html page. */
- void _emitMainHtml(SourceFile file) {
- var fileInfo = info[file.path];
-
- var bootstrapName = '${path.basename(file.path)}_bootstrap.dart';
- var bootstrapPath = path.join(path.dirname(file.path), bootstrapName);
- var bootstrapOutPath = _pathMapper.outputPath(bootstrapPath, '');
- var bootstrapOutName = path.basename(bootstrapOutPath);
- var bootstrapInfo = new FileInfo(new UrlInfo('', bootstrapPath, null));
- var printer = generateBootstrapCode(bootstrapInfo, fileInfo, global,
- _pathMapper, options);
- printer.build(bootstrapOutPath);
- output.add(new OutputFile(
- bootstrapOutPath, printer.text, source: file.path));
-
- var document = file.document;
- var hasCss = _emitAllCss();
- transformMainHtml(document, fileInfo, _pathMapper, hasCss,
- options.rewriteUrls, _messages, global, bootstrapOutName);
- output.add(new OutputFile(_pathMapper.outputPath(file.path, '.html'),
- document.outerHtml, source: file.path));
- }
-
// TODO(jmesserly): refactor this and other CSS related transforms out of
// Compiler.
/**
@@ -638,22 +287,12 @@
var fileInfo = info[file.path];
if (file.isStyleSheet) {
for (var styleSheet in fileInfo.styleSheets) {
- // Translate any URIs in CSS.
- rewriteCssUris(_pathMapper, fileInfo.inputUrl.resolvedPath,
- options.rewriteUrls, styleSheet);
css.write(
'/* Auto-generated from style sheet href = ${file.path} */\n'
'/* DO NOT EDIT. */\n\n');
css.write(emitStyleSheet(styleSheet, fileInfo));
css.write('\n\n');
}
-
- // Emit the linked style sheet in the output directory.
- if (fileInfo.inputUrl.url != _resetCssFile) {
- var outCss = _pathMapper.outputPath(fileInfo.inputUrl.resolvedPath,
- '');
- output.add(new OutputFile(outCss, css.toString()));
- }
}
}
@@ -664,9 +303,6 @@
for (var component in fileInfo.declaredComponents) {
for (var styleSheet in component.styleSheets) {
// Translate any URIs in CSS.
- rewriteCssUris(_pathMapper, fileInfo.inputUrl.resolvedPath,
- options.rewriteUrls, styleSheet);
-
if (buff.isEmpty) {
buff.write(
'/* Auto-generated from components style tags. */\n'
@@ -706,55 +342,9 @@
}
if (buff.isEmpty) return false;
-
- var cssPath = _pathMapper.outputPath(_mainPath, '.css', true);
- output.add(new OutputFile(cssPath, buff.toString()));
return true;
}
- /** Emits the Dart code for all components in [fileInfo]. */
- void _emitComponents(FileInfo fileInfo) {
- for (var component in fileInfo.declaredComponents) {
- // TODO(terry): Handle more than one stylesheet per component
- if (component.styleSheets.length > 1 && options.emulateScopedCss) {
- var span = component.externalFile != null
- ? component.externalFile.sourceSpan : null;
- _messages.warning(
- 'Component has more than one stylesheet - first stylesheet used.',
- span);
- }
- var printer = emitPolymerElement(
- component, _pathMapper, _edits[component.userCode], options);
- _emitFileAndSourceMaps(component, printer, component.externalFile);
- }
- }
-
- /**
- * Emits a file that was created using [NestedPrinter] and it's corresponding
- * source map file.
- */
- void _emitFileAndSourceMaps(
- LibraryInfo lib, NestedPrinter printer, UrlInfo dartCodeUrl) {
- // Bail if we had an error generating the code for the file.
- if (printer == null) return;
-
- var libPath = _pathMapper.outputLibraryPath(lib);
- var dir = path.dirname(libPath);
- var filename = path.basename(libPath);
- printer.add('\n//# sourceMappingURL=$filename.map');
- printer.build(libPath);
- var sourcePath = dartCodeUrl != null ? dartCodeUrl.resolvedPath : null;
- output.add(new OutputFile(libPath, printer.text, source: sourcePath));
- // Fix-up the paths in the source map file
- var sourceMap = json.parse(printer.map);
- var urls = sourceMap['sources'];
- for (int i = 0; i < urls.length; i++) {
- urls[i] = path.relative(urls[i], from: dir);
- }
- output.add(new OutputFile(path.join(dir, '$filename.map'),
- json.stringify(sourceMap)));
- }
-
_time(String logMessage, String filePath, callback(),
{bool printTime: false}) {
var message = new StringBuffer();
diff --git a/pkg/polymer/lib/src/compiler_options.dart b/pkg/polymer/lib/src/compiler_options.dart
index 4c1d317..2d446ef 100644
--- a/pkg/polymer/lib/src/compiler_options.dart
+++ b/pkg/polymer/lib/src/compiler_options.dart
@@ -56,9 +56,6 @@
/** Use CSS file for CSS Reset. */
final String resetCssFile;
- /** Whether to analyze the input for warnings without generating any code. */
- final bool analysisOnly;
-
// We could make this faster, if it ever matters.
factory CompilerOptions() => parse(['']);
@@ -76,7 +73,6 @@
componentsOnly = args['components_only'],
emulateScopedCss = args['scoped-css'],
resetCssFile = args['css-reset'],
- analysisOnly = !args['deploy'],
inputFile = args.rest.length > 0 ? args.rest[0] : null;
/**
@@ -116,8 +112,8 @@
..addFlag('scoped-css', help: 'Emulate scoped styles with CSS polyfill',
defaultsTo: false)
..addOption('css-reset', abbr: 'r', help: 'CSS file used to reset CSS')
- ..addFlag('deploy', help: 'Emit code used for deploying a polymer app,'
- ' if false just show warnings and errors (default)',
+ // TODO(sigmund): remove this flag
+ ..addFlag('deploy', help: '(deprecated) currently a noop',
defaultsTo: false, negatable: false)
..addOption('out', abbr: 'o', help: 'Directory where to generate files'
' (defaults to the same directory as the source file)')
diff --git a/pkg/polymer/lib/src/css_analyzer.dart b/pkg/polymer/lib/src/css_analyzer.dart
index 270af5d..0b96825 100644
--- a/pkg/polymer/lib/src/css_analyzer.dart
+++ b/pkg/polymer/lib/src/css_analyzer.dart
@@ -48,7 +48,7 @@
void process(SourceFile file) {
var fileInfo = info[file.path];
if (file.isStyleSheet || fileInfo.styleSheets.length > 0) {
- var styleSheets = processVars(fileInfo);
+ var styleSheets = processVars(fileInfo.inputUrl, fileInfo);
// Add to list of all style sheets analyzed.
allStyleSheets.addAll(styleSheets);
@@ -56,7 +56,7 @@
// Process any components.
for (var component in fileInfo.declaredComponents) {
- var all = processVars(component);
+ var all = processVars(fileInfo.inputUrl, component);
// Add to list of all style sheets analyzed.
allStyleSheets.addAll(all);
@@ -70,9 +70,9 @@
for (var tree in allStyleSheets) new _RemoveVarDefinitions().visitTree(tree);
}
- List<StyleSheet> processVars(var libraryInfo) {
+ List<StyleSheet> processVars(inputUrl, libraryInfo) {
// Get list of all stylesheet(s) dependencies referenced from this file.
- var styleSheets = _dependencies(libraryInfo).toList();
+ var styleSheets = _dependencies(inputUrl, libraryInfo).toList();
var errors = [];
css.analyze(styleSheets, errors: errors, options:
@@ -118,14 +118,9 @@
* return a list of all referenced stylesheet dependencies (@imports or <link
* rel="stylesheet" ..>).
*/
- Set<StyleSheet> _dependencies(var libraryInfo, {Set<StyleSheet> seen}) {
+ Set<StyleSheet> _dependencies(inputUrl, libraryInfo, {Set<StyleSheet> seen}) {
if (seen == null) seen = new Set();
- // Used to resolve all pathing information.
- var inputUrl = libraryInfo is FileInfo
- ? libraryInfo.inputUrl
- : (libraryInfo as ComponentInfo).declaringFile.inputUrl;
-
for (var styleSheet in libraryInfo.styleSheets) {
if (!seen.contains(styleSheet)) {
// TODO(terry): VM uses expandos to implement hashes. Currently, it's a
@@ -152,7 +147,8 @@
var urls = findImportsInStyleSheet(ss, packageRoot, inputUrl,
_messages);
for (var url in urls) {
- _dependencies(info[url.resolvedPath], seen: seen);
+ var fileInfo = info[url.resolvedPath];
+ _dependencies(fileInfo.inputUrl, fileInfo, seen: seen);
}
}
}
diff --git a/pkg/polymer/lib/src/css_emitters.dart b/pkg/polymer/lib/src/css_emitters.dart
index d1863f5..a4d4b7d 100644
--- a/pkg/polymer/lib/src/css_emitters.dart
+++ b/pkg/polymer/lib/src/css_emitters.dart
@@ -8,41 +8,6 @@
UriTerm, Selector, HostDirective, SimpleSelectorSequence, StyleSheet;
import 'info.dart';
-import 'paths.dart' show PathMapper;
-import 'utils.dart';
-
-void rewriteCssUris(PathMapper pathMapper, String cssPath, bool rewriteUrls,
- StyleSheet styleSheet) {
- new _UriVisitor(pathMapper, cssPath, rewriteUrls).visitTree(styleSheet);
-}
-
-/** Compute each CSS URI resource relative from the generated CSS file. */
-class _UriVisitor extends Visitor {
- /**
- * Relative path from the output css file to the location of the original
- * css file that contained the URI to each resource.
- */
- final String _pathToOriginalCss;
-
- factory _UriVisitor(PathMapper pathMapper, String cssPath, bool rewriteUrl) {
- var cssDir = path.dirname(cssPath);
- var outCssDir = rewriteUrl ? pathMapper.outputDirPath(cssPath)
- : path.dirname(cssPath);
- return new _UriVisitor._internal(path.relative(cssDir, from: outCssDir));
- }
-
- _UriVisitor._internal(this._pathToOriginalCss);
-
- void visitUriTerm(UriTerm node) {
- // Don't touch URIs that have any scheme (http, etc.).
- var uri = Uri.parse(node.text);
- if (uri.host != '') return;
- if (uri.scheme != '' && uri.scheme != 'package') return;
-
- node.text = pathToUrl(
- path.normalize(path.join(_pathToOriginalCss, node.text)));
- }
-}
/** Emit the contents of the style tag outside of a component. */
diff --git a/pkg/polymer/lib/src/dart_parser.dart b/pkg/polymer/lib/src/dart_parser.dart
deleted file mode 100644
index a2f44c3..0000000
--- a/pkg/polymer/lib/src/dart_parser.dart
+++ /dev/null
@@ -1,132 +0,0 @@
-// 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.
-
-/**
- * Parser for Dart code based on the experimental analyzer.
- */
-library dart_parser;
-
-import 'package:analyzer_experimental/src/generated/ast.dart';
-import 'package:analyzer_experimental/src/generated/error.dart';
-import 'package:analyzer_experimental/src/generated/parser.dart';
-import 'package:analyzer_experimental/src/generated/scanner.dart';
-import 'package:source_maps/span.dart' show SourceFile, SourceFileSegment, Location;
-import 'utils.dart' show escapeDartString;
-
-/** Information extracted from a source Dart file. */
-class DartCodeInfo {
-
- /** Library qualified identifier, if any. */
- final String libraryName;
-
- /** Library which the code is part-of, if any. */
- final String partOf;
-
- /** Declared imports, exports, and parts. */
- final List<Directive> directives;
-
- /** Source file representation used to compute source map information. */
- final SourceFile sourceFile;
-
- /** The parsed code. */
- final CompilationUnit compilationUnit;
-
- /** The full source code. */
- final String code;
-
- DartCodeInfo(this.libraryName, this.partOf, this.directives, code,
- this.sourceFile, [compilationUnit])
- : this.code = code,
- this.compilationUnit = compilationUnit == null
- ? _parseCompilationUnit(code) : compilationUnit;
-
- bool get isPart =>
- compilationUnit.directives.any((d) => d is PartOfDirective);
-
- int get directivesEnd {
- if (compilationUnit.directives.length == 0) return 0;
- return compilationUnit.directives.last.end;
- }
-
- /**
- * The position of the first "part" directive. If none is found,
- * this behaves like [directivesEnd].
- */
- int get firstPartOffset {
- for (var directive in compilationUnit.directives) {
- if (directive is PartDirective) return directive.offset;
- }
- // No part directives, just return directives end.
- return directivesEnd;
- }
-
- /** Gets the code after the [directives]. */
- String codeAfterDirectives() => code.substring(directivesEnd);
-
- ClassDeclaration findClass(String name) {
- for (var decl in compilationUnit.declarations) {
- if (decl is ClassDeclaration) {
- if (decl.name.name == name) return decl;
- }
- }
- return null;
- }
-}
-
-SimpleStringLiteral createStringLiteral(String contents) {
- var lexeme = "'${escapeDartString(contents)}'";
- var token = new StringToken(TokenType.STRING, lexeme, null);
- return new SimpleStringLiteral.full(token, contents);
-}
-
-
-/**
- * Parse and extract top-level directives from [code].
- *
- */
-// TODO(sigmund): log emitted error/warning messages
-DartCodeInfo parseDartCode(String path, String code, [Location offset]) {
- var unit = _parseCompilationUnit(code);
-
- // Extract some information from the compilation unit.
- String libraryName, partName;
- var directives = [];
- int directiveEnd = 0;
- for (var directive in unit.directives) {
- if (directive is LibraryDirective) {
- libraryName = directive.name.name;
- } else if (directive is PartOfDirective) {
- partName = directive.libraryName.name;
- } else {
- assert(directive is UriBasedDirective);
- // Normalize the library URI.
- var uriNode = directive.uri;
- if (uriNode is! SimpleStringLiteral) {
- String uri = uriNode.accept(new ConstantEvaluator());
- directive.uri = createStringLiteral(uri);
- }
- directives.add(directive);
- }
- }
-
- var sourceFile = offset == null
- ? new SourceFile.text(path, code)
- : new SourceFileSegment(path, code, offset);
-
- return new DartCodeInfo(libraryName, partName, directives, code,
- sourceFile, unit);
-}
-
-CompilationUnit _parseCompilationUnit(String code) {
- var errorListener = new _ErrorCollector();
- var scanner = new StringScanner(null, code, errorListener);
- var token = scanner.tokenize();
- var parser = new Parser(null, errorListener);
- return parser.parseCompilationUnit(token);
-}
-
-class _ErrorCollector extends AnalysisErrorListener {
- final errors = new List<AnalysisError>();
- onError(error) => errors.add(error);
-}
diff --git a/pkg/polymer/lib/src/emitters.dart b/pkg/polymer/lib/src/emitters.dart
deleted file mode 100644
index e611c59..0000000
--- a/pkg/polymer/lib/src/emitters.dart
+++ /dev/null
@@ -1,246 +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.
-
-/** Collects several code emitters for the template tool. */
-library emitters;
-
-import 'package:html5lib/dom.dart';
-import 'package:html5lib/dom_parsing.dart' show TreeVisitor;
-import 'package:html5lib/parser.dart' show parseFragment;
-import 'package:source_maps/printer.dart';
-import 'package:source_maps/refactor.dart';
-
-import 'compiler_options.dart';
-import 'css_emitters.dart' show emitStyleSheet, emitOriginalCss;
-import 'html5_utils.dart';
-import 'info.dart' show ComponentInfo, FileInfo, GlobalInfo;
-import 'messages.dart';
-import 'paths.dart' show PathMapper;
-import 'utils.dart' show escapeDartString, path;
-
-/** Generates the class corresponding to a single web component. */
-NestedPrinter emitPolymerElement(ComponentInfo info, PathMapper pathMapper,
- TextEditTransaction transaction, CompilerOptions options) {
- if (info.classDeclaration == null) return null;
-
- var codeInfo = info.userCode;
- if (transaction == null) {
- // TODO(sigmund): avoid emitting this file if we don't need to do any
- // modifications (e.g. no @observable and not adding the libraryName).
- transaction = new TextEditTransaction(codeInfo.code, codeInfo.sourceFile);
- }
- if (codeInfo.libraryName == null) {
- // For deploy, we need to import the library associated with the component,
- // so we need to ensure there is a library directive.
- var libraryName = info.tagName.replaceAll(new RegExp('[-./]'), '_');
- transaction.edit(0, 0, 'library $libraryName;');
- }
- return transaction.commit();
-}
-
-/** The code that will be used to bootstrap the application. */
-NestedPrinter generateBootstrapCode(
- FileInfo info, FileInfo userMainInfo, GlobalInfo global,
- PathMapper pathMapper, CompilerOptions options) {
-
- var printer = new NestedPrinter(0)
- ..addLine('library app_bootstrap;')
- ..addLine('')
- ..addLine("import 'package:polymer/polymer.dart';")
- ..addLine("import 'dart:mirrors' show currentMirrorSystem;");
-
- int i = 0;
- for (var c in global.components.values) {
- if (c.hasConflict) continue;
- printer.addLine("import '${pathMapper.importUrlFor(info, c)}' as i$i;");
- i++;
- }
- if (userMainInfo.userCode != null) {
- printer..addLine("import '${pathMapper.importUrlFor(info, userMainInfo)}' "
- "as i$i;\n");
- }
-
- printer..addLine('')
- ..addLine('void main() {')
- ..indent += 1
- ..addLine("initPolymer([")
- ..indent += 2;
-
- for (var c in global.components.values) {
- if (c.hasConflict) continue;
- printer.addLine("'${pathMapper.importUrlFor(info, c)}',");
- }
-
- if (userMainInfo.userCode != null) {
- printer.addLine("'${pathMapper.importUrlFor(info, userMainInfo)}',");
- }
-
- return printer
- ..indent -= 1
- ..addLine('],')
- ..addLine("currentMirrorSystem().isolate.rootLibrary.uri.toString());")
- ..indent -= 2
- ..addLine('}');
-}
-
-
-/**
- * Rewrites attributes that contain relative URL (excluding src urls in script
- * and link tags which are already rewritten by other parts of the compiler).
-*/
-class _AttributeUrlTransform extends TreeVisitor {
- final String filePath;
- final PathMapper pathMapper;
-
- _AttributeUrlTransform(this.filePath, this.pathMapper);
-
- visitElement(Element node) {
- if (node.tagName == 'script') return;
- if (node.tagName == 'link') return;
-
- for (var key in node.attributes.keys) {
- if (urlAttributes.contains(key)) {
- node.attributes[key] =
- pathMapper.transformUrl(filePath, node.attributes[key]);
- }
- }
- super.visitElement(node);
- }
-}
-
-final _shadowDomJS = new RegExp(r'shadowdom\..*\.js', caseSensitive: false);
-final _bootJS = new RegExp(r'.*/polymer/boot.js', caseSensitive: false);
-
-/** Trim down the html for the main html page. */
-void transformMainHtml(Document document, FileInfo fileInfo,
- PathMapper pathMapper, bool hasCss, bool rewriteUrls,
- Messages messages, GlobalInfo global, String bootstrapOutName) {
- var filePath = fileInfo.inputUrl.resolvedPath;
-
- var dartLoaderTag = null;
- bool shadowDomFound = false;
- for (var tag in document.queryAll('script')) {
- var src = tag.attributes['src'];
- if (src != null) {
- var last = src.split('/').last;
- if (last == 'dart.js' || last == 'testing.js') {
- dartLoaderTag = tag;
- } else if (_shadowDomJS.hasMatch(last)) {
- shadowDomFound = true;
- }
- }
- if (tag.attributes['type'] == 'application/dart') {
- tag.remove();
- } else if (src != null) {
- if (_bootJS.hasMatch(src)) {
- tag.remove();
- } else if (rewriteUrls) {
- tag.attributes["src"] = pathMapper.transformUrl(filePath, src);
- }
- }
- }
-
- for (var tag in document.queryAll('link')) {
- var href = tag.attributes['href'];
- var rel = tag.attributes['rel'];
- if (rel == 'component' || rel == 'components' || rel == 'import') {
- tag.remove();
- } else if (href != null && rewriteUrls && !hasCss) {
- // Only rewrite URL if rewrite on and we're not CSS polyfilling.
- tag.attributes['href'] = pathMapper.transformUrl(filePath, href);
- }
- }
-
- if (rewriteUrls) {
- // Transform any element's attribute which is a relative URL.
- new _AttributeUrlTransform(filePath, pathMapper).visit(document);
- }
-
- if (hasCss) {
- var newCss = pathMapper.mangle(path.basename(filePath), '.css', true);
- var linkElem = new Element.html(
- '<link rel="stylesheet" type="text/css" href="$newCss">');
- document.head.insertBefore(linkElem, null);
- }
-
- var styles = document.queryAll('style');
- if (styles.length > 0) {
- var allCss = new StringBuffer();
- fileInfo.styleSheets.forEach((styleSheet) =>
- allCss.write(emitStyleSheet(styleSheet, fileInfo)));
- styles[0].nodes.clear();
- styles[0].nodes.add(new Text(allCss.toString()));
- for (var i = styles.length - 1; i > 0 ; i--) {
- styles[i].remove();
- }
- }
-
- // TODO(jmesserly): put this in the global CSS file?
- // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html#css-additions
- document.head.nodes.insert(0, parseFragment(
- '<style shadowcssshim="">template { display: none; }</style>'));
-
- // Move all <element> declarations to the main HTML file
- // TODO(sigmund): remove this once we have HTMLImports implemented.
- for (var c in global.components.values) {
- document.body.nodes.insert(0, new Text('\n'));
- var fragment = c.element;
- for (var tag in fragment.queryAll('script')) {
- // TODO(sigmund): leave script tags around when we start using "boot.js"
- if (tag.attributes['type'] == 'application/dart') {
- tag.remove();
- }
- }
- document.body.nodes.insert(0, fragment);
- }
-
- if (!shadowDomFound) {
- // TODO(jmesserly): we probably shouldn't add this automatically.
- document.body.nodes.add(parseFragment('<script type="text/javascript" '
- 'src="packages/shadow_dom/shadow_dom.debug.js"></script>\n'));
-
- // JS interop code required for Polymer CSS shimming.
- document.body.nodes.add(parseFragment('<script type="text/javascript" '
- 'src="packages/browser/interop.js"></script>\n'));
- }
-
- var bootstrapScript = parseFragment(
- '<script type="application/dart" src="$bootstrapOutName"></script>');
- if (dartLoaderTag == null) {
- document.body.nodes.add(bootstrapScript);
- // TODO(jmesserly): turn this warning on.
- //messages.warning('Missing script to load Dart. '
- // 'Please add this line to your HTML file: $dartLoader',
- // document.body.sourceSpan);
- // TODO(sigmund): switch to 'boot.js'
- document.body.nodes.add(parseFragment('<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>\n'));
- } else if (dartLoaderTag.parent != document.body) {
- document.body.nodes.add(bootstrapScript);
- } else {
- document.body.insertBefore(bootstrapScript, dartLoaderTag);
- }
-
- // Insert the "auto-generated" comment after the doctype, otherwise IE will
- // go into quirks mode.
- int commentIndex = 0;
- DocumentType doctype =
- document.nodes.firstWhere((n) => n is DocumentType, orElse: () => null);
- if (doctype != null) {
- commentIndex = document.nodes.indexOf(doctype) + 1;
- // TODO(jmesserly): the html5lib parser emits a warning for missing
- // doctype, but it allows you to put it after comments. Presumably they do
- // this because some comments won't force IE into quirks mode (sigh). See
- // this link for more info:
- // http://bugzilla.validator.nu/show_bug.cgi?id=836
- // For simplicity we emit the warning always, like validator.nu does.
- if (doctype.tagName != 'html' || commentIndex != 1) {
- messages.warning('file should start with <!DOCTYPE html> '
- 'to avoid the possibility of it being parsed in quirks mode in IE. '
- 'See http://www.w3.org/TR/html5-diff/#doctype', doctype.sourceSpan);
- }
- }
- document.nodes.insert(commentIndex, parseFragment(
- '\n<!-- This file was auto-generated from $filePath. -->\n'));
-}
diff --git a/pkg/polymer/lib/src/html5_utils.dart b/pkg/polymer/lib/src/html5_utils.dart
deleted file mode 100644
index 391c12b..0000000
--- a/pkg/polymer/lib/src/html5_utils.dart
+++ /dev/null
@@ -1,29 +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.
-
-// TODO(jmesserly): html5lib might be a better home for this.
-// But at the moment we only need it here.
-
-library html5_utils;
-
-/**
- * HTML attributes that expect a URL value.
- * <http://dev.w3.org/html5/spec/section-index.html#attributes-1>
- *
- * Every one of these attributes is a URL in every context where it is used in
- * the DOM. The comments show every DOM element where an attribute can be used.
- */
-const urlAttributes = const [
- 'action', // in form
- 'background', // in body
- 'cite', // in blockquote, del, ins, q
- 'data', // in object
- 'formaction', // in button, input
- 'href', // in a, area, link, base, command
- 'icon', // in command
- 'manifest', // in html
- 'poster', // in video
- 'src', // in audio, embed, iframe, img, input, script, source, track,
- // video
-];
diff --git a/pkg/polymer/lib/src/info.dart b/pkg/polymer/lib/src/info.dart
index 9a7b530..5fa901f 100644
--- a/pkg/polymer/lib/src/info.dart
+++ b/pkg/polymer/lib/src/info.dart
@@ -10,14 +10,11 @@
import 'dart:collection' show SplayTreeMap, LinkedHashMap;
-import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:csslib/visitor.dart';
import 'package:html5lib/dom.dart';
import 'package:source_maps/span.dart' show Span;
-import 'dart_parser.dart' show DartCodeInfo;
import 'messages.dart';
-import 'summary.dart';
import 'utils.dart';
/**
@@ -44,92 +41,17 @@
* component-level behavior code. This code can either be inlined in the HTML
* file or included in a script tag with the "src" attribute.
*/
-abstract class LibraryInfo implements LibrarySummary {
-
- /** Whether there is any code associated with the page/component. */
- bool get codeAttached => inlinedCode != null || externalFile != null;
-
- /**
- * The actual inlined code. Use [userCode] if you want the code from this file
- * or from an external file.
- */
- DartCodeInfo inlinedCode;
-
- /**
- * If this library's code was loaded using a script tag (e.g. in a component),
- * [externalFile] has the path to such Dart file relative from the compiler's
- * base directory.
- */
- UrlInfo externalFile;
-
- /** Info asscociated with [externalFile], if any. */
- FileInfo externalCode;
-
- /**
- * The inverse of [externalCode]. If this .dart file was imported via a script
- * tag, this refers to the HTML file that imported it.
- */
- LibraryInfo htmlFile;
-
- /** File where the top-level code was defined. */
- UrlInfo get dartCodeUrl;
-
- /**
- * Name of the file that will hold any generated Dart code for this library
- * unit. Note this is initialized after parsing.
- */
- String outputFilename;
-
+abstract class LibraryInfo {
/** Parsed cssSource. */
List<StyleSheet> styleSheets = [];
-
- /** This is used in transforming Dart code to track modified files. */
- bool modified = false;
-
- /**
- * This is used in transforming Dart code to compute files that reference
- * [modified] files.
- */
- List<FileInfo> referencedBy = [];
-
- /**
- * Components used within this library unit. For [FileInfo] these are
- * components used directly in the page. For [ComponentInfo] these are
- * components used within their shadowed template.
- */
- final Map<ComponentSummary, bool> usedComponents =
- new LinkedHashMap<ComponentSummary, bool>();
-
- /**
- * The actual code, either inlined or from an external file, or `null` if none
- * was defined.
- */
- DartCodeInfo get userCode =>
- externalCode != null ? externalCode.inlinedCode : inlinedCode;
}
/** Information extracted at the file-level. */
-class FileInfo extends LibraryInfo implements HtmlFileSummary {
+class FileInfo extends LibraryInfo {
/** Relative path to this file from the compiler's base directory. */
final UrlInfo inputUrl;
/**
- * Whether this file should be treated as the entry point of the web app, i.e.
- * the file users navigate to in their browser. This will be true if this file
- * was passed in the command line to the dwc compiler, and the
- * `--components_only` flag was omitted.
- */
- final bool isEntryPoint;
-
- // TODO(terry): Ensure that that the libraryName is a valid identifier:
- // a..z || A..Z || _ [a..z || A..Z || 0..9 || _]*
- String get libraryName =>
- path.basename(inputUrl.resolvedPath).replaceAll('.', '_');
-
- /** File where the top-level code was defined. */
- UrlInfo get dartCodeUrl => externalFile != null ? externalFile : inputUrl;
-
- /**
* All custom element definitions in this file. This may contain duplicates.
* Normally you should use [components] for lookup.
*/
@@ -140,8 +62,8 @@
*`<link rel='components'>` tag. Maps from the tag name to the component
* information. This map is sorted by the tag name.
*/
- final Map<String, ComponentSummary> components =
- new SplayTreeMap<String, ComponentSummary>();
+ final Map<String, ComponentInfo> components =
+ new SplayTreeMap<String, ComponentInfo>();
/** Files imported with `<link rel="import">` */
final List<UrlInfo> componentLinks = <UrlInfo>[];
@@ -149,24 +71,12 @@
/** Files imported with `<link rel="stylesheet">` */
final List<UrlInfo> styleSheetHrefs = <UrlInfo>[];
- /** Root is associated with the body node. */
- Element body;
-
- FileInfo(this.inputUrl, [this.isEntryPoint = false]);
-
- /**
- * Query for an [Element] matching the provided [tag], starting from the
- * [body].
- */
- Element query(String tag) => body.query(tag);
+ FileInfo(this.inputUrl);
}
/** Information about a web component definition declared locally. */
-// TODO(sigmund): use a mixin to pull in ComponentSummary.
-class ComponentInfo extends LibraryInfo implements ComponentSummary {
- /** The file that declares this component. */
- final FileInfo declaringFile;
+class ComponentInfo extends LibraryInfo {
/** The component tag name, defined with the `name` attribute on `element`. */
final String tagName;
@@ -182,30 +92,18 @@
* This will be `null` if the component extends a built-in HTML tag, or
* if the analyzer has not run yet.
*/
- ComponentSummary extendsComponent;
-
- /** The Dart class containing the component's behavior. */
- String className;
-
- /** The Dart class declaration. */
- ClassDeclaration get classDeclaration => _classDeclaration;
- ClassDeclaration _classDeclaration;
+ ComponentInfo extendsComponent;
/** The declaring `<element>` tag. */
final Node element;
- /** File where this component was defined. */
- UrlInfo get dartCodeUrl => externalFile != null
- ? externalFile : declaringFile.inputUrl;
-
/**
* True if [tagName] was defined by more than one component. If this happened
* we will skip over the component.
*/
bool hasConflict = false;
- ComponentInfo(this.element, this.declaringFile, this.tagName,
- this.extendsTag);
+ ComponentInfo(this.element, this.tagName, this.extendsTag);
/**
* Gets the HTML tag extended by the base of the component hierarchy.
@@ -221,52 +119,7 @@
bool get hasAuthorStyles =>
element.attributes.containsKey('apply-author-styles');
- /**
- * Finds the declaring class, and initializes [className] and
- * [classDeclaration]. Also [userCode] is generated if there was no script.
- */
- void findClassDeclaration(Messages messages) {
- var constructor = element.attributes['constructor'];
- className = constructor != null ? constructor :
- toCamelCase(tagName, startUppercase: true);
-
- // If we don't have any code, generate a small class definition, and
- // pretend the user wrote it as inlined code.
- if (userCode == null) {
- var superclass = extendsComponent != null ? extendsComponent.className
- : 'autogenerated.PolymerElement';
- inlinedCode = new DartCodeInfo(null, null, [],
- 'class $className extends $superclass {\n}', null);
- }
-
- var code = userCode.code;
- _classDeclaration = userCode.findClass(className);
- if (_classDeclaration == null) {
- // Check for deprecated x-tags implied constructor.
- if (tagName.startsWith('x-') && constructor == null) {
- var oldCtor = toCamelCase(tagName.substring(2), startUppercase: true);
- _classDeclaration = userCode.findClass(oldCtor);
- if (_classDeclaration != null) {
- messages.warning('Implied constructor name for x-tags has changed to '
- '"$className". You should rename your class or add a '
- 'constructor="$oldCtor" attribute to the element declaration. '
- 'Also custom tags are not required to start with "x-" if their '
- 'name has at least one dash.',
- element.sourceSpan);
- className = oldCtor;
- }
- }
-
- if (_classDeclaration == null) {
- messages.error('please provide a class definition '
- 'for $className:\n $code', element.sourceSpan);
- return;
- }
- }
- }
-
- String toString() => '#<ComponentInfo $tagName '
- '${inlinedCode != null ? "inline" : "from ${dartCodeUrl.resolvedPath}"}>';
+ String toString() => '#<ComponentInfo $tagName>';
}
diff --git a/pkg/polymer/lib/src/messages.dart b/pkg/polymer/lib/src/messages.dart
index 5dc6247..b0a5ebd 100644
--- a/pkg/polymer/lib/src/messages.dart
+++ b/pkg/polymer/lib/src/messages.dart
@@ -4,7 +4,7 @@
library messages;
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:barback/barback.dart' show TransformLogger;
import 'package:source_maps/span.dart' show Span;
@@ -54,7 +54,7 @@
String toJson() {
if (span == null) return toString();
- return json.stringify([{
+ return JSON.encode([{
'method': kind,
'params': {
'file': span.sourceUrl,
diff --git a/pkg/polymer/lib/src/paths.dart b/pkg/polymer/lib/src/paths.dart
deleted file mode 100644
index 34037d9..0000000
--- a/pkg/polymer/lib/src/paths.dart
+++ /dev/null
@@ -1,170 +0,0 @@
-// 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.
-
-/**
- * Holds path information that is used by the WebUI compiler to find files,
- * compute their output location and relative paths between them.
- */
-library polymer.src.paths;
-
-import 'info.dart' show UrlInfo;
-import 'messages.dart';
-import 'summary.dart';
-import 'utils.dart' show path, pathToUrl;
-
-/**
- * Stores information about paths and computes mappings between input and output
- * path locations.
- */
-class PathMapper {
- /**
- * Common prefix to all input paths that are read from the file system. The
- * output generated by the compiler will reflect the directory structure
- * starting from [_baseDir]. For instance, if [_baseDir] is `a/b/c` and
- * [_outputDir] is `g/h/`, then the corresponding output file for
- * `a/b/c/e/f.html` will be under `g/h/e/f.html.dart`.
- */
- final String _baseDir;
-
- /** Base path where all output is generated. */
- final String _outputDir;
-
- /** The package root directory. */
- final String packageRoot;
-
- /** Whether to add prefixes and to output file names. */
- final bool _mangleFilenames;
-
- final bool _rewriteUrls;
-
- bool get _rewritePackageImports => _rewriteUrls || !_mangleFilenames;
-
- /** Default prefix added to all filenames. */
- static const String _DEFAULT_PREFIX = '_';
-
- PathMapper(String baseDir, String outputDir, this.packageRoot,
- bool forceMangle, this._rewriteUrls)
- : _baseDir = baseDir,
- _outputDir = outputDir,
- _mangleFilenames = forceMangle || (baseDir == outputDir);
-
- /** Add a prefix and [suffix] if [_mangleFilenames] is true */
- String mangle(String name, String suffix, [bool forceSuffix = false]) =>
- _mangleFilenames ? "$_DEFAULT_PREFIX$name$suffix"
- : (forceSuffix ? "$name$suffix" : name);
-
- /**
- * Checks that `input.resolvedPath` is a valid input path. It must be in
- * [_baseDir] and must not be in the [_outputDir]. If not, an error message
- * is added to [messages].
- */
- bool checkInputPath(UrlInfo input, Messages messages) {
- if (_mangleFilenames) return true;
- var canonicalized = path.normalize(input.resolvedPath);
- var parentDir = '..${path.separator}';
- if (!path.relative(canonicalized, from: _outputDir).startsWith(parentDir)) {
- messages.error(
- 'The file ${input.resolvedPath} cannot be processed. '
- 'Files cannot be under the output folder (${_outputDir}).',
- input.sourceSpan);
- return false;
- }
- if (path.relative(canonicalized, from: _baseDir).startsWith(parentDir)) {
- messages.error(
- 'The file ${input.resolvedPath} cannot be processed. '
- 'All processed files must be under the base folder (${_baseDir}), you'
- ' can specify the base folder using the --basedir flag.',
- input.sourceSpan);
- return false;
- }
- return true;
- }
-
- /**
- * The path to the output file corresponding to [input], by adding
- * [_DEFAULT_PREFIX] and a [suffix] to its file name.
- */
- String outputPath(String input, String suffix, [bool forceSuffix = false]) =>
- path.join(outputDirPath(input),
- mangle(path.basename(input), suffix, forceSuffix));
-
- /** The path to the output file corresponding to [info]. */
- String outputLibraryPath(LibrarySummary lib) =>
- path.join(outputDirPath(lib.dartCodeUrl.resolvedPath),
- lib.outputFilename);
-
- /** The corresponding output directory for [input]'s directory. */
- String outputDirPath(String input) {
- return _rewritePackages(path.normalize(
- path.join(_outputDir, path.relative(
- path.dirname(input), from: _baseDir))));
- }
-
- /**
- * We deal with `packages/` directories in a very special way. We assume it
- * points to resources loaded from other pub packages. If an output directory
- * is specified, the compiler will create a packages symlink so that
- * `package:` imports work.
- *
- * To make it possible to share components through pub, we allow using tags of
- * the form `<link rel="import" href="packages/...">`, so that you can
- * refer to components within the packages symlink. Regardless of whether an
- * --out option was given to the compiler, we don't want to generate files
- * inside `packages/` for those components. Instead we will generate such
- * code in a special directory called `_from_packages/`.
- */
- String _rewritePackages(String outputPath) {
- // TODO(jmesserly): this should match against packageRoot instead.
- if (!outputPath.contains('packages')) return outputPath;
- if (!_rewritePackageImports) return outputPath;
- var segments = path.split(outputPath);
- return path.joinAll(
- segments.map((s) => s == 'packages' ? '_from_packages' : s));
- }
-
- /**
- * Returns a url to import/export the output library represented by [target]
- * from the output library of [src]. In other words, a url to import or export
- * `target.outputFilename` from `src.outputFilename`.
- */
- String importUrlFor(LibrarySummary src, LibrarySummary target) {
- if (!_rewritePackageImports &&
- target.dartCodeUrl.url.startsWith('package:')) {
- return pathToUrl(path.join(path.dirname(target.dartCodeUrl.url),
- target.outputFilename));
- }
- var srcDir = path.dirname(src.dartCodeUrl.resolvedPath);
- var relDir = path.relative(
- path.dirname(target.dartCodeUrl.resolvedPath), from: srcDir);
- return pathToUrl(_rewritePackages(path.normalize(
- path.join(relDir, target.outputFilename))));
- }
-
- /**
- * Transforms a [target] url seen in [src] (e.g. a Dart import, a .css href in
- * an HTML file, etc) into a corresponding url from the output file associated
- * with [src]. This will keep 'package:', 'dart:', path-absolute, and absolute
- * urls intact, but it will fix relative paths to walk from the output
- * directory back to the input directory. An exception will be thrown if
- * [target] is not under [_baseDir].
- */
- String transformUrl(String src, String target) {
- var uri = Uri.parse(target);
- if (uri.isAbsolute) return target;
- if (!uri.scheme.isEmpty) return target;
- if (!uri.host.isEmpty) return target;
- if (uri.path.isEmpty) return target; // Implies standalone ? or # in URI.
- if (path.isAbsolute(target)) return target;
-
- return pathToUrl(path.normalize(path.relative(
- path.join(path.dirname(src), target), from: outputDirPath(src))));
- }
-}
-
-/**
- * Returns a "mangled" name, with a prefix and [suffix] depending on the
- * compiler's settings. [forceSuffix] causes [suffix] to be appended even if
- * the compiler is not mangling names.
- */
-typedef String NameMangler(String name, String suffix, [bool forceSuffix]);
diff --git a/pkg/polymer/lib/src/summary.dart b/pkg/polymer/lib/src/summary.dart
deleted file mode 100644
index 841870a..0000000
--- a/pkg/polymer/lib/src/summary.dart
+++ /dev/null
@@ -1,88 +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.
-
-/**
- * Summary information for components and libraries.
- *
- * These classes are used for modular compilation. Summaries are a subset of the
- * information collected by Info objects (see `info.dart`). When we are
- * compiling a single file, the information extracted from that file is stored
- * as info objects, but any information that is needed from other files (like
- * imported components) is stored as a summary.
- */
-library polymer.src.summary;
-
-import 'package:source_maps/span.dart' show Span;
-
-// TODO(sigmund): consider moving UrlInfo out of info.dart
-import 'info.dart' show UrlInfo;
-
-/**
- * Summary information from other library-like objects, which includes HTML
- * components and dart libraries).
- */
-class LibrarySummary {
- /** Path to the sources represented by this summary. */
- final UrlInfo dartCodeUrl;
-
- /** Name given to this source after it was compiled. */
- final String outputFilename;
-
- LibrarySummary(this.dartCodeUrl, this.outputFilename);
-}
-
-/** Summary information for an HTML file that defines custom elements. */
-class HtmlFileSummary extends LibrarySummary {
- /**
- * Summary of each component defined either explicitly the HTML file or
- * included transitively from `<link rel="import">` tags.
- */
- final Map<String, ComponentSummary> components;
-
- HtmlFileSummary(UrlInfo dartCodeUrl, String outputFilename, this.components)
- : super(dartCodeUrl, outputFilename);
-}
-
-/** Information about a web component definition. */
-class ComponentSummary extends LibrarySummary {
- /** The component tag name, defined with the `name` attribute on `element`. */
- final String tagName;
-
- /**
- * The tag name that this component extends, defined with the `extends`
- * attribute on `element`.
- */
- final String extendsTag;
-
- /**
- * The Dart class containing the component's behavior, derived from tagName or
- * defined in the `constructor` attribute on `element`.
- */
- final String className;
-
- /** Summary of the base component, if any. */
- final ComponentSummary extendsComponent;
-
- /**
- * True if [tagName] was defined by more than one component. Used internally
- * by the analyzer. Conflicting component will be skipped by the compiler.
- */
- bool hasConflict;
-
- /** Original span where this component is declared. */
- final Span sourceSpan;
-
- ComponentSummary(UrlInfo dartCodeUrl, String outputFilename,
- this.tagName, this.extendsTag, this.className, this.extendsComponent,
- this.sourceSpan, [this.hasConflict = false])
- : super(dartCodeUrl, outputFilename);
-
- /**
- * Gets the HTML tag extended by the base of the component hierarchy.
- * Equivalent to [extendsTag] if this inherits directly from an HTML element,
- * in other words, if [extendsComponent] is null.
- */
- String get baseExtendsTag =>
- extendsComponent == null ? extendsTag : extendsComponent.baseExtendsTag;
-}
diff --git a/pkg/polymer/lib/src/transform.dart b/pkg/polymer/lib/src/transform.dart
index ff5de2b..d2bf910 100644
--- a/pkg/polymer/lib/src/transform.dart
+++ b/pkg/polymer/lib/src/transform.dart
@@ -10,15 +10,18 @@
import 'transform/code_extractor.dart';
import 'transform/import_inliner.dart';
import 'transform/script_compactor.dart';
+import 'transform/polyfill_injector.dart';
export 'transform/code_extractor.dart';
export 'transform/import_inliner.dart';
export 'transform/script_compactor.dart';
+export 'transform/polyfill_injector.dart';
/** Phases to deploy a polymer application. */
var phases = [
[new InlineCodeExtractor()],
[new ObservableTransformer()],
[new ImportedElementInliner()],
- [new ScriptCompactor()]
+ [new ScriptCompactor()],
+ [new PolyfillInjector()]
];
diff --git a/pkg/polymer/lib/src/transform/code_extractor.dart b/pkg/polymer/lib/src/transform/code_extractor.dart
index 0e6d4d5..20fd73a 100644
--- a/pkg/polymer/lib/src/transform/code_extractor.dart
+++ b/pkg/polymer/lib/src/transform/code_extractor.dart
@@ -7,6 +7,10 @@
import 'dart:async';
+import 'package:analyzer_experimental/src/generated/ast.dart';
+import 'package:analyzer_experimental/src/generated/error.dart';
+import 'package:analyzer_experimental/src/generated/parser.dart';
+import 'package:analyzer_experimental/src/generated/scanner.dart';
import 'package:barback/barback.dart';
import 'package:path/path.dart' as path;
@@ -17,12 +21,13 @@
* separate file for each.
*/
class InlineCodeExtractor extends Transformer {
- Future<bool> isPrimary(Asset input) =>
- new Future.value(input.id.extension == ".html");
+ /** Only run this transformer on .html files. */
+ final String allowedExtensions = ".html";
+
Future apply(Transform transform) {
- var inputId = transform.primaryId;
- return getPrimaryContent(transform).then((content) {
+ var inputId = transform.primaryInput.id;
+ return transform.primaryInput.readAsString().then((content) {
var document = parseHtml(content, inputId.path, transform.logger);
int count = 0;
bool htmlChanged = false;
@@ -40,14 +45,18 @@
continue;
}
- // TODO(sigmund): should we automatically include a library directive
- // if it doesn't have one?
var filename = path.url.basename(inputId.path);
// TODO(sigmund): ensure this filename is unique (dartbug.com/12618).
tag.attributes['src'] = '$filename.$count.dart';
var textContent = tag.nodes.first;
+ var code = textContent.value;
var id = inputId.addExtension('.$count.dart');
- transform.addOutput(new Asset.fromString(id, textContent.value));
+ if (!_hasLibraryDirective(code)) {
+ var libname = path.withoutExtension(id.path)
+ .replaceAll(new RegExp('[-./]'), '_');
+ code = "library $libname;\n$code";
+ }
+ transform.addOutput(new Asset.fromString(id, code));
textContent.remove();
count++;
}
@@ -56,3 +65,16 @@
});
}
}
+
+/** Parse [code] and determine whether it has a library directive. */
+bool _hasLibraryDirective(String code) {
+ var errorListener = new _ErrorCollector();
+ var token = new StringScanner(null, code, errorListener).tokenize();
+ var unit = new Parser(null, errorListener).parseCompilationUnit(token);
+ return unit.directives.any((d) => d is LibraryDirective);
+}
+
+class _ErrorCollector extends AnalysisErrorListener {
+ final errors = <AnalysisError>[];
+ onError(error) => errors.add(error);
+}
diff --git a/pkg/polymer/lib/src/transform/common.dart b/pkg/polymer/lib/src/transform/common.dart
index c72e8b1..f20d836 100644
--- a/pkg/polymer/lib/src/transform/common.dart
+++ b/pkg/polymer/lib/src/transform/common.dart
@@ -13,15 +13,6 @@
import 'package:path/path.dart' as path;
import 'package:source_maps/span.dart' show Span;
-// TODO(sigmund): delete this function (see dartbug.com/12515 and
-// dartbug.com/12516)
-Future<String> getPrimaryContent(Transform transform) =>
- transform.primaryInput.then((asset) => asset.readAsString());
-
-// TODO(sigmund): delete this function (see dartbug.com/12515)
-Future<String> getContent(Transform transform, AssetId id) =>
- transform.getInput(id).then((asset) => asset.readAsString());
-
/**
* Parses an HTML file [contents] and returns a DOM-like tree. Adds emitted
* error/warning to [logger].
diff --git a/pkg/polymer/lib/src/transform/import_inliner.dart b/pkg/polymer/lib/src/transform/import_inliner.dart
index ac8ab7e..1f8fbf2 100644
--- a/pkg/polymer/lib/src/transform/import_inliner.dart
+++ b/pkg/polymer/lib/src/transform/import_inliner.dart
@@ -8,22 +8,24 @@
import 'dart:async';
import 'package:barback/barback.dart';
+import 'package:path/path.dart' as path;
import 'package:html5lib/dom.dart' show Document, Node, DocumentFragment;
+import 'package:html5lib/dom_parsing.dart' show TreeVisitor;
import 'common.dart';
/** Recursively inlines polymer-element definitions from html imports. */
// TODO(sigmund): make sure we match semantics of html-imports for tags other
// than polymer-element (see dartbug.com/12613).
class ImportedElementInliner extends Transformer {
- Future<bool> isPrimary(Asset input) =>
- new Future.value(input.id.extension == ".html");
+ /** Only run this transformer on .html files. */
+ final String allowedExtensions = ".html";
Future apply(Transform transform) {
var seen = new Set<AssetId>();
var elements = [];
- var id = transform.primaryId;
+ var id = transform.primaryInput.id;
seen.add(id);
- return getPrimaryContent(transform).then((content) {
+ return transform.primaryInput.readAsString().then((content) {
var document = parseHtml(content, id.path, transform.logger);
var future = _visitImports(document, id, transform, seen, elements);
return future.then((importsFound) {
@@ -78,14 +80,91 @@
* Loads an asset identified by [id], visits its imports and collects it's
* polymer-element definitions.
*/
- Future _collectPolymerElements(
- AssetId id, Transform transform, Set<AssetId> seen, List elements) {
- return getContent(transform, id)
- .then((content) => parseHtml(
- content, id.path, transform.logger, checkDocType: false))
- .then((document) {
- return _visitImports(document, id, transform, seen, elements)
- .then((_) => elements.addAll(document.queryAll('polymer-element')));
- });
+ Future _collectPolymerElements(AssetId id, Transform transform,
+ Set<AssetId> seen, List elements) {
+ return transform.readInputAsString(id).then((content) {
+ var document = parseHtml(
+ content, id.path, transform.logger, checkDocType: false);
+ return _visitImports(document, id, transform, seen, elements).then((_) {
+ var normalizer = new _UrlNormalizer(transform, id);
+ for (var element in document.queryAll('polymer-element')) {
+ normalizer.visit(document);
+ elements.add(element);
+ }
+ });
+ });
}
}
+
+/** Internally adjusts urls in the html that we are about to inline. */
+class _UrlNormalizer extends TreeVisitor {
+ final Transform transform;
+
+ /** Asset where the original content (and original url) was found. */
+ final AssetId sourceId;
+
+ _UrlNormalizer(this.transform, this.sourceId);
+
+ visitElement(Element node) {
+ for (var key in node.attributes.keys) {
+ if (_urlAttributes.contains(key)) {
+ var url = node.attributes[key];
+ if (url != null && url != '') {
+ node.attributes[key] = _newUrl(url, node.sourceSpan);
+ }
+ }
+ }
+ super.visitElement(node);
+ }
+
+ _newUrl(String href, Span span) {
+ var uri = Uri.parse(href);
+ if (uri.isAbsolute) return href;
+ if (!uri.scheme.isEmpty) return href;
+ if (!uri.host.isEmpty) return href;
+ if (uri.path.isEmpty) return href; // Implies standalone ? or # in URI.
+ if (path.isAbsolute(href)) return href;
+
+ var id = resolve(sourceId, href, transform.logger, span);
+ var primaryId = transform.primaryInput.id;
+
+ if (id.path.startsWith('lib/')) {
+ return 'packages/${id.package}/${id.path.substring(4)}';
+ }
+
+ if (id.path.startsWith('asset/')) {
+ return 'assets/${id.package}/${id.path.substring(6)}';
+ }
+
+ if (primaryId.package != id.package) {
+ // Techincally we shouldn't get there
+ logger.error("don't know how to include $id from $primaryId", span);
+ return null;
+ }
+
+ var builder = path.url;
+ return builder.relative(builder.join('/', id.path),
+ from: builder.join('/', builder.dirname(primaryId.path)));
+ }
+}
+
+/**
+ * HTML attributes that expect a URL value.
+ * <http://dev.w3.org/html5/spec/section-index.html#attributes-1>
+ *
+ * Every one of these attributes is a URL in every context where it is used in
+ * the DOM. The comments show every DOM element where an attribute can be used.
+ */
+const _urlAttributes = const [
+ 'action', // in form
+ 'background', // in body
+ 'cite', // in blockquote, del, ins, q
+ 'data', // in object
+ 'formaction', // in button, input
+ 'href', // in a, area, link, base, command
+ 'icon', // in command
+ 'manifest', // in html
+ 'poster', // in video
+ 'src', // in audio, embed, iframe, img, input, script, source, track,
+ // video
+];
diff --git a/pkg/polymer/lib/src/transform/polyfill_injector.dart b/pkg/polymer/lib/src/transform/polyfill_injector.dart
new file mode 100644
index 0000000..899fdd8
--- /dev/null
+++ b/pkg/polymer/lib/src/transform/polyfill_injector.dart
@@ -0,0 +1,76 @@
+// 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.
+
+/**
+ * Final phase of the polymer transformation: includes any additional polyfills
+ * that may needed by the deployed app.
+ */
+library polymer.src.transform.polyfill_injector;
+
+import 'dart:async';
+
+import 'package:barback/barback.dart';
+import 'package:html5lib/dom.dart' show Document, Node, DocumentFragment;
+import 'package:html5lib/parser.dart' show parseFragment;
+import 'common.dart';
+
+/**
+ * Ensures that any scripts and polyfills needed to run a polymer application
+ * are included. For example, this transformer will ensure that there is a
+ * script tag that loads the shadow_dom polyfill and interop.js (used for the
+ * css shimming).
+ */
+class PolyfillInjector extends Transformer {
+ /** Only run this transformer on .html files. */
+ final String allowedExtensions = ".html";
+
+ Future apply(Transform transform) {
+ var id = transform.primaryInput.id;
+ return transform.primaryInput.readAsString().then((content) {
+ var document = parseHtml(content, id.path, transform.logger);
+ bool shadowDomFound = false;
+ bool jsInteropFound = false;
+ bool dartScriptTags = false;
+
+ for (var tag in document.queryAll('script')) {
+ var src = tag.attributes['src'];
+ if (src != null) {
+ var last = src.split('/').last;
+ if (last == 'interop.js') {
+ jsInteropFound = true;
+ } else if (_shadowDomJS.hasMatch(last)) {
+ shadowDomFound = true;
+ }
+ }
+
+ if (tag.attributes['type'] == 'application/dart') {
+ dartScriptTags = true;
+ }
+ }
+
+ if (!dartScriptTags) {
+ // This HTML has no Dart code, there is nothing to do here.
+ transform.addOutput(new Asset.fromString(id, content));
+ return;
+ }
+
+ if (!jsInteropFound) {
+ // JS interop code is required for Polymer CSS shimming.
+ document.body.nodes.insert(0, parseFragment(
+ '<script src="packages/browser/interop.js"></script>\n'));
+ }
+
+ if (!shadowDomFound) {
+ // Insert at the beginning (this polyfill needs to run as early as
+ // possible).
+ document.body.nodes.insert(0, parseFragment(
+ '<script src="packages/shadow_dom/shadow_dom.min.js"></script>\n'));
+ }
+
+ transform.addOutput(new Asset.fromString(id, document.outerHtml));
+ });
+ }
+}
+
+final _shadowDomJS = new RegExp(r'shadow_dom\..*\.js', caseSensitive: false);
diff --git a/pkg/polymer/lib/src/transform/script_compactor.dart b/pkg/polymer/lib/src/transform/script_compactor.dart
index 9c2550a..8a217e6 100644
--- a/pkg/polymer/lib/src/transform/script_compactor.dart
+++ b/pkg/polymer/lib/src/transform/script_compactor.dart
@@ -28,13 +28,13 @@
* elements annotated with `@CustomTag`.
*/
class ScriptCompactor extends Transformer {
- Future<bool> isPrimary(Asset input) =>
- new Future.value(input.id.extension == ".html");
+ /** Only run this transformer on .html files. */
+ final String allowedExtensions = ".html";
Future apply(Transform transform) {
- var id = transform.primaryId;
+ var id = transform.primaryInput.id;
var logger = transform.logger;
- return getPrimaryContent(transform).then((content) {
+ return transform.primaryInput.readAsString().then((content) {
var document = parseHtml(content, id.path, logger);
var libraries = [];
bool changed = false;
@@ -79,8 +79,8 @@
'<script type="application/dart" src="$filename"></script>');
if (dartLoaderTag == null) {
document.body.nodes.add(bootstrapScript);
- document.body.nodes.add(parseFragment('<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>'));
+ document.body.nodes.add(parseFragment(
+ '<script src="packages/browser/dart.js"></script>'));
} else if (dartLoaderTag.parent != document.body) {
document.body.nodes.add(bootstrapScript);
} else {
@@ -111,7 +111,7 @@
if (id.path.startsWith('lib/')) {
return 'package:${id.package}/${id.path.substring(4)}';
}
-
+
// Use relative urls only if it's possible.
if (id.package != sourceId.package) {
logger.error("don't know how to import $id from $sourceId");
diff --git a/pkg/polymer/lib/testing/content_shell_test.dart b/pkg/polymer/lib/testing/content_shell_test.dart
index 97398be..cc60912 100644
--- a/pkg/polymer/lib/testing/content_shell_test.dart
+++ b/pkg/polymer/lib/testing/content_shell_test.dart
@@ -11,7 +11,7 @@
import 'package:args/args.dart';
import 'package:path/path.dart' as path;
import 'package:unittest/unittest.dart';
-import 'package:polymer/dwc.dart' as dwc;
+import 'package:polymer/deploy.dart' as deploy;
/**
@@ -20,17 +20,17 @@
*/
void endToEndTests(String inputDir, String outDir, {List<String> arguments}) {
_testHelper(new _TestOptions(inputDir, inputDir, null, outDir,
- arguments: arguments));
+ arguments: arguments));
}
/**
* Compiles [testFile] with the web-ui compiler, and then runs the output as a
* render test in content_shell.
*/
-void renderTests(String baseDir, String inputDir, String expectedDir,
+void renderTests(String webDir, String inputDir, String expectedDir,
String outDir, {List<String> arguments, String script, String pattern,
bool deleteDir: true}) {
- _testHelper(new _TestOptions(baseDir, inputDir, expectedDir, outDir,
+ _testHelper(new _TestOptions(webDir, inputDir, expectedDir, outDir,
arguments: arguments, script: script, pattern: pattern,
deleteDir: deleteDir));
}
@@ -51,18 +51,12 @@
print('Cleaning old output for ${path.normalize(options.outDir)}');
dir.deleteSync(recursive: true);
}
- dir.createSync();
+ dir.createSync(recursive: true);
for (var filePath in paths) {
var filename = path.basename(filePath);
test('compile $filename', () {
- var testArgs = ['-o', options.outDir, '--basedir', options.baseDir,
- '--deploy']
- ..addAll(options.compilerArgs)
- ..add(filePath);
- expect(dwc.run(testArgs, printTime: false).then((res) {
- expect(res.messages.length, 0, reason: res.messages.join('\n'));
- }), completes);
+ return deploy.runForTest(options.webDir, options.outDir);
});
}
@@ -70,26 +64,29 @@
// Sort files to match the order in which run.sh runs diff.
filenames.sort();
- // Get the path from "input" relative to "baseDir"
- var relativeToBase = path.relative(options.inputDir, from: options.baseDir);
- var finalOutDir = path.join(options.outDir, relativeToBase);
+ var finalOutDir = path.join(options.outDir, options.inputDir);
+ var outBaseDir = path.join(options.outDir, options.webDir);
runTests(String search) {
var output;
for (var filename in filenames) {
test('content_shell run $filename$search', () {
- var args = ['--dump-render-tree',
- 'file://$finalOutDir/$filename$search'];
- var env = {'DART_FLAGS': '--checked'};
- expect(Process.run('content_shell', args, environment: env).then((res) {
- expect(res.exitCode, 0, reason: 'content_shell exit code: '
- '${res.exitCode}. Contents of stderr: \n${res.stderr}');
- var outs = res.stdout.split('#EOF\n')
- .where((s) => !s.trim().isEmpty).toList();
- expect(outs.length, 1);
- output = outs.first;
- }), completes);
+ var lnArgs = ['-s', '$outBaseDir/packages', '$finalOutDir/packages'];
+ return Process.run('ln', lnArgs).then((_) {
+ var args = ['--dump-render-tree',
+ 'file://$finalOutDir/$filename$search'];
+ var env = {'DART_FLAGS': '--checked'};
+ return Process.run('content_shell', args, environment: env)
+ .then((res) {
+ expect(res.exitCode, 0, reason: 'content_shell exit code: '
+ '${res.exitCode}. Contents of stderr: \n${res.stderr}');
+ var outs = res.stdout.split('#EOF\n')
+ .where((s) => !s.trim().isEmpty).toList();
+ expect(outs.length, 1);
+ output = outs.first;
+ });
+ });
});
test('verify $filename $search', () {
@@ -150,7 +147,7 @@
}
class _TestOptions {
- final String baseDir;
+ final String webDir;
final String inputDir;
final String expectedDir;
@@ -166,7 +163,7 @@
final List<String> compilerArgs;
final RegExp pattern;
- factory _TestOptions(String baseDir, String inputDir, String expectedDir,
+ factory _TestOptions(String webDir, String inputDir, String expectedDir,
String outDir, {List<String> arguments, String script, String pattern,
bool deleteDir: true}) {
if (arguments == null) arguments = new Options().arguments;
@@ -186,19 +183,19 @@
}
var scriptDir = path.absolute(path.dirname(script));
- baseDir = path.join(scriptDir, baseDir);
- inputDir = path.join(scriptDir, inputDir);
+ webDir = path.relative(path.join(scriptDir, webDir));
+ inputDir = path.relative(path.join(scriptDir, inputDir));
outDir = path.join(scriptDir, outDir);
if (expectedDir != null) {
expectedDir = path.join(scriptDir, expectedDir);
}
- return new _TestOptions._(baseDir, inputDir, expectedDir, outDir, deleteDir,
+ return new _TestOptions._(webDir, inputDir, expectedDir, outDir, deleteDir,
args['dart'] == true, args['js'] == true, args['shadowdom'] == true,
compilerArgs, filePattern);
}
- _TestOptions._(this.baseDir, this.inputDir, this.expectedDir, this.outDir,
+ _TestOptions._(this.webDir, this.inputDir, this.expectedDir, this.outDir,
this.deleteDir, this.runAsDart, this.runAsJs,
this.forcePolyfillShadowDom, this.compilerArgs, this.pattern);
}
diff --git a/pkg/polymer/lib/testing/testing.js b/pkg/polymer/lib/testing/testing.js
index 957a48c..3c22f05 100644
--- a/pkg/polymer/lib/testing/testing.js
+++ b/pkg/polymer/lib/testing/testing.js
@@ -71,6 +71,17 @@
}
}
+ // We remove the contents of style tags so that we can compare both runs
+ // with and without the runtmie css shim. We keep the STYLE right under
+ // HEAD, because it is not affected by the shim.
+ if (node.tagName == 'STYLE') {
+ if (node.attributes['shadowcssshim'] != null) {
+ node.parentNode.removeChild(node);
+ } else if (node.parentNode.tagName != "HEAD") {
+ node.textContent = '/* style hidden by testing.js */'
+ }
+ }
+
if (node.tagName == 'SCRIPT') {
if (node.textContent.indexOf('_DART_TEMPORARY_ATTACHED') >= 0) {
node.parentNode.removeChild(node);
diff --git a/pkg/polymer/test/compiler_test.dart b/pkg/polymer/test/compiler_test.dart
index d5d47ba..abe5e32 100644
--- a/pkg/polymer/test/compiler_test.dart
+++ b/pkg/polymer/test/compiler_test.dart
@@ -39,18 +39,6 @@
'foo.html': 1,
'bar.html': 1
}), reason: 'Actual:\n ${fs.readCount}');
-
- var outputs = compiler.output.map((o) => o.path);
- expect(outputs, equals([
- 'foo.html.dart',
- 'foo.html.dart.map',
- 'bar.html.dart',
- 'bar.html.dart.map',
- 'index.html.dart',
- 'index.html.dart.map',
- 'index.html_bootstrap.dart',
- 'index.html',
- ].map((p) => path.join('out', p))));
}));
});
@@ -66,18 +54,9 @@
compiler.run().then(expectAsync1((e) {
var msgs = messages.messages.where((m) =>
m.message.contains('unable')).toList();
-
- expect(msgs.length, 1);
- expect(msgs[0].level, Level.SEVERE);
- expect(msgs[0].message, contains('unable to open file'));
- expect(msgs[0].span, isNotNull);
- expect(msgs[0].span.sourceUrl, 'index.html');
-
+ expect(msgs.length, 0);
MockFileSystem fs = compiler.fileSystem;
- expect(fs.readCount, { 'index.html': 1, 'notfound.dart': 1 });
-
- var outputs = compiler.output.map((o) => o.path.toString());
- expect(outputs, []);
+ expect(fs.readCount, { 'index.html': 1 });
}));
});
@@ -102,9 +81,6 @@
MockFileSystem fs = compiler.fileSystem;
expect(fs.readCount, { 'index.html': 1, 'notfound.html': 1 });
-
- var outputs = compiler.output.map((o) => o.path.toString());
- expect(outputs, []);
}));
});
@@ -124,17 +100,10 @@
compiler.run().then(expectAsync1((e) {
var msgs = messages.messages.where((m) =>
m.message.contains('unable')).toList();
-
- expect(msgs.length, 1);
- expect(msgs[0].level, Level.SEVERE);
- expect(msgs[0].message, contains('unable to open file'));
-
+ expect(msgs.length, 0);
MockFileSystem fs = compiler.fileSystem;
expect(fs.readCount,
- { 'index.html': 1, 'foo.html': 1, 'notfound.dart': 1 });
-
- var outputs = compiler.output.map((o) => o.path.toString());
- expect(outputs, []);
+ { 'index.html': 1, 'foo.html': 1 });
}));
});
});
diff --git a/pkg/polymer/test/css_test.dart b/pkg/polymer/test/css_test.dart
index 9a53ef4..9f4c734 100644
--- a/pkg/polymer/test/css_test.dart
+++ b/pkg/polymer/test/css_test.dart
@@ -50,14 +50,6 @@
expect(htmlInfo.styleSheets.length, 2);
expect(prettyPrintCss(htmlInfo.styleSheets[0]), '');
expect(prettyPrintCss(htmlInfo.styleSheets[1]), '.test { color: red; }');
-
- var outputs = compiler.output.map((o) => o.path);
- expect(outputs, equals([
- 'out/index.html.dart',
- 'out/index.html.dart.map',
- 'out/index.html_bootstrap.dart',
- 'out/index.html',
- ]));
}));
}
@@ -150,13 +142,6 @@
'.test-19 { border: 2px 2px 2px 3px dashed red; } '
'.test-20 { border: 3px 2px 2px 2px dashed green; } '
'.test-21 { border: bold 1px 10px blue; }');
- var outputs = compiler.output.map((o) => o.path);
- expect(outputs, equals([
- 'out/index.html.dart',
- 'out/index.html.dart.map',
- 'out/index.html_bootstrap.dart',
- 'out/index.html',
- ]));
}));
}
@@ -202,15 +187,6 @@
expect(htmlInfo.styleSheets.length, 1);
expect(prettyPrintCss(htmlInfo.styleSheets[0]),
'@import url(foo.css); .test { color: red; }');
-
- var outputs = compiler.output.map((o) => o.path);
- expect(outputs, equals([
- 'out/index.html.dart',
- 'out/index.html.dart.map',
- 'out/index.html_bootstrap.dart',
- 'out/foo.css',
- 'out/index.html',
- ]));
}));
}
@@ -293,18 +269,6 @@
'@import url(second.css); '
'.test-1 { color: red; } '
'.test-2 { width: 100px; }');
-
- var outputs = compiler.output.map((o) => o.path);
- expect(outputs, equals([
- 'out/index.html.dart',
- 'out/index.html.dart.map',
- 'out/index.html_bootstrap.dart',
- 'out/first.css',
- 'out/second.css',
- 'out/third.css',
- 'out/fourth.css',
- 'out/index.html',
- ]));
}));
}
@@ -378,39 +342,26 @@
expect(htmlInfo.declaredComponents.length, 1);
expect(htmlInfo.declaredComponents[0].styleSheets.length, 1);
- var outputs = compiler.output.map((o) => o.path);
- expect(outputs, equals([
- 'out/foo.html.dart',
- 'out/foo.html.dart.map',
- 'out/index.html.dart',
- 'out/index.html.dart.map',
- 'out/index.html_bootstrap.dart',
- 'out/foo.css',
- 'out/index.html.css',
- 'out/index.html',
- ]));
-
- for (var file in compiler.output) {
- if (file.path == 'out/index.html.css') {
- expect(file.contents,
- '/* Auto-generated from components style tags. */\n'
- '/* DO NOT EDIT. */\n\n'
- '/* ==================================================== \n'
- ' Component x-foo stylesheet \n'
- ' ==================================================== */\n'
- '@import "foo.css";\n'
- '[is="x-foo"] .main {\n'
- ' color: #f00;\n'
- '}\n'
- '[is="x-foo"] .test-background {\n'
- ' background: url("http://www.foo.com/bar.png");\n'
- '}\n\n');
- } else if (file.path == 'out/foo.css') {
- expect(file.contents,
- '/* Auto-generated from style sheet href = foo.css */\n'
- '/* DO NOT EDIT. */\n\n\n\n');
- }
- }
+ // TODO(sigmund,terry): reenable
+ // if (file.path == 'out/index.html.css') {
+ // expect(file.contents,
+ // '/* Auto-generated from components style tags. */\n'
+ // '/* DO NOT EDIT. */\n\n'
+ // '/* ==================================================== \n'
+ // ' Component x-foo stylesheet \n'
+ // ' ==================================================== */\n'
+ // '@import "foo.css";\n'
+ // '[is="x-foo"] .main {\n'
+ // ' color: #f00;\n'
+ // '}\n'
+ // '[is="x-foo"] .test-background {\n'
+ // ' background: url("http://www.foo.com/bar.png");\n'
+ // '}\n\n');
+ // } else if (file.path == 'out/foo.css') {
+ // expect(file.contents,
+ // '/* Auto-generated from style sheet href = foo.css */\n'
+ // '/* DO NOT EDIT. */\n\n\n\n');
+ // }
// Check for warning messages about var- cycles in no expected order.
expect(messages.messages.length, 8);
@@ -505,33 +456,25 @@
'foo.html': 1,
}), reason: 'Actual:\n ${fs.readCount}');
- var outputs = compiler.output.map((o) => o.path);
- expect(outputs, equals([
- 'out/foo.html.dart',
- 'out/foo.html.dart.map',
- 'out/index.html.dart',
- 'out/index.html.dart.map',
- 'out/index.html_bootstrap.dart',
- 'out/index.html',
- ]));
- expect(compiler.output.last.contents, contains(
- '<div pseudo="x-foo_0">'
- '<div>Test</div>'
- '</div>'
- '<div pseudo="x-foo1_1 x-foo2_2">'
- '<div>Test</div>'
- '</div>'));
- expect(compiler.output.last.contents, contains(
- '<style>.test > *[pseudo="x-foo_0"] {\n'
- ' background-color: #f00;\n'
- '}\n'
- '.test > *[pseudo="x-foo1_1"] {\n'
- ' color: #00f;\n'
- '}\n'
- '.test > *[pseudo="x-foo2_2"] {\n'
- ' color: #008000;\n'
- '}'
- '</style>'));
+ // TODO(sigmund, terry): reenable
+ // expect(compiler.output.last.contents, contains(
+ // '<div pseudo="x-foo_0">'
+ // '<div>Test</div>'
+ // '</div>'
+ // '<div pseudo="x-foo1_1 x-foo2_2">'
+ // '<div>Test</div>'
+ // '</div>'));
+ // expect(compiler.output.last.contents, contains(
+ // '<style>.test > *[pseudo="x-foo_0"] {\n'
+ // ' background-color: #f00;\n'
+ // '}\n'
+ // '.test > *[pseudo="x-foo1_1"] {\n'
+ // ' color: #00f;\n'
+ // '}\n'
+ // '.test > *[pseudo="x-foo2_2"] {\n'
+ // ' color: #008000;\n'
+ // '}'
+ // '</style>'));
}));
}
diff --git a/pkg/polymer/test/paths_test.dart b/pkg/polymer/test/paths_test.dart
deleted file mode 100644
index 4a54a9d..0000000
--- a/pkg/polymer/test/paths_test.dart
+++ /dev/null
@@ -1,339 +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.
-
-/** Tests for [PathMapper]. */
-library path_info_test;
-
-import 'package:path/path.dart' as path;
-import 'package:polymer/src/info.dart';
-import 'package:polymer/src/paths.dart';
-import 'package:polymer/src/utils.dart' as utils;
-import 'package:unittest/compact_vm_config.dart';
-import 'package:unittest/unittest.dart';
-
-main() {
- useCompactVMConfiguration();
- group('paths', () {
- setUp(() {
- utils.path = new path.Builder(style: path.Style.posix);
- });
-
- tearDown(() {
- utils.path = new path.Builder();
- });
-
- testPaths();
- });
-}
-
-testPaths() {
- group('outdir == basedir:', () {
- group('outputPath', () {
- test('mangle automatic', () {
- var pathMapper = _newPathMapper('a', 'a', false);
- var file = _mockFile('a/b.dart', pathMapper);
- expect(file.dartCodeUrl.resolvedPath, 'a/b.dart');
- expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'),
- 'a/_b.dart.dart');
- });
-
- test('within packages/', () {
- var pathMapper = _newPathMapper('a', 'a', false);
- var file = _mockFile('a/packages/b.dart', pathMapper);
- expect(file.dartCodeUrl.resolvedPath, 'a/packages/b.dart');
- expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'),
- 'a/_from_packages/_b.dart.dart');
- });
- });
-
- group('importUrlFor', () {
- test('simple pathMapper', () {
- var pathMapper = _newPathMapper('a', 'a', false);
- var file1 = _mockFile('a/b.dart', pathMapper);
- var file2 = _mockFile('a/c/d.dart', pathMapper);
- var file3 = _mockFile('a/e/f.dart', pathMapper);
- expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file1, file3), 'e/_f.dart.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
- expect(pathMapper.importUrlFor(file2, file3), '../e/_f.dart.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart');
- });
-
- test('include packages/', () {
- var pathMapper = _newPathMapper('a', 'a', false);
- var file1 = _mockFile('a/b.dart', pathMapper);
- var file2 = _mockFile('a/c/d.dart', pathMapper);
- var file3 = _mockFile('a/packages/f.dart', pathMapper);
- expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file1, file3),
- '_from_packages/_f.dart.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
- expect(pathMapper.importUrlFor(file2, file3),
- '../_from_packages/_f.dart.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart');
- });
-
- test('packages, but no rewrite', () {
- var pathMapper = _newPathMapper('a', 'a', false, rewriteUrls: false);
- var file1 = _mockFile('a/b.dart', pathMapper);
- var file2 = _mockFile('a/c/d.dart', pathMapper);
- var file3 = _mockFile('a/packages/c/f.dart', pathMapper,
- url: 'package:e/f.dart');
- expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file1, file3),
- 'package:e/_f.dart.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
- expect(pathMapper.importUrlFor(file2, file3),
- 'package:e/_f.dart.dart');
- });
-
- test('windows paths', () {
- try {
- utils.path = new path.Builder(style: path.Style.windows);
- var pathMapper = _newPathMapper('a', 'a', false);
- var file1 = _mockFile('a\\b.dart', pathMapper);
- var file2 = _mockFile('a\\c\\d.dart', pathMapper);
- var file3 = _mockFile('a\\packages\\f.dart', pathMapper);
- expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file1, file3),
- '_from_packages/_f.dart.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
- expect(pathMapper.importUrlFor(file2, file3),
- '../_from_packages/_f.dart.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart');
- } finally {
- utils.path = new path.Builder();
- }
- });
- });
-
- test('transformUrl simple paths', () {
- var pathMapper = _newPathMapper('a', 'a', false);
- var file1 = 'a/b.dart';
- var file2 = 'a/c/d.html';
- // when the output == input directory, no paths should be rewritten
- expect(pathMapper.transformUrl(file1, '/a.dart'), '/a.dart');
- expect(pathMapper.transformUrl(file1, 'c.dart'), 'c.dart');
- expect(pathMapper.transformUrl(file1, '../c/d.dart'), '../c/d.dart');
- expect(pathMapper.transformUrl(file1, 'packages/c.dart'),
- 'packages/c.dart');
- expect(pathMapper.transformUrl(file2, 'e.css'), 'e.css');
- expect(pathMapper.transformUrl(file2, '../c/e.css'), 'e.css');
- expect(pathMapper.transformUrl(file2, '../q/e.css'), '../q/e.css');
- expect(pathMapper.transformUrl(file2, 'packages/c.css'),
- 'packages/c.css');
- expect(pathMapper.transformUrl(file2, '../packages/c.css'),
- '../packages/c.css');
- });
-
- test('transformUrl with source in packages/', () {
- var pathMapper = _newPathMapper('a', 'a', false);
- var file = 'a/packages/e.html';
- // Even when output == base, files under packages/ are moved to
- // _from_packages, so all imports are affected:
- expect(pathMapper.transformUrl(file, 'e.css'), '../packages/e.css');
- expect(pathMapper.transformUrl(file, '../packages/e.css'),
- '../packages/e.css');
- expect(pathMapper.transformUrl(file, '../q/e.css'), '../q/e.css');
- expect(pathMapper.transformUrl(file, 'packages/c.css'),
- '../packages/packages/c.css');
- });
- });
-
- group('outdir != basedir:', () {
- group('outputPath', (){
- test('no force mangle', () {
- var pathMapper = _newPathMapper('a', 'out', false);
- var file = _mockFile('a/b.dart', pathMapper);
- expect(file.dartCodeUrl.resolvedPath, 'a/b.dart');
- expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'),
- 'out/b.dart');
- });
-
- test('force mangling', () {
- var pathMapper = _newPathMapper('a', 'out', true);
- var file = _mockFile('a/b.dart', pathMapper);
- expect(file.dartCodeUrl.resolvedPath, 'a/b.dart');
- expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'),
- 'out/_b.dart.dart');
- });
-
- test('within packages/, no mangle', () {
- var pathMapper = _newPathMapper('a', 'out', false);
- var file = _mockFile('a/packages/b.dart', pathMapper);
- expect(file.dartCodeUrl.resolvedPath, 'a/packages/b.dart');
- expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'),
- 'out/_from_packages/b.dart');
- });
-
- test('within packages/, mangle', () {
- var pathMapper = _newPathMapper('a', 'out', true);
- var file = _mockFile('a/packages/b.dart', pathMapper);
- expect(file.dartCodeUrl.resolvedPath, 'a/packages/b.dart');
- expect(pathMapper.outputPath(file.dartCodeUrl.resolvedPath, '.dart'),
- 'out/_from_packages/_b.dart.dart');
- });
- });
-
- group('importUrlFor', (){
- test('simple paths, no mangle', () {
- var pathMapper = _newPathMapper('a', 'out', false);
- var file1 = _mockFile('a/b.dart', pathMapper);
- var file2 = _mockFile('a/c/d.dart', pathMapper);
- var file3 = _mockFile('a/e/f.dart', pathMapper);
- expect(pathMapper.importUrlFor(file1, file2), 'c/d.dart');
- expect(pathMapper.importUrlFor(file1, file3), 'e/f.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../b.dart');
- expect(pathMapper.importUrlFor(file2, file3), '../e/f.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../c/d.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../b.dart');
- });
-
- test('simple paths, mangle', () {
- var pathMapper = _newPathMapper('a', 'out', true);
- var file1 = _mockFile('a/b.dart', pathMapper);
- var file2 = _mockFile('a/c/d.dart', pathMapper);
- var file3 = _mockFile('a/e/f.dart', pathMapper);
- expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file1, file3), 'e/_f.dart.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
- expect(pathMapper.importUrlFor(file2, file3), '../e/_f.dart.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart');
- });
-
- test('include packages/, no mangle', () {
- var pathMapper = _newPathMapper('a', 'out', false);
- var file1 = _mockFile('a/b.dart', pathMapper);
- var file2 = _mockFile('a/c/d.dart', pathMapper);
- var file3 = _mockFile('a/packages/e/f.dart', pathMapper,
- url: 'package:e/f.dart');
- expect(pathMapper.importUrlFor(file1, file2), 'c/d.dart');
- expect(pathMapper.importUrlFor(file1, file3),
- '_from_packages/e/f.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../b.dart');
- expect(pathMapper.importUrlFor(file2, file3),
- '../_from_packages/e/f.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../../c/d.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../../b.dart');
- });
-
- test('include packages/, mangle', () {
- var pathMapper = _newPathMapper('a', 'out', true);
- var file1 = _mockFile('a/b.dart', pathMapper);
- var file2 = _mockFile('a/c/d.dart', pathMapper);
- var file3 = _mockFile('a/packages/e/f.dart', pathMapper,
- url: 'package:e/f.dart');
- expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file1, file3),
- '_from_packages/e/_f.dart.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
- expect(pathMapper.importUrlFor(file2, file3),
- '../_from_packages/e/_f.dart.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../../c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../../_b.dart.dart');
- });
-
- test('windows paths', () {
- try {
- utils.path = new path.Builder(style: path.Style.windows);
- var pathMapper = _newPathMapper('a', 'out', true);
- var file1 = _mockFile('a\\b.dart', pathMapper);
- var file2 = _mockFile('a\\c\\d.dart', pathMapper);
- var file3 = _mockFile('a\\packages\\f.dart', pathMapper);
- expect(pathMapper.importUrlFor(file1, file2), 'c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file1, file3),
- '_from_packages/_f.dart.dart');
- expect(pathMapper.importUrlFor(file2, file1), '../_b.dart.dart');
- expect(pathMapper.importUrlFor(file2, file3),
- '../_from_packages/_f.dart.dart');
- expect(pathMapper.importUrlFor(file3, file2), '../c/_d.dart.dart');
- expect(pathMapper.importUrlFor(file3, file1), '../_b.dart.dart');
- } finally {
- utils.path = new path.Builder();
- }
- });
- });
-
- group('transformUrl', () {
- test('simple source, not in packages/', () {
- var pathMapper = _newPathMapper('a', 'out', false);
- var file1 = 'a/b.dart';
- var file2 = 'a/c/d.html';
- // when the output == input directory, no paths should be rewritten
- expect(pathMapper.transformUrl(file1, '/a.dart'), '/a.dart');
- expect(pathMapper.transformUrl(file1, 'c.dart'), '../a/c.dart');
-
- // reach out from basedir:
- expect(pathMapper.transformUrl(file1, '../c/d.dart'), '../c/d.dart');
-
- // reach into packages dir:
- expect(pathMapper.transformUrl(file1, 'packages/c.dart'),
- '../a/packages/c.dart');
-
- expect(pathMapper.transformUrl(file2, 'e.css'), '../../a/c/e.css');
-
- _checkPath('../../a/c/../c/e.css', '../../a/c/e.css');
- expect(pathMapper.transformUrl(file2, '../c/e.css'), '../../a/c/e.css');
-
- _checkPath('../../a/c/../q/e.css', '../../a/q/e.css');
- expect(pathMapper.transformUrl(file2, '../q/e.css'), '../../a/q/e.css');
-
- expect(pathMapper.transformUrl(file2, 'packages/c.css'),
- '../../a/c/packages/c.css');
- _checkPath('../../a/c/../packages/c.css', '../../a/packages/c.css');
- expect(pathMapper.transformUrl(file2, '../packages/c.css'),
- '../../a/packages/c.css');
- });
-
- test('input in packages/', () {
- var pathMapper = _newPathMapper('a', 'out', true);
- var file = 'a/packages/e.html';
- expect(pathMapper.transformUrl(file, 'e.css'),
- '../../a/packages/e.css');
- expect(pathMapper.transformUrl(file, '../packages/e.css'),
- '../../a/packages/e.css');
- expect(pathMapper.transformUrl(file, '../q/e.css'), '../../a/q/e.css');
- expect(pathMapper.transformUrl(file, 'packages/c.css'),
- '../../a/packages/packages/c.css');
- });
-
- test('src fragments', () {
- var pathMapper = _newPathMapper('a', 'out', false);
- var file1 = 'a/b.dart';
- var file2 = 'a/c/html.html';
- // when the output == input directory, no paths should be rewritten
- expect(pathMapper.transformUrl(file1, '#tips'), '#tips');
- expect(pathMapper.transformUrl(file1,
- 'http://www.w3schools.com/html_links.htm#tips'),
- 'http://www.w3schools.com/html_links.htm#tips');
- expect(pathMapper.transformUrl(file2,
- 'html_links.html'),
- '../../a/c/html_links.html');
- expect(pathMapper.transformUrl(file2,
- 'html_links.html#tips'),
- '../../a/c/html_links.html#tips');
- });
- });
- });
-}
-
-_newPathMapper(String baseDir, String outDir, bool forceMangle,
- {bool rewriteUrls: true}) =>
- new PathMapper(baseDir, outDir, 'packages', forceMangle, rewriteUrls);
-
-_mockFile(String filePath, PathMapper pathMapper, {String url}) {
- var file = new FileInfo(new UrlInfo(
- url == null ? filePath : url, filePath, null));
- file.outputFilename = pathMapper.mangle(
- utils.path.basename(filePath), '.dart', false);
- return file;
-}
-
-_checkPath(String filePath, String expected) {
- expect(utils.path.normalize(filePath), expected);
-}
diff --git a/pkg/polymer/test/run.sh b/pkg/polymer/test/run.sh
index 0d2b569..3d04337 100755
--- a/pkg/polymer/test/run.sh
+++ b/pkg/polymer/test/run.sh
@@ -16,8 +16,28 @@
# set -x
DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd )
+# Note: dartanalyzer and some tests needs to be run from the root directory
+pushd $DIR/.. > /dev/null
+
export DART_FLAGS="--checked"
-TEST_PATTERN=$1
+
+# Search for the first argument that doesn't look like an option ('--foo')
+function first_non_option {
+ while [[ $# -gt 0 ]]; do
+ if [[ $1 != --* ]]; then # Note: --* is a regex
+ echo $1
+ return
+ fi
+ shift
+ done
+}
+
+TEST_PATTERN=$(first_non_option $@)
+
+SDK_DIR=$(cd ../../out/ReleaseIA32/dart-sdk/; pwd)
+package_root=$SDK_DIR/../packages
+dart="$SDK_DIR/bin/dart --package-root=$package_root"
+dartanalyzer="$SDK_DIR/bin/dartanalyzer --package-root=$package_root"
function fail {
return 1
@@ -51,15 +71,14 @@
}
if [[ ($TEST_PATTERN == "") ]]; then
- # Note: dartanalyzer needs to be run from the root directory for proper path
- # canonicalization.
- pushd $DIR/.. > /dev/null
+ echo Analyzing analyzer for warnings or type errors
+ $dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/dwc.dart
- echo Analyzing compiler for warnings or type errors
- dartanalyzer --hints --fatal-warnings --fatal-type-errors bin/dwc.dart
+ echo Analyzing deploy-compiler for warnings or type errors
+ $dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/deploy.dart
echo -e "\nAnalyzing runtime for warnings or type errors"
- dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/polymer.dart
+ $dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/polymer.dart
popd > /dev/null
fi
@@ -68,8 +87,7 @@
# TODO(jmesserly): bash and dart regexp might not be 100% the same. Ideally we
# could do all the heavy lifting in Dart code, and keep this script as a thin
# wrapper that sets `--enable-type-checks --enable-asserts`
- for input in $DIR/../example/component/news/test/*_test.html \
- $DIR/../../../samples/third_party/todomvc/test/*_test.html; do
+ for input in $DIR/../example/component/news/test/*_test.html; do
if [[ ($TEST_PATTERN == "") || ($input =~ $TEST_PATTERN) ]]; then
FILENAME=`basename $input`
DIRNAME=`dirname $input`
@@ -77,7 +95,7 @@
DIRNAME=`dirname $DIRNAME`
fi
echo -e -n "Checking diff for $FILENAME "
- DUMP="$DIRNAME/out/$FILENAME.txt"
+ DUMP="test/data/out/example/test/$FILENAME.txt"
EXPECTATION="$DIRNAME/expected/$FILENAME.txt"
compare $EXPECTATION $DUMP
@@ -87,47 +105,26 @@
fail
}
-if [[ -e $DIR/data/input/example ]]; then
- echo "WARNING: detected old data/input/example symlink."
- echo "Removing it and rerunning pub install to fix broken example symlinks."
- echo "See http://dartbug.com/9418 for more information."
- echo "You should only see this message once."
- if [[ -e $DIR/packages ]]; then
- find . -name packages -type l | xargs rm
- fi
- rm $DIR/data/input/example
- pushd $DIR/..
- pub install
- popd
-fi
-
-# TODO(jmesserly): dart:io fails if we run the Dart scripts with an absolute
-# path. So use pushd/popd to change the working directory.
if [[ ($TEST_PATTERN == "") ]]; then
- pushd $DIR/.. > /dev/null
echo -e "\nTesting build.dart... "
- dart $DART_FLAGS build.dart
+ $dart $DART_FLAGS build.dart
# Run it the way the editor does. Hide stdout because it is in noisy machine
# format. Show stderr in case something breaks.
# NOTE: not using --checked because the editor doesn't use it, and to workaround
# http://dartbug.com/9637
- dart build.dart --machine --clean > /dev/null
- dart build.dart --machine --full > /dev/null
- dart build.dart --machine --changed ../../samples/third_party/todomvc/web/index.html > /dev/null
- popd > /dev/null
+ $dart build.dart --machine --clean > /dev/null
+ $dart build.dart --machine --full > /dev/null
fi
-pushd $DIR > /dev/null
echo -e "\nRunning unit tests... "
-dart $DART_FLAGS run_all.dart $@ || compare_all
-popd > /dev/null
+$dart $DART_FLAGS test/run_all.dart $@ || compare_all
# Run Dart analyzer to check that we're generating warning clean code.
-# It's a bit slow, so only do this for TodoMVC and html5_utils tests.
-OUT_PATTERN="$DIR/../../../third_party/samples/todomvc/test/out/test/*$TEST_PATTERN*_bootstrap.dart"
+# It's a bit slow, so only do this for one test.
+OUT_PATTERN="$DIR/../example/component/news/test/out/test/*$TEST_PATTERN*_bootstrap.dart"
if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then
echo -e "\nAnalyzing generated code for warnings or type errors."
- ls $OUT_PATTERN 2>/dev/null | dartanalyzer --package-root=packages \
+ ls $OUT_PATTERN 2>/dev/null | $dartanalyzer \
--fatal-warnings --fatal-type-errors -batch
fi
diff --git a/pkg/polymer/test/run_all.dart b/pkg/polymer/test/run_all.dart
index cc666ed..d11f475 100644
--- a/pkg/polymer/test/run_all.dart
+++ b/pkg/polymer/test/run_all.dart
@@ -15,12 +15,12 @@
import 'css_test.dart' as css_test;
import 'compiler_test.dart' as compiler_test;
-import 'paths_test.dart' as paths_test;
import 'utils_test.dart' as utils_test;
+import 'transform/all_phases_test.dart' as all_phases_test;
import 'transform/code_extractor_test.dart' as code_extractor_test;
import 'transform/import_inliner_test.dart' as import_inliner_test;
+import 'transform/polyfill_injector_test.dart' as polyfill_injector_test;
import 'transform/script_compactor_test.dart' as script_compactor_test;
-import 'transform/all_phases_test.dart' as all_phases_test;
main() {
var args = new Options().arguments;
@@ -36,11 +36,12 @@
addGroup('compiler_test.dart', compiler_test.main);
addGroup('css_test.dart', css_test.main);
- addGroup('paths_test.dart', paths_test.main);
addGroup('utils_test.dart', utils_test.main);
addGroup('transform/code_extractor_test.dart', code_extractor_test.main);
addGroup('transform/import_inliner_test.dart', import_inliner_test.main);
addGroup('transform/script_compactor_test.dart', script_compactor_test.main);
+ addGroup('transform/polyfill_injector_test.dart',
+ polyfill_injector_test.main);
addGroup('transform/all_phases_test.dart', all_phases_test.main);
endToEndTests('data/unit/', 'data/out');
@@ -51,36 +52,15 @@
// TODO(jmesserly): figure out why this fails in content_shell but works in
// Dartium and Firefox when using the ShadowDOM polyfill.
exampleTest('../example/component/news', ['--no-shadowdom']..addAll(args));
-
- exampleTest('../../../samples/third_party/todomvc');
}
-void exampleTest(String path, [List<String> args]) {
- renderTests(path, '$path/test', '$path/test/expected', '$path/test/out',
- arguments: args);
-}
-
-void cssCompileMangleTest(String path, String pattern,
- [bool deleteDirectory = true]) {
- renderTests(path, path, '$path/expected', '$path/out',
- arguments: ['--css-mangle'], pattern: pattern,
- deleteDir: deleteDirectory);
-}
-
-void cssCompilePolyFillTest(String path, String pattern, String cssReset,
- [bool deleteDirectory = true]) {
- var args = ['--no-css-mangle'];
- if (cssReset != null) {
- args.addAll(['--css-reset', '${path}/${cssReset}']);
- }
- renderTests(path, path, '$path/expected', '$path/out',
- arguments: args, pattern: pattern, deleteDir: deleteDirectory);
-}
-
-void cssCompileShadowDOMTest(String path, String pattern,
- [bool deleteDirectory = true]) {
- var args = ['--no-css'];
- renderTests(path, path, '$path/expected', '$path/out',
- arguments: args, pattern: pattern,
- deleteDir: deleteDirectory);
+void exampleTest(String path, [List args]) {
+ // TODO(sigmund): renderTests currently contatenates [path] with the out
+ // folder. This can be a problem with relative paths that go up (like todomvc
+ // above, which has '../../../'). If we continue running tests with
+ // test/run.sh, we should fix this. For now we work around this problem by
+ // using a long path 'data/out/example/test'. That way we avoid dumping output
+ // in the source-tree.
+ renderTests(path, '$path/test', '$path/test/expected',
+ 'data/out/example/test', arguments: args);
}
diff --git a/pkg/polymer/test/transform/all_phases_test.dart b/pkg/polymer/test/transform/all_phases_test.dart
index a644fe5..a3826fa 100644
--- a/pkg/polymer/test/transform/all_phases_test.dart
+++ b/pkg/polymer/test/transform/all_phases_test.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 polymer.test.transform.script_compactor_test;
+library polymer.test.transform.all_phases_test;
import 'package:polymer/src/transform.dart';
import 'package:unittest/compact_vm_config.dart';
@@ -34,10 +34,11 @@
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head></head><body>'
+ '$SHADOW_DOM_TAG'
+ '$INTEROP_TAG'
'<script type="application/dart" '
'src="test.html_bootstrap.dart"></script>'
- '<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>'
+ '<script src="packages/browser/dart.js"></script>'
'</body></html>',
'a|web/test.html_bootstrap.dart':
@@ -65,10 +66,11 @@
}, {
'a|web/test.html':
'<!DOCTYPE html><html><head></head><body>'
+ '$SHADOW_DOM_TAG'
+ '$INTEROP_TAG'
'<script type="application/dart" '
'src="test.html_bootstrap.dart"></script>'
- '<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>'
+ '<script src="packages/browser/dart.js"></script>'
'</body></html>',
'a|web/test.html_bootstrap.dart':
@@ -102,11 +104,13 @@
'a|web/a.dart': _sampleObservable('A', 'foo'),
}, {
'a|web/test.html':
- '<!DOCTYPE html><html><head></head><body><div></div>'
+ '<!DOCTYPE html><html><head></head><body>'
+ '$SHADOW_DOM_TAG'
+ '$INTEROP_TAG'
+ '<div></div>'
'<script type="application/dart" '
'src="test.html_bootstrap.dart"></script>'
- '<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>'
+ '<script src="packages/browser/dart.js"></script>'
'</body></html>',
'a|web/test.html_bootstrap.dart':
@@ -144,19 +148,20 @@
'${_sampleObservable("C", "car")}</script>',
'a|web/b.dart': _sampleObservable('B', 'bar'),
'a|web/test2.html':
- '<!DOCTYPE html><html><head>'
- '</head><body><polymer-element>1'
+ '<!DOCTYPE html><html><head></head><body>'
+ '<polymer-element>1'
'<script type="application/dart">'
'${_sampleObservable("A", "foo")}</script>'
'</polymer-element></html>',
}, {
'a|web/index.html':
'<!DOCTYPE html><html><head></head><body>'
+ '$SHADOW_DOM_TAG'
+ '$INTEROP_TAG'
'<polymer-element>1</polymer-element>'
'<script type="application/dart" '
'src="index.html_bootstrap.dart"></script>'
- '<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>'
+ '<script src="packages/browser/dart.js"></script>'
'</body></html>',
'a|web/index.html_bootstrap.dart':
'''library app_bootstrap;
@@ -183,6 +188,7 @@
}
String _sampleObservable(String className, String fieldName) => '''
+library ${className}_$fieldName;
import 'package:observe/observe.dart';
class $className extends ObservableBase {
@@ -192,6 +198,7 @@
''';
String _sampleObservableOutput(String className, String fieldName) => '''
+library ${className}_$fieldName;
import 'package:observe/observe.dart';
class $className extends ChangeNotifierBase {
diff --git a/pkg/polymer/test/transform/code_extractor_test.dart b/pkg/polymer/test/transform/code_extractor_test.dart
index e62ec96..9619684 100644
--- a/pkg/polymer/test/transform/code_extractor_test.dart
+++ b/pkg/polymer/test/transform/code_extractor_test.dart
@@ -18,7 +18,7 @@
'a|test.html': '<!DOCTYPE html><html></html>',
});
- testPhases('single script', [[new InlineCodeExtractor()]], {
+ testPhases('single script, no lib', [[new InlineCodeExtractor()]], {
'a|test.html':
'<!DOCTYPE html><html><head>'
'<script type="application/dart">main() { }</script>',
@@ -29,14 +29,28 @@
'</head><body></body></html>',
'a|test.html.0.dart':
- 'main() { }',
+ 'library test_html_0;\nmain() { }',
+ });
+
+ testPhases('single script, with lib', [[new InlineCodeExtractor()]], {
+ 'a|test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart">library f;\nmain() { }</script>',
+ }, {
+ 'a|test.html':
+ '<!DOCTYPE html><html><head>'
+ '<script type="application/dart" src="test.html.0.dart"></script>'
+ '</head><body></body></html>',
+
+ 'a|test.html.0.dart':
+ 'library f;\nmain() { }',
});
testPhases('multiple scripts', [[new InlineCodeExtractor()]], {
'a|test.html':
'<!DOCTYPE html><html><head>'
- '<script type="application/dart">main1() { }</script>'
- '<script type="application/dart">main2() { }</script>',
+ '<script type="application/dart">library a1;\nmain1() { }</script>'
+ '<script type="application/dart">library a2;\nmain2() { }</script>',
}, {
'a|test.html':
'<!DOCTYPE html><html><head>'
@@ -45,10 +59,10 @@
'</head><body></body></html>',
'a|test.html.0.dart':
- 'main1() { }',
+ 'library a1;\nmain1() { }',
'a|test.html.1.dart':
- 'main2() { }',
+ 'library a2;\nmain2() { }',
});
testPhases('multiple deeper scripts', [[new InlineCodeExtractor()]], {
@@ -71,12 +85,12 @@
'</div></div></body></html>',
'a|test.html.0.dart':
- 'main1() { }',
+ 'library test_html_0;\nmain1() { }',
'a|test.html.1.dart':
- 'main2() { }',
+ 'library test_html_1;\nmain2() { }',
'a|test.html.2.dart':
- 'main3() { }',
+ 'library test_html_2;\nmain3() { }',
});
}
diff --git a/pkg/polymer/test/transform/common.dart b/pkg/polymer/test/transform/common.dart
index c0fd47e..8114feb 100644
--- a/pkg/polymer/test/transform/common.dart
+++ b/pkg/polymer/test/transform/common.dart
@@ -95,3 +95,7 @@
});
}
+const SHADOW_DOM_TAG =
+ '<script src="packages/shadow_dom/shadow_dom.min.js"></script>\n';
+
+const INTEROP_TAG = '<script src="packages/browser/interop.js"></script>\n';
diff --git a/pkg/polymer/test/transform/polyfill_injector_test.dart b/pkg/polymer/test/transform/polyfill_injector_test.dart
new file mode 100644
index 0000000..0800325
--- /dev/null
+++ b/pkg/polymer/test/transform/polyfill_injector_test.dart
@@ -0,0 +1,46 @@
+// 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 polymer.test.transform.polyfill_injector_test;
+
+import 'package:polymer/src/transform.dart';
+import 'package:unittest/compact_vm_config.dart';
+
+import 'common.dart';
+
+void main() {
+ useCompactVMConfiguration();
+
+ testPhases('no changes', [[new PolyfillInjector()]], {
+ 'a|web/test.html': '<!DOCTYPE html><html></html>',
+ }, {
+ 'a|web/test.html': '<!DOCTYPE html><html></html>',
+ });
+
+ testPhases('with some script', [[new PolyfillInjector()]], {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '<script type="application/dart" src="a.dart"></script>',
+ }, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '$SHADOW_DOM_TAG$INTEROP_TAG'
+ '<script type="application/dart" src="a.dart"></script>'
+ '</body></html>',
+ });
+
+ testPhases('interop/shadow dom already present', [[new PolyfillInjector()]], {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '<script type="application/dart" src="a.dart"></script>'
+ '$SHADOW_DOM_TAG'
+ '$INTEROP_TAG',
+ }, {
+ 'a|web/test.html':
+ '<!DOCTYPE html><html><head></head><body>'
+ '<script type="application/dart" src="a.dart"></script>'
+ '$SHADOW_DOM_TAG'
+ '$INTEROP_TAG</body></html>',
+ });
+}
diff --git a/pkg/polymer/test/transform/script_compactor_test.dart b/pkg/polymer/test/transform/script_compactor_test.dart
index b271e3c..e12d379 100644
--- a/pkg/polymer/test/transform/script_compactor_test.dart
+++ b/pkg/polymer/test/transform/script_compactor_test.dart
@@ -27,8 +27,7 @@
'<!DOCTYPE html><html><head></head><body>'
'<script type="application/dart" '
'src="test.html_bootstrap.dart"></script>'
- '<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>'
+ '<script src="packages/browser/dart.js"></script>'
'</body></html>',
'a|test.html_bootstrap.dart':
@@ -61,8 +60,7 @@
'<!DOCTYPE html><html><head></head><body><div></div>'
'<script type="application/dart" '
'src="test.html_bootstrap.dart"></script>'
- '<script type="text/javascript" '
- 'src="packages/browser/dart.js"></script>'
+ '<script src="packages/browser/dart.js"></script>'
'</body></html>',
'a|test.html_bootstrap.dart':
diff --git a/pkg/polymer_expressions/lib/eval.dart b/pkg/polymer_expressions/lib/eval.dart
index dbf1f88..7ed7b5a 100644
--- a/pkg/polymer_expressions/lib/eval.dart
+++ b/pkg/polymer_expressions/lib/eval.dart
@@ -74,24 +74,30 @@
bool isIndex = false;
var filters = <Expression>[]; // reversed order for assignment
- while (expr is BinaryOperator && expr.operator == '|') {
- filters.add(expr.right);
- expr = expr.left;
+ while (expr is BinaryOperator) {
+ BinaryOperator op = expr;
+ if (op.operator != '|') {
+ break;
+ }
+ filters.add(op.right);
+ expr = op.left;
}
if (expr is Identifier) {
expression = empty();
- property = expr.value;
+ Identifier ident = expr;
+ property = ident.value;
} else if (expr is Invoke) {
- expression = expr.receiver;
- if (expr.method == '[]') {
- if (expr.arguments[0] is! Literal) notAssignable();
- Literal l = expr.arguments[0];
+ Invoke invoke = expr;
+ expression = invoke.receiver;
+ if (invoke.method == '[]') {
+ if (invoke.arguments[0] is! Literal) notAssignable();
+ Literal l = invoke.arguments[0];
property = l.value;
isIndex = true;
- } else if (expr.method != null) {
- if (expr.arguments != null) notAssignable();
- property = expr.method;
+ } else if (invoke.method != null) {
+ if (invoke.arguments != null) notAssignable();
+ property = invoke.method;
} else {
notAssignable();
}
@@ -418,7 +424,7 @@
implements ParenthesizedExpression {
final ExpressionObserver child;
- ParenthesizedObserver(ExpressionObserver expr, this.child) : super(expr);
+ ParenthesizedObserver(ParenthesizedExpression expr, this.child) : super(expr);
_updateSelf(Scope scope) {
diff --git a/pkg/polymer_expressions/lib/expression.dart b/pkg/polymer_expressions/lib/expression.dart
index 516e85b..0a5bb82 100644
--- a/pkg/polymer_expressions/lib/expression.dart
+++ b/pkg/polymer_expressions/lib/expression.dart
@@ -84,6 +84,8 @@
String toString() => "{$entries}";
bool operator ==(o) => o is MapLiteral && _listEquals(o.entries, entries);
+
+ int get hashCode => _hashList(entries);
}
class MapLiteralEntry extends Expression {
@@ -98,6 +100,8 @@
bool operator ==(o) => o is MapLiteralEntry && o.key == key
&& o.entryValue == entryValue;
+
+ int get hashCode => _JenkinsSmiHash.hash2(key.hashCode, entryValue.hashCode);
}
class ParenthesizedExpression extends Expression {
@@ -140,6 +144,8 @@
bool operator ==(o) => o is UnaryOperator && o.operator == operator
&& o.child == child;
+
+ int get hashCode => _JenkinsSmiHash.hash2(operator.hashCode, child.hashCode);
}
class BinaryOperator extends Expression {
@@ -155,6 +161,9 @@
bool operator ==(o) => o is BinaryOperator && o.operator == operator
&& o.left == left && o.right == right;
+
+ int get hashCode => _JenkinsSmiHash.hash3(operator.hashCode, left.hashCode,
+ right.hashCode);
}
class InExpression extends Expression {
@@ -169,6 +178,8 @@
bool operator ==(o) => o is InExpression && o.left == left
&& o.right == right;
+
+ int get hashCode => _JenkinsSmiHash.hash2(left.hashCode, right.hashCode);
}
/**
@@ -195,6 +206,9 @@
&& o.receiver == receiver
&& o.method == method
&& _listEquals(o.arguments, arguments);
+
+ int get hashCode => _JenkinsSmiHash.hash3(receiver.hashCode, method.hashCode,
+ _hashList(arguments));
}
bool _listEquals(List a, List b) {
@@ -205,4 +219,33 @@
if (a[i] != b[i]) return false;
}
return true;
-}
\ No newline at end of file
+}
+
+int _hashList(List l) {
+ var hash = l.fold(0,
+ (h, item) => _JenkinsSmiHash.combine(h, item.hashCode));
+ return _JenkinsSmiHash.finish(hash);
+}
+
+class _JenkinsSmiHash {
+ // TODO: Bug 11617- This class should be optimized and standardized elsewhere.
+
+ static int combine(int hash, int value) {
+ hash = 0x1fffffff & (hash + value);
+ hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
+ return hash ^ (hash >> 6);
+ }
+
+ static int finish(int hash) {
+ hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
+ hash = hash ^ (hash >> 11);
+ return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
+ }
+
+ static int hash2(a, b) => finish(combine(combine(0, a), b));
+
+ static int hash3(a, b, c) => finish(combine(combine(combine(0, a), b), c));
+
+ static int hash4(a, b, c, d) =>
+ finish(combine(combine(combine(combine(0, a), b), c), d));
+}
diff --git a/pkg/polymer_expressions/lib/parser.dart b/pkg/polymer_expressions/lib/parser.dart
index c02d656..cc06681 100644
--- a/pkg/polymer_expressions/lib/parser.dart
+++ b/pkg/polymer_expressions/lib/parser.dart
@@ -134,22 +134,16 @@
return _astFactory.identifier('this');
} else if (keyword == 'in') {
return null;
- } else {
- throw new ArgumentError('unrecognized keyword: $keyword');
}
- break;
+ throw new ArgumentError('unrecognized keyword: $keyword');
case IDENTIFIER_TOKEN:
return _parseInvokeOrIdentifier();
- break;
case STRING_TOKEN:
return _parseString();
- break;
case INTEGER_TOKEN:
return _parseInteger();
- break;
case DECIMAL_TOKEN:
return _parseDecimal();
- break;
case GROUPER_TOKEN:
if (_token.value == '(') {
return _parseParenthesized();
@@ -157,7 +151,6 @@
return _parseMapLiteral();
}
return null;
- break;
default:
return null;
}
diff --git a/pkg/polymer_expressions/lib/tokenizer.dart b/pkg/polymer_expressions/lib/tokenizer.dart
index 4e03167..6d3f2c9 100644
--- a/pkg/polymer_expressions/lib/tokenizer.dart
+++ b/pkg/polymer_expressions/lib/tokenizer.dart
@@ -132,11 +132,11 @@
int escape(int c) {
switch (c) {
- case _f: return _FF; break;
- case _n: return _LF; break;
- case _r: return _CR; break;
- case _t: return _TAB; break;
- case _v: return _VTAB; break;
+ case _f: return _FF;
+ case _n: return _LF;
+ case _r: return _CR;
+ case _t: return _TAB;
+ case _v: return _VTAB;
default: return c;
}
}
diff --git a/pkg/serialization/test/serialization_test.dart b/pkg/serialization/test/serialization_test.dart
index 3cb5a75..83232c9 100644
--- a/pkg/serialization/test/serialization_test.dart
+++ b/pkg/serialization/test/serialization_test.dart
@@ -4,7 +4,7 @@
library serialization_test;
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:unittest/unittest.dart';
import 'package:serialization/serialization.dart';
import 'package:serialization/src/serialization_helpers.dart';
@@ -366,8 +366,8 @@
test("Straight JSON format", () {
var s = new Serialization();
var writer = s.newWriter(const SimpleJsonFormat());
- var out = json.stringify(writer.write(a1));
- var reconstituted = json.parse(out);
+ var out = JSON.encode(writer.write(a1));
+ var reconstituted = JSON.decode(out);
expect(reconstituted.length, 4);
expect(reconstituted[0], "Seattle");
});
@@ -378,8 +378,8 @@
var addressRule = s.addRuleFor(Address)..configureForMaps();
var personRule = s.addRuleFor(Person)..configureForMaps();
var writer = s.newWriter(const SimpleJsonFormat(storeRoundTripInfo: true));
- var out = json.stringify(writer.write(p1));
- var reconstituted = json.parse(out);
+ var out = JSON.encode(writer.write(p1));
+ var reconstituted = JSON.decode(out);
var expected = {
"name" : "Alice",
"rank" : null,
diff --git a/pkg/source_maps/lib/builder.dart b/pkg/source_maps/lib/builder.dart
index be00c9e..12587cd 100644
--- a/pkg/source_maps/lib/builder.dart
+++ b/pkg/source_maps/lib/builder.dart
@@ -7,8 +7,8 @@
// TODO(sigmund): add a builder for multi-section mappings.
-import 'dart:json' as json;
import 'dart:collection';
+import 'dart:convert';
import 'span.dart';
import 'src/vlq.dart';
@@ -108,7 +108,7 @@
}
/// Encodes all mappings added to this builder as a json string.
- String toJson(String fileUrl) => json.stringify(build(fileUrl));
+ String toJson(String fileUrl) => JSON.encode(build(fileUrl));
/// Get the index of [value] in [map], or create one if it doesn't exist.
int _indexOf(Map<String, int> map, String value) {
diff --git a/pkg/source_maps/lib/parser.dart b/pkg/source_maps/lib/parser.dart
index e293263..6b8bf37 100644
--- a/pkg/source_maps/lib/parser.dart
+++ b/pkg/source_maps/lib/parser.dart
@@ -5,7 +5,7 @@
/// Contains the top-level function to parse source maps version 3.
library source_maps.parser;
-import 'dart:json' as json;
+import 'dart:convert';
import 'span.dart';
import 'src/utils.dart';
@@ -15,7 +15,7 @@
// TODO(sigmund): evaluate whether other maps should have the json parsed, or
// the string represenation.
Mapping parse(String jsonMap, {Map<String, Map> otherMaps}) =>
- parseJson(json.parse(jsonMap), otherMaps: otherMaps);
+ parseJson(JSON.decode(jsonMap), otherMaps: otherMaps);
/// Parses a source map directly from a json map object.
Mapping parseJson(Map map, {Map<String, Map> otherMaps}) {
diff --git a/pkg/source_maps/test/builder_test.dart b/pkg/source_maps/test/builder_test.dart
index 7bf2ee4..8842c62 100644
--- a/pkg/source_maps/test/builder_test.dart
+++ b/pkg/source_maps/test/builder_test.dart
@@ -4,7 +4,7 @@
library test.source_maps_test;
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:unittest/unittest.dart';
import 'package:source_maps/source_maps.dart';
import 'common.dart';
@@ -27,6 +27,6 @@
..addLocation(inputVar2.start, outputVar2.start, 'longVar2')
..addLocation(inputExpr.start, outputExpr.start, null))
.toJson(output.url);
- expect(str, json.stringify(EXPECTED_MAP));
+ expect(str, JSON.encode(EXPECTED_MAP));
});
}
diff --git a/pkg/source_maps/test/parser_test.dart b/pkg/source_maps/test/parser_test.dart
index 1c32cbd..c99acb2 100644
--- a/pkg/source_maps/test/parser_test.dart
+++ b/pkg/source_maps/test/parser_test.dart
@@ -4,7 +4,7 @@
library test.parser_test;
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:unittest/unittest.dart';
import 'package:source_maps/source_maps.dart';
import 'common.dart';
@@ -19,7 +19,7 @@
});
test('parse + json', () {
- var mapping = parse(json.stringify(EXPECTED_MAP));
+ var mapping = parse(JSON.encode(EXPECTED_MAP));
check(outputVar1, mapping, inputVar1, false);
check(outputVar2, mapping, inputVar2, false);
check(outputFunction, mapping, inputFunction, false);
diff --git a/pkg/source_maps/test/printer_test.dart b/pkg/source_maps/test/printer_test.dart
index eaeae2a..fe27f76 100644
--- a/pkg/source_maps/test/printer_test.dart
+++ b/pkg/source_maps/test/printer_test.dart
@@ -4,7 +4,7 @@
library test.printer_test;
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:unittest/unittest.dart';
import 'package:source_maps/printer.dart';
import 'package:source_maps/span.dart';
@@ -23,7 +23,7 @@
..mark(inputExpr)
..add('x + y;\n');
expect(printer.text, OUTPUT);
- expect(printer.map, json.stringify(EXPECTED_MAP));
+ expect(printer.map, JSON.encode(EXPECTED_MAP));
});
test('printer projecting marks', () {
@@ -90,7 +90,7 @@
..add('x + y;\n', span: inputExpr)
..build('output.dart');
expect(printer.text, OUTPUT);
- expect(printer.map, json.stringify(EXPECTED_MAP));
+ expect(printer.map, JSON.encode(EXPECTED_MAP));
});
test('nested use', () {
@@ -102,7 +102,7 @@
..add('x + y;\n', span: inputExpr)
..build('output.dart');
expect(printer.text, OUTPUT);
- expect(printer.map, json.stringify(EXPECTED_MAP));
+ expect(printer.map, JSON.encode(EXPECTED_MAP));
});
test('add indentation', () {
diff --git a/pkg/third_party/html5lib/lib/dom_parsing.dart b/pkg/third_party/html5lib/lib/dom_parsing.dart
index 91b37ec..363db7d 100644
--- a/pkg/third_party/html5lib/lib/dom_parsing.dart
+++ b/pkg/third_party/html5lib/lib/dom_parsing.dart
@@ -5,7 +5,7 @@
library dom_parsing;
import 'dart:math';
-import 'dart:utf' show codepointsToString;
+import 'package:utf/utf.dart' show codepointsToString;
import 'dom.dart';
/** A simple tree visitor for the DOM nodes. */
diff --git a/pkg/third_party/html5lib/lib/src/char_encodings.dart b/pkg/third_party/html5lib/lib/src/char_encodings.dart
index 610a8da..7fce8fd 100644
--- a/pkg/third_party/html5lib/lib/src/char_encodings.dart
+++ b/pkg/third_party/html5lib/lib/src/char_encodings.dart
@@ -2,7 +2,7 @@
library char_encodings;
import 'dart:collection';
-import 'dart:utf';
+import 'package:utf/utf.dart';
// TODO(jmesserly): this function is conspicuously absent from dart:utf.
/**
diff --git a/pkg/third_party/html5lib/lib/src/inputstream.dart b/pkg/third_party/html5lib/lib/src/inputstream.dart
index 29ee1dc..a3d6046 100644
--- a/pkg/third_party/html5lib/lib/src/inputstream.dart
+++ b/pkg/third_party/html5lib/lib/src/inputstream.dart
@@ -1,7 +1,7 @@
library inputstream;
import 'dart:collection';
-import 'dart:utf';
+import 'package:utf/utf.dart';
import 'package:source_maps/span.dart' show SourceFile;
import 'char_encodings.dart';
import 'constants.dart';
diff --git a/pkg/third_party/html5lib/pubspec.yaml b/pkg/third_party/html5lib/pubspec.yaml
index 79a09be..cd968ae 100644
--- a/pkg/third_party/html5lib/pubspec.yaml
+++ b/pkg/third_party/html5lib/pubspec.yaml
@@ -4,6 +4,7 @@
homepage: https://github.com/dart-lang/html5lib
dependencies:
source_maps: any
+ utf: any
dev_dependencies:
browser: any
path: any
diff --git a/pkg/third_party/html5lib/test/parser_test.dart b/pkg/third_party/html5lib/test/parser_test.dart
index 0125634..060359c 100644
--- a/pkg/third_party/html5lib/test/parser_test.dart
+++ b/pkg/third_party/html5lib/test/parser_test.dart
@@ -1,7 +1,7 @@
library parser_test;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:path/path.dart' as pathos;
import 'package:unittest/unittest.dart';
import 'package:html5lib/dom.dart';
@@ -114,11 +114,11 @@
/** Extract the name for the test based on the test input data. */
_nameFor(String input) {
- // Using json.parse to unescape other unicode characters
+ // Using JSON.decode to unescape other unicode characters
var escapeQuote = input
.replaceAll(new RegExp('\\\\.'), '_')
.replaceAll(new RegExp('\u0000'), '_')
.replaceAll('"', '\\"')
.replaceAll(new RegExp('[\n\r\t]'),'_');
- return json.parse('"$escapeQuote"');
+ return JSON.decode('"$escapeQuote"');
}
diff --git a/pkg/third_party/html5lib/test/tokenizer_test.dart b/pkg/third_party/html5lib/test/tokenizer_test.dart
index fc98012..637cc9a 100644
--- a/pkg/third_party/html5lib/test/tokenizer_test.dart
+++ b/pkg/third_party/html5lib/test/tokenizer_test.dart
@@ -2,10 +2,9 @@
// Note: mirrors used to match the getattr usage in the original test
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'dart:mirrors';
-import 'dart:utf';
import 'package:path/path.dart' as pathos;
import 'package:unittest/unittest.dart';
import 'package:html5lib/src/char_encodings.dart';
@@ -13,6 +12,7 @@
import 'package:html5lib/src/token.dart';
import 'package:html5lib/src/tokenizer.dart';
import 'package:html5lib/src/utils.dart';
+import 'package:utf/utf.dart';
import 'support.dart';
class TokenizerTestParser {
@@ -207,10 +207,10 @@
}
Map unescape(Map testInfo) {
- // TODO(sigmundch,jmesserly): we currently use json.parse to unescape the
+ // TODO(sigmundch,jmesserly): we currently use JSON.decode to unescape the
// unicode characters in the string, we should use a decoding that works with
// any control characters.
- decode(inp) => inp == '\u0000' ? inp : json.parse('"$inp"');
+ decode(inp) => inp == '\u0000' ? inp : JSON.decode('"$inp"');
testInfo["input"] = decode(testInfo["input"]);
for (var token in testInfo["output"]) {
@@ -248,7 +248,7 @@
if (!path.endsWith('.test')) continue;
var text = new File(path).readAsStringSync();
- var tests = json.parse(text);
+ var tests = JSON.decode(text);
var testName = pathos.basenameWithoutExtension(path);
var testList = tests['tests'];
if (testList == null) continue;
diff --git a/pkg/unittest/lib/interactive_html_config.dart b/pkg/unittest/lib/interactive_html_config.dart
index 27791ee..16a69a0 100644
--- a/pkg/unittest/lib/interactive_html_config.dart
+++ b/pkg/unittest/lib/interactive_html_config.dart
@@ -19,7 +19,7 @@
import 'dart:html';
import 'dart:async';
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:stack_trace/stack_trace.dart';
@@ -164,7 +164,7 @@
DateTime end = new DateTime.now();
int elapsed = end.difference(_testStarts[testCase.id]).inMilliseconds;
if (testCase.stackTrace != null) {
- var message = json.stringify(testCase.stackTrace.frames.map((frame) {
+ var message = JSON.encode(testCase.stackTrace.frames.map((frame) {
return <String, dynamic>{
"uri": frame.uri.toString(),
"line": frame.line,
@@ -244,7 +244,7 @@
if (msg.messageType == _Message.LOG) {
logMessage(e.data);
} else if (msg.messageType == _Message.STACK) {
- _stack = new Trace(json.parse(msg.body).map((frame) {
+ _stack = new Trace(JSON.decode(msg.body).map((frame) {
return new Frame(
Uri.parse(frame['uri']),
frame['line'],
diff --git a/pkg/unittest/lib/src/configuration.dart b/pkg/unittest/lib/src/configuration.dart
index c9ec1c0..1862bf5 100644
--- a/pkg/unittest/lib/src/configuration.dart
+++ b/pkg/unittest/lib/src/configuration.dart
@@ -28,6 +28,9 @@
*/
bool get autoStart => true;
+ /// How long a [TestCase] can run before it is considered an error.
+ Duration get timeout => const Duration(seconds: 20);
+
/**
* Called as soon as the unittest framework becomes initialized. This is done
* even before tests are added to the test framework. It might be used to
diff --git a/pkg/unittest/lib/src/simple_configuration.dart b/pkg/unittest/lib/src/simple_configuration.dart
index 1056ad3..20172c3 100644
--- a/pkg/unittest/lib/src/simple_configuration.dart
+++ b/pkg/unittest/lib/src/simple_configuration.dart
@@ -52,6 +52,9 @@
// we do with this List.
final _testLogBuffer = <Pair<String, StackTrace>>[];
+ /// How long a [TestCase] can run before it is considered an error.
+ Duration timeout = const Duration(seconds: 20);
+
/**
* The constructor sets up a failure handler for [expect] that redirects
* [expect] failures to [onExpectFailure].
diff --git a/pkg/unittest/lib/test_controller.js b/pkg/unittest/lib/test_controller.js
index 439b703..fe5cf93 100644
--- a/pkg/unittest/lib/test_controller.js
+++ b/pkg/unittest/lib/test_controller.js
@@ -23,7 +23,15 @@
window.postMessage('unittest-suite-external-error', '*');
};
-if (navigator.webkitStartDart) {
+// Start Dartium/content_shell, unless we are waiting for HTML Imports to load.
+// HTML Imports allows a document to link to other HTMLs documents via
+// <link rel=import>. It also allows for those other documents to contain
+// <script> tags, which must be run before scripts on the main page.
+// We have package:html_import to polyfill this feature, and it will handle
+// starting Dartium/content_shell in that case. HTML Imports is used by Polymer,
+// but it could be used by itself too. See the specification:
+// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html
+if (navigator.webkitStartDart && !window.HTMLImports) {
navigator.webkitStartDart();
}
@@ -152,6 +160,7 @@
window.postMessage(msg, '*');
return;
}
+ if (typeof console === 'object') console.warn(msg);
var pre = document.createElement("pre");
pre.appendChild(document.createTextNode(String(msg)));
document.body.appendChild(pre);
diff --git a/pkg/unittest/lib/unittest.dart b/pkg/unittest/lib/unittest.dart
index f6e83c2..f3b4e44 100644
--- a/pkg/unittest/lib/unittest.dart
+++ b/pkg/unittest/lib/unittest.dart
@@ -752,7 +752,18 @@
} else {
final testCase = testCases[_currentTestCaseIndex];
var f = _guardAsync(testCase._run, null, testCase);
+ Timer timer;
+ try {
+ final Duration timeout = unittestConfiguration.timeout;
+ timer = new Timer(timeout, () {
+ testCase.error("Test timed out after ${timeout.inSeconds} seconds.");
+ });
+ } on UnsupportedError catch (e) {
+ if (e.message != "Timer greater than 0.") rethrow;
+ // Support running on d8 and jsshell which don't support timers.
+ }
f.whenComplete(() {
+ if (timer != null) timer.cancel();
var now = new DateTime.now().millisecondsSinceEpoch;
if ((now - _lastBreath) >= BREATH_INTERVAL) {
_lastBreath = now;
diff --git a/pkg/unittest/test/matchers_minified_test.dart b/pkg/unittest/test/matchers_minified_test.dart
index 787c9e1..0edd3e3 100644
--- a/pkg/unittest/test/matchers_minified_test.dart
+++ b/pkg/unittest/test/matchers_minified_test.dart
@@ -52,8 +52,9 @@
});
test('throwsNoSuchMethodError', () {
- shouldPass(() { throw new NoSuchMethodError(null, '', null, null); },
- throwsNoSuchMethodError);
+ shouldPass(() {
+ throw new NoSuchMethodError(null, const Symbol(''), null, null);
+ }, throwsNoSuchMethodError);
shouldFail(() { throw new Exception(); },
throwsNoSuchMethodError,
matches(
diff --git a/pkg/unittest/test/matchers_unminified_test.dart b/pkg/unittest/test/matchers_unminified_test.dart
index 8a1b005..3d7c322 100644
--- a/pkg/unittest/test/matchers_unminified_test.dart
+++ b/pkg/unittest/test/matchers_unminified_test.dart
@@ -51,8 +51,9 @@
});
test('throwsNoSuchMethodError', () {
- shouldPass(() { throw new NoSuchMethodError(null, '', null, null); },
- throwsNoSuchMethodError);
+ shouldPass(() {
+ throw new NoSuchMethodError(null, const Symbol(''), null, null);
+ }, throwsNoSuchMethodError);
shouldFail(() { throw new Exception(); },
throwsNoSuchMethodError,
matches(
diff --git a/pkg/unittest/test/missing_tick_test.dart b/pkg/unittest/test/missing_tick_test.dart
new file mode 100644
index 0000000..7b42fab
--- /dev/null
+++ b/pkg/unittest/test/missing_tick_test.dart
@@ -0,0 +1,14 @@
+// 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:unittest/unittest.dart';
+
+// TODO(gram): Convert to a shouldFail passing test.
+main() {
+ group('Broken', () {
+ test('test that should time out', () {
+ expectAsync0(() {});
+ });
+ });
+}
diff --git a/pkg/yaml/lib/yaml.dart b/pkg/yaml/lib/yaml.dart
index 85861d5..fa52861 100644
--- a/pkg/yaml/lib/yaml.dart
+++ b/pkg/yaml/lib/yaml.dart
@@ -29,13 +29,13 @@
/// }
///
/// This library currently doesn't support dumping to YAML. You should use
-/// `stringify` from `dart:json` instead:
+/// `JSON.encode` from `dart:convert` instead:
///
-/// import 'dart:json' as json;
+/// import 'dart:convert';
/// import 'package:yaml/yaml.dart';
/// main() {
/// var doc = loadYaml("YAML: YAML Ain't Markup Language");
-/// print(json.stringify(doc));
+/// print(JSON.encode(doc));
/// }
///
/// [pub]: http://pub.dartlang.org
diff --git a/runtime/bin/dbg_message.cc b/runtime/bin/dbg_message.cc
index aaf4f90..739e82c 100644
--- a/runtime/bin/dbg_message.cc
+++ b/runtime/bin/dbg_message.cc
@@ -648,9 +648,8 @@
Dart_Handle target;
if (msg_parser.HasParam("libraryId")) {
- in_msg->SendErrorReply(msg_id,
- "libararyId evaluation target not supported");
- return false;
+ intptr_t lib_id = msg_parser.GetIntParam("libraryId");
+ target = Dart_GetLibraryFromId(lib_id);
} else if (msg_parser.HasParam("classId")) {
intptr_t cls_id = msg_parser.GetIntParam("classId");
target = Dart_GetClassFromId(cls_id);
diff --git a/runtime/bin/vmservice/running_isolates.dart b/runtime/bin/vmservice/running_isolates.dart
index 945e4f2..5b38223 100644
--- a/runtime/bin/vmservice/running_isolates.dart
+++ b/runtime/bin/vmservice/running_isolates.dart
@@ -35,7 +35,7 @@
});
result['type'] = 'IsolateList';
result['members'] = members;
- request.setResponse(JSON.stringify(result));
+ request.setResponse(JSON.encode(result));
}
Future route(ServiceRequest request) {
diff --git a/runtime/bin/vmservice/service_request.dart b/runtime/bin/vmservice/service_request.dart
index 04bf397..4724d7c 100644
--- a/runtime/bin/vmservice/service_request.dart
+++ b/runtime/bin/vmservice/service_request.dart
@@ -36,7 +36,7 @@
}
void setErrorResponse(String error) {
- _response = JSON.stringify({
+ _response = JSON.encode({
'type': 'error',
'msg': error,
'pathSegments': pathSegments,
diff --git a/runtime/bin/vmservice/vmservice.dart b/runtime/bin/vmservice/vmservice.dart
index 042d467..681eff1 100644
--- a/runtime/bin/vmservice/vmservice.dart
+++ b/runtime/bin/vmservice/vmservice.dart
@@ -5,7 +5,7 @@
library vmservice;
import 'dart:async';
-import 'dart:json' as JSON;
+import "dart:convert";
import 'dart:isolate';
import 'dart:typed_data';
diff --git a/runtime/include/dart_debugger_api.h b/runtime/include/dart_debugger_api.h
index 13b19ac..50bf9f0 100755
--- a/runtime/include/dart_debugger_api.h
+++ b/runtime/include/dart_debugger_api.h
@@ -598,6 +598,16 @@
/**
+ * Returns a handle to the library \library_id.
+ *
+ * Requires there to be a current isolate.
+ *
+ * \return A library handle if the id is valid.
+ */
+DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id);
+
+
+/**
* Returns an array containing all variable names and values of
* the given library \library_id.
*
diff --git a/runtime/lib/bool_patch.dart b/runtime/lib/bool_patch.dart
index d5594e2..60b5596 100644
--- a/runtime/lib/bool_patch.dart
+++ b/runtime/lib/bool_patch.dart
@@ -9,8 +9,4 @@
int get hashCode {
return this ? 1231 : 1237;
}
-
- String toString() {
- return this ? "true" : "false";
- }
}
diff --git a/runtime/lib/collection_patch.dart b/runtime/lib/collection_patch.dart
index e1cc262..869a70b 100644
--- a/runtime/lib/collection_patch.dart
+++ b/runtime/lib/collection_patch.dart
@@ -3,114 +3,275 @@
// BSD-style license that can be found in the LICENSE file.
patch class HashMap<K, V> {
- final _HashMapTable<K, V> _hashTable = new _HashMapTable<K, V>();
+ static const int _INITIAL_CAPACITY = 8;
+ static const int _MODIFICATION_COUNT_MASK = 0x3fffffff;
- /* patch */ HashMap() {
- _hashTable._container = this;
- }
+ int _elementCount = 0;
+ List<_HashMapEntry> _buckets = new List(_INITIAL_CAPACITY);
+ int _modificationCount = 0;
+
+ /* patch */ HashMap();
+
+ /* patch */ int get length => _elementCount;
+ /* patch */ bool get isEmpty => _elementCount == 0;
+ /* patch */ bool get isNotEmpty => _elementCount != 0;
+
+ /* patch */ Iterable<K> get keys => new _HashMapKeyIterable<K>(this);
+ /* patch */ Iterable<V> get values => new _HashMapValueIterable<V>(this);
/* patch */ bool containsKey(Object key) {
- return _hashTable._get(key) >= 0;
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int index = hashCode & (buckets.length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) return true;
+ entry = entry.next;
+ }
+ return false;
}
/* patch */ bool containsValue(Object value) {
- List table = _hashTable._table;
- int entrySize = _hashTable._entrySize;
- for (int offset = 0; offset < table.length; offset += entrySize) {
- if (!_hashTable._isFree(table[offset]) &&
- _hashTable._value(offset) == value) {
- return true;
+ List buckets = _buckets;
+ int length = buckets.length;
+ for (int i = 0; i < length; i++) {
+ _HashMapEntry entry = buckets[i];
+ while (entry != null) {
+ if (entry.value == value) return true;
+ entry = entry.next;
}
}
return false;
}
- /* patch */ void addAll(Map<K, V> other) {
- other.forEach((K key, V value) {
- int offset = _hashTable._put(key);
- _hashTable._setValue(offset, value);
- _hashTable._checkCapacity();
- });
- }
-
- /* patch */ V operator [](Object key) {
- int offset = _hashTable._get(key);
- if (offset >= 0) return _hashTable._value(offset);
+ /* patch */ V operator[](Object key) {
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int index = hashCode & (buckets.length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) {
+ return entry.value;
+ }
+ entry = entry.next;
+ }
return null;
}
/* patch */ void operator []=(K key, V value) {
- int offset = _hashTable._put(key);
- _hashTable._setValue(offset, value);
- _hashTable._checkCapacity();
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int length = buckets.length;
+ int index = hashCode & (length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) {
+ entry.value = value;
+ return;
+ }
+ entry = entry.next;
+ }
+ _addEntry(buckets, index, length, key, value, hashCode);
}
/* patch */ V putIfAbsent(K key, V ifAbsent()) {
- int offset = _hashTable._probeForAdd(_hashTable._hashCodeOf(key), key);
- Object entry = _hashTable._table[offset];
- if (!_hashTable._isFree(entry)) {
- return _hashTable._value(offset);
- }
- int modificationCount = _hashTable._modificationCount;
- V value = ifAbsent();
- if (modificationCount == _hashTable._modificationCount) {
- _hashTable._setKey(offset, key);
- _hashTable._setValue(offset, value);
- if (entry == null) {
- _hashTable._entryCount++;
- _hashTable._checkCapacity();
- } else {
- assert(identical(entry, _TOMBSTONE));
- _hashTable._deletedCount--;
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int length = buckets.length;
+ int index = hashCode & (length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) {
+ return entry.value;
}
- _hashTable._recordModification();
+ entry = entry.next;
+ }
+ int stamp = _modificationCount;
+ V value = ifAbsent();
+ if (stamp == _modificationCount) {
+ _addEntry(buckets, index, length, key, value, hashCode);
} else {
- // The table might have changed, so we can't trust [offset] any more.
- // Do another lookup before setting the value.
- offset = _hashTable._put(key);
- _hashTable._setValue(offset, value);
- _hashTable._checkCapacity();
+ this[key] = value;
}
return value;
}
- /* patch */ V remove(Object key) {
- int offset = _hashTable._remove(key);
- if (offset < 0) return null;
- V oldValue = _hashTable._value(offset);
- _hashTable._setValue(offset, null);
- _hashTable._checkCapacity();
- return oldValue;
- }
-
- /* patch */ void clear() {
- _hashTable._clear();
+ /* patch */ void addAll(Map<K, V> other) {
+ other.forEach((K key, V value) {
+ this[key] = value;
+ });
}
/* patch */ void forEach(void action(K key, V value)) {
- int modificationCount = _hashTable._modificationCount;
- List table = _hashTable._table;
- int entrySize = _hashTable._entrySize;
- for (int offset = 0; offset < table.length; offset += entrySize) {
- Object entry = table[offset];
- if (!_hashTable._isFree(entry)) {
- K key = identical(entry, _NULL) ? null : entry;
- V value = _hashTable._value(offset);
- action(key, value);
- _hashTable._checkModification(modificationCount);
+ int stamp = _modificationCount;
+ List buckets = _buckets;
+ int length = buckets.length;
+ for (int i = 0; i < length; i++) {
+ _HashMapEntry entry = buckets[i];
+ while (entry != null) {
+ action(entry.key, entry.value);
+ if (stamp != _modificationCount) {
+ throw new ConcurrentModificationError(this);
+ }
+ entry = entry.next;
}
}
}
- /* patch */ Iterable<K> get keys => new _HashTableKeyIterable<K>(_hashTable);
- /* patch */ Iterable<V> get values =>
- new _HashTableValueIterable<V>(_hashTable, _HashMapTable._VALUE_INDEX);
+ /* patch */ V remove(Object key) {
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int index = hashCode & (buckets.length - 1);
+ _HashMapEntry entry = buckets[index];
+ _HashMapEntry previous = null;
+ while (entry != null) {
+ _HashMapEntry next = entry.next;
+ if (hashCode == entry.hashCode && entry.key == key) {
+ if (previous == null) {
+ buckets[index] = next;
+ } else {
+ previous.next = next;
+ }
+ _elementCount--;
+ _modificationCount =
+ (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+ return entry.value;
+ }
+ previous = entry;
+ entry = next;
+ }
+ return null;
+ }
- /* patch */ int get length => _hashTable._elementCount;
+ /* patch */ void clear() {
+ _elementCount = 0;
+ _buckets = new List(_INITIAL_CAPACITY);
+ _modificationCount = (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+ }
- /* patch */ bool get isEmpty => _hashTable._elementCount == 0;
+ void _addEntry(List buckets, int index, int length,
+ K key, V value, int hashCode) {
+ _HashMapEntry entry =
+ new _HashMapEntry(key, value, hashCode, buckets[index]);
+ buckets[index] = entry;
+ int newElements = _elementCount + 1;
+ _elementCount = newElements;
+ // If we end up with more than 75% non-empty entries, we
+ // resize the backing store.
+ if ((newElements << 2) > ((length << 1) + length)) _resize();
+ _modificationCount = (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+ }
- /* patch */ bool get isNotEmpty => !isEmpty;
+ void _resize() {
+ List oldBuckets = _buckets;
+ int oldLength = oldBuckets.length;
+ int newLength = oldLength << 1;
+ List newBuckets = new List(newLength);
+ for (int i = 0; i < oldLength; i++) {
+ _HashMapEntry entry = oldBuckets[i];
+ while (entry != null) {
+ _HashMapEntry next = entry.next;
+ int hashCode = entry.hashCode;
+ int index = hashCode & (newLength - 1);
+ entry.next = newBuckets[index];
+ newBuckets[index] = entry;
+ entry = next;
+ }
+ }
+ _buckets = newBuckets;
+ }
+}
+
+class _HashMapEntry {
+ final key;
+ var value;
+ final int hashCode;
+ _HashMapEntry next;
+ _HashMapEntry(this.key, this.value, this.hashCode, this.next);
+}
+
+abstract class _HashMapIterable<E> extends IterableBase<E> {
+ final HashMap _map;
+ _HashMapIterable(this._map);
+ int get length => _map.length;
+ bool get isEmpty => _map.isEmpty;
+ bool get isNotEmpty => _map.isNotEmpty;
+}
+
+class _HashMapKeyIterable<K> extends _HashMapIterable<K> {
+ _HashMapKeyIterable(HashMap map) : super(map);
+ Iterator<K> get iterator => new _HashMapKeyIterator<K>(_map);
+ bool contains(K key) => _map.containsKey(key);
+ void forEach(void action(K key)) {
+ _map.forEach((K key, _) {
+ action(key);
+ });
+ }
+}
+
+class _HashMapValueIterable<V> extends _HashMapIterable<V> {
+ _HashMapValueIterable(HashMap map) : super(map);
+ Iterator<V> get iterator => new _HashMapValueIterator<V>(_map);
+ bool contains(V value) => _map.containsValue(value);
+ void forEach(void action(V value)) {
+ _map.forEach((_, V value) {
+ action(value);
+ });
+ }
+}
+
+abstract class _HashMapIterator<E> implements Iterator<E> {
+ final HashMap _map;
+ final int _stamp;
+
+ int _index = 0;
+ _HashMapEntry _entry;
+
+ _HashMapIterator(HashMap map)
+ : _map = map, _stamp = map._modificationCount;
+
+ bool moveNext() {
+ if (_stamp != _map._modificationCount) {
+ throw new ConcurrentModificationError(_map);
+ }
+ _HashMapEntry entry = _entry;
+ if (entry != null) {
+ _HashMapEntry next = entry.next;
+ if (next != null) {
+ _entry = next;
+ return true;
+ }
+ _entry = null;
+ }
+ List buckets = _map._buckets;
+ int length = buckets.length;
+ for (int i = _index; i < length; i++) {
+ entry = buckets[i];
+ if (entry != null) {
+ _index = i + 1;
+ _entry = entry;
+ return true;
+ }
+ }
+ _index = length;
+ return false;
+ }
+}
+
+class _HashMapKeyIterator<K> extends _HashMapIterator<K> {
+ _HashMapKeyIterator(HashMap map) : super(map);
+ K get current {
+ _HashMapEntry entry = _entry;
+ return (entry == null) ? null : entry.key;
+ }
+}
+
+class _HashMapValueIterator<V> extends _HashMapIterator<V> {
+ _HashMapValueIterator(HashMap map) : super(map);
+ V get current {
+ _HashMapEntry entry = _entry;
+ return (entry == null) ? null : entry.value;
+ }
}
patch class HashSet<E> {
@@ -193,119 +354,264 @@
}
}
+class _LinkedHashMapEntry extends _HashMapEntry {
+ var _nextEntry;
+ var _previousEntry;
+ _LinkedHashMapEntry(key, value, int hashCode, _LinkedHashMapEntry next,
+ this._previousEntry, this._nextEntry)
+ : super(key, value, hashCode, next) {
+ _previousEntry._nextEntry = this;
+ _nextEntry._previousEntry = this;
+ }
+}
+
+class _LinkedHashMapKeyIterable<K> extends IterableBase<K> {
+ LinkedHashMap<K, dynamic> _map;
+ _LinkedHashMapKeyIterable(this._map);
+ Iterator<K> get iterator => new _LinkedHashMapKeyIterator<K>(_map);
+ bool contains(K key) => _map.containsKey(key);
+ bool get isEmpty => _map.isEmpty;
+ bool get isNotEmpty => _map.isNotEmpty;
+ int get length => _map.length;
+}
+
+class _LinkedHashMapValueIterable<V> extends IterableBase<V> {
+ LinkedHashMap<dynamic, V> _map;
+ _LinkedHashMapValueIterable(this._map);
+ Iterator<K> get iterator => new _LinkedHashMapValueIterator<V>(_map);
+ bool contains(V value) => _map.containsValue(value);
+ bool get isEmpty => _map.isEmpty;
+ bool get isNotEmpty => _map.isNotEmpty;
+ int get length => _map.length;
+}
+
+abstract class _LinkedHashMapIterator<T> implements Iterator<T> {
+ final _LinkedHashMap _map;
+ var _next;
+ T _current;
+ int _modificationCount;
+ _LinkedHashMapIterator(_LinkedHashMap map)
+ : _map = map,
+ _current = null,
+ _next = map._nextEntry,
+ _modificationCount = map._modificationCount;
+
+ bool moveNext() {
+ if (_modificationCount != _map._modificationCount) {
+ throw new ConcurrentModificationError(_map);
+ }
+ if (identical(_map, _next)) {
+ _current = null;
+ return false;
+ }
+ _LinkedHashMapEntry entry = _next;
+ _next = entry._nextEntry;
+ _current = _getValue(entry);
+ return true;
+ }
+
+ T _getValue(_LinkedHashMapEntry entry);
+
+ T get current => _current;
+}
+
+class _LinkedHashMapKeyIterator<K> extends _LinkedHashMapIterator<K> {
+ _LinkedHashMapKeyIterator(_LinkedHashMap map) : super(map);
+ K _getValue(_LinkedHashMapEntry entry) => entry.key;
+}
+
+class _LinkedHashMapValueIterator<V> extends _LinkedHashMapIterator<V> {
+ _LinkedHashMapValueIterator(_LinkedHashMap map) : super(map);
+ V _getValue(_LinkedHashMapEntry entry) => entry.value;
+}
+
+
/**
* A hash-based map that iterates keys and values in key insertion order.
*/
patch class LinkedHashMap<K, V> {
- final _LinkedHashMapTable _hashTable;
+ static const int _INITIAL_CAPACITY = 8;
+ static const int _MODIFICATION_COUNT_MASK = 0x3fffffff;
- /* patch */ LinkedHashMap() : _hashTable = new _LinkedHashMapTable<K, V>() {
- _hashTable._container = this;
+ int _elementCount = 0;
+ List<_HashMapEntry> _buckets = new List(_INITIAL_CAPACITY);
+ int _modificationCount = 0;
+
+ var _nextEntry;
+ var _previousEntry;
+
+ /* patch */ LinkedHashMap() {
+ _nextEntry = _previousEntry = this;
}
+ /* patch */ int get length => _elementCount;
+ /* patch */ bool get isEmpty => _elementCount == 0;
+ /* patch */ bool get isNotEmpty => _elementCount != 0;
+
+ /* patch */ Iterable<K> get keys => new _LinkedHashMapKeyIterable<K>(this);
+ /* patch */ Iterable<V> get values => new _LinkedHashMapValueIterable<V>(this);
+
/* patch */ bool containsKey(Object key) {
- return _hashTable._get(key) >= 0;
- }
-
- /* patch */ bool containsValue(Object value) {
- int modificationCount = _hashTable._modificationCount;
- for (int offset = _hashTable._next(_LinkedHashTable._HEAD_OFFSET);
- offset != _LinkedHashTable._HEAD_OFFSET;
- offset = _hashTable._next(offset)) {
- if (_hashTable._value(offset) == value) {
- return true;
- }
- // The == call may modify the table.
- _hashTable._checkModification(modificationCount);
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int index = hashCode & (buckets.length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) return true;
+ entry = entry.next;
}
return false;
}
- /* patch */ void addAll(Map<K, V> other) {
- other.forEach((K key, V value) {
- int offset = _hashTable._put(key);
- _hashTable._setValue(offset, value);
- _hashTable._checkCapacity();
- });
+ /* patch */ bool containsValue(Object value) {
+ var cursor = _nextEntry;
+ int modificationCount = _modificationCount;
+ while (!identical(cursor, this)) {
+ _HashMapEntry entry = cursor;
+ if (entry.value == value) return true;
+ cursor = cursor._nextEntry;
+ }
+ return false;
}
- /* patch */ V operator [](Object key) {
- int offset = _hashTable._get(key);
- if (offset >= 0) return _hashTable._value(offset);
+ /* patch */ V operator[](Object key) {
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int index = hashCode & (buckets.length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) {
+ return entry.value;
+ }
+ entry = entry.next;
+ }
return null;
}
/* patch */ void operator []=(K key, V value) {
- int offset = _hashTable._put(key);
- _hashTable._setValue(offset, value);
- _hashTable._checkCapacity();
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int length = buckets.length;
+ int index = hashCode & (length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) {
+ entry.value = value;
+ return;
+ }
+ entry = entry.next;
+ }
+ _addEntry(buckets, index, length, key, value, hashCode);
}
/* patch */ V putIfAbsent(K key, V ifAbsent()) {
- int offset = _hashTable._probeForAdd(_hashTable._hashCodeOf(key), key);
- Object entry = _hashTable._table[offset];
- if (!_hashTable._isFree(entry)) {
- return _hashTable._value(offset);
- }
- int modificationCount = _hashTable._modificationCount;
- V value = ifAbsent();
- if (modificationCount == _hashTable._modificationCount) {
- _hashTable._setKey(offset, key);
- _hashTable._setValue(offset, value);
- _hashTable._linkLast(offset);
- if (entry == null) {
- _hashTable._entryCount++;
- _hashTable._checkCapacity();
- } else {
- assert(identical(entry, _TOMBSTONE));
- _hashTable._deletedCount--;
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int length = buckets.length;
+ int index = hashCode & (length - 1);
+ _HashMapEntry entry = buckets[index];
+ while (entry != null) {
+ if (hashCode == entry.hashCode && entry.key == key) {
+ return entry.value;
}
- _hashTable._recordModification();
+ entry = entry.next;
+ }
+ int stamp = _modificationCount;
+ V value = ifAbsent();
+ if (stamp == _modificationCount) {
+ _addEntry(buckets, index, length, key, value, hashCode);
} else {
- // The table might have changed, so we can't trust [offset] any more.
- // Do another lookup before setting the value.
- offset = _hashTable._put(key);
- _hashTable._setValue(offset, value);
- _hashTable._checkCapacity();
+ this[key] = value;
}
return value;
}
- /* patch */ V remove(Object key) {
- int offset = _hashTable._remove(key);
- if (offset < 0) return null;
- Object oldValue = _hashTable._value(offset);
- _hashTable._setValue(offset, null);
- _hashTable._checkCapacity();
- return oldValue;
+ /* patch */ void addAll(Map<K, V> other) {
+ other.forEach((K key, V value) {
+ this[key] = value;
+ });
}
- /* patch */ void clear() {
- _hashTable._clear();
- }
-
- /* patch */ void forEach(void action (K key, V value)) {
- int modificationCount = _hashTable._modificationCount;
- for (int offset = _hashTable._next(_LinkedHashTable._HEAD_OFFSET);
- offset != _LinkedHashTable._HEAD_OFFSET;
- offset = _hashTable._next(offset)) {
- action(_hashTable._key(offset), _hashTable._value(offset));
- _hashTable._checkModification(modificationCount);
+ /* patch */ void forEach(void action(K key, V value)) {
+ int stamp = _modificationCount;
+ var cursor = _nextEntry;
+ while (!identical(cursor, this)) {
+ _HashMapEntry entry = cursor;
+ action(entry.key, entry.value);
+ if (stamp != _modificationCount) {
+ throw new ConcurrentModificationError(this);
+ }
+ cursor = cursor._nextEntry;
}
}
- /* patch */ Iterable<K> get keys =>
- new _LinkedHashTableKeyIterable<K>(_hashTable);
+ /* patch */ V remove(Object key) {
+ int hashCode = key.hashCode;
+ List buckets = _buckets;
+ int index = hashCode & (buckets.length - 1);
+ _LinkedHashMapEntry entry = buckets[index];
+ _HashMapEntry previous = null;
+ while (entry != null) {
+ _HashMapEntry next = entry.next;
+ if (hashCode == entry.hashCode && entry.key == key) {
+ if (previous == null) {
+ buckets[index] = next;
+ } else {
+ previous.next = next;
+ }
+ entry._previousEntry._nextEntry = entry._nextEntry;
+ entry._nextEntry._previousEntry = entry._previousEntry;
+ entry._nextEntry = entry._previousEntry = null;
+ _elementCount--;
+ _modificationCount =
+ (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+ return entry.value;
+ }
+ previous = entry;
+ entry = next;
+ }
+ return null;
+ }
- /* patch */ Iterable<V> get values =>
- new _LinkedHashTableValueIterable<V>(_hashTable,
- _LinkedHashMapTable._VALUE_INDEX);
+ /* patch */ void clear() {
+ _elementCount = 0;
+ _nextEntry = _previousEntry = this;
+ _buckets = new List(_INITIAL_CAPACITY);
+ _modificationCount = (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+ }
- /* patch */ int get length => _hashTable._elementCount;
+ void _addEntry(List buckets, int index, int length,
+ K key, V value, int hashCode) {
+ _HashMapEntry entry =
+ new _LinkedHashMapEntry(key, value, hashCode, buckets[index],
+ _previousEntry, this);
+ buckets[index] = entry;
+ int newElements = _elementCount + 1;
+ _elementCount = newElements;
+ // If we end up with more than 75% non-empty entries, we
+ // resize the backing store.
+ if ((newElements << 2) > ((length << 1) + length)) _resize();
+ _modificationCount = (_modificationCount + 1) & _MODIFICATION_COUNT_MASK;
+ }
- /* patch */ bool get isEmpty => _hashTable._elementCount == 0;
-
- /* patch */ bool get isNotEmpty => !isEmpty;
+ void _resize() {
+ List oldBuckets = _buckets;
+ int oldLength = oldBuckets.length;
+ int newLength = oldLength << 1;
+ List newBuckets = new List(newLength);
+ for (int i = 0; i < oldLength; i++) {
+ _HashMapEntry entry = oldBuckets[i];
+ while (entry != null) {
+ _HashMapEntry next = entry.next;
+ int hashCode = entry.hashCode;
+ int index = hashCode & (newLength - 1);
+ entry.next = newBuckets[index];
+ newBuckets[index] = entry;
+ entry = next;
+ }
+ }
+ _buckets = newBuckets;
+ }
}
patch class LinkedHashSet<E> extends _HashSetBase<E> {
diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart
index f841240..a1818db 100644
--- a/runtime/lib/errors_patch.dart
+++ b/runtime/lib/errors_patch.dart
@@ -148,13 +148,13 @@
} else {
positionalArguments = arguments.sublist(0, numPositionalArguments);
}
- Map<String, dynamic> namedArguments = new Map<String, dynamic>();
+ Map<Symbol, dynamic> namedArguments = new Map<Symbol, dynamic>();
for (int i = 0; i < numNamedArguments; i++) {
var arg_value = arguments[numPositionalArguments + i];
- namedArguments[argumentNames[i]] = arg_value;
+ namedArguments[new Symbol(argumentNames[i])] = arg_value;
}
throw new NoSuchMethodError._withType(receiver,
- memberName,
+ new Symbol(memberName),
invocation_type,
positionalArguments,
namedArguments,
@@ -167,20 +167,31 @@
final int _invocation_type;
NoSuchMethodError(Object this._receiver,
- String this._memberName,
+ Symbol this._memberName,
List this._arguments,
- Map<String,dynamic> this._namedArguments,
+ Map<Symbol, dynamic> this._namedArguments,
[List existingArgumentNames = null])
: this._existingArgumentNames = existingArgumentNames,
this._invocation_type = -1;
+ // This constructor seems to be called with either strings or
+ // values read from another NoSuchMethodError.
NoSuchMethodError._withType(Object this._receiver,
- String this._memberName,
+ /*String|Symbol*/ memberName,
this._invocation_type,
List this._arguments,
- Map<String,dynamic> this._namedArguments,
+ Map<dynamic, dynamic> namedArguments,
[List existingArgumentNames = null])
- : this._existingArgumentNames = existingArgumentNames;
+ : this._memberName =
+ (memberName is String) ? new Symbol(memberName) : memberName,
+ this._namedArguments =
+ (namedArguments == null)
+ ? null
+ : new Map<Symbol, dynamic>.fromIterable(
+ namedArguments.keys,
+ key: (k) => (k is String) ? new Symbol(k) : k,
+ value: (k) => namedArguments[k]),
+ this._existingArgumentNames = existingArgumentNames;
String _developerMessage(args_mismatch) {
@@ -194,33 +205,35 @@
(const ["method", "getter", "setter", "getter or setter"])[type];
var args_message = args_mismatch ? " with matching arguments" : "";
var msg;
+ var memberName =
+ (_memberName == null) ? "" :_collection_dev.Symbol.getName(_memberName);
switch (level) {
case _InvocationMirror._DYNAMIC: {
if (_receiver == null) {
- msg = "The null object does not have a $type_str '$_memberName'"
+ msg = "The null object does not have a $type_str '$memberName'"
"$args_message.";
} else {
if (_receiver is Function) {
msg = "Closure call with mismatched arguments: "
- "function '$_memberName'";
+ "function '$memberName'";
} else {
msg = "Class '${_receiver.runtimeType}' has no instance $type_str "
- "'$_memberName'$args_message.";
+ "'$memberName'$args_message.";
}
}
break;
}
case _InvocationMirror._STATIC: {
- msg = "No static $type_str '$_memberName' declared in class "
+ msg = "No static $type_str '$memberName' declared in class "
"'$_receiver'.";
break;
}
case _InvocationMirror._CONSTRUCTOR: {
- msg = "No constructor '$_memberName' declared in class '$_receiver'.";
+ msg = "No constructor '$memberName' declared in class '$_receiver'.";
break;
}
case _InvocationMirror._TOP_LEVEL: {
- msg = "No top-level $type_str '$_memberName'$args_message declared.";
+ msg = "No top-level $type_str '$memberName'$args_message declared.";
break;
}
}
@@ -244,11 +257,11 @@
}
}
if (_namedArguments != null) {
- _namedArguments.forEach((String key, var value) {
+ _namedArguments.forEach((Symbol key, var value) {
if (i > 0) {
actual_buf.write(", ");
}
- actual_buf.write(key);
+ actual_buf.write(_collection_dev.Symbol.getName(key));
actual_buf.write(": ");
actual_buf.write(Error.safeToString(value));
i++;
@@ -264,9 +277,11 @@
} else {
receiver_str = Error.safeToString(_receiver);
}
+ var memberName =
+ (_memberName == null) ? "" :_collection_dev.Symbol.getName(_memberName);
if (!args_mismatch) {
msg_buf.write(
- "NoSuchMethodError : method not found: '$_memberName'\n"
+ "NoSuchMethodError : method not found: '$memberName'\n"
"Receiver: $receiver_str\n"
"Arguments: [$actual_buf]");
} else {
@@ -281,10 +296,10 @@
String formalParameters = formal_buf.toString();
msg_buf.write(
"NoSuchMethodError: incorrect number of arguments passed to "
- "method named '$_memberName'\n"
+ "method named '$memberName'\n"
"Receiver: $receiver_str\n"
- "Tried calling: $_memberName($actualParameters)\n"
- "Found: $_memberName($formalParameters)");
+ "Tried calling: $memberName($actualParameters)\n"
+ "Found: $memberName($formalParameters)");
}
return msg_buf.toString();
}
diff --git a/runtime/lib/integers.cc b/runtime/lib/integers.cc
index 4962ac9..5be23af 100644
--- a/runtime/lib/integers.cc
+++ b/runtime/lib/integers.cc
@@ -216,9 +216,6 @@
return Integer::New(temp);
}
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, value);
- Exceptions::ThrowByType(Exceptions::kFormat, args);
return Object::null();
}
diff --git a/runtime/lib/integers_patch.dart b/runtime/lib/integers_patch.dart
index fb749d7..fab603f 100644
--- a/runtime/lib/integers_patch.dart
+++ b/runtime/lib/integers_patch.dart
@@ -74,20 +74,21 @@
/* patch */ static int parse(String source,
{ int radix,
int onError(String str) }) {
- if ((radix == null) && (onError == null)) return _parse(source);
+ if (radix == null) {
+ int result = _parse(source);
+ if (result == null) {
+ if (onError == null) {
+ throw new FormatException(source);
+ }
+ return onError(source);
+ }
+ return result;
+ }
return _slowParse(source, radix, onError);
}
static int _slowParse(String source, int radix, int onError(String str)) {
if (source is! String) throw new ArgumentError(source);
- if (radix == null) {
- assert(onError != null);
- try {
- return _parse(source);
- } on FormatException {
- return onError(source);
- }
- }
if (radix is! int) throw new ArgumentError("Radix is not an integer");
if (radix < 2 || radix > 36) {
throw new RangeError("Radix $radix not in range 2..36");
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index e897ab5..17f4e94 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -238,7 +238,7 @@
args.SetAt(4, Bool::Get(func.is_abstract()));
args.SetAt(5, Bool::Get(func.IsGetterFunction()));
args.SetAt(6, Bool::Get(func.IsSetterFunction()));
- args.SetAt(7, Bool::Get(func.IsConstructor()));
+ args.SetAt(7, Bool::Get(func.kind() == RawFunction::kConstructor));
// TODO(mlippautz): Implement different constructor kinds.
args.SetAt(8, Bool::False());
args.SetAt(9, Bool::False());
@@ -299,12 +299,25 @@
}
const Bool& is_generic = Bool::Get(cls.NumTypeParameters() != 0);
+ const Bool& is_mixin_typedef = Bool::Get(cls.is_mixin_typedef());
- const Array& args = Array::Handle(Array::New(4));
+ // If the class is not generic, the mirror must have a non-null runtime type.
+ // If the class is generic, the mirror will have a null runtime type if it
+ // represents the declaration or a non-null runtime type if it represents an
+ // instantiation.
+ ASSERT(!(cls.NumTypeParameters() == 0) || !type.IsNull());
+
+ const Array& args = Array::Handle(Array::New(5));
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
args.SetAt(1, type);
- args.SetAt(2, String::Handle(cls.UserVisibleName()));
+ // We do not set the names of anonymous mixin applications because the mirrors
+ // use a different naming convention than the VM (lib.S with lib.M and S&M
+ // respectively).
+ if ((cls.mixin() == Type::null()) || cls.is_mixin_typedef()) {
+ args.SetAt(2, String::Handle(cls.UserVisibleName()));
+ }
args.SetAt(3, is_generic);
+ args.SetAt(4, is_mixin_typedef);
return CreateMirror(Symbols::_LocalClassMirrorImpl(), args);
}
@@ -512,11 +525,7 @@
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
const Class& klass = Class::Handle(ref.GetClassReferent());
const Library& library = Library::Handle(klass.library());
- // TODO(rmacnak): Revisit when we decide what to do about
- // reflectClass(dynamic).
- if (library.IsNull()) {
- return Instance::null();
- }
+ ASSERT(!library.IsNull());
return CreateLibraryMirror(library);
}
@@ -541,6 +550,13 @@
}
+DEFINE_NATIVE_ENTRY(ClassMirror_mixin, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
+ const Class& klass = Class::Handle(ref.GetClassReferent());
+ return klass.mixin();
+}
+
+
DEFINE_NATIVE_ENTRY(ClassMirror_members, 2) {
GET_NON_NULL_NATIVE_ARGUMENT(Instance,
owner_mirror,
@@ -632,6 +648,8 @@
Object& entry = Object::Handle();
DictionaryIterator entries(library);
+ AbstractType& type = AbstractType::Handle();
+
while (entries.HasNext()) {
entry = entries.GetNext();
if (entry.IsClass()) {
@@ -641,9 +659,13 @@
if (!klass.IsCanonicalSignatureClass() &&
!klass.IsDynamicClass() &&
!RawObject::IsImplementationClassId(klass.id())) {
- member_mirror = CreateClassMirror(klass,
- AbstractType::Handle(),
- owner_mirror);
+ if (klass.NumTypeParameters() == 0) {
+ // Include runtime type for non-generics only.
+ type = RawTypeOfClass(klass);
+ } else {
+ type = AbstractType::null();
+ }
+ member_mirror = CreateClassMirror(klass, type, owner_mirror);
member_mirrors.Add(member_mirror);
}
} else if (entry.IsField()) {
@@ -713,7 +735,11 @@
DEFINE_NATIVE_ENTRY(TypeVariableMirror_owner, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0));
- return CreateClassMirror(Class::Handle(param.parameterized_class()),
+ const Class& owner = Class::Handle(param.parameterized_class());
+ // The owner of a type variable must be a generic class: pass a null runtime
+ // type to get a mirror on the declaration.
+ ASSERT(owner.NumTypeParameters() != 0);
+ return CreateClassMirror(owner,
AbstractType::Handle(),
Instance::null_instance());
}
@@ -1278,9 +1304,13 @@
if (owner.IsTopLevel()) {
return CreateLibraryMirror(Library::Handle(owner.library()));
}
- return CreateClassMirror(owner,
- AbstractType::Handle(),
- Object::null_instance());
+
+ AbstractType& type = AbstractType::Handle();
+ if (owner.NumTypeParameters() == 0) {
+ // Include runtime type for non-generics only.
+ type = RawTypeOfClass(owner);
+ }
+ return CreateClassMirror(owner, type, Object::null_instance());
}
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 4d211ec..ddf05f0 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -283,6 +283,7 @@
identical(_reflectee, other._reflectee);
}
+ // TODO(12909): Use the reflectee's identity hash.
int get hashCode => _reflectee.hashCode;
_invoke(reflectee, functionName, positionalArguments)
@@ -362,12 +363,14 @@
_LocalClassMirrorImpl(reflectee,
this._reflectedType,
String simpleName,
- this._isGeneric)
+ this._isGeneric,
+ this._isMixinTypedef)
: this._simpleName = _s(simpleName),
super(reflectee);
final Type _reflectedType;
final bool _isGeneric;
+ final bool _isMixinTypedef;
bool get hasReflectedType => _reflectedType != null;
Type get reflectedType {
@@ -383,7 +386,12 @@
// dynamic, void and the function types have their names set eagerly in the
// constructor.
if(_simpleName == null) {
- _simpleName = _s(_name(_reflectee));
+ var simpleString = _name(_reflectee);
+ if (simpleString.contains('&')) {
+ _simpleName = this._mixinApplicationName;
+ } else {
+ _simpleName = _s(simpleString);
+ }
}
return _simpleName;
}
@@ -418,33 +426,68 @@
bool get isClass => true;
ClassMirror get defaultFactory => null;
- ClassMirror _superclass;
- ClassMirror get superclass {
- if (_superclass == null) {
+ ClassMirror _trueSuperclassField;
+ ClassMirror get _trueSuperclass {
+ if (_trueSuperclassField == null) {
Type supertype = _supertype(_reflectee);
if (supertype == null) {
// Object has no superclass.
return null;
}
- _superclass = _Mirrors._reflectType(supertype);
+ _trueSuperclassField = _Mirrors._reflectType(supertype);
}
- return _superclass;
+ return _trueSuperclassField;
+ }
+ ClassMirror get superclass {
+ return _isMixinTypedef ? _trueSuperclass._trueSuperclass : _trueSuperclass;
}
var _superinterfaces;
List<ClassMirror> get superinterfaces {
if (_superinterfaces == null) {
_superinterfaces = _interfaces(_reflectee)
- .map((i) => reflectClass(i)).toList(growable:false);
+ .map((i) => _Mirrors._reflectType(i)).toList(growable:false);
}
return _superinterfaces;
}
+ get _mixinApplicationName {
+ var mixins = new List<ClassMirror>();
+ var klass = this;
+ while (_computeMixin(klass._reflectee) != null) {
+ mixins.add(klass.mixin);
+ klass = klass.superclass;
+ }
+ return _s(
+ _n(klass.qualifiedName)
+ + ' with '
+ + mixins.reversed.map((m)=>_n(m.qualifiedName)).join(', '));
+ }
+
+ var _mixin;
+ ClassMirror get mixin {
+ if (_mixin == null) {
+ if (_isMixinTypedef) {
+ _mixin = _trueSuperclass.mixin;
+ } else {
+ var mixinType = _computeMixin(_reflectee);
+ if (mixinType == null) {
+ // The reflectee is not a mixin application.
+ _mixin = this;
+ } else {
+ _mixin = _Mirrors._reflectType(mixinType);
+ }
+ }
+ }
+ return _mixin;
+ }
+
Map<Symbol, Mirror> _members;
Map<Symbol, Mirror> get members {
if (_members == null) {
- _members = _makeMemberMap(_computeMembers(_reflectee));
+ var whoseMembers = _isMixinTypedef ? _trueSuperclass : this;
+ _members = _makeMemberMap(mixin._computeMembers(whoseMembers._reflectee));
}
return _members;
}
@@ -494,9 +537,12 @@
Map<Symbol, MethodMirror> get constructors {
if (_constructors == null) {
- _constructors = _makeMemberMap(_computeConstructors(_reflectee));
- }
- return _constructors;
+ var constructorsList = _computeConstructors(_reflectee);
+ var stringName = _n(simpleName);
+ constructorsList.forEach((c) => c._patchConstructorName(stringName));
+ _constructors = _makeMemberMap(constructorsList);
+ }
+ return _constructors;
}
Map<Symbol, TypeVariableMirror> _typeVariables = null;
@@ -584,8 +630,7 @@
bool operator ==(other) {
return this.runtimeType == other.runtimeType &&
this._reflectee == other._reflectee &&
- (isOriginalDeclaration ||
- this._reflectedType == other._reflectedType);
+ this._reflectedType == other._reflectedType;
}
int get hashCode => simpleName.hashCode;
@@ -602,6 +647,9 @@
static _interfaces(reflectee)
native "ClassMirror_interfaces";
+ static _computeMixin(reflectee)
+ native "ClassMirror_mixin";
+
_computeMembers(reflectee)
native "ClassMirror_members";
@@ -630,7 +678,7 @@
class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
implements FunctionTypeMirror {
_LocalFunctionTypeMirrorImpl(reflectee, reflectedType)
- : super(reflectee, reflectedType, null, false);
+ : super(reflectee, reflectedType, null, false, false);
// FunctionTypeMirrors have a simpleName generated from their signature.
Symbol _simpleName = null;
@@ -684,11 +732,12 @@
abstract class _LocalDeclarationMirrorImpl extends _LocalMirrorImpl
implements DeclarationMirror {
- _LocalDeclarationMirrorImpl(this._reflectee, this.simpleName);
+ _LocalDeclarationMirrorImpl(this._reflectee, this._simpleName);
final _reflectee;
- final Symbol simpleName;
+ Symbol _simpleName;
+ Symbol get simpleName => _simpleName;
Symbol _qualifiedName = null;
Symbol get qualifiedName {
@@ -1025,6 +1074,15 @@
return _source;
}
+ void _patchConstructorName(ownerName) {
+ var cn = _n(constructorName);
+ if(cn == ''){
+ _simpleName = _s(ownerName);
+ } else {
+ _simpleName = _s(ownerName + "." + cn);
+ }
+ }
+
String toString() => "MethodMirror on '${_n(simpleName)}'";
static dynamic _MethodMirror_owner(reflectee)
diff --git a/runtime/lib/regexp_patch.dart b/runtime/lib/regexp_patch.dart
index 72b6f4b..909b801 100644
--- a/runtime/lib/regexp_patch.dart
+++ b/runtime/lib/regexp_patch.dart
@@ -3,17 +3,17 @@
// BSD-style license that can be found in the LICENSE file.
patch class RegExp {
- /* patch */ factory RegExp(String pattern,
+ /* patch */ factory RegExp(String source,
{bool multiLine: false,
bool caseSensitive: true}) {
- return new _JSSyntaxRegExp(pattern,
+ return new _JSSyntaxRegExp(source,
multiLine: multiLine,
caseSensitive: caseSensitive);
}
}
class _JSRegExpMatch implements Match {
- _JSRegExpMatch(this._regexp, this.str, this._match);
+ _JSRegExpMatch(this._regexp, this.input, this._match);
int get start => _start(0);
int get end => _end(0);
@@ -36,7 +36,7 @@
assert(endIndex == -1);
return null;
}
- return str._substringUnchecked(startIndex, endIndex);
+ return input._substringUnchecked(startIndex, endIndex);
}
String operator [](int groupIdx) {
@@ -55,8 +55,11 @@
Pattern get pattern => _regexp;
+ // TODO(12843): Remove when grace period is over.
+ String get str => input;
+
final RegExp _regexp;
- final String str;
+ final String input;
final List<int> _match;
static const int _MATCH_PAIR = 2;
}
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 2d40f2d..b9ec3c9 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -600,7 +600,7 @@
class _StringMatch implements Match {
const _StringMatch(int this.start,
- String this.str,
+ String this.input,
String this.pattern);
int get end => start + pattern.length;
@@ -622,8 +622,11 @@
return result;
}
+ // TODO(12843): Remove when grace period is over.
+ String get str => input;
+
final int start;
- final String str;
+ final String input;
final String pattern;
}
diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart
index e60c145..006918c 100644
--- a/runtime/lib/typed_data.dart
+++ b/runtime/lib/typed_data.dart
@@ -432,16 +432,6 @@
"Cannot remove from a non-extendable array");
}
- void removeAll(Iterable elements) {
- throw new UnsupportedError(
- "Cannot remove from a non-extendable array");
- }
-
- void retainAll(Iterable elements) {
- throw new UnsupportedError(
- "Cannot remove from a non-extendable array");
- }
-
void removeWhere(bool test(element)) {
throw new UnsupportedError(
"Cannot remove from a non-extendable array");
diff --git a/runtime/third_party/double-conversion/src/bignum.cc b/runtime/third_party/double-conversion/src/bignum.cc
index 747491a..d2c8aa9 100644
--- a/runtime/third_party/double-conversion/src/bignum.cc
+++ b/runtime/third_party/double-conversion/src/bignum.cc
@@ -755,7 +755,6 @@
Chunk difference = bigits_[i] - borrow;
bigits_[i] = difference & kBigitMask;
borrow = difference >> (kChunkSize - 1);
- ++i;
}
Clamp();
}
diff --git a/runtime/vm/assembler_arm.cc b/runtime/vm/assembler_arm.cc
index 7752441..30b6123 100644
--- a/runtime/vm/assembler_arm.cc
+++ b/runtime/vm/assembler_arm.cc
@@ -2532,8 +2532,9 @@
}
-void Assembler::CallRuntime(const RuntimeEntry& entry) {
- entry.Call(this);
+void Assembler::CallRuntime(const RuntimeEntry& entry,
+ intptr_t argument_count) {
+ entry.Call(this, argument_count);
}
diff --git a/runtime/vm/assembler_arm.h b/runtime/vm/assembler_arm.h
index 8449603..f8917f4 100644
--- a/runtime/vm/assembler_arm.h
+++ b/runtime/vm/assembler_arm.h
@@ -699,7 +699,7 @@
void EnterCallRuntimeFrame(intptr_t frame_space);
void LeaveCallRuntimeFrame();
- void CallRuntime(const RuntimeEntry& entry);
+ void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count);
// Set up a Dart frame on entry with a frame pointer and PC information to
// enable easy access to the RawInstruction object of code corresponding
diff --git a/runtime/vm/assembler_ia32.cc b/runtime/vm/assembler_ia32.cc
index a1dfc13..0ac2354 100644
--- a/runtime/vm/assembler_ia32.cc
+++ b/runtime/vm/assembler_ia32.cc
@@ -2200,8 +2200,9 @@
}
-void Assembler::CallRuntime(const RuntimeEntry& entry) {
- entry.Call(this);
+void Assembler::CallRuntime(const RuntimeEntry& entry,
+ intptr_t argument_count) {
+ entry.Call(this, argument_count);
}
diff --git a/runtime/vm/assembler_ia32.h b/runtime/vm/assembler_ia32.h
index d0972ea..4ddd90e 100644
--- a/runtime/vm/assembler_ia32.h
+++ b/runtime/vm/assembler_ia32.h
@@ -670,7 +670,7 @@
void EnterCallRuntimeFrame(intptr_t frame_space);
void LeaveCallRuntimeFrame();
- void CallRuntime(const RuntimeEntry& entry);
+ void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count);
/*
* Loading and comparing classes of objects.
diff --git a/runtime/vm/assembler_mips.cc b/runtime/vm/assembler_mips.cc
index bb4a2c3..33ede4c 100644
--- a/runtime/vm/assembler_mips.cc
+++ b/runtime/vm/assembler_mips.cc
@@ -729,8 +729,9 @@
}
-void Assembler::CallRuntime(const RuntimeEntry& entry) {
- entry.Call(this);
+void Assembler::CallRuntime(const RuntimeEntry& entry,
+ intptr_t argument_count) {
+ entry.Call(this, argument_count);
}
diff --git a/runtime/vm/assembler_mips.h b/runtime/vm/assembler_mips.h
index d7e96c4..15c02d8 100644
--- a/runtime/vm/assembler_mips.h
+++ b/runtime/vm/assembler_mips.h
@@ -1080,7 +1080,7 @@
const Address& dest,
const Object& value);
- void CallRuntime(const RuntimeEntry& entry);
+ void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count);
// Set up a Dart frame on entry with a frame pointer and PC information to
// enable easy access to the RawInstruction object of code corresponding
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc
index 38fad31..0434aef 100644
--- a/runtime/vm/assembler_x64.cc
+++ b/runtime/vm/assembler_x64.cc
@@ -2372,8 +2372,9 @@
}
-void Assembler::CallRuntime(const RuntimeEntry& entry) {
- entry.Call(this);
+void Assembler::CallRuntime(const RuntimeEntry& entry,
+ intptr_t argument_count) {
+ entry.Call(this, argument_count);
}
diff --git a/runtime/vm/assembler_x64.h b/runtime/vm/assembler_x64.h
index fd0d70b..f4c945f 100644
--- a/runtime/vm/assembler_x64.h
+++ b/runtime/vm/assembler_x64.h
@@ -689,7 +689,7 @@
void LeaveCallRuntimeFrame();
- void CallRuntime(const RuntimeEntry& entry);
+ void CallRuntime(const RuntimeEntry& entry, intptr_t argument_count);
/*
* Loading and comparing classes of objects.
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index babc9a9..4b40760 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -214,12 +214,11 @@
intptr_t length() const { return nodes_.length(); }
AstNode* NodeAt(intptr_t index) const { return nodes_[index]; }
void SetNodeAt(intptr_t index, AstNode* node) { nodes_[index] = node; }
- const Array& names() const {
- return names_;
- }
+ const Array& names() const { return names_; }
void set_names(const Array& names) {
names_ = names.raw();
}
+ const GrowableArray<AstNode*>& nodes() const { return nodes_; }
DECLARE_COMMON_NODE_FUNCTIONS(ArgumentListNode);
@@ -1604,14 +1603,16 @@
const LocalVariable* context_var,
const LocalVariable* exception_var,
const LocalVariable* stacktrace_var,
- intptr_t catch_handler_index)
+ intptr_t catch_handler_index,
+ bool needs_stacktrace)
: AstNode(token_pos),
catch_block_(catch_block),
handler_types_(handler_types),
context_var_(*context_var),
exception_var_(*exception_var),
stacktrace_var_(*stacktrace_var),
- catch_handler_index_(catch_handler_index) {
+ catch_handler_index_(catch_handler_index),
+ needs_stacktrace_(needs_stacktrace) {
ASSERT(catch_block_ != NULL);
ASSERT(handler_types.IsZoneHandle());
ASSERT(context_var != NULL);
@@ -1624,6 +1625,7 @@
const LocalVariable& exception_var() const { return exception_var_; }
const LocalVariable& stacktrace_var() const { return stacktrace_var_; }
intptr_t catch_handler_index() const { return catch_handler_index_; }
+ bool needs_stacktrace() const { return needs_stacktrace_; }
virtual void VisitChildren(AstNodeVisitor* visitor) const {
catch_block_->Visit(visitor);
@@ -1638,6 +1640,7 @@
const LocalVariable& exception_var_;
const LocalVariable& stacktrace_var_;
const intptr_t catch_handler_index_;
+ const bool needs_stacktrace_;
DISALLOW_COPY_AND_ASSIGN(CatchClauseNode);
};
diff --git a/runtime/vm/bigint_operations.cc b/runtime/vm/bigint_operations.cc
index 709baa2..fc54442 100644
--- a/runtime/vm/bigint_operations.cc
+++ b/runtime/vm/bigint_operations.cc
@@ -152,6 +152,7 @@
RawBigint* BigintOperations::FromDecimalCString(const char* str,
Heap::Space space) {
+ Isolate* isolate = Isolate::Current();
// Read 8 digits a time. 10^8 < 2^27.
const int kDigitsPerIteration = 8;
const Chunk kTenMultiplier = 100000000;
@@ -178,6 +179,7 @@
// 'increment' to the new result.
const Bigint& increment = Bigint::Handle(Bigint::Allocate(1));
while (str_pos < str_length - 1) {
+ HANDLESCOPE(isolate);
Chunk digit = 0;
for (intptr_t i = 0; i < kDigitsPerIteration; i++) {
char c = str[str_pos++];
@@ -329,10 +331,10 @@
(kIntptrMax - 10) / kLog2Dividend / kDigitBitSize * kLog2Divisor;
intptr_t length = bigint.Length();
+ Isolate* isolate = Isolate::Current();
if (length >= kMaxAllowedDigitLength) {
// Use the preallocated out of memory exception to avoid calling
// into dart code or allocating any code.
- Isolate* isolate = Isolate::Current();
const Instance& exception =
Instance::Handle(isolate->object_store()->out_of_memory());
Exceptions::Throw(exception);
@@ -370,6 +372,7 @@
Bigint& quotient = Bigint::Handle();
Bigint& remainder = Bigint::Handle();
while (!rest.IsZero()) {
+ HANDLESCOPE(isolate);
DivideRemainder(rest, divisor, "ient, &remainder);
ASSERT(remainder.Length() <= 1);
intptr_t part = (remainder.Length() == 1)
@@ -718,32 +721,55 @@
// 1000 * (a2b1 + a1b2) +
// 10000 * a2b2
//
- // Each column will be accumulated in an integer of type DoubleChunk. We
- // must guarantee that the column-sum will not overflow.
+ // Each column will be accumulated in an integer of type DoubleChunk. We must
+ // guarantee that the column-sum will not overflow. We achieve this by
+ // 'blocking' the sum into overflow-free sums followed by propagating the
+ // overflow.
//
- // In the worst case we have to accumulate k = Min(a.length, b.length)
- // products plus the carry from the previous round.
- // Each bigint-digit is smaller than beta = 2^kDigitBitSize.
- // Each product is at most (beta - 1)^2.
- // If we want to use Comba multiplication the following condition must hold:
- // k * (beta - 1)^2 + (2^(kDoubleChunkBitSize - kDigitBitSize) - 1) <
- // 2^kDoubleChunkBitSize.
- const DoubleChunk square =
- static_cast<DoubleChunk>(kDigitMaxValue) * kDigitMaxValue;
- const DoubleChunk kDoubleChunkMaxValue = static_cast<DoubleChunk>(-1);
- const DoubleChunk left_over_carry = kDoubleChunkMaxValue >> kDigitBitSize;
- const intptr_t kMaxDigits = (kDoubleChunkMaxValue - left_over_carry) / square;
- if (Utils::Minimum(a_length, b_length) > kMaxDigits) {
- // Use the preallocated out of memory exception to avoid calling
- // into dart code or allocating any code.
- Isolate* isolate = Isolate::Current();
- const Instance& exception =
- Instance::Handle(isolate->object_store()->out_of_memory());
- Exceptions::Throw(exception);
- UNREACHABLE();
- }
+ // Each bigint digit fits in kDigitBitSize bits.
+ // Each product fits in 2*kDigitBitSize bits.
+ // The accumulator is 8 * sizeof(DoubleChunk) == 2*kDigitBitSize + kCarryBits.
+ //
+ // Each time we add a product to the accumulator it could carry one bit into
+ // the carry bits, supporting kBlockSize = 2^kCarryBits - 1 addition
+ // operations before the DoubleChunk overflows.
+ //
+ // At the end of the column sum and after each batch of kBlockSize additions
+ // the high kCarryBits+kDigitBitSize of accumulator are flushed to
+ // accumulator_overflow.
+ //
+ // Diagramatically, using one char per 4 bits:
+ //
+ // 0aaaaaaa * 0bbbbbbb -> 00pppppppppppppp product of 2 digits
+ // |
+ // + ...added to
+ // v
+ // ccSSSSSSSsssssss accumulator
+ // ...flushed to
+ // 000000000sssssss accumulator
+ // vvvvvvvvvVVVVVVV accumulator_overflow
+ //
+ // 'sssssss' becomes the column sum an overflow is carried to next column:
+ //
+ // 000000000VVVVVVV accumulator
+ // 0000000vvvvvvvvv accumulator_overflow
+ //
+ // accumulator_overflow supports 2^(kDigitBitSize + kCarryBits) additions of
+ // products.
+ //
+ // Since the bottom (kDigitBitSize + kCarryBits) bits of accumulator_overflow
+ // are initialized from the previous column, that uses up the capacity to
+ // absorb 2^kCarryBits additions. The accumulator_overflow can overflow if
+ // the column has more than 2^(kDigitBitSize + kCarryBits) - 2^kCarryBits
+ // elements With current configuration that is 2^36-2^8 elements. That is too
+ // high to happen in practice. Comba multiplication is O(N^2) so overflow
+ // won't happen during a human lifespan.
+
+ const intptr_t kCarryBits = 8 * sizeof(DoubleChunk) - 2 * kDigitBitSize;
+ const intptr_t kBlockSize = (1 << kCarryBits) - 1;
DoubleChunk accumulator = 0; // Accumulates the result of one column.
+ DoubleChunk accumulator_overflow = 0;
for (intptr_t i = 0; i < result_length; i++) {
// Example: r = a2a1a0 * b2b1b0.
// For i == 0, compute a0b0.
@@ -758,17 +784,29 @@
// Instead of testing for a_index >= 0 && b_index < b_length we compute the
// number of iterations first.
intptr_t iterations = Utils::Minimum(b_length - b_index, a_index + 1);
- for (intptr_t j = 0; j < iterations; j++) {
- DoubleChunk chunk_a = a.GetChunkAt(a_index);
- DoubleChunk chunk_b = b.GetChunkAt(b_index);
- accumulator += chunk_a * chunk_b;
- a_index--;
- b_index++;
+
+ // For large products we need extra bit for the overflow. The sum is broken
+ // into blocks to avoid dealing with the overflow on each iteration.
+ for (intptr_t j_block = 0; j_block < iterations; j_block += kBlockSize) {
+ intptr_t j_end = Utils::Minimum(j_block + kBlockSize, iterations);
+ for (intptr_t j = j_block; j < j_end; j++) {
+ DoubleChunk chunk_a = a.GetChunkAt(a_index);
+ DoubleChunk chunk_b = b.GetChunkAt(b_index);
+ accumulator += chunk_a * chunk_b;
+ a_index--;
+ b_index++;
+ }
+ accumulator_overflow += (accumulator >> kDigitBitSize);
+ accumulator &= kDigitMask;
}
- result.SetChunkAt(i, static_cast<Chunk>(accumulator & kDigitMask));
- accumulator >>= kDigitBitSize;
+ result.SetChunkAt(i, static_cast<Chunk>(accumulator));
+ // Overflow becomes the initial accumulator for the next column.
+ accumulator = accumulator_overflow & kDigitMask;
+ // And the overflow from the overflow becomes the new overflow.
+ accumulator_overflow = (accumulator_overflow >> kDigitBitSize);
}
ASSERT(accumulator == 0);
+ ASSERT(accumulator_overflow == 0);
Clamp(result);
return result.raw();
@@ -1537,7 +1575,9 @@
Bigint& shifted_divisor =
Bigint::Handle(DigitsShiftLeft(divisor, divisor_shift_amount));
Chunk first_quotient_digit = 0;
+ Isolate* isolate = Isolate::Current();
while (UnsignedCompare(dividend, shifted_divisor) >= 0) {
+ HANDLESCOPE(isolate);
first_quotient_digit++;
dividend = Subtract(dividend, shifted_divisor);
}
@@ -1566,6 +1606,7 @@
// dividend: 56822123, and divisor: 563 (with t == 5) is bad.
// dividend: 6822123, and divisor: 563 (with t == 5) is ok.
+ HANDLESCOPE(isolate);
// The dividend has changed. So recompute its length.
dividend_length = dividend.Length();
Chunk dividend_digit;
@@ -1611,6 +1652,7 @@
target.SetChunkAt(1, ((i - 1) < 0) ? 0 : dividend.GetChunkAt(i - 1));
target.SetChunkAt(2, dividend_digit);
do {
+ HANDLESCOPE(isolate);
quotient_digit = (quotient_digit - 1) & kDigitMask;
estimation_product = MultiplyWithDigit(short_divisor, quotient_digit);
} while (UnsignedCompareNonClamped(estimation_product, target) > 0);
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 8e01bd5..1df9edf 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -262,6 +262,7 @@
V(ClassMirror_library, 1) \
V(ClassMirror_supertype, 1) \
V(ClassMirror_interfaces, 1) \
+ V(ClassMirror_mixin, 1) \
V(ClassMirror_members, 2) \
V(ClassMirror_constructors, 2) \
V(LibraryMirror_members, 2) \
diff --git a/runtime/vm/code_descriptors.h b/runtime/vm/code_descriptors.h
index cab61ef..6337826 100644
--- a/runtime/vm/code_descriptors.h
+++ b/runtime/vm/code_descriptors.h
@@ -5,6 +5,7 @@
#ifndef VM_CODE_DESCRIPTORS_H_
#define VM_CODE_DESCRIPTORS_H_
+#include "vm/ast.h"
#include "vm/code_generator.h"
#include "vm/globals.h"
#include "vm/growable_array.h"
@@ -101,6 +102,7 @@
intptr_t outer_try_index; // Try block in which this try block is nested.
intptr_t pc_offset; // Handler PC offset value.
const Array* handler_types; // Catch clause guards.
+ bool needs_stacktrace;
};
ExceptionHandlerList() : list_() {}
@@ -114,13 +116,15 @@
data.outer_try_index = -1;
data.pc_offset = -1;
data.handler_types = NULL;
+ data.needs_stacktrace = false;
list_.Add(data);
}
void AddHandler(intptr_t try_index,
intptr_t outer_try_index,
intptr_t pc_offset,
- const Array& handler_types) {
+ const Array& handler_types,
+ bool needs_stacktrace) {
ASSERT(try_index >= 0);
while (Length() <= try_index) {
AddPlaceHolder();
@@ -129,8 +133,31 @@
list_[try_index].pc_offset = pc_offset;
ASSERT(handler_types.IsZoneHandle());
list_[try_index].handler_types = &handler_types;
+ list_[try_index].needs_stacktrace = needs_stacktrace;
}
+
+ // Called by rethrows, to mark their enclosing handlers.
+ void SetNeedsStacktrace(intptr_t try_index) {
+ // Rethrows can be generated outside a try by the compiler.
+ if (try_index == CatchClauseNode::kInvalidTryIndex) {
+ return;
+ }
+ ASSERT((0 <= try_index) && (try_index < Length()));
+ list_[try_index].needs_stacktrace = true;
+ }
+
+
+ static bool ContainsDynamic(const Array& array) {
+ for (intptr_t i = 0; i < array.Length(); i++) {
+ if (array.At(i) == Type::DynamicType()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
RawExceptionHandlers* FinalizeExceptionHandlers(uword entry_point) {
intptr_t num_handlers = Length();
const ExceptionHandlers& handlers =
@@ -138,9 +165,12 @@
for (intptr_t i = 0; i < num_handlers; i++) {
// Assert that every element in the array has been initialized.
ASSERT(list_[i].handler_types != NULL);
+ bool has_catch_all = ContainsDynamic(*list_[i].handler_types);
handlers.SetHandlerInfo(i,
list_[i].outer_try_index,
- (entry_point + list_[i].pc_offset));
+ (entry_point + list_[i].pc_offset),
+ list_[i].needs_stacktrace,
+ has_catch_all);
handlers.SetHandledTypes(i, *list_[i].handler_types);
}
return handlers.raw();
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index b80d822..9bfd2a5 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -62,8 +62,6 @@
DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) {
- ASSERT(arguments.ArgCount() ==
- kTraceFunctionEntryRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
const String& function_name = String::Handle(function.name());
const String& class_name =
@@ -74,8 +72,6 @@
DEFINE_RUNTIME_ENTRY(TraceFunctionExit, 1) {
- ASSERT(arguments.ArgCount() ==
- kTraceFunctionExitRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
const String& function_name = String::Handle(function.name());
const String& class_name =
@@ -92,7 +88,6 @@
// Arg1: array type arguments, i.e. vector of 1 type, the element type.
// Return value: newly allocated array of length arg0.
DEFINE_RUNTIME_ENTRY(AllocateArray, 2) {
- ASSERT(arguments.ArgCount() == kAllocateArrayRuntimeEntry.argument_count());
const Smi& length = Smi::CheckedHandle(arguments.ArgAt(0));
const Array& array = Array::Handle(Array::New(length.Value()));
arguments.SetReturn(array);
@@ -113,7 +108,6 @@
// Arg2: type arguments of the instantiator or kNoInstantiator.
// Return value: newly allocated object.
DEFINE_RUNTIME_ENTRY(AllocateObject, 3) {
- ASSERT(arguments.ArgCount() == kAllocateObjectRuntimeEntry.argument_count());
const Class& cls = Class::CheckedHandle(arguments.ArgAt(0));
const Instance& instance = Instance::Handle(Instance::New(cls));
arguments.SetReturn(instance);
@@ -168,8 +162,6 @@
// Return value: newly allocated object.
DEFINE_RUNTIME_ENTRY(AllocateObjectWithBoundsCheck, 3) {
ASSERT(FLAG_enable_type_checks);
- ASSERT(arguments.ArgCount() ==
- kAllocateObjectWithBoundsCheckRuntimeEntry.argument_count());
const Class& cls = Class::CheckedHandle(arguments.ArgAt(0));
const Instance& instance = Instance::Handle(Instance::New(cls));
arguments.SetReturn(instance);
@@ -219,7 +211,6 @@
// Arg1: instantiator type arguments.
// Return value: instantiated type.
DEFINE_RUNTIME_ENTRY(InstantiateType, 2) {
- ASSERT(arguments.ArgCount() == kInstantiateTypeRuntimeEntry.argument_count());
AbstractType& type = AbstractType::CheckedHandle(arguments.ArgAt(0));
const AbstractTypeArguments& instantiator =
AbstractTypeArguments::CheckedHandle(arguments.ArgAt(1));
@@ -247,8 +238,6 @@
// Arg1: instantiator type arguments.
// Return value: instantiated type arguments.
DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) {
- ASSERT(arguments.ArgCount() ==
- kInstantiateTypeArgumentsRuntimeEntry.argument_count());
AbstractTypeArguments& type_arguments =
AbstractTypeArguments::CheckedHandle(arguments.ArgAt(0));
const AbstractTypeArguments& instantiator =
@@ -273,7 +262,6 @@
// Arg1: type arguments of the closure (i.e. instantiator).
// Return value: newly allocated closure.
DEFINE_RUNTIME_ENTRY(AllocateClosure, 2) {
- ASSERT(arguments.ArgCount() == kAllocateClosureRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
ASSERT(function.IsClosureFunction() && !function.IsImplicitClosureFunction());
const AbstractTypeArguments& type_arguments =
@@ -295,8 +283,6 @@
// Arg2: type arguments of the closure.
// Return value: newly allocated closure.
DEFINE_RUNTIME_ENTRY(AllocateImplicitInstanceClosure, 3) {
- ASSERT(arguments.ArgCount() ==
- kAllocateImplicitInstanceClosureRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
ASSERT(function.IsImplicitInstanceClosureFunction());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(1));
@@ -316,7 +302,6 @@
// Arg0: number of variables.
// Return value: newly allocated context.
DEFINE_RUNTIME_ENTRY(AllocateContext, 1) {
- ASSERT(arguments.ArgCount() == kAllocateContextRuntimeEntry.argument_count());
const Smi& num_variables = Smi::CheckedHandle(arguments.ArgAt(0));
arguments.SetReturn(Context::Handle(Context::New(num_variables.Value())));
}
@@ -327,7 +312,6 @@
// Arg0: the context to be cloned.
// Return value: newly allocated context.
DEFINE_RUNTIME_ENTRY(CloneContext, 1) {
- ASSERT(arguments.ArgCount() == kCloneContextRuntimeEntry.argument_count());
const Context& ctx = Context::CheckedHandle(arguments.ArgAt(0));
Context& cloned_ctx = Context::Handle(Context::New(ctx.num_variables()));
cloned_ctx.set_parent(Context::Handle(ctx.parent()));
@@ -554,7 +538,6 @@
// Arg4: SubtypeTestCache.
// Return value: true or false, or may throw a type error in checked mode.
DEFINE_RUNTIME_ENTRY(Instanceof, 5) {
- ASSERT(arguments.ArgCount() == kInstanceofRuntimeEntry.argument_count());
const Instance& instance = Instance::CheckedHandle(arguments.ArgAt(0));
const AbstractType& type = AbstractType::CheckedHandle(arguments.ArgAt(1));
const Instance& instantiator = Instance::CheckedHandle(arguments.ArgAt(2));
@@ -598,7 +581,6 @@
// Arg5: SubtypeTestCache.
// Return value: instance if a subtype, otherwise throw a TypeError.
DEFINE_RUNTIME_ENTRY(TypeCheck, 6) {
- ASSERT(arguments.ArgCount() == kTypeCheckRuntimeEntry.argument_count());
const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0));
const AbstractType& dst_type =
AbstractType::CheckedHandle(arguments.ArgAt(1));
@@ -658,8 +640,6 @@
// Arg0: bad object.
// Return value: none, throws a TypeError.
DEFINE_RUNTIME_ENTRY(ConditionTypeError, 1) {
- ASSERT(arguments.ArgCount() ==
- kConditionTypeErrorRuntimeEntry.argument_count());
const intptr_t location = GetCallerLocation();
const Instance& src_instance = Instance::CheckedHandle(arguments.ArgAt(0));
ASSERT(src_instance.IsNull() || !src_instance.IsBool());
@@ -682,8 +662,6 @@
// Arg2: malformed type error message.
// Return value: none, throws an exception.
DEFINE_RUNTIME_ENTRY(MalformedTypeError, 3) {
- ASSERT(arguments.ArgCount() ==
- kMalformedTypeErrorRuntimeEntry.argument_count());
const intptr_t location = GetCallerLocation();
const Instance& src_value = Instance::CheckedHandle(arguments.ArgAt(0));
const String& dst_name = String::CheckedHandle(arguments.ArgAt(1));
@@ -698,14 +676,12 @@
DEFINE_RUNTIME_ENTRY(Throw, 1) {
- ASSERT(arguments.ArgCount() == kThrowRuntimeEntry.argument_count());
const Instance& exception = Instance::CheckedHandle(arguments.ArgAt(0));
Exceptions::Throw(exception);
}
DEFINE_RUNTIME_ENTRY(ReThrow, 2) {
- ASSERT(arguments.ArgCount() == kReThrowRuntimeEntry.argument_count());
const Instance& exception = Instance::CheckedHandle(arguments.ArgAt(0));
const Instance& stacktrace = Instance::CheckedHandle(arguments.ArgAt(1));
Exceptions::ReThrow(exception, stacktrace);
@@ -715,7 +691,6 @@
// Patches static call in optimized code with the target's entry point.
// Compiles target if necessary.
DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
- ASSERT(arguments.ArgCount() == kPatchStaticCallRuntimeEntry.argument_count());
DartFrameIterator iterator;
StackFrame* caller_frame = iterator.NextFrame();
ASSERT(caller_frame != NULL);
@@ -789,8 +764,6 @@
// Gets called from debug stub when code reaches a breakpoint
// set on a runtime stub call.
DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) {
- ASSERT(arguments.ArgCount() ==
- kBreakpointRuntimeHandlerRuntimeEntry.argument_count());
ASSERT(isolate->debugger() != NULL);
DartFrameIterator iterator;
StackFrame* caller_frame = iterator.NextFrame();
@@ -805,8 +778,6 @@
// Gets called from debug stub when code reaches a breakpoint.
DEFINE_RUNTIME_ENTRY(BreakpointStaticHandler, 0) {
- ASSERT(arguments.ArgCount() ==
- kBreakpointStaticHandlerRuntimeEntry.argument_count());
ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SignalBpReached();
// Make sure the static function that is about to be called is
@@ -834,8 +805,6 @@
// Gets called from debug stub when code reaches a breakpoint at a return
// in Dart code.
DEFINE_RUNTIME_ENTRY(BreakpointReturnHandler, 0) {
- ASSERT(arguments.ArgCount() ==
- kBreakpointReturnHandlerRuntimeEntry.argument_count());
ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SignalBpReached();
}
@@ -843,16 +812,12 @@
// Gets called from debug stub when code reaches a breakpoint.
DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) {
- ASSERT(arguments.ArgCount() ==
- kBreakpointDynamicHandlerRuntimeEntry.argument_count());
ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SignalBpReached();
}
DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) {
- ASSERT(arguments.ArgCount() ==
- kSingleStepHandlerRuntimeEntry.argument_count());
ASSERT(isolate->debugger() != NULL);
isolate->debugger()->SingleStepCallback();
}
@@ -920,8 +885,6 @@
// Returns: target function with compiled code or null.
// Modifies the instance call to hold the updated IC data array.
DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 2) {
- ASSERT(arguments.ArgCount() ==
- kInlineCacheMissHandlerOneArgRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
GrowableArray<const Instance*> args(1);
@@ -940,8 +903,6 @@
// Returns: target function with compiled code or null.
// Modifies the instance call to hold the updated IC data array.
DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerTwoArgs, 3) {
- ASSERT(arguments.ArgCount() ==
- kInlineCacheMissHandlerTwoArgsRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const Instance& other = Instance::CheckedHandle(arguments.ArgAt(1));
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2));
@@ -963,8 +924,6 @@
// Returns: target function with compiled code or null.
// Modifies the instance call to hold the updated IC data array.
DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerThreeArgs, 4) {
- ASSERT(arguments.ArgCount() ==
- kInlineCacheMissHandlerThreeArgsRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1));
const Instance& arg2 = Instance::CheckedHandle(arguments.ArgAt(2));
@@ -985,8 +944,6 @@
// Arg1: argument 1.
// Arg2: IC data object.
DEFINE_RUNTIME_ENTRY(StaticCallMissHandlerTwoArgs, 3) {
- ASSERT(arguments.ArgCount() ==
- kStaticCallMissHandlerTwoArgsRuntimeEntry.argument_count());
const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0));
const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1));
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2));
@@ -1025,8 +982,6 @@
// InstanceFunctionLookup stub should be used (e.g., to invoke no such
// method and implicit closures)..
DEFINE_RUNTIME_ENTRY(MegamorphicCacheMissHandler, 3) {
- ASSERT(arguments.ArgCount() ==
- kMegamorphicCacheMissHandlerRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
const Array& descriptor = Array::CheckedHandle(arguments.ArgAt(2));
@@ -1074,8 +1029,6 @@
// Arg2: Target's name.
// Arg3: ICData.
DEFINE_RUNTIME_ENTRY(UpdateICDataTwoArgs, 4) {
- ASSERT(arguments.ArgCount() ==
- kUpdateICDataTwoArgsRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1));
const String& target_name = String::CheckedHandle(arguments.ArgAt(2));
@@ -1105,8 +1058,6 @@
// Arg2: arguments descriptor array.
// Arg3: arguments array.
DEFINE_RUNTIME_ENTRY(InvokeNoSuchMethodFunction, 4) {
- ASSERT(arguments.ArgCount() ==
- kInvokeNoSuchMethodFunctionRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
const Array& orig_arguments_desc = Array::CheckedHandle(arguments.ArgAt(2));
@@ -1135,8 +1086,6 @@
// Arg0: arguments descriptor.
// Arg1: arguments array, including non-closure object.
DEFINE_RUNTIME_ENTRY(InvokeNonClosure, 2) {
- ASSERT(arguments.ArgCount() ==
- kInvokeNonClosureRuntimeEntry.argument_count());
const Array& args_descriptor = Array::CheckedHandle(arguments.ArgAt(0));
const Array& function_args = Array::CheckedHandle(arguments.ArgAt(1));
@@ -1206,8 +1155,6 @@
//
// 3. There is no such method.
DEFINE_RUNTIME_ENTRY(InstanceFunctionLookup, 4) {
- ASSERT(arguments.ArgCount() ==
- kInstanceFunctionLookupRuntimeEntry.argument_count());
const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0));
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1));
const Array& args_descriptor = Array::CheckedHandle(arguments.ArgAt(2));
@@ -1311,8 +1258,6 @@
DEFINE_RUNTIME_ENTRY(StackOverflow, 0) {
- ASSERT(arguments.ArgCount() ==
- kStackOverflowRuntimeEntry.argument_count());
#if defined(USING_SIMULATOR)
uword stack_pos = Simulator::Current()->get_register(SPREG);
#else
@@ -1398,8 +1343,6 @@
DEFINE_RUNTIME_ENTRY(TraceICCall, 2) {
- ASSERT(arguments.ArgCount() ==
- kTraceICCallRuntimeEntry.argument_count());
const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(0));
const Function& function = Function::CheckedHandle(arguments.ArgAt(1));
DartFrameIterator iterator;
@@ -1420,8 +1363,6 @@
// The requesting function can be already optimized (reoptimization).
// Returns the Code object where to continue execution.
DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) {
- ASSERT(arguments.ArgCount() ==
- kOptimizeInvokedFunctionRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
ASSERT(!function.IsNull());
@@ -1443,9 +1384,6 @@
// The caller must be a static call in a Dart frame, or an entry frame.
// Patch static call to point to valid code's entry point.
DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) {
- ASSERT(arguments.ArgCount() ==
- kFixCallersTargetRuntimeEntry.argument_count());
-
StackFrameIterator iterator(StackFrameIterator::kDontValidateFrames);
StackFrame* frame = iterator.NextFrame();
while (frame != NULL && (frame->IsStubFrame() || frame->IsExitFrame())) {
@@ -1884,7 +1822,6 @@
// Arg0: Field object;
// Arg1: Value that is being stored.
DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) {
- ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count());
const Field& field = Field::CheckedHandle(arguments.ArgAt(0));
const Object& value = Object::Handle(arguments.ArgAt(1));
const intptr_t cid = value.GetClassId();
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index a50bf18..1e6ce14 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -63,7 +63,6 @@
// Compile a function. Should call only if the function has not been compiled.
// Arg0: function object.
DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
- ASSERT(arguments.ArgCount() == kCompileFunctionRuntimeEntry.argument_count());
const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
ASSERT(!function.HasCode());
const Error& error = Error::Handle(Compiler::CompileFunction(function));
diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc
index 114de52..f9bbe1c 100644
--- a/runtime/vm/debugger_api_impl.cc
+++ b/runtime/vm/debugger_api_impl.cc
@@ -514,6 +514,8 @@
return Api::NewHandle(isolate, Instance::Cast(target).Evaluate(expr));
} else if (target.IsClass()) {
return Api::NewHandle(isolate, Class::Cast(target).Evaluate(expr));
+ } else if (target.IsLibrary()) {
+ return Api::NewHandle(isolate, Library::Cast(target).Evaluate(expr));
}
return Api::NewError("%s: unsupported target type", CURRENT_FUNC);
}
@@ -782,6 +784,19 @@
}
+DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id) {
+ Isolate* isolate = Isolate::Current();
+ ASSERT(isolate != NULL);
+ DARTSCOPE(isolate);
+ const Library& lib = Library::Handle(Library::GetLibrary(library_id));
+ if (lib.IsNull()) {
+ return Api::NewError("%s: %" Pd " is not a valid library id",
+ CURRENT_FUNC, library_id);
+ }
+ return Api::NewHandle(isolate, lib.raw());
+}
+
+
DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) {
Isolate* isolate = Isolate::Current();
ASSERT(isolate != NULL);
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index 4b4b458..b56bc15 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -1574,6 +1574,15 @@
EXPECT_VALID(elem);
EXPECT(Dart_IsString(elem));
EXPECT_STREQ("tab", ToCString(elem));
+
+ res = Dart_EvaluateExpr(script_lib, NewString("l..add(11)..add(-5)"));
+ EXPECT_VALID(res);
+ // List l now has 5 elements.
+
+ len = Dart_EvaluateExpr(script_lib, NewString("l.length + 1"));
+ EXPECT_VALID(len);
+ EXPECT(Dart_IsNumber(len));
+ EXPECT_EQ(6, ToInt64(len));
}
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index a57a46a..3c6e44e 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -161,7 +161,7 @@
stacktrace_.SetFunctionAtFrame(null_slot, frame_func);
stacktrace_.SetCodeAtFrame(null_slot, frame_code);
}
- // Move frames one slot down so that we can accomadate the new frame.
+ // Move frames one slot down so that we can accomodate the new frame.
for (intptr_t i = start; i < Stacktrace::kPreallocatedStackdepth; i++) {
intptr_t prev = (i - 1);
frame_func = stacktrace_.FunctionAtFrame(i);
@@ -188,13 +188,7 @@
}
-// Iterate through the stack frames and try to find a frame with an
-// exception handler. Once found, set the pc, sp and fp so that execution
-// can continue in that frame.
-static bool FindExceptionHandler(uword* handler_pc,
- uword* handler_sp,
- uword* handler_fp,
- StacktraceBuilder* builder) {
+static void BuildStackTrace(StacktraceBuilder* builder) {
StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
StackFrame* frame = frames.NextFrame();
ASSERT(frame != NULL); // We expect to find a dart invocation frame.
@@ -229,13 +223,17 @@
builder->AddFrame(func, code, offset, dart_handler_found);
}
}
- if (!handler_pc_set && frame->FindExceptionHandler(handler_pc)) {
+ bool needs_stacktrace = false;
+ bool is_catch_all = false;
+ uword handler_pc = kUwordMax;
+ if (!handler_pc_set &&
+ frame->FindExceptionHandler(&handler_pc,
+ &needs_stacktrace,
+ &is_catch_all)) {
handler_pc_set = true;
- *handler_sp = frame->sp();
- *handler_fp = frame->fp();
dart_handler_found = true;
if (!builder->FullStacktrace()) {
- return dart_handler_found;
+ return;
}
}
}
@@ -245,16 +243,58 @@
ASSERT(frame->IsEntryFrame());
if (!handler_pc_set) {
handler_pc_set = true;
- *handler_pc = frame->pc();
- *handler_sp = frame->sp();
- *handler_fp = frame->fp();
if (!builder->FullStacktrace()) {
- return dart_handler_found;
+ return;
}
}
frame = frames.NextFrame();
}
- return dart_handler_found;
+}
+
+
+// Iterate through the stack frames and try to find a frame with an
+// exception handler. Once found, set the pc, sp and fp so that execution
+// can continue in that frame. Sets 'needs_stacktrace' if there is no
+// cath-all handler or if a stack-trace is specified in the catch.
+static bool FindExceptionHandler(uword* handler_pc,
+ uword* handler_sp,
+ uword* handler_fp,
+ bool* needs_stacktrace) {
+ StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
+ StackFrame* frame = frames.NextFrame();
+ ASSERT(frame != NULL); // We expect to find a dart invocation frame.
+ bool handler_pc_set = false;
+ *needs_stacktrace = false;
+ bool is_catch_all = false;
+ uword temp_handler_pc = kUwordMax;
+ while (!frame->IsEntryFrame()) {
+ if (frame->IsDartFrame()) {
+ if (frame->FindExceptionHandler(&temp_handler_pc,
+ needs_stacktrace,
+ &is_catch_all)) {
+ if (!handler_pc_set) {
+ handler_pc_set = true;
+ *handler_pc = temp_handler_pc;
+ *handler_sp = frame->sp();
+ *handler_fp = frame->fp();
+ }
+ if (*needs_stacktrace || is_catch_all) {
+ return true;
+ }
+ }
+ } // if frame->IsDartFrame
+ frame = frames.NextFrame();
+ ASSERT(frame != NULL);
+ } // while !frame->IsEntryFrame
+ ASSERT(frame->IsEntryFrame());
+ if (!handler_pc_set) {
+ *handler_pc = frame->pc();
+ *handler_sp = frame->sp();
+ *handler_fp = frame->fp();
+ }
+ // No catch-all encountered, needs stacktrace.
+ *needs_stacktrace = true;
+ return handler_pc_set;
}
@@ -325,6 +365,10 @@
static RawField* LookupStacktraceField(const Instance& instance) {
+ if (instance.GetClassId() < kNumPredefinedCids) {
+ // 'class Error' is not a predefined class.
+ return Field::null();
+ }
Isolate* isolate = Isolate::Current();
Class& error_class = Class::Handle(isolate,
isolate->object_store()->error_class());
@@ -334,15 +378,18 @@
ASSERT(!error_class.IsNull());
isolate->object_store()->set_error_class(error_class);
}
- const Class& instance_class = Class::Handle(isolate, instance.clazz());
- Error& malformed_type_error = Error::Handle(isolate);
- if (instance_class.IsSubtypeOf(Object::null_abstract_type_arguments(),
- error_class,
- Object::null_abstract_type_arguments(),
- &malformed_type_error)) {
- ASSERT(malformed_type_error.IsNull());
- return error_class.LookupInstanceField(Symbols::_stackTrace());
- }
+ // If instance class extends 'class Error' return '_stackTrace' field.
+ Class& test_class = Class::Handle(isolate, instance.clazz());
+ AbstractType& type = AbstractType::Handle(isolate, AbstractType::null());
+ while (true) {
+ if (test_class.raw() == error_class.raw()) {
+ return error_class.LookupInstanceField(Symbols::_stackTrace());
+ }
+ type = test_class.super_type();
+ if (type.IsNull()) return Field::null();
+ test_class = type.type_class();
+ };
+ UNREACHABLE();
return Field::null();
}
@@ -364,56 +411,59 @@
uword handler_fp = 0;
Stacktrace& stacktrace = Stacktrace::Handle(isolate);
bool handler_exists = false;
+ bool handler_needs_stacktrace = false;
if (use_preallocated_stacktrace) {
stacktrace ^= isolate->object_store()->preallocated_stack_trace();
PreallocatedStacktraceBuilder frame_builder(stacktrace);
handler_exists = FindExceptionHandler(&handler_pc,
&handler_sp,
&handler_fp,
- &frame_builder);
+ &handler_needs_stacktrace);
+ if (handler_needs_stacktrace) {
+ BuildStackTrace(&frame_builder);
+ }
} else {
+ // Get stacktrace field of class Error.
const Field& stacktrace_field =
- Field::Handle(LookupStacktraceField(exception));
+ Field::Handle(isolate, LookupStacktraceField(exception));
bool full_stacktrace = !stacktrace_field.IsNull();
- RegularStacktraceBuilder frame_builder(full_stacktrace);
handler_exists = FindExceptionHandler(&handler_pc,
&handler_sp,
&handler_fp,
- &frame_builder);
- // Create arrays for function, code and pc_offset triplet of each frame.
- const Array& func_array =
- Array::Handle(isolate, Array::MakeArray(frame_builder.func_list()));
- const Array& code_array =
- Array::Handle(isolate, Array::MakeArray(frame_builder.code_list()));
- const Array& pc_offset_array =
- Array::Handle(isolate,
- Array::MakeArray(frame_builder.pc_offset_list()));
- if (!stacktrace_field.IsNull()) {
- // This is an error object and we need to capture the full stack trace
- // here implicitly, so we set up the stack trace. The stack trace field
- // is set only once, it is not overriden.
- const Array& catch_func_array =
- Array::Handle(isolate,
- Array::MakeArray(frame_builder.catch_func_list()));
- const Array& catch_code_array =
- Array::Handle(isolate,
- Array::MakeArray(frame_builder.catch_code_list()));
- const Array& catch_pc_offset_array =
- Array::Handle(isolate,
- Array::MakeArray(frame_builder.catch_pc_offset_list()));
- stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
- stacktrace.SetCatchStacktrace(catch_func_array,
- catch_code_array,
- catch_pc_offset_array);
- if (exception.GetField(stacktrace_field) == Object::null()) {
- exception.SetField(stacktrace_field, stacktrace);
- }
- }
- // TODO(5411263): At some point we can optimize by figuring out if a
- // stack trace is needed based on whether the catch code specifies a
- // stack trace object or there is a rethrow in the catch clause.
- if (existing_stacktrace.IsNull()) {
+ &handler_needs_stacktrace);
+ Array& func_array = Array::Handle(isolate, Object::empty_array().raw());
+ Array& code_array = Array::Handle(isolate, Object::empty_array().raw());
+ Array& pc_offset_array =
+ Array::Handle(isolate, Object::empty_array().raw());
+ if (handler_needs_stacktrace || full_stacktrace) {
+ RegularStacktraceBuilder frame_builder(full_stacktrace);
+ BuildStackTrace(&frame_builder);
+
+ // Create arrays for function, code and pc_offset triplet of each frame.
+ func_array = Array::MakeArray(frame_builder.func_list());
+ code_array = Array::MakeArray(frame_builder.code_list());
+ pc_offset_array = Array::MakeArray(frame_builder.pc_offset_list());
+ if (!stacktrace_field.IsNull()) {
+ // This is an error object and we need to capture the full stack trace
+ // here implicitly, so we set up the stack trace. The stack trace field
+ // is set only once, it is not overriden.
+ const Array& catch_func_array = Array::Handle(isolate,
+ Array::MakeArray(frame_builder.catch_func_list()));
+ const Array& catch_code_array = Array::Handle(isolate,
+ Array::MakeArray(frame_builder.catch_code_list()));
+ const Array& catch_pc_offset_array = Array::Handle(isolate,
+ Array::MakeArray(frame_builder.catch_pc_offset_list()));
stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
+ stacktrace.SetCatchStacktrace(catch_func_array,
+ catch_code_array,
+ catch_pc_offset_array);
+ if (exception.GetField(stacktrace_field) == Object::null()) {
+ exception.SetField(stacktrace_field, stacktrace);
+ }
+ } // if stacktrace needed.
+ }
+ if (existing_stacktrace.IsNull()) {
+ stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
} else {
stacktrace ^= existing_stacktrace.raw();
if (pc_offset_array.Length() != 0) {
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index ce28a04..7033250 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -58,6 +58,7 @@
last_used_block_id_(0), // 0 is used for the graph entry.
context_level_(0),
try_index_(CatchClauseNode::kInvalidTryIndex),
+ catch_try_index_(CatchClauseNode::kInvalidTryIndex),
loop_depth_(0),
graph_entry_(NULL),
args_pushed_(0),
@@ -2753,6 +2754,7 @@
node->token_pos(),
node->cls(),
getter_name,
+ NULL, // No Arguments to getter.
InvocationMirror::EncodeType(
node->cls().IsTopLevel() ?
InvocationMirror::kTopLevel :
@@ -2802,10 +2804,13 @@
result_is_needed); // Save last arg if result is needed.
} else {
// Throw a NoSuchMethodError.
+ ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
+ arguments->Add(node->value());
call = BuildThrowNoSuchMethodError(
node->token_pos(),
node->cls(),
setter_name,
+ arguments, // Argument is the value passed to the setter.
InvocationMirror::EncodeType(
node->cls().IsTopLevel() ?
InvocationMirror::kTopLevel :
@@ -2875,16 +2880,21 @@
}
+static LoadLocalInstr* BuildLoadThisVar(LocalScope* scope) {
+ LocalVariable* receiver_var = scope->LookupVariable(Symbols::This(),
+ true); // Test only.
+ return new LoadLocalInstr(*receiver_var);
+}
+
+
void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
const Function& function = owner()->parsed_function()->function();
if (!function.IsClosureFunction()) {
MethodRecognizer::Kind kind = MethodRecognizer::RecognizeKind(function);
switch (kind) {
- case MethodRecognizer::kStringBaseLength: {
- LocalVariable* receiver_var =
- node->scope()->LookupVariable(Symbols::This(),
- true); // Test only.
- Value* receiver = Bind(new LoadLocalInstr(*receiver_var));
+ case MethodRecognizer::kStringBaseLength:
+ case MethodRecognizer::kStringBaseIsEmpty: {
+ Value* receiver = Bind(BuildLoadThisVar(node->scope()));
// Treat length loads as mutable (i.e. affected by side effects) to
// avoid hoisting them since we can't hoist the preceding class-check.
// This is because of externalization of strings that affects their
@@ -2897,16 +2907,24 @@
is_immutable);
load->set_result_cid(kSmiCid);
load->set_recognized_kind(MethodRecognizer::kStringBaseLength);
- return ReturnDefinition(load);
+ if (kind == MethodRecognizer::kStringBaseLength) {
+ return ReturnDefinition(load);
+ }
+ ASSERT(kind == MethodRecognizer::kStringBaseIsEmpty);
+ Value* zero_val = Bind(new ConstantInstr(Smi::ZoneHandle(Smi::New(0))));
+ Value* load_val = Bind(load);
+ StrictCompareInstr* compare =
+ new StrictCompareInstr(node->token_pos(),
+ Token::kEQ_STRICT,
+ load_val,
+ zero_val);
+ return ReturnDefinition(compare);
}
case MethodRecognizer::kGrowableArrayLength:
case MethodRecognizer::kObjectArrayLength:
case MethodRecognizer::kImmutableArrayLength:
case MethodRecognizer::kTypedDataLength: {
- LocalVariable* receiver_var =
- node->scope()->LookupVariable(Symbols::This(),
- true); // Test only.
- Value* receiver = Bind(new LoadLocalInstr(*receiver_var));
+ Value* receiver = Bind(BuildLoadThisVar(node->scope()));
const bool is_immutable =
(kind != MethodRecognizer::kGrowableArrayLength);
LoadFieldInstr* load = new LoadFieldInstr(
@@ -2918,6 +2936,27 @@
load->set_recognized_kind(kind);
return ReturnDefinition(load);
}
+ case MethodRecognizer::kObjectCid: {
+ Value* receiver = Bind(BuildLoadThisVar(node->scope()));
+ LoadClassIdInstr* load = new LoadClassIdInstr(receiver);
+ return ReturnDefinition(load);
+ }
+ case MethodRecognizer::kGrowableArrayCapacity: {
+ Value* receiver = Bind(BuildLoadThisVar(node->scope()));
+ LoadFieldInstr* data_load = new LoadFieldInstr(
+ receiver,
+ Array::data_offset(),
+ Type::ZoneHandle(Type::DynamicType()));
+ data_load->set_result_cid(kArrayCid);
+ Value* data = Bind(data_load);
+ LoadFieldInstr* length_load = new LoadFieldInstr(
+ data,
+ Array::length_offset(),
+ Type::ZoneHandle(Type::SmiType()));
+ length_load->set_result_cid(kSmiCid);
+ length_load->set_recognized_kind(MethodRecognizer::kObjectArrayLength);
+ return ReturnDefinition(length_load);
+ }
default:
break;
}
@@ -3428,7 +3467,7 @@
void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
InlineBailout("EffectGraphVisitor::VisitTryCatchNode (exception)");
intptr_t original_handler_index = owner()->try_index();
- intptr_t try_handler_index = node->try_index();
+ const intptr_t try_handler_index = node->try_index();
ASSERT(try_handler_index != original_handler_index);
owner()->set_try_index(try_handler_index);
@@ -3464,9 +3503,13 @@
? original_handler_index
: catch_block->catch_handler_index();
+ const intptr_t prev_catch_try_index = owner()->catch_try_index();
+
owner()->set_try_index(catch_handler_index);
+ owner()->set_catch_try_index(try_handler_index);
EffectGraphVisitor for_catch(owner(), temp_index());
catch_block->Visit(&for_catch);
+ owner()->set_catch_try_index(prev_catch_try_index);
// NOTE: The implicit variables ':saved_context', ':exception_var'
// and ':stacktrace_var' can never be captured variables.
@@ -3479,7 +3522,8 @@
catch_block->handler_types(),
try_handler_index,
catch_block->exception_var(),
- catch_block->stacktrace_var());
+ catch_block->stacktrace_var(),
+ catch_block->needs_stacktrace());
owner()->AddCatchEntry(catch_entry);
ASSERT(!for_catch.is_open());
AppendFragment(catch_entry, for_catch);
@@ -3507,7 +3551,8 @@
Value* stacktrace = for_finally.Bind(
for_finally.BuildLoadLocal(catch_block->stacktrace_var()));
for_finally.PushArgument(stacktrace);
- for_finally.AddInstruction(new ReThrowInstr(catch_block->token_pos()));
+ for_finally.AddInstruction(
+ new ReThrowInstr(catch_block->token_pos(), catch_handler_index));
for_finally.CloseFragment();
}
ASSERT(!for_finally.is_open());
@@ -3520,7 +3565,8 @@
types,
catch_handler_index,
catch_block->exception_var(),
- catch_block->stacktrace_var());
+ catch_block->stacktrace_var(),
+ catch_block->needs_stacktrace());
owner()->AddCatchEntry(finally_entry);
AppendFragment(finally_entry, for_finally);
}
@@ -3571,6 +3617,7 @@
intptr_t token_pos,
const Class& function_class,
const String& function_name,
+ ArgumentListNode* function_arguments,
int invocation_type) {
ZoneGrowableArray<PushArgumentInstr*>* arguments =
new ZoneGrowableArray<PushArgumentInstr*>();
@@ -3595,13 +3642,25 @@
Smi::ZoneHandle(Smi::New(invocation_type))));
arguments->Add(PushArgument(invocation_type_value));
// List arguments.
- // TODO(regis): Pass arguments.
- Value* arguments_value = Bind(new ConstantInstr(Array::ZoneHandle()));
- arguments->Add(PushArgument(arguments_value));
+ if (function_arguments == NULL) {
+ Value* arguments_value = Bind(new ConstantInstr(Array::ZoneHandle()));
+ arguments->Add(PushArgument(arguments_value));
+ } else {
+ ValueGraphVisitor array_val(owner(), temp_index());
+ ArrayNode* array =
+ new ArrayNode(token_pos, Type::ZoneHandle(Type::ArrayType()),
+ function_arguments->nodes());
+ array->Visit(&array_val);
+ Append(array_val);
+ arguments->Add(PushArgument(array_val.value()));
+ }
// List argumentNames.
- Value* argument_names_value =
- Bind(new ConstantInstr(Array::ZoneHandle()));
+ ConstantInstr* cinstr = new ConstantInstr(
+ (function_arguments == NULL) ? Array::ZoneHandle()
+ : function_arguments->names());
+ Value* argument_names_value = Bind(cinstr);
arguments->Add(PushArgument(argument_names_value));
+
// List existingArgumentNames.
Value* existing_argument_names_value =
Bind(new ConstantInstr(Array::ZoneHandle()));
@@ -3639,7 +3698,7 @@
node->stacktrace()->Visit(&for_stack_trace);
Append(for_stack_trace);
PushArgument(for_stack_trace.value());
- instr = new ReThrowInstr(node->token_pos());
+ instr = new ReThrowInstr(node->token_pos(), owner()->catch_try_index());
}
AddInstruction(instr);
}
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index 84ba8c0..4a8457b 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -128,6 +128,10 @@
void set_try_index(intptr_t value) { try_index_ = value; }
intptr_t try_index() const { return try_index_; }
+ // Manage the currently active catch-handler try index.
+ void set_catch_try_index(intptr_t value) { catch_try_index_ = value; }
+ intptr_t catch_try_index() const { return catch_try_index_; }
+
void AddCatchEntry(CatchBlockEntryInstr* entry);
intptr_t num_copied_params() const {
@@ -169,6 +173,7 @@
intptr_t last_used_block_id_;
intptr_t context_level_;
intptr_t try_index_;
+ intptr_t catch_try_index_;
intptr_t loop_depth_;
GraphEntryInstr* graph_entry_;
@@ -356,10 +361,12 @@
ArgumentListNode* method_arguments,
bool save_last_arg);
- StaticCallInstr* BuildThrowNoSuchMethodError(intptr_t token_pos,
- const Class& function_class,
- const String& function_name,
- int invocation_type);
+ StaticCallInstr* BuildThrowNoSuchMethodError(
+ intptr_t token_pos,
+ const Class& function_class,
+ const String& function_name,
+ ArgumentListNode* function_arguments,
+ int invocation_type);
void BuildStaticSetter(StaticSetterNode* node, bool result_is_needed);
Definition* BuildStoreStaticField(StoreStaticFieldNode* node,
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index f8b752a..8c305d0 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -315,11 +315,18 @@
void FlowGraphCompiler::AddExceptionHandler(intptr_t try_index,
intptr_t outer_try_index,
intptr_t pc_offset,
- const Array& handler_types) {
+ const Array& handler_types,
+ bool needs_stacktrace) {
exception_handlers_list_->AddHandler(try_index,
outer_try_index,
pc_offset,
- handler_types);
+ handler_types,
+ needs_stacktrace);
+}
+
+
+void FlowGraphCompiler::SetNeedsStacktrace(intptr_t try_index) {
+ exception_handlers_list_->SetNeedsStacktrace(try_index);
}
diff --git a/runtime/vm/flow_graph_compiler.h b/runtime/vm/flow_graph_compiler.h
index 8847f8c..a5369ec 100644
--- a/runtime/vm/flow_graph_compiler.h
+++ b/runtime/vm/flow_graph_compiler.h
@@ -285,6 +285,7 @@
void GenerateCallRuntime(intptr_t token_pos,
intptr_t deopt_id,
const RuntimeEntry& entry,
+ intptr_t argument_count,
LocationSummary* locs);
void GenerateCall(intptr_t token_pos,
@@ -401,7 +402,9 @@
void AddExceptionHandler(intptr_t try_index,
intptr_t outer_try_index,
intptr_t pc_offset,
- const Array& handler_types);
+ const Array& handler_types,
+ bool needs_stacktrace);
+ void SetNeedsStacktrace(intptr_t try_index);
void AddCurrentDescriptor(PcDescriptors::Kind kind,
intptr_t deopt_id,
intptr_t token_pos);
diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc
index b8a6025..b65b83b 100644
--- a/runtime/vm/flow_graph_compiler_arm.cc
+++ b/runtime/vm/flow_graph_compiler_arm.cc
@@ -603,7 +603,7 @@
__ PushList((1 << R1) | (1 << R2));
__ LoadObject(R0, test_cache);
__ Push(R0);
- GenerateCallRuntime(token_pos, deopt_id, kInstanceofRuntimeEntry, locs);
+ GenerateCallRuntime(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs);
// Pop the parameters supplied to the runtime entry. The result of the
// instanceof runtime call will be left as the result of the operation.
__ Drop(5);
@@ -685,6 +685,7 @@
GenerateCallRuntime(token_pos,
deopt_id,
kMalformedTypeErrorRuntimeEntry,
+ 3,
locs);
// We should never return here.
__ bkpt(0);
@@ -711,7 +712,7 @@
__ PushObject(dst_name); // Push the name of the destination.
__ LoadObject(R0, test_cache);
__ Push(R0);
- GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, locs);
+ GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs);
// Pop the parameters supplied to the runtime entry. The result of the
// type check runtime call is the checked value.
__ Drop(6);
@@ -1256,8 +1257,9 @@
void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos,
intptr_t deopt_id,
const RuntimeEntry& entry,
+ intptr_t argument_count,
LocationSummary* locs) {
- __ CallRuntime(entry);
+ __ CallRuntime(entry, argument_count);
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos);
RecordSafepoint(locs);
if (deopt_id != Isolate::kNoDeoptId) {
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index 4eb2ea1..9ca6baa 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -618,6 +618,7 @@
GenerateCallRuntime(token_pos,
deopt_id,
kInstanceofRuntimeEntry,
+ 5,
locs);
// Pop the parameters supplied to the runtime entry. The result of the
// instanceof runtime call will be left as the result of the operation.
@@ -705,6 +706,7 @@
GenerateCallRuntime(token_pos,
deopt_id,
kMalformedTypeErrorRuntimeEntry,
+ 3,
locs);
// We should never return here.
__ int3();
@@ -731,7 +733,7 @@
__ PushObject(dst_name); // Push the name of the destination.
__ LoadObject(EAX, test_cache);
__ pushl(EAX);
- GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, locs);
+ GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs);
// Pop the parameters supplied to the runtime entry. The result of the
// type check runtime call is the checked value.
__ Drop(6);
@@ -1263,8 +1265,9 @@
void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos,
intptr_t deopt_id,
const RuntimeEntry& entry,
+ intptr_t argument_count,
LocationSummary* locs) {
- __ CallRuntime(entry);
+ __ CallRuntime(entry, argument_count);
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos);
RecordSafepoint(locs);
if (deopt_id != Isolate::kNoDeoptId) {
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc
index c428d74..f3bbf2f 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -607,7 +607,7 @@
__ sw(A1, Address(SP, 1 * kWordSize)); // Push type arguments.
__ LoadObject(A0, test_cache);
__ sw(A0, Address(SP, 0 * kWordSize));
- GenerateCallRuntime(token_pos, deopt_id, kInstanceofRuntimeEntry, locs);
+ GenerateCallRuntime(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs);
// Pop the parameters supplied to the runtime entry. The result of the
// instanceof runtime call will be left as the result of the operation.
__ lw(T0, Address(SP, 5 * kWordSize));
@@ -698,6 +698,7 @@
GenerateCallRuntime(token_pos,
deopt_id,
kMalformedTypeErrorRuntimeEntry,
+ 3,
locs);
// We should never return here.
__ break_(0);
@@ -733,7 +734,7 @@
__ LoadObject(T0, test_cache);
__ sw(T0, Address(SP, 0 * kWordSize));
- GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, locs);
+ GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs);
// Pop the parameters supplied to the runtime entry. The result of the
// type check runtime call is the checked value.
__ lw(A0, Address(SP, 6 * kWordSize));
@@ -1300,8 +1301,9 @@
void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos,
intptr_t deopt_id,
const RuntimeEntry& entry,
+ intptr_t argument_count,
LocationSummary* locs) {
- __ CallRuntime(entry);
+ __ CallRuntime(entry, argument_count);
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos);
RecordSafepoint(locs);
if (deopt_id != Isolate::kNoDeoptId) {
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 71d8a9c..3d9b852d 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -615,6 +615,7 @@
GenerateCallRuntime(token_pos,
deopt_id,
kInstanceofRuntimeEntry,
+ 5,
locs);
// Pop the parameters supplied to the runtime entry. The result of the
// instanceof runtime call will be left as the result of the operation.
@@ -699,6 +700,7 @@
GenerateCallRuntime(token_pos,
deopt_id,
kMalformedTypeErrorRuntimeEntry,
+ 3,
locs);
// We should never return here.
__ int3();
@@ -725,7 +727,7 @@
__ PushObject(dst_name); // Push the name of the destination.
__ LoadObject(RAX, test_cache);
__ pushq(RAX);
- GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, locs);
+ GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs);
// Pop the parameters supplied to the runtime entry. The result of the
// type check runtime call is the checked value.
__ Drop(6);
@@ -1258,8 +1260,9 @@
void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos,
intptr_t deopt_id,
const RuntimeEntry& entry,
+ intptr_t argument_count,
LocationSummary* locs) {
- __ CallRuntime(entry);
+ __ CallRuntime(entry, argument_count);
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos);
RecordSafepoint(locs);
if (deopt_id != Isolate::kNoDeoptId) {
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 4558352..6ecb193 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -510,14 +510,6 @@
return false;
}
- // Abort if the callee has an intrinsic translation.
- if (Intrinsifier::CanIntrinsify(function) &&
- !function.is_optimizable()) {
- function.set_is_inlinable(false);
- TRACE_INLINING(OS::Print(" Bailout: can intrinsify\n"));
- return false;
- }
-
Isolate* isolate = Isolate::Current();
// Save and clear deopt id.
const intptr_t prev_deopt_id = isolate->deopt_id();
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index ff732c0..05cb407 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -1408,29 +1408,6 @@
}
-void FlowGraphOptimizer::InlineGrowableArrayCapacityGetter(
- InstanceCallInstr* call) {
- AddReceiverCheck(call);
-
- // TODO(srdjan): type of load should be GrowableObjectArrayType.
- LoadFieldInstr* data_load = new LoadFieldInstr(
- new Value(call->ArgumentAt(0)),
- Array::data_offset(),
- Type::ZoneHandle(Type::DynamicType()));
- data_load->set_result_cid(kArrayCid);
- InsertBefore(call, data_load, NULL, Definition::kValue);
-
- LoadFieldInstr* length_load = new LoadFieldInstr(
- new Value(data_load),
- Array::length_offset(),
- Type::ZoneHandle(Type::SmiType()));
- length_load->set_result_cid(kSmiCid);
- length_load->set_recognized_kind(MethodRecognizer::kObjectArrayLength);
-
- ReplaceCall(call, length_load);
-}
-
-
static LoadFieldInstr* BuildLoadStringLength(Definition* str) {
// Treat length loads as mutable (i.e. affected by side effects) to avoid
// hoisting them since we can't hoist the preceding class-check. This
@@ -1447,28 +1424,6 @@
}
-void FlowGraphOptimizer::InlineStringIsEmptyGetter(InstanceCallInstr* call) {
- AddReceiverCheck(call);
-
- LoadFieldInstr* load = BuildLoadStringLength(call->ArgumentAt(0));
- InsertBefore(call, load, NULL, Definition::kValue);
-
- ConstantInstr* zero = flow_graph()->GetConstant(Smi::Handle(Smi::New(0)));
- StrictCompareInstr* compare =
- new StrictCompareInstr(call->token_pos(),
- Token::kEQ_STRICT,
- new Value(load),
- new Value(zero));
- ReplaceCall(call, compare);
-}
-
-
-void FlowGraphOptimizer::InlineObjectCid(InstanceCallInstr* call) {
- LoadClassIdInstr* load = new LoadClassIdInstr(new Value(call->ArgumentAt(0)));
- ReplaceCall(call, load);
-}
-
-
bool FlowGraphOptimizer::InlineFloat32x4Getter(InstanceCallInstr* call,
MethodRecognizer::Kind getter) {
if (!ShouldInlineSimd()) {
@@ -1649,20 +1604,6 @@
// VM objects length getter.
switch (recognized_kind) {
- case MethodRecognizer::kObjectCid: {
- InlineObjectCid(call);
- return true;
- }
- case MethodRecognizer::kGrowableArrayCapacity:
- InlineGrowableArrayCapacityGetter(call);
- return true;
- case MethodRecognizer::kStringBaseIsEmpty:
- if (!ic_data.HasOneTarget()) {
- // Target is not only StringBase_get_isEmpty.
- return false;
- }
- InlineStringIsEmptyGetter(call);
- return true;
case MethodRecognizer::kFloat32x4ShuffleX:
case MethodRecognizer::kFloat32x4ShuffleY:
case MethodRecognizer::kFloat32x4ShuffleZ:
diff --git a/runtime/vm/flow_graph_optimizer.h b/runtime/vm/flow_graph_optimizer.h
index 117ea99..aad40dc 100644
--- a/runtime/vm/flow_graph_optimizer.h
+++ b/runtime/vm/flow_graph_optimizer.h
@@ -156,9 +156,6 @@
bool InlineUint32x4BinaryOp(InstanceCallInstr* call,
Token::Kind op_kind);
void InlineImplicitInstanceGetter(InstanceCallInstr* call);
- void InlineGrowableArrayCapacityGetter(InstanceCallInstr* call);
- void InlineStringIsEmptyGetter(InstanceCallInstr* call);
- void InlineObjectCid(InstanceCallInstr* call);
RawBool* InstanceOfAsBool(const ICData& ic_data,
const AbstractType& type) const;
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 0c5b53b..67b66e4 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -1516,13 +1516,15 @@
const Array& handler_types,
intptr_t catch_try_index,
const LocalVariable& exception_var,
- const LocalVariable& stacktrace_var)
+ const LocalVariable& stacktrace_var,
+ bool needs_stacktrace)
: BlockEntryInstr(block_id, try_index),
predecessor_(NULL),
catch_handler_types_(Array::ZoneHandle(handler_types.raw())),
catch_try_index_(catch_try_index),
exception_var_(exception_var),
- stacktrace_var_(stacktrace_var) { }
+ stacktrace_var_(stacktrace_var),
+ needs_stacktrace_(needs_stacktrace) { }
DECLARE_INSTRUCTION(CatchBlockEntry)
@@ -1537,6 +1539,8 @@
const LocalVariable& exception_var() const { return exception_var_; }
const LocalVariable& stacktrace_var() const { return stacktrace_var_; }
+ bool needs_stacktrace() const { return needs_stacktrace_; }
+
// Returns try index for the try block to which this catch handler
// corresponds.
intptr_t catch_try_index() const {
@@ -1563,6 +1567,7 @@
GrowableArray<Definition*> initial_definitions_;
const LocalVariable& exception_var_;
const LocalVariable& stacktrace_var_;
+ const bool needs_stacktrace_;
DISALLOW_COPY_AND_ASSIGN(CatchBlockEntryInstr);
};
@@ -1981,13 +1986,17 @@
class ReThrowInstr : public TemplateInstruction<0> {
public:
- explicit ReThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { }
+ // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the
+ // rethrow has been artifically generated by the parser.
+ ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index)
+ : token_pos_(token_pos), catch_try_index_(catch_try_index) {}
DECLARE_INSTRUCTION(ReThrow)
virtual intptr_t ArgumentCount() const { return 2; }
intptr_t token_pos() const { return token_pos_; }
+ intptr_t catch_try_index() const { return catch_try_index_; }
virtual bool CanDeoptimize() const { return true; }
@@ -1997,6 +2006,7 @@
private:
const intptr_t token_pos_;
+ const intptr_t catch_try_index_;
DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
};
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index 01f1c16..a0cc46a 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -249,6 +249,7 @@
compiler->GenerateCallRuntime(token_pos,
deopt_id,
kConditionTypeErrorRuntimeEntry,
+ 1,
locs);
// We should never return here.
__ bkpt(0);
@@ -1799,7 +1800,7 @@
__ Push(field_reg);
__ Push(value_reg);
- __ CallRuntime(kUpdateFieldCidRuntimeEntry);
+ __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
__ Drop(2); // Drop the field and the value.
}
@@ -1952,6 +1953,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kAllocateObjectWithBoundsCheckRuntimeEntry,
+ 3,
locs());
__ Drop(3);
ASSERT(locs()->out().reg() == R0);
@@ -1999,6 +2001,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeRuntimeEntry,
+ 2,
locs());
__ Drop(2); // Drop instantiator and uninstantiated type.
__ Pop(result_reg); // Pop instantiated type.
@@ -2045,6 +2048,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeArgumentsRuntimeEntry,
+ 2,
locs());
__ Drop(2); // Drop instantiator and uninstantiated type arguments.
__ Pop(result_reg); // Pop instantiated type arguments.
@@ -2180,6 +2184,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kCloneContextRuntimeEntry,
+ 1,
locs());
__ Drop(1); // Remove argument.
__ Pop(result); // Get result (cloned context).
@@ -2197,7 +2202,8 @@
compiler->AddExceptionHandler(catch_try_index(),
try_index(),
compiler->assembler()->CodeSize(),
- catch_handler_types_);
+ catch_handler_types_,
+ needs_stacktrace());
// Restore the pool pointer.
__ LoadPoolPointer();
@@ -2250,6 +2256,7 @@
compiler->GenerateCallRuntime(instruction_->token_pos(),
instruction_->deopt_id(),
kStackOverflowRuntimeEntry,
+ 0,
instruction_->locs());
if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
@@ -4184,7 +4191,7 @@
// Args must be in D0 and D1, so move arg from Q1(== D3:D2) to D1.
__ vmovd(D1, D2);
}
- __ CallRuntime(TargetFunction());
+ __ CallRuntime(TargetFunction(), InputCount());
__ Bind(&skip_call);
}
@@ -4433,6 +4440,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kThrowRuntimeEntry,
+ 1,
locs());
__ bkpt(0);
}
@@ -4444,9 +4452,11 @@
void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ compiler->SetNeedsStacktrace(catch_try_index());
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kReThrowRuntimeEntry,
+ 2,
locs());
__ bkpt(0);
}
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 31dbe54..a0aeebf 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -197,6 +197,7 @@
compiler->GenerateCallRuntime(token_pos,
deopt_id,
kConditionTypeErrorRuntimeEntry,
+ 1,
locs);
// We should never return here.
__ int3();
@@ -1887,7 +1888,7 @@
__ pushl(field_reg);
__ pushl(value_reg);
- __ CallRuntime(kUpdateFieldCidRuntimeEntry);
+ __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
__ Drop(2); // Drop the field and the value.
}
@@ -2041,6 +2042,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kAllocateObjectWithBoundsCheckRuntimeEntry,
+ 3,
locs());
__ Drop(3);
ASSERT(locs()->out().reg() == EAX);
@@ -2087,6 +2089,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeRuntimeEntry,
+ 2,
locs());
__ Drop(2); // Drop instantiator and uninstantiated type.
__ popl(result_reg); // Pop instantiated type.
@@ -2134,6 +2137,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeArgumentsRuntimeEntry,
+ 2,
locs());
__ Drop(2); // Drop instantiator and uninstantiated type arguments.
__ popl(result_reg); // Pop instantiated type arguments.
@@ -2271,6 +2275,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kCloneContextRuntimeEntry,
+ 1,
locs());
__ popl(result); // Remove argument.
__ popl(result); // Get result (cloned context).
@@ -2288,7 +2293,8 @@
compiler->AddExceptionHandler(catch_try_index(),
try_index(),
compiler->assembler()->CodeSize(),
- catch_handler_types_);
+ catch_handler_types_,
+ needs_stacktrace());
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
}
@@ -2336,6 +2342,7 @@
compiler->GenerateCallRuntime(instruction_->token_pos(),
instruction_->deopt_id(),
kStackOverflowRuntimeEntry,
+ 0,
instruction_->locs());
if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
@@ -4242,7 +4249,7 @@
// exp is Nan case is handled correctly in the C-library.
}
__ Bind(&do_call);
- __ CallRuntime(TargetFunction());
+ __ CallRuntime(TargetFunction(), InputCount());
__ fstpl(Address(ESP, 0));
__ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
__ Bind(&skip_call);
@@ -4779,6 +4786,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kThrowRuntimeEntry,
+ 1,
locs());
__ int3();
}
@@ -4790,9 +4798,11 @@
void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ compiler->SetNeedsStacktrace(catch_try_index());
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kReThrowRuntimeEntry,
+ 2,
locs());
__ int3();
}
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index 3d2f338..aa59591 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -252,6 +252,7 @@
compiler->GenerateCallRuntime(token_pos,
deopt_id,
kConditionTypeErrorRuntimeEntry,
+ 1,
locs);
// We should never return here.
__ break_(0);
@@ -1869,7 +1870,7 @@
__ addiu(SP, SP, Immediate(-2 * kWordSize));
__ sw(field_reg, Address(SP, 1 * kWordSize));
__ sw(value_reg, Address(SP, 0 * kWordSize));
- __ CallRuntime(kUpdateFieldCidRuntimeEntry);
+ __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
__ Drop(2); // Drop the field and the value.
}
@@ -2025,6 +2026,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kAllocateObjectWithBoundsCheckRuntimeEntry,
+ 3,
locs());
__ Drop(3);
ASSERT(locs()->out().reg() == V0);
@@ -2077,6 +2079,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeRuntimeEntry,
+ 2,
locs());
// Pop instantiated type.
__ lw(result_reg, Address(SP, 2 * kWordSize));
@@ -2130,6 +2133,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeArgumentsRuntimeEntry,
+ 2,
locs());
// Pop instantiated type arguments.
__ lw(result_reg, Address(SP, 2 * kWordSize));
@@ -2272,6 +2276,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kCloneContextRuntimeEntry,
+ 1,
locs());
__ lw(result, Address(SP, 1 * kWordSize)); // Get result (cloned context).
__ addiu(SP, SP, Immediate(2 * kWordSize));
@@ -2289,7 +2294,8 @@
compiler->AddExceptionHandler(catch_try_index(),
try_index(),
compiler->assembler()->CodeSize(),
- catch_handler_types_);
+ catch_handler_types_,
+ needs_stacktrace());
// Restore pool pointer.
__ GetNextPC(CMPRES, TMP);
const intptr_t object_pool_pc_dist =
@@ -2346,6 +2352,7 @@
compiler->GenerateCallRuntime(instruction_->token_pos(),
instruction_->deopt_id(),
kStackOverflowRuntimeEntry,
+ 0,
instruction_->locs());
if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
@@ -3578,7 +3585,7 @@
}
__ Bind(&do_call);
// double values are passed and returned in vfp registers.
- __ CallRuntime(TargetFunction());
+ __ CallRuntime(TargetFunction(), InputCount());
__ Bind(&skip_call);
}
@@ -3829,6 +3836,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kThrowRuntimeEntry,
+ 1,
locs());
__ break_(0);
}
@@ -3840,9 +3848,11 @@
void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ compiler->SetNeedsStacktrace(catch_try_index());
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kReThrowRuntimeEntry,
+ 2,
locs());
__ break_(0);
}
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index b5cc607..8935d30 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -362,6 +362,7 @@
compiler->GenerateCallRuntime(token_pos,
deopt_id,
kConditionTypeErrorRuntimeEntry,
+ 1,
locs);
// We should never return here.
__ int3();
@@ -1832,7 +1833,7 @@
__ pushq(field_reg);
__ pushq(value_reg);
- __ CallRuntime(kUpdateFieldCidRuntimeEntry);
+ __ CallRuntime(kUpdateFieldCidRuntimeEntry, 2);
__ Drop(2); // Drop the field and the value.
}
@@ -1982,6 +1983,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kAllocateObjectWithBoundsCheckRuntimeEntry,
+ 3,
locs());
__ Drop(3);
ASSERT(locs()->out().reg() == RAX);
@@ -2028,6 +2030,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeRuntimeEntry,
+ 2,
locs());
__ Drop(2); // Drop instantiator and uninstantiated type.
__ popq(result_reg); // Pop instantiated type.
@@ -2075,6 +2078,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kInstantiateTypeArgumentsRuntimeEntry,
+ 2,
locs());
__ Drop(2); // Drop instantiator and uninstantiated type arguments.
__ popq(result_reg); // Pop instantiated type arguments.
@@ -2212,6 +2216,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kCloneContextRuntimeEntry,
+ 1,
locs());
__ popq(result); // Remove argument.
__ popq(result); // Get result (cloned context).
@@ -2229,7 +2234,8 @@
compiler->AddExceptionHandler(catch_try_index(),
try_index(),
compiler->assembler()->CodeSize(),
- catch_handler_types_);
+ catch_handler_types_,
+ needs_stacktrace());
if (HasParallelMove()) {
compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
}
@@ -2278,6 +2284,7 @@
compiler->GenerateCallRuntime(instruction_->token_pos(),
instruction_->deopt_id(),
kStackOverflowRuntimeEntry,
+ 0,
instruction_->locs());
if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
@@ -4297,7 +4304,7 @@
// exp is Nan case is handled correctly in the C-library.
}
__ Bind(&do_call);
- __ CallRuntime(TargetFunction());
+ __ CallRuntime(TargetFunction(), InputCount());
__ movaps(locs()->out().fpu_reg(), XMM0);
__ Bind(&skip_call);
__ leave();
@@ -4552,6 +4559,7 @@
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kThrowRuntimeEntry,
+ 1,
locs());
__ int3();
}
@@ -4563,9 +4571,11 @@
void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ compiler->SetNeedsStacktrace(catch_try_index());
compiler->GenerateCallRuntime(token_pos(),
deopt_id(),
kReThrowRuntimeEntry,
+ 2,
locs());
__ int3();
}
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 137eb9d..05169e6 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -146,7 +146,7 @@
// The following functions are marked as invisible, meaning they will be hidden
-// in the stack trace.
+// in the stack trace and will be hidden from reflective access.
// (Library, class name, method name)
#define INVISIBLE_LIST(V) \
V(CoreLibrary, Object, _noSuchMethod) \
@@ -157,10 +157,10 @@
V(CoreLibrary, TypeError, _throwNew) \
V(CoreLibrary, FallThroughError, _throwNew) \
V(CoreLibrary, AbstractClassInstantiationError, _throwNew) \
- V(CoreLibrary, NoSuchMethodError, _throwNew) \
V(CoreLibrary, int, _throwFormatException) \
V(CoreLibrary, int, _parse) \
V(CoreLibrary, StackTrace, _setupFullStackTrace) \
+ V(CoreLibrary, _OneByteString, _setAt) \
static void MarkFunctionAsInvisible(const Library& lib,
@@ -2349,6 +2349,11 @@
}
+void Class::set_is_mixin_typedef() const {
+ set_state_bits(MixinTypedefBit::update(true, raw_ptr()->state_bits_));
+}
+
+
void Class::set_is_finalized() const {
ASSERT(!is_finalized());
set_state_bits(StateBits::update(RawClass::kFinalized,
@@ -6714,15 +6719,19 @@
RawObject* Library::LookupExport(const String& name) const {
if (HasExports()) {
const Array& exports = Array::Handle(this->exports());
+ // Break potential export cycle while looking up name.
+ StorePointer(&raw_ptr()->exports_, Object::empty_array().raw());
Namespace& ns = Namespace::Handle();
Object& obj = Object::Handle();
for (int i = 0; i < exports.Length(); i++) {
ns ^= exports.At(i);
obj = ns.Lookup(name);
if (!obj.IsNull()) {
- return obj.raw();
+ break;
}
}
+ StorePointer(&raw_ptr()->exports_, exports.raw());
+ return obj.raw();
}
return Object::null();
}
@@ -7237,6 +7246,20 @@
}
+RawObject* Library::Evaluate(const String& expr) const {
+ // Make a fake top-level class and evaluate the expression
+ // as a static function of the class.
+ Script& script = Script::Handle();
+ script = Script::New(Symbols::Empty(),
+ Symbols::Empty(),
+ RawScript::kSourceTag);
+ Class& temp_class =
+ Class::Handle(Class::New(Symbols::TopLevel(), script, 0));
+ temp_class.set_library(*this);
+ return temp_class.Evaluate(expr);
+}
+
+
void Library::InitNativeWrappersLibrary(Isolate* isolate) {
static const int kNumNativeWrappersClasses = 4;
ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10);
@@ -8117,8 +8140,7 @@
intptr_t payload_size =
Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
if ((payload_size < 0) ||
- (payload_size >
- (kSmiMax - static_cast<intptr_t>(sizeof(RawStackmap))))) {
+ (payload_size > kMaxLengthInBytes)) {
// This should be caught before we reach here.
FATAL1("Fatal error in Stackmap::New: invalid length %" Pd "\n",
length);
@@ -8284,21 +8306,23 @@
void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
intptr_t outer_try_index,
- intptr_t handler_pc) const {
+ intptr_t handler_pc,
+ bool needs_stacktrace,
+ bool has_catch_all) const {
ASSERT((try_index >= 0) && (try_index < Length()));
RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data_[try_index];
info->outer_try_index = outer_try_index;
info->handler_pc = handler_pc;
+ info->needs_stacktrace = needs_stacktrace;
+ info->has_catch_all = has_catch_all;
}
void ExceptionHandlers::GetHandlerInfo(
- intptr_t try_index,
- RawExceptionHandlers::HandlerInfo* info) const {
+ intptr_t try_index,
+ RawExceptionHandlers::HandlerInfo* info) const {
ASSERT((try_index >= 0) && (try_index < Length()));
ASSERT(info != NULL);
- RawExceptionHandlers::HandlerInfo* data = &raw_ptr()->data_[try_index];
- info->outer_try_index = data->outer_try_index;
- info->handler_pc = data->handler_pc;
+ *info = raw_ptr()->data_[try_index];
}
@@ -8314,6 +8338,18 @@
}
+bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const {
+ ASSERT((try_index >= 0) && (try_index < Length()));
+ return raw_ptr()->data_[try_index].needs_stacktrace;
+}
+
+
+bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
+ ASSERT((try_index >= 0) && (try_index < Length()));
+ return raw_ptr()->data_[try_index].has_catch_all;
+}
+
+
void ExceptionHandlers::SetHandledTypes(intptr_t try_index,
const Array& handled_types) const {
ASSERT((try_index >= 0) && (try_index < Length()));
@@ -8338,7 +8374,7 @@
RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) {
ASSERT(Object::exception_handlers_class() != Class::null());
- if (num_handlers < 0 || num_handlers >= kMaxHandlers) {
+ if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) {
FATAL1("Fatal error in ExceptionHandlers::New(): "
"invalid num_handlers %" Pd "\n",
num_handlers);
@@ -8521,6 +8557,10 @@
RawDeoptInfo* DeoptInfo::New(intptr_t num_commands) {
ASSERT(Object::deopt_info_class() != Class::null());
+ if ((num_commands < 0) || (num_commands > kMaxElements)) {
+ FATAL1("Fatal error in DeoptInfo::New(): invalid num_commands %" Pd "\n",
+ num_commands);
+ }
DeoptInfo& result = DeoptInfo::Handle();
{
uword size = DeoptInfo::InstanceSize(num_commands);
@@ -8603,6 +8643,21 @@
}
+void Code::set_state_bits(intptr_t bits) const {
+ raw_ptr()->state_bits_ = bits;
+}
+
+
+void Code::set_is_optimized(bool value) const {
+ set_state_bits(OptimizedBit::update(value, raw_ptr()->state_bits_));
+}
+
+
+void Code::set_is_alive(bool value) const {
+ set_state_bits(AliveBit::update(value, raw_ptr()->state_bits_));
+}
+
+
void Code::set_stackmaps(const Array& maps) const {
ASSERT(maps.IsOld());
StorePointer(&raw_ptr()->stackmaps_, maps.raw());
@@ -14320,13 +14375,11 @@
RawTypedData* TypedData::New(intptr_t class_id,
intptr_t len,
Heap::Space space) {
- // TODO(asiva): Add a check for maximum elements.
+ if (len < 0 || len > TypedData::MaxElements(class_id)) {
+ FATAL1("Fatal error in TypedData::New: invalid len %" Pd "\n", len);
+ }
TypedData& result = TypedData::Handle();
{
- // The len field has already been checked by the caller, we only assert
- // here that it is within a valid range.
- ASSERT((len >= 0) &&
- (len < (kSmiMax / TypedData::ElementSizeInBytes(class_id))));
intptr_t lengthInBytes = len * ElementSizeInBytes(class_id);
RawObject* raw = Object::Allocate(class_id,
TypedData::InstanceSize(lengthInBytes),
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 79cd964..4728639 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -922,6 +922,11 @@
bool is_const() const { return ConstBit::decode(raw_ptr()->state_bits_); }
void set_is_const() const;
+ bool is_mixin_typedef() const {
+ return MixinTypedefBit::decode(raw_ptr()->state_bits_);
+ }
+ void set_is_mixin_typedef() const;
+
int num_native_fields() const {
return raw_ptr()->num_native_fields_;
}
@@ -1017,6 +1022,7 @@
kStateTagBit = 6,
kStateTagSize = 2,
kMarkedForParsingBit = 8,
+ kMixinTypedefBit = 9,
};
class ConstBit : public BitField<bool, kConstBit, 1> {};
class ImplementedBit : public BitField<bool, kImplementedBit, 1> {};
@@ -1027,6 +1033,7 @@
class StateBits : public BitField<RawClass::ClassState,
kStateTagBit, kStateTagSize> {}; // NOLINT
class MarkedForParsingBit : public BitField<bool, kMarkedForParsingBit, 1> {};
+ class MixinTypedefBit : public BitField<bool, kMixinTypedefBit, 1> {};
void set_name(const String& value) const;
void set_signature_function(const Function& value) const;
@@ -2343,6 +2350,8 @@
static RawLibrary* New(const String& url);
+ RawObject* Evaluate(const String& expr) const;
+
// Library scope name dictionary.
//
// TODO(turnidge): The Lookup functions are not consistent in how
@@ -2816,13 +2825,17 @@
intptr_t HandlerPC(intptr_t try_index) const;
intptr_t OuterTryIndex(intptr_t try_index) const;
+ bool NeedsStacktrace(intptr_t try_index) const;
void SetHandlerInfo(intptr_t try_index,
intptr_t outer_try_index,
- intptr_t handler_pc) const;
+ intptr_t handler_pc,
+ bool needs_stacktrace,
+ bool has_catch_all) const;
RawArray* GetHandledTypes(intptr_t try_index) const;
void SetHandledTypes(intptr_t try_index, const Array& handled_types) const;
+ bool HasCatchAll(intptr_t try_index) const;
static intptr_t InstanceSize() {
ASSERT(sizeof(RawExceptionHandlers) == OFFSET_OF(RawExceptionHandlers,
@@ -2940,18 +2953,15 @@
intptr_t pointer_offsets_length() const {
return raw_ptr()->pointer_offsets_length_;
}
+
bool is_optimized() const {
- return (raw_ptr()->is_optimized_ == 1);
+ return OptimizedBit::decode(raw_ptr()->state_bits_);
}
- void set_is_optimized(bool value) const {
- raw_ptr()->is_optimized_ = value ? 1 : 0;
- }
+ void set_is_optimized(bool value) const;
bool is_alive() const {
- return (raw_ptr()->is_alive_ == 1);
+ return AliveBit::decode(raw_ptr()->state_bits_);
}
- void set_is_alive(bool value) const {
- raw_ptr()->is_alive_ = value ? 1 : 0;
- }
+ void set_is_alive(bool value) const;
uword EntryPoint() const {
const Instructions& instr = Instructions::Handle(instructions());
@@ -3123,6 +3133,17 @@
RawArray* ExtractTypeFeedbackArray() const;
private:
+ void set_state_bits(intptr_t bits) const;
+
+ friend class RawCode;
+ enum {
+ kOptimizedBit = 0,
+ kAliveBit = 1,
+ };
+
+ class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {};
+ class AliveBit : public BitField<bool, kAliveBit, 1> {};
+
// An object finder visitor interface.
class FindRawCodeVisitor : public FindObjectVisitor {
public:
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 61d9cbd..8158e58 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -2385,10 +2385,12 @@
// Add an exception handler table to the code.
ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle();
exception_handlers ^= ExceptionHandlers::New(kNumEntries);
- exception_handlers.SetHandlerInfo(0, -1, 20);
- exception_handlers.SetHandlerInfo(1, 0, 30);
- exception_handlers.SetHandlerInfo(2, -1, 40);
- exception_handlers.SetHandlerInfo(3, 1, 150);
+ const bool kNeedsStacktrace = true;
+ const bool kNoStacktrace = false;
+ exception_handlers.SetHandlerInfo(0, -1, 20, kNeedsStacktrace, false);
+ exception_handlers.SetHandlerInfo(1, 0, 30, kNeedsStacktrace, false);
+ exception_handlers.SetHandlerInfo(2, -1, 40, kNoStacktrace, true);
+ exception_handlers.SetHandlerInfo(3, 1, 150, kNoStacktrace, true);
extern void GenerateIncrement(Assembler* assembler);
Assembler _assembler_;
@@ -2406,9 +2408,13 @@
EXPECT_EQ(-1, handlers.OuterTryIndex(0));
EXPECT_EQ(-1, info.outer_try_index);
EXPECT_EQ(20, handlers.HandlerPC(0));
+ EXPECT(handlers.NeedsStacktrace(0));
+ EXPECT(!handlers.HasCatchAll(0));
EXPECT_EQ(20, info.handler_pc);
EXPECT_EQ(1, handlers.OuterTryIndex(3));
EXPECT_EQ(150, handlers.HandlerPC(3));
+ EXPECT(!handlers.NeedsStacktrace(3));
+ EXPECT(handlers.HasCatchAll(3));
}
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index e5e13fc..447c7bb 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -762,19 +762,6 @@
}
-static bool IsInvisible(const Function& func) {
- if (!Library::IsPrivate(String::Handle(func.name()))) return false;
- // Check for private function in the core libraries.
- const Class& cls = Class::Handle(func.Owner());
- const Library& library = Library::Handle(cls.library());
- if (library.raw() == Library::CoreLibrary()) return true;
- if (library.raw() == Library::CollectionLibrary()) return true;
- if (library.raw() == Library::TypedDataLibrary()) return true;
- if (library.raw() == Library::MathLibrary()) return true;
- return false;
-}
-
-
RawObject* Parser::ParseFunctionParameters(const Function& func) {
ASSERT(!func.IsNull());
Isolate* isolate = Isolate::Current();
@@ -823,8 +810,6 @@
ASSERT(isolate->long_jump_base()->IsSafeToJump());
ASSERT(parsed_function != NULL);
const Function& func = parsed_function->function();
- // Mark private core library functions as invisible by default.
- if (IsInvisible(func)) func.set_is_visible(false);
const Script& script = Script::Handle(isolate, func.script());
Parser parser(script, parsed_function, func.token_pos());
SequenceNode* node_sequence = NULL;
@@ -2818,6 +2803,7 @@
ThrowNoSuchMethodError(TokenPos(),
current_class(),
function_name,
+ NULL, // No arguments.
func.is_static() ?
InvocationMirror::kStatic :
InvocationMirror::kDynamic,
@@ -3883,6 +3869,7 @@
}
const Class& mixin_application =
Class::Handle(Class::New(class_name, script_, classname_pos));
+ mixin_application.set_is_mixin_typedef();
library_.AddClass(mixin_application);
set_current_class(mixin_application);
ParseTypeParameters(mixin_application);
@@ -3909,8 +3896,9 @@
}
type = ParseMixins(type);
- // TODO(hausner): treat the mixin application as an alias, not as a base
- // class whose super class is the mixin application!
+ // TODO(12773): Treat the mixin application as an alias, not as a base
+ // class whose super class is the mixin application! This is difficult because
+ // of issues involving subsitution of type parameters
mixin_application.set_super_type(type);
mixin_application.set_is_synthesized_class();
@@ -3918,6 +3906,9 @@
// too early to call 'AddImplicitConstructor(mixin_application)' here,
// because this class should be lazily compiled.
if (CurrentToken() == Token::kIMPLEMENTS) {
+ // At this point, the mixin_application alias already has an interface, but
+ // ParseInterfaceList will add to the list and not lose the one already
+ // there.
ParseInterfaceList(mixin_application);
}
ExpectSemicolon();
@@ -6554,6 +6545,7 @@
current_block_->scope->AddLabel(end_catch_label);
const GrowableObjectArray& handler_types =
GrowableObjectArray::Handle(GrowableObjectArray::New());
+ bool needs_stacktrace = false;
while ((CurrentToken() == Token::kCATCH) || IsLiteral("on")) {
const intptr_t catch_pos = TokenPos();
CatchParamDesc exception_param;
@@ -6614,6 +6606,7 @@
// A stack trace variable is specified in this block, so generate code
// to load the stack trace object (:stacktrace_var) into the stack trace
// variable specified in this block.
+ needs_stacktrace = true;
ArgumentListNode* no_args = new ArgumentListNode(catch_pos);
LocalVariable* trace = LookupLocalScope(*stack_trace_param.var);
ASSERT(catch_trace_var != NULL);
@@ -6679,9 +6672,9 @@
}
catch_handler_list = CloseBlock();
TryBlocks* inner_try_block = PopTryBlock();
- intptr_t try_index = inner_try_block->try_index();
+ const intptr_t try_index = inner_try_block->try_index();
TryBlocks* outer_try_block = try_blocks_list_;
- intptr_t outer_try_index = (outer_try_block != NULL)
+ const intptr_t outer_try_index = (outer_try_block != NULL)
? outer_try_block->try_index()
: CatchClauseNode::kInvalidTryIndex;
@@ -6730,7 +6723,8 @@
catch_trace_var,
(finally_block != NULL)
? AllocateTryIndex()
- : CatchClauseNode::kInvalidTryIndex);
+ : CatchClauseNode::kInvalidTryIndex,
+ needs_stacktrace);
// Now create the try/catch ast node and return it. If there is a label
// on the try/catch, close the block that's embedding the try statement
@@ -7200,13 +7194,10 @@
}
-// TODO(regis): Providing the argument values is not always feasible, since
-// evaluating them could throw an error.
-// Should NoSuchMethodError reflect the argument count and names instead of
-// argument values? Or should the spec specify a different evaluation order?
AstNode* Parser::ThrowNoSuchMethodError(intptr_t call_pos,
const Class& cls,
const String& function_name,
+ ArgumentListNode* function_arguments,
InvocationMirror::Call im_call,
InvocationMirror::Type im_type) {
ArgumentListNode* arguments = new ArgumentListNode(call_pos);
@@ -7230,15 +7221,25 @@
arguments->Add(new LiteralNode(call_pos, Smi::ZoneHandle(
Smi::New(InvocationMirror::EncodeType(im_call, im_type)))));
// List arguments.
- arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
+ if (function_arguments == NULL) {
+ arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
+ } else {
+ ArrayNode* array = new ArrayNode(call_pos,
+ Type::ZoneHandle(Type::ArrayType()),
+ function_arguments->nodes());
+ arguments->Add(array);
+ }
// List argumentNames.
- arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
+ if (function_arguments == NULL) {
+ arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
+ } else {
+ arguments->Add(new LiteralNode(call_pos, function_arguments->names()));
+ }
// List existingArgumentNames.
// Check if there exists a function with the same name.
Function& function =
Function::Handle(cls.LookupStaticFunction(function_name));
if (function.IsNull()) {
- // TODO(srdjan): Store argument values into the argument list.
arguments->Add(new LiteralNode(call_pos, Array::ZoneHandle()));
} else {
const int total_num_parameters = function.NumParameters();
@@ -7538,6 +7539,7 @@
result = ThrowNoSuchMethodError(original->token_pos(),
current_class(),
name,
+ NULL, // No arguments.
InvocationMirror::kStatic,
InvocationMirror::kSetter);
} else if (result->IsStoreIndexedNode() ||
@@ -7742,7 +7744,7 @@
arguments = implicit_arguments;
}
const GrowableObjectArray& names =
- GrowableObjectArray::Handle(GrowableObjectArray::New());
+ GrowableObjectArray::Handle(GrowableObjectArray::New(Heap::kOld));
bool named_argument_seen = false;
if (LookaheadToken(1) != Token::kRPAREN) {
String& arg_name = String::Handle();
@@ -7831,6 +7833,7 @@
return ThrowNoSuchMethodError(ident_pos,
cls,
func_name,
+ arguments,
InvocationMirror::kStatic,
InvocationMirror::kMethod);
} else if (cls.IsTopLevel() &&
@@ -7931,6 +7934,7 @@
return ThrowNoSuchMethodError(ident_pos,
cls,
field_name,
+ NULL, // No arguments.
InvocationMirror::kStatic,
InvocationMirror::kField);
}
@@ -7975,6 +7979,7 @@
return ThrowNoSuchMethodError(ident_pos,
cls,
field_name,
+ NULL, // No arguments.
InvocationMirror::kStatic,
InvocationMirror::kGetter);
}
@@ -8014,6 +8019,7 @@
return ThrowNoSuchMethodError(primary->token_pos(),
current_class(),
name,
+ NULL, // No arguments.
InvocationMirror::kStatic,
InvocationMirror::kField);
} else {
@@ -8185,6 +8191,7 @@
selector = ThrowNoSuchMethodError(primary->token_pos(),
current_class(),
name,
+ NULL, // No arguments.
InvocationMirror::kStatic,
InvocationMirror::kMethod);
} else {
@@ -8198,6 +8205,7 @@
selector = ThrowNoSuchMethodError(primary->token_pos(),
current_class(),
name,
+ NULL, // No arguments.
InvocationMirror::kStatic,
InvocationMirror::kMethod);
} else if (primary->primary().IsClass()) {
@@ -9096,6 +9104,7 @@
resolved = ThrowNoSuchMethodError(ident_pos,
current_class(),
ident,
+ NULL, // No arguments.
InvocationMirror::kStatic,
InvocationMirror::kField);
} else {
@@ -9753,6 +9762,7 @@
return ThrowNoSuchMethodError(call_pos,
type_class,
external_constructor_name,
+ arguments,
InvocationMirror::kConstructor,
InvocationMirror::kMethod);
} else if (constructor.IsRedirectingFactory()) {
@@ -9820,6 +9830,7 @@
return ThrowNoSuchMethodError(call_pos,
type_class,
external_constructor_name,
+ arguments,
InvocationMirror::kConstructor,
InvocationMirror::kMethod);
}
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index e5e53ec..f729cc9 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -636,6 +636,7 @@
AstNode* ThrowNoSuchMethodError(intptr_t call_pos,
const Class& cls,
const String& function_name,
+ ArgumentListNode* function_arguments,
InvocationMirror::Call call,
InvocationMirror::Type type);
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index 2ec7137..c003f6e 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -429,7 +429,7 @@
RawCode* obj = raw_obj->ptr();
intptr_t length = obj->pointer_offsets_length_;
- if (obj->is_alive_ == 1) {
+ if (Code::AliveBit::decode(obj->state_bits_)) {
// Also visit all the embedded pointers in the corresponding instructions.
uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) +
Instructions::HeaderSize();
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 1be013c..1746366 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -837,11 +837,10 @@
}
intptr_t pointer_offsets_length_;
- // These fields cannot be boolean because of alignment issues on x64
+ // Alive: If true, the embedded object pointers will be visited during GC.
+ // This field cannot be shorter because of alignment issues on x64
// architectures.
- intptr_t is_optimized_;
- // If true, the embedded object pointers will be visited during GC.
- intptr_t is_alive_;
+ intptr_t state_bits_; // state, is_optimized, is_alive.
// Variable length data follows here.
int32_t data_[0];
@@ -943,8 +942,10 @@
// The index into the ExceptionHandlers table corresponds to
// the try_index of the handler.
struct HandlerInfo {
- intptr_t outer_try_index; // Try block index of enclosing try block.
intptr_t handler_pc; // PC value of handler.
+ int16_t outer_try_index; // Try block index of enclosing try block.
+ int8_t needs_stacktrace; // True if a stacktrace is needed.
+ int8_t has_catch_all; // Catches all exceptions.
};
private:
RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers);
diff --git a/runtime/vm/runtime_entry.h b/runtime/vm/runtime_entry.h
index 5cdcf9b..3bb1dde 100644
--- a/runtime/vm/runtime_entry.h
+++ b/runtime/vm/runtime_entry.h
@@ -23,7 +23,7 @@
class RuntimeEntry : public ValueObject {
public:
RuntimeEntry(const char* name, RuntimeFunction function,
- int argument_count, bool is_leaf, bool is_float)
+ intptr_t argument_count, bool is_leaf, bool is_float)
: name_(name),
function_(function),
argument_count_(argument_count),
@@ -33,18 +33,18 @@
const char* name() const { return name_; }
RuntimeFunction function() const { return function_; }
- int argument_count() const { return argument_count_; }
+ intptr_t argument_count() const { return argument_count_; }
bool is_leaf() const { return is_leaf_; }
bool is_float() const { return is_float_; }
uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); }
// Generate code to call the runtime entry.
- void Call(Assembler* assembler) const;
+ void Call(Assembler* assembler, intptr_t argument_count) const;
private:
const char* name_;
const RuntimeFunction function_;
- const int argument_count_;
+ const intptr_t argument_count_;
const bool is_leaf_;
const bool is_float_;
@@ -62,6 +62,7 @@
void DRT_##name(NativeArguments arguments) { \
CHECK_STACK_ALIGNMENT; \
VERIFY_ON_TRANSITION; \
+ ASSERT(arguments.ArgCount() == argument_count); \
if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \
{ \
StackZone zone(arguments.isolate()); \
diff --git a/runtime/vm/runtime_entry_arm.cc b/runtime/vm/runtime_entry_arm.cc
index 347e952..3acf589 100644
--- a/runtime/vm/runtime_entry_arm.cc
+++ b/runtime/vm/runtime_entry_arm.cc
@@ -21,7 +21,7 @@
// SP : points to the arguments and return value array.
// R5 : address of the runtime function to call.
// R4 : number of arguments to the call.
-void RuntimeEntry::Call(Assembler* assembler) const {
+void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
// Compute the effective address. When running under the simulator,
// this is a redirection address that forces the simulator to call
// into the runtime system.
@@ -29,23 +29,26 @@
#if defined(USING_SIMULATOR)
// Redirection to leaf runtime calls supports a maximum of 4 arguments passed
// in registers (maximum 2 double arguments for leaf float runtime calls).
- ASSERT(argument_count() >= 0);
+ ASSERT(argument_count >= 0);
ASSERT(!is_leaf() ||
- (!is_float() && (argument_count() <= 4)) ||
- (argument_count() <= 2));
+ (!is_float() && (argument_count <= 4)) ||
+ (argument_count <= 2));
Simulator::CallKind call_kind =
is_leaf() ? (is_float() ? Simulator::kLeafFloatRuntimeCall
: Simulator::kLeafRuntimeCall)
: Simulator::kRuntimeCall;
entry =
- Simulator::RedirectExternalReference(entry, call_kind, argument_count());
+ Simulator::RedirectExternalReference(entry, call_kind, argument_count);
#endif
if (is_leaf()) {
+ ASSERT(argument_count == this->argument_count());
ExternalLabel label(name(), entry);
__ BranchLink(&label);
} else {
+ // Argument count is not checked here, but in the runtime entry for a more
+ // informative error message.
__ LoadImmediate(R5, entry);
- __ LoadImmediate(R4, argument_count());
+ __ LoadImmediate(R4, argument_count);
__ BranchLink(&StubCode::CallToRuntimeLabel());
}
}
diff --git a/runtime/vm/runtime_entry_ia32.cc b/runtime/vm/runtime_entry_ia32.cc
index e0f6a59..942fad9 100644
--- a/runtime/vm/runtime_entry_ia32.cc
+++ b/runtime/vm/runtime_entry_ia32.cc
@@ -23,14 +23,17 @@
// EDX : number of arguments to the call.
// For leaf calls the caller is responsible to setup the arguments
// and look for return values based on the C calling convention.
-void RuntimeEntry::Call(Assembler* assembler) const {
- if (!is_leaf()) {
- __ movl(ECX, Immediate(GetEntryPoint()));
- __ movl(EDX, Immediate(argument_count()));
- __ call(&StubCode::CallToRuntimeLabel());
- } else {
+void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
+ if (is_leaf()) {
+ ASSERT(argument_count == this->argument_count());
ExternalLabel label(name(), GetEntryPoint());
__ call(&label);
+ } else {
+ // Argument count is not checked here, but in the runtime entry for a more
+ // informative error message.
+ __ movl(ECX, Immediate(GetEntryPoint()));
+ __ movl(EDX, Immediate(argument_count));
+ __ call(&StubCode::CallToRuntimeLabel());
}
}
diff --git a/runtime/vm/runtime_entry_mips.cc b/runtime/vm/runtime_entry_mips.cc
index f9d2b2f..320b7e9 100644
--- a/runtime/vm/runtime_entry_mips.cc
+++ b/runtime/vm/runtime_entry_mips.cc
@@ -21,7 +21,7 @@
// SP : points to the arguments and return value array.
// S5 : address of the runtime function to call.
// S4 : number of arguments to the call.
-void RuntimeEntry::Call(Assembler* assembler) const {
+void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
// Compute the effective address. When running under the simulator,
// this is a redirection address that forces the simulator to call
// into the runtime system.
@@ -29,23 +29,26 @@
#if defined(USING_SIMULATOR)
// Redirection to leaf runtime calls supports a maximum of 4 arguments passed
// in registers (maximum 2 double arguments for leaf float runtime calls).
- ASSERT(argument_count() >= 0);
+ ASSERT(argument_count >= 0);
ASSERT(!is_leaf() ||
- (!is_float() && (argument_count() <= 4)) ||
- (argument_count() <= 2));
+ (!is_float() && (argument_count <= 4)) ||
+ (argument_count <= 2));
Simulator::CallKind call_kind =
is_leaf() ? (is_float() ? Simulator::kLeafFloatRuntimeCall
: Simulator::kLeafRuntimeCall)
: Simulator::kRuntimeCall;
entry =
- Simulator::RedirectExternalReference(entry, call_kind, argument_count());
+ Simulator::RedirectExternalReference(entry, call_kind, argument_count);
#endif
if (is_leaf()) {
+ ASSERT(argument_count == this->argument_count());
ExternalLabel label(name(), entry);
__ BranchLink(&label);
} else {
+ // Argument count is not checked here, but in the runtime entry for a more
+ // informative error message.
__ LoadImmediate(S5, entry);
- __ LoadImmediate(S4, argument_count());
+ __ LoadImmediate(S4, argument_count);
__ BranchLink(&StubCode::CallToRuntimeLabel());
}
}
diff --git a/runtime/vm/runtime_entry_test.cc b/runtime/vm/runtime_entry_test.cc
index cfd24c9..138bea7 100644
--- a/runtime/vm/runtime_entry_test.cc
+++ b/runtime/vm/runtime_entry_test.cc
@@ -36,7 +36,6 @@
// Arg1: a smi.
// Result: a smi representing arg0 - arg1.
DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) {
- ASSERT(arguments.ArgCount() == kTestSmiSubRuntimeEntry.argument_count());
const Smi& left = Smi::CheckedHandle(arguments.ArgAt(0));
const Smi& right = Smi::CheckedHandle(arguments.ArgAt(1));
// Ignoring overflow in the calculation below.
diff --git a/runtime/vm/runtime_entry_x64.cc b/runtime/vm/runtime_entry_x64.cc
index 346a77c..13fa2a1 100644
--- a/runtime/vm/runtime_entry_x64.cc
+++ b/runtime/vm/runtime_entry_x64.cc
@@ -20,14 +20,17 @@
// RSP : points to the arguments and return value array.
// RBX : address of the runtime function to call.
// R10 : number of arguments to the call.
-void RuntimeEntry::Call(Assembler* assembler) const {
- if (!is_leaf()) {
- __ movq(RBX, Immediate(GetEntryPoint()));
- __ movq(R10, Immediate(argument_count()));
- __ call(&StubCode::CallToRuntimeLabel());
- } else {
+void RuntimeEntry::Call(Assembler* assembler, intptr_t argument_count) const {
+ if (is_leaf()) {
+ ASSERT(argument_count == this->argument_count());
ExternalLabel label(name(), GetEntryPoint());
__ call(&label);
+ } else {
+ // Argument count is not checked here, but in the runtime entry for a more
+ // informative error message.
+ __ movq(RBX, Immediate(GetEntryPoint()));
+ __ movq(R10, Immediate(argument_count));
+ __ call(&StubCode::CallToRuntimeLabel());
}
}
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index 0a97d0b..fd9a5c9 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -154,22 +154,33 @@
}
-bool StackFrame::FindExceptionHandler(uword* handler_pc) const {
- const Code& code = Code::Handle(LookupDartCode());
+bool StackFrame::FindExceptionHandler(uword* handler_pc,
+ bool* needs_stacktrace,
+ bool* has_catch_all) const {
+ Isolate* isolate = Isolate::Current();
+ Code& code = Code::Handle(isolate, LookupDartCode());
if (code.IsNull()) {
return false; // Stub frames do not have exception handlers.
}
+ ExceptionHandlers& handlers =
+ ExceptionHandlers::Handle(isolate, code.exception_handlers());
+ if (handlers.Length() == 0) {
+ return false;
+ }
// Find pc descriptor for the current pc.
const PcDescriptors& descriptors =
- PcDescriptors::Handle(code.pc_descriptors());
- for (intptr_t i = 0; i < descriptors.Length(); i++) {
+ PcDescriptors::Handle(isolate, code.pc_descriptors());
+ const intptr_t len = descriptors.Length();
+ for (intptr_t i = 0; i < len; i++) {
if ((static_cast<uword>(descriptors.PC(i)) == pc()) &&
(descriptors.TryIndex(i) != -1)) {
const intptr_t try_index = descriptors.TryIndex(i);
- const ExceptionHandlers& handlers =
- ExceptionHandlers::Handle(code.exception_handlers());
- *handler_pc = handlers.HandlerPC(try_index);
+ RawExceptionHandlers::HandlerInfo handler_info;
+ handlers.GetHandlerInfo(try_index, &handler_info);
+ *handler_pc = handler_info.handler_pc;
+ *needs_stacktrace = handler_info.needs_stacktrace;
+ *has_catch_all = handler_info.has_catch_all;
return true;
}
}
diff --git a/runtime/vm/stack_frame.h b/runtime/vm/stack_frame.h
index e32f242..83a93e5 100644
--- a/runtime/vm/stack_frame.h
+++ b/runtime/vm/stack_frame.h
@@ -71,7 +71,9 @@
RawFunction* LookupDartFunction() const;
RawCode* LookupDartCode() const;
- bool FindExceptionHandler(uword* handler_pc) const;
+ bool FindExceptionHandler(uword* handler_pc,
+ bool* needs_stacktrace,
+ bool* is_catch_all) const;
// Returns token_pos of the pc(), or -1 if none exists.
intptr_t GetTokenPos() const;
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index b101db7..111c91a 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -113,7 +113,7 @@
void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) {
__ EnterCallRuntimeFrame(0);
// Call the runtime leaf function. R0 already contains the parameter.
- __ CallRuntime(kPrintStopMessageRuntimeEntry);
+ __ CallRuntime(kPrintStopMessageRuntimeEntry, 1);
__ LeaveCallRuntimeFrame();
__ Ret();
}
@@ -291,7 +291,7 @@
// Setup space on stack for return value and preserve arguments descriptor.
__ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
__ PushList((1 << R0) | (1 << R4));
- __ CallRuntime(kPatchStaticCallRuntimeEntry);
+ __ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
// Get Code object result and restore arguments descriptor array.
__ PopList((1 << R0) | (1 << R4));
// Remove the stub frame.
@@ -313,7 +313,7 @@
// Setup space on stack for return value and preserve arguments descriptor.
__ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
__ PushList((1 << R0) | (1 << R4));
- __ CallRuntime(kFixCallersTargetRuntimeEntry);
+ __ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
// Get Code object result and restore arguments descriptor array.
__ PopList((1 << R0) | (1 << R4));
// Remove the stub frame.
@@ -377,7 +377,7 @@
// R2: Smi-tagged arguments array length.
PushArgumentsArray(assembler);
- __ CallRuntime(kInstanceFunctionLookupRuntimeEntry);
+ __ CallRuntime(kInstanceFunctionLookupRuntimeEntry, 4);
// Remove arguments.
__ Drop(4);
@@ -447,7 +447,7 @@
__ mov(R0, ShifterOperand(SP)); // Pass address of saved registers block.
__ ReserveAlignedFrameSpace(0);
- __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
+ __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry, 1);
// Result (R0) is stack-size (FP - SP) in bytes.
if (preserve_result) {
@@ -468,7 +468,7 @@
__ Push(R1); // Preserve result as first local.
}
__ ReserveAlignedFrameSpace(0);
- __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry); // Pass last FP in R0.
+ __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry, 1); // Pass last FP in R0.
if (preserve_result) {
// Restore result into R1.
__ ldr(R1, Address(FP, kFirstLocalSlotFromFp * kWordSize));
@@ -484,7 +484,7 @@
__ Push(R1); // Preserve result, it will be GC-d here.
}
__ PushObject(Smi::ZoneHandle()); // Space for the result.
- __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry);
+ __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0);
// Result tells stub how many bytes to remove from the expression stack
// of the bottom-most frame. They were used as materialization arguments.
__ Pop(R1);
@@ -528,7 +528,7 @@
// Push arguments descriptor array.
__ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
__ PushList((1 << R4) | (1 << R5) | (1 << R6) | (1 << IP));
- __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3);
// Remove arguments.
__ Drop(3);
__ Pop(R0); // Get result into R0.
@@ -667,7 +667,7 @@
// Setup space on stack for return value.
// Push array length as Smi and element type.
__ PushList((1 << R1) | (1 << R2) | (1 << IP));
- __ CallRuntime(kAllocateArrayRuntimeEntry);
+ __ CallRuntime(kAllocateArrayRuntimeEntry, 2);
// Pop arguments; result is popped in IP.
__ PopList((1 << R1) | (1 << R2) | (1 << IP)); // R2 is restored.
__ mov(R0, ShifterOperand(IP));
@@ -724,7 +724,7 @@
// Preserve arguments descriptor array and read-only function object argument.
__ PushList((1 << R2) | (1 << R4));
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
// Restore arguments descriptor array and read-only function object argument.
__ PopList((1 << R2) | (1 << R4));
// Restore R0.
@@ -759,7 +759,7 @@
__ ldr(R2, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
PushArgumentsArray(assembler);
- __ CallRuntime(kInvokeNonClosureRuntimeEntry);
+ __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2);
// Remove arguments.
__ Drop(2);
__ Pop(R0); // Get result into R0.
@@ -982,7 +982,7 @@
__ LoadImmediate(R2, reinterpret_cast<intptr_t>(Object::null()));
__ SmiTag(R1);
__ PushList((1 << R1) | (1 << R2));
- __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context.
+ __ CallRuntime(kAllocateContextRuntimeEntry, 1); // Allocate context.
__ Drop(1); // Pop number of context variables argument.
__ Pop(R0); // Pop the new context object.
// R0: new object
@@ -1047,7 +1047,7 @@
__ EnterCallRuntimeFrame(0 * kWordSize);
__ ldr(R0, FieldAddress(CTX, Context::isolate_offset()));
- __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry);
+ __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
// Restore callee-saved registers, tear down frame.
__ LeaveCallRuntimeFrame();
__ Ret();
@@ -1212,7 +1212,7 @@
__ LoadImmediate(R1, Smi::RawValue(StubCode::kNoInstantiator));
__ PushList((1 << R1) | (1 << R2));
}
- __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object.
+ __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object.
__ Drop(3); // Pop arguments.
__ Pop(R0); // Pop result (newly allocated object).
// R0: new object
@@ -1345,11 +1345,11 @@
__ Push(R0); // Push type arguments of closure to be allocated or null.
if (is_implicit_instance_closure) {
- __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry);
+ __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry, 3);
__ Drop(2); // Pop arguments (type arguments of object and receiver).
} else {
ASSERT(func.IsNonImplicitClosureFunction());
- __ CallRuntime(kAllocateClosureRuntimeEntry);
+ __ CallRuntime(kAllocateClosureRuntimeEntry, 2);
__ Drop(1); // Pop argument (type arguments of object).
}
__ Drop(1); // Pop function object.
@@ -1387,7 +1387,7 @@
// R2: Smi-tagged arguments array length.
PushArgumentsArray(assembler);
- __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry);
+ __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry, 4);
// Remove arguments.
__ Drop(4);
__ Pop(R0); // Get result into R0.
@@ -1408,7 +1408,7 @@
__ PushList((1 << R5) | (1 << R6)); // Preserve.
__ Push(ic_reg); // Argument.
__ Push(func_reg); // Argument.
- __ CallRuntime(kTraceICCallRuntimeEntry);
+ __ CallRuntime(kTraceICCallRuntimeEntry, 2);
__ Drop(2); // Discard argument;
__ PopList((1 << R5) | (1 << R6)); // Restore.
__ LeaveStubFrame();
@@ -1467,7 +1467,7 @@
__ b(¬_stepping, EQ);
__ EnterStubFrame();
__ Push(R5); // Preserve IC data.
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ Pop(R5);
__ LeaveStubFrame();
__ Bind(¬_stepping);
@@ -1552,7 +1552,7 @@
}
// Pass IC data object.
__ Push(R5);
- __ CallRuntime(handle_ic_miss);
+ __ CallRuntime(handle_ic_miss, num_args + 1);
// Remove the call arguments pushed earlier, including the IC data object.
__ Drop(num_args + 1);
// Pop returned code object into R0 (null if not found).
@@ -1693,7 +1693,7 @@
__ b(¬_stepping, EQ);
__ EnterStubFrame();
__ Push(R5); // Preserve IC data.
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ Pop(R5);
__ LeaveStubFrame();
__ Bind(¬_stepping);
@@ -1728,7 +1728,7 @@
// Preserve target function and IC data object.
__ PushList((1 << R1) | (1 << R5));
__ Push(R1); // Pass function.
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ Drop(1); // Discard argument.
__ PopList((1 << R1) | (1 << R5)); // Restore function and IC data.
__ LeaveStubFrame();
@@ -1766,7 +1766,7 @@
__ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
// Preserve arguments descriptor and make room for result.
__ PushList((1 << R0) | (1 << R5));
- __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry, 0);
// Pop code object result and restore arguments descriptor.
__ PopList((1 << R0) | (1 << R5));
__ LeaveStubFrame();
@@ -1787,7 +1787,7 @@
// calling into the runtime.
__ EnterStubFrame();
__ Push(R0);
- __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry, 0);
__ Pop(R0);
__ LeaveStubFrame();
@@ -1805,7 +1805,7 @@
// calling into the runtime.
__ EnterStubFrame();
__ Push(R5);
- __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry, 0);
__ Pop(R5);
__ LeaveStubFrame();
@@ -2032,7 +2032,7 @@
__ PushList((1 << R0) | (1 << R1));
__ PushObject(Symbols::EqualOperator()); // Target's name.
__ Push(R5); // ICData
- __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); // Clobbers R4, R5.
+ __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4); // Clobbers R4, R5.
__ Drop(2);
__ PopList((1 << R0) | (1 << R1));
__ b(&compute_result);
@@ -2048,7 +2048,7 @@
__ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
__ Push(IP); // Setup space on stack for return value.
__ Push(R6);
- __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
+ __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ Pop(R0); // Discard argument.
__ Pop(R0); // Get Code object
__ Pop(R4); // Restore argument descriptor.
@@ -2122,7 +2122,7 @@
__ EnterStubFrame(0);
__ ReserveAlignedFrameSpace(2 * kWordSize);
__ stm(IA, SP, (1 << R0) | (1 << R1));
- __ CallRuntime(kBigintCompareRuntimeEntry);
+ __ CallRuntime(kBigintCompareRuntimeEntry, 2);
// Result in R0, 0 means equal.
__ LeaveStubFrame();
__ cmp(R0, ShifterOperand(0));
@@ -2148,7 +2148,7 @@
__ CompareImmediate(R1, 0);
__ b(¬_stepping, EQ);
__ EnterStubFrame();
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ LeaveStubFrame();
__ Bind(¬_stepping);
diff --git a/runtime/vm/stub_code_arm_test.cc b/runtime/vm/stub_code_arm_test.cc
index 0a11a98..4bea65e 100644
--- a/runtime/vm/stub_code_arm_test.cc
+++ b/runtime/vm/stub_code_arm_test.cc
@@ -51,7 +51,7 @@
__ PushObject(smi1); // Push argument 1 smi1.
__ PushObject(smi2); // Push argument 2 smi2.
ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
- __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func.
+ __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
__ AddImmediate(SP, argc * kWordSize);
__ Pop(R0); // Pop return value from return slot.
__ LeaveDartFrame();
@@ -86,7 +86,7 @@
__ ReserveAlignedFrameSpace(0);
__ LoadObject(R0, smi1); // Set up argument 1 smi1.
__ LoadObject(R1, smi2); // Set up argument 2 smi2.
- __ CallRuntime(kTestLeafSmiAddRuntimeEntry); // Call SmiAdd runtime func.
+ __ CallRuntime(kTestLeafSmiAddRuntimeEntry, 2); // Call SmiAdd runtime func.
__ LeaveDartFrame();
__ Ret(); // Return value is in R0.
}
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index f5e4ed1..927f612 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -107,7 +107,7 @@
void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) {
__ EnterCallRuntimeFrame(1 * kWordSize);
__ movl(Address(ESP, 0), EAX);
- __ CallRuntime(kPrintStopMessageRuntimeEntry);
+ __ CallRuntime(kPrintStopMessageRuntimeEntry, 1);
__ LeaveCallRuntimeFrame();
__ ret();
}
@@ -263,7 +263,7 @@
__ EnterStubFrame();
__ pushl(EDX); // Preserve arguments descriptor array.
__ pushl(raw_null); // Setup space on stack for return value.
- __ CallRuntime(kPatchStaticCallRuntimeEntry);
+ __ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
__ popl(EAX); // Get Code object result.
__ popl(EDX); // Restore arguments descriptor array.
// Remove the stub frame as we are about to jump to the dart function.
@@ -286,7 +286,7 @@
__ EnterStubFrame();
__ pushl(EDX); // Preserve arguments descriptor array.
__ pushl(raw_null); // Setup space on stack for return value.
- __ CallRuntime(kFixCallersTargetRuntimeEntry);
+ __ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
__ popl(EAX); // Get Code object.
__ popl(EDX); // Restore arguments descriptor array.
__ movl(EAX, FieldAddress(EAX, Code::instructions_offset()));
@@ -357,7 +357,7 @@
__ movl(EDX, EDI); // Smi-tagged arguments array length.
PushArgumentsArray(assembler);
- __ CallRuntime(kInstanceFunctionLookupRuntimeEntry);
+ __ CallRuntime(kInstanceFunctionLookupRuntimeEntry, 4);
// Remove arguments.
__ Drop(4);
@@ -422,7 +422,7 @@
__ movl(ECX, ESP); // Preserve saved registers block.
__ ReserveAlignedFrameSpace(1 * kWordSize);
__ movl(Address(ESP, 0), ECX); // Start of register block.
- __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
+ __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry, 1);
// Result (EAX) is stack-size (FP - SP) in bytes.
if (preserve_result) {
@@ -443,7 +443,7 @@
}
__ ReserveAlignedFrameSpace(1 * kWordSize);
__ movl(Address(ESP, 0), EBP); // Pass last FP as parameter on stack.
- __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry);
+ __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry, 1);
if (preserve_result) {
// Restore result into EBX.
__ movl(EBX, Address(EBP, kFirstLocalSlotFromFp * kWordSize));
@@ -459,7 +459,7 @@
__ pushl(EBX); // Preserve result, it will be GC-d here.
}
__ pushl(Immediate(Smi::RawValue(0))); // Space for the result.
- __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry);
+ __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0);
// Result tells stub how many bytes to remove from the expression stack
// of the bottom-most frame. They were used as materialization arguments.
__ popl(EBX);
@@ -511,7 +511,7 @@
__ pushl(EAX); // Pass receiver.
__ pushl(ECX); // Pass IC data.
__ pushl(EDX); // Pass arguments descriptor.
- __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3);
// Discard arguments.
__ popl(EAX);
__ popl(EAX);
@@ -662,7 +662,7 @@
__ pushl(raw_null); // Setup space on stack for return value.
__ pushl(EDX); // Array length as Smi.
__ pushl(ECX); // Element type.
- __ CallRuntime(kAllocateArrayRuntimeEntry);
+ __ CallRuntime(kAllocateArrayRuntimeEntry, 2);
__ popl(EAX); // Pop element type argument.
__ popl(EDX); // Pop array length argument.
__ popl(EAX); // Pop return value from return slot.
@@ -719,7 +719,7 @@
__ pushl(EDX); // Preserve arguments descriptor array.
__ pushl(ECX); // Preserve read-only function object argument.
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ popl(ECX); // Restore read-only function object argument in ECX.
__ popl(EDX); // Restore arguments descriptor array.
// Restore EAX.
@@ -755,7 +755,7 @@
__ movl(EDX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
PushArgumentsArray(assembler);
- __ CallRuntime(kInvokeNonClosureRuntimeEntry);
+ __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2);
// Remove arguments.
__ Drop(2);
__ popl(EAX); // Get result into EAX.
@@ -1004,7 +1004,7 @@
__ pushl(raw_null); // Setup space on stack for return value.
__ SmiTag(EDX);
__ pushl(EDX);
- __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context.
+ __ CallRuntime(kAllocateContextRuntimeEntry, 1); // Allocate context.
__ popl(EAX); // Pop number of context variables argument.
__ popl(EAX); // Pop the new context object.
// EAX: new object
@@ -1075,7 +1075,7 @@
__ EnterCallRuntimeFrame(1 * kWordSize);
__ movl(EAX, FieldAddress(CTX, Context::isolate_offset()));
__ movl(Address(ESP, 0), EAX); // Push the isolate as the only argument.
- __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry);
+ __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
// Restore callee-saved registers, tear down frame.
__ LeaveCallRuntimeFrame();
__ ret();
@@ -1245,7 +1245,7 @@
__ pushl(raw_null); // Push null type arguments.
__ pushl(Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
}
- __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object.
+ __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object.
__ popl(EAX); // Pop argument (instantiator).
__ popl(EAX); // Pop argument (type arguments of object).
__ popl(EAX); // Pop argument (class of object).
@@ -1379,12 +1379,12 @@
__ pushl(raw_null); // Push null type arguments.
}
if (is_implicit_instance_closure) {
- __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry);
+ __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry, 3);
__ popl(EAX); // Pop argument (type arguments of object).
__ popl(EAX); // Pop receiver.
} else {
ASSERT(func.IsNonImplicitClosureFunction());
- __ CallRuntime(kAllocateClosureRuntimeEntry);
+ __ CallRuntime(kAllocateClosureRuntimeEntry, 2);
__ popl(EAX); // Pop argument (type arguments of object).
}
__ popl(EAX); // Pop function object.
@@ -1423,7 +1423,7 @@
// EDX: Smi-tagged arguments array length.
PushArgumentsArray(assembler);
- __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry);
+ __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry, 4);
// Remove arguments.
__ Drop(4);
@@ -1446,7 +1446,7 @@
__ pushl(ic_reg); // Preserve.
__ pushl(ic_reg); // Argument.
__ pushl(func_reg); // Argument.
- __ CallRuntime(kTraceICCallRuntimeEntry);
+ __ CallRuntime(kTraceICCallRuntimeEntry, 2);
__ popl(EAX); // Discard argument;
__ popl(EAX); // Discard argument;
__ popl(ic_reg); // Restore.
@@ -1504,7 +1504,7 @@
__ EnterStubFrame();
__ pushl(ECX);
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ popl(ECX);
__ LeaveFrame();
__ Bind(¬_stepping);
@@ -1583,7 +1583,7 @@
__ pushl(EBX);
}
__ pushl(ECX); // Pass IC data object.
- __ CallRuntime(handle_ic_miss);
+ __ CallRuntime(handle_ic_miss, num_args + 1);
// Remove the call arguments pushed earlier, including the IC data object.
for (intptr_t i = 0; i < num_args + 1; i++) {
__ popl(EAX);
@@ -1740,7 +1740,7 @@
__ EnterStubFrame();
__ pushl(ECX);
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ popl(ECX);
__ LeaveFrame();
__ Bind(¬_stepping);
@@ -1772,7 +1772,7 @@
__ pushl(EDI); // Preserve target function.
__ pushl(ECX); // Preserve IC data object.
__ pushl(EDI); // Pass function.
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ popl(EAX); // Discard argument.
__ popl(ECX); // Restore IC data object.
__ popl(EDI); // Restore target function.
@@ -1807,7 +1807,7 @@
const Immediate& raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ pushl(raw_null); // Room for result.
- __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
__ popl(EAX); // Address of original stub.
__ popl(EDX); // Restore arguments.
__ popl(ECX);
@@ -1826,7 +1826,7 @@
const Immediate& raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ pushl(raw_null); // Room for result.
- __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry, 0);
__ popl(EAX); // Code object.
__ popl(ECX); // Restore ICData.
__ LeaveFrame();
@@ -1850,7 +1850,7 @@
// calling into the runtime.
__ EnterStubFrame();
__ pushl(EAX);
- __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry, 0);
__ popl(EAX);
__ LeaveFrame();
@@ -1870,7 +1870,7 @@
// calling into the runtime.
__ EnterStubFrame();
__ pushl(ECX);
- __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry, 0);
__ popl(ECX);
__ LeaveFrame();
@@ -2123,7 +2123,7 @@
__ pushl(EAX); // arg 1
__ PushObject(Symbols::EqualOperator()); // Target's name.
__ pushl(ECX); // ICData
- __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry);
+ __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4);
__ Drop(4);
__ LeaveFrame();
@@ -2141,7 +2141,7 @@
__ pushl(EDX);
__ pushl(raw_null); // Setup space on stack for return value.
__ pushl(EDI);
- __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
+ __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ popl(EAX); // Discard argument.
__ popl(EAX); // Get Code object
__ popl(EDX); // Restore argument descriptor.
@@ -2211,7 +2211,7 @@
__ ReserveAlignedFrameSpace(2 * kWordSize);
__ movl(Address(ESP, 1 * kWordSize), left);
__ movl(Address(ESP, 0 * kWordSize), right);
- __ CallRuntime(kBigintCompareRuntimeEntry);
+ __ CallRuntime(kBigintCompareRuntimeEntry, 2);
// Result in EAX, 0 means equal.
__ LeaveFrame();
__ cmpl(EAX, Immediate(0));
@@ -2238,7 +2238,7 @@
__ j(EQUAL, ¬_stepping, Assembler::kNearJump);
__ EnterStubFrame();
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ LeaveFrame();
__ Bind(¬_stepping);
diff --git a/runtime/vm/stub_code_ia32_test.cc b/runtime/vm/stub_code_ia32_test.cc
index 6e43487..2966be2 100644
--- a/runtime/vm/stub_code_ia32_test.cc
+++ b/runtime/vm/stub_code_ia32_test.cc
@@ -51,7 +51,7 @@
__ PushObject(smi1); // Push argument 1 smi1.
__ PushObject(smi2); // Push argument 2 smi2.
ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
- __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func.
+ __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
__ AddImmediate(ESP, Immediate(argc * kWordSize));
__ popl(EAX); // Pop return value from return slot.
__ leave();
@@ -88,7 +88,7 @@
__ movl(Address(ESP, 0), EAX); // Push argument 1 smi1.
__ LoadObject(EAX, smi2);
__ movl(Address(ESP, kWordSize), EAX); // Push argument 2 smi2.
- __ CallRuntime(kTestLeafSmiAddRuntimeEntry); // Call SmiAdd runtime func.
+ __ CallRuntime(kTestLeafSmiAddRuntimeEntry, 2); // Call SmiAdd runtime func.
__ leave();
__ ret(); // Return value is in EAX.
}
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index 9be9e94..ceef26f 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -125,7 +125,7 @@
void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) {
__ EnterCallRuntimeFrame(0);
// Call the runtime leaf function. A0 already contains the parameter.
- __ CallRuntime(kPrintStopMessageRuntimeEntry);
+ __ CallRuntime(kPrintStopMessageRuntimeEntry, 1);
__ LeaveCallRuntimeFrame();
__ Ret();
}
@@ -328,7 +328,7 @@
__ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
__ sw(TMP, Address(SP, 0 * kWordSize));
- __ CallRuntime(kPatchStaticCallRuntimeEntry);
+ __ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
__ TraceSimMsg("CallStaticFunctionStub return");
// Get Code object result and restore arguments descriptor array.
@@ -357,7 +357,7 @@
__ sw(S4, Address(SP, 1 * kWordSize));
__ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
__ sw(TMP, Address(SP, 0 * kWordSize));
- __ CallRuntime(kFixCallersTargetRuntimeEntry);
+ __ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
// Get Code object result and restore arguments descriptor array.
__ lw(T0, Address(SP, 0 * kWordSize));
__ lw(S4, Address(SP, 1 * kWordSize));
@@ -438,7 +438,7 @@
PushArgumentsArray(assembler);
__ TraceSimMsg("InstanceFunctionLookupStub return");
- __ CallRuntime(kInstanceFunctionLookupRuntimeEntry);
+ __ CallRuntime(kInstanceFunctionLookupRuntimeEntry, 4);
__ lw(V0, Address(SP, 4 * kWordSize)); // Get result into V0.
__ addiu(SP, SP, Immediate(5 * kWordSize)); // Remove arguments.
@@ -521,7 +521,7 @@
__ mov(A0, SP); // Pass address of saved registers block.
__ ReserveAlignedFrameSpace(1 * kWordSize);
- __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
+ __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry, 1);
// Result (V0) is stack-size (FP - SP) in bytes, incl. the return address.
if (preserve_result) {
@@ -549,7 +549,7 @@
__ Push(T1); // Preserve result as first local.
}
__ ReserveAlignedFrameSpace(1 * kWordSize);
- __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry); // Pass last FP in A0.
+ __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry, 1); // Pass last FP in A0.
if (preserve_result) {
// Restore result into T1.
__ lw(T1, Address(FP, kFirstLocalSlotFromFp * kWordSize));
@@ -569,7 +569,7 @@
__ Push(T1); // Preserve result, it will be GC-d here.
}
__ PushObject(Smi::ZoneHandle()); // Space for the result.
- __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry);
+ __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0);
// Result tells stub how many bytes to remove from the expression stack
// of the bottom-most frame. They were used as materialization arguments.
__ Pop(T1);
@@ -621,7 +621,7 @@
__ sw(S5, Address(SP, 1 * kWordSize));
__ sw(S4, Address(SP, 0 * kWordSize));
- __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3);
__ lw(T0, Address(SP, 3 * kWordSize)); // Get result.
__ lw(S4, Address(SP, 4 * kWordSize)); // Restore argument descriptor.
@@ -768,7 +768,7 @@
__ sw(TMP, Address(SP, 2 * kWordSize));
__ sw(A1, Address(SP, 1 * kWordSize));
__ sw(A0, Address(SP, 0 * kWordSize));
- __ CallRuntime(kAllocateArrayRuntimeEntry);
+ __ CallRuntime(kAllocateArrayRuntimeEntry, 2);
__ TraceSimMsg("AllocateArrayStub return");
// Pop arguments; result is popped in IP.
__ lw(V0, Address(SP, 2 * kWordSize));
@@ -838,7 +838,7 @@
__ addiu(SP, SP, Immediate(-2 * kWordSize));
__ sw(S4, Address(SP, 1 * kWordSize));
__ sw(T2, Address(SP, 0 * kWordSize));
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ TraceSimMsg("GenerateCallClosureFunctionStub return");
// Restore arguments descriptor array and read-only function object argument.
__ lw(T2, Address(SP, 0 * kWordSize));
@@ -888,7 +888,7 @@
// TOS + 5: PC marker (0 for stub).
// TOS + 6: Last argument of caller.
// ....
- __ CallRuntime(kInvokeNonClosureRuntimeEntry);
+ __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2);
__ lw(V0, Address(SP, 2 * kWordSize)); // Get result into V0.
__ addiu(SP, SP, Immediate(3 * kWordSize)); // Remove arguments.
@@ -1129,7 +1129,7 @@
__ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
__ sw(TMP, Address(SP, 1 * kWordSize)); // Store null.
__ sw(T1, Address(SP, 0 * kWordSize));
- __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context.
+ __ CallRuntime(kAllocateContextRuntimeEntry, 1); // Allocate context.
__ lw(V0, Address(SP, 1 * kWordSize)); // Get the new context.
__ addiu(SP, SP, Immediate(2 * kWordSize)); // Pop argument and return.
@@ -1206,7 +1206,7 @@
__ EnterCallRuntimeFrame(1 * kWordSize);
__ lw(A0, FieldAddress(CTX, Context::isolate_offset()));
- __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry);
+ __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
__ TraceSimMsg("UpdateStoreBufferStub return");
// Restore callee-saved registers, tear down frame.
__ LeaveCallRuntimeFrame();
@@ -1379,7 +1379,7 @@
__ sw(T7, Address(SP, 1 * kWordSize));
__ sw(T1, Address(SP, 0 * kWordSize));
}
- __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object.
+ __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object.
__ TraceSimMsg("AllocationStubForClass return");
// Pop result (newly allocated object).
__ lw(V0, Address(SP, 3 * kWordSize));
@@ -1518,11 +1518,11 @@
__ sw(T2, Address(SP, 0 * kWordSize));
if (is_implicit_instance_closure) {
- __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry);
+ __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry, 3);
__ TraceSimMsg("AllocationStubForClosure return");
} else {
ASSERT(func.IsNonImplicitClosureFunction());
- __ CallRuntime(kAllocateClosureRuntimeEntry);
+ __ CallRuntime(kAllocateClosureRuntimeEntry, 2);
__ TraceSimMsg("AllocationStubForClosure return");
}
__ lw(V0, Address(SP, (num_slots - 1) * kWordSize)); // Pop function object.
@@ -1565,7 +1565,7 @@
// A1: Smi-tagged arguments array length.
PushArgumentsArray(assembler);
- __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry);
+ __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry, 4);
__ lw(V0, Address(SP, 4 * kWordSize)); // Get result into V0.
__ LeaveStubFrameAndReturn();
@@ -1587,7 +1587,7 @@
__ sw(S5, Address(SP, 2 * kWordSize));
__ sw(ic_reg, Address(SP, 1 * kWordSize)); // Argument.
__ sw(func_reg, Address(SP, 0 * kWordSize)); // Argument.
- __ CallRuntime(kTraceICCallRuntimeEntry);
+ __ CallRuntime(kTraceICCallRuntimeEntry, 2);
__ lw(S5, Address(SP, 2 * kWordSize));
__ lw(T0, Address(SP, 3 * kWordSize));
__ addiu(SP, SP, Immediate(4 * kWordSize)); // Discard argument;
@@ -1650,7 +1650,7 @@
__ addiu(SP, SP, Immediate(-2 * kWordSize));
__ sw(S5, Address(SP, 1 * kWordSize)); // Preserve IC data.
__ sw(RA, Address(SP, 0 * kWordSize)); // Return address.
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ lw(RA, Address(SP, 0 * kWordSize));
__ lw(S5, Address(SP, 1 * kWordSize));
__ addiu(SP, SP, Immediate(2 * kWordSize));
@@ -1751,7 +1751,7 @@
}
// Pass IC data object.
__ sw(S5, Address(SP, (num_slots - num_args - 4) * kWordSize));
- __ CallRuntime(handle_ic_miss);
+ __ CallRuntime(handle_ic_miss, num_args + 1);
__ TraceSimMsg("NArgsCheckInlineCacheStub return");
// Pop returned code object into T3 (null if not found).
// Restore arguments descriptor array and IC data array.
@@ -1904,7 +1904,7 @@
__ addiu(SP, SP, Immediate(-2 * kWordSize));
__ sw(S5, Address(SP, 1 * kWordSize)); // Preserve IC data.
__ sw(RA, Address(SP, 0 * kWordSize)); // Return address.
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ lw(RA, Address(SP, 0 * kWordSize));
__ lw(S5, Address(SP, 1 * kWordSize));
__ addiu(SP, SP, Immediate(2 * kWordSize));
@@ -1945,7 +1945,7 @@
__ sw(S5, Address(SP, 2 * kWordSize)); // Preserve IC data.
__ sw(T3, Address(SP, 1 * kWordSize)); // Preserve function.
__ sw(T3, Address(SP, 0 * kWordSize)); // Function argument.
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ lw(T3, Address(SP, 1 * kWordSize)); // Restore function.
__ lw(S5, Address(SP, 2 * kWordSize)); // Restore IC data.
__ addiu(SP, SP, Immediate(3 * kWordSize));
@@ -1988,7 +1988,7 @@
__ sw(S5, Address(SP, 1 * kWordSize));
__ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
__ sw(TMP, Address(SP, 0 * kWordSize));
- __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry, 0);
// Pop code object result and restore arguments descriptor.
__ lw(T0, Address(SP, 0 * kWordSize));
__ lw(S5, Address(SP, 1 * kWordSize));
@@ -2012,7 +2012,7 @@
// calling into the runtime.
__ EnterStubFrame();
__ Push(V0);
- __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry, 0);
__ Pop(V0);
__ LeaveStubFrame();
@@ -2030,7 +2030,7 @@
__ TraceSimMsg("BreakpointDynamicStub");
__ EnterStubFrame();
__ Push(S5);
- __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry, 0);
__ Pop(S5);
__ LeaveStubFrame();
@@ -2285,7 +2285,7 @@
__ LoadObject(TMP1, Symbols::EqualOperator()); // Target's name.
__ sw(TMP1, Address(SP, 1 * kWordSize));
__ sw(T0, Address(SP, 0 * kWordSize)); // ICData.
- __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry);
+ __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4);
__ lw(A0, Address(SP, 2 * kWordSize));
__ lw(A1, Address(SP, 3 * kWordSize));
__ b(&compute_result);
@@ -2305,7 +2305,7 @@
__ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
__ sw(TMP, Address(SP, 1 * kWordSize));
__ sw(T0, Address(SP, 0 * kWordSize));
- __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
+ __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ TraceSimMsg("OptimizeFunctionStub return");
__ lw(T0, Address(SP, 1 * kWordSize)); // Get Code object
__ lw(S4, Address(SP, 2 * kWordSize)); // Restore argument descriptor.
@@ -2392,7 +2392,7 @@
__ sw(right, Address(SP, 0 * kWordSize));
__ mov(A0, left);
__ mov(A1, right);
- __ CallRuntime(kBigintCompareRuntimeEntry);
+ __ CallRuntime(kBigintCompareRuntimeEntry, 2);
__ TraceSimMsg("IdenticalWithNumberCheckStub return");
// Result in V0, 0 means equal.
__ LeaveStubFrame();
@@ -2422,7 +2422,7 @@
// Call single step callback in debugger.
__ addiu(SP, SP, Immediate(-1 * kWordSize));
__ sw(RA, Address(SP, 0 * kWordSize)); // Return address.
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ lw(RA, Address(SP, 0 * kWordSize));
__ addiu(SP, SP, Immediate(1 * kWordSize));
__ Bind(¬_stepping);
diff --git a/runtime/vm/stub_code_mips_test.cc b/runtime/vm/stub_code_mips_test.cc
index 6fdbdfd..20a425b 100644
--- a/runtime/vm/stub_code_mips_test.cc
+++ b/runtime/vm/stub_code_mips_test.cc
@@ -51,7 +51,7 @@
__ PushObject(smi1); // Push argument 1 smi1.
__ PushObject(smi2); // Push argument 2 smi2.
ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
- __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func.
+ __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
__ addiu(SP, SP, Immediate(argc * kWordSize));
__ Pop(V0); // Pop return value from return slot.
__ LeaveDartFrameAndReturn();
@@ -85,7 +85,7 @@
__ ReserveAlignedFrameSpace(0);
__ LoadObject(A0, smi1); // Set up argument 1 smi1.
__ LoadObject(A1, smi2); // Set up argument 2 smi2.
- __ CallRuntime(kTestLeafSmiAddRuntimeEntry); // Call SmiAdd runtime func.
+ __ CallRuntime(kTestLeafSmiAddRuntimeEntry, 2); // Call SmiAdd runtime func.
__ LeaveDartFrameAndReturn(); // Return value is in V0.
}
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index a0da196..87163a7 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -109,7 +109,7 @@
void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) {
__ EnterCallRuntimeFrame(0);
// Call the runtime leaf function. RDI already contains the parameter.
- __ CallRuntime(kPrintStopMessageRuntimeEntry);
+ __ CallRuntime(kPrintStopMessageRuntimeEntry, 1);
__ LeaveCallRuntimeFrame();
__ ret();
}
@@ -260,7 +260,7 @@
__ EnterStubFrame();
__ pushq(R10); // Preserve arguments descriptor array.
__ pushq(raw_null); // Setup space on stack for return value.
- __ CallRuntime(kPatchStaticCallRuntimeEntry);
+ __ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
__ popq(RAX); // Get Code object result.
__ popq(R10); // Restore arguments descriptor array.
// Remove the stub frame as we are about to jump to the dart function.
@@ -281,7 +281,7 @@
__ EnterStubFrame();
__ pushq(R10); // Preserve arguments descriptor array.
__ pushq(raw_null); // Setup space on stack for return value.
- __ CallRuntime(kFixCallersTargetRuntimeEntry);
+ __ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
__ popq(RAX); // Get Code object.
__ popq(R10); // Restore arguments descriptor array.
__ movq(RAX, FieldAddress(RAX, Code::instructions_offset()));
@@ -350,7 +350,7 @@
__ movq(R10, R13); // Smi-tagged arguments array length.
PushArgumentsArray(assembler);
- __ CallRuntime(kInstanceFunctionLookupRuntimeEntry);
+ __ CallRuntime(kInstanceFunctionLookupRuntimeEntry, 4);
// Remove arguments.
__ Drop(4);
@@ -414,7 +414,7 @@
__ movq(RDI, RSP); // Pass address of saved registers block.
__ ReserveAlignedFrameSpace(0);
- __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
+ __ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry, 1);
// Result (RAX) is stack-size (FP - SP) in bytes.
if (preserve_result) {
@@ -435,7 +435,7 @@
}
__ ReserveAlignedFrameSpace(0);
__ movq(RDI, RBP); // Pass last FP as parameter in RDI.
- __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry);
+ __ CallRuntime(kDeoptimizeFillFrameRuntimeEntry, 1);
if (preserve_result) {
// Restore result into RBX.
__ movq(RBX, Address(RBP, kFirstLocalSlotFromFp * kWordSize));
@@ -451,7 +451,7 @@
__ pushq(RBX); // Preserve result, it will be GC-d here.
}
__ pushq(Immediate(Smi::RawValue(0))); // Space for the result.
- __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry);
+ __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0);
// Result tells stub how many bytes to remove from the expression stack
// of the bottom-most frame. They were used as materialization arguments.
__ popq(RBX);
@@ -503,7 +503,7 @@
__ pushq(RAX); // Receiver.
__ pushq(RBX); // IC data.
__ pushq(R10); // Arguments descriptor.
- __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry);
+ __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3);
// Discard arguments.
__ popq(RAX);
__ popq(RAX);
@@ -648,7 +648,7 @@
__ pushq(raw_null); // Setup space on stack for return value.
__ pushq(R10); // Array length as Smi.
__ pushq(RBX); // Element type.
- __ CallRuntime(kAllocateArrayRuntimeEntry);
+ __ CallRuntime(kAllocateArrayRuntimeEntry, 2);
__ popq(RAX); // Pop element type argument.
__ popq(R10); // Pop array length argument.
__ popq(RAX); // Pop return value from return slot.
@@ -704,7 +704,7 @@
__ pushq(R10); // Preserve arguments descriptor array.
__ pushq(RBX); // Preserve read-only function object argument.
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ popq(RBX); // Restore read-only function object argument in RBX.
__ popq(R10); // Restore arguments descriptor array.
// Restore RAX.
@@ -740,7 +740,7 @@
__ movq(R10, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
PushArgumentsArray(assembler);
- __ CallRuntime(kInvokeNonClosureRuntimeEntry);
+ __ CallRuntime(kInvokeNonClosureRuntimeEntry, 2);
// Remove arguments.
__ Drop(2);
@@ -991,7 +991,7 @@
__ pushq(raw_null); // Setup space on stack for the return value.
__ SmiTag(R10);
__ pushq(R10); // Push number of context variables.
- __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context.
+ __ CallRuntime(kAllocateContextRuntimeEntry, 1); // Allocate context.
__ popq(RAX); // Pop number of context variables argument.
__ popq(RAX); // Pop the new context object.
// RAX: new object
@@ -1057,7 +1057,7 @@
// Setup frame, push callee-saved registers.
__ EnterCallRuntimeFrame(0);
__ movq(RDI, FieldAddress(CTX, Context::isolate_offset()));
- __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry);
+ __ CallRuntime(kStoreBufferBlockProcessRuntimeEntry, 1);
__ LeaveCallRuntimeFrame();
__ ret();
}
@@ -1227,7 +1227,7 @@
__ pushq(raw_null); // Push null type arguments.
__ pushq(Immediate(Smi::RawValue(StubCode::kNoInstantiator)));
}
- __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object.
+ __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object.
__ popq(RAX); // Pop argument (instantiator).
__ popq(RAX); // Pop argument (type arguments of object).
__ popq(RAX); // Pop argument (class of object).
@@ -1363,12 +1363,12 @@
__ pushq(raw_null); // Push null type arguments.
}
if (is_implicit_instance_closure) {
- __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry);
+ __ CallRuntime(kAllocateImplicitInstanceClosureRuntimeEntry, 3);
__ popq(RAX); // Pop type arguments.
__ popq(RAX); // Pop receiver.
} else {
ASSERT(func.IsNonImplicitClosureFunction());
- __ CallRuntime(kAllocateClosureRuntimeEntry);
+ __ CallRuntime(kAllocateClosureRuntimeEntry, 2);
__ popq(RAX); // Pop type arguments.
}
__ popq(RAX); // Pop the function object.
@@ -1405,7 +1405,7 @@
__ movq(R10, R13); // Smi-tagged arguments array length.
PushArgumentsArray(assembler);
- __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry);
+ __ CallRuntime(kInvokeNoSuchMethodFunctionRuntimeEntry, 4);
// Remove arguments.
__ Drop(4);
@@ -1428,7 +1428,7 @@
__ pushq(ic_reg); // Preserve.
__ pushq(ic_reg); // Argument.
__ pushq(func_reg); // Argument.
- __ CallRuntime(kTraceICCallRuntimeEntry);
+ __ CallRuntime(kTraceICCallRuntimeEntry, 2);
__ popq(RAX); // Discard argument;
__ popq(RAX); // Discard argument;
__ popq(ic_reg); // Restore.
@@ -1485,7 +1485,7 @@
__ j(EQUAL, ¬_stepping, Assembler::kNearJump);
__ EnterStubFrame();
__ pushq(RBX);
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ popq(RBX);
__ LeaveFrame();
__ Bind(¬_stepping);
@@ -1561,7 +1561,7 @@
__ pushq(RCX);
}
__ pushq(RBX); // Pass IC data object.
- __ CallRuntime(handle_ic_miss);
+ __ CallRuntime(handle_ic_miss, num_args + 1);
// Remove the call arguments pushed earlier, including the IC data object.
for (intptr_t i = 0; i < num_args + 1; i++) {
__ popq(RAX);
@@ -1716,7 +1716,7 @@
__ j(EQUAL, ¬_stepping, Assembler::kNearJump);
__ EnterStubFrame();
__ pushq(RBX); // Preserve IC data object.
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ popq(RBX);
__ LeaveFrame();
__ Bind(¬_stepping);
@@ -1750,7 +1750,7 @@
__ pushq(R13); // Preserve target function.
__ pushq(RBX); // Preserve IC data object.
__ pushq(R13); // Pass function.
- __ CallRuntime(kCompileFunctionRuntimeEntry);
+ __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
__ popq(RAX); // Discard argument.
__ popq(RBX); // Restore IC data object.
__ popq(R13); // Restore target function.
@@ -1786,7 +1786,7 @@
const Immediate& raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ pushq(raw_null); // Room for result.
- __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
__ popq(RAX); // Address of original.
__ popq(R10); // Restore arguments.
__ popq(RBX);
@@ -1803,7 +1803,7 @@
__ EnterStubFrame();
__ pushq(RBX); // Preserve IC data for unoptimized call.
__ pushq(raw_null); // Room for result.
- __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry, 0);
__ popq(RAX); // Code object.
__ popq(RBX); // Restore IC data.
__ LeaveFrame();
@@ -1822,7 +1822,7 @@
void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) {
__ EnterStubFrame();
__ pushq(RAX);
- __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry, 0);
__ popq(RAX);
__ LeaveFrame();
@@ -1837,7 +1837,7 @@
void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) {
__ EnterStubFrame();
__ pushq(RBX);
- __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry);
+ __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry, 0);
__ popq(RBX);
__ LeaveFrame();
@@ -2089,7 +2089,7 @@
__ pushq(RAX); // arg 1
__ PushObject(Symbols::EqualOperator()); // Target's name.
__ pushq(RBX); // ICData
- __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry);
+ __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry, 4);
__ Drop(4);
__ LeaveFrame();
@@ -2106,7 +2106,7 @@
__ pushq(R10);
__ pushq(raw_null); // Setup space on stack for return value.
__ pushq(RDI);
- __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
+ __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ popq(RAX); // Disard argument.
__ popq(RAX); // Get Code object.
__ popq(R10); // Restore argument descriptor.
@@ -2171,7 +2171,7 @@
__ ReserveAlignedFrameSpace(0);
__ movq(RDI, left);
__ movq(RSI, right);
- __ CallRuntime(kBigintCompareRuntimeEntry);
+ __ CallRuntime(kBigintCompareRuntimeEntry, 2);
// Result in RAX, 0 means equal.
__ LeaveFrame();
__ cmpq(RAX, Immediate(0));
@@ -2197,7 +2197,7 @@
__ cmpq(RAX, Immediate(0));
__ j(EQUAL, ¬_stepping, Assembler::kNearJump);
__ EnterStubFrame();
- __ CallRuntime(kSingleStepHandlerRuntimeEntry);
+ __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0);
__ LeaveFrame();
__ Bind(¬_stepping);
diff --git a/runtime/vm/stub_code_x64_test.cc b/runtime/vm/stub_code_x64_test.cc
index b73a0b4..769134d 100644
--- a/runtime/vm/stub_code_x64_test.cc
+++ b/runtime/vm/stub_code_x64_test.cc
@@ -51,7 +51,7 @@
__ PushObject(smi1); // Push argument 1 smi1.
__ PushObject(smi2); // Push argument 2 smi2.
ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
- __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func.
+ __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
__ AddImmediate(RSP, Immediate(argc * kWordSize));
__ popq(RAX); // Pop return value from return slot.
__ leave();
@@ -86,7 +86,7 @@
__ ReserveAlignedFrameSpace(0);
__ LoadObject(RDI, smi1); // Set up argument 1 smi1.
__ LoadObject(RSI, smi2); // Set up argument 2 smi2.
- __ CallRuntime(kTestLeafSmiAddRuntimeEntry); // Call SmiAdd runtime func.
+ __ CallRuntime(kTestLeafSmiAddRuntimeEntry, 2); // Call SmiAdd runtime func.
__ leave();
__ ret(); // Return value is in RAX.
}
diff --git a/sdk/lib/_collection_dev/iterable.dart b/sdk/lib/_collection_dev/iterable.dart
index 7013272..99659ac 100644
--- a/sdk/lib/_collection_dev/iterable.dart
+++ b/sdk/lib/_collection_dev/iterable.dart
@@ -7,7 +7,7 @@
// This is a hack to make @deprecated work in dart:io. Don't remove or use this,
// unless coordinated with either me or the core library team. Thanks!
-// TODO(ajohnsen): Remove at the 11th of Auguest 2013.
+// TODO(ajohnsen): Remove at the 11th of August 2013.
// TODO(ajohnsen): Remove hide in:
// tools/dom/templates/html/dart2js/html_dart2js.darttemplate
// tools/dom/templates/html/dart2js/svg_dart2js.darttemplate
@@ -19,6 +19,7 @@
// tools/dom/templates/html/dartium/web_audio_dartium.darttemplate
// tools/dom/templates/html/dartium/web_gl_dartium.darttemplate
// tools/dom/templates/html/dartium/web_sql_dartium.darttemplate
+// sdk/lib/core/regexp.dart
const deprecated = 0;
diff --git a/sdk/lib/_collection_dev/list.dart b/sdk/lib/_collection_dev/list.dart
index 1008dc1..f5db3bb 100644
--- a/sdk/lib/_collection_dev/list.dart
+++ b/sdk/lib/_collection_dev/list.dart
@@ -40,16 +40,6 @@
"Cannot remove from a fixed-length list");
}
- void removeAll(Iterable elements) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
- void retainAll(Iterable elements) {
- throw new UnsupportedError(
- "Cannot remove from a fixed-length list");
- }
-
void removeWhere(bool test(E element)) {
throw new UnsupportedError(
"Cannot remove from a fixed-length list");
@@ -93,7 +83,7 @@
* This mixin is intended to be mixed in on top of [ListMixin] on
* unmodifiable lists.
*/
-abstract class UnmodifiableListMixin<E> {
+abstract class UnmodifiableListMixin<E> implements List<E> {
void operator []=(int index, E value) {
throw new UnsupportedError(
@@ -135,16 +125,6 @@
"Cannot remove from an unmodifiable list");
}
- void removeAll(Iterable elements) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
- void retainAll(Iterable elements) {
- throw new UnsupportedError(
- "Cannot remove from an unmodifiable list");
- }
-
void removeWhere(bool test(E element)) {
throw new UnsupportedError(
"Cannot remove from an unmodifiable list");
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 91ee72a..7e543d0 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -211,6 +211,14 @@
*/
void registerRuntimeType(Enqueuer enqueuer, TreeElements elements) {}
+ /**
+ * Call this method to enable [noSuchMethod] handling in the
+ * backend.
+ */
+ void enableNoSuchMethod(Enqueuer enqueuer) {
+ enqueuer.registerInvocation(compiler.noSuchMethodSelector);
+ }
+
void registerRequiredType(DartType type, Element enclosingElement) {}
void registerClassUsingVariableExpression(ClassElement cls) {}
@@ -398,6 +406,9 @@
/// Initialized when dart:mirrors is loaded.
LibraryElement mirrorsLibrary;
+ /// Initialized when dart:typed_data is loaded.
+ LibraryElement typedDataLibrary;
+
ClassElement objectClass;
ClassElement closureClass;
ClassElement boundClosureClass;
@@ -414,6 +425,7 @@
ClassElement mapClass;
ClassElement symbolClass;
ClassElement stackTraceClass;
+ ClassElement typedDataClass;
// Initialized after mirrorSystemClass has been resolved.
FunctionElement symbolConstructor;
@@ -446,7 +458,6 @@
Element identicalFunction;
Element functionApplyMethod;
Element invokeOnMethod;
- Element createInvocationMirrorElement;
Element get currentElement => _currentElement;
@@ -633,9 +644,7 @@
bool get compileAll => false;
- bool get disableTypeInference {
- return disableTypeInferenceFlag || disableTypeInferenceForMirrors;
- }
+ bool get disableTypeInference => disableTypeInferenceFlag;
int getNextFreeClassId() => nextFreeClassId++;
@@ -711,7 +720,8 @@
return spanFromElement(node);
} else if (node is MetadataAnnotation) {
MetadataAnnotation annotation = node;
- return spanFromTokens(annotation.beginToken, annotation.endToken);
+ uri = annotation.annotatedElement.getCompilationUnit().script.uri;
+ return spanFromTokens(annotation.beginToken, annotation.endToken, uri);
} else {
throw 'No error location.';
}
@@ -769,6 +779,10 @@
findRequiredElement(library, const SourceString('MirrorSystem'));
mirrorsUsedClass =
findRequiredElement(library, const SourceString('MirrorsUsed'));
+ } else if (uri == new Uri(scheme: 'dart', path: 'typed_data')) {
+ typedDataLibrary = library;
+ typedDataClass =
+ findRequiredElement(library, const SourceString('TypedData'));
} else if (uri == new Uri(scheme: 'dart', path: '_collection-dev')) {
symbolImplementationClass =
findRequiredElement(library, const SourceString('Symbol'));
@@ -1029,8 +1043,7 @@
enqueuer.codegen.registerGetOfStaticFunction(mainApp.find(MAIN));
}
if (enabledNoSuchMethod) {
- enqueuer.codegen.registerInvocation(noSuchMethodSelector);
- enqueuer.codegen.addToWorkList(createInvocationMirrorElement);
+ backend.enableNoSuchMethod(enqueuer.codegen);
}
if (compileAll) {
libraries.forEach((_, lib) => fullyEnqueueLibrary(lib, enqueuer.codegen));
diff --git a/sdk/lib/_internal/compiler/implementation/enqueue.dart b/sdk/lib/_internal/compiler/implementation/enqueue.dart
index 05c1d46..22f8351 100644
--- a/sdk/lib/_internal/compiler/implementation/enqueue.dart
+++ b/sdk/lib/_internal/compiler/implementation/enqueue.dart
@@ -653,11 +653,7 @@
Selector selector = compiler.noSuchMethodSelector;
compiler.enabledNoSuchMethod = true;
- registerInvocation(selector);
-
- compiler.createInvocationMirrorElement =
- compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR);
- addToWorkList(compiler.createInvocationMirrorElement);
+ compiler.backend.enableNoSuchMethod(this);
}
void forEach(f(WorkItem work)) {
diff --git a/sdk/lib/_internal/compiler/implementation/js/builder.dart b/sdk/lib/_internal/compiler/implementation/js/builder.dart
index a1d4f41..b0424c6 100644
--- a/sdk/lib/_internal/compiler/implementation/js/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/js/builder.dart
@@ -114,7 +114,9 @@
}
Expression toExpression(expression) {
- if (expression is Expression) {
+ if (expression == null) {
+ return null;
+ } else if (expression is Expression) {
return expression;
} else if (expression is String) {
return this(expression);
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index 8b6f872..a067322 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -221,9 +221,6 @@
Element dispatchPropertyName;
Element getNativeInterceptorMethod;
Element defineNativeMethodsFinishMethod;
- Element getDispatchPropertyMethod;
- Element setDispatchPropertyMethod;
- Element initializeDispatchPropertyMethod;
bool needToInitializeDispatchProperty = false;
bool seenAnyClass = false;
@@ -369,9 +366,12 @@
if (element.isParameter()
|| element.isFieldParameter()
|| element.isField()) {
- element = element.enclosingElement;
+ if (!canBeUsedForGlobalOptimizations(element.enclosingElement)) {
+ return false;
+ }
}
- return !helpersUsed.contains(element.declaration);
+ element = element.declaration;
+ return !isNeededForReflection(element) && !helpersUsed.contains(element);
}
bool isInterceptorClass(ClassElement element) {
@@ -478,22 +478,13 @@
compiler.findInterceptor(const SourceString('mapTypeToInterceptor'));
dispatchPropertyName =
compiler.findInterceptor(const SourceString('dispatchPropertyName'));
- getDispatchPropertyMethod =
- compiler.findInterceptor(const SourceString('getDispatchProperty'));
- setDispatchPropertyMethod =
- compiler.findInterceptor(const SourceString('setDispatchProperty'));
getNativeInterceptorMethod =
compiler.findInterceptor(const SourceString('getNativeInterceptor'));
- initializeDispatchPropertyMethod =
- compiler.findInterceptor(
- new SourceString(emitter.nameOfDispatchPropertyInitializer));
defineNativeMethodsFinishMethod =
compiler.findHelper(const SourceString('defineNativeMethodsFinish'));
// These methods are overwritten with generated versions.
inlineCache.markAsNonInlinable(getInterceptorMethod, insideLoop: true);
- inlineCache.markAsNonInlinable(getDispatchPropertyMethod, insideLoop: true);
- inlineCache.markAsNonInlinable(setDispatchPropertyMethod, insideLoop: true);
List<ClassElement> classes = [
jsInterceptorClass =
@@ -566,6 +557,9 @@
objectEquals = compiler.lookupElementIn(
compiler.objectClass, const SourceString('=='));
+ jsIndexingBehaviorInterface =
+ compiler.findHelper(const SourceString('JavaScriptIndexingBehavior'));
+
specialOperatorEqClasses
..add(compiler.objectClass)
..add(jsInterceptorClass)
@@ -667,7 +661,6 @@
// native classes.
enqueue(enqueuer, getNativeInterceptorMethod, elements);
enqueue(enqueuer, defineNativeMethodsFinishMethod, elements);
- enqueue(enqueuer, initializeDispatchPropertyMethod, elements);
enqueueClass(enqueuer, jsInterceptorClass, compiler.globalDependencies);
}
}
@@ -737,6 +730,18 @@
addInterceptors(jsUnknownJavaScriptObjectClass, enqueuer, elements);
} else if (Elements.isNativeOrExtendsNative(cls)) {
addInterceptorsForNativeClassMembers(cls, enqueuer);
+ } else if (cls == jsIndexingBehaviorInterface) {
+ // These two helpers are used by the emitter and the codegen.
+ // Because we cannot enqueue elements at the time of emission,
+ // we make sure they are always generated.
+ enqueue(
+ enqueuer,
+ compiler.findHelper(const SourceString('isJsIndexable')),
+ elements);
+ enqueue(
+ enqueuer,
+ compiler.findInterceptor(const SourceString('dispatchPropertyName')),
+ elements);
}
}
@@ -746,7 +751,6 @@
TreeElements elements = compiler.globalDependencies;
enqueue(enqueuer, getNativeInterceptorMethod, elements);
enqueue(enqueuer, defineNativeMethodsFinishMethod, elements);
- enqueue(enqueuer, initializeDispatchPropertyMethod, elements);
enqueueClass(enqueuer, jsPlainJavaScriptObjectClass, elements);
needToInitializeDispatchProperty = true;
}
@@ -756,21 +760,11 @@
}
void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements) {
- jsIndexingBehaviorInterface =
- compiler.findHelper(const SourceString('JavaScriptIndexingBehavior'));
- if (jsIndexingBehaviorInterface != null) {
- world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler),
- elements);
- enqueue(
- world,
- compiler.findHelper(const SourceString('isJsIndexable')),
- elements);
- enqueue(
- world,
- compiler.findInterceptor(const SourceString('dispatchPropertyName')),
- elements);
- }
-
+ // TODO(ngeoffray): Not enqueuing those two classes currently make
+ // the compiler potentially crash. However, any reasonable program
+ // will instantiate those two classes.
+ addInterceptors(jsBoolClass, world, elements);
+ addInterceptors(jsNullClass, world, elements);
if (compiler.enableTypeAssertions) {
// Unconditionally register the helper that checks if the
// expression in an if/while/for is a boolean.
@@ -948,6 +942,11 @@
enqueueInResolution(getFallThroughError(), elements);
}
+ void enableNoSuchMethod(Enqueuer world) {
+ enqueue(world, getCreateInvocationMirror(), compiler.globalDependencies);
+ world.registerInvocation(compiler.noSuchMethodSelector);
+ }
+
void registerSuperNoSuchMethod(TreeElements elements) {
enqueueInResolution(getCreateInvocationMirror(), elements);
enqueueInResolution(
@@ -1438,13 +1437,7 @@
if (mustRetainMetadata) return;
compiler.log('Retaining metadata.');
mustRetainMetadata = true;
- for (LibraryElement library in compiler.libraries.values) {
- if (retainMetadataOf(library)) {
- for (Link link = library.metadata; !link.isEmpty; link = link.tail) {
- link.head.ensureResolved(compiler);
- }
- }
- }
+ compiler.libraries.values.forEach(retainMetadataOf);
for (Dependency dependency in metadataInstantiatedTypes) {
registerMetadataInstantiatedType(dependency.type, dependency.user);
}
@@ -1488,7 +1481,8 @@
if (mustRetainMetadata) hasRetainedMetadata = true;
if (mustRetainMetadata && isNeededForReflection(element)) {
for (MetadataAnnotation metadata in element.metadata) {
- metadata.value.accept(new ConstantCopier(compiler.constantHandler));
+ metadata.ensureResolved(compiler)
+ .value.accept(new ConstantCopier(compiler.constantHandler));
}
return true;
}
@@ -1555,6 +1549,25 @@
if (metaTargets != null) metaTargetsUsed.addAll(metaTargets);
}
+ /**
+ * Returns `true` if [element] can be accessed through reflection, that is,
+ * is in the set of elements covered by a `MirrorsUsed` annotation.
+ *
+ * This property is used to tag emitted elements with a marker which is
+ * checked by the runtime system to throw an exception if an element is
+ * accessed (invoked, get, set) that is not accessible for the reflective
+ * system.
+ */
+ bool isAccessibleByReflection(Element element) {
+ if (hasInsufficientMirrorsUsed) return true;
+ return isNeededForReflection(element);
+ }
+
+ /**
+ * Returns `true` if the emitter must emit the element even though there
+ * is no direct use in the program, but because the reflective system may
+ * need to access it.
+ */
bool isNeededForReflection(Element element) {
if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled;
/// Record the name of [element] in [symbolsUsed]. Return true for
@@ -1591,6 +1604,34 @@
return false;
}
+
+ jsAst.Call generateIsJsIndexableCall(jsAst.Expression use1,
+ jsAst.Expression use2) {
+ Element dispatchProperty =
+ compiler.findInterceptor(const SourceString('dispatchPropertyName'));
+ String dispatchPropertyName = namer.isolateAccess(dispatchProperty);
+
+ // We pass the dispatch property record to the isJsIndexable
+ // helper rather than reading it inside the helper to increase the
+ // chance of making the dispatch record access monomorphic.
+ jsAst.PropertyAccess record = new jsAst.PropertyAccess(
+ use2, new jsAst.VariableUse(dispatchPropertyName));
+
+ List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record];
+ FunctionElement helper =
+ compiler.findHelper(const SourceString('isJsIndexable'));
+ String helperName = namer.isolateAccess(helper);
+ return new jsAst.Call(new jsAst.VariableUse(helperName), arguments);
+ }
+
+ bool isTypedArray(TypeMask mask) {
+ // Just checking for [:TypedData:] is not sufficient, as it is an
+ // abstract class any user-defined class can implement. So we also
+ // check for the interface [JavaScriptIndexingBehavior].
+ return compiler.typedDataClass != null
+ && mask.satisfies(compiler.typedDataClass, compiler)
+ && mask.satisfies(jsIndexingBehaviorInterface, compiler);
+ }
}
/// Records that [type] is used by [user.element].
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart
index f1b83d9..ae5c1f0 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/constant_emitter.dart
@@ -299,6 +299,12 @@
}
jsAst.Expression visitConstructed(ConstructedConstant constant) {
+ Element element = constant.type.element;
+ if (element.isForeign(compiler)
+ && element.name == const SourceString('JS_CONST')) {
+ StringConstant str = constant.fields[0];
+ return new jsAst.LiteralExpression(str.value.slowToString());
+ }
jsAst.New instantiation = new jsAst.New(
new jsAst.VariableUse(getJsConstructor(constant.type.element)),
_array(constant.fields));
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index e7eb3ce..2b3fe3a 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -287,6 +287,7 @@
static const RANGE2_LAST = 0x7e;
static const RANGE3_FIRST = 0x25; // %&'()*+ encodes 10..16
static const RANGE3_LAST = 0x2b;
+ static const REFLECTION_MARKER = 0x2d;
jsAst.FunctionDeclaration get generateAccessorFunction {
const RANGE1_SIZE = RANGE1_LAST - RANGE1_FIRST + 1;
@@ -298,11 +299,19 @@
String receiverParamName = compiler.enableMinification ? "r" : "receiver";
String valueParamName = compiler.enableMinification ? "v" : "value";
+ String reflectableField = namer.reflectableField;
// function generateAccessor(field, prototype) {
jsAst.Fun fun = js.fun(['field', 'prototype'], [
js('var len = field.length'),
js('var code = field.charCodeAt(len - 1)'),
+ js('var reflectable = false'),
+ js.if_('code == $REFLECTION_MARKER', [
+ js('len--'),
+ js('code = field.charCodeAt(len - 1)'),
+ js('field = field.substring(0, len)'),
+ js('reflectable = true')
+ ]),
js('code = ((code >= $RANGE1_FIRST) && (code <= $RANGE1_LAST))'
' ? code - $RANGE1_ADJUST'
' : ((code >= $RANGE2_FIRST) && (code <= $RANGE2_LAST))'
@@ -329,7 +338,10 @@
js('var receiver = (getterCode & 1) ? "this" : "$receiverParamName"'),
js('var body = "return " + receiver + "." + field'),
js('prototype["${namer.getterPrefix}" + accessorName] = '
- 'new Function(args, body)')
+ 'new Function(args, body)'),
+ js.if_('!reflectable', [
+ js('prototype["${namer.getterPrefix}" + accessorName].'
+ '$reflectableField = false')])
]),
// if (needsSetter) {
@@ -340,7 +352,10 @@
js('var receiver = (setterCode & 1) ? "this" : "$receiverParamName"'),
js('var body = receiver + "." + field + "$_=$_$valueParamName"'),
js('prototype["${namer.setterPrefix}" + accessorName] = '
- 'new Function(args, body)')
+ 'new Function(args, body)'),
+ js.if_('!reflectable', [
+ js('prototype["${namer.setterPrefix}" + accessorName].'
+ '$reflectableField = false')])
]),
]),
@@ -570,7 +585,7 @@
// Object class to catch noSuchMethod invocations.
ClassElement objectClass = compiler.objectClass;
String createInvocationMirror = namer.getName(
- compiler.createInvocationMirrorElement);
+ backend.getCreateInvocationMirror());
String noSuchMethodName = namer.publicInstanceMethodNameByArity(
Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT);
var type = 0;
@@ -857,8 +872,6 @@
return js.fun('oldIsolate', [
js('var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'),
- js(r'isolateProperties.$currentScript = null'),
-
js('var isolatePrototype = oldIsolate.prototype'),
js('var str = "{\\n"'),
js('str += "var properties = '
@@ -1099,7 +1112,9 @@
String reflectionName = getReflectionName(selector, invocationName);
if (reflectionName != null) {
- defineStub('+$reflectionName', js('0'));
+ var reflectable =
+ js(backend.isAccessibleByReflection(member) ? '1' : '0');
+ defineStub('+$reflectionName', reflectable);
}
}
@@ -1239,13 +1254,6 @@
return field is ClosureFieldElement;
}
- String compiledFieldName(Element member) {
- assert(member.isField());
- return member.hasFixedBackendName()
- ? member.fixedBackendName()
- : namer.getName(member);
- }
-
/**
* Documentation wanted -- johnniwinther
*
@@ -1270,7 +1278,9 @@
builder.addProperty(name, code);
String reflectionName = getReflectionName(member, name);
if (reflectionName != null) {
- builder.addProperty('+$reflectionName', js('0'));
+ var reflectable =
+ js(backend.isAccessibleByReflection(member) ? '1' : '0');
+ builder.addProperty('+$reflectionName', reflectable);
}
code = backend.generatedBailoutCode[member];
if (code != null) {
@@ -1325,7 +1335,10 @@
String getter = '${namer.getterPrefix}$base';
mangledFieldNames[getter] = name;
recordedMangledNames.add(getter);
- return null;
+ // TODO(karlklose,ahe): we do not actually need to store information
+ // about the name of this setter in the output, but it is needed for
+ // marking the function as invokable by reflection.
+ return '$name=';
}
if (elementOrSelector is Selector
|| elementOrSelector.isFunction()
@@ -1861,6 +1874,9 @@
buffer.write(FIELD_CODE_CHARACTERS[code - FIRST_FIELD_CODE]);
}
}
+ if (backend.isAccessibleByReflection(field)) {
+ buffer.write(new String.fromCharCode(REFLECTION_MARKER));
+ }
}
});
}
@@ -2300,7 +2316,8 @@
emitStaticFunction(buffer, name, code);
String reflectionName = getReflectionName(element, name);
if (reflectionName != null) {
- buffer.write(',$n$n"+$reflectionName":${_}0');
+ var reflectable = backend.isAccessibleByReflection(element) ? 1 : 0;
+ buffer.write(',$n$n"+$reflectionName":${_}$reflectable');
}
jsAst.Expression bailoutCode = backend.generatedBailoutCode[element];
if (bailoutCode != null) {
@@ -2809,8 +2826,7 @@
String noSuchMethodName = namer.publicInstanceMethodNameByArity(
Compiler.NO_SUCH_METHOD, Compiler.NO_SUCH_METHOD_ARG_COUNT);
- Element createInvocationMirrorElement =
- compiler.findHelper(const SourceString("createInvocationMirror"));
+ Element createInvocationMirrorElement = backend.getCreateInvocationMirror();
String createInvocationMirrorName =
namer.getName(createInvocationMirrorElement);
@@ -2871,7 +2887,7 @@
}
String createInvocationMirror = namer.getName(
- compiler.createInvocationMirrorElement);
+ backend.getCreateInvocationMirror());
assert(backend.isInterceptedName(Compiler.NO_SUCH_METHOD));
jsAst.Expression expression = js('this.$noSuchMethodName')(
@@ -2907,18 +2923,15 @@
return "${namer.isolateAccess(isolateMain)}($mainAccess)";
}
- String get nameOfDispatchPropertyInitializer => 'initializeDispatchProperty';
-
jsAst.Expression generateDispatchPropertyInitialization() {
- String ref(Element element) {
- return '${namer.CURRENT_ISOLATE}.${namer.getName(element)}';
- }
-
- return js(ref(backend.initializeDispatchPropertyMethod))([
- js.fun(['a'], [ js('${ref(backend.getDispatchPropertyMethod)} = a')]),
- js.string(generateDispatchPropertyName(0)),
- js('${ref(backend.jsPlainJavaScriptObjectClass)}.prototype')
- ]);
+ return js('!#', js.fun([], [
+ js('var objectProto = Object.prototype'),
+ js.for_('var i = 0', null, 'i++', [
+ js('var property = "${generateDispatchPropertyName(0)}"'),
+ js.if_('i > 0', js('property = rootProperty + "_" + i')),
+ js.if_('!(property in objectProto)',
+ js.return_(
+ js('init.dispatchPropertyName = property')))])])());
}
String generateDispatchPropertyName(int seed) {
@@ -2970,8 +2983,7 @@
scripts[i].addEventListener("load", onLoad, false);
}
})(function(currentScript) {
- ${namer.isolateName}.${namer.isolatePropertiesName}.\$currentScript =
- currentScript;
+ init.currentScript = currentScript;
if (typeof console !== "undefined" && typeof document !== "undefined" &&
document.readyState == "loading") {
@@ -3380,6 +3392,10 @@
// }
bool containsArray = classes.contains(backend.jsArrayClass);
bool containsString = classes.contains(backend.jsStringClass);
+ bool containsJsIndexable = classes.any((cls) {
+ return compiler.world.isSubtype(
+ backend.jsIndexingBehaviorInterface, cls);
+ });
// The index set operator requires a check on its set value in
// checked mode, so we don't optimize the interceptor if the
// compiler has type assertions enabled.
@@ -3393,26 +3409,42 @@
jsAst.Expression isIntAndAboveZero = js('a0 >>> 0 === a0');
jsAst.Expression belowLength = js('a0 < receiver.length');
jsAst.Expression arrayCheck = js('receiver.constructor == Array');
+ jsAst.Expression indexableCheck =
+ backend.generateIsJsIndexableCall(js('receiver'), js('receiver'));
+
+ jsAst.Expression orExp(left, right) {
+ return left == null ? right : left.binary('||', right);
+ }
if (selector.isIndex()) {
jsAst.Expression stringCheck = js('typeof receiver == "string"');
jsAst.Expression typeCheck;
if (containsArray) {
- if (containsString) {
- typeCheck = arrayCheck.binary('||', stringCheck);
- } else {
- typeCheck = arrayCheck;
- }
- } else {
- assert(containsString);
- typeCheck = stringCheck;
+ typeCheck = arrayCheck;
+ }
+
+ if (containsString) {
+ typeCheck = orExp(typeCheck, stringCheck);
+ }
+
+ if (containsJsIndexable) {
+ typeCheck = orExp(typeCheck, indexableCheck);
}
return js.if_(typeCheck,
js.if_(isIntAndAboveZero.binary('&&', belowLength),
js.return_(js('receiver[a0]'))));
} else {
- jsAst.Expression isImmutableArray = arrayCheck.binary(
+ jsAst.Expression typeCheck;
+ if (containsArray) {
+ typeCheck = arrayCheck;
+ }
+
+ if (containsJsIndexable) {
+ typeCheck = orExp(typeCheck, indexableCheck);
+ }
+
+ jsAst.Expression isImmutableArray = typeCheck.binary(
'&&', js(r'!receiver.immutable$list'));
return js.if_(isImmutableArray.binary(
'&&', isIntAndAboveZero.binary('&&', belowLength)),
@@ -4030,6 +4062,7 @@
// TODO(ahe): This code should be integrated in finishClasses.
String getReflectionDataParser() {
String metadataField = '"${namer.metadataField}"';
+ String reflectableField = namer.reflectableField;
return '''
(function (reflectionData) {
'''
@@ -4078,7 +4111,9 @@
var previousProperty;
if (firstChar === "+") {
mangledGlobalNames[previousProperty] = property.substring(1);
- if (element && element.length) ''' // Breaking long line.
+ descriptor[previousProperty].''' // Break long line.
+'''$reflectableField = (descriptor[property] == 1);
+ if (element && element.length) ''' // Break long line.
'''init.interfaces[previousProperty] = element;
} else if (firstChar === "@") {
property = property.substring(1);
@@ -4097,6 +4132,8 @@
processStatics(init.statics[property] = element[prop]);
} else if (firstChar === "+") {
mangledNames[previousProp] = prop.substring(1);
+ element[previousProp].''' // Break long line.
+'''$reflectableField = (element[prop] == 1);
} else if (firstChar === "@" && prop !== "@") {
newDesc[prop.substring(1)][$metadataField] = element[prop];
} else {
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
index 64d0cda..325ad0a 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter_no_eval.dart
@@ -154,30 +154,4 @@
js('Isolate.${namer.isolatePropertiesName} = isolateProperties'),
js.return_('Isolate')]);
}
-
- String get nameOfDispatchPropertyInitializer =>
- 'initializeDispatchPropertyCSP';
-
- jsAst.Expression generateDispatchPropertyInitialization() {
- String ref(Element topLevelElement) {
- return '${namer.CURRENT_ISOLATE}.${namer.getName(topLevelElement)}';
- }
-
- jsAst.Expression makeGetter(int seed) {
- return js.fun('a',
- js.return_(js('a.${generateDispatchPropertyName(seed)}')));
- }
-
- List<jsAst.Expression> getters = <jsAst.Expression>[
- makeGetter(3),
- makeGetter(2),
- makeGetter(1),
- makeGetter(0)];
-
- return js(ref(backend.initializeDispatchPropertyMethod))([
- js.fun(['a'], [ js('${ref(backend.getDispatchPropertyMethod)} = a')]),
- new jsAst.ArrayInitializer.from(getters),
- js('${ref(backend.jsPlainJavaScriptObjectClass)}.prototype')
- ]);
- }
}
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
index e1246bf..cfb179c 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart
@@ -182,6 +182,7 @@
final String setterPrefix = r'set$';
final String metadataField = '@';
final String callCatchAllName = r'call$catchAll';
+ final String reflectableField = r'$reflectable';
/**
* Map from top-level or static elements to their unique identifiers provided
@@ -243,6 +244,7 @@
case 'GETTER_PREFIX': return getterPrefix;
case 'SETTER_PREFIX': return setterPrefix;
case 'CALL_CATCH_ALL': return callCatchAllName;
+ case 'REFLECTABLE': return reflectableField;
default:
compiler.reportError(
node, MessageKind.GENERIC,
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
index 9b3ac22..c5ccf96 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
@@ -429,25 +429,19 @@
jsAst.Expression receiver;
List<jsAst.Expression> arguments;
- if (!nativeMethods.contains(member)) {
- // When calling a method that has a native body, we call it with our
- // calling conventions.
- target = backend.namer.getName(member);
- arguments = argumentsBuffer;
- } else {
- // When calling a JS method, we call it with the native name, and only the
- // arguments up until the last one provided.
- target = member.fixedBackendName();
+ assert(invariant(member, nativeMethods.contains(member)));
+ // When calling a JS method, we call it with the native name, and only the
+ // arguments up until the last one provided.
+ target = member.fixedBackendName();
- if (isInterceptedMethod) {
- receiver = argumentsBuffer[0];
- arguments = argumentsBuffer.sublist(1,
- indexOfLastOptionalArgumentInParameters + 1);
- } else {
- receiver = js('this');
- arguments = argumentsBuffer.sublist(0,
- indexOfLastOptionalArgumentInParameters + 1);
- }
+ if (isInterceptedMethod) {
+ receiver = argumentsBuffer[0];
+ arguments = argumentsBuffer.sublist(1,
+ indexOfLastOptionalArgumentInParameters + 1);
+ } else {
+ receiver = js('this');
+ arguments = argumentsBuffer.sublist(0,
+ indexOfLastOptionalArgumentInParameters + 1);
}
statements.add(new jsAst.Return(receiver[target](arguments)));
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
index 144f395..98707c6 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
@@ -562,6 +562,10 @@
Element findLocalMemberIn(Element element, SourceString name) {
if (element is ScopeContainerElement) {
ScopeContainerElement scope = element;
+ if (element.isClass()) {
+ ClassElement cls = element;
+ cls.ensureResolved(compiler);
+ }
return scope.localLookup(name);
}
return null;
diff --git a/sdk/lib/_internal/compiler/implementation/patch_parser.dart b/sdk/lib/_internal/compiler/implementation/patch_parser.dart
index 5ae5779..d21e842 100644
--- a/sdk/lib/_internal/compiler/implementation/patch_parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/patch_parser.dart
@@ -401,6 +401,7 @@
origin.isConstructor() ||
origin.isFunction() ||
origin.isAbstractField())) {
+ // TODO(ahe): Remove this error when the parser rejects all bad modifiers.
listener.reportError(origin, leg.MessageKind.PATCH_NONPATCHABLE);
return;
}
@@ -415,6 +416,7 @@
} else if(patch.isFunction()) {
tryPatchFunction(listener, origin, patch);
} else {
+ // TODO(ahe): Remove this error when the parser rejects all bad modifiers.
listener.reportError(patch, leg.MessageKind.PATCH_NONPATCHABLE);
}
}
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/listener.dart b/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
index ab20f51..314e8d7 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
@@ -595,6 +595,22 @@
void error(String message, Token token) {
throw new ParserError("$message @ ${token.charOffset}");
}
+
+ void reportError(Spannable spannable,
+ MessageKind errorCode,
+ [Map arguments = const {}]) {
+ String message = errorCode.error(arguments, true).toString();
+ Token token;
+ Node node;
+ if (spannable is Token) {
+ token = spannable;
+ } else if (spannable is Node) {
+ node = spannable;
+ } else {
+ throw new ParserError(message);
+ }
+ recoverableError(message, token: token, node: node);
+ }
}
class ParserError {
@@ -1122,6 +1138,12 @@
}
pushNode(accumulator);
}
+
+ void reportError(Spannable spannable,
+ MessageKind errorCode,
+ [Map arguments = const {}]) {
+ listener.reportError(spannable, errorCode, arguments);
+ }
}
class NodeListener extends ElementListener {
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart
index 327d1f2..064136f 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/parser.dart
@@ -48,7 +48,8 @@
Token parseTopLevelDeclaration(Token token) {
token = parseMetadataStar(token);
final String value = token.stringValue;
- if ((identical(value, 'abstract')) || (identical(value, 'class'))) {
+ if ((identical(value, 'abstract') && optional('class', token.next))
+ || identical(value, 'class')) {
return parseClass(token);
} else if (identical(value, 'typedef')) {
return parseTypedef(token);
@@ -613,14 +614,8 @@
identifiers = identifiers.tail;
}
}
- parseModifierList(identifiers.reverse());
- if (type == null) {
- listener.handleNoType(token);
- } else {
- parseReturnTypeOpt(type);
- }
- token = parseIdentifier(name);
+ token = name.next;
bool isField;
while (true) {
// Loop to allow the listener to rewrite the token stream for
@@ -645,32 +640,173 @@
break;
} else {
token = listener.unexpected(token);
- if (identical(token.kind, EOF_TOKEN)) {
- // TODO(ahe): This is a hack. It would be better to tell the
- // listener more explicitly that it must pop an identifier.
- listener.endTopLevelFields(1, start, token);
- return token;
- }
+ if (identical(token.kind, EOF_TOKEN)) return token;
}
}
- if (isField) {
- int fieldCount = 1;
- token = parseVariableInitializerOpt(token);
- while (optional(',', token)) {
- token = parseIdentifier(token.next);
- token = parseVariableInitializerOpt(token);
- ++fieldCount;
+ var modifiers = identifiers.reverse();
+ return isField
+ ? parseFields(start, modifiers, type, getOrSet, name, true)
+ : parseTopLevelMethod(start, modifiers, type, getOrSet, name);
+ }
+
+ bool isVarFinalOrConst(Token token) {
+ String value = token.stringValue;
+ return identical('var', value)
+ || identical('final', value)
+ || identical('const', value);
+ }
+
+ Token expectVarFinalOrConst(Link<Token> modifiers,
+ bool hasType,
+ bool allowStatic) {
+ int modifierCount = 0;
+ Token staticModifier;
+ if (allowStatic && !modifiers.isEmpty
+ && optional('static', modifiers.head)) {
+ staticModifier = modifiers.head;
+ modifierCount++;
+ parseModifier(staticModifier);
+ modifiers = modifiers.tail;
+ }
+ if (modifiers.isEmpty) {
+ listener.handleModifiers(modifierCount);
+ return null;
+ }
+ if (modifiers.tail.isEmpty) {
+ Token modifier = modifiers.head;
+ if (isVarFinalOrConst(modifier)) {
+ modifierCount++;
+ parseModifier(modifier);
+ listener.handleModifiers(modifierCount);
+ // TODO(ahe): The caller checks for "var Type name", perhaps we should
+ // check here instead.
+ return modifier;
}
- expectSemicolon(token);
+ }
+
+ // Slow case to report errors.
+ List<Token> modifierList = modifiers.toList();
+ Token varFinalOrConst =
+ modifierList.firstWhere(isVarFinalOrConst, orElse: () => null);
+ if (allowStatic && staticModifier == null) {
+ staticModifier =
+ modifierList.firstWhere(
+ (modifier) => optional('static', modifier), orElse: () => null);
+ if (staticModifier != null) {
+ modifierCount++;
+ parseModifier(staticModifier);
+ modifierList.remove(staticModifier);
+ }
+ }
+ bool hasTypeOrModifier = hasType;
+ if (varFinalOrConst != null) {
+ parseModifier(varFinalOrConst);
+ modifierCount++;
+ hasTypeOrModifier = true;
+ modifierList.remove(varFinalOrConst);
+ }
+ listener.handleModifiers(modifierCount);
+ var kind = hasTypeOrModifier
+ ? MessageKind.EXTRANEOUS_MODIFIER
+ : MessageKind.EXTRANEOUS_MODIFIER_REPLACE;
+ for (Token modifier in modifierList) {
+ listener.reportError(modifier, kind, {'modifier': modifier});
+ }
+ return null;
+ }
+
+ Token parseFields(Token start,
+ Link<Token> modifiers,
+ Token type,
+ Token getOrSet,
+ Token name,
+ bool isTopLevel) {
+ bool hasType = type != null;
+ Token varFinalOrConst =
+ expectVarFinalOrConst(modifiers, hasType, !isTopLevel);
+ bool isVar = false;
+ bool hasModifier = false;
+ if (varFinalOrConst != null) {
+ hasModifier = true;
+ isVar = optional('var', varFinalOrConst);
+ }
+
+ if (getOrSet != null) {
+ var kind = (hasModifier || hasType)
+ ? MessageKind.EXTRANEOUS_MODIFIER
+ : MessageKind.EXTRANEOUS_MODIFIER_REPLACE;
+ listener.reportError(getOrSet, kind, {'modifier': getOrSet});
+ }
+
+ if (!hasType) {
+ listener.handleNoType(name);
+ } else if (optional('void', type)) {
+ listener.handleNoType(name);
+ // TODO(ahe): This error is reported twice, second time is from
+ // [parseVariablesDeclarationMaybeSemicolon] via
+ // [PartialFieldListElement.parseNode].
+ listener.reportError(type, MessageKind.VOID_NOT_ALLOWED);
+ } else {
+ parseType(type);
+ if (isVar) {
+ listener.reportError(
+ modifiers.head, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': modifiers.head});
+ }
+ }
+
+ Token token = parseIdentifier(name);
+
+ int fieldCount = 1;
+ token = parseVariableInitializerOpt(token);
+ while (optional(',', token)) {
+ token = parseIdentifier(token.next);
+ token = parseVariableInitializerOpt(token);
+ ++fieldCount;
+ }
+ expectSemicolon(token);
+ if (isTopLevel) {
listener.endTopLevelFields(fieldCount, start, token);
} else {
- token = parseFormalParametersOpt(token);
- token = parseFunctionBody(token, false);
- listener.endTopLevelMethod(start, getOrSet, token);
+ listener.endFields(fieldCount, start, token);
}
return token.next;
}
+ Token parseTopLevelMethod(Token start,
+ Link<Token> modifiers,
+ Token type,
+ Token getOrSet,
+ Token name) {
+ Token externalModifier;
+ for (Token modifier in modifiers) {
+ if (externalModifier == null && optional('external', modifier)) {
+ externalModifier = modifier;
+ } else {
+ listener.reportError(
+ modifier, MessageKind.EXTRANEOUS_MODIFIER, {'modifier': modifier});
+ }
+ }
+ if (externalModifier != null) {
+ parseModifier(externalModifier);
+ listener.handleModifiers(1);
+ } else {
+ listener.handleModifiers(0);
+ }
+
+ if (type == null) {
+ listener.handleNoType(name);
+ } else {
+ parseReturnTypeOpt(type);
+ }
+ Token token = parseIdentifier(name);
+
+ token = parseFormalParametersOpt(token);
+ token = parseFunctionBody(token, false, externalModifier != null);
+ listener.endTopLevelMethod(start, getOrSet, token);
+ return token.next;
+ }
+
Link<Token> findMemberName(Token token) {
Token start = token;
Link<Token> identifiers = const Link<Token>();
@@ -877,6 +1013,7 @@
return listener.unexpected(start);
}
Token name = identifiers.head;
+ Token afterName = name.next;
identifiers = identifiers.tail;
if (!identifiers.isEmpty) {
if (optional('operator', identifiers.head)) {
@@ -898,18 +1035,8 @@
identifiers = identifiers.tail;
}
}
- parseModifierList(identifiers.reverse());
- if (type == null) {
- listener.handleNoType(token);
- } else {
- parseReturnTypeOpt(type);
- }
- if (optional('operator', name)) {
- token = parseOperatorName(name);
- } else {
- token = parseIdentifier(name);
- }
+ token = afterName;
bool isField;
while (true) {
// Loop to allow the listener to rewrite the token stream for
@@ -941,38 +1068,96 @@
}
}
}
- if (isField) {
- int fieldCount = 1;
- token = parseVariableInitializerOpt(token);
- if (getOrSet != null) {
- listener.recoverableError("unexpected", token: getOrSet);
- }
- while (optional(',', token)) {
- // TODO(ahe): Count these.
- token = parseIdentifier(token.next);
- token = parseVariableInitializerOpt(token);
- ++fieldCount;
- }
- expectSemicolon(token);
- listener.endFields(fieldCount, start, token);
- } else {
- token = parseQualifiedRestOpt(token);
- token = parseFormalParametersOpt(token);
- token = parseInitializersOpt(token);
- if (optional('=', token)) {
- token = parseRedirectingFactoryBody(token);
+
+ var modifiers = identifiers.reverse();
+ return isField
+ ? parseFields(start, modifiers, type, getOrSet, name, false)
+ : parseMethod(start, modifiers, type, getOrSet, name);
+
+ }
+
+ Token parseMethod(Token start,
+ Link<Token> modifiers,
+ Token type,
+ Token getOrSet,
+ Token name) {
+ Token externalModifier;
+ Token staticModifier;
+ Token constModifier;
+ int modifierCount = 0;
+ int allowedModifierCount = 1;
+ for (Token modifier in modifiers) {
+ if (externalModifier == null && optional('external', modifier)) {
+ modifierCount++;
+ externalModifier = modifier;
+ if (modifierCount != allowedModifierCount) {
+ listener.reportError(
+ modifier,
+ MessageKind.EXTRANEOUS_MODIFIER, {'modifier': modifier});
+ }
+ allowedModifierCount++;
+ } else if (staticModifier == null && optional('static', modifier)) {
+ modifierCount++;
+ staticModifier = modifier;
+ if (modifierCount != allowedModifierCount) {
+ listener.reportError(
+ modifier,
+ MessageKind.EXTRANEOUS_MODIFIER, {'modifier': modifier});
+ }
+ } else if (constModifier == null && optional('const', modifier)) {
+ modifierCount++;
+ constModifier = modifier;
+ if (modifierCount != allowedModifierCount) {
+ listener.reportError(
+ modifier,
+ MessageKind.EXTRANEOUS_MODIFIER, {'modifier': modifier});
+ }
} else {
- token = parseFunctionBody(token, false);
+ listener.reportError(
+ modifier, MessageKind.EXTRANEOUS_MODIFIER, {'modifier': modifier});
}
- listener.endMethod(getOrSet, start, token);
}
+ parseModifierList(modifiers);
+
+ if (type == null) {
+ listener.handleNoType(name);
+ } else {
+ parseReturnTypeOpt(type);
+ }
+ Token token;
+ if (optional('operator', name)) {
+ token = parseOperatorName(name);
+ if (staticModifier != null) {
+ // TODO(ahe): Consider a more specific error message.
+ listener.reportError(
+ staticModifier, MessageKind.EXTRANEOUS_MODIFIER,
+ {'modifier': staticModifier});
+ }
+ } else {
+ token = parseIdentifier(name);
+ }
+
+ token = parseQualifiedRestOpt(token);
+ token = parseFormalParametersOpt(token);
+ token = parseInitializersOpt(token);
+ if (optional('=', token)) {
+ token = parseRedirectingFactoryBody(token);
+ } else {
+ token = parseFunctionBody(
+ token, false, staticModifier == null || externalModifier != null);
+ }
+ listener.endMethod(getOrSet, start, token);
return token.next;
}
Token parseFactoryMethod(Token token) {
assert(isFactoryDeclaration(token));
Token start = token;
- if (identical(token.stringValue, 'external')) token = token.next;
+ Token externalModifier;
+ if (identical(token.stringValue, 'external')) {
+ externalModifier = token;
+ token = token.next;
+ }
Token constKeyword = null;
if (optional('const', token)) {
constKeyword = token;
@@ -986,7 +1171,7 @@
if (optional('=', token)) {
token = parseRedirectingFactoryBody(token);
} else {
- token = parseFunctionBody(token, false);
+ token = parseFunctionBody(token, false, externalModifier != null);
}
listener.endFactoryMethod(start, token);
return token.next;
@@ -1029,7 +1214,7 @@
if (optional('=', token)) {
token = parseRedirectingFactoryBody(token);
} else {
- token = parseFunctionBody(token, false);
+ token = parseFunctionBody(token, false, true);
}
listener.endFunction(getOrSet, token);
return token.next;
@@ -1039,7 +1224,7 @@
listener.beginUnamedFunction(token);
token = parseFormalParameters(token);
bool isBlock = optional('{', token);
- token = parseFunctionBody(token, true);
+ token = parseFunctionBody(token, true, false);
listener.endUnamedFunction(token);
return isBlock ? token.next : token;
}
@@ -1061,7 +1246,7 @@
token = parseFormalParameters(token);
listener.handleNoInitializers();
bool isBlock = optional('{', token);
- token = parseFunctionBody(token, true);
+ token = parseFunctionBody(token, true, false);
listener.endFunction(null, token);
return isBlock ? token.next : token;
}
@@ -1092,8 +1277,11 @@
return token;
}
- Token parseFunctionBody(Token token, bool isExpression) {
+ Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) {
if (optional(';', token)) {
+ if (!allowAbstract) {
+ listener.reportError(token, MessageKind.BODY_EXPECTED);
+ }
listener.endFunctionBody(0, null, token);
return token;
} else if (optional('=>', token)) {
@@ -1825,6 +2013,7 @@
}
Token parseVariablesDeclarationNoSemicolon(Token token) {
+ // Only called when parsing a for loop, so this is for parsing locals.
return parseVariablesDeclarationMaybeSemicolon(token, false);
}
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart b/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart
index 3b666ae..8054487 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart
@@ -95,10 +95,13 @@
return endGroup;
}
- Token parseFunctionBody(Token token, bool isExpression) {
+ Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) {
assert(!isExpression);
String value = token.stringValue;
if (identical(value, ';')) {
+ if (!allowAbstract) {
+ listener.reportError(token, MessageKind.BODY_EXPECTED);
+ }
// No body.
} else if (identical(value, '=>')) {
token = parseExpression(token.next);
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index a9113e1..4c175a7 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -1664,7 +1664,21 @@
// We're accessing a native JavaScript property called 'length'
// on a JS String or a JS array. Therefore, the name of that
// property should not be mangled.
- push(new js.PropertyAccess.field(pop(), 'length'), node);
+ if (backend.isTypedArray(
+ node.receiver.instructionType.computeMask(compiler))) {
+ // TODO(12929): Remove this custom code for typed arrays once V8
+ // optimizes their length access.
+ // Do a call to `fetchLength` instead of accessing `length`
+ // directly. Because `fetchLength` is a constant we use its
+ // constant value instead.
+ Element element = compiler.findRequiredElement(
+ compiler.typedDataLibrary, const SourceString('fetchLength'));
+ Constant constant = compiler.constantHandler.compileConstant(element);
+ var jsConstant = backend.emitter.constantReference(constant);
+ push(new js.Call(jsConstant, [pop()]), node);
+ } else {
+ push(new js.PropertyAccess.field(pop(), 'length'), node);
+ }
} else {
String name = _fieldPropertyName(element);
push(new js.PropertyAccess.field(pop(), name), node);
@@ -2190,30 +2204,19 @@
push(new js.Binary('!=', pop(), new js.LiteralNull()));
}
- void checkIndexingBehavior(HInstruction input, {bool negative: false}) {
+ bool checkIndexingBehavior(HInstruction input, {bool negative: false}) {
+ if (!compiler.enqueuer.resolution.seenClasses.contains(
+ backend.jsIndexingBehaviorInterface)) {
+ return false;
+ }
+
use(input);
- js.Expression object = pop();
-
- Element dispatchProperty =
- compiler.findInterceptor(const SourceString('dispatchPropertyName'));
- String dispatchPropertyName =
- backend.namer.isolateAccess(dispatchProperty);
- world.registerStaticUse(dispatchProperty);
-
- // We pass the dispatch property record to the isJsIndexable
- // helper rather than reading it inside the helper to increase the
- // chance of making the dispatch record access monomorphic.
+ js.Expression object1 = pop();
use(input);
- js.PropertyAccess record = new js.PropertyAccess(
- pop(), new js.VariableUse(dispatchPropertyName));
-
- List<js.Expression> arguments = <js.Expression>[object, record];
- FunctionElement helper =
- compiler.findHelper(const SourceString('isJsIndexable'));
- world.registerStaticUse(helper);
- String helperName = backend.namer.isolateAccess(helper);
- push(new js.Call(new js.VariableUse(helperName), arguments));
+ js.Expression object2 = pop();
+ push(backend.generateIsJsIndexableCall(object1, object2));
if (negative) push(new js.Prefix('!', pop()));
+ return true;
}
void checkType(HInstruction input, HInstruction interceptor,
@@ -2447,8 +2450,10 @@
js.Expression arrayTest = pop();
checkImmutableArray(input);
js.Binary notArrayOrImmutable = new js.Binary('||', arrayTest, pop());
- checkIndexingBehavior(input, negative: true);
- js.Binary notIndexing = new js.Binary('&&', notArrayOrImmutable, pop());
+
+ js.Binary notIndexing = checkIndexingBehavior(input, negative: true)
+ ? new js.Binary('&&', notArrayOrImmutable, pop())
+ : notArrayOrImmutable;
test = new js.Binary('||', objectTest, notIndexing);
} else if (node.isReadableArray(compiler)) {
// input is !Object
@@ -2457,8 +2462,10 @@
js.Expression objectTest = pop();
checkArray(input, '!==');
js.Expression arrayTest = pop();
- checkIndexingBehavior(input, negative: true);
- js.Expression notIndexing = new js.Binary('&&', arrayTest, pop());
+
+ js.Expression notIndexing = checkIndexingBehavior(input, negative: true)
+ ? new js.Binary('&&', arrayTest, pop())
+ : arrayTest;
test = new js.Binary('||', objectTest, notIndexing);
} else if (node.isIndexablePrimitive(compiler)) {
// input is !String
@@ -2470,8 +2477,10 @@
js.Expression objectTest = pop();
checkArray(input, '!==');
js.Expression arrayTest = pop();
- checkIndexingBehavior(input, negative: true);
- js.Binary notIndexingTest = new js.Binary('&&', arrayTest, pop());
+
+ js.Binary notIndexingTest = checkIndexingBehavior(input, negative: true)
+ ? new js.Binary('&&', arrayTest, pop())
+ : arrayTest;
js.Binary notObjectOrIndexingTest =
new js.Binary('||', objectTest, notIndexingTest);
test = new js.Binary('&&', stringTest, notObjectOrIndexingTest);
diff --git a/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart b/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
index a549a6e..e7061a9 100644
--- a/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
@@ -12,7 +12,7 @@
import '../elements/elements.dart';
import '../native_handler.dart' as native;
import '../tree/tree.dart';
-import '../util/util.dart' show Link;
+import '../util/util.dart' show Link, Spannable;
import 'types.dart'
show TypesInferrer, FlatTypeMask, TypeMask, ContainerTypeMask,
ElementTypeMask, TypeSystem, MinimalInferrerEngine;
@@ -168,7 +168,7 @@
* Assignments on the element and the types inferred at
* these assignments.
*/
- Map<Node, TypeMask> get assignments => null;
+ Map<Spannable, TypeMask> get assignments => null;
/**
* Callers of an element.
@@ -204,7 +204,7 @@
}
}
- void addAssignment(Node node, TypeMask mask) {
+ void addAssignment(Spannable node, TypeMask mask) {
assignments[node] = mask;
}
@@ -223,7 +223,7 @@
}
class ParameterTypeInformation extends TypeInformation {
- Map<Node, TypeMask> assignments = new Map<Node, TypeMask>();
+ Map<Spannable, TypeMask> assignments = new Map<Spannable, TypeMask>();
TypeMask type;
TypeMask defaultType;
@@ -235,7 +235,7 @@
class FieldTypeInformation extends TypeInformation {
TypeMask type;
Map<Element, int> callers = new Map<Element, int>();
- Map<Node, TypeMask> assignments = new Map<Node, TypeMask>();
+ Map<Spannable, TypeMask> assignments = new Map<Spannable, TypeMask>();
int analyzeCount = 0;
void clear() {
@@ -384,7 +384,7 @@
* [constraint] is a field assignment constraint, as described in
* [InternalSimpleTypesInferrer].
*/
- void recordTypeOfNonFinalField(Node node,
+ void recordTypeOfNonFinalField(Spannable node,
Element field,
T type,
CallSite constraint);
@@ -407,7 +407,7 @@
void recordReturnType(Element element, T type);
/**
- * Registers that [caller] calls [callee] at node [node], with
+ * Registers that [caller] calls [callee] at location [node], with
* [selector], and [arguments]. Note that [selector] is null for
* forwarding constructors.
*
@@ -419,7 +419,7 @@
*
* [inLoop] tells whether the call happens in a loop.
*/
- void registerCalledElement(Node node,
+ void registerCalledElement(Spannable node,
Selector selector,
Element caller,
Element callee,
@@ -626,7 +626,7 @@
* returns that type.
*
*/
- Map<Node, CallSite> setterConstraints = new Map<Node, CallSite>();
+ Map<Spannable, CallSite> setterConstraints = new Map<Spannable, CallSite>();
/**
* The work list of the inferrer.
@@ -1184,7 +1184,7 @@
typeInformationOf(callee).addCaller(caller);
}
- bool addArguments(Node node,
+ bool addArguments(Spannable node,
FunctionElement element,
ArgumentsTypes arguments) {
FunctionTypeInformation info = typeInformationOf(element);
@@ -1232,7 +1232,7 @@
ParameterTypeInformation info = typeInformationOf(parameter);
TypeMask elementType;
- info.assignments.forEach((Node node, TypeMask mask) {
+ info.assignments.forEach((Spannable node, TypeMask mask) {
if (mask == null) {
// Now that we know we have analyzed the function holding
// [parameter], we have a default type for that [parameter].
@@ -1259,7 +1259,7 @@
* [arguments]. [constraint] is a setter constraint (see
* [setterConstraints] documentation).
*/
- void registerCalledElement(Node node,
+ void registerCalledElement(Spannable node,
Selector selector,
Element caller,
Element callee,
@@ -1329,7 +1329,7 @@
typeInformationOf(callee).removeCall(caller);
if (callee.isField()) {
if (selector.isSetter()) {
- Map<Node, TypeMask> assignments = typeInformationOf(callee).assignments;
+ Map<Spannable, TypeMask> assignments = typeInformationOf(callee).assignments;
if (assignments == null || !assignments.containsKey(node)) return;
assignments.remove(node);
if (hasAnalyzedAll) updateNonFinalFieldType(callee);
@@ -1339,7 +1339,7 @@
} else {
FunctionElement element = callee;
element.computeSignature(compiler).forEachParameter((Element parameter) {
- Map<Node, TypeMask> assignments =
+ Map<Spannable, TypeMask> assignments =
typeInformationOf(parameter).assignments;
if (assignments == null || !assignments.containsKey(node)) return;
assignments.remove(node);
@@ -1438,7 +1438,7 @@
* Records an assignment to [element] with the given
* [argumentType].
*/
- void recordTypeOfNonFinalField(Node node,
+ void recordTypeOfNonFinalField(Spannable node,
Element element,
TypeMask argumentType,
CallSite constraint) {
@@ -1457,10 +1457,10 @@
}
TypeMask computeTypeWithConstraints(Element element,
- Map<Node, TypeMask> assignments) {
+ Map<Spannable, TypeMask> assignments) {
List<CallSite> constraints = <CallSite>[];
TypeMask elementType;
- assignments.forEach((Node node, TypeMask mask) {
+ assignments.forEach((Spannable node, TypeMask mask) {
CallSite constraint = setterConstraints[node];
if (constraint != null) {
// If this update has a constraint, we collect it and don't
@@ -1516,7 +1516,7 @@
assert(hasAnalyzedAll);
TypeInformation info = typeInformationOf(element);
- Map<Node, TypeMask> assignments = info.assignments;
+ Map<Spannable, TypeMask> assignments = info.assignments;
if (assignments.isEmpty) return;
TypeMask fieldType = computeTypeWithConstraints(element, assignments);
@@ -1675,14 +1675,12 @@
parameterType,
null);
}
- } else {
- locals.update(element, parameterType, node);
}
+ locals.update(element, parameterType, node);
});
if (analyzedElement.isSynthesized) {
- // Use the enclosing class of the synthesized constructor as
- // the location for the initialized fields.
- node = analyzedElement.enclosingElement.parseNode(compiler);
+ node = analyzedElement;
+ synthesizeForwardingCall(node, analyzedElement.targetConstructor);
} else {
visitingInitializers = true;
visit(node.initializers);
@@ -2237,40 +2235,45 @@
returnType = inferrer.addReturnTypeFor(analyzedElement, returnType, type);
}
+ void synthesizeForwardingCall(Spannable node, FunctionElement element) {
+ element = element.implementation;
+ FunctionElement function = analyzedElement;
+ FunctionSignature signature = function.computeSignature(compiler);
+ List<T> unnamed = <T>[];
+ Map<SourceString, T> named = new Map<SourceString, T>();
+ signature.forEachRequiredParameter((Element element) {
+ assert(locals.use(element) != null);
+ unnamed.add(locals.use(element));
+ });
+ signature.forEachOptionalParameter((Element element) {
+ if (signature.optionalParametersAreNamed) {
+ named[element.name] = locals.use(element);
+ } else {
+ unnamed.add(locals.use(element));
+ }
+ });
+ ArgumentsTypes arguments = new ArgumentsTypes<T>(unnamed, named);
+ inferrer.registerCalledElement(node,
+ null,
+ outermostElement,
+ element,
+ arguments,
+ null,
+ sideEffects,
+ inLoop);
+ }
+
T visitReturn(Return node) {
if (node.isRedirectingFactoryBody) {
Element element = elements[node.expression];
if (Elements.isErroneousElement(element)) {
recordReturnType(types.dynamicType);
} else {
- element = element.implementation;
// We don't create a selector for redirecting factories, and
// the send is just a property access. Therefore we must
// manually create the [ArgumentsTypes] of the call, and
// manually register [analyzedElement] as a caller of [element].
- FunctionElement function = analyzedElement;
- FunctionSignature signature = function.computeSignature(compiler);
- List<T> unnamed = <T>[];
- Map<SourceString, T> named = new Map<SourceString, T>();
- signature.forEachRequiredParameter((Element element) {
- unnamed.add(locals.use(element));
- });
- signature.forEachOptionalParameter((Element element) {
- if (signature.optionalParametersAreNamed) {
- named[element.name] = locals.use(element);
- } else {
- unnamed.add(locals.use(element));
- }
- });
- ArgumentsTypes arguments = new ArgumentsTypes<T>(unnamed, named);
- inferrer.registerCalledElement(node.expression,
- null,
- outermostElement,
- element,
- arguments,
- null,
- sideEffects,
- inLoop);
+ synthesizeForwardingCall(node.expression, element);
recordReturnType(inferrer.returnTypeOfElement(element));
}
} else {
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 7edacfa..2fe05d7 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -4,6 +4,8 @@
part of dart2js;
+const DONT_KNOW_HOW_TO_FIX = "";
+
/**
* The messages in this file should meet the following guide lines:
*
@@ -540,7 +542,13 @@
warning: const MessageKind('Warning: Cannot resolve setter.'));
static const MessageKind VOID_NOT_ALLOWED = const MessageKind(
- 'Error: Type "void" is only allowed in a return type.');
+ "Error: Type 'void' can't be used here because it isn't a return type.",
+ howToFix: "Try removing 'void' keyword or replace it with 'var', 'final',"
+ " or a type.",
+ examples: const [
+ "void x; main() {}",
+ "foo(void x) {} main() { foo(null); }",
+ ]);
static const MessageKind BEFORE_TOP_LEVEL = const MessageKind(
'Error: Part header must come before top-level definitions.');
@@ -659,7 +667,7 @@
howToFix: "Did you forget to add quotes?",
examples: const [
"""
-// 'main' is a method, not a class.
+// 'Foo' is a type literal, not a string.
@MirrorsUsed(symbols: const [Foo])
import 'dart:mirrors';
@@ -754,6 +762,8 @@
static const MessageKind READ_SCRIPT_ERROR = const MessageKind(
"Error: Can't read '#{uri}' (#{exception}).",
+ // Don't know how to fix since the underlying error is unknown.
+ howToFix: DONT_KNOW_HOW_TO_FIX,
examples: const [
"""
// 'foo.dart' does not exist.
@@ -762,6 +772,47 @@
main() {}
"""]);
+ static const MessageKind EXTRANEOUS_MODIFIER = const MessageKind(
+ "Error: Can't have modifier '#{modifier}' here.",
+ howToFix: "Try removing '#{modifier}'.",
+ examples: const [
+ "var String foo; main(){}",
+ // "var get foo; main(){}",
+ "var set foo; main(){}",
+ "var final foo; main(){}",
+ "var var foo; main(){}",
+ "var const foo; main(){}",
+ "var abstract foo; main(){}",
+ "var static foo; main(){}",
+ "var external foo; main(){}",
+ "get var foo; main(){}",
+ "set var foo; main(){}",
+ "final var foo; main(){}",
+ "var var foo; main(){}",
+ "const var foo; main(){}",
+ "abstract var foo; main(){}",
+ "static var foo; main(){}",
+ "external var foo; main(){}"]);
+
+ static const MessageKind EXTRANEOUS_MODIFIER_REPLACE = const MessageKind(
+ "Error: Can't have modifier '#{modifier}' here.",
+ howToFix: "Try replacing modifier '#{modifier}' with 'var', 'final',"
+ " or a type.",
+ examples: const [
+ // "get foo; main(){}",
+ "set foo; main(){}",
+ "abstract foo; main(){}",
+ "static foo; main(){}",
+ "external foo; main(){}"]);
+
+ static const MessageKind BODY_EXPECTED = const MessageKind(
+ "Error: Expected a function body or '=>'.",
+ // TODO(ahe): In some scenarios, we can suggest removing the 'static'
+ // keyword.
+ howToFix: "Try adding {}.",
+ examples: const [
+ "main();"]);
+
static const MessageKind COMPILER_CRASHED = const MessageKind(
'Error: The compiler crashed when compiling this element.');
@@ -844,6 +895,8 @@
static const MessageKind PATCH_NON_EXISTING = const MessageKind(
'Error: Origin does not exist for patch "#{name}".');
+ // TODO(ahe): Eventually, this error should be removed as it will be handled
+ // by the regular parser.
static const MessageKind PATCH_NONPATCHABLE = const MessageKind(
'Error: Only classes and functions can be patched.');
@@ -886,6 +939,8 @@
CompilationError error([Map arguments = const {}, bool terse = false]) {
return new CompilationError(this, arguments, terse);
}
+
+ bool get hasHowToFix => howToFix != null && howToFix != DONT_KNOW_HOW_TO_FIX;
}
class DualKind {
@@ -916,7 +971,7 @@
CURRENT_ELEMENT_SPANNABLE,
!message.contains(new RegExp(r'#\{.+\}')),
message: 'Missing arguments in error message: "$message"'));
- if (!terse && kind.howToFix != null) {
+ if (!terse && kind.hasHowToFix) {
String howToFix = kind.howToFix;
arguments.forEach((key, value) {
String string = slowToString(value);
diff --git a/sdk/lib/_internal/compiler/implementation/world.dart b/sdk/lib/_internal/compiler/implementation/world.dart
index 2382113..4d25945 100644
--- a/sdk/lib/_internal/compiler/implementation/world.dart
+++ b/sdk/lib/_internal/compiler/implementation/world.dart
@@ -174,6 +174,11 @@
: false;
}
+ bool isSubtype(ClassElement supertype, ClassElement test) {
+ Set<ClassElement> subtypes = subtypesOf(supertype);
+ return subtypes != null && subtypes.contains(test.declaration);
+ }
+
void registerUsedElement(Element element) {
if (element.isInstanceMember() && !element.isAbstract(compiler)) {
allFunctions.add(element);
diff --git a/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart b/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart
index 82232c9..931e24b 100644
--- a/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart
+++ b/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
-import 'dart:json';
+import 'dart:convert';
// TODO(ahe): Should be dart:mirrors.
import '../../implementation/mirrors/mirrors.dart';
@@ -92,7 +92,7 @@
library dart.sdk_sources;
const Map<String, String> SDK_SOURCES = const <String, String>''');
- output.writeStringSync(stringify(map).replaceAll(r'$', r'\$'));
+ output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$'));
output.writeStringSync(';\n');
output.closeSync();
}
diff --git a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
index f005351..1f94af6 100644
--- a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
@@ -17,9 +17,9 @@
library dartdoc;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
import 'dart:isolate';
-import 'dart:json' as json;
import 'dart:math';
import 'package:path/path.dart' as path;
@@ -778,7 +778,7 @@
*/
void docNavigationJson() {
startFile('nav.json');
- writeln(json.stringify(createNavigationInfo()));
+ writeln(JSON.encode(createNavigationInfo()));
endFile();
}
/// Whether dartdoc is running from within the Dart SDK or the
@@ -802,7 +802,7 @@
if (!tmpDir.existsSync()) {
tmpDir.createSync();
}
- String jsonString = json.stringify(createNavigationInfo());
+ String jsonString = JSON.encode(createNavigationInfo());
String dartString = jsonString.replaceAll(r"$", r"\$");
var filePath = path.join(tmpPath, 'client.dart');
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 9d52c49..958fcb1 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
@@ -6,7 +6,7 @@
library client;
import 'dart:html';
-import 'dart:json' as jsonlib;
+import 'dart:convert';
// TODO(rnystrom): Use "package:" URL (#4968).
import '../../classify.dart';
import '../../markdown.dart' as md;
@@ -20,7 +20,7 @@
// Request the navigation data so we can build the HTML for it.
HttpRequest.getString('${prefix}nav.json').then((text) {
- var json = jsonlib.parse(text);
+ var json = JSON.decode(text);
buildNavigation(json);
setupSearch(json);
});
diff --git a/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart b/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart
index 9f9915ab..8bfa7bb 100755
--- a/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart
+++ b/sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart
@@ -10,8 +10,8 @@
library json_serializer;
import 'dart:async';
+import 'dart:convert';
import 'dart:mirrors';
-import 'dart:json' as json;
String serialize(Object o) {
var printer = new JsonPrinter();
@@ -207,7 +207,7 @@
} else {
// Convenient hack to remove the pretty printing this serializer adds by
// default.
- return json.stringify(json.parse(_sb.toString()));
+ return JSON.encode(JSON.decode(_sb.toString()));
}
}
diff --git a/sdk/lib/_internal/lib/async_patch.dart b/sdk/lib/_internal/lib/async_patch.dart
index 78ce9cd..850d4e6 100644
--- a/sdk/lib/_internal/lib/async_patch.dart
+++ b/sdk/lib/_internal/lib/async_patch.dart
@@ -40,39 +40,56 @@
// TODO(ahe): Validate libraryName. Kasper points out that you want
// to be able to experiment with the effect of toggling @DeferLoad,
// so perhaps we should silently ignore "bad" library names.
- Completer completer = new Completer<bool>();
Future<bool> future = _loadedLibraries[libraryName];
if (future != null) {
- future.then((_) { completer.complete(false); });
- return completer.future;
- }
- _loadedLibraries[libraryName] = completer.future;
-
- if (uri == null) {
- uri = IsolateNatives.thisScript;
- int index = uri.lastIndexOf('/');
- uri = '${uri.substring(0, index + 1)}part.js';
+ return future.then((_) => false);
}
- if (_hasDocument) {
+ if (IsolateNatives.isJsshell) {
+ // TODO(ahe): Move this code to a JavaScript command helper script that is
+ // not included in generated output.
+ return _loadedLibraries[libraryName] = new Future<bool>(() {
+ if (uri == null) uri = 'part.js';
+ // Create a new function to avoid getting access to current function
+ // context.
+ JS('void', '(new Function(#))()', 'loadRelativeToScript("$uri")');
+ return true;
+ });
+ } else if (IsolateNatives.isD8) {
+ // TODO(ahe): Move this code to a JavaScript command helper script that is
+ // not included in generated output.
+ return _loadedLibraries[libraryName] = new Future<bool>(() {
+ if (uri == null) {
+ uri = IsolateNatives.computeThisScriptD8();
+ int index = uri.lastIndexOf('/');
+ uri = '${uri.substring(0, index + 1)}part.js';
+ }
+ // Create a new function to avoid getting access to current function
+ // context.
+ JS('void', '(new Function(#))()', 'load("$uri")');
+ return true;
+ });
+ }
+
+ return _loadedLibraries[libraryName] = new Future<bool>(() {
+ Completer completer = new Completer<bool>();
+ if (uri == null) {
+ uri = IsolateNatives.thisScript;
+ int index = uri.lastIndexOf('/');
+ uri = '${uri.substring(0, index + 1)}part.js';
+ }
+
// Inject a script tag.
var script = JS('', 'document.createElement("script")');
JS('', '#.type = "text/javascript"', script);
- JS('', '#.async = "async"', script);
JS('', '#.src = #', script, uri);
var onLoad = JS('', '#.bind(null, #)',
DART_CLOSURE_TO_JS(_onDeferredLibraryLoad), completer);
JS('', '#.addEventListener("load", #, false)', script, onLoad);
JS('', 'document.body.appendChild(#)', script);
- } else if (JS('String', 'typeof load') == 'function') {
- Timer.run(() {
- JS('void', 'load(#)', uri);
- completer.complete(true);
- });
- } else {
- throw new UnsupportedError('load not supported');
- }
- return completer.future;
+
+ return completer.future;
+ });
}
/// Used to implement deferred loading. Used as callback on "load"
diff --git a/sdk/lib/_internal/lib/core_patch.dart b/sdk/lib/_internal/lib/core_patch.dart
index 3a4f7ac..aaa8164 100644
--- a/sdk/lib/_internal/lib/core_patch.dart
+++ b/sdk/lib/_internal/lib/core_patch.dart
@@ -35,9 +35,9 @@
patch dynamic noSuchMethod(Invocation invocation) {
throw new NoSuchMethodError(
this,
- _symbolToString(invocation.memberName),
+ invocation.memberName,
invocation.positionalArguments,
- _symbolMapToStringMap(invocation.namedArguments));
+ invocation.namedArguments);
}
patch Type get runtimeType => getRuntimeType(this);
@@ -221,10 +221,10 @@
}
patch class RegExp {
- patch factory RegExp(String pattern,
+ patch factory RegExp(String source,
{bool multiLine: false,
bool caseSensitive: true})
- => new JSSyntaxRegExp(pattern,
+ => new JSSyntaxRegExp(source,
multiLine: multiLine,
caseSensitive: caseSensitive);
}
@@ -276,11 +276,11 @@
}
}
if (_namedArguments != null) {
- _namedArguments.forEach((String key, var value) {
+ _namedArguments.forEach((Symbol key, var value) {
if (i > 0) {
sb.write(", ");
}
- sb.write(key);
+ sb.write(_symbolToString(key));
sb.write(": ");
sb.write(Error.safeToString(value));
i++;
diff --git a/sdk/lib/_internal/lib/foreign_helper.dart b/sdk/lib/_internal/lib/foreign_helper.dart
index 9ba05eb..a45d9bf 100644
--- a/sdk/lib/_internal/lib/foreign_helper.dart
+++ b/sdk/lib/_internal/lib/foreign_helper.dart
@@ -255,3 +255,17 @@
* externally initialized elements.
*/
void JS_EFFECT(Function code) { code(null); }
+
+/**
+ * Use this class for creating constants that hold JavaScript code.
+ * For example:
+ *
+ * const constant = JS_CONST('typeof window != "undefined");
+ *
+ * This code will generate:
+ * $.JS_CONST_1 = typeof window != "undefined";
+ */
+class JS_CONST {
+ String code;
+ const JS_CONST(this.code);
+}
diff --git a/sdk/lib/_internal/lib/interceptors.dart b/sdk/lib/_internal/lib/interceptors.dart
index c40b797..149814b 100644
--- a/sdk/lib/_internal/lib/interceptors.dart
+++ b/sdk/lib/_internal/lib/interceptors.dart
@@ -66,21 +66,11 @@
var dispatchPropertyName = null;
getDispatchProperty(object) {
- // This is a magic method: the compiler replaces it with a runtime generated
- // function
- //
- // function(object){return object._zzyzx;}
- //
- // where `_zzyzx` is replaced with the actual [dispatchPropertyName].
- //
- // The CSP compliant version replaces this function with one of a few
- // pre-compiled accessors, unless the pre-compiled versions are all in use,
- // when it falls back on this code.
- return JS('', '#[#]', object, dispatchPropertyName);
+ return JS('', '#[#]', object, JS('String', 'init.dispatchPropertyName'));
}
setDispatchProperty(object, value) {
- defineProperty(object, dispatchPropertyName, value);
+ defineProperty(object, JS('String', 'init.dispatchPropertyName'), value);
}
makeDispatchRecord(interceptor, proto, extension, indexability) {
@@ -159,86 +149,6 @@
return getNativeInterceptor(object);
}
-/**
- * Initializes the [getDispatchProperty] function and [dispatchPropertyName]
- * variable. Each isolate running in a web page needs a different
- * [dispatchPropertyName], so if a given dispatch property name is in use by
- * some other program loaded into the web page, another name is chosen.
- *
- * The non-CSP version is called like this:
- *
- * initializeDispatchProperty(
- * function(x){$.getDispatchProperty=x},
- * '_f4$Dxv7S',
- * $.Interceptor);
- *
- * The [getDispatchProperty] function is generated from the chosen name of the
- * property.
- *
- * The CSP version can't create functions via `new Function(...)`, so it is
- * given a fixed set of functions to choose from. If all the property names in
- * the fixed set of functions are in use, it falls back on the definition of
- * [getDispatchProperty] above.
- *
- * initializeDispatchPropertyCSP(
- * function(x){$.getDispatchProperty=x},
- * [function(a){return a._f4$Dxv7S},
- * function(a){return a._Q2zpL9iY}],
- * $.Interceptor);
- */
-void initializeDispatchProperty(
- setGetDispatchPropertyFn, rootProperty, jsObjectInterceptor) {
- // We must be extremely careful to avoid any language feature that needs an
- // interceptor. Avoid type annotations since they might generate type checks.
- var objectProto = JS('=Object', 'Object.prototype');
- for (var i = 0; ; i = JS('int', '# + 1', i)) {
- var property = rootProperty;
- if (JS('bool', '# > 0', i)) {
- property = JS('String', '# + "_" + #', rootProperty, i);
- }
- if (JS('bool', 'typeof #[#] === "undefined"', objectProto, property)) {
- dispatchPropertyName = property;
- var getter = JS('', 'new Function("a", "return a." + #)', property);
- JS('void', '#(#)', setGetDispatchPropertyFn, getter);
- setDispatchProperty(
- objectProto,
- makeDispatchRecord(jsObjectInterceptor, objectProto, null, null));
- return;
- }
- }
-}
-
-void initializeDispatchPropertyCSP(
- setGetDispatchPropertyFn, getterFunctions, jsObjectInterceptor) {
- // We must be extremely careful to avoid any language feature that needs an
- // interceptor. Avoid type annotations since they might generate type checks.
- var objectProto = JS('=Object', 'Object.prototype');
- var property = null;
- var getter = null;
- var rootProperty = null;
- for (var i = 0; ; i = JS('int', '# + 1', i)) {
- if (JS('bool', '# < #.length', i, getterFunctions)) {
- getter = JS('', '#[#]', getterFunctions, i);
- var fnText = JS('String', '"" + #', getter);
- property =
- JS('String', '#.match(#)[1]', fnText, JS('', r'/\.([^;}]*)/'));
- rootProperty = property;
- } else {
- getter = null;
- property = JS('String', '# + "_" + #', rootProperty, i);
- }
- if (JS('bool', 'typeof #[#] === "undefined"', objectProto, property)) {
- dispatchPropertyName = property;
- if (!identical(getter, null)) {
- JS('void', '#(#)', setGetDispatchPropertyFn, getter);
- }
- setDispatchProperty(
- objectProto,
- makeDispatchRecord(jsObjectInterceptor, objectProto, null, null));
- return;
- }
- }
-}
/**
* If [JSInvocationMirror._invokeOn] is being used, this variable
@@ -338,9 +248,9 @@
dynamic noSuchMethod(Invocation invocation) {
throw new NoSuchMethodError(
this,
- _symbolToString(invocation.memberName),
+ invocation.memberName,
invocation.positionalArguments,
- _symbolMapToStringMap(invocation.namedArguments));
+ invocation.namedArguments);
}
Type get runtimeType => getRuntimeType(this);
diff --git a/sdk/lib/_internal/lib/isolate_helper.dart b/sdk/lib/_internal/lib/isolate_helper.dart
index d59dbb8..9fe12b0 100644
--- a/sdk/lib/_internal/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/lib/isolate_helper.dart
@@ -424,29 +424,49 @@
/// Associates an ID with a native worker object.
static final Expando<int> workerIds = new Expando<int>();
+ static bool get isD8 {
+ return JS('bool',
+ 'typeof version == "function"'
+ ' && typeof os == "object" && "system" in os');
+ }
+
+ static bool get isJsshell {
+ return JS('bool',
+ 'typeof version == "function" && typeof system == "function"');
+ }
+
/**
* The src url for the script tag that loaded this code. Used to create
* JavaScript workers.
*/
static String computeThisScript() {
- var currentScript = JS('', r'#.$currentScript', JS_CURRENT_ISOLATE());
+ var currentScript = JS('', r'init.currentScript');
if (currentScript != null) {
return JS('String', 'String(#.src)', currentScript);
}
+ if (isD8) return computeThisScriptD8();
+ if (isJsshell) return computeThisScriptJsshell();
+ return null;
+ }
- // TODO(ahe): The following is for supporting command-line engines
- // such as d8 and jsshell. We should move this code to a helper
- // library that is only loaded when testing on those engines.
+ static String computeThisScriptJsshell() {
+ return JS('String|Null', 'thisFilename()');
+ }
+
+ static String computeThisScriptD8() {
+ // TODO(ahe): The following is for supporting D8. We should move this code
+ // to a helper library that is only loaded when testing on D8.
var stack = JS('String|Null', 'new Error().stack');
if (stack == null) {
// According to Internet Explorer documentation, the stack
// property is not set until the exception is thrown. The stack
// property was not provided until IE10.
- stack = JS('String',
+ stack = JS('String|Null',
'(function() {'
'try { throw new Error() } catch(e) { return e.stack }'
'})()');
+ if (stack == null) throw new UnsupportedError('No stack trace');
}
var pattern, matches;
diff --git a/sdk/lib/_internal/lib/js_helper.dart b/sdk/lib/_internal/lib/js_helper.dart
index 412c9b4..4374eae 100644
--- a/sdk/lib/_internal/lib/js_helper.dart
+++ b/sdk/lib/_internal/lib/js_helper.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// 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.
@@ -86,6 +86,11 @@
argumentNames);
}
+void throwInvalidReflectionError(Symbol memberName) {
+ throw new UnsupportedError('invalid reflective use of ${memberName}, '
+ 'which is not included by a @MirrorsUsed annotation');
+}
+
class JSInvocationMirror implements Invocation {
static const METHOD = 0;
static const GETTER = 1;
@@ -99,7 +104,7 @@
final List _arguments;
final List _namedArgumentNames;
/** Map from argument name to index in _arguments. */
- Map<String,dynamic> _namedIndices = null;
+ Map<String, dynamic> _namedIndices = null;
JSInvocationMirror(this._memberName,
this._internalName,
@@ -135,7 +140,7 @@
return makeLiteralListConst(list);
}
- Map<Symbol,dynamic> get namedArguments {
+ Map<Symbol, dynamic> get namedArguments {
// TODO: Make maps const (issue 10471)
if (isAccessor) return <Symbol, dynamic>{};
int namedArgumentCount = _namedArgumentNames.length;
@@ -170,6 +175,9 @@
}
var method = JS('var', '#[#]', receiver, name);
if (JS('String', 'typeof #', method) == 'function') {
+ if (JS('bool', '#[#] == false', method, JS_GET_NAME("REFLECTABLE"))) {
+ throwInvalidReflectionError(memberName);
+ }
return new CachedInvocation(method, isIntercepted, interceptor);
} else {
// In this case, receiver doesn't implement name. So we should
@@ -346,10 +354,9 @@
}
if (radix < 10 || match[decimalIndex] == null) {
// We know that the characters must be ASCII as otherwise the
- // regexp wouldn't have matched. Calling toLowerCase is thus
- // guaranteed to be a safe operation. If it wasn't ASCII, then
- // "İ" would become "i", and we would accept it for radices greater
- // than 18.
+ // regexp wouldn't have matched. Lowercasing by doing `| 0x20` is thus
+ // guaranteed to be a safe operation, since it preserves digits
+ // and lower-cases ASCII letters.
int maxCharCode;
if (radix <= 10) {
// Allow all digits less than the radix. For example 0, 1, 2 for
@@ -357,15 +364,16 @@
// "0".codeUnitAt(0) + radix - 1;
maxCharCode = 0x30 + radix - 1;
} else {
- // Characters are located after the digits in ASCII. Therefore we
+ // Letters are located after the digits in ASCII. Therefore we
// only check for the character code. The regexp above made already
// sure that the string does not contain anything but digits or
- // characters.
- // "0".codeUnitAt(0) + radix - 1;
+ // letters.
+ // "a".codeUnitAt(0) + (radix - 10) - 1;
maxCharCode = 0x61 + radix - 10 - 1;
}
- String digitsPart = match[digitsIndex].toLowerCase();
+ String digitsPart = match[digitsIndex];
for (int i = 0; i < digitsPart.length; i++) {
+ int characterCode = digitsPart.codeUnitAt(0) | 0x20;
if (digitsPart.codeUnitAt(i) > maxCharCode) {
return handleError(source);
}
@@ -1923,7 +1931,9 @@
* resolved cannot be found.
*/
void throwNoSuchMethod(obj, name, arguments, expectedArgumentNames) {
- throw new NoSuchMethodError(obj, name, arguments, const {},
+ Symbol memberName = new _symbol_dev.Symbol.unvalidated(name);
+ throw new NoSuchMethodError(obj, memberName, arguments,
+ new Map<Symbol, dynamic>(),
expectedArgumentNames);
}
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
index 52aca10..d8408a6 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -25,6 +25,7 @@
createRuntimeType,
createUnmangledInvocationMirror,
getMangledTypeName,
+ throwInvalidReflectionError,
runtimeTypeToString;
import 'dart:_interceptors' show
Interceptor,
@@ -90,7 +91,7 @@
var fields = data[5];
bool isRoot = data[6];
List metadata = (metadataFunction == null)
- ? null : JS('List', '#()', metadataFunction);
+ ? const [] : JS('List', '#()', metadataFunction);
var libraries = result.putIfAbsent(name, () => <LibraryMirror>[]);
libraries.add(
new JsLibraryMirror(
@@ -103,7 +104,7 @@
abstract class JsMirror implements Mirror {
const JsMirror();
- abstract String get _prettyName;
+ String get _prettyName;
String toString() => _prettyName;
@@ -243,7 +244,7 @@
if (mirror == null) mirror = variables[fieldName];
if (mirror == null) {
// TODO(ahe): What receiver to use?
- throw new NoSuchMethodError(this, '${n(fieldName)}=', [arg], null);
+ throw new NoSuchMethodError(this, setterSymbol(fieldName), [arg], null);
}
mirror._setField(this, arg);
return reflect(arg);
@@ -253,24 +254,28 @@
JsMirror mirror = members[fieldName];
if (mirror == null) {
// TODO(ahe): What receiver to use?
- throw new NoSuchMethodError(this, '${n(fieldName)}', [], null);
+ throw new NoSuchMethodError(this, fieldName, [], null);
}
return reflect(mirror._getField(this));
}
InstanceMirror invoke(Symbol memberName,
List positionalArguments,
- [Map<Symbol,dynamic> namedArguments]) {
+ [Map<Symbol, dynamic> namedArguments]) {
if (namedArguments != null && !namedArguments.isEmpty) {
throw new UnsupportedError('Named arguments are not implemented.');
}
JsDeclarationMirror mirror = members[memberName];
if (mirror == null) {
- // TODO(ahe): Pass namedArguments when NoSuchMethodError has been
- // fixed to use Symbol.
// TODO(ahe): What receiver to use?
throw new NoSuchMethodError(
- this, '${n(memberName)}', positionalArguments, null);
+ this, memberName, positionalArguments, namedArguments);
+ }
+ if (mirror is JsMethodMirror) {
+ JsMethodMirror method = mirror;
+ if (!method.canInvokeReflectively()) {
+ throwInvalidReflectionError(memberName);
+ }
}
return reflect(mirror._invoke(positionalArguments, namedArguments));
}
@@ -287,14 +292,19 @@
List<JsMethodMirror> get _functionMirrors {
if (_cachedFunctionMirrors != null) return _cachedFunctionMirrors;
- var result = new List<JsMethodMirror>(_functions.length);
+ var result = new List<JsMethodMirror>();
for (int i = 0; i < _functions.length; i++) {
String name = _functions[i];
// TODO(ahe): Create accessor for accessing $. It is also
// used in js_helper.
var jsFunction = JS('', '#[#]', JS_CURRENT_ISOLATE(), name);
String unmangledName = mangledGlobalNames[name];
- if (unmangledName == null) unmangledName = name;
+ if (unmangledName == null) {
+ // If there is no unmangledName, [jsFunction] is either a synthetic
+ // implementation detail, or something that is excluded
+ // by @MirrorsUsed.
+ continue;
+ }
bool isConstructor = unmangledName.startsWith('new ');
bool isStatic = !isConstructor; // Top-level functions are static, but
// constructors are not.
@@ -304,7 +314,7 @@
JsMethodMirror mirror =
new JsMethodMirror.fromUnmangledName(
unmangledName, jsFunction, isStatic, isConstructor);
- result[i] = mirror;
+ result.add(mirror);
mirror._owner = this;
}
return _cachedFunctionMirrors = result;
@@ -385,6 +395,8 @@
return new _symbol_dev.Symbol.unvalidated(name);
}
+Symbol setterSymbol(Symbol symbol) => s("${n(symbol)}=");
+
final JsMirrorSystem currentJsMirrorSystem = new JsMirrorSystem();
InstanceMirror reflect(Object reflectee) {
@@ -507,20 +519,19 @@
Symbol memberName,
List positionalArguments,
[Map<Symbol,dynamic> namedArguments]) {
- // TODO(ahe): Pass namedArguments when NoSuchMethodError has
- // been fixed to use Symbol.
// TODO(ahe): What receiver to use?
- throw new NoSuchMethodError(this, n(memberName), positionalArguments, null);
+ throw new NoSuchMethodError(this, memberName,
+ positionalArguments, namedArguments);
}
InstanceMirror getField(Symbol fieldName) {
// TODO(ahe): What receiver to use?
- throw new NoSuchMethodError(this, n(fieldName), null, null);
+ throw new NoSuchMethodError(this, fieldName, null, null);
}
InstanceMirror setField(Symbol fieldName, Object arg) {
// TODO(ahe): What receiver to use?
- throw new NoSuchMethodError(this, '${n(fieldName)}=', [arg], null);
+ throw new NoSuchMethodError(this, setterSymbol(fieldName), [arg], null);
}
List<ClassMirror> get superinterfaces => [mixin];
@@ -748,6 +759,7 @@
int length = keys.length;
for (int i = 0; i < length; i++) {
String mangledName = keys[i];
+ if (mangledName == '') continue; // Skip static field descriptor.
String unmangledName = mangledName;
// TODO(ahe): Create accessor for accessing $. It is also
// used in js_helper.
@@ -889,7 +901,7 @@
return reflect(arg);
}
// TODO(ahe): What receiver to use?
- throw new NoSuchMethodError(this, '${n(fieldName)}=', [arg], null);
+ throw new NoSuchMethodError(this, setterSymbol(fieldName), [arg], null);
}
InstanceMirror getField(Symbol fieldName) {
@@ -907,7 +919,7 @@
}
}
// TODO(ahe): What receiver to use?
- throw new NoSuchMethodError(this, n(fieldName), null, null);
+ throw new NoSuchMethodError(this, fieldName, null, null);
}
InstanceMirror newInstance(Symbol constructorName,
@@ -922,11 +934,9 @@
mirror = constructors.values.firstWhere(
(m) => m.constructorName == constructorName,
orElse: () {
- // TODO(ahe): Pass namedArguments when NoSuchMethodError has been
- // fixed to use Symbol.
// TODO(ahe): What receiver to use?
throw new NoSuchMethodError(
- owner, n(constructorName), positionalArguments, null);
+ owner, constructorName, positionalArguments, namedArguments);
});
JsCache.update(_jsConstructorCache, n(constructorName), mirror);
}
@@ -1004,11 +1014,12 @@
}
JsMethodMirror mirror = methods[memberName];
if (mirror == null || !mirror.isStatic) {
- // TODO(ahe): Pass namedArguments when NoSuchMethodError has
- // been fixed to use Symbol.
// TODO(ahe): What receiver to use?
throw new NoSuchMethodError(
- this, n(memberName), positionalArguments, null);
+ this, memberName, positionalArguments, namedArguments);
+ }
+ if (!mirror.canInvokeReflectively()) {
+ throwInvalidReflectionError(memberName);
}
return reflect(mirror._invoke(positionalArguments, namedArguments));
}
@@ -1039,6 +1050,8 @@
}
class JsVariableMirror extends JsDeclarationMirror implements VariableMirror {
+ static final int REFLECTION_MARKER = 45;
+
// TODO(ahe): The values in these fields are virtually untested.
final String _jsName;
final bool isFinal;
@@ -1061,6 +1074,16 @@
bool isStatic) {
int length = descriptor.length;
var code = fieldCode(descriptor.codeUnitAt(length - 1));
+ if (code == REFLECTION_MARKER) {
+ // If the field descriptor has a reflection marker, remove it by
+ // changing length and getting the real getter/setter code. The
+ // descriptor will be truncated below.
+ length--;
+ code = fieldCode(descriptor.codeUnitAt(length - 1));
+ } else {
+ // The field is not available for reflection.
+ return null;
+ }
bool isFinal = false;
if (code == 0) return null; // Inherited field.
bool hasGetter = (code & 3) != 0;
@@ -1072,7 +1095,7 @@
int divider = descriptor.indexOf(':');
if (divider > 0) {
accessorName = accessorName.substring(0, divider);
- jsName = accessorName.substring(divider + 1);
+ jsName = descriptor.substring(divider + 1);
}
var unmangledName;
if (isStatic) {
@@ -1113,6 +1136,7 @@
}
static int fieldCode(int code) {
+ if (code == REFLECTION_MARKER) return code;
if (code >= 60 && code <= 64) return code - 59;
if (code >= 123 && code <= 126) return code - 117;
if (code >= 37 && code <= 43) return code - 27;
@@ -1123,7 +1147,7 @@
void _setField(JsMirror receiver, Object arg) {
if (isFinal) {
- throw new NoSuchMethodError(this, '${n(simpleName)}=', [arg], null);
+ throw new NoSuchMethodError(this, setterSymbol(simpleName), [arg], null);
}
receiver._storeField(_jsName, arg);
}
@@ -1248,6 +1272,10 @@
return _parameters;
}
+ bool canInvokeReflectively() {
+ return JS('bool', '#[#] != false', _jsFunction, JS_GET_NAME("REFLECTABLE"));
+ }
+
DeclarationMirror get owner => _owner;
TypeMirror get returnType {
@@ -1298,11 +1326,9 @@
throw new RuntimeError('Cannot invoke instance method without receiver.');
}
if (_parameterCount != positionalArguments.length || _jsFunction == null) {
- // TODO(ahe): Pass namedArguments when NoSuchMethodError has
- // been fixed to use Symbol.
// TODO(ahe): What receiver to use?
throw new NoSuchMethodError(
- owner, n(simpleName), positionalArguments, null);
+ owner, simpleName, positionalArguments, namedArguments);
}
return JS('', r'#.apply(#, #)', _jsFunction, JS_CURRENT_ISOLATE(),
new List.from(positionalArguments));
@@ -1321,7 +1347,7 @@
if (isSetter) {
return _invoke([arg], null);
} else {
- throw new NoSuchMethodError(this, '${n(simpleName)}=', [], null);
+ throw new NoSuchMethodError(this, setterSymbol(simpleName), [], null);
}
}
diff --git a/sdk/lib/_internal/lib/regexp_helper.dart b/sdk/lib/_internal/lib/regexp_helper.dart
index 94b015f..bec8253 100644
--- a/sdk/lib/_internal/lib/regexp_helper.dart
+++ b/sdk/lib/_internal/lib/regexp_helper.dart
@@ -150,7 +150,9 @@
assert(JS("var", "#.index", _match) is int);
}
- String get str => JS("String", "#.input", _match);
+ // TODO(12843): Remove when grace period is over.
+ String get str => input;
+ String get input => JS("String", "#.input", _match);
int get start => JS("int", "#.index", _match);
int get end => start + _match[0].length;
diff --git a/sdk/lib/_internal/lib/string_helper.dart b/sdk/lib/_internal/lib/string_helper.dart
index ba03364..fa046d5 100644
--- a/sdk/lib/_internal/lib/string_helper.dart
+++ b/sdk/lib/_internal/lib/string_helper.dart
@@ -6,7 +6,7 @@
class StringMatch implements Match {
const StringMatch(int this.start,
- String this.str,
+ String this.input,
String this.pattern);
int get end => start + pattern.length;
@@ -28,8 +28,11 @@
return result;
}
+ // TODO(12843): Remove when grace period is over.
+ String get str => input;
+
final int start;
- final String str;
+ final String input;
final String pattern;
}
diff --git a/sdk/lib/_internal/pub/lib/src/command/cache.dart b/sdk/lib/_internal/pub/lib/src/command/cache.dart
index 24c5124..122ee1c 100644
--- a/sdk/lib/_internal/pub/lib/src/command/cache.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/cache.dart
@@ -5,8 +5,8 @@
library pub.command.cache;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import '../command.dart';
import '../exit_codes.dart' as exit_codes;
@@ -43,7 +43,7 @@
// TODO(keertip): Add support for non-JSON format
// and check for --format flag
- log.message(json.stringify({'packages': packagesObj}));
+ log.message(JSON.encode({'packages': packagesObj}));
}
}
diff --git a/sdk/lib/_internal/pub/lib/src/command/lish.dart b/sdk/lib/_internal/pub/lib/src/command/lish.dart
index 4a7b2ac..fb65fc3 100644
--- a/sdk/lib/_internal/pub/lib/src/command/lish.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/lish.dart
@@ -106,7 +106,7 @@
// Show the package contents so the user can verify they look OK.
var package = entrypoint.root;
log.message(
- 'Publishing "${package.name}" ${package.version}:\n'
+ 'Publishing "${package.name}" ${package.version} to $server:\n'
'${generateTree(files, baseDir: entrypoint.root.dir)}');
return createTarGz(files, baseDir: entrypoint.root.dir);
diff --git a/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart b/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart
index fc05630..f16ad65 100644
--- a/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/list_package_dirs.dart
@@ -5,8 +5,8 @@
library pub.command.list_package_dirs;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:path/path.dart' as path;
@@ -28,7 +28,7 @@
Future onRun() {
if (!entrypoint.lockFileExists) {
- log.error(json.stringify(
+ log.error(JSON.encode(
'Package "myapp" has no lockfile. Please run "pub install" first.'));
exit(exit_codes.NO_INPUT);
}
@@ -55,7 +55,7 @@
output["input_files"] = [entrypoint.lockFilePath];
return Future.wait(futures).then((_) {
- log.message(json.stringify(output));
+ log.message(JSON.encode(output));
});
}
}
diff --git a/sdk/lib/_internal/pub/lib/src/http.dart b/sdk/lib/_internal/pub/lib/src/http.dart
index a54f02f..9fc338e 100644
--- a/sdk/lib/_internal/pub/lib/src/http.dart
+++ b/sdk/lib/_internal/pub/lib/src/http.dart
@@ -6,8 +6,8 @@
library pub.http;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:http/http.dart' as http;
@@ -203,7 +203,7 @@
Map parseJsonResponse(http.Response response) {
var value;
try {
- value = json.parse(response.body);
+ value = JSON.decode(response.body);
} on FormatException catch (e) {
invalidServerResponse(response);
}
diff --git a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart b/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
index 2dc215e..eb2fc63 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
+++ b/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
@@ -5,7 +5,7 @@
library pub.solver.version_solver;
import 'dart:async';
-import 'dart:json' as json;
+import "dart:convert";
import '../lock_file.dart';
import '../log.dart' as log;
@@ -293,6 +293,6 @@
String _describeDependency(PackageDep dep) {
// TODO(nweiz): Dump descriptions to YAML when that's supported.
- return "depends on it with description ${json.stringify(dep.description)}";
+ return "depends on it with description ${JSON.encode(dep.description)}";
}
}
diff --git a/sdk/lib/_internal/pub/lib/src/source/hosted.dart b/sdk/lib/_internal/pub/lib/src/source/hosted.dart
index 7a0409f..b2c1647 100644
--- a/sdk/lib/_internal/pub/lib/src/source/hosted.dart
+++ b/sdk/lib/_internal/pub/lib/src/source/hosted.dart
@@ -6,7 +6,7 @@
import 'dart:async';
import 'dart:io' as io;
-import 'dart:json' as json;
+import "dart:convert";
import 'package:http/http.dart' as http;
import 'package:path/path.dart' as path;
@@ -46,7 +46,7 @@
log.io("Get versions from $url.");
return httpClient.read(url, headers: PUB_API_HEADERS).then((body) {
- var doc = json.parse(body);
+ var doc = JSON.decode(body);
return doc['versions']
.map((version) => new Version.parse(version['version']))
.toList();
@@ -65,7 +65,7 @@
log.io("Describe package at $url.");
return httpClient.read(url, headers: PUB_API_HEADERS).then((version) {
- version = json.parse(version);
+ version = JSON.decode(version);
// TODO(rnystrom): After this is pulled down, we could place it in
// a secondary cache of just pubspecs. This would let us have a
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
index d495516..ed2e5e3 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -7,7 +7,7 @@
import 'dart:async';
import 'dart:io';
-import 'dart:json' as json;
+import "dart:convert";
import 'dart:mirrors';
import "package:crypto/crypto.dart";
@@ -494,7 +494,7 @@
var keyString = key;
if (key is! String || !_unquotableYamlString.hasMatch(key)) {
- keyString = json.stringify(key);
+ keyString = JSON.encode(key);
}
buffer.write('$indent$keyString:');
@@ -510,7 +510,7 @@
// Don't quote plain strings if not needed.
if (data is! String || !_unquotableYamlString.hasMatch(data)) {
- string = json.stringify(data);
+ string = JSON.encode(data);
}
if (isMapValue) {
diff --git a/sdk/lib/_internal/pub/pub.status b/sdk/lib/_internal/pub/pub.status
index 276a0d5..1e72e02 100644
--- a/sdk/lib/_internal/pub/pub.status
+++ b/sdk/lib/_internal/pub/pub.status
@@ -4,19 +4,26 @@
test/serve/missing_file_test: Pass, Fail # Issue 12570
test/oauth2/with_an_expired_credentials_refreshes_and_saves_test: Pass, Fail # Issue 12581
-test/hosted/remove_removed_dependency_test: Pass, Fail # Issue 12582
-test/hosted/remove_removed_transitive_dependency_test: Pass, Fail # Issue 12582
-test/install/hosted/cached_pubspec_test: Pass, Fail # Issue 12678
-test/install/hosted/do_not_update_on_removed_constraints_test: Pass, Fail # Issue 12680
-test/install/hosted/install_test: Pass, Fail # Issue 12682
-test/install/hosted/install_transitive_test: Pass, Fail # Issue 12683
-test/install/hosted/repair_cache_test: Pass, Fail # Issue 12684
-test/serve/serve_from_dependency_asset_test: Pass, Fail # Issue 12686
+
+# Issue 12837 is a networking issue on the pub-mac buildbot.
+[ $runtime == vm && $system == macos ]
+test/hosted/remove_removed_dependency_test: Pass, Fail # Issue 12837
+test/hosted/remove_removed_transitive_dependency_test: Pass, Fail # Issue 12837
+test/install/hosted/cached_pubspec_test: Pass, Fail # Issue 12837
+test/install/hosted/do_not_update_on_removed_constraints_test: Pass, Fail # Issue 12837
+test/install/hosted/install_test: Pass, Fail # Issue 12837
+test/install/hosted/install_transitive_test: Pass, Fail # Issue 12837
+test/install/hosted/version_negotiation_test: Pass, Fail # Issue 12837
+test/install/hosted/repair_cache_test: Pass, Fail # Issue 12837
+test/serve/serve_from_dependency_asset_test: Pass, Fail # Issue 12837
test/install/hosted/stay_locked_if_new_is_satisfied_test: Pass, Fail # Issue 12837
test/install/hosted/unlock_if_incompatible_test: Pass, Fail # Issue 12837
test/install/hosted/unlock_if_new_is_unsatisfied_test: Pass, Fail # Issue 12837
test/install/hosted/stay_locked_test: Pass, Fail # Issue 12837
+[ $runtime == vm && $system == windows ]
+test/update/git/update_locked_test: Pass, Fail # Issue 12983
+
# Pub only runs on the VM, so just rule out all compilers.
[ $compiler == dart2js || $compiler == dart2dart ]
*: Skip
diff --git a/sdk/lib/_internal/pub/test/deploy/copies_browser_js_next_to_entrypoints_test.dart b/sdk/lib/_internal/pub/test/deploy/copies_browser_js_next_to_entrypoints_test.dart
index 291284e..5076a7d 100644
--- a/sdk/lib/_internal/pub/test/deploy/copies_browser_js_next_to_entrypoints_test.dart
+++ b/sdk/lib/_internal/pub/test/deploy/copies_browser_js_next_to_entrypoints_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:path/path.dart' as path;
import 'package:scheduled_test/scheduled_test.dart';
@@ -21,12 +21,12 @@
serve([
d.dir('api', [
d.dir('packages', [
- d.file('browser', json.stringify({
+ d.file('browser', JSON.encode({
'versions': [packageVersionApiMap(packageMap('browser', '1.0.0'))]
})),
d.dir('browser', [
d.dir('versions', [
- d.file('1.0.0', json.stringify(
+ d.file('1.0.0', JSON.encode(
packageVersionApiMap(
packageMap('browser', '1.0.0'),
full: true)))
diff --git a/sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.dart b/sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.dart
index f1460b5..1ef75ce 100644
--- a/sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/archives_and_uploads_a_package_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -25,7 +25,7 @@
handleUpload(server);
server.handle('GET', '/create', (request) {
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
request.response.close();
diff --git a/sdk/lib/_internal/pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart b/sdk/lib/_internal/pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart
index 9bf4aa3..40b2aee 100644
--- a/sdk/lib/_internal/pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/force_publishes_if_tests_are_no_warnings_or_errors_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -24,7 +24,7 @@
handleUpload(server);
server.handle('GET', '/create', (request) {
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
request.response.close();
diff --git a/sdk/lib/_internal/pub/test/lish/force_publishes_if_there_are_warnings_test.dart b/sdk/lib/_internal/pub/test/lish/force_publishes_if_there_are_warnings_test.dart
index c4d3616..f89e6c2 100644
--- a/sdk/lib/_internal/pub/test/lish/force_publishes_if_there_are_warnings_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/force_publishes_if_there_are_warnings_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -28,7 +28,7 @@
handleUpload(server);
server.handle('GET', '/create', (request) {
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
request.response.close();
diff --git a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_error_test.dart b/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_error_test.dart
index bbcc4d3..0730bcd 100644
--- a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_error_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_error_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -27,12 +27,12 @@
var body = {'error': 'Your package was too boring.'};
server.handle('GET', '/create', (request) {
request.response.statusCode = 400;
- request.response.write(json.stringify(body));
+ request.response.write(JSON.encode(body));
request.response.close();
});
expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals(json.stringify(body))));
+ expect(pub.nextErrLine(), completion(equals(JSON.encode(body))));
pub.shouldExit(1);
});
}
diff --git a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_success_test.dart b/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_success_test.dart
index 635e11d..f6ce3b7 100644
--- a/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_success_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/package_creation_provides_a_malformed_success_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -26,12 +26,12 @@
var body = {'success': 'Your package was awesome.'};
server.handle('GET', '/create', (request) {
- request.response.write(json.stringify(body));
+ request.response.write(JSON.encode(body));
request.response.close();
});
expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals(json.stringify(body))));
+ expect(pub.nextErrLine(), completion(equals(JSON.encode(body))));
pub.shouldExit(1);
});
}
diff --git a/sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.dart b/sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.dart
index 2298e70..a1c134d 100644
--- a/sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/package_creation_provides_an_error_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -26,7 +26,7 @@
server.handle('GET', '/create', (request) {
request.response.statusCode = 400;
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'error': {'message': 'Your package was too boring.'}
}));
request.response.close();
diff --git a/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_continues_test.dart b/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_continues_test.dart
index 4883fe5..01916ef 100644
--- a/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_continues_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/package_validation_has_a_warning_and_continues_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -28,7 +28,7 @@
handleUpload(server);
server.handle('GET', '/create', (request) {
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'success': {'message': 'Package test_pkg 1.0.0 uploaded!'}
}));
request.response.close();
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_fields_has_a_non_string_value_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_fields_has_a_non_string_value_test.dart
index e1143d6..9e24715 100644
--- a/sdk/lib/_internal/pub/test/lish/upload_form_fields_has_a_non_string_value_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/upload_form_fields_has_a_non_string_value_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -28,7 +28,7 @@
};
handleUploadForm(server, body);
expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals(json.stringify(body))));
+ expect(pub.nextErrLine(), completion(equals(JSON.encode(body))));
pub.shouldExit(1);
});
}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_fields_is_not_a_map_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_fields_is_not_a_map_test.dart
index 09d0745..2f75460 100644
--- a/sdk/lib/_internal/pub/test/lish/upload_form_fields_is_not_a_map_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/upload_form_fields_is_not_a_map_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -25,7 +25,7 @@
var body = {'url': 'http://example.com/upload', 'fields': 12};
handleUploadForm(server, body);
expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals(json.stringify(body))));
+ expect(pub.nextErrLine(), completion(equals(JSON.encode(body))));
pub.shouldExit(1);
});
}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_fields_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_fields_test.dart
index 8883a87..dd4fd51 100644
--- a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_fields_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_fields_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -25,7 +25,7 @@
var body = {'url': 'http://example.com/upload'};
handleUploadForm(server, body);
expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals(json.stringify(body))));
+ expect(pub.nextErrLine(), completion(equals(JSON.encode(body))));
pub.shouldExit(1);
});
}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_url_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_url_test.dart
index aaad952..0f27503 100644
--- a/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_url_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/upload_form_is_missing_url_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -31,7 +31,7 @@
handleUploadForm(server, body);
expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals(json.stringify(body))));
+ expect(pub.nextErrLine(), completion(equals(JSON.encode(body))));
pub.shouldExit(1);
});
}
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_provides_an_error_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_provides_an_error_test.dart
index a02193c..2a415e4 100644
--- a/sdk/lib/_internal/pub/test/lish/upload_form_provides_an_error_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/upload_form_provides_an_error_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -23,7 +23,7 @@
server.handle('GET', '/api/packages/versions/new', (request) {
request.response.statusCode = 400;
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'error': {'message': 'your request sucked'}
}));
request.response.close();
diff --git a/sdk/lib/_internal/pub/test/lish/upload_form_url_is_not_a_string_test.dart b/sdk/lib/_internal/pub/test/lish/upload_form_url_is_not_a_string_test.dart
index 521d612..7f0164a 100644
--- a/sdk/lib/_internal/pub/test/lish/upload_form_url_is_not_a_string_test.dart
+++ b/sdk/lib/_internal/pub/test/lish/upload_form_url_is_not_a_string_test.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.
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -32,7 +32,7 @@
handleUploadForm(server, body);
expect(pub.nextErrLine(), completion(equals('Invalid server response:')));
- expect(pub.nextErrLine(), completion(equals(json.stringify(body))));
+ expect(pub.nextErrLine(), completion(equals(JSON.encode(body))));
pub.shouldExit(1);
});
}
diff --git a/sdk/lib/_internal/pub/test/lish/utils.dart b/sdk/lib/_internal/pub/test/lish/utils.dart
index 70020cf..8279281 100644
--- a/sdk/lib/_internal/pub/test/lish/utils.dart
+++ b/sdk/lib/_internal/pub/test/lish/utils.dart
@@ -4,8 +4,8 @@
library lish.utils;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -30,7 +30,7 @@
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify(body));
+ request.response.write(JSON.encode(body));
request.response.close();
});
});
diff --git a/sdk/lib/_internal/pub/test/oauth2/utils.dart b/sdk/lib/_internal/pub/test/oauth2/utils.dart
index a67e2bc..019628b 100644
--- a/sdk/lib/_internal/pub/test/oauth2/utils.dart
+++ b/sdk/lib/_internal/pub/test/oauth2/utils.dart
@@ -4,8 +4,8 @@
library oauth2.utils;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:http/http.dart' as http;
import 'package:scheduled_test/scheduled_process.dart';
@@ -45,7 +45,7 @@
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
"access_token": accessToken,
"token_type": "bearer"
}));
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
index 08e1396..8c78a34 100644
--- a/sdk/lib/_internal/pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
+++ b/sdk/lib/_internal/pub/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart
@@ -2,8 +2,8 @@
// 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 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -36,7 +36,7 @@
response.statusCode = 400;
response.reasonPhrase = 'Bad request';
response.headers.contentType = new ContentType("application", "json");
- response.write(json.stringify({"error": "invalid_request"}));
+ response.write(JSON.encode({"error": "invalid_request"}));
response.close();
});
});
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
index 2155a89..ac6fc55 100644
--- a/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
+++ b/sdk/lib/_internal/pub/test/oauth2/with_an_expired_credentials_refreshes_and_saves_test.dart
@@ -2,8 +2,8 @@
// 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 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -35,7 +35,7 @@
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
"access_token": "new access token",
"token_type": "bearer"
}));
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
index bbe3c3a..67e134b 100644
--- a/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
+++ b/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
@@ -2,8 +2,8 @@
// 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 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -27,7 +27,7 @@
response.statusCode = 401;
response.headers.set('www-authenticate', 'Bearer error="invalid_token",'
' error_description="your token sucks"');
- response.write(json.stringify({
+ response.write(JSON.encode({
'error': {'message': 'your token sucks'}
}));
response.close();
diff --git a/sdk/lib/_internal/pub/test/pub_uploader_test.dart b/sdk/lib/_internal/pub/test/pub_uploader_test.dart
index b52a5e3..9c8b822 100644
--- a/sdk/lib/_internal/pub/test/pub_uploader_test.dart
+++ b/sdk/lib/_internal/pub/test/pub_uploader_test.dart
@@ -4,8 +4,8 @@
library pub_uploader_test;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'package:scheduled_test/scheduled_process.dart';
import 'package:scheduled_test/scheduled_server.dart';
@@ -65,7 +65,7 @@
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'success': {'message': 'Good job!'}
}));
request.response.close();
@@ -84,7 +84,7 @@
server.handle('DELETE', '/api/packages/pkg/uploaders/email', (request) {
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'success': {'message': 'Good job!'}
}));
request.response.close();
@@ -104,7 +104,7 @@
server.handle('POST', '/api/packages/test_pkg/uploaders', (request) {
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'success': {'message': 'Good job!'}
}));
request.response.close();
@@ -123,7 +123,7 @@
request.response.statusCode = 400;
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'error': {'message': 'Bad job!'}
}));
request.response.close();
@@ -143,7 +143,7 @@
request.response.statusCode = 400;
request.response.headers.contentType =
new ContentType("application", "json");
- request.response.write(json.stringify({
+ request.response.write(JSON.encode({
'error': {'message': 'Bad job!'}
}));
request.response.close();
diff --git a/sdk/lib/_internal/pub/test/serve/installs_first_if_dev_dependency_changed_test.dart b/sdk/lib/_internal/pub/test/serve/installs_first_if_dev_dependency_changed_test.dart
index fb5591e..553d924 100644
--- a/sdk/lib/_internal/pub/test/serve/installs_first_if_dev_dependency_changed_test.dart
+++ b/sdk/lib/_internal/pub/test/serve/installs_first_if_dev_dependency_changed_test.dart
@@ -4,7 +4,7 @@
library pub_tests;
-import 'dart:json' as json;
+import 'dart:convert';
import '../descriptor.dart' as d;
import '../test_pub.dart';
@@ -26,7 +26,7 @@
"foo": {"path": "../foo"}
}
}),
- d.file("pubspec.lock", json.stringify({
+ d.file("pubspec.lock", JSON.encode({
'packages': {}
}))
]).create();
diff --git a/sdk/lib/_internal/pub/test/serve/installs_first_if_source_changed_test.dart b/sdk/lib/_internal/pub/test/serve/installs_first_if_source_changed_test.dart
index d7f5c92..65d177e 100644
--- a/sdk/lib/_internal/pub/test/serve/installs_first_if_source_changed_test.dart
+++ b/sdk/lib/_internal/pub/test/serve/installs_first_if_source_changed_test.dart
@@ -4,7 +4,7 @@
library pub_tests;
-import 'dart:json' as json;
+import 'dart:convert';
import '../descriptor.dart' as d;
import '../test_pub.dart';
@@ -25,7 +25,7 @@
"foo": {"path": "../foo"}
}),
// A lock file with the hosted source.
- d.file("pubspec.lock", json.stringify({
+ d.file("pubspec.lock", JSON.encode({
'packages': {
'foo': {
'version': '0.0.0',
diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart
index bf51392..7b63184 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -11,7 +11,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'dart:math';
import 'package:http/testing.dart';
@@ -198,14 +197,14 @@
_servedPackageDir.contents.clear();
for (var name in _servedPackages.keys) {
_servedApiPackageDir.contents.addAll([
- d.file('$name', json.stringify({
+ d.file('$name', JSON.encode({
'name': name,
'uploaders': ['nweiz@google.com'],
'versions': _servedPackages[name].map(packageVersionApiMap).toList()
})),
d.dir(name, [
d.dir('versions', _servedPackages[name].map((pubspec) {
- return d.file(pubspec['version'], json.stringify(
+ return d.file(pubspec['version'], JSON.encode(
packageVersionApiMap(pubspec, full: true)));
}))
])
@@ -215,7 +214,7 @@
d.dir('versions', _servedPackages[name].map((pubspec) {
var version = pubspec['version'];
return d.tar('$version.tar.gz', [
- d.file('pubspec.yaml', json.stringify(pubspec)),
+ d.file('pubspec.yaml', JSON.encode(pubspec)),
d.libDir(name, '$name $version')
]);
}))
@@ -226,7 +225,7 @@
}
/// Converts [value] into a YAML string.
-String yaml(value) => json.stringify(value);
+String yaml(value) => JSON.encode(value);
/// The full path to the created sandbox directory for an integration test.
String get sandboxDir => _sandboxDir;
@@ -425,7 +424,8 @@
void confirmPublish(ScheduledProcess pub) {
// TODO(rnystrom): This is overly specific and inflexible regarding different
// test packages. Should validate this a little more loosely.
- expect(pub.nextLine(), completion(equals('Publishing "test_pkg" 1.0.0:')));
+ expect(pub.nextLine(), completion(startsWith(
+ 'Publishing "test_pkg" 1.0.0 to ')));
expect(pub.nextLine(), completion(equals("|-- LICENSE")));
expect(pub.nextLine(), completion(equals("|-- lib")));
expect(pub.nextLine(), completion(equals("| '-- test_pkg.dart")));
@@ -741,7 +741,7 @@
expected, String actualText) {
var actual;
try {
- actual = json.parse(actualText);
+ actual = JSON.decode(actualText);
} on FormatException catch(error) {
failures.add('Expected $pipe JSON:');
failures.add(expected);
diff --git a/sdk/lib/_internal/pub/test/unknown_source_test.dart b/sdk/lib/_internal/pub/test/unknown_source_test.dart
index cdcc1d7..dab714c 100644
--- a/sdk/lib/_internal/pub/test/unknown_source_test.dart
+++ b/sdk/lib/_internal/pub/test/unknown_source_test.dart
@@ -4,7 +4,7 @@
library pub_tests;
-import 'dart:json' as json;
+import 'dart:convert';
import 'descriptor.dart' as d;
import 'test_pub.dart';
@@ -48,7 +48,7 @@
// But lock it to a bad one.
d.dir(appPath, [
- d.file("pubspec.lock", json.stringify({
+ d.file("pubspec.lock", JSON.encode({
'packages': {
'foo': {
'version': '0.0.0',
diff --git a/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart b/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart
index 82361ce..54c1a71 100644
--- a/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart
+++ b/sdk/lib/_internal/pub/test/update/git/do_not_update_if_unneeded_test.dart
@@ -6,9 +6,11 @@
import '../../descriptor.dart' as d;
import '../../test_pub.dart';
+import 'package:unittest/unittest.dart' as unittest;
main() {
initConfig();
+ unittest.unittestConfiguration.timeout = const Duration(seconds: 60);
integration("doesn't update one locked Git package's dependencies if it's "
"not necessary", () {
ensureGit();
diff --git a/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart b/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart
index 42b9239..5b5c837 100644
--- a/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart
+++ b/sdk/lib/_internal/pub/test/update/git/update_one_locked_test.dart
@@ -6,9 +6,11 @@
import '../../descriptor.dart' as d;
import '../../test_pub.dart';
+import 'package:unittest/unittest.dart' as unittest;
main() {
initConfig();
+ unittest.unittestConfiguration.timeout = const Duration(seconds: 60);
integration("updates one locked Git package but no others", () {
ensureGit();
diff --git a/sdk/lib/_internal/pub/test/validator/dependency_test.dart b/sdk/lib/_internal/pub/test/validator/dependency_test.dart
index ba29373..53dfff9 100644
--- a/sdk/lib/_internal/pub/test/validator/dependency_test.dart
+++ b/sdk/lib/_internal/pub/test/validator/dependency_test.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:json' as json;
+import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:http/testing.dart';
@@ -40,7 +40,7 @@
if (hostedVersions == null) {
return new Future.value(new http.Response("not found", 404));
} else {
- return new Future.value(new http.Response(json.stringify({
+ return new Future.value(new http.Response(JSON.encode({
"name": "foo",
"uploaders": ["nweiz@google.com"],
"versions": hostedVersions.map((version) =>
@@ -170,7 +170,7 @@
d.libPubspec("test_pkg", "1.0.0", deps: {
"foo": "any"
}),
- d.file("pubspec.lock", json.stringify({
+ d.file("pubspec.lock", JSON.encode({
'packages': {
'bar': {
'version': '1.2.3',
@@ -196,7 +196,7 @@
d.libPubspec("test_pkg", "1.0.0", deps: {
"foo": "any"
}),
- d.file("pubspec.lock", json.stringify({
+ d.file("pubspec.lock", JSON.encode({
'packages': {
'foo': {
'version': '1.2.3',
@@ -219,7 +219,7 @@
d.libPubspec("test_pkg", "1.0.0", deps: {
"foo": "any"
}),
- d.file("pubspec.lock", json.stringify({
+ d.file("pubspec.lock", JSON.encode({
'packages': {
'foo': {
'version': '0.1.2',
diff --git a/sdk/lib/async/zone.dart b/sdk/lib/async/zone.dart
index bea3fc2..078b2d9 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -490,7 +490,10 @@
* by the callback.
*
* The [onDone] handler (if non-null) is invoked when the zone has no more
- * outstanding callbacks.
+ * outstanding callbacks. *Deprecated*: this method is less useful than it
+ * seems, because it assumes that every registered callback is always invoked.
+ * There are, however, many *valid* reasons not to complete futures or to abort
+ * a future-chain. In general it is a bad idea to rely on `onDone`.
*
* The [onRunAsync] handler (if non-null) is invoked when the [body] executes
* [runAsync]. The handler is invoked in the outer zone and can therefore
diff --git a/sdk/lib/collection/hash_map.dart b/sdk/lib/collection/hash_map.dart
index e2f22a6..a0624e0 100644
--- a/sdk/lib/collection/hash_map.dart
+++ b/sdk/lib/collection/hash_map.dart
@@ -38,7 +38,7 @@
* If no values are specified for [key] and [value] the default is the
* identity function.
*/
- factory HashMap.fromIterable(Iterable<K> iterable,
+ factory HashMap.fromIterable(Iterable iterable,
{K key(element), V value(element)}) {
HashMap<K, V> map = new HashMap<K, V>();
Maps._fillMapWithMappedIterable(map, iterable, key, value);
diff --git a/sdk/lib/collection/linked_hash_map.dart b/sdk/lib/collection/linked_hash_map.dart
index ee38ae7..ff6f045f 100644
--- a/sdk/lib/collection/linked_hash_map.dart
+++ b/sdk/lib/collection/linked_hash_map.dart
@@ -41,7 +41,7 @@
* If no values are specified for [key] and [value] the default is the
* identity function.
*/
- factory LinkedHashMap.fromIterable(Iterable<K> iterable,
+ factory LinkedHashMap.fromIterable(Iterable iterable,
{K key(element), V value(element)}) {
LinkedHashMap<K, V> map = new LinkedHashMap<K, V>();
Maps._fillMapWithMappedIterable(map, iterable, key, value);
diff --git a/sdk/lib/collection/linked_list.dart b/sdk/lib/collection/linked_list.dart
index 502341c..cd89e78 100644
--- a/sdk/lib/collection/linked_list.dart
+++ b/sdk/lib/collection/linked_list.dart
@@ -185,7 +185,8 @@
/**
* Entry element for a [LinkedList]. Any entry must extend this class.
*/
-abstract class LinkedListEntry<E> implements _LinkedListLink {
+abstract class LinkedListEntry<E extends LinkedListEntry>
+ implements _LinkedListLink {
LinkedList<E> _list;
_LinkedListLink _next;
_LinkedListLink _previous;
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index 7b4a074..0e0c611 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -20,17 +20,11 @@
* This implements all read operations using only the `length` and
* `operator[]` members. It implements write operations using those and
* `length=` and `operator[]=`
- *
- * A fixed-length list should mix this class in, and the [FixedLengthListMixin]
- * as well, in that order, to overwrite the methods that modify the length.
- *
- * An unmodifiable list should mix [UnmodifiableListMixin] on top of this
- * mixin to prevent all modifications.
*/
abstract class ListMixin<E> implements List<E> {
- // A list to identify cyclic lists during toString() calls.
+ // A list to identify cyclic lists during toString() calls.
static List _toStringList = new List();
-
+
// Iterable interface.
Iterator<E> get iterator => new ListIterator<E>(this);
@@ -493,9 +487,9 @@
result.write(']');
} finally {
assert(identical(_toStringList.last, this));
- _toStringList.removeLast();
+ _toStringList.removeLast();
}
-
+
return result.toString();
}
}
diff --git a/sdk/lib/convert/string_conversion.dart b/sdk/lib/convert/string_conversion.dart
index 4a90cfa..a10b616 100644
--- a/sdk/lib/convert/string_conversion.dart
+++ b/sdk/lib/convert/string_conversion.dart
@@ -92,8 +92,8 @@
void writeCharCode(int charCode) => _sink.writeCharCode(charCode);
void write(Object o) => _sink.write(o);
- void writeln([Object o]) => _sink.writeln(o);
- void writeAll(Iterable objects, [String separator])
+ void writeln([Object o = ""]) => _sink.writeln(o);
+ void writeAll(Iterable objects, [String separator = ""])
=> _sink.writeAll(objects, separator);
}
@@ -128,12 +128,12 @@
_chunkedSink.add(o.toString());
}
- void writeln([Object o]) {
+ void writeln([Object o = ""]) {
_buffer.writeln(o);
if (_buffer.length > _MIN_STRING_SIZE) _flush();
}
- void writeAll(Iterable objects, [String separator]) {
+ void writeAll(Iterable objects, [String separator = ""]) {
if (_buffer.isNotEmpty) _flush();
Iterator iterator = objects.iterator;
if (!iterator.moveNext()) return;
diff --git a/sdk/lib/core/bool.dart b/sdk/lib/core/bool.dart
index 6155d6a..6c7797f 100644
--- a/sdk/lib/core/bool.dart
+++ b/sdk/lib/core/bool.dart
@@ -7,7 +7,7 @@
/**
* The reserved words [:true:] and [:false:] denote objects that are the only
* instances of this class.
- *
+ *
* It is a compile-time error for a class to attempt to extend or implement
* bool.
*/
@@ -21,5 +21,7 @@
* Returns [:"true":] if the receiver is [:true:], or [:"false":] if the
* receiver is [:false:].
*/
- String toString();
+ String toString() {
+ return this ? "true" : "false";
+ }
}
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index 1ce7193..1c9797c 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -154,36 +154,50 @@
String toString() => "Cannot instantiate abstract class: '$_className'";
}
+
/**
* Error thrown by the default implementation of [:noSuchMethod:] on [Object].
*/
class NoSuchMethodError extends Error {
final Object _receiver;
- final String _memberName;
+ final Symbol _memberName;
final List _arguments;
- final Map<String,dynamic> _namedArguments;
+ final Map<Symbol, dynamic> _namedArguments;
final List _existingArgumentNames;
/**
* Create a [NoSuchMethodError] corresponding to a failed method call.
*
- * The first parameter to this constructor is the receiver of the method call.
+ * The [receiver] is the receiver of the method call.
* That is, the object on which the method was attempted called.
- * The second parameter is the name of the called method or accessor.
- * The third parameter is a list of the positional arguments that the method
- * was called with.
- * The fourth parameter is a map from [String] names to the values of named
+ * If the receiver is `null`, it is interpreted as a call to a top-level
+ * function of a library.
+ *
+ * The [memberName] is a [Symbol] representing the name of the called method
+ * or accessor. It should not be `null`.
+ *
+ * The [positionalArguments] is a list of the positional arguments that the
+ * method was called with. If `null`, it is considered equivalent to the
+ * empty list.
+ *
+ * The [namedArguments] is a map from [Symbol]s to the values of named
* arguments that the method was called with.
+ *
* The optional [exisitingArgumentNames] is the expected parameters of a
* method with the same name on the receiver, if available. This is
- * the method that would have been called if the parameters had matched.
+ * the signature of the method that would have been called if the parameters
+ * had matched.
*/
- NoSuchMethodError(Object this._receiver,
- String this._memberName,
- List this._arguments,
- Map<String,dynamic> this._namedArguments,
+ NoSuchMethodError(Object receiver,
+ Symbol memberName,
+ List positionalArguments,
+ Map<Symbol ,dynamic> namedArguments,
[List existingArgumentNames = null])
- : this._existingArgumentNames = existingArgumentNames;
+ : _receiver = receiver,
+ _memberName = memberName,
+ _arguments = positionalArguments,
+ _namedArguments = namedArguments,
+ _existingArgumentNames = existingArgumentNames;
external String toString();
}
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index af9f895..3c27d04 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -231,10 +231,11 @@
void setAll(int index, Iterable<E> iterable);
/**
- * Removes [value] from this list.
+ * Removes the first occurence of [value] from this list.
*
* Returns true if [value] was in the list.
* Returns false otherwise.
+ *
* The method has no effect if [value] was not in the list.
*
* An [UnsupportedError] occurs if the list is fixed-length.
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index 79e81e4..e673446 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -36,7 +36,7 @@
* If no values are specified for [key] and [value] the default is the
* identity function.
*/
- factory Map.fromIterable(Iterable<K> iterable,
+ factory Map.fromIterable(Iterable iterable,
{K key(element), V value(element)}) = LinkedHashMap<K, V>.fromIterable;
/**
diff --git a/sdk/lib/core/regexp.dart b/sdk/lib/core/regexp.dart
index a515692..815c52a 100644
--- a/sdk/lib/core/regexp.dart
+++ b/sdk/lib/core/regexp.dart
@@ -5,9 +5,10 @@
part of dart.core;
/**
- * [Match] contains methods to manipulate a regular expression match.
+ * [Match] contains methods to manipulate a pattern match.
*
- * Iterables of [Match] objects are returned from [RegExp] matching methods.
+ * A [Match] or and iterable of [Match] objects are returned from [Pattern]
+ * matching methods.
*
* The following example finds all matches of a [RegExp] in a [String]
* and iterates through the returned iterable of [Match] objects.
@@ -25,6 +26,11 @@
* Parse
* my
* string
+ *
+ * Some patterns, regular expressions in particular, may record subtrings
+ * that were part of the matching. These are called "groups" in the `Match`
+ * object. Some patterns may never have any groups, and their matches always
+ * have zero [groupCount].
*/
abstract class Match {
/**
@@ -39,37 +45,66 @@
int get end;
/**
- * Returns the string matched by the given [group]. If [group] is 0,
- * returns the match of the regular expression.
+ * Returns the string matched by the given [group].
+ *
+ * If [group] is 0, returns the match of the pattern.
+ *
+ * The result may be `null` if the pattern didn't assign a value to it
+ * as part of this match.
*/
String group(int group);
+
+ /**
+ * Returns the string matched by the given [group].
+ *
+ * If [group] is 0, returns the match of the pattern.
+ *
+ * Short alias for [Match.group].
+ */
String operator [](int group);
/**
- * Returns the strings matched by [groups]. The order in the
- * returned string follows the order in [groups].
+ * Returns a list of the groups with the given indices.
+ *
+ * The list contains the strings returned by [group] for each index in
+ * [groupIndices].
*/
- List<String> groups(List<int> groups);
+ List<String> groups(List<int> groupIndices);
/**
- * Returns the number of groups in the regular expression.
+ * Returns the number of captured groups in the match.
+ *
+ * Some patterns may capture parts of the input that was used to
+ * compute the full match. This is the number of captured groups,
+ * which is also the maximal allowed argument to the [group] method.
*/
int get groupCount;
/**
- * The string on which this matcher was computed.
+ * The string on which this match was computed.
*/
+ String get input;
+
+ /**
+ * Deprecated alias for [input].
+ *
+ * Will be removed soon.
+ */
+ @deprecated
String get str;
/**
- * The pattern used to search in [str].
+ * The pattern used to search in [input].
*/
Pattern get pattern;
}
/**
- * A class for working with regular expressions.
+ * A regular expression pattern.
+ *
+ * Regular expressions are [Pattern]s, and can as such be used to match strings
+ * or parts of strings.
*
* Dart regular expressions have the same syntax and semantics as
* JavaScript regular expressions. See
@@ -92,36 +127,34 @@
*/
abstract class RegExp implements Pattern {
/**
- * Constructs a regular expression. The default implementation of a
- * [RegExp] sets [multiLine] to false and [caseSensitive] to true.
- * Throws a [FormatException] if [pattern] is not a valid regular
- * exression pattern.
+ * Constructs a regular expression.
+ *
+ * Throws a [FormatException] if [source] is not valid regular
+ * expression syntax.
*/
- external factory RegExp(String pattern, {bool multiLine: false,
- bool caseSensitive: true});
+ external factory RegExp(String source, {bool multiLine: false,
+ bool caseSensitive: true});
/**
* Searches for the first match of the regular expression
- * in the string [str]. Returns `null` if there is no match.
+ * in the string [input]. Returns `null` if there is no match.
*/
- Match firstMatch(String str);
+ Match firstMatch(String input);
/**
- * Returns an iterable on the matches of the regular
- * expression in [str].
+ * Returns an iterable of the matches of the regular expression on [input].
*/
- Iterable<Match> allMatches(String str);
+ Iterable<Match> allMatches(String input);
/**
- * Returns whether the regular expression has a match in the string [str].
+ * Returns whether the regular expression has a match in the string [input].
*/
- bool hasMatch(String str);
+ bool hasMatch(String input);
/**
- * Searches for the first match of the regular expression
- * in the string [str] and returns the matched string.
+ * Returns the first substring match of this regular expression in [input].
*/
- String stringMatch(String str);
+ String stringMatch(String input);
/**
* The pattern of this regular expression.
@@ -130,11 +163,19 @@
/**
* Whether this regular expression matches multiple lines.
+ *
+ * If the regexp does match multiple lines, the "^" and "$" characters
+ * match the beginning and end of lines. If not, the character match the
+ * beginning and end of the input.
*/
bool get isMultiLine;
/**
- * Whether this regular expression is case insensitive.
+ * Whether this regular expression is case sensitive.
+ *
+ * If the regular expression is not case sensitive, it will match an input
+ * letter with a pattern letter even if the two letters are different case
+ * versions of the same letter.
*/
bool get isCaseSensitive;
}
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 919675d..b5106a9 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -1,8 +1,27 @@
-/// The Dart HTML library.
-///
-/// For examples, see
-/// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
-/// on Github.
+/**
+ * HTML elements and other resources for web-based applications that need to
+ * interact with the browser and the DOM (Document Object Model).
+ *
+ * This library includes DOM element types, CSS styling, local storage,
+ * media, speech, events, and more.
+ * To get started,
+ * check out the [Element] class, the base class for many of the HTML
+ * DOM types.
+ *
+ * ## Other resources
+ *
+ * * If you've never written a web app before, try our
+ * tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials).
+ *
+ * * To see some web-based Dart apps in action and to play with the code,
+ * download
+ * [Dart Editor](http://www.dartlang.org/#get-started)
+ * and run its built-in examples.
+ *
+ * * For even more examples, see
+ * [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
+ * on Github.
+ */
library dart.dom.html;
import 'dart:async';
@@ -11,7 +30,7 @@
import 'dart:html_common';
import 'dart:indexed_db';
import 'dart:isolate';
-import 'dart:json' as json;
+import "dart:convert";
import 'dart:math';
import 'dart:typed_data';
import 'dart:svg' as svg;
@@ -264,7 +283,7 @@
@DomName('WebKitAnimationEvent.elapsedTime')
@DocsEditable()
- final num elapsedTime;
+ final double elapsedTime;
}
// 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
@@ -272,7 +291,7 @@
@DocsEditable()
-@DomName('DOMApplicationCache')
+@DomName('ApplicationCache')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@@ -283,110 +302,110 @@
// To suppress missing implicit constructor warnings.
factory ApplicationCache._() { throw new UnsupportedError("Not supported"); }
- @DomName('DOMApplicationCache.cachedEvent')
+ @DomName('ApplicationCache.cachedEvent')
@DocsEditable()
static const EventStreamProvider<Event> cachedEvent = const EventStreamProvider<Event>('cached');
- @DomName('DOMApplicationCache.checkingEvent')
+ @DomName('ApplicationCache.checkingEvent')
@DocsEditable()
static const EventStreamProvider<Event> checkingEvent = const EventStreamProvider<Event>('checking');
- @DomName('DOMApplicationCache.downloadingEvent')
+ @DomName('ApplicationCache.downloadingEvent')
@DocsEditable()
static const EventStreamProvider<Event> downloadingEvent = const EventStreamProvider<Event>('downloading');
- @DomName('DOMApplicationCache.errorEvent')
+ @DomName('ApplicationCache.errorEvent')
@DocsEditable()
static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
- @DomName('DOMApplicationCache.noupdateEvent')
+ @DomName('ApplicationCache.noupdateEvent')
@DocsEditable()
static const EventStreamProvider<Event> noUpdateEvent = const EventStreamProvider<Event>('noupdate');
- @DomName('DOMApplicationCache.obsoleteEvent')
+ @DomName('ApplicationCache.obsoleteEvent')
@DocsEditable()
static const EventStreamProvider<Event> obsoleteEvent = const EventStreamProvider<Event>('obsolete');
- @DomName('DOMApplicationCache.progressEvent')
+ @DomName('ApplicationCache.progressEvent')
@DocsEditable()
static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
- @DomName('DOMApplicationCache.updatereadyEvent')
+ @DomName('ApplicationCache.updatereadyEvent')
@DocsEditable()
static const EventStreamProvider<Event> updateReadyEvent = const EventStreamProvider<Event>('updateready');
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.applicationCache)');
- @DomName('DOMApplicationCache.CHECKING')
+ @DomName('ApplicationCache.CHECKING')
@DocsEditable()
static const int CHECKING = 2;
- @DomName('DOMApplicationCache.DOWNLOADING')
+ @DomName('ApplicationCache.DOWNLOADING')
@DocsEditable()
static const int DOWNLOADING = 3;
- @DomName('DOMApplicationCache.IDLE')
+ @DomName('ApplicationCache.IDLE')
@DocsEditable()
static const int IDLE = 1;
- @DomName('DOMApplicationCache.OBSOLETE')
+ @DomName('ApplicationCache.OBSOLETE')
@DocsEditable()
static const int OBSOLETE = 5;
- @DomName('DOMApplicationCache.UNCACHED')
+ @DomName('ApplicationCache.UNCACHED')
@DocsEditable()
static const int UNCACHED = 0;
- @DomName('DOMApplicationCache.UPDATEREADY')
+ @DomName('ApplicationCache.UPDATEREADY')
@DocsEditable()
static const int UPDATEREADY = 4;
- @DomName('DOMApplicationCache.status')
+ @DomName('ApplicationCache.status')
@DocsEditable()
final int status;
- @DomName('DOMApplicationCache.abort')
+ @DomName('ApplicationCache.abort')
@DocsEditable()
void abort() native;
- @DomName('DOMApplicationCache.swapCache')
+ @DomName('ApplicationCache.swapCache')
@DocsEditable()
void swapCache() native;
- @DomName('DOMApplicationCache.update')
+ @DomName('ApplicationCache.update')
@DocsEditable()
void update() native;
- @DomName('DOMApplicationCache.oncached')
+ @DomName('ApplicationCache.oncached')
@DocsEditable()
Stream<Event> get onCached => cachedEvent.forTarget(this);
- @DomName('DOMApplicationCache.onchecking')
+ @DomName('ApplicationCache.onchecking')
@DocsEditable()
Stream<Event> get onChecking => checkingEvent.forTarget(this);
- @DomName('DOMApplicationCache.ondownloading')
+ @DomName('ApplicationCache.ondownloading')
@DocsEditable()
Stream<Event> get onDownloading => downloadingEvent.forTarget(this);
- @DomName('DOMApplicationCache.onerror')
+ @DomName('ApplicationCache.onerror')
@DocsEditable()
Stream<Event> get onError => errorEvent.forTarget(this);
- @DomName('DOMApplicationCache.onnoupdate')
+ @DomName('ApplicationCache.onnoupdate')
@DocsEditable()
Stream<Event> get onNoUpdate => noUpdateEvent.forTarget(this);
- @DomName('DOMApplicationCache.onobsolete')
+ @DomName('ApplicationCache.onobsolete')
@DocsEditable()
Stream<Event> get onObsolete => obsoleteEvent.forTarget(this);
- @DomName('DOMApplicationCache.onprogress')
+ @DomName('ApplicationCache.onprogress')
@DocsEditable()
Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
- @DomName('DOMApplicationCache.onupdateready')
+ @DomName('ApplicationCache.onupdateready')
@DocsEditable()
Stream<Event> get onUpdateReady => updateReadyEvent.forTarget(this);
}
@@ -1180,7 +1199,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
- final num backingStorePixelRatio;
+ final double backingStorePixelRatio;
@JSName('arc')
@DomName('CanvasRenderingContext2D.arc')
@@ -1833,7 +1852,9 @@
@DomName('Console')
class Console {
- static Console _safeConsole = new Console();
+ Console._safe() {}
+
+ static Console _safeConsole = new Console._safe();
bool get _isConsoleDefined => JS('bool', 'typeof console != "undefined"');
@@ -1916,17 +1937,124 @@
@DomName('Console.warn')
void warn(Object arg) => _isConsoleDefined ?
JS('void', 'console.warn(#)', arg) : null;
+ // To suppress missing implicit constructor warnings.
+ factory Console._() { throw new UnsupportedError("Not supported"); }
- @DomName('Console.clear')
+}
+// 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('ConsoleBase')
+@Experimental() // untriaged
+class ConsoleBase extends Interceptor native "ConsoleBase" {
+
+ @DomName('ConsoleBase.assertCondition')
@DocsEditable()
- @Experimental()
+ @Experimental() // untriaged
+ void assertCondition(bool condition, Object arg) native;
+
+ @DomName('ConsoleBase.clear')
+ @DocsEditable()
+ @Experimental() // untriaged
void clear(Object arg) native;
- @DomName('Console.table')
+ @DomName('ConsoleBase.count')
@DocsEditable()
- @Experimental()
+ @Experimental() // untriaged
+ void count(Object arg) native;
+
+ @DomName('ConsoleBase.debug')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void debug(Object arg) native;
+
+ @DomName('ConsoleBase.dir')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void dir(Object arg) native;
+
+ @DomName('ConsoleBase.dirxml')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void dirxml(Object arg) native;
+
+ @DomName('ConsoleBase.error')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void error(Object arg) native;
+
+ @DomName('ConsoleBase.group')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void group(Object arg) native;
+
+ @DomName('ConsoleBase.groupCollapsed')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void groupCollapsed(Object arg) native;
+
+ @DomName('ConsoleBase.groupEnd')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void groupEnd() native;
+
+ @DomName('ConsoleBase.info')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void info(Object arg) native;
+
+ @DomName('ConsoleBase.log')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void log(Object arg) native;
+
+ @DomName('ConsoleBase.markTimeline')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void markTimeline(Object arg) native;
+
+ @DomName('ConsoleBase.profile')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void profile(String title) native;
+
+ @DomName('ConsoleBase.profileEnd')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void profileEnd(String title) native;
+
+ @DomName('ConsoleBase.table')
+ @DocsEditable()
+ @Experimental() // untriaged
void table(Object arg) native;
+ @DomName('ConsoleBase.time')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void time(String title) native;
+
+ @DomName('ConsoleBase.timeEnd')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void timeEnd(String title) native;
+
+ @DomName('ConsoleBase.timeStamp')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void timeStamp(Object arg) native;
+
+ @DomName('ConsoleBase.trace')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void trace(Object arg) native;
+
+ @DomName('ConsoleBase.warn')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void warn(Object arg) 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
@@ -1974,31 +2102,31 @@
@DomName('Coordinates.accuracy')
@DocsEditable()
- final num accuracy;
+ final double accuracy;
@DomName('Coordinates.altitude')
@DocsEditable()
- final num altitude;
+ final double altitude;
@DomName('Coordinates.altitudeAccuracy')
@DocsEditable()
- final num altitudeAccuracy;
+ final double altitudeAccuracy;
@DomName('Coordinates.heading')
@DocsEditable()
- final num heading;
+ final double heading;
@DomName('Coordinates.latitude')
@DocsEditable()
- final num latitude;
+ final double latitude;
@DomName('Coordinates.longitude')
@DocsEditable()
- final num longitude;
+ final double longitude;
@DomName('Coordinates.speed')
@DocsEditable()
- final num speed;
+ final double speed;
}
// 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
@@ -2063,43 +2191,6 @@
@DocsEditable()
-@DomName('CryptoOperation')
-@Experimental() // untriaged
-class CryptoOperation extends Interceptor native "CryptoOperation" {
-
- @DomName('CryptoOperation.algorithm')
- @DocsEditable()
- @Experimental() // untriaged
- final Algorithm algorithm;
-
- @DomName('CryptoOperation.abort')
- @DocsEditable()
- @Experimental() // untriaged
- Object abort() native;
-
- @DomName('CryptoOperation.finish')
- @DocsEditable()
- @Experimental() // untriaged
- Object finish() native;
-
- @JSName('process')
- @DomName('CryptoOperation.process')
- @DocsEditable()
- @Experimental() // untriaged
- CryptoOperation processByteBuffer(ByteBuffer data) native;
-
- @JSName('process')
- @DomName('CryptoOperation.process')
- @DocsEditable()
- @Experimental() // untriaged
- CryptoOperation processTypedData(TypedData data) 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
-// BSD-style license that can be found in the LICENSE file.
-
-
-@DocsEditable()
@DomName('CSS')
// http://www.w3.org/TR/css3-conditional/#the-css-interface
@Experimental() // None
@@ -2315,21 +2406,20 @@
@DocsEditable()
-@DomName('WebKitCSSKeyframeRule')
-@SupportedBrowser(SupportedBrowser.CHROME)
-@SupportedBrowser(SupportedBrowser.SAFARI)
-@Experimental()
-// http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface
-class CssKeyframeRule extends CssRule native "CSSKeyframeRule,MozCSSKeyframeRule,WebKitCSSKeyframeRule" {
+@DomName('CSSKeyframeRule')
+@Experimental() // untriaged
+class CssKeyframeRule extends CssRule native "CSSKeyframeRule" {
// To suppress missing implicit constructor warnings.
factory CssKeyframeRule._() { throw new UnsupportedError("Not supported"); }
- @DomName('WebKitCSSKeyframeRule.keyText')
+ @DomName('CSSKeyframeRule.keyText')
@DocsEditable()
+ @Experimental() // untriaged
String keyText;
- @DomName('WebKitCSSKeyframeRule.style')
+ @DomName('CSSKeyframeRule.style')
@DocsEditable()
+ @Experimental() // untriaged
final CssStyleDeclaration style;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2338,45 +2428,43 @@
@DocsEditable()
-@DomName('WebKitCSSKeyframesRule')
-@SupportedBrowser(SupportedBrowser.CHROME)
-@SupportedBrowser(SupportedBrowser.SAFARI)
-@Experimental()
-// http://www.w3.org/TR/css3-animations/#csskeyframesrule
-class CssKeyframesRule extends CssRule native "CSSKeyframesRule,MozCSSKeyframesRule,WebKitCSSKeyframesRule" {
+@DomName('CSSKeyframesRule')
+@Experimental() // untriaged
+class CssKeyframesRule extends CssRule native "CSSKeyframesRule" {
// To suppress missing implicit constructor warnings.
factory CssKeyframesRule._() { throw new UnsupportedError("Not supported"); }
- @DomName('WebKitCSSKeyframesRule.cssRules')
+ @DomName('CSSKeyframesRule.cssRules')
@DocsEditable()
+ @Experimental() // untriaged
@Returns('_CssRuleList')
@Creates('_CssRuleList')
final List<CssRule> cssRules;
- @DomName('WebKitCSSKeyframesRule.name')
+ @DomName('CSSKeyframesRule.name')
@DocsEditable()
+ @Experimental() // untriaged
String name;
- @DomName('WebKitCSSKeyframesRule.__getter__')
+ @DomName('CSSKeyframesRule.__getter__')
@DocsEditable()
+ @Experimental() // untriaged
CssKeyframeRule __getter__(int index) native;
- @DomName('WebKitCSSKeyframesRule.deleteRule')
+ @DomName('CSSKeyframesRule.deleteRule')
@DocsEditable()
+ @Experimental() // untriaged
void deleteRule(String key) native;
- @DomName('WebKitCSSKeyframesRule.findRule')
+ @DomName('CSSKeyframesRule.findRule')
@DocsEditable()
+ @Experimental() // untriaged
CssKeyframeRule findRule(String key) native;
-
- void appendRule(String rule) {
- if (JS('bool', '("appendRule" in #)', this)) {
- JS('', '#.appendRule(#)', this, rule);
- } else {
- JS('', '#.insertRule(#)', this, rule);
- }
- }
+ @DomName('CSSKeyframesRule.insertRule')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void insertRule(String rule) 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
@@ -2646,6 +2734,16 @@
@DocsEditable()
static const int IMPORT_RULE = 3;
+ @DomName('CSSRule.KEYFRAMES_RULE')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int KEYFRAMES_RULE = 7;
+
+ @DomName('CSSRule.KEYFRAME_RULE')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int KEYFRAME_RULE = 8;
+
@DomName('CSSRule.MEDIA_RULE')
@DocsEditable()
static const int MEDIA_RULE = 4;
@@ -6465,27 +6563,33 @@
@DocsEditable()
final int length;
+ @DomName('DataTransferItemList.__getter__')
+ @DocsEditable()
+ @Experimental() // untriaged
+ DataTransferItem __getter__(int index) native;
+
@DomName('DataTransferItemList.add')
@DocsEditable()
- void add(data_OR_file, [String type]) native;
+ DataTransferItem add(data_OR_file, [String type]) native;
@JSName('add')
@DomName('DataTransferItemList.add')
@DocsEditable()
- void addData(String data, String type) native;
+ DataTransferItem addData(String data, String type) native;
@JSName('add')
@DomName('DataTransferItemList.add')
@DocsEditable()
- void addFile(File file) native;
+ DataTransferItem addFile(File file) native;
@DomName('DataTransferItemList.clear')
@DocsEditable()
void clear() native;
- @DomName('DataTransferItemList.item')
+ @DomName('DataTransferItemList.remove')
@DocsEditable()
- DataTransferItem item(int index) native;
+ @Experimental() // untriaged
+ void remove(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
@@ -6563,15 +6667,15 @@
@DomName('DeviceAcceleration.x')
@DocsEditable()
- final num x;
+ final double x;
@DomName('DeviceAcceleration.y')
@DocsEditable()
- final num y;
+ final double y;
@DomName('DeviceAcceleration.z')
@DocsEditable()
- final num z;
+ final double z;
}
// 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
@@ -6596,7 +6700,7 @@
@DomName('DeviceMotionEvent.interval')
@DocsEditable()
- final num interval;
+ final double interval;
@DomName('DeviceMotionEvent.rotationRate')
@DocsEditable()
@@ -6629,15 +6733,15 @@
@DomName('DeviceOrientationEvent.alpha')
@DocsEditable()
- final num alpha;
+ final double alpha;
@DomName('DeviceOrientationEvent.beta')
@DocsEditable()
- final num beta;
+ final double beta;
@DomName('DeviceOrientationEvent.gamma')
@DocsEditable()
- final num gamma;
+ final double gamma;
@JSName('initDeviceOrientationEvent')
@DomName('DeviceOrientationEvent.initDeviceOrientationEvent')
@@ -6658,15 +6762,15 @@
@DomName('DeviceRotationRate.alpha')
@DocsEditable()
- final num alpha;
+ final double alpha;
@DomName('DeviceRotationRate.beta')
@DocsEditable()
- final num beta;
+ final double beta;
@DomName('DeviceRotationRate.gamma')
@DocsEditable()
- final num gamma;
+ final double gamma;
}
// 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
@@ -7178,10 +7282,9 @@
@Unstable()
NodeIterator _createNodeIterator(Node root, [int whatToShow, NodeFilter filter, bool expandEntityReferences]) native;
- @JSName('createRange')
@DomName('Document.createRange')
@DocsEditable()
- Range $dom_createRange() native;
+ Range createRange() native;
@JSName('createTextNode')
@DomName('Document.createTextNode')
@@ -9678,7 +9781,7 @@
}
var fragment;
if (Range.supportsCreateContextualFragment) {
- var range = _parseDocument.$dom_createRange();
+ var range = _parseDocument.createRange();
range.selectNodeContents(contextElement);
fragment = range.createContextualFragment(html);
} else {
@@ -10072,6 +10175,12 @@
@DocsEditable()
String id;
+ // Use implementation from Node.
+ // final String _localName;
+
+ // Use implementation from Node.
+ // final String _namespaceUri;
+
@DomName('Element.offsetHeight')
@DocsEditable()
final int offsetHeight;
@@ -10147,12 +10256,12 @@
@JSName('getAttribute')
@DomName('Element.getAttribute')
@DocsEditable()
- String $dom_getAttribute(String name) native;
+ String _getAttribute(String name) native;
@JSName('getAttributeNS')
@DomName('Element.getAttributeNS')
@DocsEditable()
- String $dom_getAttributeNS(String namespaceURI, String localName) native;
+ String _getAttributeNS(String namespaceURI, String localName) native;
@DomName('Element.getBoundingClientRect')
@DocsEditable()
@@ -10256,12 +10365,12 @@
@JSName('setAttribute')
@DomName('Element.setAttribute')
@DocsEditable()
- void $dom_setAttribute(String name, String value) native;
+ void _setAttribute(String name, String value) native;
@JSName('setAttributeNS')
@DomName('Element.setAttributeNS')
@DocsEditable()
- void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String value) native;
+ void _setAttributeNS(String namespaceURI, String qualifiedName, String value) native;
@JSName('webkitGetRegionFlowRanges')
@DomName('Element.webkitGetRegionFlowRanges')
@@ -11378,7 +11487,9 @@
@DomName('FileError')
// http://dev.w3.org/2009/dap/file-system/pub/FileSystem/
@Experimental()
-class FileError extends Interceptor native "FileError" {
+class FileError extends DomError native "FileError" {
+ // To suppress missing implicit constructor warnings.
+ factory FileError._() { throw new UnsupportedError("Not supported"); }
@DomName('FileError.ABORT_ERR')
@DocsEditable()
@@ -12346,6 +12457,28 @@
@DocsEditable()
+@DomName('HmacKeyParams')
+@Experimental() // untriaged
+class HmacKeyParams extends Algorithm native "HmacKeyParams" {
+ // To suppress missing implicit constructor warnings.
+ factory HmacKeyParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('HmacKeyParams.hash')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final Algorithm hash;
+
+ @DomName('HmacKeyParams.length')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final int length;
+}
+// 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('HmacParams')
@Experimental() // untriaged
class HmacParams extends Algorithm native "HmacParams" {
@@ -12366,7 +12499,7 @@
@DomName('HTMLAllCollection')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#dom-document-all
@deprecated // deprecated
-class HtmlAllCollection extends Interceptor with ListMixin<Node>, ImmutableListMixin<Node> implements JavaScriptIndexingBehavior, List<Node> native "HTMLAllCollection" {
+class HtmlAllCollection extends Interceptor with ListMixin<Node>, ImmutableListMixin<Node> implements List<Node> native "HTMLAllCollection" {
@DomName('HTMLAllCollection.length')
@DocsEditable()
@@ -12757,7 +12890,7 @@
* * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest)
*/
@DomName('XMLHttpRequest')
-class HttpRequest extends EventTarget native "XMLHttpRequest" {
+class HttpRequest extends XmlHttpRequestEventTarget native "XMLHttpRequest" {
/**
* Creates a URL get request for the specified [url].
@@ -12960,6 +13093,13 @@
completer.completeError(e);
}, 1));
+ // IE9 RTM - XDomainRequest issued requests may abort if all event handlers
+ // not specified
+ // http://social.msdn.microsoft.com/Forums/ie/en-US/30ef3add-767c-4436-b8a9-f1ca19b4812e/ie9-rtm-xdomainrequest-issued-requests-may-abort-if-all-event-handlers-not-specified
+ JS('', '#.onprogress = {}', xhr);
+ JS('', '#.ontimeout = {}', xhr);
+ JS('', '#.timeout = Number.MAX_VALUE', xhr);
+
if (sendData != null) {
JS('', '#.send(#)', xhr, sendData);
} else {
@@ -12972,30 +13112,6 @@
// To suppress missing implicit constructor warnings.
factory HttpRequest._() { throw new UnsupportedError("Not supported"); }
- @DomName('XMLHttpRequest.abortEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> abortEvent = const EventStreamProvider<ProgressEvent>('abort');
-
- @DomName('XMLHttpRequest.errorEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> errorEvent = const EventStreamProvider<ProgressEvent>('error');
-
- @DomName('XMLHttpRequest.loadEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEvent = const EventStreamProvider<ProgressEvent>('load');
-
- @DomName('XMLHttpRequest.loadendEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEndEvent = const EventStreamProvider<ProgressEvent>('loadend');
-
- @DomName('XMLHttpRequest.loadstartEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadStartEvent = const EventStreamProvider<ProgressEvent>('loadstart');
-
- @DomName('XMLHttpRequest.progressEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
-
@DomName('XMLHttpRequest.readystatechangeEvent')
@DocsEditable()
static const EventStreamProvider<ProgressEvent> readyStateChangeEvent = const EventStreamProvider<ProgressEvent>('readystatechange');
@@ -13250,65 +13366,6 @@
void setRequestHeader(String header, String value) native;
/**
- * Event listeners to be notified when request has been aborted,
- * generally due to calling `httpRequest.abort()`.
- */
- @DomName('XMLHttpRequest.onabort')
- @DocsEditable()
- Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
-
- /**
- * Event listeners to be notified when a request has failed, such as when a
- * cross-domain error occurred or the file wasn't found on the server.
- */
- @DomName('XMLHttpRequest.onerror')
- @DocsEditable()
- Stream<ProgressEvent> get onError => errorEvent.forTarget(this);
-
- /**
- * Event listeners to be notified once the request has completed
- * *successfully*.
- */
- @DomName('XMLHttpRequest.onload')
- @DocsEditable()
- Stream<ProgressEvent> get onLoad => loadEvent.forTarget(this);
-
- /**
- * Event listeners to be notified once the request has completed (on
- * either success or failure).
- */
- @DomName('XMLHttpRequest.onloadend')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.FIREFOX)
- @SupportedBrowser(SupportedBrowser.IE, '10')
- @SupportedBrowser(SupportedBrowser.SAFARI)
- Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
-
- /**
- * Event listeners to be notified when the request starts, once
- * `httpRequest.send()` has been called.
- */
- @DomName('XMLHttpRequest.onloadstart')
- @DocsEditable()
- Stream<ProgressEvent> get onLoadStart => loadStartEvent.forTarget(this);
-
- /**
- * Event listeners to be notified when data for the request
- * is being sent or loaded.
- *
- * Progress events are fired every 50ms or for every byte transmitted,
- * whichever is less frequent.
- */
- @DomName('XMLHttpRequest.onprogress')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.FIREFOX)
- @SupportedBrowser(SupportedBrowser.IE, '10')
- @SupportedBrowser(SupportedBrowser.SAFARI)
- Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
-
- /**
* Event listeners to be notified every time the [HttpRequest]
* object's `readyState` changes values.
*/
@@ -13352,57 +13409,9 @@
@DomName('XMLHttpRequestUpload')
// http://xhr.spec.whatwg.org/#xmlhttprequestupload
@Experimental()
-class HttpRequestUpload extends EventTarget native "XMLHttpRequestUpload,XMLHttpRequestEventTarget" {
+class HttpRequestUpload extends XmlHttpRequestEventTarget native "XMLHttpRequestUpload,XMLHttpRequestEventTarget" {
// To suppress missing implicit constructor warnings.
factory HttpRequestUpload._() { throw new UnsupportedError("Not supported"); }
-
- @DomName('XMLHttpRequestUpload.abortEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> abortEvent = const EventStreamProvider<ProgressEvent>('abort');
-
- @DomName('XMLHttpRequestUpload.errorEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> errorEvent = const EventStreamProvider<ProgressEvent>('error');
-
- @DomName('XMLHttpRequestUpload.loadEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEvent = const EventStreamProvider<ProgressEvent>('load');
-
- @DomName('XMLHttpRequestUpload.loadendEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEndEvent = const EventStreamProvider<ProgressEvent>('loadend');
-
- @DomName('XMLHttpRequestUpload.loadstartEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadStartEvent = const EventStreamProvider<ProgressEvent>('loadstart');
-
- @DomName('XMLHttpRequestUpload.progressEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
-
- @DomName('XMLHttpRequestUpload.onabort')
- @DocsEditable()
- Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onerror')
- @DocsEditable()
- Stream<ProgressEvent> get onError => errorEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onload')
- @DocsEditable()
- Stream<ProgressEvent> get onLoad => loadEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onloadend')
- @DocsEditable()
- Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onloadstart')
- @DocsEditable()
- Stream<ProgressEvent> get onLoadStart => loadStartEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onprogress')
- @DocsEditable()
- Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
}
// 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
@@ -14981,7 +14990,7 @@
@DomName('MediaController.duration')
@DocsEditable()
- final num duration;
+ final double duration;
@DomName('MediaController.muted')
@DocsEditable()
@@ -15223,7 +15232,7 @@
@DomName('HTMLMediaElement.duration')
@DocsEditable()
- final num duration;
+ final double duration;
@DomName('HTMLMediaElement.ended')
@DocsEditable()
@@ -15237,7 +15246,7 @@
@DocsEditable()
// http://www.w3.org/TR/2011/WD-html5-20110113/video.html#dom-media-initialtime
@Experimental()
- final num initialTime;
+ final double initialTime;
@DomName('HTMLMediaElement.loop')
@DocsEditable()
@@ -15296,7 +15305,7 @@
@DomName('HTMLMediaElement.startTime')
@DocsEditable()
@Experimental() // non-standard
- final num startTime;
+ final double startTime;
@DomName('HTMLMediaElement.textTracks')
@DocsEditable()
@@ -16166,13 +16175,6 @@
@Unstable()
class MessageChannel extends Interceptor native "MessageChannel" {
- @DomName('MessageChannel.MessageChannel')
- @DocsEditable()
- factory MessageChannel() {
- return MessageChannel._create_1();
- }
- static MessageChannel _create_1() => JS('MessageChannel', 'new MessageChannel()');
-
@DomName('MessageChannel.port1')
@DocsEditable()
final MessagePort port1;
@@ -16228,12 +16230,10 @@
@Creates('JSExtendableArray')
final List<MessagePort> ports;
- WindowBase get source => _convertNativeToDart_Window(this._get_source);
+ EventTarget get source => _convertNativeToDart_EventTarget(this._get_source);
@JSName('source')
@DomName('MessageEvent.source')
@DocsEditable()
- @Creates('Window|=Object')
- @Returns('Window|=Object')
final dynamic _get_source;
@JSName('initMessageEvent')
@@ -16513,7 +16513,7 @@
@DomName('MIDIMessageEvent.receivedTime')
@DocsEditable()
- final num receivedTime;
+ final double receivedTime;
}
// 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
@@ -16695,7 +16695,7 @@
@DomName('MouseEvent')
-class MouseEvent extends UIEvent native "MouseEvent,DragEvent" {
+class MouseEvent extends UIEvent native "MouseEvent,DragEvent,PointerEvent,MSPointerEvent" {
factory MouseEvent(String type,
{Window view, int detail: 0, int screenX: 0, int screenY: 0,
int clientX: 0, int clientY: 0, int button: 0, bool canBubble: true,
@@ -17160,7 +17160,7 @@
@DomName('Navigator')
-class Navigator extends Interceptor native "Navigator" {
+class Navigator extends Interceptor implements NavigatorOnLine, NavigatorID native "Navigator" {
@DomName('Navigator.language')
String get language => JS('String', '#.language || #.userLanguage', this,
@@ -17239,14 +17239,6 @@
@Experimental() // non-standard
final String appCodeName;
- @DomName('Navigator.appName')
- @DocsEditable()
- final String appName;
-
- @DomName('Navigator.appVersion')
- @DocsEditable()
- final String appVersion;
-
@DomName('Navigator.cookieEnabled')
@DocsEditable()
@Unstable()
@@ -17268,15 +17260,6 @@
@Experimental() // nonstandard
final MimeTypeArray mimeTypes;
- @DomName('Navigator.onLine')
- @DocsEditable()
- @Unstable()
- final bool onLine;
-
- @DomName('Navigator.platform')
- @DocsEditable()
- final String platform;
-
@DomName('Navigator.plugins')
@DocsEditable()
@deprecated // nonstandard
@@ -17292,10 +17275,6 @@
@Unstable()
final String productSub;
- @DomName('Navigator.userAgent')
- @DocsEditable()
- final String userAgent;
-
@DomName('Navigator.vendor')
@DocsEditable()
@Unstable()
@@ -17372,6 +17351,61 @@
@Creates('_GamepadList')
List<Gamepad> getGamepads() native;
+ // From NavigatorID
+
+ @DomName('Navigator.appName')
+ @DocsEditable()
+ final String appName;
+
+ @DomName('Navigator.appVersion')
+ @DocsEditable()
+ final String appVersion;
+
+ @DomName('Navigator.platform')
+ @DocsEditable()
+ final String platform;
+
+ @DomName('Navigator.userAgent')
+ @DocsEditable()
+ final String userAgent;
+
+ // From NavigatorOnLine
+
+ @DomName('Navigator.onLine')
+ @DocsEditable()
+ @Unstable()
+ final bool onLine;
+
+}
+// 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('NavigatorID')
+@Experimental() // untriaged
+abstract class NavigatorID extends Interceptor {
+
+ String appName;
+
+ String appVersion;
+
+ String platform;
+
+ String userAgent;
+}
+// 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('NavigatorOnLine')
+@Experimental() // untriaged
+abstract class NavigatorOnLine extends Interceptor {
+
+ bool onLine;
}
// 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
@@ -17545,7 +17579,7 @@
_this._replaceChild(value, this[index]);
}
- Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
+ Iterator<Node> get iterator => _this._childNodes.iterator;
// From List<Node>:
@@ -17567,15 +17601,15 @@
// -- end List<Node> mixins.
// TODO(jacobr): benchmark whether this is more efficient or whether caching
- // a local copy of $dom_childNodes is more efficient.
- int get length => _this.$dom_childNodes.length;
+ // a local copy of _childNodes is more efficient.
+ int get length => _this._childNodes.length;
void set length(int value) {
throw new UnsupportedError(
"Cannot set length on immutable List.");
}
- Node operator[](int index) => _this.$dom_childNodes[index];
+ Node operator[](int index) => _this._childNodes[index];
}
/** Information about the instantiated template. */
@@ -17774,7 +17808,7 @@
@DocsEditable()
@Returns('NodeList')
@Creates('NodeList')
- final List<Node> $dom_childNodes;
+ final List<Node> _childNodes;
@DomName('Node.firstChild')
@DocsEditable()
@@ -18775,7 +18809,7 @@
@DomName('Performance.now')
@DocsEditable()
- num now() native;
+ double now() native;
@JSName('webkitClearResourceTimings')
@DomName('Performance.webkitClearResourceTimings')
@@ -18808,7 +18842,7 @@
@DomName('PerformanceEntry.duration')
@DocsEditable()
- final num duration;
+ final double duration;
@DomName('PerformanceEntry.entryType')
@DocsEditable()
@@ -18820,7 +18854,7 @@
@DomName('PerformanceEntry.startTime')
@DocsEditable()
- final num startTime;
+ final double startTime;
}
// 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
@@ -18897,23 +18931,23 @@
@DomName('PerformanceResourceTiming.connectEnd')
@DocsEditable()
- final num connectEnd;
+ final double connectEnd;
@DomName('PerformanceResourceTiming.connectStart')
@DocsEditable()
- final num connectStart;
+ final double connectStart;
@DomName('PerformanceResourceTiming.domainLookupEnd')
@DocsEditable()
- final num domainLookupEnd;
+ final double domainLookupEnd;
@DomName('PerformanceResourceTiming.domainLookupStart')
@DocsEditable()
- final num domainLookupStart;
+ final double domainLookupStart;
@DomName('PerformanceResourceTiming.fetchStart')
@DocsEditable()
- final num fetchStart;
+ final double fetchStart;
@DomName('PerformanceResourceTiming.initiatorType')
@DocsEditable()
@@ -18921,30 +18955,30 @@
@DomName('PerformanceResourceTiming.redirectEnd')
@DocsEditable()
- final num redirectEnd;
+ final double redirectEnd;
@DomName('PerformanceResourceTiming.redirectStart')
@DocsEditable()
- final num redirectStart;
+ final double redirectStart;
@DomName('PerformanceResourceTiming.requestStart')
@DocsEditable()
@Experimental() // nonstandard
- final num requestStart;
+ final double requestStart;
@DomName('PerformanceResourceTiming.responseEnd')
@DocsEditable()
@Experimental() // nonstandard
- final num responseEnd;
+ final double responseEnd;
@DomName('PerformanceResourceTiming.responseStart')
@DocsEditable()
@Experimental() // nonstandard
- final num responseStart;
+ final double responseStart;
@DomName('PerformanceResourceTiming.secureConnectionStart')
@DocsEditable()
- final num secureConnectionStart;
+ final double secureConnectionStart;
}
// 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
@@ -19253,15 +19287,10 @@
@DocsEditable()
@DomName('ProcessingInstruction')
@Unstable()
-class ProcessingInstruction extends Node native "ProcessingInstruction" {
+class ProcessingInstruction extends CharacterData native "ProcessingInstruction" {
// To suppress missing implicit constructor warnings.
factory ProcessingInstruction._() { throw new UnsupportedError("Not supported"); }
- @DomName('ProcessingInstruction.data')
- @DocsEditable()
- @Experimental() // non-standard
- String data;
-
@DomName('ProcessingInstruction.sheet')
@DocsEditable()
@Experimental() // non-standard
@@ -19306,7 +19335,7 @@
@DomName('HTMLProgressElement.position')
@DocsEditable()
- final num position;
+ final double position;
@DomName('HTMLProgressElement.value')
@DocsEditable()
@@ -19462,7 +19491,7 @@
@DomName('Range')
@Unstable()
class Range extends Interceptor native "Range" {
- factory Range() => document.$dom_createRange();
+ factory Range() => document.createRange();
factory Range.fromPoint(Point point) =>
document._caretRangeFromPoint(point.x, point.y);
@@ -21291,7 +21320,7 @@
@DomName('SpeechInputResult.confidence')
@DocsEditable()
- final num confidence;
+ final double confidence;
@DomName('SpeechInputResult.utterance')
@DocsEditable()
@@ -21452,7 +21481,7 @@
@DomName('SpeechRecognitionAlternative.confidence')
@DocsEditable()
- final num confidence;
+ final double confidence;
@DomName('SpeechRecognitionAlternative.transcript')
@DocsEditable()
@@ -21598,7 +21627,7 @@
@DomName('SpeechSynthesisEvent.elapsedTime')
@DocsEditable()
- final num elapsedTime;
+ final double elapsedTime;
@DomName('SpeechSynthesisEvent.name')
@DocsEditable()
@@ -22143,41 +22172,41 @@
@DomName('SubtleCrypto.decrypt')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation decrypt(Map algorithm, CryptoKey key) {
+ Object decrypt(Map algorithm, CryptoKey key, TypedData data) {
var algorithm_1 = convertDartToNative_Dictionary(algorithm);
- return _decrypt_1(algorithm_1, key);
+ return _decrypt_1(algorithm_1, key, data);
}
@JSName('decrypt')
@DomName('SubtleCrypto.decrypt')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation _decrypt_1(algorithm, CryptoKey key) native;
+ Object _decrypt_1(algorithm, CryptoKey key, TypedData data) native;
@DomName('SubtleCrypto.digest')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation digest(Map algorithm) {
+ Object digest(Map algorithm, TypedData data) {
var algorithm_1 = convertDartToNative_Dictionary(algorithm);
- return _digest_1(algorithm_1);
+ return _digest_1(algorithm_1, data);
}
@JSName('digest')
@DomName('SubtleCrypto.digest')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation _digest_1(algorithm) native;
+ Object _digest_1(algorithm, TypedData data) native;
@DomName('SubtleCrypto.encrypt')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation encrypt(Map algorithm, CryptoKey key) {
+ Object encrypt(Map algorithm, CryptoKey key, TypedData data) {
var algorithm_1 = convertDartToNative_Dictionary(algorithm);
- return _encrypt_1(algorithm_1, key);
+ return _encrypt_1(algorithm_1, key, data);
}
@JSName('encrypt')
@DomName('SubtleCrypto.encrypt')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation _encrypt_1(algorithm, CryptoKey key) native;
+ Object _encrypt_1(algorithm, CryptoKey key, TypedData data) native;
@DomName('SubtleCrypto.generateKey')
@DocsEditable()
@@ -22208,28 +22237,28 @@
@DomName('SubtleCrypto.sign')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation sign(Map algorithm, CryptoKey key) {
+ Object sign(Map algorithm, CryptoKey key, TypedData data) {
var algorithm_1 = convertDartToNative_Dictionary(algorithm);
- return _sign_1(algorithm_1, key);
+ return _sign_1(algorithm_1, key, data);
}
@JSName('sign')
@DomName('SubtleCrypto.sign')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation _sign_1(algorithm, CryptoKey key) native;
+ Object _sign_1(algorithm, CryptoKey key, TypedData data) native;
@DomName('SubtleCrypto.verify')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation verify(Map algorithm, CryptoKey key, TypedData signature) {
+ Object verify(Map algorithm, CryptoKey key, TypedData signature, TypedData data) {
var algorithm_1 = convertDartToNative_Dictionary(algorithm);
- return _verify_1(algorithm_1, key, signature);
+ return _verify_1(algorithm_1, key, signature, data);
}
@JSName('verify')
@DomName('SubtleCrypto.verify')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation _verify_1(algorithm, CryptoKey key, TypedData signature) native;
+ Object _verify_1(algorithm, CryptoKey key, TypedData signature, TypedData data) 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
@@ -22335,6 +22364,22 @@
@JSName('createTBody')
TableSectionElement _nativeCreateTBody() native;
+ DocumentFragment createFragment(String html,
+ {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ if (Range.supportsCreateContextualFragment) {
+ return super.createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer);
+ }
+ // IE9 workaround which does not support innerHTML on Table elements.
+ var contextualHtml = '<table>$html</table>';
+ var table = new Element.html(contextualHtml, validator: validator,
+ treeSanitizer: treeSanitizer);
+ var fragment = new DocumentFragment();
+ fragment.nodes.addAll(table.nodes);
+
+ return fragment;
+ }
+
// To suppress missing implicit constructor warnings.
factory TableElement._() { throw new UnsupportedError("Not supported"); }
@@ -22425,6 +22470,21 @@
TableCellElement insertCell(int index) => _insertCell(index);
+ DocumentFragment createFragment(String html,
+ {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ if (Range.supportsCreateContextualFragment) {
+ return super.createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer);
+ }
+ // IE9 workaround which does not support innerHTML on Table elements.
+ var fragment = new DocumentFragment();
+ var section = new TableElement().createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer).nodes.single;
+ var row = section.nodes.single;
+ fragment.nodes.addAll(row.nodes);
+ return fragment;
+ }
+
// To suppress missing implicit constructor warnings.
factory TableRowElement._() { throw new UnsupportedError("Not supported"); }
@@ -22473,6 +22533,20 @@
TableRowElement insertRow(int index) => _insertRow(index);
+ DocumentFragment createFragment(String html,
+ {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ if (Range.supportsCreateContextualFragment) {
+ return super.createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer);
+ }
+ // IE9 workaround which does not support innerHTML on Table elements.
+ var fragment = new DocumentFragment();
+ var section = new TableElement().createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer).nodes.single;
+ fragment.nodes.addAll(section.nodes);
+ return fragment;
+ }
+
// To suppress missing implicit constructor warnings.
factory TableSectionElement._() { throw new UnsupportedError("Not supported"); }
@@ -23032,7 +23106,7 @@
@DomName('TextMetrics.width')
@DocsEditable()
- final num width;
+ final double width;
}
// 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
@@ -23340,11 +23414,11 @@
@DomName('TimeRanges.end')
@DocsEditable()
- num end(int index) native;
+ double end(int index) native;
@DomName('TimeRanges.start')
@DocsEditable()
- num start(int index) native;
+ double start(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
@@ -23429,7 +23503,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
- final num force;
+ final double force;
@JSName('webkitRadiusX')
@DomName('Touch.webkitRadiusX')
@@ -23453,7 +23527,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
- final num rotationAngle;
+ final double rotationAngle;
@DomName('Touch.clientX')
@@ -23712,7 +23786,7 @@
@DomName('TransitionEvent.elapsedTime')
@DocsEditable()
- final num elapsedTime;
+ final double elapsedTime;
@DomName('TransitionEvent.propertyName')
@DocsEditable()
@@ -24398,12 +24472,13 @@
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey, button, relatedTarget, axis);
} else {
+ // Chrome does an auto-convert to pixels.
+ deltaY = deltaY ~/ 120;
// Fallthrough for Dartium.
event._initMouseEvent(type, canBubble, cancelable, view, detail,
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey, button, relatedTarget);
- event._initWebKitWheelEvent(deltaX,
- deltaY ~/ 120, // Chrome does an auto-convert to pixels.
+ event._initWebKitWheelEvent(deltaX, deltaY,
view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey);
}
@@ -24426,6 +24501,23 @@
@DocsEditable()
static const int DOM_DELTA_PIXEL = 0x00;
+ @JSName('deltaX')
+ @DomName('WheelEvent.deltaX')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final double _deltaX;
+
+ @JSName('deltaY')
+ @DomName('WheelEvent.deltaY')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final double _deltaY;
+
+ @DomName('WheelEvent.deltaZ')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final double deltaZ;
+
@JSName('webkitDirectionInvertedFromDevice')
@DomName('WheelEvent.webkitDirectionInvertedFromDevice')
@DocsEditable()
@@ -24524,8 +24616,6 @@
return 0;
}
- num get _deltaY => JS('num', '#.deltaY', this);
- num get _deltaX => JS('num', '#.deltaX', this);
num get _wheelDelta => JS('num', '#.wheelDelta', this);
num get _wheelDeltaX => JS('num', '#.wheelDeltaX', this);
num get _detail => JS('num', '#.detail', this);
@@ -24604,7 +24694,7 @@
if (portStr == null) {
return null;
}
- var port = json.parse(portStr);
+ var port = JSON.decode(portStr);
return _deserialize(port);
}
@@ -24616,7 +24706,7 @@
void registerPort(String name, var port) {
var serialized = _serialize(port);
document.documentElement.attributes['dart-port:$name'] =
- json.stringify(serialized);
+ JSON.encode(serialized);
}
/**
@@ -24962,7 +25052,7 @@
@DocsEditable()
// http://www.quirksmode.org/blog/archives/2012/06/devicepixelrati.html
@Experimental() // non-standard
- final num devicePixelRatio;
+ final double devicePixelRatio;
@DomName('Window.event')
@DocsEditable()
@@ -25191,6 +25281,12 @@
@DocsEditable()
bool confirm(String message) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Object _createImageBitmap(canvas_OR_context_OR_image_OR_video, [int sx, int sy, int sw, int sh]) native;
+
@DomName('Window.find')
@DocsEditable()
@Experimental() // non-standard
@@ -25798,6 +25894,18 @@
@DocsEditable()
+@DomName('WorkerConsole')
+@Experimental() // untriaged
+class WorkerConsole extends ConsoleBase native "WorkerConsole" {
+ // To suppress missing implicit constructor warnings.
+ factory WorkerConsole._() { throw new UnsupportedError("Not supported"); }
+}
+// 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('WorkerCrypto')
@Experimental() // untriaged
class WorkerCrypto extends Interceptor native "WorkerCrypto" {
@@ -25836,6 +25944,11 @@
@Experimental() // untriaged
static const int TEMPORARY = 0;
+ @DomName('WorkerGlobalScope.console')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final WorkerConsole console;
+
@DomName('WorkerGlobalScope.crypto')
@DocsEditable()
@Experimental() // untriaged
@@ -25880,11 +25993,6 @@
@Experimental() // untriaged
void close() native;
- @DomName('WorkerGlobalScope.importScripts')
- @DocsEditable()
- @Experimental() // untriaged
- void importScripts() native;
-
@DomName('WorkerGlobalScope.openDatabase')
@DocsEditable()
@Experimental() // untriaged
@@ -26001,7 +26109,7 @@
@DomName('WorkerPerformance.now')
@DocsEditable()
@Experimental() // untriaged
- num now() native;
+ double now() 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
@@ -26125,7 +26233,7 @@
@DomName('XPathResult.numberValue')
@DocsEditable()
- final num numberValue;
+ final double numberValue;
@DomName('XPathResult.resultType')
@DocsEditable()
@@ -26157,6 +26265,78 @@
@DocsEditable()
+@DomName('XMLHttpRequestEventTarget')
+@Experimental() // untriaged
+class XmlHttpRequestEventTarget extends EventTarget native "XMLHttpRequestEventTarget" {
+ // To suppress missing implicit constructor warnings.
+ factory XmlHttpRequestEventTarget._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('XMLHttpRequestEventTarget.abortEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> abortEvent = const EventStreamProvider<ProgressEvent>('abort');
+
+ @DomName('XMLHttpRequestEventTarget.errorEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> errorEvent = const EventStreamProvider<ProgressEvent>('error');
+
+ @DomName('XMLHttpRequestEventTarget.loadEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> loadEvent = const EventStreamProvider<ProgressEvent>('load');
+
+ @DomName('XMLHttpRequestEventTarget.loadendEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> loadEndEvent = const EventStreamProvider<ProgressEvent>('loadend');
+
+ @DomName('XMLHttpRequestEventTarget.loadstartEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> loadStartEvent = const EventStreamProvider<ProgressEvent>('loadstart');
+
+ @DomName('XMLHttpRequestEventTarget.progressEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
+
+ @DomName('XMLHttpRequestEventTarget.onabort')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onerror')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onError => errorEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onload')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onLoad => loadEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onloadend')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onloadstart')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onLoadStart => loadStartEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onprogress')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
+}
+// 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('XMLSerializer')
// http://domparsing.spec.whatwg.org/#the-xmlserializer-interface
@deprecated // stable
@@ -26243,10 +26423,16 @@
@DocsEditable()
final bool isId;
+ // Use implementation from Node.
+ // final String _localName;
+
@DomName('Attr.name')
@DocsEditable()
final String name;
+ // Use implementation from Node.
+ // final String _namespaceUri;
+
@DomName('Attr.ownerElement')
@DocsEditable()
@deprecated // deprecated
@@ -26391,27 +26577,27 @@
@DomName('ClientRect.bottom')
@DocsEditable()
- final num bottom;
+ final double bottom;
@DomName('ClientRect.height')
@DocsEditable()
- final num height;
+ final double height;
@DomName('ClientRect.left')
@DocsEditable()
- final num left;
+ final double left;
@DomName('ClientRect.right')
@DocsEditable()
- final num right;
+ final double right;
@DomName('ClientRect.top')
@DocsEditable()
- final num top;
+ final double top;
@DomName('ClientRect.width')
@DocsEditable()
- final num width;
+ final double width;
}
// 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
@@ -27338,7 +27524,11 @@
@DomName('WorkerNavigator')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#workernavigator
@Experimental()
-abstract class _WorkerNavigator extends Interceptor native "WorkerNavigator" {
+abstract class _WorkerNavigator extends Interceptor implements NavigatorOnLine, NavigatorID native "WorkerNavigator" {
+
+ // From NavigatorID
+
+ // From NavigatorOnLine
}
// 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
@@ -27433,15 +27623,15 @@
}
String operator [](String key) {
- return _element.$dom_getAttribute(key);
+ return _element._getAttribute(key);
}
void operator []=(String key, String value) {
- _element.$dom_setAttribute(key, value);
+ _element._setAttribute(key, value);
}
String remove(String key) {
- String value = _element.$dom_getAttribute(key);
+ String value = _element._getAttribute(key);
_element._removeAttribute(key);
return value;
}
@@ -27470,11 +27660,11 @@
}
String operator [](String key) {
- return _element.$dom_getAttributeNS(_namespace, key);
+ return _element._getAttributeNS(_namespace, key);
}
void operator []=(String key, String value) {
- _element.$dom_setAttributeNS(_namespace, key, value);
+ _element._setAttributeNS(_namespace, key, value);
}
String remove(String key) {
@@ -27624,7 +27814,7 @@
* * [DOM Window](https://developer.mozilla.org/en-US/docs/DOM/window) from MDN.
* * [Window](http://www.w3.org/TR/Window/) from the W3C.
*/
-abstract class WindowBase {
+abstract class WindowBase implements EventTarget {
// Fields.
/**
@@ -29194,7 +29384,7 @@
var source = '$target-result';
var result = null;
window.on[source].first.then((Event e) {
- result = json.parse(_getPortSyncEventData(e));
+ result = JSON.decode(_getPortSyncEventData(e));
});
_dispatchEvent(target, [source, message]);
return result;
@@ -29278,7 +29468,7 @@
_callback = callback;
if (_portSubscription == null) {
_portSubscription = window.on[_listenerName].listen((Event e) {
- var data = json.parse(_getPortSyncEventData(e));
+ var data = JSON.decode(_getPortSyncEventData(e));
var replyTo = data[0];
var message = _deserialize(data[1]);
var result = _callback(message);
@@ -29309,7 +29499,7 @@
void _dispatchEvent(String receiver, var message) {
var event = new CustomEvent(receiver, canBubble: false, cancelable:false,
- detail: json.stringify(message));
+ detail: JSON.encode(message));
window.dispatchEvent(event);
}
@@ -30750,6 +30940,21 @@
}
/**
+ * Allow inline styles on elements.
+ *
+ * If [tagName] is not specified then this allows inline styles on all
+ * elements. Otherwise tagName limits the styles to the specified elements.
+ */
+ void allowInlineStyles({String tagName}) {
+ if (tagName == null) {
+ tagName = '*';
+ } else {
+ tagName = tagName.toUpperCase();
+ }
+ add(new _SimpleNodeValidator(null, allowedAttributes: ['$tagName::style']));
+ }
+
+ /**
* Allow common safe HTML5 elements and attributes.
*
* This list is based off of the Caja whitelists at:
@@ -32333,6 +32538,8 @@
Element element = node;
var attrs = element.attributes;
if (!validator.allowsElement(element)) {
+ window.console.warn(
+ 'Removing disallowed element <${element.tagName}>');
element.remove();
break;
}
@@ -32340,6 +32547,8 @@
var isAttr = attrs['is'];
if (isAttr != null) {
if (!validator.allowsAttribute(element, 'is', isAttr)) {
+ window.console.warn('Removing disallowed type extension '
+ '<${element.tagName} is="$isAttr">');
element.remove();
break;
}
@@ -32352,6 +32561,8 @@
var name = keys[i];
if (!validator.allowsAttribute(element, name.toLowerCase(),
attrs[name])) {
+ window.console.warn('Removing disallowed attribute '
+ '<${element.tagName} $name="${attrs[name]}">');
attrs.remove(name);
}
}
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index bd228d2..bc54884 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -1,8 +1,27 @@
-/// The Dart HTML library.
-///
-/// For examples, see
-/// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
-/// on Github.
+/**
+ * HTML elements and other resources for web-based applications that need to
+ * interact with the browser and the DOM (Document Object Model).
+ *
+ * This library includes DOM element types, CSS styling, local storage,
+ * media, speech, events, and more.
+ * To get started,
+ * check out the [Element] class, the base class for many of the HTML
+ * DOM types.
+ *
+ * ## Other resources
+ *
+ * * If you've never written a web app before, try our
+ * tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials).
+ *
+ * * To see some web-based Dart apps in action and to play with the code,
+ * download
+ * [Dart Editor](http://www.dartlang.org/#get-started)
+ * and run its built-in examples.
+ *
+ * * For even more examples, see
+ * [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
+ * on Github.
+ */
library dart.dom.html;
import 'dart:async';
@@ -11,7 +30,7 @@
import 'dart:html_common';
import 'dart:indexed_db';
import 'dart:isolate';
-import 'dart:json' as json;
+import "dart:convert";
import 'dart:math';
import 'dart:mirrors';
import 'dart:nativewrappers';
@@ -84,7 +103,7 @@
_callPortSync(num id, var message) {
if (!_callPortInitialized) {
window.on['js-result'].listen((event) {
- _callPortLastResult = json.parse(_getPortSyncEventData(event));
+ _callPortLastResult = JSON.decode(_getPortSyncEventData(event));
});
_callPortInitialized = true;
}
@@ -351,7 +370,7 @@
@DomName('WebKitAnimationEvent.elapsedTime')
@DocsEditable()
- num get elapsedTime native "WebKitAnimationEvent_elapsedTime_Getter";
+ double get elapsedTime native "WebKitAnimationEvent_elapsedTime_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -362,7 +381,7 @@
@DocsEditable()
-@DomName('DOMApplicationCache')
+@DomName('ApplicationCache')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@@ -373,122 +392,122 @@
// To suppress missing implicit constructor warnings.
factory ApplicationCache._() { throw new UnsupportedError("Not supported"); }
- @DomName('DOMApplicationCache.cachedEvent')
+ @DomName('ApplicationCache.cachedEvent')
@DocsEditable()
static const EventStreamProvider<Event> cachedEvent = const EventStreamProvider<Event>('cached');
- @DomName('DOMApplicationCache.checkingEvent')
+ @DomName('ApplicationCache.checkingEvent')
@DocsEditable()
static const EventStreamProvider<Event> checkingEvent = const EventStreamProvider<Event>('checking');
- @DomName('DOMApplicationCache.downloadingEvent')
+ @DomName('ApplicationCache.downloadingEvent')
@DocsEditable()
static const EventStreamProvider<Event> downloadingEvent = const EventStreamProvider<Event>('downloading');
- @DomName('DOMApplicationCache.errorEvent')
+ @DomName('ApplicationCache.errorEvent')
@DocsEditable()
static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
- @DomName('DOMApplicationCache.noupdateEvent')
+ @DomName('ApplicationCache.noupdateEvent')
@DocsEditable()
static const EventStreamProvider<Event> noUpdateEvent = const EventStreamProvider<Event>('noupdate');
- @DomName('DOMApplicationCache.obsoleteEvent')
+ @DomName('ApplicationCache.obsoleteEvent')
@DocsEditable()
static const EventStreamProvider<Event> obsoleteEvent = const EventStreamProvider<Event>('obsolete');
- @DomName('DOMApplicationCache.progressEvent')
+ @DomName('ApplicationCache.progressEvent')
@DocsEditable()
static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
- @DomName('DOMApplicationCache.updatereadyEvent')
+ @DomName('ApplicationCache.updatereadyEvent')
@DocsEditable()
static const EventStreamProvider<Event> updateReadyEvent = const EventStreamProvider<Event>('updateready');
/// Checks if this type is supported on the current platform.
static bool get supported => true;
- @DomName('DOMApplicationCache.CHECKING')
+ @DomName('ApplicationCache.CHECKING')
@DocsEditable()
static const int CHECKING = 2;
- @DomName('DOMApplicationCache.DOWNLOADING')
+ @DomName('ApplicationCache.DOWNLOADING')
@DocsEditable()
static const int DOWNLOADING = 3;
- @DomName('DOMApplicationCache.IDLE')
+ @DomName('ApplicationCache.IDLE')
@DocsEditable()
static const int IDLE = 1;
- @DomName('DOMApplicationCache.OBSOLETE')
+ @DomName('ApplicationCache.OBSOLETE')
@DocsEditable()
static const int OBSOLETE = 5;
- @DomName('DOMApplicationCache.UNCACHED')
+ @DomName('ApplicationCache.UNCACHED')
@DocsEditable()
static const int UNCACHED = 0;
- @DomName('DOMApplicationCache.UPDATEREADY')
+ @DomName('ApplicationCache.UPDATEREADY')
@DocsEditable()
static const int UPDATEREADY = 4;
- @DomName('DOMApplicationCache.status')
+ @DomName('ApplicationCache.status')
@DocsEditable()
- int get status native "DOMApplicationCache_status_Getter";
+ int get status native "ApplicationCache_status_Getter";
- @DomName('DOMApplicationCache.abort')
+ @DomName('ApplicationCache.abort')
@DocsEditable()
- void abort() native "DOMApplicationCache_abort_Callback";
+ void abort() native "ApplicationCache_abort_Callback";
- @DomName('DOMApplicationCache.swapCache')
+ @DomName('ApplicationCache.swapCache')
@DocsEditable()
- void swapCache() native "DOMApplicationCache_swapCache_Callback";
+ void swapCache() native "ApplicationCache_swapCache_Callback";
- @DomName('DOMApplicationCache.update')
+ @DomName('ApplicationCache.update')
@DocsEditable()
- void update() native "DOMApplicationCache_update_Callback";
+ void update() native "ApplicationCache_update_Callback";
- @DomName('DOMApplicationCache.addEventListener')
+ @DomName('ApplicationCache.addEventListener')
@DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "DOMApplicationCache_addEventListener_Callback";
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "ApplicationCache_addEventListener_Callback";
- @DomName('DOMApplicationCache.dispatchEvent')
+ @DomName('ApplicationCache.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event event) native "DOMApplicationCache_dispatchEvent_Callback";
+ bool dispatchEvent(Event event) native "ApplicationCache_dispatchEvent_Callback";
- @DomName('DOMApplicationCache.removeEventListener')
+ @DomName('ApplicationCache.removeEventListener')
@DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "DOMApplicationCache_removeEventListener_Callback";
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "ApplicationCache_removeEventListener_Callback";
- @DomName('DOMApplicationCache.oncached')
+ @DomName('ApplicationCache.oncached')
@DocsEditable()
Stream<Event> get onCached => cachedEvent.forTarget(this);
- @DomName('DOMApplicationCache.onchecking')
+ @DomName('ApplicationCache.onchecking')
@DocsEditable()
Stream<Event> get onChecking => checkingEvent.forTarget(this);
- @DomName('DOMApplicationCache.ondownloading')
+ @DomName('ApplicationCache.ondownloading')
@DocsEditable()
Stream<Event> get onDownloading => downloadingEvent.forTarget(this);
- @DomName('DOMApplicationCache.onerror')
+ @DomName('ApplicationCache.onerror')
@DocsEditable()
Stream<Event> get onError => errorEvent.forTarget(this);
- @DomName('DOMApplicationCache.onnoupdate')
+ @DomName('ApplicationCache.onnoupdate')
@DocsEditable()
Stream<Event> get onNoUpdate => noUpdateEvent.forTarget(this);
- @DomName('DOMApplicationCache.onobsolete')
+ @DomName('ApplicationCache.onobsolete')
@DocsEditable()
Stream<Event> get onObsolete => obsoleteEvent.forTarget(this);
- @DomName('DOMApplicationCache.onprogress')
+ @DomName('ApplicationCache.onprogress')
@DocsEditable()
Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
- @DomName('DOMApplicationCache.onupdateready')
+ @DomName('ApplicationCache.onupdateready')
@DocsEditable()
Stream<Event> get onUpdateReady => updateReadyEvent.forTarget(this);
@@ -1473,7 +1492,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
- num get backingStorePixelRatio native "CanvasRenderingContext2D_webkitBackingStorePixelRatio_Getter";
+ double get backingStorePixelRatio native "CanvasRenderingContext2D_webkitBackingStorePixelRatio_Getter";
@DomName('CanvasRenderingContext2D.arc')
@DocsEditable()
@@ -2204,106 +2223,132 @@
@DocsEditable()
@DomName('Console')
-class Console extends NativeFieldWrapperClass1 {
+class Console extends ConsoleBase {
+ // To suppress missing implicit constructor warnings.
+ factory Console._() { throw new UnsupportedError("Not supported"); }
@DomName('Console.memory')
@DocsEditable()
@Experimental()
MemoryInfo get memory native "Console_memory_Getter";
- @DomName('Console.assertCondition')
- @DocsEditable()
- @Experimental()
- void assertCondition(bool condition, Object arg) native "Console_assertCondition_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.
- @DomName('Console.clear')
- @DocsEditable()
- @Experimental()
- void clear(Object arg) native "Console_clear_Callback";
+// WARNING: Do not edit - generated code.
- @DomName('Console.count')
- @DocsEditable()
- @Experimental()
- void count(Object arg) native "Console_count_Callback";
- @DomName('Console.debug')
- @DocsEditable()
- @deprecated // deprecated
- void debug(Object arg) native "Console_debug_Callback";
+@DocsEditable()
+@DomName('ConsoleBase')
+@Experimental() // untriaged
+class ConsoleBase extends NativeFieldWrapperClass1 {
- @DomName('Console.dir')
+ @DomName('ConsoleBase.assertCondition')
@DocsEditable()
- void dir(Object arg) native "Console_dir_Callback";
+ @Experimental() // untriaged
+ void assertCondition(bool condition, Object arg) native "ConsoleBase_assertCondition_Callback";
- @DomName('Console.dirxml')
+ @DomName('ConsoleBase.clear')
@DocsEditable()
- @Experimental()
- void dirxml(Object arg) native "Console_dirxml_Callback";
+ @Experimental() // untriaged
+ void clear(Object arg) native "ConsoleBase_clear_Callback";
- @DomName('Console.error')
+ @DomName('ConsoleBase.count')
@DocsEditable()
- void error(Object arg) native "Console_error_Callback";
+ @Experimental() // untriaged
+ void count(Object arg) native "ConsoleBase_count_Callback";
- @DomName('Console.group')
+ @DomName('ConsoleBase.debug')
@DocsEditable()
- void group(Object arg) native "Console_group_Callback";
+ @Experimental() // untriaged
+ void debug(Object arg) native "ConsoleBase_debug_Callback";
- @DomName('Console.groupCollapsed')
+ @DomName('ConsoleBase.dir')
@DocsEditable()
- void groupCollapsed(Object arg) native "Console_groupCollapsed_Callback";
+ @Experimental() // untriaged
+ void dir(Object arg) native "ConsoleBase_dir_Callback";
- @DomName('Console.groupEnd')
+ @DomName('ConsoleBase.dirxml')
@DocsEditable()
- void groupEnd() native "Console_groupEnd_Callback";
+ @Experimental() // untriaged
+ void dirxml(Object arg) native "ConsoleBase_dirxml_Callback";
- @DomName('Console.info')
+ @DomName('ConsoleBase.error')
@DocsEditable()
- void info(Object arg) native "Console_info_Callback";
+ @Experimental() // untriaged
+ void error(Object arg) native "ConsoleBase_error_Callback";
- @DomName('Console.log')
+ @DomName('ConsoleBase.group')
@DocsEditable()
- void log(Object arg) native "Console_log_Callback";
+ @Experimental() // untriaged
+ void group(Object arg) native "ConsoleBase_group_Callback";
- @DomName('Console.markTimeline')
+ @DomName('ConsoleBase.groupCollapsed')
@DocsEditable()
- @Experimental()
- void markTimeline(Object arg) native "Console_markTimeline_Callback";
+ @Experimental() // untriaged
+ void groupCollapsed(Object arg) native "ConsoleBase_groupCollapsed_Callback";
- @DomName('Console.profile')
+ @DomName('ConsoleBase.groupEnd')
@DocsEditable()
- @Experimental()
- void profile(String title) native "Console_profile_Callback";
+ @Experimental() // untriaged
+ void groupEnd() native "ConsoleBase_groupEnd_Callback";
- @DomName('Console.profileEnd')
+ @DomName('ConsoleBase.info')
@DocsEditable()
- @Experimental()
- void profileEnd(String title) native "Console_profileEnd_Callback";
+ @Experimental() // untriaged
+ void info(Object arg) native "ConsoleBase_info_Callback";
- @DomName('Console.table')
+ @DomName('ConsoleBase.log')
@DocsEditable()
- @Experimental()
- void table(Object arg) native "Console_table_Callback";
+ @Experimental() // untriaged
+ void log(Object arg) native "ConsoleBase_log_Callback";
- @DomName('Console.time')
+ @DomName('ConsoleBase.markTimeline')
@DocsEditable()
- void time(String title) native "Console_time_Callback";
+ @Experimental() // untriaged
+ void markTimeline(Object arg) native "ConsoleBase_markTimeline_Callback";
- @DomName('Console.timeEnd')
+ @DomName('ConsoleBase.profile')
@DocsEditable()
- void timeEnd(String title) native "Console_timeEnd_Callback";
+ @Experimental() // untriaged
+ void profile(String title) native "ConsoleBase_profile_Callback";
- @DomName('Console.timeStamp')
+ @DomName('ConsoleBase.profileEnd')
@DocsEditable()
- @Experimental()
- void timeStamp(Object arg) native "Console_timeStamp_Callback";
+ @Experimental() // untriaged
+ void profileEnd(String title) native "ConsoleBase_profileEnd_Callback";
- @DomName('Console.trace')
+ @DomName('ConsoleBase.table')
@DocsEditable()
- void trace(Object arg) native "Console_trace_Callback";
+ @Experimental() // untriaged
+ void table(Object arg) native "ConsoleBase_table_Callback";
- @DomName('Console.warn')
+ @DomName('ConsoleBase.time')
@DocsEditable()
- void warn(Object arg) native "Console_warn_Callback";
+ @Experimental() // untriaged
+ void time(String title) native "ConsoleBase_time_Callback";
+
+ @DomName('ConsoleBase.timeEnd')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void timeEnd(String title) native "ConsoleBase_timeEnd_Callback";
+
+ @DomName('ConsoleBase.timeStamp')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void timeStamp(Object arg) native "ConsoleBase_timeStamp_Callback";
+
+ @DomName('ConsoleBase.trace')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void trace(Object arg) native "ConsoleBase_trace_Callback";
+
+ @DomName('ConsoleBase.warn')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void warn(Object arg) native "ConsoleBase_warn_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2363,31 +2408,31 @@
@DomName('Coordinates.accuracy')
@DocsEditable()
- num get accuracy native "Coordinates_accuracy_Getter";
+ double get accuracy native "Coordinates_accuracy_Getter";
@DomName('Coordinates.altitude')
@DocsEditable()
- num get altitude native "Coordinates_altitude_Getter";
+ double get altitude native "Coordinates_altitude_Getter";
@DomName('Coordinates.altitudeAccuracy')
@DocsEditable()
- num get altitudeAccuracy native "Coordinates_altitudeAccuracy_Getter";
+ double get altitudeAccuracy native "Coordinates_altitudeAccuracy_Getter";
@DomName('Coordinates.heading')
@DocsEditable()
- num get heading native "Coordinates_heading_Getter";
+ double get heading native "Coordinates_heading_Getter";
@DomName('Coordinates.latitude')
@DocsEditable()
- num get latitude native "Coordinates_latitude_Getter";
+ double get latitude native "Coordinates_latitude_Getter";
@DomName('Coordinates.longitude')
@DocsEditable()
- num get longitude native "Coordinates_longitude_Getter";
+ double get longitude native "Coordinates_longitude_Getter";
@DomName('Coordinates.speed')
@DocsEditable()
- num get speed native "Coordinates_speed_Getter";
+ double get speed native "Coordinates_speed_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2459,44 +2504,6 @@
@DocsEditable()
-@DomName('CryptoOperation')
-@Experimental() // untriaged
-class CryptoOperation extends NativeFieldWrapperClass1 {
-
- @DomName('CryptoOperation.algorithm')
- @DocsEditable()
- @Experimental() // untriaged
- Algorithm get algorithm native "CryptoOperation_algorithm_Getter";
-
- @DomName('CryptoOperation.abort')
- @DocsEditable()
- @Experimental() // untriaged
- Object abort() native "CryptoOperation_abort_Callback";
-
- @DomName('CryptoOperation.finish')
- @DocsEditable()
- @Experimental() // untriaged
- Object finish() native "CryptoOperation_finish_Callback";
-
- @DomName('CryptoOperation.processByteBuffer')
- @DocsEditable()
- @Experimental() // untriaged
- CryptoOperation processByteBuffer(ByteBuffer data) native "CryptoOperation_processByteBuffer_Callback";
-
- @DomName('CryptoOperation.processTypedData')
- @DocsEditable()
- @Experimental() // untriaged
- CryptoOperation processTypedData(TypedData data) native "CryptoOperation_processTypedData_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('CSS')
// http://www.w3.org/TR/css3-conditional/#the-css-interface
@Experimental() // None
@@ -2737,71 +2744,76 @@
@DocsEditable()
-@DomName('WebKitCSSKeyframeRule')
-@SupportedBrowser(SupportedBrowser.CHROME)
-@SupportedBrowser(SupportedBrowser.SAFARI)
-@Experimental()
-// http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface
+@DomName('CSSKeyframeRule')
+@Experimental() // untriaged
class CssKeyframeRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssKeyframeRule._() { throw new UnsupportedError("Not supported"); }
- @DomName('WebKitCSSKeyframeRule.keyText')
+ @DomName('CSSKeyframeRule.keyText')
@DocsEditable()
- String get keyText native "WebKitCSSKeyframeRule_keyText_Getter";
+ @Experimental() // untriaged
+ String get keyText native "CSSKeyframeRule_keyText_Getter";
- @DomName('WebKitCSSKeyframeRule.keyText')
+ @DomName('CSSKeyframeRule.keyText')
@DocsEditable()
- void set keyText(String value) native "WebKitCSSKeyframeRule_keyText_Setter";
+ @Experimental() // untriaged
+ void set keyText(String value) native "CSSKeyframeRule_keyText_Setter";
- @DomName('WebKitCSSKeyframeRule.style')
+ @DomName('CSSKeyframeRule.style')
@DocsEditable()
- CssStyleDeclaration get style native "WebKitCSSKeyframeRule_style_Getter";
+ @Experimental() // untriaged
+ CssStyleDeclaration get style native "CSSKeyframeRule_style_Getter";
}
// 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('WebKitCSSKeyframesRule')
-@SupportedBrowser(SupportedBrowser.CHROME)
-@SupportedBrowser(SupportedBrowser.SAFARI)
-@Experimental()
-// http://www.w3.org/TR/css3-animations/#csskeyframesrule
+@DomName('CSSKeyframesRule')
+@Experimental() // untriaged
class CssKeyframesRule extends CssRule {
// To suppress missing implicit constructor warnings.
factory CssKeyframesRule._() { throw new UnsupportedError("Not supported"); }
- @DomName('WebKitCSSKeyframesRule.cssRules')
+ @DomName('CSSKeyframesRule.cssRules')
@DocsEditable()
- List<CssRule> get cssRules native "WebKitCSSKeyframesRule_cssRules_Getter";
+ @Experimental() // untriaged
+ List<CssRule> get cssRules native "CSSKeyframesRule_cssRules_Getter";
- @DomName('WebKitCSSKeyframesRule.name')
+ @DomName('CSSKeyframesRule.name')
@DocsEditable()
- String get name native "WebKitCSSKeyframesRule_name_Getter";
+ @Experimental() // untriaged
+ String get name native "CSSKeyframesRule_name_Getter";
- @DomName('WebKitCSSKeyframesRule.name')
+ @DomName('CSSKeyframesRule.name')
@DocsEditable()
- void set name(String value) native "WebKitCSSKeyframesRule_name_Setter";
+ @Experimental() // untriaged
+ void set name(String value) native "CSSKeyframesRule_name_Setter";
- @DomName('WebKitCSSKeyframesRule.__getter__')
+ @DomName('CSSKeyframesRule.__getter__')
@DocsEditable()
- CssKeyframeRule __getter__(int index) native "WebKitCSSKeyframesRule___getter___Callback";
+ @Experimental() // untriaged
+ CssKeyframeRule __getter__(int index) native "CSSKeyframesRule___getter___Callback";
- @DomName('WebKitCSSKeyframesRule.deleteRule')
+ @DomName('CSSKeyframesRule.deleteRule')
@DocsEditable()
- void deleteRule(String key) native "WebKitCSSKeyframesRule_deleteRule_Callback";
+ @Experimental() // untriaged
+ void deleteRule(String key) native "CSSKeyframesRule_deleteRule_Callback";
- @DomName('WebKitCSSKeyframesRule.findRule')
+ @DomName('CSSKeyframesRule.findRule')
@DocsEditable()
- CssKeyframeRule findRule(String key) native "WebKitCSSKeyframesRule_findRule_Callback";
+ @Experimental() // untriaged
+ CssKeyframeRule findRule(String key) native "CSSKeyframesRule_findRule_Callback";
- @DomName('WebKitCSSKeyframesRule.insertRule')
+ @DomName('CSSKeyframesRule.insertRule')
@DocsEditable()
- void appendRule(String rule) native "WebKitCSSKeyframesRule_insertRule_Callback";
-
+ @Experimental() // untriaged
+ void insertRule(String rule) native "CSSKeyframesRule_insertRule_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -3175,6 +3187,16 @@
@DocsEditable()
static const int IMPORT_RULE = 3;
+ @DomName('CSSRule.KEYFRAMES_RULE')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int KEYFRAMES_RULE = 7;
+
+ @DomName('CSSRule.KEYFRAME_RULE')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int KEYFRAME_RULE = 8;
+
@DomName('CSSRule.MEDIA_RULE')
@DocsEditable()
static const int MEDIA_RULE = 4;
@@ -7027,37 +7049,41 @@
@DocsEditable()
int get length native "DataTransferItemList_length_Getter";
- void add(data_OR_file, [String type]) {
+ @DomName('DataTransferItemList.__getter__')
+ @DocsEditable()
+ @Experimental() // untriaged
+ DataTransferItem __getter__(int index) native "DataTransferItemList___getter___Callback";
+
+ DataTransferItem add(data_OR_file, [String type]) {
if ((data_OR_file is File || data_OR_file == null) && type == null) {
- _add_1(data_OR_file);
- return;
+ return _add_1(data_OR_file);
}
if ((type is String || type == null) && (data_OR_file is String || data_OR_file == null)) {
- _add_2(data_OR_file, type);
- return;
+ return _add_2(data_OR_file, type);
}
throw new ArgumentError("Incorrect number or type of arguments");
}
- void _add_1(data_OR_file) native "DataTransferItemList__add_1_Callback";
+ DataTransferItem _add_1(data_OR_file) native "DataTransferItemList__add_1_Callback";
- void _add_2(data_OR_file, type) native "DataTransferItemList__add_2_Callback";
+ DataTransferItem _add_2(data_OR_file, type) native "DataTransferItemList__add_2_Callback";
@DomName('DataTransferItemList.addData')
@DocsEditable()
- void addData(String data, String type) native "DataTransferItemList_addData_Callback";
+ DataTransferItem addData(String data, String type) native "DataTransferItemList_addData_Callback";
@DomName('DataTransferItemList.addFile')
@DocsEditable()
- void addFile(File file) native "DataTransferItemList_addFile_Callback";
+ DataTransferItem addFile(File file) native "DataTransferItemList_addFile_Callback";
@DomName('DataTransferItemList.clear')
@DocsEditable()
void clear() native "DataTransferItemList_clear_Callback";
- @DomName('DataTransferItemList.item')
+ @DomName('DataTransferItemList.remove')
@DocsEditable()
- DataTransferItem item(int index) native "DataTransferItemList_item_Callback";
+ @Experimental() // untriaged
+ void remove(int index) native "DataTransferItemList_remove_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -7148,15 +7174,15 @@
@DomName('DeviceAcceleration.x')
@DocsEditable()
- num get x native "DeviceAcceleration_x_Getter";
+ double get x native "DeviceAcceleration_x_Getter";
@DomName('DeviceAcceleration.y')
@DocsEditable()
- num get y native "DeviceAcceleration_y_Getter";
+ double get y native "DeviceAcceleration_y_Getter";
@DomName('DeviceAcceleration.z')
@DocsEditable()
- num get z native "DeviceAcceleration_z_Getter";
+ double get z native "DeviceAcceleration_z_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -7184,7 +7210,7 @@
@DomName('DeviceMotionEvent.interval')
@DocsEditable()
- num get interval native "DeviceMotionEvent_interval_Getter";
+ double get interval native "DeviceMotionEvent_interval_Getter";
@DomName('DeviceMotionEvent.rotationRate')
@DocsEditable()
@@ -7218,15 +7244,15 @@
@DomName('DeviceOrientationEvent.alpha')
@DocsEditable()
- num get alpha native "DeviceOrientationEvent_alpha_Getter";
+ double get alpha native "DeviceOrientationEvent_alpha_Getter";
@DomName('DeviceOrientationEvent.beta')
@DocsEditable()
- num get beta native "DeviceOrientationEvent_beta_Getter";
+ double get beta native "DeviceOrientationEvent_beta_Getter";
@DomName('DeviceOrientationEvent.gamma')
@DocsEditable()
- num get gamma native "DeviceOrientationEvent_gamma_Getter";
+ double get gamma native "DeviceOrientationEvent_gamma_Getter";
@DomName('DeviceOrientationEvent.initDeviceOrientationEvent')
@DocsEditable()
@@ -7248,15 +7274,15 @@
@DomName('DeviceRotationRate.alpha')
@DocsEditable()
- num get alpha native "DeviceRotationRate_alpha_Getter";
+ double get alpha native "DeviceRotationRate_alpha_Getter";
@DomName('DeviceRotationRate.beta')
@DocsEditable()
- num get beta native "DeviceRotationRate_beta_Getter";
+ double get beta native "DeviceRotationRate_beta_Getter";
@DomName('DeviceRotationRate.gamma')
@DocsEditable()
- num get gamma native "DeviceRotationRate_gamma_Getter";
+ double get gamma native "DeviceRotationRate_gamma_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -7734,7 +7760,7 @@
@DomName('Document.createRange')
@DocsEditable()
- Range $dom_createRange() native "Document_createRange_Callback";
+ Range createRange() native "Document_createRange_Callback";
@DomName('Document.createTextNode')
@DocsEditable()
@@ -10085,7 +10111,7 @@
}
var fragment;
if (Range.supportsCreateContextualFragment) {
- var range = _parseDocument.$dom_createRange();
+ var range = _parseDocument.createRange();
range.selectNodeContents(contextElement);
fragment = range.createContextualFragment(html);
} else {
@@ -10460,6 +10486,16 @@
@DocsEditable()
void set id(String value) native "Element_id_Setter";
+ @DomName('Element.localName')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get _localName native "Element_localName_Getter";
+
+ @DomName('Element.namespaceURI')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get _namespaceUri native "Element_namespaceURI_Getter";
+
@DomName('Element.offsetHeight')
@DocsEditable()
int get offsetHeight native "Element_offsetHeight_Getter";
@@ -10553,11 +10589,11 @@
@DomName('Element.getAttribute')
@DocsEditable()
- String $dom_getAttribute(String name) native "Element_getAttribute_Callback";
+ String _getAttribute(String name) native "Element_getAttribute_Callback";
@DomName('Element.getAttributeNS')
@DocsEditable()
- String $dom_getAttributeNS(String namespaceURI, String localName) native "Element_getAttributeNS_Callback";
+ String _getAttributeNS(String namespaceURI, String localName) native "Element_getAttributeNS_Callback";
@DomName('Element.getBoundingClientRect')
@DocsEditable()
@@ -10657,11 +10693,11 @@
@DomName('Element.setAttribute')
@DocsEditable()
- void $dom_setAttribute(String name, String value) native "Element_setAttribute_Callback";
+ void _setAttribute(String name, String value) native "Element_setAttribute_Callback";
@DomName('Element.setAttributeNS')
@DocsEditable()
- void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String value) native "Element_setAttributeNS_Callback";
+ void _setAttributeNS(String namespaceURI, String qualifiedName, String value) native "Element_setAttributeNS_Callback";
@DomName('Element.webkitGetRegionFlowRanges')
@DocsEditable()
@@ -11814,7 +11850,9 @@
@DomName('FileError')
// http://dev.w3.org/2009/dap/file-system/pub/FileSystem/
@Experimental()
-class FileError extends NativeFieldWrapperClass1 {
+class FileError extends DomError {
+ // To suppress missing implicit constructor warnings.
+ factory FileError._() { throw new UnsupportedError("Not supported"); }
@DomName('FileError.ABORT_ERR')
@DocsEditable()
@@ -12867,6 +12905,31 @@
@DocsEditable()
+@DomName('HmacKeyParams')
+@Experimental() // untriaged
+class HmacKeyParams extends Algorithm {
+ // To suppress missing implicit constructor warnings.
+ factory HmacKeyParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('HmacKeyParams.hash')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Algorithm get hash native "HmacKeyParams_hash_Getter";
+
+ @DomName('HmacKeyParams.length')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int get length native "HmacKeyParams_length_Getter";
+
+}
+// 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('HmacParams')
@Experimental() // untriaged
class HmacParams extends Algorithm {
@@ -13446,7 +13509,7 @@
* * [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest)
*/
@DomName('XMLHttpRequest')
-class HttpRequest extends EventTarget {
+class HttpRequest extends XmlHttpRequestEventTarget {
/**
* Creates a URL get request for the specified [url].
@@ -13636,30 +13699,6 @@
// To suppress missing implicit constructor warnings.
factory HttpRequest._() { throw new UnsupportedError("Not supported"); }
- @DomName('XMLHttpRequest.abortEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> abortEvent = const EventStreamProvider<ProgressEvent>('abort');
-
- @DomName('XMLHttpRequest.errorEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> errorEvent = const EventStreamProvider<ProgressEvent>('error');
-
- @DomName('XMLHttpRequest.loadEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEvent = const EventStreamProvider<ProgressEvent>('load');
-
- @DomName('XMLHttpRequest.loadendEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEndEvent = const EventStreamProvider<ProgressEvent>('loadend');
-
- @DomName('XMLHttpRequest.loadstartEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadStartEvent = const EventStreamProvider<ProgressEvent>('loadstart');
-
- @DomName('XMLHttpRequest.progressEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
-
@DomName('XMLHttpRequest.readystatechangeEvent')
@DocsEditable()
static const EventStreamProvider<ProgressEvent> readyStateChangeEvent = const EventStreamProvider<ProgressEvent>('readystatechange');
@@ -13940,77 +13979,6 @@
@DocsEditable()
void setRequestHeader(String header, String value) native "XMLHttpRequest_setRequestHeader_Callback";
- @DomName('XMLHttpRequest.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "XMLHttpRequest_addEventListener_Callback";
-
- @DomName('XMLHttpRequest.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "XMLHttpRequest_dispatchEvent_Callback";
-
- @DomName('XMLHttpRequest.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "XMLHttpRequest_removeEventListener_Callback";
-
- /**
- * Event listeners to be notified when request has been aborted,
- * generally due to calling `httpRequest.abort()`.
- */
- @DomName('XMLHttpRequest.onabort')
- @DocsEditable()
- Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
-
- /**
- * Event listeners to be notified when a request has failed, such as when a
- * cross-domain error occurred or the file wasn't found on the server.
- */
- @DomName('XMLHttpRequest.onerror')
- @DocsEditable()
- Stream<ProgressEvent> get onError => errorEvent.forTarget(this);
-
- /**
- * Event listeners to be notified once the request has completed
- * *successfully*.
- */
- @DomName('XMLHttpRequest.onload')
- @DocsEditable()
- Stream<ProgressEvent> get onLoad => loadEvent.forTarget(this);
-
- /**
- * Event listeners to be notified once the request has completed (on
- * either success or failure).
- */
- @DomName('XMLHttpRequest.onloadend')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.FIREFOX)
- @SupportedBrowser(SupportedBrowser.IE, '10')
- @SupportedBrowser(SupportedBrowser.SAFARI)
- Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
-
- /**
- * Event listeners to be notified when the request starts, once
- * `httpRequest.send()` has been called.
- */
- @DomName('XMLHttpRequest.onloadstart')
- @DocsEditable()
- Stream<ProgressEvent> get onLoadStart => loadStartEvent.forTarget(this);
-
- /**
- * Event listeners to be notified when data for the request
- * is being sent or loaded.
- *
- * Progress events are fired every 50ms or for every byte transmitted,
- * whichever is less frequent.
- */
- @DomName('XMLHttpRequest.onprogress')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.FIREFOX)
- @SupportedBrowser(SupportedBrowser.IE, '10')
- @SupportedBrowser(SupportedBrowser.SAFARI)
- Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
-
/**
* Event listeners to be notified every time the [HttpRequest]
* object's `readyState` changes values.
@@ -14060,70 +14028,10 @@
@DomName('XMLHttpRequestUpload')
// http://xhr.spec.whatwg.org/#xmlhttprequestupload
@Experimental()
-class HttpRequestUpload extends EventTarget {
+class HttpRequestUpload extends XmlHttpRequestEventTarget {
// To suppress missing implicit constructor warnings.
factory HttpRequestUpload._() { throw new UnsupportedError("Not supported"); }
- @DomName('XMLHttpRequestUpload.abortEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> abortEvent = const EventStreamProvider<ProgressEvent>('abort');
-
- @DomName('XMLHttpRequestUpload.errorEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> errorEvent = const EventStreamProvider<ProgressEvent>('error');
-
- @DomName('XMLHttpRequestUpload.loadEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEvent = const EventStreamProvider<ProgressEvent>('load');
-
- @DomName('XMLHttpRequestUpload.loadendEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadEndEvent = const EventStreamProvider<ProgressEvent>('loadend');
-
- @DomName('XMLHttpRequestUpload.loadstartEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> loadStartEvent = const EventStreamProvider<ProgressEvent>('loadstart');
-
- @DomName('XMLHttpRequestUpload.progressEvent')
- @DocsEditable()
- static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
-
- @DomName('XMLHttpRequestUpload.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "XMLHttpRequestUpload_addEventListener_Callback";
-
- @DomName('XMLHttpRequestUpload.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "XMLHttpRequestUpload_dispatchEvent_Callback";
-
- @DomName('XMLHttpRequestUpload.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "XMLHttpRequestUpload_removeEventListener_Callback";
-
- @DomName('XMLHttpRequestUpload.onabort')
- @DocsEditable()
- Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onerror')
- @DocsEditable()
- Stream<ProgressEvent> get onError => errorEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onload')
- @DocsEditable()
- Stream<ProgressEvent> get onLoad => loadEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onloadend')
- @DocsEditable()
- Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onloadstart')
- @DocsEditable()
- Stream<ProgressEvent> get onLoadStart => loadStartEvent.forTarget(this);
-
- @DomName('XMLHttpRequestUpload.onprogress')
- @DocsEditable()
- Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
-
}
// 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
@@ -16076,7 +15984,7 @@
@DomName('MediaController.duration')
@DocsEditable()
- num get duration native "MediaController_duration_Getter";
+ double get duration native "MediaController_duration_Getter";
@DomName('MediaController.muted')
@DocsEditable()
@@ -16369,7 +16277,7 @@
@DomName('HTMLMediaElement.duration')
@DocsEditable()
- num get duration native "HTMLMediaElement_duration_Getter";
+ double get duration native "HTMLMediaElement_duration_Getter";
@DomName('HTMLMediaElement.ended')
@DocsEditable()
@@ -16383,7 +16291,7 @@
@DocsEditable()
// http://www.w3.org/TR/2011/WD-html5-20110113/video.html#dom-media-initialtime
@Experimental()
- num get initialTime native "HTMLMediaElement_initialTime_Getter";
+ double get initialTime native "HTMLMediaElement_initialTime_Getter";
@DomName('HTMLMediaElement.loop')
@DocsEditable()
@@ -16472,7 +16380,7 @@
@DomName('HTMLMediaElement.startTime')
@DocsEditable()
@Experimental() // non-standard
- num get startTime native "HTMLMediaElement_startTime_Getter";
+ double get startTime native "HTMLMediaElement_startTime_Getter";
@DomName('HTMLMediaElement.textTracks')
@DocsEditable()
@@ -17489,13 +17397,6 @@
@Unstable()
class MessageChannel extends NativeFieldWrapperClass1 {
- @DomName('MessageChannel.MessageChannel')
- @DocsEditable()
- factory MessageChannel() => _create();
-
- @DocsEditable()
- static MessageChannel _create() native "MessageChannel_constructorCallback";
-
@DomName('MessageChannel.port1')
@DocsEditable()
MessagePort get port1 native "MessageChannel_port1_Getter";
@@ -17549,7 +17450,7 @@
@DomName('MessageEvent.source')
@DocsEditable()
- WindowBase get source native "MessageEvent_source_Getter";
+ EventTarget get source native "MessageEvent_source_Getter";
@DomName('MessageEvent.initMessageEvent')
@DocsEditable()
@@ -17891,7 +17792,7 @@
@DomName('MIDIMessageEvent.receivedTime')
@DocsEditable()
- num get receivedTime native "MIDIMessageEvent_receivedTime_Getter";
+ double get receivedTime native "MIDIMessageEvent_receivedTime_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -18562,7 +18463,7 @@
@DomName('Navigator')
-class Navigator extends NativeFieldWrapperClass1 {
+class Navigator extends NativeFieldWrapperClass1 implements NavigatorOnLine, NavigatorID {
/**
@@ -18626,14 +18527,6 @@
@Experimental() // non-standard
String get appCodeName native "Navigator_appCodeName_Getter";
- @DomName('Navigator.appName')
- @DocsEditable()
- String get appName native "Navigator_appName_Getter";
-
- @DomName('Navigator.appVersion')
- @DocsEditable()
- String get appVersion native "Navigator_appVersion_Getter";
-
@DomName('Navigator.cookieEnabled')
@DocsEditable()
@Unstable()
@@ -18659,15 +18552,6 @@
@Experimental() // nonstandard
MimeTypeArray get mimeTypes native "Navigator_mimeTypes_Getter";
- @DomName('Navigator.onLine')
- @DocsEditable()
- @Unstable()
- bool get onLine native "Navigator_onLine_Getter";
-
- @DomName('Navigator.platform')
- @DocsEditable()
- String get platform native "Navigator_platform_Getter";
-
@DomName('Navigator.plugins')
@DocsEditable()
@deprecated // nonstandard
@@ -18683,10 +18567,6 @@
@Unstable()
String get productSub native "Navigator_productSub_Getter";
- @DomName('Navigator.userAgent')
- @DocsEditable()
- String get userAgent native "Navigator_userAgent_Getter";
-
@DomName('Navigator.vendor')
@DocsEditable()
@Unstable()
@@ -18748,6 +18628,78 @@
@Experimental()
void _getUserMedia(Map options, _NavigatorUserMediaSuccessCallback successCallback, [_NavigatorUserMediaErrorCallback errorCallback]) native "Navigator_webkitGetUserMedia_Callback";
+ @DomName('Navigator.appName')
+ @DocsEditable()
+ String get appName native "Navigator_appName_Getter";
+
+ @DomName('Navigator.appVersion')
+ @DocsEditable()
+ String get appVersion native "Navigator_appVersion_Getter";
+
+ @DomName('Navigator.platform')
+ @DocsEditable()
+ String get platform native "Navigator_platform_Getter";
+
+ @DomName('Navigator.userAgent')
+ @DocsEditable()
+ String get userAgent native "Navigator_userAgent_Getter";
+
+ @DomName('Navigator.onLine')
+ @DocsEditable()
+ @Unstable()
+ bool get onLine native "Navigator_onLine_Getter";
+
+}
+// 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('NavigatorID')
+@Experimental() // untriaged
+abstract class NavigatorID extends NativeFieldWrapperClass1 {
+
+ @DomName('NavigatorID.appName')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get appName native "NavigatorID_appName_Getter";
+
+ @DomName('NavigatorID.appVersion')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get appVersion native "NavigatorID_appVersion_Getter";
+
+ @DomName('NavigatorID.platform')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get platform native "NavigatorID_platform_Getter";
+
+ @DomName('NavigatorID.userAgent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get userAgent native "NavigatorID_userAgent_Getter";
+
+}
+// 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('NavigatorOnLine')
+@Experimental() // untriaged
+abstract class NavigatorOnLine extends NativeFieldWrapperClass1 {
+
+ @DomName('NavigatorOnLine.onLine')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool get onLine native "NavigatorOnLine_onLine_Getter";
+
}
// 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
@@ -18924,7 +18876,7 @@
_this._replaceChild(value, this[index]);
}
- Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
+ Iterator<Node> get iterator => _this._childNodes.iterator;
// From List<Node>:
@@ -18946,15 +18898,15 @@
// -- end List<Node> mixins.
// TODO(jacobr): benchmark whether this is more efficient or whether caching
- // a local copy of $dom_childNodes is more efficient.
- int get length => _this.$dom_childNodes.length;
+ // a local copy of _childNodes is more efficient.
+ int get length => _this._childNodes.length;
void set length(int value) {
throw new UnsupportedError(
"Cannot set length on immutable List.");
}
- Node operator[](int index) => _this.$dom_childNodes[index];
+ Node operator[](int index) => _this._childNodes[index];
}
/** Information about the instantiated template. */
@@ -19150,7 +19102,7 @@
@DomName('Node.childNodes')
@DocsEditable()
- List<Node> get $dom_childNodes native "Node_childNodes_Getter";
+ List<Node> get _childNodes native "Node_childNodes_Getter";
@DomName('Node.firstChild')
@DocsEditable()
@@ -20312,7 +20264,7 @@
@DomName('Performance.now')
@DocsEditable()
- num now() native "Performance_now_Callback";
+ double now() native "Performance_now_Callback";
@DomName('Performance.webkitClearResourceTimings')
@DocsEditable()
@@ -20361,7 +20313,7 @@
@DomName('PerformanceEntry.duration')
@DocsEditable()
- num get duration native "PerformanceEntry_duration_Getter";
+ double get duration native "PerformanceEntry_duration_Getter";
@DomName('PerformanceEntry.entryType')
@DocsEditable()
@@ -20373,7 +20325,7 @@
@DomName('PerformanceEntry.startTime')
@DocsEditable()
- num get startTime native "PerformanceEntry_startTime_Getter";
+ double get startTime native "PerformanceEntry_startTime_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -20462,23 +20414,23 @@
@DomName('PerformanceResourceTiming.connectEnd')
@DocsEditable()
- num get connectEnd native "PerformanceResourceTiming_connectEnd_Getter";
+ double get connectEnd native "PerformanceResourceTiming_connectEnd_Getter";
@DomName('PerformanceResourceTiming.connectStart')
@DocsEditable()
- num get connectStart native "PerformanceResourceTiming_connectStart_Getter";
+ double get connectStart native "PerformanceResourceTiming_connectStart_Getter";
@DomName('PerformanceResourceTiming.domainLookupEnd')
@DocsEditable()
- num get domainLookupEnd native "PerformanceResourceTiming_domainLookupEnd_Getter";
+ double get domainLookupEnd native "PerformanceResourceTiming_domainLookupEnd_Getter";
@DomName('PerformanceResourceTiming.domainLookupStart')
@DocsEditable()
- num get domainLookupStart native "PerformanceResourceTiming_domainLookupStart_Getter";
+ double get domainLookupStart native "PerformanceResourceTiming_domainLookupStart_Getter";
@DomName('PerformanceResourceTiming.fetchStart')
@DocsEditable()
- num get fetchStart native "PerformanceResourceTiming_fetchStart_Getter";
+ double get fetchStart native "PerformanceResourceTiming_fetchStart_Getter";
@DomName('PerformanceResourceTiming.initiatorType')
@DocsEditable()
@@ -20486,30 +20438,30 @@
@DomName('PerformanceResourceTiming.redirectEnd')
@DocsEditable()
- num get redirectEnd native "PerformanceResourceTiming_redirectEnd_Getter";
+ double get redirectEnd native "PerformanceResourceTiming_redirectEnd_Getter";
@DomName('PerformanceResourceTiming.redirectStart')
@DocsEditable()
- num get redirectStart native "PerformanceResourceTiming_redirectStart_Getter";
+ double get redirectStart native "PerformanceResourceTiming_redirectStart_Getter";
@DomName('PerformanceResourceTiming.requestStart')
@DocsEditable()
@Experimental() // nonstandard
- num get requestStart native "PerformanceResourceTiming_requestStart_Getter";
+ double get requestStart native "PerformanceResourceTiming_requestStart_Getter";
@DomName('PerformanceResourceTiming.responseEnd')
@DocsEditable()
@Experimental() // nonstandard
- num get responseEnd native "PerformanceResourceTiming_responseEnd_Getter";
+ double get responseEnd native "PerformanceResourceTiming_responseEnd_Getter";
@DomName('PerformanceResourceTiming.responseStart')
@DocsEditable()
@Experimental() // nonstandard
- num get responseStart native "PerformanceResourceTiming_responseStart_Getter";
+ double get responseStart native "PerformanceResourceTiming_responseStart_Getter";
@DomName('PerformanceResourceTiming.secureConnectionStart')
@DocsEditable()
- num get secureConnectionStart native "PerformanceResourceTiming_secureConnectionStart_Getter";
+ double get secureConnectionStart native "PerformanceResourceTiming_secureConnectionStart_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -20841,20 +20793,10 @@
@DocsEditable()
@DomName('ProcessingInstruction')
@Unstable()
-class ProcessingInstruction extends Node {
+class ProcessingInstruction extends CharacterData {
// To suppress missing implicit constructor warnings.
factory ProcessingInstruction._() { throw new UnsupportedError("Not supported"); }
- @DomName('ProcessingInstruction.data')
- @DocsEditable()
- @Experimental() // non-standard
- String get data native "ProcessingInstruction_data_Getter";
-
- @DomName('ProcessingInstruction.data')
- @DocsEditable()
- @Experimental() // non-standard
- void set data(String value) native "ProcessingInstruction_data_Setter";
-
@DomName('ProcessingInstruction.sheet')
@DocsEditable()
@Experimental() // non-standard
@@ -20904,7 +20846,7 @@
@DomName('HTMLProgressElement.position')
@DocsEditable()
- num get position native "HTMLProgressElement_position_Getter";
+ double get position native "HTMLProgressElement_position_Getter";
@DomName('HTMLProgressElement.value')
@DocsEditable()
@@ -21081,7 +21023,7 @@
@DomName('Range')
@Unstable()
class Range extends NativeFieldWrapperClass1 {
- factory Range() => document.$dom_createRange();
+ factory Range() => document.createRange();
factory Range.fromPoint(Point point) =>
document._caretRangeFromPoint(point.x, point.y);
@@ -23112,7 +23054,7 @@
@DomName('SpeechInputResult.confidence')
@DocsEditable()
- num get confidence native "SpeechInputResult_confidence_Getter";
+ double get confidence native "SpeechInputResult_confidence_Getter";
@DomName('SpeechInputResult.utterance')
@DocsEditable()
@@ -23316,7 +23258,7 @@
@DomName('SpeechRecognitionAlternative.confidence')
@DocsEditable()
- num get confidence native "SpeechRecognitionAlternative_confidence_Getter";
+ double get confidence native "SpeechRecognitionAlternative_confidence_Getter";
@DomName('SpeechRecognitionAlternative.transcript')
@DocsEditable()
@@ -23475,7 +23417,7 @@
@DomName('SpeechSynthesisEvent.elapsedTime')
@DocsEditable()
- num get elapsedTime native "SpeechSynthesisEvent_elapsedTime_Getter";
+ double get elapsedTime native "SpeechSynthesisEvent_elapsedTime_Getter";
@DomName('SpeechSynthesisEvent.name')
@DocsEditable()
@@ -24116,17 +24058,17 @@
@DomName('SubtleCrypto.decrypt')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation decrypt(Map algorithm, CryptoKey key) native "SubtleCrypto_decrypt_Callback";
+ Object decrypt(Map algorithm, CryptoKey key, TypedData data) native "SubtleCrypto_decrypt_Callback";
@DomName('SubtleCrypto.digest')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation digest(Map algorithm) native "SubtleCrypto_digest_Callback";
+ Object digest(Map algorithm, TypedData data) native "SubtleCrypto_digest_Callback";
@DomName('SubtleCrypto.encrypt')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation encrypt(Map algorithm, CryptoKey key) native "SubtleCrypto_encrypt_Callback";
+ Object encrypt(Map algorithm, CryptoKey key, TypedData data) native "SubtleCrypto_encrypt_Callback";
@DomName('SubtleCrypto.generateKey')
@DocsEditable()
@@ -24141,12 +24083,12 @@
@DomName('SubtleCrypto.sign')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation sign(Map algorithm, CryptoKey key) native "SubtleCrypto_sign_Callback";
+ Object sign(Map algorithm, CryptoKey key, TypedData data) native "SubtleCrypto_sign_Callback";
@DomName('SubtleCrypto.verify')
@DocsEditable()
@Experimental() // untriaged
- CryptoOperation verify(Map algorithm, CryptoKey key, TypedData signature) native "SubtleCrypto_verify_Callback";
+ Object verify(Map algorithm, CryptoKey key, TypedData signature, TypedData data) native "SubtleCrypto_verify_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -24373,6 +24315,7 @@
TableCellElement insertCell(int index) => _insertCell(index);
+
// To suppress missing implicit constructor warnings.
factory TableRowElement._() { throw new UnsupportedError("Not supported"); }
@@ -24419,6 +24362,7 @@
TableRowElement insertRow(int index) => _insertRow(index);
+
// To suppress missing implicit constructor warnings.
factory TableSectionElement._() { throw new UnsupportedError("Not supported"); }
@@ -25065,7 +25009,7 @@
@DomName('TextMetrics.width')
@DocsEditable()
- num get width native "TextMetrics_width_Getter";
+ double get width native "TextMetrics_width_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -25482,11 +25426,11 @@
@DomName('TimeRanges.end')
@DocsEditable()
- num end(int index) native "TimeRanges_end_Callback";
+ double end(int index) native "TimeRanges_end_Callback";
@DomName('TimeRanges.start')
@DocsEditable()
- num start(int index) native "TimeRanges_start_Callback";
+ double start(int index) native "TimeRanges_start_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -25564,7 +25508,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
- num get force native "Touch_webkitForce_Getter";
+ double get force native "Touch_webkitForce_Getter";
@DomName('Touch.webkitRadiusX')
@DocsEditable()
@@ -25585,7 +25529,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
- num get rotationAngle native "Touch_webkitRotationAngle_Getter";
+ double get rotationAngle native "Touch_webkitRotationAngle_Getter";
@DomName('Touch.clientX')
@@ -25870,7 +25814,7 @@
@DomName('TransitionEvent.elapsedTime')
@DocsEditable()
- num get elapsedTime native "TransitionEvent_elapsedTime_Getter";
+ double get elapsedTime native "TransitionEvent_elapsedTime_Getter";
@DomName('TransitionEvent.propertyName')
@DocsEditable()
@@ -26553,16 +26497,16 @@
eventType = 'MouseScrollEvents';
}
final event = document._createEvent(eventType);
- // Dartium always needs these flipped because we're essentially always
- // polyfilling (see similar dart2js code as well)
+ // Dartium always needs these flipped because we're using the legacy
+ // _initWebKitWheelEvent instead of the more modern WheelEvent constructor
+ // which isn't yet properly exposed by the Dartium bindings.
deltaX = -deltaX;
deltaY = -deltaY;
// Fallthrough for Dartium.
event._initMouseEvent(type, canBubble, cancelable, view, detail,
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey, button, relatedTarget);
- event._initWebKitWheelEvent(deltaX,
- deltaY ~/ 120, // Chrome does an auto-convert to pixels.
+ event._initWebKitWheelEvent(deltaX, deltaY,
view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey);
@@ -26588,6 +26532,21 @@
@DocsEditable()
int get deltaMode native "WheelEvent_deltaMode_Getter";
+ @DomName('WheelEvent.deltaX')
+ @DocsEditable()
+ @Experimental() // untriaged
+ double get _deltaX native "WheelEvent_deltaX_Getter";
+
+ @DomName('WheelEvent.deltaY')
+ @DocsEditable()
+ @Experimental() // untriaged
+ double get _deltaY native "WheelEvent_deltaY_Getter";
+
+ @DomName('WheelEvent.deltaZ')
+ @DocsEditable()
+ @Experimental() // untriaged
+ double get deltaZ native "WheelEvent_deltaZ_Getter";
+
@DomName('WheelEvent.webkitDirectionInvertedFromDevice')
@DocsEditable()
@SupportedBrowser(SupportedBrowser.CHROME)
@@ -26598,12 +26557,12 @@
@DomName('WheelEvent.wheelDeltaX')
@DocsEditable()
@Experimental() // non-standard
- int get _wheelDeltaX native "WheelEvent_wheelDeltaX_Getter";
+ int get wheelDeltaX native "WheelEvent_wheelDeltaX_Getter";
@DomName('WheelEvent.wheelDeltaY')
@DocsEditable()
@Experimental() // non-standard
- int get _wheelDeltaY native "WheelEvent_wheelDeltaY_Getter";
+ int get wheelDeltaY native "WheelEvent_wheelDeltaY_Getter";
@DomName('WheelEvent.initWebKitWheelEvent')
@DocsEditable()
@@ -26620,7 +26579,7 @@
* * [WheelEvent.deltaX](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaX) from the W3C.
*/
@DomName('WheelEvent.deltaX')
- num get deltaX => -_wheelDeltaX;
+ num get deltaX => _deltaX;
/**
* The amount that is expected to scroll vertically, in units determined by
@@ -26631,7 +26590,7 @@
* * [WheelEvent.deltaY](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaY) from the W3C.
*/
@DomName('WheelEvent.deltaY')
- num get deltaY => -_wheelDeltaY;
+ num get deltaY => _deltaY;
}
// 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
@@ -26663,7 +26622,7 @@
if (portStr == null) {
return null;
}
- var port = json.parse(portStr);
+ var port = JSON.decode(portStr);
return _deserialize(port);
}
@@ -26675,7 +26634,7 @@
void registerPort(String name, var port) {
var serialized = _serialize(port);
document.documentElement.attributes['dart-port:$name'] =
- json.stringify(serialized);
+ JSON.encode(serialized);
}
/**
@@ -26891,7 +26850,7 @@
@DocsEditable()
// http://www.quirksmode.org/blog/archives/2012/06/devicepixelrati.html
@Experimental() // non-standard
- num get devicePixelRatio native "Window_devicePixelRatio_Getter";
+ double get devicePixelRatio native "Window_devicePixelRatio_Getter";
@DomName('Window.document')
@DocsEditable()
@@ -27122,6 +27081,50 @@
@DocsEditable()
bool confirm(String message) native "Window_confirm_Callback";
+ Object _createImageBitmap(canvas_OR_context_OR_image_OR_video, [int sx, int sy, int sw, int sh]) {
+ if ((canvas_OR_context_OR_image_OR_video is ImageElement || canvas_OR_context_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ return _createImageBitmap_1(canvas_OR_context_OR_image_OR_video);
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (canvas_OR_context_OR_image_OR_video is ImageElement || canvas_OR_context_OR_image_OR_video == null)) {
+ return _createImageBitmap_2(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh);
+ }
+ if ((canvas_OR_context_OR_image_OR_video is CanvasRenderingContext2D || canvas_OR_context_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ return _createImageBitmap_3(canvas_OR_context_OR_image_OR_video);
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (canvas_OR_context_OR_image_OR_video is CanvasElement || canvas_OR_context_OR_image_OR_video == null)) {
+ return _createImageBitmap_4(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh);
+ }
+ if ((canvas_OR_context_OR_image_OR_video is CanvasElement || canvas_OR_context_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ return _createImageBitmap_5(canvas_OR_context_OR_image_OR_video);
+ }
+ if ((canvas_OR_context_OR_image_OR_video is VideoElement || canvas_OR_context_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ return _createImageBitmap_6(canvas_OR_context_OR_image_OR_video);
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (canvas_OR_context_OR_image_OR_video is VideoElement || canvas_OR_context_OR_image_OR_video == null)) {
+ return _createImageBitmap_7(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh);
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (canvas_OR_context_OR_image_OR_video is CanvasRenderingContext2D || canvas_OR_context_OR_image_OR_video == null)) {
+ return _createImageBitmap_8(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh);
+ }
+ throw new ArgumentError("Incorrect number or type of arguments");
+ }
+
+ Object _createImageBitmap_1(canvas_OR_context_OR_image_OR_video) native "Window__createImageBitmap_1_Callback";
+
+ Object _createImageBitmap_2(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh) native "Window__createImageBitmap_2_Callback";
+
+ Object _createImageBitmap_3(canvas_OR_context_OR_image_OR_video) native "Window__createImageBitmap_3_Callback";
+
+ Object _createImageBitmap_4(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh) native "Window__createImageBitmap_4_Callback";
+
+ Object _createImageBitmap_5(canvas_OR_context_OR_image_OR_video) native "Window__createImageBitmap_5_Callback";
+
+ Object _createImageBitmap_6(canvas_OR_context_OR_image_OR_video) native "Window__createImageBitmap_6_Callback";
+
+ Object _createImageBitmap_7(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh) native "Window__createImageBitmap_7_Callback";
+
+ Object _createImageBitmap_8(canvas_OR_context_OR_image_OR_video, sx, sy, sw, sh) native "Window__createImageBitmap_8_Callback";
+
@DomName('Window.find')
@DocsEditable()
@Experimental() // non-standard
@@ -27738,6 +27741,21 @@
@DocsEditable()
+@DomName('WorkerConsole')
+@Experimental() // untriaged
+class WorkerConsole extends ConsoleBase {
+ // To suppress missing implicit constructor warnings.
+ factory WorkerConsole._() { throw new UnsupportedError("Not supported"); }
+
+}
+// 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('WorkerCrypto')
@Experimental() // untriaged
class WorkerCrypto extends NativeFieldWrapperClass1 {
@@ -27777,6 +27795,11 @@
@Experimental() // untriaged
static const int TEMPORARY = 0;
+ @DomName('WorkerGlobalScope.console')
+ @DocsEditable()
+ @Experimental() // untriaged
+ WorkerConsole get console native "WorkerGlobalScope_console_Getter";
+
@DomName('WorkerGlobalScope.crypto')
@DocsEditable()
@Experimental() // untriaged
@@ -27820,11 +27843,6 @@
@Experimental() // untriaged
void close() native "WorkerGlobalScope_close_Callback";
- @DomName('WorkerGlobalScope.importScripts')
- @DocsEditable()
- @Experimental() // untriaged
- void importScripts() native "WorkerGlobalScope_importScripts_Callback";
-
@DomName('WorkerGlobalScope.openDatabase')
@DocsEditable()
@Experimental() // untriaged
@@ -27943,7 +27961,7 @@
@DomName('WorkerPerformance.now')
@DocsEditable()
@Experimental() // untriaged
- num now() native "WorkerPerformance_now_Callback";
+ double now() native "WorkerPerformance_now_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -28080,7 +28098,7 @@
@DomName('XPathResult.numberValue')
@DocsEditable()
- num get numberValue native "XPathResult_numberValue_Getter";
+ double get numberValue native "XPathResult_numberValue_Getter";
@DomName('XPathResult.resultType')
@DocsEditable()
@@ -28115,6 +28133,96 @@
@DocsEditable()
+@DomName('XMLHttpRequestEventTarget')
+@Experimental() // untriaged
+class XmlHttpRequestEventTarget extends EventTarget {
+ // To suppress missing implicit constructor warnings.
+ factory XmlHttpRequestEventTarget._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('XMLHttpRequestEventTarget.abortEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> abortEvent = const EventStreamProvider<ProgressEvent>('abort');
+
+ @DomName('XMLHttpRequestEventTarget.errorEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> errorEvent = const EventStreamProvider<ProgressEvent>('error');
+
+ @DomName('XMLHttpRequestEventTarget.loadEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> loadEvent = const EventStreamProvider<ProgressEvent>('load');
+
+ @DomName('XMLHttpRequestEventTarget.loadendEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> loadEndEvent = const EventStreamProvider<ProgressEvent>('loadend');
+
+ @DomName('XMLHttpRequestEventTarget.loadstartEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> loadStartEvent = const EventStreamProvider<ProgressEvent>('loadstart');
+
+ @DomName('XMLHttpRequestEventTarget.progressEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
+
+ @DomName('XMLHttpRequestEventTarget.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "XMLHttpRequestEventTarget_addEventListener_Callback";
+
+ @DomName('XMLHttpRequestEventTarget.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native "XMLHttpRequestEventTarget_dispatchEvent_Callback";
+
+ @DomName('XMLHttpRequestEventTarget.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "XMLHttpRequestEventTarget_removeEventListener_Callback";
+
+ @DomName('XMLHttpRequestEventTarget.onabort')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onerror')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onError => errorEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onload')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onLoad => loadEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onloadend')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onLoadEnd => loadEndEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onloadstart')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onLoadStart => loadStartEvent.forTarget(this);
+
+ @DomName('XMLHttpRequestEventTarget.onprogress')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<ProgressEvent> get onProgress => progressEvent.forTarget(this);
+
+}
+// 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('XMLSerializer')
// http://domparsing.spec.whatwg.org/#the-xmlserializer-interface
@deprecated // stable
@@ -28211,10 +28319,20 @@
@DocsEditable()
bool get isId native "Attr_isId_Getter";
+ @DomName('Attr.localName')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get _localName native "Attr_localName_Getter";
+
@DomName('Attr.name')
@DocsEditable()
String get name native "Attr_name_Getter";
+ @DomName('Attr.namespaceURI')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get _namespaceUri native "Attr_namespaceURI_Getter";
+
@DomName('Attr.ownerElement')
@DocsEditable()
@deprecated // deprecated
@@ -28370,27 +28488,27 @@
@DomName('ClientRect.bottom')
@DocsEditable()
- num get bottom native "ClientRect_bottom_Getter";
+ double get bottom native "ClientRect_bottom_Getter";
@DomName('ClientRect.height')
@DocsEditable()
- num get height native "ClientRect_height_Getter";
+ double get height native "ClientRect_height_Getter";
@DomName('ClientRect.left')
@DocsEditable()
- num get left native "ClientRect_left_Getter";
+ double get left native "ClientRect_left_Getter";
@DomName('ClientRect.right')
@DocsEditable()
- num get right native "ClientRect_right_Getter";
+ double get right native "ClientRect_right_Getter";
@DomName('ClientRect.top')
@DocsEditable()
- num get top native "ClientRect_top_Getter";
+ double get top native "ClientRect_top_Getter";
@DomName('ClientRect.width')
@DocsEditable()
- num get width native "ClientRect_width_Getter";
+ double get width native "ClientRect_width_Getter";
}
// 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
@@ -29440,7 +29558,7 @@
@DomName('WorkerNavigator')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#workernavigator
@Experimental()
-abstract class _WorkerNavigator extends NativeFieldWrapperClass1 {
+abstract class _WorkerNavigator extends NativeFieldWrapperClass1 implements NavigatorOnLine, NavigatorID {
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -29536,15 +29654,15 @@
}
String operator [](String key) {
- return _element.$dom_getAttribute(key);
+ return _element._getAttribute(key);
}
void operator []=(String key, String value) {
- _element.$dom_setAttribute(key, value);
+ _element._setAttribute(key, value);
}
String remove(String key) {
- String value = _element.$dom_getAttribute(key);
+ String value = _element._getAttribute(key);
_element._removeAttribute(key);
return value;
}
@@ -29573,11 +29691,11 @@
}
String operator [](String key) {
- return _element.$dom_getAttributeNS(_namespace, key);
+ return _element._getAttributeNS(_namespace, key);
}
void operator []=(String key, String value) {
- _element.$dom_setAttributeNS(_namespace, key, value);
+ _element._setAttributeNS(_namespace, key, value);
}
String remove(String key) {
@@ -29727,7 +29845,7 @@
* * [DOM Window](https://developer.mozilla.org/en-US/docs/DOM/window) from MDN.
* * [Window](http://www.w3.org/TR/Window/) from the W3C.
*/
-abstract class WindowBase {
+abstract class WindowBase implements EventTarget {
// Fields.
/**
@@ -31297,7 +31415,7 @@
var source = '$target-result';
var result = null;
window.on[source].first.then((Event e) {
- result = json.parse(_getPortSyncEventData(e));
+ result = JSON.decode(_getPortSyncEventData(e));
});
_dispatchEvent(target, [source, message]);
return result;
@@ -31381,7 +31499,7 @@
_callback = callback;
if (_portSubscription == null) {
_portSubscription = window.on[_listenerName].listen((Event e) {
- var data = json.parse(_getPortSyncEventData(e));
+ var data = JSON.decode(_getPortSyncEventData(e));
var replyTo = data[0];
var message = _deserialize(data[1]);
var result = _callback(message);
@@ -31412,7 +31530,7 @@
void _dispatchEvent(String receiver, var message) {
var event = new CustomEvent(receiver, canBubble: false, cancelable:false,
- detail: json.stringify(message));
+ detail: JSON.encode(message));
window.dispatchEvent(event);
}
@@ -32853,6 +32971,21 @@
}
/**
+ * Allow inline styles on elements.
+ *
+ * If [tagName] is not specified then this allows inline styles on all
+ * elements. Otherwise tagName limits the styles to the specified elements.
+ */
+ void allowInlineStyles({String tagName}) {
+ if (tagName == null) {
+ tagName = '*';
+ } else {
+ tagName = tagName.toUpperCase();
+ }
+ add(new _SimpleNodeValidator(null, allowedAttributes: ['$tagName::style']));
+ }
+
+ /**
* Allow common safe HTML5 elements and attributes.
*
* This list is based off of the Caja whitelists at:
@@ -33792,6 +33925,8 @@
Element element = node;
var attrs = element.attributes;
if (!validator.allowsElement(element)) {
+ window.console.warn(
+ 'Removing disallowed element <${element.tagName}>');
element.remove();
break;
}
@@ -33799,6 +33934,8 @@
var isAttr = attrs['is'];
if (isAttr != null) {
if (!validator.allowsAttribute(element, 'is', isAttr)) {
+ window.console.warn('Removing disallowed type extension '
+ '<${element.tagName} is="$isAttr">');
element.remove();
break;
}
@@ -33811,6 +33948,8 @@
var name = keys[i];
if (!validator.allowsAttribute(element, name.toLowerCase(),
attrs[name])) {
+ window.console.warn('Removing disallowed attribute '
+ '<${element.tagName} $name="${attrs[name]}">');
attrs.remove(name);
}
}
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 44b179e..3fbe9ff 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -531,12 +531,7 @@
@DomName('IDBIndex.count')
Future<int> count([key_OR_range]) {
try {
- var request;
- if (key_OR_range != null) {
- request = _count(key_OR_range);
- } else {
- request = _count();
- }
+ var request = _count(key_OR_range);
return _completeRequest(request);
} catch (e, stacktrace) {
return new Future.error(e, stacktrace);
@@ -583,12 +578,7 @@
} else {
key_OR_range = range;
}
- var request;
- if (direction == null) {
- request = _openCursor(key_OR_range);
- } else {
- request = _openCursor(key_OR_range, direction);
- }
+ var request = _openCursor(key_OR_range, direction);
return ObjectStore._cursorStreamFromResult(request, autoAdvance);
}
@@ -610,12 +600,7 @@
} else {
key_OR_range = range;
}
- var request;
- if (direction == null) {
- request = _openKeyCursor(key_OR_range);
- } else {
- request = _openKeyCursor(key_OR_range, direction);
- }
+ var request = _openKeyCursor(key_OR_range, direction);
return ObjectStore._cursorStreamFromResult(request, autoAdvance);
}
@@ -644,7 +629,7 @@
@JSName('count')
@DomName('IDBIndex.count')
@DocsEditable()
- Request _count([key_OR_range]) native;
+ Request _count(Object key) native;
@JSName('get')
@DomName('IDBIndex.get')
@@ -652,7 +637,7 @@
@Returns('Request')
@Creates('Request')
@annotation_Creates_SerializedScriptValue
- Request _get(key) native;
+ Request _get(Object key) native;
@JSName('getKey')
@DomName('IDBIndex.getKey')
@@ -661,7 +646,7 @@
@Creates('Request')
@annotation_Creates_SerializedScriptValue
@Creates('ObjectStore')
- Request _getKey(key) native;
+ Request _getKey(Object key) native;
@JSName('openCursor')
@DomName('IDBIndex.openCursor')
@@ -669,7 +654,7 @@
@Returns('Request')
@Creates('Request')
@Creates('Cursor')
- Request _openCursor([key_OR_range, String direction]) native;
+ Request _openCursor(Object key, String direction) native;
@JSName('openKeyCursor')
@DomName('IDBIndex.openKeyCursor')
@@ -677,7 +662,7 @@
@Returns('Request')
@Creates('Request')
@Creates('Cursor')
- Request _openKeyCursor([key_OR_range, String direction]) native;
+ Request _openKeyCursor(Object key, String direction) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -791,12 +776,7 @@
@DomName('IDBObjectStore.count')
Future<int> count([key_OR_range]) {
try {
- var request;
- if (key_OR_range != null) {
- request = _count(key_OR_range);
- } else {
- request = _count();
- }
+ var request = _count(key_OR_range);
return _completeRequest(request);
} catch (e, stacktrace) {
return new Future.error(e, stacktrace);
@@ -947,7 +927,7 @@
@JSName('count')
@DomName('IDBObjectStore.count')
@DocsEditable()
- Request _count([key_OR_range]) native;
+ Request _count(Object key) native;
@DomName('IDBObjectStore.createIndex')
@DocsEditable()
@@ -990,7 +970,7 @@
@JSName('delete')
@DomName('IDBObjectStore.delete')
@DocsEditable()
- Request _delete(key_OR_keyRange) native;
+ Request _delete(Object key) native;
@DomName('IDBObjectStore.deleteIndex')
@DocsEditable()
@@ -1002,7 +982,7 @@
@Returns('Request')
@Creates('Request')
@annotation_Creates_SerializedScriptValue
- Request _get(key) native;
+ Request _get(Object key) native;
@DomName('IDBObjectStore.index')
@DocsEditable()
@@ -1014,7 +994,7 @@
@Returns('Request')
@Creates('Request')
@Creates('Cursor')
- Request _openCursor([key_OR_range, String direction]) native;
+ Request _openCursor(Object key, [String direction]) native;
@DomName('IDBObjectStore.put')
@DocsEditable()
diff --git a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
index 4612492..c21a6a4 100644
--- a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
+++ b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
@@ -394,12 +394,7 @@
@DomName('IDBIndex.count')
Future<int> count([key_OR_range]) {
try {
- var request;
- if (key_OR_range != null) {
- request = _count(key_OR_range);
- } else {
- request = _count();
- }
+ var request = _count(key_OR_range);
return _completeRequest(request);
} catch (e, stacktrace) {
return new Future.error(e, stacktrace);
@@ -446,12 +441,7 @@
} else {
key_OR_range = range;
}
- var request;
- if (direction == null) {
- request = _openCursor(key_OR_range);
- } else {
- request = _openCursor(key_OR_range, direction);
- }
+ var request = _openCursor(key_OR_range, direction);
return ObjectStore._cursorStreamFromResult(request, autoAdvance);
}
@@ -473,12 +463,7 @@
} else {
key_OR_range = range;
}
- var request;
- if (direction == null) {
- request = _openKeyCursor(key_OR_range);
- } else {
- request = _openKeyCursor(key_OR_range, direction);
- }
+ var request = _openKeyCursor(key_OR_range, direction);
return ObjectStore._cursorStreamFromResult(request, autoAdvance);
}
@@ -503,75 +488,25 @@
@DocsEditable()
bool get unique native "IDBIndex_unique_Getter";
- Request _count([key_OR_range]) {
- if ((key_OR_range is KeyRange || key_OR_range == null)) {
- return _count_1(key_OR_range);
- }
- if (key_OR_range != null) {
- return _count_2(key_OR_range);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
+ @DomName('IDBIndex.count')
+ @DocsEditable()
+ Request _count(Object key) native "IDBIndex_count_Callback";
- Request _count_1(key_OR_range) native "IDBIndex__count_1_Callback";
+ @DomName('IDBIndex.get')
+ @DocsEditable()
+ Request _get(Object key) native "IDBIndex_get_Callback";
- Request _count_2(key_OR_range) native "IDBIndex__count_2_Callback";
+ @DomName('IDBIndex.getKey')
+ @DocsEditable()
+ Request _getKey(Object key) native "IDBIndex_getKey_Callback";
- Request _get(key) {
- if ((key is KeyRange || key == null)) {
- return _get_1(key);
- }
- if (key != null) {
- return _get_2(key);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
+ @DomName('IDBIndex.openCursor')
+ @DocsEditable()
+ Request _openCursor(Object key, String direction) native "IDBIndex_openCursor_Callback";
- Request _get_1(key) native "IDBIndex__get_1_Callback";
-
- Request _get_2(key) native "IDBIndex__get_2_Callback";
-
- Request _getKey(key) {
- if ((key is KeyRange || key == null)) {
- return _getKey_1(key);
- }
- if (key != null) {
- return _getKey_2(key);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Request _getKey_1(key) native "IDBIndex__getKey_1_Callback";
-
- Request _getKey_2(key) native "IDBIndex__getKey_2_Callback";
-
- Request _openCursor([key_OR_range, String direction]) {
- if ((direction is String || direction == null) && (key_OR_range is KeyRange || key_OR_range == null)) {
- return _openCursor_1(key_OR_range, direction);
- }
- if ((direction is String || direction == null) && key_OR_range != null) {
- return _openCursor_2(key_OR_range, direction);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Request _openCursor_1(key_OR_range, direction) native "IDBIndex__openCursor_1_Callback";
-
- Request _openCursor_2(key_OR_range, direction) native "IDBIndex__openCursor_2_Callback";
-
- Request _openKeyCursor([key_OR_range, String direction]) {
- if ((direction is String || direction == null) && (key_OR_range is KeyRange || key_OR_range == null)) {
- return _openKeyCursor_1(key_OR_range, direction);
- }
- if ((direction is String || direction == null) && key_OR_range != null) {
- return _openKeyCursor_2(key_OR_range, direction);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Request _openKeyCursor_1(key_OR_range, direction) native "IDBIndex__openKeyCursor_1_Callback";
-
- Request _openKeyCursor_2(key_OR_range, direction) native "IDBIndex__openKeyCursor_2_Callback";
+ @DomName('IDBIndex.openKeyCursor')
+ @DocsEditable()
+ Request _openKeyCursor(Object key, String direction) native "IDBIndex_openKeyCursor_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -683,12 +618,7 @@
@DomName('IDBObjectStore.count')
Future<int> count([key_OR_range]) {
try {
- var request;
- if (key_OR_range != null) {
- request = _count(key_OR_range);
- } else {
- request = _count();
- }
+ var request = _count(key_OR_range);
return _completeRequest(request);
} catch (e, stacktrace) {
return new Future.error(e, stacktrace);
@@ -807,19 +737,9 @@
@DocsEditable()
Request _clear() native "IDBObjectStore_clear_Callback";
- Request _count([key_OR_range]) {
- if ((key_OR_range is KeyRange || key_OR_range == null)) {
- return _count_1(key_OR_range);
- }
- if (key_OR_range != null) {
- return _count_2(key_OR_range);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Request _count_1(key_OR_range) native "IDBObjectStore__count_1_Callback";
-
- Request _count_2(key_OR_range) native "IDBObjectStore__count_2_Callback";
+ @DomName('IDBObjectStore.count')
+ @DocsEditable()
+ Request _count(Object key) native "IDBObjectStore_count_Callback";
Index _createIndex(String name, keyPath, [Map options]) {
if ((options is Map || options == null) && (keyPath is List<String> || keyPath == null) && (name is String || name == null)) {
@@ -835,55 +755,25 @@
Index _createIndex_2(name, keyPath, options) native "IDBObjectStore__createIndex_2_Callback";
- Request _delete(key_OR_keyRange) {
- if ((key_OR_keyRange is KeyRange || key_OR_keyRange == null)) {
- return _delete_1(key_OR_keyRange);
- }
- if (key_OR_keyRange != null) {
- return _delete_2(key_OR_keyRange);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Request _delete_1(key_OR_keyRange) native "IDBObjectStore__delete_1_Callback";
-
- Request _delete_2(key_OR_keyRange) native "IDBObjectStore__delete_2_Callback";
+ @DomName('IDBObjectStore.delete')
+ @DocsEditable()
+ Request _delete(Object key) native "IDBObjectStore_delete_Callback";
@DomName('IDBObjectStore.deleteIndex')
@DocsEditable()
void deleteIndex(String name) native "IDBObjectStore_deleteIndex_Callback";
- Request _get(key) {
- if ((key is KeyRange || key == null)) {
- return _get_1(key);
- }
- if (key != null) {
- return _get_2(key);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Request _get_1(key) native "IDBObjectStore__get_1_Callback";
-
- Request _get_2(key) native "IDBObjectStore__get_2_Callback";
+ @DomName('IDBObjectStore.get')
+ @DocsEditable()
+ Request _get(Object key) native "IDBObjectStore_get_Callback";
@DomName('IDBObjectStore.index')
@DocsEditable()
Index index(String name) native "IDBObjectStore_index_Callback";
- Request _openCursor([key_OR_range, String direction]) {
- if ((direction is String || direction == null) && (key_OR_range is KeyRange || key_OR_range == null)) {
- return _openCursor_1(key_OR_range, direction);
- }
- if ((direction is String || direction == null) && key_OR_range != null) {
- return _openCursor_2(key_OR_range, direction);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- Request _openCursor_1(key_OR_range, direction) native "IDBObjectStore__openCursor_1_Callback";
-
- Request _openCursor_2(key_OR_range, direction) native "IDBObjectStore__openCursor_2_Callback";
+ @DomName('IDBObjectStore.openCursor')
+ @DocsEditable()
+ Request _openCursor(Object key, [String direction]) native "IDBObjectStore_openCursor_Callback";
@DomName('IDBObjectStore.put')
@DocsEditable()
diff --git a/sdk/lib/io/io.dart b/sdk/lib/io/io.dart
index e390d31..c44f101 100644
--- a/sdk/lib/io/io.dart
+++ b/sdk/lib/io/io.dart
@@ -21,7 +21,6 @@
LinkedListEntry;
import 'dart:convert';
import 'dart:isolate';
-import 'dart:json' as JSON;
import 'dart:math';
import 'dart:typed_data';
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index f85ddf2..b13709c 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -866,7 +866,8 @@
_outCloseReason = reason;
_writeClosed = true;
}
- return _sink.close();
+ if (!(_sink as _StreamSinkImpl)._isBound) _sink.close();
+ return _sink.done;
}
static bool _isReservedStatusCode(int code) {
diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart
index 5f9788b..2ec2c0e 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -211,7 +211,8 @@
switch (result[0]) {
case 'return': return _deserialize(result[1]);
case 'throws': throw _deserialize(result[1]);
- case 'none': throw new NoSuchMethodError(receiver, member, args, {});
+ case 'none':
+ throw new NoSuchMethodError(receiver, new Symbol(member), args, {});
default: throw 'Invalid return value';
}
}
diff --git a/sdk/lib/json/json.dart b/sdk/lib/json/json.dart
index efc2621..8bd8ab2 100644
--- a/sdk/lib/json/json.dart
+++ b/sdk/lib/json/json.dart
@@ -463,7 +463,8 @@
}
char = source.codeUnitAt(position);
if (char == QUOTE) {
- listener.handleString(source.substring(start, position));
+ String result = source.substring(start, position);
+ listener.handleString(result);
return position + 1;
}
if (char < SPACE) {
diff --git a/sdk/lib/mirrors/mirrors.dart b/sdk/lib/mirrors/mirrors.dart
index 4e96d84..313026f 100644
--- a/sdk/lib/mirrors/mirrors.dart
+++ b/sdk/lib/mirrors/mirrors.dart
@@ -219,11 +219,15 @@
* computed by [simpleName].
* The fully qualified name of *r* is the
* concatenation of *p*, '.', and *s*.
+ *
+ * Because an isolate can contain more than one library with the same name (at
+ * different URIs), a fully-qualified name does not uniquely identify any
+ * language entity.
*/
Symbol get qualifiedName;
/**
- * A mirror on the owner of this function. This is the declaration
+ * A mirror on the owner of this Dart language entity. This is the declaration
* immediately surrounding the reflectee.
*
* For a library, the owner is [:null:].
diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart
index 7d4f71b..2222b2e 100644
--- a/sdk/lib/svg/dart2js/svg_dart2js.dart
+++ b/sdk/lib/svg/dart2js/svg_dart2js.dart
@@ -5,7 +5,7 @@
import 'dart:_collection-dev' hide deprecated;
import 'dart:html';
import 'dart:html_common';
-import 'dart:_js_helper' show Creates, Returns, JavaScriptIndexingBehavior, JSName;
+import 'dart:_js_helper' show Creates, Returns, JSName;
import 'dart:_foreign_helper' show JS;
import 'dart:_interceptors' show Interceptor;
// DO NOT EDIT - unless you are editing documentation as per:
@@ -336,7 +336,7 @@
@DomName('SVGAnimatedNumber.animVal')
@DocsEditable()
- final num animVal;
+ final double animVal;
@DomName('SVGAnimatedNumber.baseVal')
@DocsEditable()
@@ -470,15 +470,15 @@
@DomName('SVGAnimationElement.getCurrentTime')
@DocsEditable()
- num getCurrentTime() native;
+ double getCurrentTime() native;
@DomName('SVGAnimationElement.getSimpleDuration')
@DocsEditable()
- num getSimpleDuration() native;
+ double getSimpleDuration() native;
@DomName('SVGAnimationElement.getStartTime')
@DocsEditable()
- num getStartTime() native;
+ double getStartTime() native;
// From SVGExternalResourcesRequired
@@ -2759,7 +2759,7 @@
@DocsEditable()
@DomName('SVGLengthList')
@Unstable()
-class LengthList extends Interceptor with ListMixin<Length>, ImmutableListMixin<Length> implements JavaScriptIndexingBehavior, List<Length> native "SVGLengthList" {
+class LengthList extends Interceptor with ListMixin<Length>, ImmutableListMixin<Length> implements List<Length> native "SVGLengthList" {
@DomName('SVGLengthList.numberOfItems')
@DocsEditable()
@@ -3177,7 +3177,7 @@
@DocsEditable()
@DomName('SVGNumberList')
@Unstable()
-class NumberList extends Interceptor with ListMixin<Number>, ImmutableListMixin<Number> implements JavaScriptIndexingBehavior, List<Number> native "SVGNumberList" {
+class NumberList extends Interceptor with ListMixin<Number>, ImmutableListMixin<Number> implements List<Number> native "SVGNumberList" {
@DomName('SVGNumberList.numberOfItems')
@DocsEditable()
@@ -3398,7 +3398,7 @@
@DomName('SVGPathElement.getTotalLength')
@DocsEditable()
- num getTotalLength() native;
+ double getTotalLength() native;
// From SVGExternalResourcesRequired
@@ -3932,7 +3932,7 @@
@DocsEditable()
@DomName('SVGPathSegList')
@Unstable()
-class PathSegList extends Interceptor with ListMixin<PathSeg>, ImmutableListMixin<PathSeg> implements JavaScriptIndexingBehavior, List<PathSeg> native "SVGPathSegList" {
+class PathSegList extends Interceptor with ListMixin<PathSeg>, ImmutableListMixin<PathSeg> implements List<PathSeg> native "SVGPathSegList" {
@DomName('SVGPathSegList.numberOfItems')
@DocsEditable()
@@ -4563,7 +4563,7 @@
@DocsEditable()
@DomName('SVGStringList')
@Unstable()
-class StringList extends Interceptor with ListMixin<String>, ImmutableListMixin<String> implements JavaScriptIndexingBehavior, List<String> native "SVGStringList" {
+class StringList extends Interceptor with ListMixin<String>, ImmutableListMixin<String> implements List<String> native "SVGStringList" {
@DomName('SVGStringList.numberOfItems')
@DocsEditable()
@@ -4923,19 +4923,19 @@
@DomName('SVGSVGElement.pixelUnitToMillimeterX')
@DocsEditable()
- final num pixelUnitToMillimeterX;
+ final double pixelUnitToMillimeterX;
@DomName('SVGSVGElement.pixelUnitToMillimeterY')
@DocsEditable()
- final num pixelUnitToMillimeterY;
+ final double pixelUnitToMillimeterY;
@DomName('SVGSVGElement.screenPixelToMillimeterX')
@DocsEditable()
- final num screenPixelToMillimeterX;
+ final double screenPixelToMillimeterX;
@DomName('SVGSVGElement.screenPixelToMillimeterY')
@DocsEditable()
- final num screenPixelToMillimeterY;
+ final double screenPixelToMillimeterY;
@DomName('SVGSVGElement.useCurrentView')
@DocsEditable()
@@ -5019,7 +5019,7 @@
@DomName('SVGSVGElement.getCurrentTime')
@DocsEditable()
- num getCurrentTime() native;
+ double getCurrentTime() native;
@DomName('SVGSVGElement.getElementById')
@DocsEditable()
@@ -5210,7 +5210,7 @@
@DomName('SVGTextContentElement.getComputedTextLength')
@DocsEditable()
- num getComputedTextLength() native;
+ double getComputedTextLength() native;
@DomName('SVGTextContentElement.getEndPositionOfChar')
@DocsEditable()
@@ -5226,7 +5226,7 @@
@DomName('SVGTextContentElement.getRotationOfChar')
@DocsEditable()
- num getRotationOfChar(int offset) native;
+ double getRotationOfChar(int offset) native;
@DomName('SVGTextContentElement.getStartPositionOfChar')
@DocsEditable()
@@ -5234,7 +5234,7 @@
@DomName('SVGTextContentElement.getSubStringLength')
@DocsEditable()
- num getSubStringLength(int offset, int length) native;
+ double getSubStringLength(int offset, int length) native;
@DomName('SVGTextContentElement.selectSubString')
@DocsEditable()
@@ -5404,7 +5404,7 @@
@DomName('SVGTransform.angle')
@DocsEditable()
- final num angle;
+ final double angle;
@DomName('SVGTransform.matrix')
@DocsEditable()
@@ -5446,7 +5446,7 @@
@DocsEditable()
@DomName('SVGTransformList')
@Unstable()
-class TransformList extends Interceptor with ListMixin<Transform>, ImmutableListMixin<Transform> implements List<Transform>, JavaScriptIndexingBehavior native "SVGTransformList" {
+class TransformList extends Interceptor with ListMixin<Transform>, ImmutableListMixin<Transform> implements List<Transform> native "SVGTransformList" {
@DomName('SVGTransformList.numberOfItems')
@DocsEditable()
@@ -5770,7 +5770,7 @@
@DomName('SVGZoomEvent.newScale')
@DocsEditable()
- final num newScale;
+ final double newScale;
@DomName('SVGZoomEvent.newTranslate')
@DocsEditable()
@@ -5778,7 +5778,7 @@
@DomName('SVGZoomEvent.previousScale')
@DocsEditable()
- final num previousScale;
+ final double previousScale;
@DomName('SVGZoomEvent.previousTranslate')
@DocsEditable()
@@ -5796,7 +5796,7 @@
@DocsEditable()
@DomName('SVGElementInstanceList')
@Unstable()
-class _ElementInstanceList extends Interceptor with ListMixin<ElementInstance>, ImmutableListMixin<ElementInstance> implements JavaScriptIndexingBehavior, List<ElementInstance> native "SVGElementInstanceList" {
+class _ElementInstanceList extends Interceptor with ListMixin<ElementInstance>, ImmutableListMixin<ElementInstance> implements List<ElementInstance> native "SVGElementInstanceList" {
@DomName('SVGElementInstanceList.length')
@DocsEditable()
diff --git a/sdk/lib/svg/dartium/svg_dartium.dart b/sdk/lib/svg/dartium/svg_dartium.dart
index e9d3b1e..228c9a8 100644
--- a/sdk/lib/svg/dartium/svg_dartium.dart
+++ b/sdk/lib/svg/dartium/svg_dartium.dart
@@ -397,7 +397,7 @@
@DomName('SVGAnimatedNumber.animVal')
@DocsEditable()
- num get animVal native "SVGAnimatedNumber_animVal_Getter";
+ double get animVal native "SVGAnimatedNumber_animVal_Getter";
@DomName('SVGAnimatedNumber.baseVal')
@DocsEditable()
@@ -557,15 +557,15 @@
@DomName('SVGAnimationElement.getCurrentTime')
@DocsEditable()
- num getCurrentTime() native "SVGAnimationElement_getCurrentTime_Callback";
+ double getCurrentTime() native "SVGAnimationElement_getCurrentTime_Callback";
@DomName('SVGAnimationElement.getSimpleDuration')
@DocsEditable()
- num getSimpleDuration() native "SVGAnimationElement_getSimpleDuration_Callback";
+ double getSimpleDuration() native "SVGAnimationElement_getSimpleDuration_Callback";
@DomName('SVGAnimationElement.getStartTime')
@DocsEditable()
- num getStartTime() native "SVGAnimationElement_getStartTime_Callback";
+ double getStartTime() native "SVGAnimationElement_getStartTime_Callback";
@DomName('SVGAnimationElement.externalResourcesRequired')
@DocsEditable()
@@ -3608,7 +3608,7 @@
@DomName('SVGPathElement.getTotalLength')
@DocsEditable()
- num getTotalLength() native "SVGPathElement_getTotalLength_Callback";
+ double getTotalLength() native "SVGPathElement_getTotalLength_Callback";
@DomName('SVGPathElement.externalResourcesRequired')
@DocsEditable()
@@ -5538,19 +5538,19 @@
@DomName('SVGSVGElement.pixelUnitToMillimeterX')
@DocsEditable()
- num get pixelUnitToMillimeterX native "SVGSVGElement_pixelUnitToMillimeterX_Getter";
+ double get pixelUnitToMillimeterX native "SVGSVGElement_pixelUnitToMillimeterX_Getter";
@DomName('SVGSVGElement.pixelUnitToMillimeterY')
@DocsEditable()
- num get pixelUnitToMillimeterY native "SVGSVGElement_pixelUnitToMillimeterY_Getter";
+ double get pixelUnitToMillimeterY native "SVGSVGElement_pixelUnitToMillimeterY_Getter";
@DomName('SVGSVGElement.screenPixelToMillimeterX')
@DocsEditable()
- num get screenPixelToMillimeterX native "SVGSVGElement_screenPixelToMillimeterX_Getter";
+ double get screenPixelToMillimeterX native "SVGSVGElement_screenPixelToMillimeterX_Getter";
@DomName('SVGSVGElement.screenPixelToMillimeterY')
@DocsEditable()
- num get screenPixelToMillimeterY native "SVGSVGElement_screenPixelToMillimeterY_Getter";
+ double get screenPixelToMillimeterY native "SVGSVGElement_screenPixelToMillimeterY_Getter";
@DomName('SVGSVGElement.useCurrentView')
@DocsEditable()
@@ -5626,7 +5626,7 @@
@DomName('SVGSVGElement.getCurrentTime')
@DocsEditable()
- num getCurrentTime() native "SVGSVGElement_getCurrentTime_Callback";
+ double getCurrentTime() native "SVGSVGElement_getCurrentTime_Callback";
@DomName('SVGSVGElement.getElementById')
@DocsEditable()
@@ -5827,7 +5827,7 @@
@DomName('SVGTextContentElement.getComputedTextLength')
@DocsEditable()
- num getComputedTextLength() native "SVGTextContentElement_getComputedTextLength_Callback";
+ double getComputedTextLength() native "SVGTextContentElement_getComputedTextLength_Callback";
@DomName('SVGTextContentElement.getEndPositionOfChar')
@DocsEditable()
@@ -5843,7 +5843,7 @@
@DomName('SVGTextContentElement.getRotationOfChar')
@DocsEditable()
- num getRotationOfChar(int offset) native "SVGTextContentElement_getRotationOfChar_Callback";
+ double getRotationOfChar(int offset) native "SVGTextContentElement_getRotationOfChar_Callback";
@DomName('SVGTextContentElement.getStartPositionOfChar')
@DocsEditable()
@@ -5851,7 +5851,7 @@
@DomName('SVGTextContentElement.getSubStringLength')
@DocsEditable()
- num getSubStringLength(int offset, int length) native "SVGTextContentElement_getSubStringLength_Callback";
+ double getSubStringLength(int offset, int length) native "SVGTextContentElement_getSubStringLength_Callback";
@DomName('SVGTextContentElement.selectSubString')
@DocsEditable()
@@ -6032,7 +6032,7 @@
@DomName('SVGTransform.angle')
@DocsEditable()
- num get angle native "SVGTransform_angle_Getter";
+ double get angle native "SVGTransform_angle_Getter";
@DomName('SVGTransform.matrix')
@DocsEditable()
@@ -6424,7 +6424,7 @@
@DomName('SVGZoomEvent.newScale')
@DocsEditable()
- num get newScale native "SVGZoomEvent_newScale_Getter";
+ double get newScale native "SVGZoomEvent_newScale_Getter";
@DomName('SVGZoomEvent.newTranslate')
@DocsEditable()
@@ -6432,7 +6432,7 @@
@DomName('SVGZoomEvent.previousScale')
@DocsEditable()
- num get previousScale native "SVGZoomEvent_previousScale_Getter";
+ double get previousScale native "SVGZoomEvent_previousScale_Getter";
@DomName('SVGZoomEvent.previousTranslate')
@DocsEditable()
diff --git a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
index c72a299..5933b2e 100644
--- a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
+++ b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
@@ -11,7 +11,7 @@
import 'dart:collection';
import 'dart:_collection-dev';
import 'dart:_js_helper' show Creates, JavaScriptIndexingBehavior, JSName, Null, Returns;
-import 'dart:_foreign_helper' show JS;
+import 'dart:_foreign_helper' show JS, JS_CONST;
import 'dart:math' as Math;
/**
@@ -35,6 +35,17 @@
final int lengthInBytes;
}
+// TODO(12929): Remove this constant once V8 optimizes length access of
+// typed arrays. Firefox does not like accessing a named property of a
+// typed array, so we only use the new [:$dartCachedLength:] property in V8 and
+// Chrome.
+const fetchLength = const JS_CONST(r'''
+ ((typeof version == "function" && typeof os == "object" && "system" in os)
+ || (typeof navigator == "object"
+ && navigator.userAgent.indexOf('Chrome') != -1))
+ ? function(x) { return x.$dartCachedLength || x.length; }
+ : function(x) { return x.length; };
+''');
class TypedData native "ArrayBufferView" {
@Creates('ByteBuffer')
@@ -64,6 +75,12 @@
}
}
+ // TODO(12929): Remove this method once V8 optimizes length access of
+ // typed arrays.
+ void _setCachedLength() {
+ JS('void', r'#.$dartCachedLength = #.length', this, this);
+ }
+
int _checkSublistArguments(int start, int end, int length) {
// For `sublist` the [start] and [end] indices are allowed to be equal to
// [length]. However, [_checkIndex] only allows incides in the range
@@ -197,13 +214,14 @@
void setUint8(int byteOffset, int value) native;
static ByteData _create1(arg) =>
- JS('ByteData', 'new DataView(new ArrayBuffer(#))', arg);
+ JS('ByteData', 'new DataView(new ArrayBuffer(#))', arg).._setCachedLength();
static ByteData _create2(arg1, arg2) =>
- JS('ByteData', 'new DataView(#, #)', arg1, arg2);
+ JS('ByteData', 'new DataView(#, #)', arg1, arg2).._setCachedLength();
static ByteData _create3(arg1, arg2, arg3) =>
- JS('ByteData', 'new DataView(#, #, #)', arg1, arg2, arg3);
+ JS('ByteData', 'new DataView(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -224,7 +242,7 @@
static const int BYTES_PER_ELEMENT = 4;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
num operator[](int index) {
_checkIndex(index, length);
@@ -239,17 +257,20 @@
List<double> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
var source = JS('Float32List', '#.subarray(#, #)', this, start, end);
+ source._setCachedLength();
return _create1(source);
}
static Float32List _create1(arg) =>
- JS('Float32List', 'new Float32Array(#)', arg);
+ JS('Float32List', 'new Float32Array(#)', arg).._setCachedLength();
static Float32List _create2(arg1, arg2) =>
- JS('Float32List', 'new Float32Array(#, #)', arg1, arg2);
+ JS('Float32List', 'new Float32Array(#, #)', arg1, arg2)
+ .._setCachedLength();
static Float32List _create3(arg1, arg2, arg3) =>
- JS('Float32List', 'new Float32Array(#, #, #)', arg1, arg2, arg3);
+ JS('Float32List', 'new Float32Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -270,7 +291,7 @@
static const int BYTES_PER_ELEMENT = 8;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
num operator[](int index) {
_checkIndex(index, length);
@@ -285,17 +306,23 @@
List<double> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
var source = JS('Float64List', '#.subarray(#, #)', this, start, end);
+ source._setCachedLength();
return _create1(source);
}
- static Float64List _create1(arg) =>
- JS('Float64List', 'new Float64Array(#)', arg);
+ static Float64List _create1(arg) {
+ return JS('Float64List', 'new Float64Array(#)', arg).._setCachedLength();
+ }
- static Float64List _create2(arg1, arg2) =>
- JS('Float64List', 'new Float64Array(#, #)', arg1, arg2);
+ static Float64List _create2(arg1, arg2) {
+ return JS('Float64List', 'new Float64Array(#, #)', arg1, arg2)
+ .._setCachedLength();
+ }
- static Float64List _create3(arg1, arg2, arg3) =>
- JS('Float64List', 'new Float64Array(#, #, #)', arg1, arg2, arg3);
+ static Float64List _create3(arg1, arg2, arg3) {
+ return JS('Float64List', 'new Float64Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
+ }
}
@@ -315,7 +342,7 @@
static const int BYTES_PER_ELEMENT = 2;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
int operator[](int index) {
_checkIndex(index, length);
@@ -329,18 +356,20 @@
List<int> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
- var source = JS('Int16List', '#.subarray(#, #)', this, start, end);
+ var source = JS('Int16List', '#.subarray(#, #)', this, start, end)
+ .._setCachedLength();
return _create1(source);
}
static Int16List _create1(arg) =>
- JS('Int16List', 'new Int16Array(#)', arg);
+ JS('Int16List', 'new Int16Array(#)', arg).._setCachedLength();
static Int16List _create2(arg1, arg2) =>
- JS('Int16List', 'new Int16Array(#, #)', arg1, arg2);
+ JS('Int16List', 'new Int16Array(#, #)', arg1, arg2).._setCachedLength();
static Int16List _create3(arg1, arg2, arg3) =>
- JS('Int16List', 'new Int16Array(#, #, #)', arg1, arg2, arg3);
+ JS('Int16List', 'new Int16Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -360,7 +389,7 @@
static const int BYTES_PER_ELEMENT = 4;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
int operator[](int index) {
_checkIndex(index, length);
@@ -374,18 +403,20 @@
List<int> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
- var source = JS('Int32List', '#.subarray(#, #)', this, start, end);
+ var source = JS('Int32List', '#.subarray(#, #)', this, start, end)
+ .._setCachedLength();
return _create1(source);
}
static Int32List _create1(arg) =>
- JS('Int32List', 'new Int32Array(#)', arg);
+ JS('Int32List', 'new Int32Array(#)', arg).._setCachedLength();
static Int32List _create2(arg1, arg2) =>
- JS('Int32List', 'new Int32Array(#, #)', arg1, arg2);
+ JS('Int32List', 'new Int32Array(#, #)', arg1, arg2).._setCachedLength();
static Int32List _create3(arg1, arg2, arg3) =>
- JS('Int32List', 'new Int32Array(#, #, #)', arg1, arg2, arg3);
+ JS('Int32List', 'new Int32Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -405,7 +436,7 @@
static const int BYTES_PER_ELEMENT = 1;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
int operator[](int index) {
_checkIndex(index, length);
@@ -419,18 +450,20 @@
List<int> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
- var source = JS('Int8List', '#.subarray(#, #)', this, start, end);
+ var source = JS('Int8List', '#.subarray(#, #)', this, start, end)
+ .._setCachedLength();
return _create1(source);
}
static Int8List _create1(arg) =>
- JS('Int8List', 'new Int8Array(#)', arg);
+ JS('Int8List', 'new Int8Array(#)', arg).._setCachedLength();
static Int8List _create2(arg1, arg2) =>
- JS('Int8List', 'new Int8Array(#, #)', arg1, arg2);
+ JS('Int8List', 'new Int8Array(#, #)', arg1, arg2).._setCachedLength();
static Int8List _create3(arg1, arg2, arg3) =>
- JS('Int8List', 'new Int8Array(#, #, #)', arg1, arg2, arg3);
+ JS('Int8List', 'new Int8Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -451,7 +484,7 @@
static const int BYTES_PER_ELEMENT = 2;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
int operator[](int index) {
_checkIndex(index, length);
@@ -465,18 +498,20 @@
List<int> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
- var source = JS('Uint16List', '#.subarray(#, #)', this, start, end);
+ var source = JS('Uint16List', '#.subarray(#, #)', this, start, end)
+ .._setCachedLength();
return _create1(source);
}
static Uint16List _create1(arg) =>
- JS('Uint16List', 'new Uint16Array(#)', arg);
+ JS('Uint16List', 'new Uint16Array(#)', arg).._setCachedLength();
static Uint16List _create2(arg1, arg2) =>
- JS('Uint16List', 'new Uint16Array(#, #)', arg1, arg2);
+ JS('Uint16List', 'new Uint16Array(#, #)', arg1, arg2).._setCachedLength();
static Uint16List _create3(arg1, arg2, arg3) =>
- JS('Uint16List', 'new Uint16Array(#, #, #)', arg1, arg2, arg3);
+ JS('Uint16List', 'new Uint16Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -497,7 +532,7 @@
static const int BYTES_PER_ELEMENT = 4;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
int operator[](int index) {
_checkIndex(index, length);
@@ -511,18 +546,20 @@
List<int> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
- var source = JS('Uint32List', '#.subarray(#, #)', this, start, end);
+ var source = JS('Uint32List', '#.subarray(#, #)', this, start, end)
+ .._setCachedLength();
return _create1(source);
}
static Uint32List _create1(arg) =>
- JS('Uint32List', 'new Uint32Array(#)', arg);
+ JS('Uint32List', 'new Uint32Array(#)', arg).._setCachedLength();
static Uint32List _create2(arg1, arg2) =>
- JS('Uint32List', 'new Uint32Array(#, #)', arg1, arg2);
+ JS('Uint32List', 'new Uint32Array(#, #)', arg1, arg2).._setCachedLength();
static Uint32List _create3(arg1, arg2, arg3) =>
- JS('Uint32List', 'new Uint32Array(#, #, #)', arg1, arg2, arg3);
+ JS('Uint32List', 'new Uint32Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -556,18 +593,22 @@
List<int> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
- var source = JS('Uint8ClampedList', '#.subarray(#, #)', this, start, end);
+ var source = JS('Uint8ClampedList', '#.subarray(#, #)', this, start, end)
+ .._setCachedLength();
return _create1(source);
}
static Uint8ClampedList _create1(arg) =>
- JS('Uint8ClampedList', 'new Uint8ClampedArray(#)', arg);
+ JS('Uint8ClampedList', 'new Uint8ClampedArray(#)', arg)
+ .._setCachedLength();
static Uint8ClampedList _create2(arg1, arg2) =>
- JS('Uint8ClampedList', 'new Uint8ClampedArray(#, #)', arg1, arg2);
+ JS('Uint8ClampedList', 'new Uint8ClampedArray(#, #)', arg1, arg2)
+ .._setCachedLength();
static Uint8ClampedList _create3(arg1, arg2, arg3) =>
- JS('Uint8ClampedList', 'new Uint8ClampedArray(#, #, #)', arg1, arg2, arg3);
+ JS('Uint8ClampedList', 'new Uint8ClampedArray(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
@@ -588,7 +629,7 @@
static const int BYTES_PER_ELEMENT = 1;
- int get length => JS("int", "#.length", this);
+ int get length => JS("int", '#(#)', fetchLength, this);
int operator[](int index) {
_checkIndex(index, length);
@@ -602,18 +643,20 @@
List<int> sublist(int start, [int end]) {
end = _checkSublistArguments(start, end, length);
- var source = JS('Uint8List', '#.subarray(#, #)', this, start, end);
+ var source = JS('Uint8List', '#.subarray(#, #)', this, start, end)
+ .._setCachedLength();
return _create1(source);
}
static Uint8List _create1(arg) =>
- JS('Uint8List', 'new Uint8Array(#)', arg);
+ JS('Uint8List', 'new Uint8Array(#)', arg).._setCachedLength();
static Uint8List _create2(arg1, arg2) =>
- JS('Uint8List', 'new Uint8Array(#, #)', arg1, arg2);
+ JS('Uint8List', 'new Uint8Array(#, #)', arg1, arg2).._setCachedLength();
static Uint8List _create3(arg1, arg2, arg3) =>
- JS('Uint8List', 'new Uint8Array(#, #, #)', arg1, arg2, arg3);
+ JS('Uint8List', 'new Uint8Array(#, #, #)', arg1, arg2, arg3)
+ .._setCachedLength();
}
diff --git a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
index 7c85f1d..1b1d0db 100644
--- a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
+++ b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
@@ -77,7 +77,7 @@
@DomName('AudioBuffer.duration')
@DocsEditable()
- final num duration;
+ final double duration;
@DomName('AudioBuffer.gain')
@DocsEditable()
@@ -93,7 +93,7 @@
@DomName('AudioBuffer.sampleRate')
@DocsEditable()
- final num sampleRate;
+ final double sampleRate;
@DomName('AudioBuffer.getChannelData')
@DocsEditable()
@@ -244,7 +244,7 @@
@DomName('AudioContext.currentTime')
@DocsEditable()
- final num currentTime;
+ final double currentTime;
@DomName('AudioContext.destination')
@DocsEditable()
@@ -256,7 +256,7 @@
@DomName('AudioContext.sampleRate')
@DocsEditable()
- final num sampleRate;
+ final double sampleRate;
@DomName('AudioContext.createAnalyser')
@DocsEditable()
@@ -505,15 +505,15 @@
@DomName('AudioParam.defaultValue')
@DocsEditable()
- final num defaultValue;
+ final double defaultValue;
@DomName('AudioParam.maxValue')
@DocsEditable()
- final num maxValue;
+ final double maxValue;
@DomName('AudioParam.minValue')
@DocsEditable()
- final num minValue;
+ final double minValue;
@DomName('AudioParam.name')
@DocsEditable()
diff --git a/sdk/lib/web_audio/dartium/web_audio_dartium.dart b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
index cd8b0b9..f925e65 100644
--- a/sdk/lib/web_audio/dartium/web_audio_dartium.dart
+++ b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
@@ -92,7 +92,7 @@
@DomName('AudioBuffer.duration')
@DocsEditable()
- num get duration native "AudioBuffer_duration_Getter";
+ double get duration native "AudioBuffer_duration_Getter";
@DomName('AudioBuffer.gain')
@DocsEditable()
@@ -112,7 +112,7 @@
@DomName('AudioBuffer.sampleRate')
@DocsEditable()
- num get sampleRate native "AudioBuffer_sampleRate_Getter";
+ double get sampleRate native "AudioBuffer_sampleRate_Getter";
@DomName('AudioBuffer.getChannelData')
@DocsEditable()
@@ -286,7 +286,7 @@
@DomName('AudioContext.currentTime')
@DocsEditable()
- num get currentTime native "AudioContext_currentTime_Getter";
+ double get currentTime native "AudioContext_currentTime_Getter";
@DomName('AudioContext.destination')
@DocsEditable()
@@ -298,7 +298,7 @@
@DomName('AudioContext.sampleRate')
@DocsEditable()
- num get sampleRate native "AudioContext_sampleRate_Getter";
+ double get sampleRate native "AudioContext_sampleRate_Getter";
@DomName('AudioContext.createAnalyser')
@DocsEditable()
@@ -642,15 +642,15 @@
@DomName('AudioParam.defaultValue')
@DocsEditable()
- num get defaultValue native "AudioParam_defaultValue_Getter";
+ double get defaultValue native "AudioParam_defaultValue_Getter";
@DomName('AudioParam.maxValue')
@DocsEditable()
- num get maxValue native "AudioParam_maxValue_Getter";
+ double get maxValue native "AudioParam_maxValue_Getter";
@DomName('AudioParam.minValue')
@DocsEditable()
- num get minValue native "AudioParam_minValue_Getter";
+ double get minValue native "AudioParam_minValue_Getter";
@DomName('AudioParam.name')
@DocsEditable()
diff --git a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
index 57a3f17..dc61a62 100644
--- a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
+++ b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
@@ -15,7 +15,7 @@
import 'dart:_collection-dev' hide deprecated;
import 'dart:html';
import 'dart:html_common';
-import 'dart:_js_helper' show convertDartClosureToJS, Creates, JavaScriptIndexingBehavior, JSName;
+import 'dart:_js_helper' show convertDartClosureToJS, Creates, JSName;
import 'dart:_foreign_helper' show JS;
import 'dart:_interceptors' show Interceptor;
// DO NOT EDIT - unless you are editing documentation as per:
@@ -197,7 +197,7 @@
@DomName('SQLResultSetRowList')
// http://www.w3.org/TR/webdatabase/#sqlresultsetrowlist
@Experimental() // deprecated
-class SqlResultSetRowList extends Interceptor with ListMixin<Map>, ImmutableListMixin<Map> implements JavaScriptIndexingBehavior, List<Map> native "SQLResultSetRowList" {
+class SqlResultSetRowList extends Interceptor with ListMixin<Map>, ImmutableListMixin<Map> implements List<Map> native "SQLResultSetRowList" {
@DomName('SQLResultSetRowList.length')
@DocsEditable()
diff --git a/tests/async_helper.dart b/tests/async_helper.dart
deleted file mode 100644
index f1a84b3..0000000
--- a/tests/async_helper.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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.
-
-/// This library is used for testing asynchronous tests.
-/// If a test is asynchronous, it needs to notify the testing driver
-/// about this (otherwise tests may get reported as passing [after main()
-/// finished] even if the asynchronous operations fail).
-/// Tests which can't use the unittest framework should use the helper functions
-/// in this library.
-/// This library provides two methods
-/// - asyncStart(): Needs to be called before an asynchronous operation is
-/// scheduled.
-/// - asyncEnd(): Needs to be called as soon as the asynchronous operation
-/// ended.
-/// After the last asyncStart() called was matched with a corresponding
-/// asyncEnd() call, the testing driver will be notified that the tests is done.
-
-library async_helper;
-
-// TODO(kustermann): This is problematic because we rely on a working
-// 'dart:isolate' (i.e. it is in particular problematic with dart2js).
-// It would be nice if we could use a different mechanism for different
-// runtimes.
-import 'dart:isolate';
-
-bool _initialized = false;
-ReceivePort _port = null;
-int _asyncLevel = 0;
-
-Exception _buildException(String msg) {
- return new Exception('Fatal: $msg. This is most likely a bug in your test.');
-}
-
-void asyncStart() {
- if (_initialized && _asyncLevel == 0) {
- throw _buildException('asyncStart() was called even though we are done '
- 'with testing.');
- }
- if (!_initialized) {
- print('unittest-suite-wait-for-done');
- _initialized = true;
- _port = new ReceivePort();
- }
- _asyncLevel++;
-}
-
-void asyncEnd() {
- if (_asyncLevel <= 0) {
- if (!_initialized) {
- throw _buildException('asyncEnd() was called before asyncStart().');
- } else {
- throw _buildException('asyncEnd() was called more often than '
- 'asyncStart().');
- }
- }
- _asyncLevel--;
- if (_asyncLevel == 0) {
- _port.close();
- _port = null;
- print('unittest-suite-success');
- }
-}
diff --git a/tests/co19/co19-analyzer.status b/tests/co19/co19-analyzer.status
index 014c34f..6984c32 100644
--- a/tests/co19/co19-analyzer.status
+++ b/tests/co19/co19-analyzer.status
@@ -25,13 +25,17 @@
# TBF: infinite look: class A {const A();final m = const A();}
Language/12_Expressions/01_Constants_A17_t03: fail
+# analyzer issue https://code.google.com/p/dart/issues/detail?id=11534
+Language/15_Types/4_Interface_Types_A11_t01: Skip
+Language/15_Types/4_Interface_Types_A11_t02: Skip
+
+
+
+
# co19 issue #380, Strings class has been removed
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A03_t01: fail, OK
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A04_t01: fail, OK
-# co19 issue #397, List.addLast removed
-LibTest/core/Iterable/where_A01_t07: fail, OK
-
# co19 issue #400, collection library reorg
LibTest/core/String/String_class_A01_t01: fail, OK
LibTest/core/String/concat_A01_t01: fail, OK
@@ -40,15 +44,6 @@
LibTest/core/Set/isSubsetOf_A01_t01: fail, OK
LibTest/core/Set/isSubsetOf_A01_t02: fail, OK
-# co19 issue #403
-LibTest/core/List/every_A01_t01: fail, OK
-
-# co19 issue #414, extra @compile-error
-Language/03_Overview/1_Scoping_A02_t28: fail, OK
-
-# co19 issue #416, function name is declared the parameter scope
-Language/03_Overview/1_Scoping_A02_t07: fail, OK
-
# co19 issue #424, Uninitialized finals are warnings not errors
Language/05_Variables/05_Variables_A07_t05: fail, OK
Language/05_Variables/05_Variables_A07_t06: fail, OK
@@ -94,10 +89,6 @@
# co19 issue #448, Collection was removed
LibTest/collection/Queue/Queue.from_A01_t01: fail, OK
LibTest/collection/Queue/Queue.from_A01_t02: fail, OK
-LibTest/core/List/List.from_A01_t01: fail, OK
-LibTest/core/Match/pattern_A01_t01: fail, OK
-LibTest/core/Match/str_A01_t01: fail, OK
-LibTest/core/RegExp/allMatches_A01_t01: fail, OK
LibTest/core/Set/intersection_A01_t02: fail, OK
# co19 issue 452, more method in Iterable
@@ -109,26 +100,6 @@
Language/14_Libraries_and_Scripts/1_Imports_A02_t12: fail, OK
Language/14_Libraries_and_Scripts/1_Imports_A02_t15: fail, OK
-# co19 issue #486, some override errors are now warnings
-Language/07_Classes/1_Instance_Methods_A01_t01: fail, OK
-Language/07_Classes/1_Instance_Methods_A01_t02: fail, OK
-Language/07_Classes/1_Instance_Methods_A01_t03: fail, OK
-Language/07_Classes/1_Instance_Methods_A01_t04: fail, OK
-Language/07_Classes/1_Instance_Methods_A01_t05: fail, OK
-Language/07_Classes/1_Instance_Methods_A01_t06: fail, OK
-Language/07_Classes/1_Instance_Methods_A02_t02: fail, OK
-Language/07_Classes/1_Instance_Methods_A02_t05: fail, OK
-Language/07_Classes/1_Instance_Methods_A06_t01: fail, OK
-Language/07_Classes/1_Instance_Methods_A06_t02: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A03_t01: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A03_t02: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A03_t03: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A03_t04: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A03_t05: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A04_t01: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A04_t05: fail, OK
-Language/07_Classes/4_Abstract_Instance_Members_A04_t06: fail, OK
-
# co19 issue #513, rules for finals were loosened, contradiction in spec was fixed
Language/07_Classes/6_Constructors/1_Generative_Constructors_A21_t01: fail, OK
@@ -163,9 +134,6 @@
Language/12_Expressions/01_Constants_A12_t01: fail, OK
Language/12_Expressions/01_Constants_A13_t06: fail, OK
-# co19 issue #397, List.addLast being removed
-Language/12_Expressions/06_Lists_A06_t01: fail, OK
-
# co19 issue #519, ++5 is not assignable
Language/12_Expressions/07_Maps_A01_t01: fail, OK
@@ -224,9 +192,6 @@
# co19 issue #530, garbage
Language/12_Expressions/32_Type_Test_A04_t02: fail, OK
-# co19 issue #531, void f(void f()) {f();} is error. Gilad: The formal parameter conflicts with the name of the function.
-Language/13_Statements/04_Local_Function_Declaration_A01_t01: fail, OK
-
# co19 issue #541: tests contain unqualified reference to static members defined in superclass
Language/12_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: fail, OK
Language/12_Expressions/30_Identifier_Reference_A14_t03: fail, OK
@@ -234,8 +199,8 @@
# co19 issue #543: invocation of a non-function
Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t02: fail, OK
+LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail, OK # co19 issue 556
-# co19-roll r546 (11.08.2013) caused these failures
Language/13_Statements/11_Return_A07_t01: fail # co19-roll r546: Please triage this failure
Language/13_Statements/11_Try_A02_t03: fail # co19-roll r546: Please triage this failure
Language/13_Statements/11_Try_A03_t03: fail # co19-roll r546: Please triage this failure
@@ -247,11 +212,8 @@
Language/14_Libraries_and_Scripts/2_Exports_A05_t01: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t24: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t25: fail # co19-roll r546: Please triage this failure
-Language/15_Types/1_Static_Types_A03_t01: fail # co19-roll r546: Please triage this failure
-Language/15_Types/5_Function_Types_A01_t01: fail # co19-roll r546: Please triage this failure
Language/15_Types/6_Type_dynamic_A03_t01: fail # co19-roll r546: Please triage this failure
Language/15_Types/6_Type_dynamic_A04_t01: fail # co19-roll r546: Please triage this failure
-Language/16_Reference/1_Lexical_Rules/2_Comments_A04_t03: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/asBroadcastStream_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/distinct_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/distinct_A01_t02: fail # co19-roll r546: Please triage this failure
@@ -293,7 +255,6 @@
LibTest/async/StreamIterator/cancel_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/listen_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/listen_A04_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/StreamSink/close_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/Stream_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/Stream.fromFuture_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/Stream.fromFuture_A02_t02: fail # co19-roll r546: Please triage this failure
@@ -305,9 +266,9 @@
LibTest/async/Timer/Timer.periodic_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Timer/Timer.periodic_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/DateTime/compareTo_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/DateTime/isAtSameMomentAs_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/DateTime/subtract_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/double/parse_A01_t01: fail # co19-roll r546: Please triage this failure
+LibTest/core/double/truncate_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/core/double/truncate_A01_t05: fail # co19-roll r559: Please triage this failure
LibTest/core/Duration/operator_div_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/Duration/operator_eq_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/Duration/operator_gt_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -339,11 +300,8 @@
LibTest/core/List/replaceRange_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/core/List/skipWhile_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/List/takeWhile_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/toList_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/List/toList_A01_t03: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/toSet_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/StringBuffer/writeAll_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/isolate_api/spawnFunction_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/streamSpawnFunction_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateSink/add_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateSink/addError_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -354,9 +312,4 @@
LibTest/isolate/IsolateStream/contains_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateStream/contains_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateStream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/IsolateStream/last_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/IsolateStream/length_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/IsolateStream/single_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/SendPort/send_A02_t02: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t03: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t04: fail # co19-roll r546: Please triage this failure
diff --git a/tests/co19/co19-analyzer2.status b/tests/co19/co19-analyzer2.status
index 67c183c..f80c456 100644
--- a/tests/co19/co19-analyzer2.status
+++ b/tests/co19/co19-analyzer2.status
@@ -3,7 +3,6 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2analyzer ]
-
# not clear: g([var foo = foo + 10]) is parameter 'foo' in the scope of its own initialzer?
Language/06_Functions/2_Formal_Parameters_A02_t02: fail
@@ -16,16 +15,27 @@
# TBF: _f is private, so does not collide
Language/07_Classes/1_Instance_Methods_A05_t08: fail
+# TBD: should we check that argument for dynamic parameter of constant constructor is not compatible with operation that is performed with it?
+Language/12_Expressions/01_Constants_A16_t03: fail
+
+# TBD: should we report _error_ when constant creation uses arguments with types incompatible with parameters?
+Language/12_Expressions/12_Instance_Creation/2_Const_A09_t02: fail
+Language/12_Expressions/12_Instance_Creation/2_Const_A09_t03: fail
+
+# TBF: infinite look: class A {const A();final m = const A();}
+Language/12_Expressions/01_Constants_A17_t03: fail
+
+# analyzer issue https://code.google.com/p/dart/issues/detail?id=11534
+Language/15_Types/4_Interface_Types_A11_t01: Skip
+Language/15_Types/4_Interface_Types_A11_t02: Skip
+
+
+
+
# co19 issue #380, Strings class has been removed
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A03_t01: fail, OK
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A04_t01: fail, OK
-# co19 issue #389, ceil, floor, truncate and round return integers
-LibTest/core/int/operator_division_A01_t01: fail, OK
-
-# co19 issue #397, List.addLast removed
-LibTest/core/Iterable/where_A01_t07: fail, OK
-
# co19 issue #400, collection library reorg
LibTest/core/String/String_class_A01_t01: fail, OK
LibTest/core/String/concat_A01_t01: fail, OK
@@ -34,19 +44,6 @@
LibTest/core/Set/isSubsetOf_A01_t01: fail, OK
LibTest/core/Set/isSubsetOf_A01_t02: fail, OK
-# co19 issue #403
-LibTest/core/List/every_A01_t01: fail, OK
-
-# co19 issue #414, extra @compile-error
-Language/03_Overview/1_Scoping_A02_t28: fail, OK
-
-# co19 issue #416, function name is declared the parameter scope
-Language/03_Overview/1_Scoping_A02_t07: fail, OK
-
-# analyzer issue https://code.google.com/p/dart/issues/detail?id=11534
-Language/15_Types/4_Interface_Types_A11_t01: Skip
-Language/15_Types/4_Interface_Types_A11_t02: Skip
-
# co19 issue #424, Uninitialized finals are warnings not errors
Language/05_Variables/05_Variables_A07_t05: fail, OK
Language/05_Variables/05_Variables_A07_t06: fail, OK
@@ -75,10 +72,6 @@
LibTest/core/double/ceil_A01_t05: fail, OK
LibTest/core/double/floor_A01_t05: fail, OK
-# co19 issue #434, argument definition was dropped
-#Language/11_Expressions/33_Argument_Definition_Test_A01_t14: fail, OK (this is passing for the wrong reason)
-#Language/11_Expressions/33_Argument_Definition_Test_A01_t18: fail, OK (this is passing for the wrong reason)
-
# co19 issue 459, FallThroughError is no longer const
LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail, OK
@@ -90,80 +83,124 @@
# co19 issue #464, not initialized final instance variable is warning, not error
Language/07_Classes/6_Constructors/1_Generative_Constructors_A09_t01: fail
+# co19 issue #442, undefined name "Expect"
+Language/15_Types/4_Interface_Types_A08_t03: fail, OK
+
# co19 issue #448, Collection was removed
LibTest/collection/Queue/Queue.from_A01_t01: fail, OK
LibTest/collection/Queue/Queue.from_A01_t02: fail, OK
-LibTest/core/List/List.from_A01_t01: fail, OK
-LibTest/core/Match/pattern_A01_t01: fail, OK
-LibTest/core/Match/str_A01_t01: fail, OK
-LibTest/core/RegExp/allMatches_A01_t01: fail, OK
LibTest/core/Set/intersection_A01_t02: fail, OK
# co19 issue 452, more method in Iterable
LibTest/core/Set/Set.from_A01_t02: fail, OK
-# co19-roll r546 (11.08.2013) caused these failures
-Language/05_Variables/05_Variables_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/05_Variables/05_Variables_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/05_Variables/05_Variables_A05_t03: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/3_Setters_A08_t01: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/3_Setters_A08_t02: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/3_Setters_A08_t03: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/3_Setters_A08_t04: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/3_Setters_A08_t05: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/00_Object_Identity/1_Object_Identity_A04_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/00_Object_Identity/1_Object_Identity_A04_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A01_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A11_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A12_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A13_t06: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A16_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A16_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A16_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A17_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t08: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/03_Numbers_A01_t10: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/06_Lists_A06_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/07_Maps_A01_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/08_Throw_A05_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A01_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t05: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A02_t07: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A05_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t05: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t06: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t07: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t08: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t09: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A06_t12: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/2_Const_A09_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/2_Const_A09_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation_A01_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation_A01_t05: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation_A01_t06: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation_A01_t08: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t07: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/32_Type_Test_A04_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/02_Expression_Statements_A01_t06: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/04_Local_Function_Declaration_A01_t01: fail # co19-roll r546: Please triage this failure
+# co19 issue #455, undeclared identifier is static warning
+Language/12_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t10: fail, OK
+Language/13_Statements/04_Local_Function_Declaration_A02_t02: fail, OK
+Language/14_Libraries_and_Scripts/1_Imports_A02_t12: fail, OK
+Language/14_Libraries_and_Scripts/1_Imports_A02_t15: fail, OK
+
+# co19 issue #513, rules for finals were loosened, contradiction in spec was fixed
+Language/07_Classes/6_Constructors/1_Generative_Constructors_A21_t01: fail, OK
+
+# co19 issue #514, it is still an error to have both a n initializing formal and an initializer in the constructor's initializer list
+Language/05_Variables/05_Variables_A05_t03: fail, OK
+
+# co19 issue #515, it is a compile-time error if there is more than one entity with the same name declared in the same scope
+Language/07_Classes/3_Setters_A08_t01: fail, OK
+Language/07_Classes/3_Setters_A08_t02: fail, OK
+Language/07_Classes/3_Setters_A08_t03: fail, OK
+Language/07_Classes/3_Setters_A08_t04: fail, OK
+
+# co19 issue #516, it is a compile-time error if a class has both a getter and a method with the same name.
+Language/07_Classes/3_Setters_A08_t05: fail, OK
+
+# co19 issue #438, Static variables are initialized lazily, need not be constants
+Language/12_Expressions/01_Constants_A16_t01: fail, OK
+Language/12_Expressions/01_Constants_A16_t02: fail, OK
+
+# co19 issue #517, +5 is not a valid expression
+Language/12_Expressions/01_Constants_A01_t01: fail, OK
+Language/12_Expressions/03_Numbers_A01_t01: fail, OK
+Language/12_Expressions/03_Numbers_A01_t02: fail, OK
+Language/12_Expressions/03_Numbers_A01_t03: fail, OK
+Language/12_Expressions/03_Numbers_A01_t04: fail, OK
+Language/12_Expressions/03_Numbers_A01_t08: fail, OK
+Language/12_Expressions/03_Numbers_A01_t10: fail, OK
+Language/13_Statements/02_Expression_Statements_A01_t06: fail, OK
+
+# co19 issue #518, It is a compile-time error if evaluation of a compile-time constant would raise an exception
+Language/12_Expressions/01_Constants_A11_t01: fail, OK
+Language/12_Expressions/01_Constants_A12_t01: fail, OK
+Language/12_Expressions/01_Constants_A13_t06: fail, OK
+
+# co19 issue #519, ++5 is not assignable
+Language/12_Expressions/07_Maps_A01_t01: fail, OK
+
+# co19 issue #420, "throw" requires expression, "rethrow" should be used instead
+Language/12_Expressions/08_Throw_A05_t01: fail, OK
+Language/12_Expressions/08_Throw_A05_t02: fail, OK
+Language/12_Expressions/08_Throw_A05_t03: fail, OK
+
+# co19 issue #454 (wrongly closed)
+Language/12_Expressions/12_Instance_Creation/1_New_A01_t04: fail, OK
+
+# co19 issue #521, attempt to create instance of not a class
+Language/12_Expressions/12_Instance_Creation/1_New_A02_t01: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A02_t02: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A02_t03: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A02_t05: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A02_t07: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t03: fail, OK
+
+# co19 issue #523, new malbound type
+Language/12_Expressions/12_Instance_Creation/1_New_A05_t01: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A05_t02: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A05_t03: fail, OK
+
+# co19 issue #524, new abstract class
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t01: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t02: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t12: fail, OK
+
+# co19 issue #526, use undefined constructor
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t04: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t05: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t06: fail, OK
+
+# co19 issue #527, not enough or extra positional parameters; no such named paramater
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t07: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t08: fail, OK
+Language/12_Expressions/12_Instance_Creation/1_New_A06_t09: fail, OK
+
+# co19 issue #528, Const: wrong number of type arguments
+Language/12_Expressions/12_Instance_Creation_A01_t02: fail, OK
+Language/12_Expressions/12_Instance_Creation_A01_t05: fail, OK
+Language/12_Expressions/12_Instance_Creation_A01_t06: fail, OK
+
+# co19 issue #529, const instance creation with invalid type arguments
+Language/12_Expressions/12_Instance_Creation_A01_t08: fail, OK
+
+# co19 issue #388 (wrongly closed), StringBuffer methods changed
+Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail, OK
+Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail, OK
+
+# co19 issue #433 (wrongly closed), missing @static-warning annotation
+Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t01: fail, OK
+Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A03_t07: fail, OK
+
+# co19 issue #530, garbage
+Language/12_Expressions/32_Type_Test_A04_t02: fail, OK
+
+# co19 issue #541: tests contain unqualified reference to static members defined in superclass
+Language/12_Expressions/14_Function_Invocation/3_Unqualified_Invocation_A01_t07: fail, OK
+Language/12_Expressions/30_Identifier_Reference_A14_t03: fail, OK
+
+# co19 issue #543: invocation of a non-function
+Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A03_t02: fail, OK
+
+LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail, OK # co19 issue 556
+
Language/13_Statements/11_Return_A07_t01: fail # co19-roll r546: Please triage this failure
Language/13_Statements/11_Try_A02_t03: fail # co19-roll r546: Please triage this failure
Language/13_Statements/11_Try_A03_t03: fail # co19-roll r546: Please triage this failure
@@ -175,10 +212,8 @@
Language/14_Libraries_and_Scripts/2_Exports_A05_t01: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t24: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t25: fail # co19-roll r546: Please triage this failure
-Language/15_Types/1_Static_Types_A03_t01: fail # co19-roll r546: Please triage this failure
Language/15_Types/6_Type_dynamic_A03_t01: fail # co19-roll r546: Please triage this failure
Language/15_Types/6_Type_dynamic_A04_t01: fail # co19-roll r546: Please triage this failure
-Language/16_Reference/1_Lexical_Rules/2_Comments_A04_t03: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/asBroadcastStream_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/distinct_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/distinct_A01_t02: fail # co19-roll r546: Please triage this failure
@@ -187,6 +222,7 @@
LibTest/async/EventTransformStream/EventTransformStream_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/expand_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/first_A02_t01: fail # co19-roll r546: Please triage this failure
+LibTest/async/EventTransformStream/handleError_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/listen_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/listen_A04_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/EventTransformStream/transform_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -213,12 +249,12 @@
LibTest/async/StreamEventTransformer/handleDone_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/StreamEventTransformer/handleError_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/expand_A01_t01: fail # co19-roll r546: Please triage this failure
+LibTest/async/Stream/handleError_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/isBroadcast_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/async/StreamIterator/cancel_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/listen_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/listen_A04_t01: fail # co19-roll r546: Please triage this failure
-LibTest/async/StreamSink/close_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/Stream_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/Stream.fromFuture_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/Stream.fromFuture_A02_t02: fail # co19-roll r546: Please triage this failure
@@ -230,9 +266,9 @@
LibTest/async/Timer/Timer.periodic_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Timer/Timer.periodic_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/DateTime/compareTo_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/DateTime/isAtSameMomentAs_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/DateTime/subtract_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/double/parse_A01_t01: fail # co19-roll r546: Please triage this failure
+LibTest/core/double/truncate_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/core/double/truncate_A01_t05: fail # co19-roll r559: Please triage this failure
LibTest/core/Duration/operator_div_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/Duration/operator_eq_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/Duration/operator_gt_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -264,11 +300,8 @@
LibTest/core/List/replaceRange_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/core/List/skipWhile_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/List/takeWhile_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/toList_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/List/toList_A01_t03: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/toSet_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/StringBuffer/writeAll_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/isolate_api/spawnFunction_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/streamSpawnFunction_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateSink/add_A01_t02: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateSink/addError_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -279,9 +312,4 @@
LibTest/isolate/IsolateStream/contains_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateStream/contains_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateStream/isBroadcast_A01_t02: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/IsolateStream/last_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/IsolateStream/length_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/IsolateStream/single_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/SendPort/send_A02_t02: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t03: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t04: fail # co19-roll r546: Please triage this failure
diff --git a/tests/co19/co19-co19.status b/tests/co19/co19-co19.status
index de5a6db..12b1782 100644
--- a/tests/co19/co19-co19.status
+++ b/tests/co19/co19-co19.status
@@ -9,10 +9,14 @@
### GENERAL FAILURES ###
[ $runtime == vm || $compiler == dart2js ]
+Language/13_Statements/11_Try_A02_t03: fail # co19 issue 552
+Language/13_Statements/11_Try_A03_t03: fail # co19 issue 552
+Language/13_Statements/11_Try_A04_t03: fail # co19 issue 552
+Language/13_Statements/11_Try_A07_t03: fail # co19 issue 553
+
Language/07_Classes/6_Constructors_A02_t01: SKIP # co19 issue 415.
-Language/16_Reference/1_Lexical_Rules/2_Comments_A04_t03: FAIL, OK # co19 issue 505
-Language/15_Types/1_Static_Types_A03_t01: FAIL, OK # co19 issue 506
Language/07_Classes/6_Constructors/3_Constant_Constructors_A05_t01: FAIL, OK # co19 issue 426
+Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t15: FAIL, OK # co19 issue 547
LibTest/math/acos_A01_t01: PASS, FAIL, OK # co19 issue 44
LibTest/math/asin_A01_t01: PASS, FAIL, OK # co19 issue 44
@@ -28,7 +32,6 @@
LibTest/math/tan_A01_t01: PASS, FAIL, OK # co19 issue 44
LibTest/collection/Queue/iterator_current_A01_t02: FAIL, OK # co19 issue 475
-LibTest/collection/Queue/iterator_moveNext_A01_t02: FAIL, OK # co19 issue 475
LibTest/core/double/ceil_A01_t03: FAIL, OK # co19 issue 389
LibTest/core/double/ceil_A01_t04: FAIL, OK # co19 issue 389
@@ -36,18 +39,12 @@
LibTest/core/double/floor_A01_t04: FAIL, OK # co19 issue 389
LibTest/core/double/round_A01_t02: FAIL, OK # co19 issue 389
LibTest/core/double/round_A01_t04: FAIL, OK # co19 issue 389
-LibTest/core/double/parse_A02_t01: FAIL, OK # co19 issue 418
LibTest/core/double/truncate_A01_t03: FAIL, OK # co19 issue 389
LibTest/core/double/truncate_A01_t04: FAIL, OK # co19 issue 389
LibTest/core/int/toStringAsExponential_A02_t01: FAIL, OK # co19 issue 477
-LibTest/core/Iterable/any_A01_t04: FAIL, OK # co19 issue 508.
-LibTest/core/List/skip_A03_t01: FAIL, OK # co19 issue 502
-LibTest/core/List/take_A02_t01: FAIL, OK # co19 issue 502
-LibTest/core/Match/pattern_A01_t01: FAIL, OK # co19 Issue 400, 422
-LibTest/core/RegExp/allMatches_A01_t01: FAIL, OK # co19 Issue 400, 422
-LibTest/async/Stream/Stream.periodic_A01_t01: PASS, FAIL, OK # co19 issue 538
+LibTest/async/Stream/Stream.periodic_A01_t01: TIMEOUT, PASS, FAIL, OK # co19 issue 538
LibTest/async/Stream/Stream.periodic_A03_t01: PASS, FAIL, OK # co19 issue 538
LibTest/async/Timer/run_A01_t01: PASS, FAIL, OK # co19 issue 538
LibTest/async/Timer/Timer_A01_t01: PASS, FAIL, OK # co19 issue 538
@@ -55,17 +52,10 @@
LibTest/async/Timer/Timer.periodic_A01_t01: PASS, FAIL, OK # co19 issue 537
LibTest/async/Timer/Timer.periodic_A02_t01: PASS, FAIL, OK # co19 issue 538
LibTest/async/Future/Future.delayed_A01_t02: PASS, FAIL, OK # co19 issue 536
-LibTest/core/DateTime/isAtSameMomentAs_A01_t01: FAIL, OK # co19 issue 503
-LibTest/core/DateTime/year_A01_t01: FAIL, OK # co19 issue 504
-LibTest/core/double/parse_A01_t01: FAIL, OK # co19 issue 503
LibTest/isolate/SendPort/send_A02_t02: SKIP # co19 issue 493
LibTest/isolate/SendPort/send_A02_t03: SKIP # co19 issue 495
-Utils/tests/Expect/listEquals_A02_t01: FAIL, OK # co19 issue 499
-Utils/tests/Expect/listEquals_A03_t01: FAIL, OK # co19 issue 500
-Utils/tests/Expect/setEquals_A02_t01: FAIL, OK # co19 issue 499
-
LibTest/isolate/isolate_api/streamSpawnFunction_A02_t02: PASS, FAIL, OK # co19 issue 540
LibTest/isolate/isolate_api/streamSpawnFunction_A02_t03: PASS, FAIL, OK # co19 issue 540
LibTest/isolate/IsolateStream/contains_A02_t01: PASS, FAIL, OK # co19 issue 540
@@ -75,21 +65,305 @@
LibTest/async/EventTransformStream/elementAt_A03_t01: FAIL # co19 issue 545
LibTest/async/Stream/elementAt_A03_t01: FAIL # co19 issue 545
+LibTest/typed_data/Float32x4/wwww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wwzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wxzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wywx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wywy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wywz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wyzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/wzzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xwzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xxzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xywx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xywy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xywz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xyzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/xzzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/ywzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yxzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yywx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yywy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yywz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yyzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/yzzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zwzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zxzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zywx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zywy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zywz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zyzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzww_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzwx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzwy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzwz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzxw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzxx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzxy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzxz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzyw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzyx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzyy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzyz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzzw_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzzx_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzzy_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Float32x4/zzzz_A01_t01: FAIL, OK # co19 issue 546
+LibTest/typed_data/Int8List/Int8List.fromList_A01_t02: Fail # co19-roll r559: Please triage this failure
+
+LibTest/typed_data/Float32List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Float32List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Float32x4List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Float32x4List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Float64List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Float64List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int16List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int16List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int32List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int32List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int64List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int64List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int8List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Int8List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint16List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint16List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint32List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint32List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint64List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint64List/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint8ClampedList/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint8ClampedList/retainAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint8List/removeAll_A01_t01: Fail # co19 issue 548
+LibTest/typed_data/Uint8List/retainAll_A01_t01: Fail # co19 issue 548
+
+
### CHECKED MODE FAILURES ###
[ ($runtime == vm || $compiler == dart2js) && $checked]
-Language/13_Statements/09_Switch_A05_t01: FAIL, OK # co19 issue 498
+Language/13_Statements/09_Switch_A05_t01: FAIL, OK # co19 issue 498
Language/14_Libraries_and_Scripts/1_Imports_A03_t26: FAIL, OK # co19 issue 498
+Language/15_Types/1_Static_Types_A03_t01: Fail # co19-roll r559: Please triage this failure
Language/15_Types/1_Static_Types_A03_t03: FAIL, OK # co19 issue 498
Language/15_Types/1_Static_Types_A03_t04: FAIL, OK # co19 issue 498
-LibTest/async/EventTransformStream/asBroadcastStream_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/contains_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/contains_A02_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/distinct_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/drain_A01_t01: FAIL, OK # co19 issue 498
+LibTest/async/EventTransformStream/first_A03_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/firstWhere_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/firstWhere_A02_t01: FAIL, OK # co19 issue 498
-LibTest/async/EventTransformStream/first_A03_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/fold_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/fold_A01_t02: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/forEach_A01_t01: FAIL, OK # co19 issue 498
@@ -114,6 +388,7 @@
LibTest/async/EventTransformStream/where_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/EventTransformStream/where_A01_t02: FAIL, OK # co19 issue 498
LibTest/async/Stream/drain_A01_t01: FAIL, OK # co19 issue 498
+LibTest/async/StreamEventTransformer/bind_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/Stream/firstWhere_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/Stream/firstWhere_A02_t01: FAIL, OK # co19 issue 498
LibTest/async/Stream/fold_A01_t01: FAIL, OK # co19 issue 498
@@ -127,7 +402,6 @@
LibTest/async/Stream/transform_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/Stream/where_A01_t01: FAIL, OK # co19 issue 498
LibTest/async/Stream/where_A01_t02: FAIL, OK # co19 issue 498
-LibTest/async/StreamEventTransformer/bind_A01_t01: FAIL, OK # co19 issue 498
LibTest/core/DateTime/compareTo_A02_t01: FAIL, OK # co19 issue 498
LibTest/core/List/join_A01_t01: FAIL, OK # co19 issue 498
LibTest/core/List/removeAt_A02_t01: FAIL, OK # co19 issue 498
@@ -138,6 +412,4 @@
LibTest/core/TypeError/line_A01_t01: FAIL, OK # co19 issue 510
LibTest/core/TypeError/srcType_A01_t01: FAIL, OK # co19 issue 510
LibTest/core/TypeError/url_A01_t01: FAIL, OK # co19 issue 510
-LibTest/isolate/IsolateStream/last_A01_t01: FAIL, OK # co19 issue 498
-LibTest/isolate/IsolateStream/length_A01_t01: FAIL, OK # co19 issue 498
-LibTest/isolate/IsolateStream/single_A01_t01: FAIL, OK # co19 issue 498
+LibTest/core/NoSuchMethodError/NoSuchMethodError_A01_t01: Fail # co19 issue 550
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index a7ed9ce..1688c19 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -12,10 +12,8 @@
LibTest/core/double/floor_A01_t05: Fail # issue 428
LibTest/core/double/ceil_A01_t05: Fail # issue 428
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t15: Fail # TODO(dart2dart-team): Please triage this failure.
Language/07_Classes/9_Superclasses/1_Inheritance_and_Overriding_A01_t03: Fail # TODO(dart2dart-team): Please triage this failure.
LibTest/collection/Queue/iterator_current_A01_t02: Fail # co19 issue 475
-LibTest/collection/Queue/iterator_moveNext_A01_t02: Fail # co19 issue 475
LibTest/core/int/toStringAsExponential_A02_t01: Fail # co19 issue 477
Language/03_Overview/1_Scoping_A01_t39: Fail # http://dartbug.com/7202
@@ -29,14 +27,12 @@
Language/03_Overview/1_Scoping_A01_t41: Fail # http://dartbug.com/5519
Language/03_Overview/1_Scoping_A02_t05: Fail # Inherited from dart2js
Language/03_Overview/1_Scoping_A02_t06: Fail # inherited from dart2js
-Language/03_Overview/1_Scoping_A02_t07: Fail # inherited from dart2js
Language/05_Variables/05_Variables_A01_t04: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A01_t05: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A01_t08: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A01_t12: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A01_t13: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A01_t14: Fail # http://dartbug.com/5519
-Language/05_Variables/05_Variables_A01_t15: Fail # http://dartbug.com/5519
Language/05_Variables/05_Variables_A07_t05: Fail # Inherited from dart2js
Language/05_Variables/05_Variables_A07_t06: Fail # Inherited from dart2js
Language/05_Variables/05_Variables_A07_t07: Fail # Inherited from dart2js
@@ -65,20 +61,7 @@
Language/07_Classes/07_Classes_A02_t02: Fail # http://dartbug.com/5519
Language/07_Classes/07_Classes_A02_t04: Fail # http://dartbug.com/5519
Language/07_Classes/07_Classes_A02_t11: Fail # http://dartbug.com/5519
-Language/07_Classes/07_Classes_A03_t02: Fail # http://dartbug.com/5519
-Language/07_Classes/07_Classes_A03_t07: Fail # inherited from dart2js
-Language/07_Classes/07_Classes_A03_t08: Fail # inherited from dart2js
-Language/07_Classes/07_Classes_A03_t09: Fail # inherited from dart2js
Language/07_Classes/07_Classes_A03_t10: Fail # http://dartbug.com/6687
-Language/07_Classes/07_Classes_A04_t19: Fail # inherited from dart2js
-Language/07_Classes/07_Classes_A04_t21: Fail # inherited from dart2js
-Language/07_Classes/07_Classes_A04_t22: Fail # inherited from dart2js
-Language/07_Classes/07_Classes_A04_t24: Fail # inherited from dart2js
-Language/07_Classes/07_Classes_A04_t25: Fail # inherited from dart2js
-Language/07_Classes/1_Instance_Methods_A02_t02: Fail # http://dartbug.com/5519
-Language/07_Classes/1_Instance_Methods_A02_t05: Fail # http://dartbug.com/5519
-Language/07_Classes/1_Instance_Methods_A06_t01: Fail # Inherited from dart2js
-Language/07_Classes/1_Instance_Methods_A06_t02: Fail # Inherited from dart2js
Language/07_Classes/3_Setters_A04_t01: Fail # inherited from VM
Language/07_Classes/3_Setters_A04_t02: Fail # inherited from VM
Language/07_Classes/3_Setters_A04_t03: Fail # inherited from VM
@@ -86,12 +69,8 @@
Language/07_Classes/3_Setters_A04_t05: Fail # inherited from VM
Language/07_Classes/3_Setters_A04_t06: Fail # inherited from VM
Language/07_Classes/3_Setters_A04_t07: Fail # inherited from VM
-Language/07_Classes/4_Abstract_Instance_Members_A04_t01: Fail # http://dartbug.com/5519
-Language/07_Classes/4_Abstract_Instance_Members_A04_t05: Fail # inherited from VM
-Language/07_Classes/4_Abstract_Instance_Members_A04_t06: Fail # inherited from VM
Language/07_Classes/6_Constructors/1_Generative_Constructors_A09_t01: Fail # http://dartbug.com/5519
Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t07: Fail # inherited from VM
-Language/07_Classes/6_Constructors/2_Factories_A01_t05: Fail # Inherited from dartjs
Language/07_Classes/6_Constructors/2_Factories_A07_t01: Fail # inherited from VM
Language/07_Classes/6_Constructors/3_Constant_Constructors_A03_t01: Fail # http://dartbug.com/5519
Language/07_Classes/6_Constructors/3_Constant_Constructors_A04_t01: Fail # inherited from VM
@@ -103,7 +82,6 @@
Language/07_Classes/6_Constructors_A02_t01: Fail # http://dartbug.com/5519
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
@@ -115,10 +93,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.
LibTest/core/double/toRadixString_A01_t01: Fail # inherited from VM
LibTest/core/int/operator_left_shift_A01_t02: Fail, OK # co19 issue 129
LibTest/core/int/toRadixString_A01_t01: Fail # inherited from VM
@@ -166,23 +141,16 @@
LibTest/core/double/truncate_A01_t03: Fail # truncate/ceil/floor/round returns ints, issue 389
LibTest/core/double/truncate_A01_t04: Fail # truncate/ceil/floor/round returns ints, issue 389
-LibTest/core/Iterable/any_A01_t04: Fail # setRange now takes end-argument. Issue 402
-
-LibTest/core/Iterable/where_A01_t07: Fail # Issue 397
-
LibTest/core/Set/isSubsetOf_A01_t01: Fail # Issue 400
LibTest/core/Set/isSubsetOf_A01_t02: Fail # Issue 400
LibTest/core/FallThroughError/toString_A01_t01: Fail # FallThroughError is no longer const. Issue 459
LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-Language/07_Classes/4_Abstract_Instance_Members_A04_t01: Fail # Override rules have been relaxed. Issue
-Language/07_Classes/1_Instance_Methods_A02_t02: Fail # Override rules have been relaxed. Issue
-Language/07_Classes/1_Instance_Methods_A02_t05: Fail # Override rules have been relaxed. Issue
-
# co19-roll r546 (11.08.2013) caused these failures
[ $compiler == dart2dart ]
+Language/03_Overview/1_Scoping_A02_t28: Fail # co19-roll r559: Please triage this failure
Language/05_Variables/05_Variables_A05_t01: fail # co19-roll r546: Please triage this failure
Language/05_Variables/05_Variables_A05_t02: fail # co19-roll r546: Please triage this failure
Language/05_Variables/05_Variables_A05_t03: fail # co19-roll r546: Please triage this failure
@@ -194,10 +162,21 @@
Language/05_Variables/05_Variables_A06_t06: fail # co19-roll r546: Please triage this failure
Language/07_Classes/07_Classes_A11_t01: fail # co19-roll r546: Please triage this failure
Language/07_Classes/07_Classes_A11_t03: fail # co19-roll r546: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t01: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t02: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t03: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t04: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t05: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t06: Fail # co19-roll r559: Please triage this failure
Language/07_Classes/3_Setters_A08_t01: fail # co19-roll r546: Please triage this failure
Language/07_Classes/3_Setters_A08_t02: fail # co19-roll r546: Please triage this failure
Language/07_Classes/3_Setters_A08_t03: fail # co19-roll r546: Please triage this failure
Language/07_Classes/3_Setters_A08_t04: fail # co19-roll r546: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t01: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t02: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t03: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t04: Fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t05: Fail # co19-roll r559: Please triage this failure
Language/12_Expressions/00_Object_Identity/1_Object_Identity_A04_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/01_Constants_A01_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/01_Constants_A03_t02: fail # co19-roll r546: Please triage this failure
@@ -255,8 +234,6 @@
Language/12_Expressions/03_Numbers_A01_t08: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/03_Numbers_A01_t10: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/05_Strings/1_String_Interpolation_A01_t09: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/05_Strings/1_String_Interpolation_A03_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/05_Strings/1_String_Interpolation_A04_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/05_Strings_A02_t46: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/05_Strings_A02_t48: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/05_Strings_A20_t01: fail # co19-roll r546: Please triage this failure
@@ -286,26 +263,14 @@
Language/12_Expressions/12_Instance_Creation/1_New_A06_t05: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/1_New_A06_t06: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/1_New_A06_t12: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t03: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/1_New_A09_t09: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/2_Const_A06_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/2_Const_A06_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/2_Const_A09_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/2_Const_A10_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A01_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t09: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/17_Getter_Invocation_A02_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A05_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A05_t05: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A08_t04: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/22_Equality_A01_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/22_Equality_A01_t15: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/22_Equality_A01_t16: fail # co19-roll r546: Please triage this failure
@@ -337,11 +302,9 @@
Language/13_Statements/03_Variable_Declaration_A04_t06: fail # co19-roll r546: Please triage this failure
Language/13_Statements/03_Variable_Declaration_A04_t07: fail # co19-roll r546: Please triage this failure
Language/13_Statements/03_Variable_Declaration_A04_t08: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/04_Local_Function_Declaration_A01_t01: fail # co19-roll r546: Please triage this failure
Language/13_Statements/06_For_A01_t11: fail # co19-roll r546: Please triage this failure
Language/13_Statements/09_Switch_A01_t02: fail # co19-roll r546: Please triage this failure
Language/13_Statements/09_Switch_A04_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/09_Switch_A06_t02: fail # co19-roll r546: Please triage this failure
Language/13_Statements/11_Return_A05_t01: fail # co19-roll r546: Please triage this failure
Language/13_Statements/11_Return_A05_t02: fail # co19-roll r546: Please triage this failure
Language/13_Statements/11_Return_A05_t03: fail # co19-roll r546: Please triage this failure
@@ -368,7 +331,6 @@
Language/14_Libraries_and_Scripts/1_Imports_A03_t69: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A03_t70: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A04_t03: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/3_Parts_A03_t02: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t01: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t01: fail # co19-roll r546: Please triage this failure
@@ -376,7 +338,6 @@
Language/14_Libraries_and_Scripts/5_URIs_A01_t21: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t24: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t25: fail # co19-roll r546: Please triage this failure
-Language/15_Types/1_Static_Types_A03_t01: fail # co19-roll r546: Please triage this failure
Language/15_Types/3_Type_Declarations/1_Typedef_A06_t01: fail # co19-roll r546: Please triage this failure
Language/15_Types/3_Type_Declarations/1_Typedef_A06_t02: fail # co19-roll r546: Please triage this failure
Language/15_Types/3_Type_Declarations/1_Typedef_A06_t03: fail # co19-roll r546: Please triage this failure
@@ -390,16 +351,10 @@
Language/15_Types/4_Interface_Types_A11_t02: crash # co19-roll r546: Please triage this failure
Language/15_Types/5_Function_Types_A06_t01: fail # co19-roll r546: Please triage this failure
Language/16_Reference/1_Lexical_Rules/1_Reserved_Words_A40_t04: fail # co19-roll r546: Please triage this failure
-Language/16_Reference/1_Lexical_Rules/2_Comments_A04_t03: fail # co19-roll r546: Please triage this failure
Language/16_Reference/1_Lexical_Rules_A02_t06: fail # co19-roll r546: Please triage this failure
LibTest/async/Stream/Stream.periodic_A03_t01: fail, pass # co19-roll r546: Please triage this failure
LibTest/async/Timer/Timer.periodic_A02_t01: fail, pass # co19-roll r546: Please triage this failure
-LibTest/core/DateTime/isAtSameMomentAs_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/DateTime/parse_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/DateTime/year_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/double/parse_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/skip_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/take_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/spawnFunction_A04_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/spawnUri_A02_t02: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/spawnUri_A02_t03: fail # co19-roll r546: Please triage this failure
@@ -410,10 +365,10 @@
LibTest/isolate/SendPort/send_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/SendPort/send_A02_t02: timeout # co19-roll r546: Please triage this failure
LibTest/isolate/SendPort/send_A02_t03: timeout # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t04: fail # co19-roll r546: Please triage this failure
-Utils/tests/Expect/listEquals_A02_t01: fail # co19-roll r546: Please triage this failure
-Utils/tests/Expect/listEquals_A03_t01: fail # co19-roll r546: Please triage this failure
-Utils/tests/Expect/setEquals_A02_t01: fail # co19-roll r546: Please triage this failure
[ $compiler == dart2dart && $minified ]
Language/13_Statements/11_Try_A06_t01: fail # co19-roll r546: Please triage this failure
+Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A01_t02: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/17_Getter_Invocation_A02_t01: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/18_Assignment_A05_t02: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/18_Assignment_A05_t04: fail # co19-roll r559: Please triage this failure
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 82ddff6..8fe176e 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -9,10 +9,9 @@
[ $compiler == dart2js && $runtime == jsshell ]
LibTest/isolate/isolate_api/spawnUri_A02_t01: Crash # TODO(ahe): Please triage this crash.
-LibTest/core/List/sort_A01_t04: Pass, Timeout # Must be a bug in jsshell, test sometimes times out.
+LibTest/core/List/sort_A01_t04: Fail, Pass, Timeout # Must be a bug in jsshell, test sometimes times out.
[ $compiler == dart2js && $checked && $runtime == ie9 ]
-LibTest/core/Map/Map_class_A01_t04: Slow, Pass
LibTest/isolate/isolate_api/spawnUri_A02_t03: Pass, Fail # Issue 8920
@@ -22,15 +21,6 @@
Language/03_Overview/1_Scoping_A02_t05: Fail # TODO(ahe): Please triage this failure.
Language/03_Overview/1_Scoping_A02_t06: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A07_t05: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A07_t06: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A07_t07: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A07_t08: Fail # TODO(ahe): Please triage this failure.
-Language/05_Variables/05_Variables_A08_t01: Fail # TODO(ahe): Please triage this failure.
-Language/07_Classes/07_Classes_A03_t07: Fail # TODO(ahe): Please triage this failure.
-Language/07_Classes/1_Instance_Methods_A06_t01: Fail # TODO(ahe): Please triage this failure.
-Language/07_Classes/1_Instance_Methods_A06_t02: Fail # TODO(ahe): Please triage this failure.
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t15: Fail # TODO(ahe): Please triage this failure.
Language/07_Classes/6_Constructors/2_Factories_A07_t01: Fail # TODO(ahe): Please triage this failure.
LibTest/core/List/List_A03_t01: Fail # TODO(kasperl): Please triage this failure.
LibTest/core/double/INFINITY_A01_t04: Fail # TODO(ahe): Please triage this failure.
@@ -55,9 +45,18 @@
LibTest/isolate/ReceivePort/receive_A01_t02: Fail # Issue 6750
-Language/07_Classes/6_Constructors/2_Factories_A01_t05: Fail # Partially implemented rediriecting constructors makes this fail.
+LibTest/typed_data/Float64List/Float64List.view_A01_t01: Fail, OK # Issue 12928
+LibTest/typed_data/Float32List/Float32List.view_A01_t01: Fail, OK # Issue 12928
+LibTest/typed_data/Uint16List/Uint16List.view_A01_t01: Fail, OK # Issue 12928
+LibTest/typed_data/Uint32List/Uint32List.view_A01_t01: Fail, OK # Issue 12928
+LibTest/typed_data/Int32List/Int32List.view_A01_t01: Fail, OK # Issue 12928
+LibTest/typed_data/Float32x4List/Float32x4List.view_A01_t01: Fail, OK # Issue 12928
+
[ $compiler == dart2js && $runtime == ie9 ]
+LibTest/async/Completer/completeError_A02_t01: Pass, Fail # Issue 8920
+LibTest/async/Stream/listen_A04_t01: Pass, Timeout # Issue: 8920
+LibTest/core/DateTime/timeZoneName_A01_t01: Fail # Issue: 8920
LibTest/core/double/round_A01_t01: Fail # Issue: 8920
LibTest/core/double/toRadixString_A01_t01: Fail # Issue: 8920
LibTest/core/double/toStringAsExponential_A01_t04: Fail # Issue: 8920
@@ -69,18 +68,15 @@
LibTest/core/int/remainder_A01_t01: Fail # Issue: 8920
LibTest/core/int/remainder_A01_t03: Fail # Issue: 8920
LibTest/core/int/toRadixString_A01_t01: Fail # Issue: 8920
+LibTest/core/Map/Map_class_A01_t04: Pass, Timeout # Issue 8096
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterEscape_A06_t02: Fail # Issue: 8920
LibTest/core/RegExp/Pattern_semantics/firstMatch_DecimalEscape_A01_t02: Fail # Issue: 8920
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t01: Fail # Issue: 8920
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t05: Fail # Issue: 8920
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t06: Fail # Issue: 8920
-LibTest/core/String/contains_A01_t02: Fail # Issue: 8920
-LibTest/isolate/ReceivePort/toSendPort_A01_t02: Pass, Fail # Issue: 8920
LibTest/isolate/ReceivePort/toSendPort_A01_t01: Pass, Fail # Issue: 8920
-LibTest/core/DateTime/timeZoneName_A01_t01: Fail # Issue: 8920
-LibTest/async/Stream/listen_A04_t01: Pass, Timeout # Issue: 8920
-LibTest/async/Completer/completeError_A02_t01: Pass, Fail # Issue 8920
-LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: Pass, Timeout # Issue 8920
+LibTest/isolate/ReceivePort/toSendPort_A01_t02: Pass, Fail # Issue: 8920
+LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: Skip # http://dartbug.com/12635
[ $compiler == dart2js && $runtime == jsshell ]
LibTest/core/Map/Map_class_A01_t04: Pass, Slow # Issue 8096
@@ -104,7 +100,6 @@
LibTest/core/List/getRange_A03_t01: Fail, OK # Tests that fail because they use the legacy try-catch syntax. co19 issue 184.
-Language/07_Classes/1_Instance_Methods_A02_t05: Fail, OK # These tests need to be updated for new optional parameter syntax and semantics, co19 issue 258:
Language/07_Classes/6_Constructors/1_Generative_Constructors_A13_t01: Fail, OK # These tests need to be updated for new optional parameter syntax and semantics, co19 issue 258:
LibTest/isolate/SendPort/send_A02_t04: Fail, Pass, OK # co19 issue 293 Passes on IE
@@ -116,12 +111,6 @@
LibTest/core/int/isEven_A01_t01: Fail, OK # co19 issue 277
[ $compiler == dart2js ]
-Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t03: Fail # TODO(ahe): Enforce optional parameter semantics.
-Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t04: Fail # TODO(ahe): Enforce optional parameter semantics.
-Language/06_Functions/2_Formal_Parameters_A03_t03: Fail # TODO(ahe): Enforce optional parameter semantics.
-Language/06_Functions/2_Formal_Parameters_A03_t04: Fail # TODO(ahe): Enforce optional parameter semantics.
-Language/06_Functions/2_Formal_Parameters_A03_t06: Fail # TODO(ahe): Enforce optional parameter semantics.
-
LibTest/isolate/SendPort/send_A02_t01: Fail # Compile-time error: error: not a compile-time constant
LibTest/isolate/isolate_api/spawnUri_A02_t01: Fail # Runtime error: Expect.throws() fails
@@ -151,31 +140,25 @@
# can understand so he can file a bug later.
#
[ $compiler == dart2js ]
-LibTest/core/Set/isSubsetOf_A01_t01: fail # Issue 400
-LibTest/core/Set/isSubsetOf_A01_t02: fail # Issue 400
-
-Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t14: Fail, OK # co19 issue 210
-Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t15: Fail, OK # co19 issue 210
-
Language/03_Overview/1_Scoping_A01_t40: Fail, OK # co19 issue 188
Language/03_Overview/1_Scoping_A01_t41: Fail, OK # co19 issue 188
-
-Language/06_Functions/4_External_Functions_A01_t01: Fail, OK # http://dartbug.com/5021
-
Language/03_Overview/2_Privacy_A01_t09: Fail, OK # co19 issue 198
-
-LibTest/core/int/hashCode_A01_t01: Fail, OK # co19 issue 308
-
Language/03_Overview/2_Privacy_A01_t11: Pass, OK # co19 issue 316
-
-LibTest/core/Iterable/where_A01_t07: Fail # Issue 397
-
-
+Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t14: Fail, OK # co19 issue 210
+Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A01_t15: Fail, OK # co19 issue 210
+Language/06_Functions/4_External_Functions_A01_t01: Fail, OK # http://dartbug.com/5021
+LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail # FallThroughError is no longer const. Issue 459
+LibTest/core/FallThroughError/toString_A01_t01: Fail # FallThroughError is no longer const. Issue 459
+LibTest/core/int/hashCode_A01_t01: Fail, OK # co19 issue 308
+LibTest/core/Set/isSubsetOf_A01_t01: fail # Issue 400
+LibTest/core/Set/isSubsetOf_A01_t02: fail # Issue 400
LibTest/core/String/indexOf_A01_t02: Fail # Issue 427
LibTest/core/String/lastIndexOf_A01_t02: Fail # Issue 427
+LibTest/typed_data/Int64List/*: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int64List/Int64List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint64List/*: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint64List/Uint64List_A02_t01: pass # co19-roll r559: Please triage this failure
-LibTest/core/FallThroughError/toString_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail # FallThroughError is no longer const. Issue 459
[ $compiler == dart2js && $jscl ]
LibTest/core/RegExp/Pattern_semantics/firstMatch_CharacterClassEscape_A04_t01: Fail, Pass # issue 3333
@@ -196,7 +179,6 @@
LibTest/core/int/remainder_A01_t03: Fail, OK # Leg only has double.
LibTest/core/int/toDouble_A01_t01: Fail, OK # Requires big int.
LibTest/core/int/toRadixString_A01_t01: Fail, OK # Bad test: uses Expect.fail, Expect.throws, assumes case of result, and uses unsupported radixes.
-LibTest/core/String/contains_A01_t02: Fail, OK # co19 issue 105.
[ $compiler == dart2js && $runtime == ie9 ]
LibTest/math/cos_A01_t01: Fail # co19 issue 44
@@ -209,7 +191,6 @@
[ $compiler == dart2js ]
Language/07_Classes/6_Constructors/1_Generative_Constructors_A13_t01: Fail # compiler cancelled: cannot resolve type T
-Language/03_Overview/1_Scoping_A02_t07: Fail # duplicate definition of f(var f){f();}
Language/03_Overview/2_Privacy_A01_t06: Fail # cannot resolve type _inaccessibleFuncType
[ $compiler == dart2js && $jscl ]
@@ -225,37 +206,77 @@
# Missing compile-time errors.
#
[ $compiler == dart2js ]
+Language/03_Overview/1_Scoping_A01_t39: Fail # dartbug.com/7202
Language/05_Variables/05_Variables_A01_t04: Fail # Checks that a variable declaration cannot contain both 'final' and 'var'.
Language/05_Variables/05_Variables_A01_t05: Fail # Checks that a variable declaration cannot contain both 'var' and 'type'.
Language/05_Variables/05_Variables_A01_t08: Fail # Checks different variables in a single variable declaration must be delimited by commas.
Language/05_Variables/05_Variables_A01_t12: Fail # Checks that variable declaration cannot contain both 'const' and 'var'.
Language/05_Variables/05_Variables_A01_t13: Fail # Checks that variable declaration cannot contain both 'const' and 'final'.
Language/05_Variables/05_Variables_A01_t14: Fail # Checks that variable declaration cannot contain 'const', 'final' and 'var' simultaneously.
-Language/05_Variables/05_Variables_A01_t15: Fail # Checks that a variable declaration cannot contain the 'abstract' keyword.
+Language/05_Variables/05_Variables_A07_t05: Fail # Checks that a compile-time error occurs if a local constant variable is not initialized at declaration.
+Language/05_Variables/05_Variables_A07_t06: Fail # Checks that a compile-time error occurs if a local typed constant variable is not initialized at declaration.
+Language/05_Variables/05_Variables_A07_t07: Fail # Checks that a compile-time error occurs if a global constant variable is not initialized at declaration.
+Language/05_Variables/05_Variables_A07_t08: Fail # Checks that a compile-time error occurs if a global typed constant variable is not initialized at declaration.
+Language/05_Variables/05_Variables_A08_t01: Fail # Checks that a compile-time error occurs if a constant variable is not initialized.
Language/06_Functions/2_Formal_Parameters/1_Required_Formals_A02_t03: Fail # Checks that a required parameter can be constant. Reassigning it should produce a compile-time error.
Language/06_Functions/2_Formal_Parameters/1_Required_Formals_A02_t04: Fail # Checks that static variable declaration can't be a required formal parameter
Language/06_Functions/2_Formal_Parameters/1_Required_Formals_A02_t06: Fail # Checks that a functionSignature parameter cannot be final.
Language/06_Functions/2_Formal_Parameters/1_Required_Formals_A02_t07: Fail # Checks that a functionSignature parameter cannot be declared as variable.
+Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t03: Fail # TODO(ahe): Enforce optional parameter semantics.
+Language/06_Functions/2_Formal_Parameters/2_Optional_Formals_A03_t04: Fail # TODO(ahe): Enforce optional parameter semantics.
Language/06_Functions/2_Formal_Parameters_A03_t01: Fail # Checks that it is a compile-time error if a required parameter is declared as a constant variable.
Language/06_Functions/2_Formal_Parameters_A03_t02: Fail # Checks that it is a compile-time error if a required parameter is declared as a constant typed variable.
+Language/06_Functions/2_Formal_Parameters_A03_t03: Fail # TODO(ahe): Enforce optional parameter semantics.
+Language/06_Functions/2_Formal_Parameters_A03_t04: Fail # TODO(ahe): Enforce optional parameter semantics.
Language/06_Functions/2_Formal_Parameters_A03_t05: Fail # Checks that it is a compile-time error if an optional named parameter is declared as a constant typed variable.
Language/06_Functions/2_Formal_Parameters_A03_t05: Fail # Checks that it is a compile-time error if an optional positional parameter is declared as a constant variable.
+Language/06_Functions/2_Formal_Parameters_A03_t06: Fail # TODO(ahe): Enforce optional parameter semantics.
Language/07_Classes/07_Classes_A02_t02: Fail # Checks that it is a compile-time error if a constant constructor declaration includes a body.
Language/07_Classes/07_Classes_A02_t04: Fail # Checks that it is a compile-time error if a constant constructor declaration with initializers includes a body.
Language/07_Classes/07_Classes_A02_t11: Fail # Checks that it is a compile-time error if a static final variable declaration does not include explicit initializer.
-Language/07_Classes/07_Classes_A03_t02: Fail # Checks that it is a compile-time error if a factory constructor method definition does not include a body.
-Language/07_Classes/07_Classes_A03_t08: Fail # Checks that it is a compile-time error if a static setter method definition does not include a body.
-Language/07_Classes/07_Classes_A03_t09: Fail # Checks that it is a compile-time error if a static function method definition does not include a body.
-Language/07_Classes/07_Classes_A04_t19: Fail # Checks that an abstract static method can't be used in place of a class member definition./
-Language/07_Classes/07_Classes_A04_t21: Fail # Checks that a static operator can't be used in place of a class member definition.
-Language/07_Classes/07_Classes_A04_t22: Fail # Checks that an abstract static operator can't be used in place of a class member definition./
-Language/07_Classes/07_Classes_A04_t24: Fail # Checks that a static abstract getter can't be used in place of a class member definition.
-Language/07_Classes/07_Classes_A04_t25: Fail # Checks that a static abstract setter can't be used in place of a class member definition.
-Language/07_Classes/1_Instance_Methods_A02_t02: Fail # Checks that a compile-time error is produced if m1 has fewer named parameters than m2 (1 vs. 0) and neither have any required parameters.
-Language/07_Classes/1_Instance_Methods_A02_t05: Fail # Checks that a compile-time error is produced if m1 has almost the same set of named parameters as m2 except for one of them having a different name.
-Language/07_Classes/4_Abstract_Instance_Members_A04_t01: Fail # Checks that a compile-time error is produced when the overriding abstract method has fewer named parameters than the instance method being overridden (2 vs 3) and neither have any required parameters.
-Language/07_Classes/4_Abstract_Instance_Members_A04_t05: Fail # Checks that a compile-time error is produced when the overriding non-abstract instance method has the same set of named parameters as the abstract method being overriden, but in a different order.
-Language/07_Classes/4_Abstract_Instance_Members_A04_t06: Fail # Checks that a compile-time error is produced when the overriding non-abstract instance method has almost the same set of named parameters as the abstract method being overriden, except for one that has a different name.
+Language/07_Classes/07_Classes_A11_t01: Fail # Checks that a class name cannot be used as a name of a member variable.
+Language/07_Classes/07_Classes_A11_t03: Fail # Checks that a class name cannot be used as a name of a static variable.
+Language/07_Classes/6_Constructors/3_Constant_Constructors_A03_t01: Fail # Checks that a compile-time error is produced when a class with constant constructor also declares a non-final instance variable.
+Language/12_Expressions/01_Constants_A16_t01: Fail # Checks that an IntegerDivisionByZeroException raised during evaluation of a compile-time constant causes a compile-time error.
+Language/12_Expressions/01_Constants_A16_t02: Fail # Checks that an OutOfMemoryException raised during evaluation of a compile-time constant causes a compile-time error.
+Language/12_Expressions/01_Constants_A20_t03: Fail # Checks that an identifier expression that denotes a type parameter can not be assigned to a constant variable.
+Language/12_Expressions/05_Strings/1_String_Interpolation_A01_t09: Fail # Checks that it is a compile-time error if a string interpolation construct does not start with IDENTIFIER_NO_DOLLAR or opening brace.
+Language/12_Expressions/05_Strings_A02_t46: Fail # Checks that multi-line strings that contain characters and sequences prohibited by this grammar, cause compile-time errors.
+Language/12_Expressions/05_Strings_A02_t48: Fail # Checks that multi-line strings that contain characters and sequences prohibited by this grammar, cause compile-time errors.
+Language/12_Expressions/22_Equality_A01_t15: Fail # Checks that equality expressions cannot be operands of another equality expression.
+Language/12_Expressions/22_Equality_A01_t16: Fail # Checks that equality expressions cannot be operands of another equality expression.
+Language/12_Expressions/23_Relational_Expressions_A01_t10: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/12_Expressions/23_Relational_Expressions_A01_t11: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/12_Expressions/23_Relational_Expressions_A01_t12: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/12_Expressions/23_Relational_Expressions_A01_t13: Fail # Checks that a relational expression cannot be the operand of another relational expression.
+Language/12_Expressions/30_Identifier_Reference_A04_t09: Fail # Checks that it is a compile-time error when a built-in identifier dynamic is used as the declared name of a type variable.
+Language/12_Expressions/30_Identifier_Reference_A05_t01: Fail # Checks that it is a compile-time error when a built-in identifier "abstract" is used as a type annotation of a local variable.
+Language/12_Expressions/30_Identifier_Reference_A05_t12: Fail # Checks that it is a compile-time error when a built-in identifier "static" is used as a type annotation of a local variable.
+Language/13_Statements/03_Variable_Declaration_A04_t01: Fail # Checks that a variable declaration statement var e = e; causes a compile-time error.
+Language/13_Statements/03_Variable_Declaration_A04_t02: Fail # Checks that a variable declaration statement T e = e; causes a compile-time error.
+Language/13_Statements/03_Variable_Declaration_A04_t03: Fail # Checks that a variable declaration statement const e = e; causes a compile-time error.
+Language/13_Statements/03_Variable_Declaration_A04_t04: Fail # Checks that a variable declaration statement const T e = e; causes a compile-time error.
+Language/13_Statements/03_Variable_Declaration_A04_t05: Fail # Checks that a variable declaration statement final e = e; causes a compile-time error.
+Language/13_Statements/03_Variable_Declaration_A04_t06: Fail # Checks that a variable declaration statement final T e = e; causes a compile-time error.
+Language/13_Statements/03_Variable_Declaration_A04_t07: Fail # Checks that a variable declaration statement var e = e; causes a compile-time error. A top-level variable with the same name is declared.
+Language/13_Statements/03_Variable_Declaration_A04_t08: Fail # Checks that it is a compile-time error if the initializing expression of a local variable v refers to the name v= even when a top-level variable with the same name is declared.
+Language/13_Statements/11_Return_A05_t01: Fail # Checks that a compile-time error occurs if a return statement of the form return e; appears in a generative constructor.
+Language/13_Statements/11_Return_A05_t02: Fail # Checks that a compile-time error occurs if a return statement of the form return e; appears in a named generative constructor.
+Language/13_Statements/11_Return_A05_t03: Fail # Checks that a compile-time error occurs if a return statement of the form return e; appears in a generative constructor.
+Language/14_Libraries_and_Scripts/5_URIs_A01_t24: Fail # Checks that it is a compile-time error when the URI in a part directive consists of two adjacent string literals instead of one.
+Language/14_Libraries_and_Scripts/5_URIs_A01_t25: Fail # Checks that it is a compile-time error when the URI in a part directive consists of two adjacent multi-line string literals instead of one.
+Language/15_Types/3_Type_Declarations/1_Typedef_A06_t01: Fail # Checks that a compile error is produced when a null default value is specified for a required argument in a function type alias.
+Language/15_Types/3_Type_Declarations/1_Typedef_A06_t02: Fail # Checks that a compile error is produced when a default value is specified for an optional positional argument in a function type alias.
+Language/15_Types/3_Type_Declarations/1_Typedef_A06_t03: Fail # Checks that a compile error is produced when a default value is specified for an optional named argument in a function type alias.
+Language/15_Types/3_Type_Declarations/1_Typedef_A06_t04: Fail # Checks that a compile error is produced when a default value is specified for one of the required arguments in a function type alias.
+Language/15_Types/3_Type_Declarations/1_Typedef_A06_t05: Fail # Checks that a compile error is produced when default values are specified for several parameters in a function type alias.
+Language/15_Types/3_Type_Declarations/1_Typedef_A07_t01: Fail # Checks that self-referencing typedef is not allowed (return value type annotation has the same name as the type alias).
+Language/15_Types/3_Type_Declarations/1_Typedef_A07_t02: Fail # Checks that self-referencing typedef is not allowed (positional formal parameter type annotation has the same name as the type alias).
+Language/15_Types/3_Type_Declarations/1_Typedef_A07_t03: Fail # Checks that self-referencing typedef is not allowed (positional optional parameter type annotation has the same name as the type alias).
+Language/15_Types/3_Type_Declarations/1_Typedef_A07_t04: Fail # Checks that self-referencing typedef is not allowed (named optional parameter type annotation has the same name as the type alias).
+Language/16_Reference/1_Lexical_Rules/1_Reserved_Words_A40_t04: Fail # Checks that other Unicode whitespaces are not allowed: check NO-BREAK SPACE (U+00A0)
+Language/16_Reference/1_Lexical_Rules_A02_t06: Fail # Checks that Unicode whitespaces other than WHITESPACE are not permitted in the source code. Checks symbol U+00a0.
+
#
# Unexpected compile-time errors.
@@ -272,25 +293,53 @@
Language/07_Classes/07_Classes_A03_t10: Fail # http://dartbug.com/6687
-#
-# Unexpected runtime errors.
-#
-[ $compiler == dart2js ]
-Language/03_Overview/1_Scoping_A01_t39: Fail # dartbug.com/7202
+[ $compiler == dart2js && $runtime == ie9 ]
+# These are most likey due to the fact that IE9 doesn't support typed data
+LibTest/typed_data/Float32List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int8List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int64List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32x4/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint64List/*: fail, crash # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/Float32List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/Float32x4List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/Float64List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/Int16List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/Int32List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int8List/Int8List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/Uint16List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/Uint32List_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/Uint8ClampedList_A02_t01: pass # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/Uint8List_A02_t01: pass # co19-roll r559: Please triage this failure
-
-# co19-roll r546 (11.08.2013) caused these failures
[ $compiler == dart2js ]
+Language/03_Overview/1_Scoping_A02_t28: fail # co19-roll r559: Please triage this failure
Language/05_Variables/05_Variables_A05_t01: fail # co19-roll r546: Please triage this failure
Language/05_Variables/05_Variables_A05_t02: fail # co19-roll r546: Please triage this failure
Language/05_Variables/05_Variables_A05_t03: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/07_Classes_A11_t01: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/07_Classes_A11_t03: fail # co19-roll r546: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t01: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t02: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t03: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t04: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t05: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/1_Instance_Methods_A01_t06: fail # co19-roll r559: Please triage this failure
Language/07_Classes/3_Setters_A08_t01: fail # co19-roll r546: Please triage this failure
Language/07_Classes/3_Setters_A08_t02: fail # co19-roll r546: Please triage this failure
Language/07_Classes/3_Setters_A08_t03: fail # co19-roll r546: Please triage this failure
Language/07_Classes/3_Setters_A08_t04: fail # co19-roll r546: Please triage this failure
-Language/07_Classes/6_Constructors/3_Constant_Constructors_A03_t01: fail # co19-roll r546: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t01: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t02: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t03: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t04: fail # co19-roll r559: Please triage this failure
+Language/07_Classes/4_Abstract_Instance_Members_A03_t05: fail # co19-roll r559: Please triage this failure
Language/12_Expressions/00_Object_Identity/1_Object_Identity_A02_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/00_Object_Identity/1_Object_Identity_A04_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/00_Object_Identity/1_Object_Identity_A04_t02: fail # co19-roll r546: Please triage this failure
@@ -300,16 +349,8 @@
Language/12_Expressions/01_Constants_A11_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/01_Constants_A12_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/01_Constants_A13_t06: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A16_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A16_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/01_Constants_A20_t03: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/03_Numbers_A01_t06: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/03_Numbers_A01_t09: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/05_Strings/1_String_Interpolation_A01_t09: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/05_Strings/1_String_Interpolation_A03_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/05_Strings/1_String_Interpolation_A04_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/05_Strings_A02_t46: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/05_Strings_A02_t48: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/05_Strings_A20_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/07_Maps_A01_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/07_Maps_A08_t02: fail # co19-roll r546: Please triage this failure
@@ -325,35 +366,14 @@
Language/12_Expressions/12_Instance_Creation/1_New_A02_t05: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/1_New_A02_t06: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/1_New_A02_t07: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/12_Instance_Creation/2_Const_A09_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/2_Const_A11_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/2_Const_A11_t03: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A01_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t09: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/17_Getter_Invocation_A02_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A05_t04: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A05_t05: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/18_Assignment_A08_t04: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/22_Equality_A01_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/22_Equality_A01_t15: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/22_Equality_A01_t16: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/22_Equality_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/23_Relational_Expressions_A01_t10: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/23_Relational_Expressions_A01_t11: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/23_Relational_Expressions_A01_t12: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/23_Relational_Expressions_A01_t13: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/30_Identifier_Reference_A02_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/30_Identifier_Reference_A04_t09: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/30_Identifier_Reference_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/12_Expressions/30_Identifier_Reference_A05_t12: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/32_Type_Test_A04_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/32_Type_Test_A04_t03: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/32_Type_Test_A04_t04: fail # co19-roll r546: Please triage this failure
@@ -361,25 +381,10 @@
Language/12_Expressions/33_Type_Cast_A03_t02: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/33_Type_Cast_A03_t03: fail # co19-roll r546: Please triage this failure
Language/13_Statements/02_Expression_Statements_A01_t08: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t04: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t05: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t06: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t07: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/03_Variable_Declaration_A04_t08: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/04_Local_Function_Declaration_A01_t01: fail # co19-roll r546: Please triage this failure
Language/13_Statements/06_For_A01_t11: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/09_Switch_A06_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Return_A05_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Return_A05_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Return_A05_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A02_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A03_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A04_t03: fail # co19-roll r546: Please triage this failure
+Language/13_Statements/10_Rethrow_A01_t04: fail # co19-roll r559: Please triage this failure
+Language/13_Statements/10_Rethrow_A01_t05: fail # co19-roll r559: Please triage this failure
Language/13_Statements/11_Try_A06_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A07_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A02_t28: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A02_t29: fail # co19-roll r546: Please triage this failure
@@ -399,36 +404,22 @@
Language/14_Libraries_and_Scripts/1_Imports_A03_t69: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A03_t70: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/1_Imports_A04_t03: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/3_Parts_A03_t02: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t01: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/4_Scripts_A03_t03: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t01: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t11: fail # co19-roll r546: Please triage this failure
Language/14_Libraries_and_Scripts/5_URIs_A01_t21: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/5_URIs_A01_t24: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/5_URIs_A01_t25: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A06_t01: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A06_t02: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A06_t03: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A06_t04: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A06_t05: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A07_t01: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A07_t02: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A07_t03: fail # co19-roll r546: Please triage this failure
-Language/15_Types/3_Type_Declarations/1_Typedef_A07_t04: fail # co19-roll r546: Please triage this failure
Language/15_Types/4_Interface_Types_A11_t01: crash # co19-roll r546: Please triage this failure
Language/15_Types/4_Interface_Types_A11_t02: crash # co19-roll r546: Please triage this failure
Language/15_Types/4_Interface_Types_A11_t04: fail # co19-roll r546: Please triage this failure
Language/15_Types/4_Interface_Types_A12_t10: fail # co19-roll r546: Please triage this failure
-Language/16_Reference/1_Lexical_Rules/1_Reserved_Words_A40_t04: fail # co19-roll r546: Please triage this failure
-Language/16_Reference/1_Lexical_Rules_A02_t06: fail # co19-roll r546: Please triage this failure
LibTest/core/DateTime/DateTime_A01_t03: fail # co19-roll r546: Please triage this failure
LibTest/core/DateTime/parse_A03_t01: fail # co19-roll r546: Please triage this failure
-LibTest/core/double/parse_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/Duration/operator_div_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/List/List_A02_t01: fail # co19-roll r546: Please triage this failure
+LibTest/core/Match/pattern_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/core/RegExp/allMatches_A01_t01: fail # co19-roll r559: Please triage this failure
LibTest/isolate/isolate_api/spawnFunction_A02_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/isolate_api/spawnFunction_A03_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/spawnFunction_A04_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/spawnFunction_A04_t02: fail # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/spawnFunction_A04_t03: fail # co19-roll r546: Please triage this failure
@@ -446,9 +437,68 @@
LibTest/isolate/IsolateStream/any_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/IsolateStream/contains_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/isolate/SendPort/send_A01_t01: fail # co19-roll r546: Please triage this failure
+LibTest/typed_data/Float32List/buffer_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Float32List/Float32List.view_A01_t02: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Float32List/Float32List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/Float32List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/Float32List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/fold_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/join_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/join_A01_t02: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/offsetInBytes_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Float32x4/clamp_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/Float32x4List.view_A01_t02: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Float32x4List/Float32x4List.view_A02_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/Float32x4List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/Float32x4List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/Float32x4List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/fold_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/join_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/join_A01_t02: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/buffer_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Float64List/Float64List.view_A01_t02: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Float64List/Float64List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/Float64List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/Float64List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/fold_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/join_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/join_A01_t02: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/offsetInBytes_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Int16List/buffer_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Int16List/Int16List.view_A01_t02: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Int16List/Int16List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/Int16List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/Int16List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/offsetInBytes_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Int32List/buffer_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Int32List/Int32List.view_A01_t02: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Int32List/Int32List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/Int32List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/Int32List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/offsetInBytes_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Int8List/Int8List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int8List/Int8List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int8List/Int8List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/buffer_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Uint16List/offsetInBytes_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Uint16List/Uint16List.view_A01_t02: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Uint16List/Uint16List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/Uint16List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/Uint16List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/buffer_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Uint32List/offsetInBytes_A01_t01: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Uint32List/Uint32List.view_A01_t02: Fail, Ok # co19 issue: 549
+LibTest/typed_data/Uint32List/Uint32List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/Uint32List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/Uint32List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/Uint8ClampedList.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/Uint8ClampedList.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/Uint8ClampedList.view_A05_t03: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/Uint8List.view_A05_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/Uint8List.view_A05_t02: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/Uint8List.view_A05_t03: Fail # co19-roll r559: Please triage this failure
Utils/tests/Expect/identical_A01_t01: fail # co19-roll r546: Please triage this failure
-# co19-roll r546 (11.08.2013) caused these failures
[ $compiler == dart2js && $checked ]
Language/10_Generics/09_Generics_A03_t01: fail # co19-roll r546: Please triage this failure
Language/10_Generics/09_Generics_A04_t06: fail # co19-roll r546: Please triage this failure
@@ -459,18 +509,42 @@
Language/12_Expressions/07_Maps_A11_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/1_New_A07_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation/1_New_A12_t02: fail # co19-roll r546: Please triage this failure
+Language/12_Expressions/12_Instance_Creation/2_Const_A09_t02: Fail # co19-roll r559: Please triage this failure
Language/12_Expressions/12_Instance_Creation/2_Const_A09_t03: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/12_Instance_Creation_A01_t07: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/19_Conditional_A04_t03: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/20_Logical_Boolean_Expressions_A03_t01: fail # co19-roll r546: Please triage this failure
Language/12_Expressions/27_Unary_Expressions_A02_t03: fail # co19-roll r546: Please triage this failure
Language/13_Statements/06_For/1_For_Loop_A01_t08: fail # co19-roll r546: Please triage this failure
-LibTest/core/List/getRange_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/core/Set/intersection_A01_t02: fail # co19-roll r546: Please triage this failure
+LibTest/typed_data/Float32x4List/operator_subscripted_assignment_A02_t01: Fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/reduce_A01_t01: Fail # co19-roll r559: Please triage this failure
+[ $compiler == dart2js && $runtime == jsshell ]
+LibTest/typed_data/Float32List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/toList_A01_t01: timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4/toUint32x4_A01_t02: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/toList_A01_t01: pass, fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/toList_A01_t01: timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/toList_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/toList_A01_t01: pass, timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int8List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int8List/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/toList_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/toList_A01_t01: timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/toList_A01_t01: fail, timeout # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/hashCode_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/toList_A01_t01: timeout # co19-roll r559: Please triage this failure
# Could this be dart issue 7728?
-# co19-roll r546 (11.08.2013) caused these failures
[ $compiler == dart2js && ($runtime == d8 || $runtime == jsshell) ]
LibTest/async/Future/Future.delayed_A01_t01: Fail # co19-roll r546: Please triage this failure
LibTest/async/Future/Future.delayed_A03_t01: fail # co19-roll r546: Please triage this failure
@@ -482,3 +556,24 @@
LibTest/async/Stream/Stream.periodic_A02_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Timer/cancel_A01_t01: fail # co19-roll r546: Please triage this failure
LibTest/async/Timer/Timer_A01_t01: fail # co19-roll r546: Please triage this failure
+
+[ $compiler == dart2js && $minified ]
+Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A01_t02: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/17_Getter_Invocation_A02_t01: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/18_Assignment_A05_t02: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/18_Assignment_A05_t04: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/18_Assignment_A05_t05: fail # co19-roll r559: Please triage this failure
+Language/12_Expressions/18_Assignment_A08_t04: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float32x4List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Float64List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int16List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int32List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Int8List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint16List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint32List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8ClampedList/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+LibTest/typed_data/Uint8List/runtimeType_A01_t01: fail # co19-roll r559: Please triage this failure
+
diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status
index d9637be..dd687c2 100644
--- a/tests/co19/co19-runtime.status
+++ b/tests/co19/co19-runtime.status
@@ -11,13 +11,6 @@
LibTest/core/double/floor_A01_t05: Fail # co19 issue 428
LibTest/core/double/ceil_A01_t05: Fail # co19 issue 428
-Language/07_Classes/4_Abstract_Instance_Members_A03_t02: Fail # Dart issue 978
-Language/07_Classes/4_Abstract_Instance_Members_A03_t03: Fail # Dart issue 978
-Language/07_Classes/4_Abstract_Instance_Members_A03_t04: Fail # Dart issue 978
-Language/07_Classes/4_Abstract_Instance_Members_A03_t05: Fail # Dart issue 978
-Language/07_Classes/4_Abstract_Instance_Members_A04_t05: Fail # Dart issue 978
-Language/07_Classes/4_Abstract_Instance_Members_A04_t06: Fail # Dart issue 978
-Language/07_Classes/6_Constructors/1_Generative_Constructors_A04_t15: Fail # Dart issue 6954
LibTest/math/pow_A18_t01: Fail # co19 issue 507
Language/05_Variables/1_Evaluation_of_Implicit_Variable_Getters_A01_t02: Fail # Dart issue 5802
@@ -38,8 +31,6 @@
LibTest/core/double/toRadixString_A01_t01: Fail # co19 issue 491
LibTest/core/int/toRadixString_A01_t01: Fail # co19 issue 492
-LibTest/core/String/contains_A01_t02: Fail # Issue 12508
-
LibTest/isolate/ReceivePort/receive_A01_t02: Fail # VM triage, check spec.
LibTest/isolate/isolate_api/spawnUri_A02_t02: Fail # VM triage, check spec.
LibTest/isolate/isolate_api/spawnUri_A02_t03: Fail # VM triage, check spec.
@@ -47,8 +38,6 @@
Language/07_Classes/6_Constructors/1_Generative_Constructors_A15_t07: Fail $ co19 issue 494
-LibTest/core/Iterable/where_A01_t07: Fail # Issue 397
-
LibTest/core/Set/isSubsetOf_A01_t01: fail # Issue 400
LibTest/core/Set/isSubsetOf_A01_t02: fail # Issue 400
@@ -58,20 +47,6 @@
LibTest/core/FallThroughError/toString_A01_t01: Fail # FallThroughError is no longer const. Issue 459
LibTest/core/FallThroughError/FallThroughError_A01_t01: Fail # FallThroughError is no longer const. Issue 459
-Language/07_Classes/1_Instance_Methods_A01_t01: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A01_t02: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A01_t03: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A01_t04: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A01_t05: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A01_t06: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A02_t02: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A02_t05: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A06_t01: Fail # Issue 485
-Language/07_Classes/1_Instance_Methods_A06_t02: Fail # Issue 485
-Language/07_Classes/4_Abstract_Instance_Members_A03_t01: Fail # Issue 485
-Language/07_Classes/4_Abstract_Instance_Members_A04_t01: Fail # Issue 485
-
-Language/03_Overview/1_Scoping_A02_t28: Fail # Issue 463
Language/03_Overview/2_Privacy_A01_t06: Fail # Issue 463
LibTest/async/Timer/Timer.periodic_A02_t01: Pass, Fail # co19 issue 537
@@ -81,13 +56,6 @@
[ $compiler == none && $runtime == vm && $checked ]
LibTest/async/Future/catchError_A01_t01: Fail # Future constructors have changed # issue 408
-LibTest/core/List/getRange_A01_t01: Fail # getRange now takes end-argument and returns Iterable. Issue 399
-LibTest/core/Set/intersection_A03_t01: Fail # co19 issue 510
-LibTest/core/int/operator_division_A01_t01: Fail # co19 issue 509
-
-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
# Passing for the wrong reasons:
LibTest/async/Completer/completeError_A03_t02: Pass # No AsyncError anymore. Issue 407 and 463
@@ -109,7 +77,11 @@
LibTest/math/log_A01_t01: Fail
LibTest/core/double/toInt_A01_t01: Fail
-# co19-roll r546 (11.08.2013) caused these failures
+[ $compiler == none && $runtime == vm && $arch == arm ]
+LibTest/typed_data/Float32List/Float32List.view_A01_t02: Crash # Issue 12868
+LibTest/typed_data/Float32x4/toUint32x4_A01_t02: Fail # Issue 12868
+LibTest/typed_data/Float64List/Float64List.view_A01_t02: Crash # Issue 12868
+
[ $compiler == none && $runtime == vm ]
Language/05_Variables/05_Variables_A05_t01: fail # Dart issue 12539
Language/05_Variables/05_Variables_A05_t02: fail # Dart issue 12539
@@ -138,32 +110,19 @@
Language/12_Expressions/03_Numbers_A01_t04: fail # co19 issue 522
Language/12_Expressions/03_Numbers_A01_t08: fail # co19 issue 522
Language/12_Expressions/03_Numbers_A01_t10: fail # co19 issue 522
-Language/12_Expressions/05_Strings/1_String_Interpolation_A03_t02: fail # co19 issue 397
-Language/12_Expressions/05_Strings/1_String_Interpolation_A04_t02: fail # co19 issue 397
Language/12_Expressions/05_Strings_A02_t46: fail # Dart issue 12547
Language/12_Expressions/05_Strings_A02_t48: fail # Dart issue 12547
Language/12_Expressions/05_Strings_A20_t01: fail # Dart issue 12518
Language/12_Expressions/07_Maps_A01_t01: fail # co19 issue 522
Language/12_Expressions/12_Instance_Creation/1_New_A06_t12: fail # Dart issue 12549
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t01: fail # co19 issue 397
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t02: fail # co19 issue 397
-Language/12_Expressions/12_Instance_Creation/1_New_A08_t03: fail # co19 issue 397
-Language/12_Expressions/12_Instance_Creation/1_New_A09_t09: fail # co19-roll r546: Please triage this failure
+Language/12_Expressions/12_Instance_Creation/1_New_A09_t09: fail # Dart issue 1372
Language/12_Expressions/12_Instance_Creation/2_Const_A10_t01: fail # co19 issue 525
-Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A01_t02: fail # co19 issue 532
Language/12_Expressions/14_Function_Invocation/4_Function_Expression_Invocation_A05_t01: fail # Dart issue 12550
-Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t02: fail # co19 issue 532
-Language/12_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t03: fail # co19 issue 532
Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t05: fail # co19 issue 533
Language/12_Expressions/15_Method_Invocation/3_Static_Invocation_A04_t09: fail # Dart issue 12549
Language/12_Expressions/15_Method_Invocation/4_Super_Invocation_A02_t04: fail # Dart issue 12549
-Language/12_Expressions/17_Getter_Invocation_A02_t01: fail # co19 issue 532
-Language/12_Expressions/18_Assignment_A05_t02: fail # co19 issue 532
-Language/12_Expressions/18_Assignment_A05_t04: fail # co19 issue 532
-Language/12_Expressions/18_Assignment_A05_t05: fail # co19 issue 532
-Language/12_Expressions/18_Assignment_A08_t04: fail # co19 issue 532
Language/12_Expressions/30_Identifier_Reference_A05_t02: fail # Dart issue 12551
-Language/12_Expressions/30_Identifier_Reference_A08_t02: fail # co19-roll r546: Please triage this failure
+Language/12_Expressions/30_Identifier_Reference_A08_t02: fail # Dart issue 12593
Language/12_Expressions/32_Type_Test_A04_t02: fail # co19 issue 503
Language/12_Expressions/32_Type_Test_A04_t03: fail # co19 issue 534
Language/12_Expressions/32_Type_Test_A04_t04: fail # co19 issue 534
@@ -173,34 +132,27 @@
Language/13_Statements/03_Variable_Declaration_A04_t07: fail # co19 issue 535
Language/13_Statements/03_Variable_Declaration_A04_t08: fail # co19 issue 535
Language/13_Statements/06_For_A01_t11: fail # Dart issue 5675
-Language/13_Statements/09_Switch_A01_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/09_Switch_A02_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/09_Switch_A03_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/09_Switch_A03_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/09_Switch_A04_t01: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/09_Switch_A06_t02: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A02_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A03_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A04_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/11_Try_A07_t03: fail # co19-roll r546: Please triage this failure
-Language/13_Statements/12_Labels_A01_t03: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t04: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A02_t21: crash # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A02_t22: crash # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t09: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t10: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t27: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t29: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t30: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t47: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t49: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t50: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t67: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t69: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/1_Imports_A03_t70: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/2_Exports_A04_t02: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/2_Exports_A04_t03: fail # co19-roll r546: Please triage this failure
-Language/14_Libraries_and_Scripts/2_Exports_A05_t01: fail # co19-roll r546: Please triage this failure
+Language/13_Statements/09_Switch_A01_t02: fail # Dart issue 12908
+Language/13_Statements/09_Switch_A02_t02: fail # Dart issue 7307
+Language/13_Statements/09_Switch_A03_t01: fail # Dart issue 7307
+Language/13_Statements/09_Switch_A03_t02: fail # Dart issue 7307
+Language/13_Statements/09_Switch_A04_t01: fail # Dart issue 11233
+Language/13_Statements/12_Labels_A01_t03: fail # Dart issue 2238
+Language/14_Libraries_and_Scripts/13_Libraries_and_Scripts_A05_t04: fail # Dart issue 12913
+Language/14_Libraries_and_Scripts/1_Imports_A03_t09: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t10: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t27: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t29: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t30: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t47: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t49: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t50: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t67: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t69: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/1_Imports_A03_t70: fail # Dart issue 12915
+Language/14_Libraries_and_Scripts/2_Exports_A04_t02: fail # Dart issue 12916
+Language/14_Libraries_and_Scripts/2_Exports_A04_t03: fail # Dart issue 12916
+Language/14_Libraries_and_Scripts/2_Exports_A05_t01: fail # Dart issue 12918
Language/14_Libraries_and_Scripts/5_URIs_A01_t01: fail # Issue 12521
Language/14_Libraries_and_Scripts/5_URIs_A01_t04: fail # Issue 12521
Language/14_Libraries_and_Scripts/5_URIs_A01_t05: fail # Issue 12521
@@ -208,7 +160,6 @@
Language/14_Libraries_and_Scripts/5_URIs_A01_t14: fail # Issue 12521
Language/14_Libraries_and_Scripts/5_URIs_A01_t15: fail # Issue 12521
Language/14_Libraries_and_Scripts/5_URIs_A01_t21: fail # Issue 12518
-LibTest/async/StreamSink/close_A01_t01: fail # co19 503
LibTest/core/DateTime/parse_A03_t01: fail # Issue 12514
LibTest/isolate/isolate_api/spawnFunction_A04_t01: fail # co19-roll r546: Please triage this failure
@@ -219,21 +170,37 @@
LibTest/isolate/IsolateStream/contains_A02_t01: fail, pass # co19-roll r546: Please triage this failure
LibTest/isolate/isolate_api/streamSpawnFunction_A02_t03: fail, pass # co19-roll r546: Please triage this failure
LibTest/isolate/SendPort/send_A01_t01: fail # co19-roll r546: Please triage this failure
-LibTest/isolate/SendPort/send_A02_t04: fail # co19 issue 501
-
[ $compiler == none && $runtime == vm && $checked ]
Language/12_Expressions/12_Instance_Creation_A01_t08: FAIL, OK # co19 issue 498
-LibTest/core/Set/intersection_A01_t01: pass # co19-roll r546: Please triage this failure
-LibTest/core/Set/intersection_A01_t03: pass # co19-roll r546: Please triage this failure
-LibTest/core/Set/intersection_A03_t01: pass # co19-roll r546: Please triage this failure
+LibTest/core/double/truncate_A01_t01: Fail # co19 issue 554
+LibTest/core/double/truncate_A01_t05: Fail # co19 issue 554
LibTest/core/int/ceilToDouble_A01_t01: fail # co19 issue 498
LibTest/core/int/floorToDouble_A01_t01: fail # co19 issue 498
LibTest/core/int/roundToDouble_A01_t01: fail # co19 issue 498
LibTest/core/int/truncateToDouble_A01_t01: fail # co19 issue 498
-LibTest/isolate/isolate_api/spawnFunction_A03_t01: fail # co19 issue 497
-
-# co19-roll r546 (11.08.2013) caused these failures
-[ $compiler == none && $runtime == vm && $unchecked ]
-Language/12_Expressions/12_Instance_Creation/2_Const_A09_t02: Fail # co19 issue 496
-
+LibTest/typed_data/Float32List/operator_subscripted_assignment_A02_t01: Fail # co19 issue 555
+LibTest/typed_data/Float64List/operator_subscripted_assignment_A02_t01: Fail # co19 issue 555
+LibTest/typed_data/Float32x4List/elementAt_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/fillRange_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/first_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/first_A03_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/firstWhere_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/firstWhere_A02_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/getRange_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/getRange_A02_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/last_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/lastWhere_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/map_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/map_A02_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/map_A03_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/operator_subscript_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/operator_subscripted_assignment_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/operator_subscripted_assignment_A02_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/reduce_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/reversed_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/single_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/singleWhere_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/skip_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/take_A01_t01: Fail # Dart issue 12861
+LibTest/typed_data/Float32x4List/take_A02_t01: Fail # Dart issue 12861
diff --git a/tests/compiler/dart2js/message_kind_helper.dart b/tests/compiler/dart2js/message_kind_helper.dart
index 6302bf1..b7163fe 100644
--- a/tests/compiler/dart2js/message_kind_helper.dart
+++ b/tests/compiler/dart2js/message_kind_helper.dart
@@ -14,13 +14,8 @@
const String ESCAPE_REGEXP = r'[[\]{}()*+?.\\^$|]';
-Compiler check(MessageKind kind, Compiler cachedCompiler,
- {bool expectNoHowToFix: false}) {
- if (expectNoHowToFix) {
- Expect.isNull(kind.howToFix);
- } else {
- Expect.isNotNull(kind.howToFix);
- }
+Compiler check(MessageKind kind, Compiler cachedCompiler) {
+ Expect.isNotNull(kind.howToFix);
Expect.isFalse(kind.examples.isEmpty);
for (String example in kind.examples) {
@@ -42,7 +37,7 @@
Expect.isFalse(messages.isEmpty, 'No messages in """$example"""');
- String expectedText = kind.howToFix == null
+ String expectedText = !kind.hasHowToFix
? kind.template : '${kind.template}\n${kind.howToFix}';
String pattern = expectedText.replaceAllMapped(
new RegExp(ESCAPE_REGEXP), (m) => '\\${m[0]}');
@@ -52,6 +47,8 @@
Expect.isTrue(new RegExp('^$pattern\$').hasMatch(message),
'"$pattern" does not match "$message"');
}
- return compiler;
+ cachedCompiler = compiler;
}
+
+ return cachedCompiler;
}
diff --git a/tests/compiler/dart2js/message_kind_test.dart b/tests/compiler/dart2js/message_kind_test.dart
index 6a2e641..55f9bed 100644
--- a/tests/compiler/dart2js/message_kind_test.dart
+++ b/tests/compiler/dart2js/message_kind_test.dart
@@ -27,15 +27,9 @@
}
});
List<String> names = kinds.keys.toList()..sort();
- Map<String, bool> examples = <String, bool>{};
+ List<String> examples = <String>[];
for (String name in names) {
MessageKind kind = kinds[name];
- bool expectNoHowToFix = false;
- if (name == 'READ_SCRIPT_ERROR') {
- // For this we can give no how-to-fix since the underlying error is
- // unknown.
- expectNoHowToFix = true;
- }
if (name == 'GENERIC' // Shouldn't be used.
// We can't provoke a crash.
|| name == 'COMPILER_CRASHED'
@@ -43,17 +37,16 @@
// We cannot provide examples for patch errors.
|| name.startsWith('PATCH_')) continue;
if (kind.examples != null) {
- examples[name] = expectNoHowToFix;
+ examples.add(name);
} else {
print("No example in '$name'");
}
};
var cachedCompiler;
- examples.forEach((String name, bool expectNoHowToFix) {
+ for (String name in examples) {
Stopwatch sw = new Stopwatch()..start();
- cachedCompiler = check(kinds[name], cachedCompiler,
- expectNoHowToFix: expectNoHowToFix);
+ cachedCompiler = check(kinds[name], cachedCompiler);
sw.stop();
print("Checked '$name' in ${sw.elapsedMilliseconds}ms.");
- });
+ }
}
diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
index 7463d7e..779efce 100644
--- a/tests/compiler/dart2js/patch_test.dart
+++ b/tests/compiler/dart2js/patch_test.dart
@@ -506,9 +506,13 @@
Expect.isTrue(compiler.warnings.isEmpty,
"Unexpected warnings: ${compiler.warnings}");
print('testPatchNonPatchableOrigin:${compiler.errors}');
- Expect.equals(1, compiler.errors.length);
- Expect.isTrue(
- compiler.errors[0].message.kind == MessageKind.PATCH_NONPATCHABLE);
+ Expect.equals(2, compiler.errors.length);
+ Expect.equals(
+ MessageKind.EXTRANEOUS_MODIFIER, compiler.errors[0].message.kind);
+ Expect.equals(
+ // TODO(ahe): Eventually, this error should be removed as it will be
+ // handled by the regular parser.
+ MessageKind.PATCH_NONPATCHABLE, compiler.errors[1].message.kind);
}
testPatchNonExternalTopLevel() {
diff --git a/tests/compiler/dart2js_extra/crash_library_metadata.dart b/tests/compiler/dart2js_extra/crash_library_metadata.dart
new file mode 100644
index 0000000..b274687
--- /dev/null
+++ b/tests/compiler/dart2js_extra/crash_library_metadata.dart
@@ -0,0 +1,10 @@
+// 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.
+
+@Constant()
+library foo;
+
+class Constant {
+ const Constant();
+}
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 3e81bd4..416799d 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -10,10 +10,6 @@
constant_javascript_semantics4_test: Fail, OK
-[ $runtime == ff || $jscl ]
-deferred/deferred_constant_test: Pass, Crash, Fail # Issue 9158
-deferred/deferred_class_test: Pass, Crash # Issue 9158
-
[ $compiler == dart2js && $checked ]
variable_type_test/03: Fail, OK
variable_type_test/01: Fail, OK
@@ -24,7 +20,7 @@
[ $compiler == dart2js && $runtime == ie9 ]
class_test: Fail
-deferred/deferred_function_test: Pass, Fail, Timeout # Issue 12635
+deferred/*: Skip # http://dartbug.com/12635
[ $compiler == dart2js && $runtime == none ]
*: Fail, Pass # TODO(ahe): Triage these tests.
@@ -42,3 +38,12 @@
[ $csp ]
mirrors_test: Fail # http://dartbug.com/6490
+mirror_printer_test: Fail # http://dartbug.com/6490
+mirror_invalid_field_access_test: Fail # http://dartbug.com/6490
+mirror_invalid_field_access2_test: Fail # http://dartbug.com/6490
+mirror_invalid_field_access3_test: Fail # http://dartbug.com/6490
+mirror_invalid_field_access4_test: Fail # http://dartbug.com/6490
+deferred/deferred_class_test: Fail # http://dartbug.com/3940
+deferred/deferred_constant_test: Fail # http://dartbug.com/3940
+mirror_type_inference_field_test: Fail # http://dartbug.com/6490
+mirror_type_inference_field2_test: Fail # http://dartbug.com/6490
diff --git a/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart
index 4eaa40d..7b6279b 100644
--- a/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart
+++ b/tests/compiler/dart2js_extra/deferred/deferred_class_test.dart
@@ -2,7 +2,9 @@
// 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 'package:async_helper/async_helper.dart';
+import 'package:expect/expect.dart';
+
import 'dart:async';
@lazy import 'deferred_class_library.dart';
@@ -16,21 +18,25 @@
Expect.throws(() { x = new MyClass(); }, isNoSuchMethodError);
Expect.isNull(x);
int counter = 0;
+ asyncStart();
lazy.load().then((bool didLoad) {
Expect.isTrue(didLoad);
Expect.equals(1, ++counter);
print('deferred_class_library was loaded');
x = new MyClass();
Expect.equals(42, x.foo(87));
+ asyncEnd();
});
Expect.equals(0, counter);
Expect.isNull(x);
+ asyncStart();
lazy.load().then((bool didLoad) {
Expect.isFalse(didLoad);
Expect.equals(2, ++counter);
print('deferred_class_library was loaded');
x = new MyClass();
Expect.equals(42, x.foo(87));
+ asyncEnd();
});
Expect.equals(0, counter);
Expect.isNull(x);
diff --git a/tests/compiler/dart2js_extra/deferred/deferred_constant_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_constant_test.dart
index 87728934..22e7265 100644
--- a/tests/compiler/dart2js_extra/deferred/deferred_constant_test.dart
+++ b/tests/compiler/dart2js_extra/deferred/deferred_constant_test.dart
@@ -2,7 +2,9 @@
// 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 'package:async_helper/async_helper.dart';
+import 'package:expect/expect.dart';
+
import 'dart:async';
@lazy import 'deferred_class_library.dart';
@@ -16,6 +18,7 @@
Expect.isNull(const [const Constant(42)]);
Expect.isNull(x);
int counter = 0;
+ asyncStart();
lazy.load().then((bool didLoad) {
Expect.isTrue(didLoad);
Expect.equals(1, ++counter);
@@ -23,9 +26,11 @@
x = const MyClass();
Expect.equals(42, x.foo(87));
Expect.listEquals(const [const Constant(42)], [new Constant(42)]);
+ asyncEnd();
});
Expect.equals(0, counter);
Expect.isNull(x);
+ asyncStart();
lazy.load().then((bool didLoad) {
Expect.isFalse(didLoad);
Expect.equals(2, ++counter);
@@ -33,6 +38,7 @@
x = const MyClass();
Expect.equals(42, x.foo(87));
Expect.listEquals(const [const Constant(42)], [new Constant(42)]);
+ asyncEnd();
});
Expect.equals(0, counter);
Expect.isNull(x);
diff --git a/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
index 3f15bec6..fb4c282 100644
--- a/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
+++ b/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
@@ -5,8 +5,11 @@
// Test that loading of a library (with top-level functions only) can
// be deferred.
-import "package:expect/expect.dart";
+import 'package:async_helper/async_helper.dart';
+import 'package:expect/expect.dart';
+
import 'dart:async';
+
@lazy import 'deferred_function_library.dart';
const lazy = const DeferredLibrary('deferred_function_library');
@@ -21,26 +24,27 @@
}
main() {
- print('unittest-suite-wait-for-done');
-
Expect.throws(() { foo('a'); }, isNoSuchMethodError);
Expect.isNull(readFoo());
int counter = 0;
+ asyncStart();
lazy.load().then((bool didLoad) {
Expect.isTrue(didLoad);
Expect.equals(1, ++counter);
print('lazy was loaded');
Expect.equals(42, foo('b'));
Expect.isNotNull(readFoo());
+ asyncEnd();
});
Expect.equals(0, counter);
+ asyncStart();
lazy.load().then((bool didLoad) {
Expect.isFalse(didLoad);
Expect.equals(2, ++counter);
print('lazy was loaded');
Expect.equals(42, foo('b'));
Expect.isNotNull(readFoo());
- print('unittest-suite-success');
+ asyncEnd();
});
Expect.equals(0, counter);
Expect.throws(() { foo('a'); }, isNoSuchMethodError);
diff --git a/tests/compiler/dart2js_extra/field_initializer_test.dart b/tests/compiler/dart2js_extra/field_initializer_test.dart
index 43dbe3a..cb4a34b 100644
--- a/tests/compiler/dart2js_extra/field_initializer_test.dart
+++ b/tests/compiler/dart2js_extra/field_initializer_test.dart
@@ -7,21 +7,21 @@
class A {
static var a;
static var b = c;
- static const var c = 499;
- static const var d = c;
- static const var e = d;
- static const var f = B.g;
- static const var h = true;
- static const var i = false;
- static const var j = n;
- static const var k = 4.99;
- static const var l;
- static const var m = l;
- static const var n = 42;
+ static const c = 499;
+ static const d = c;
+ static const e = d;
+ static const f = B.g;
+ static const h = true;
+ static const i = false;
+ static const j = n;
+ static const k = 4.99;
+ static const l;
+ static const m = l;
+ static const n = 42;
}
class B {
- static const var g = A.c;
+ static const g = A.c;
}
testInitialValues() {
diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access2_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access2_test.dart
new file mode 100644
index 0000000..e972bbb
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_invalid_field_access2_test.dart
@@ -0,0 +1,33 @@
+// 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.
+
+// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
+// annotation.
+
+library test;
+
+@MirrorsUsed(targets: 'C.foo')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class C {
+ var foo;
+ var bar;
+}
+
+main() {
+ var c = new C();
+
+ c.bar = 1;
+ var local = c.bar;
+
+ var mirror = reflect(c);
+ Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee);
+ Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee);
+ Expect.throws(() => mirror.setField(const Symbol('bar'), 2),
+ (e) => e is NoSuchMethodError);
+ Expect.throws(() => mirror.getField(const Symbol('bar')),
+ (e) => e is NoSuchMethodError);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart
new file mode 100644
index 0000000..e100442
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_invalid_field_access3_test.dart
@@ -0,0 +1,30 @@
+// 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.
+
+// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
+// annotation.
+
+library test;
+
+@MirrorsUsed(targets: 'C.foo')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class C {
+ static var foo;
+ static var bar;
+}
+
+main() {
+ C.bar = 1;
+ var local = C.bar;
+ var mirror = reflect(new C()).type; // Workaround bug 12799.
+ Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee);
+ Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee);
+ Expect.throws(() => mirror.setField(const Symbol('bar'), 2),
+ (e) => e is NoSuchMethodError);
+ Expect.throws(() => mirror.getField(const Symbol('bar')),
+ (e) => e is NoSuchMethodError);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access4_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access4_test.dart
new file mode 100644
index 0000000..cdd562e
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_invalid_field_access4_test.dart
@@ -0,0 +1,40 @@
+// 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.
+
+// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
+// annotation.
+
+library test;
+
+@MirrorsUsed(targets: 'C.foo')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class C {
+ var foo;
+ var bar;
+}
+
+class D {
+ get bar {}
+ set bar(x) {}
+}
+
+int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
+
+main() {
+ var c = inscrutable(1) == 1 ? new C() : new D();
+
+ c.bar = 1;
+ var local = c.bar;
+
+ var mirror = reflect(c);
+ Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee);
+ Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee);
+ Expect.throws(() => mirror.setField(const Symbol('bar'), 2),
+ (e) => e is UnsupportedError);
+ Expect.throws(() => mirror.getField(const Symbol('bar')),
+ (e) => e is UnsupportedError);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_invalid_field_access_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_field_access_test.dart
new file mode 100644
index 0000000..42badbd
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_invalid_field_access_test.dart
@@ -0,0 +1,29 @@
+// 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.
+
+// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
+// annotation.
+
+library test;
+
+@MirrorsUsed(targets: 'foo')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+var foo;
+var bar;
+
+main() {
+ bar = 1;
+ var local = bar;
+
+ var mirror = currentMirrorSystem().findLibrary(const Symbol('test')).single;
+ Expect.equals(1, mirror.setField(const Symbol('foo'), 1).reflectee);
+ Expect.equals(1, mirror.getField(const Symbol('foo')).reflectee);
+ Expect.throws(() => mirror.setField(const Symbol('bar'), 2),
+ (e) => e is NoSuchMethodError);
+ Expect.throws(() => mirror.getField(const Symbol('bar')),
+ (e) => e is NoSuchMethodError);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_invalid_invoke2_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_invoke2_test.dart
new file mode 100644
index 0000000..5955594
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_invalid_invoke2_test.dart
@@ -0,0 +1,33 @@
+// 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.
+
+// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
+// annotation.
+
+library test;
+
+@MirrorsUsed(targets: 'C.foo')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+import '../../language/compiler_annotations.dart';
+
+class C {
+ foo() => 1;
+
+ @DontInline
+ // Use a closure to prevent inlining until the annotation is implemented.
+ bar() => () => 2;
+}
+
+main() {
+ var c = new C();
+ c.bar(); // Call bar, so it is included in the program.
+
+ var mirror = reflect(c);
+ Expect.equals(1, mirror.invoke(const Symbol('foo'), []).reflectee);
+ Expect.throws(() => mirror.invoke(const Symbol('bar'), []),
+ (e) => e is UnsupportedError);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_invalid_invoke3_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_invoke3_test.dart
new file mode 100644
index 0000000..0783c70
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_invalid_invoke3_test.dart
@@ -0,0 +1,32 @@
+// 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.
+
+// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
+// annotation.
+
+library test;
+
+@MirrorsUsed(targets: 'C.foo')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+import '../../language/compiler_annotations.dart';
+
+class C {
+ static foo() => 1;
+
+ @DontInline
+ // Use a closure to prevent inlining until the annotation is implemented.
+ static bar() => () => 2;
+}
+
+main() {
+ C.bar(); // Call bar, so it is included in the program.
+
+ var mirror = reflect(new C()).type; // Workaround bug 12799.
+ Expect.equals(1, mirror.invoke(const Symbol('foo'), []).reflectee);
+ Expect.throws(() => mirror.invoke(const Symbol('bar'), []),
+ (e) => e is UnsupportedError);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_invalid_invoke_test.dart b/tests/compiler/dart2js_extra/mirror_invalid_invoke_test.dart
new file mode 100644
index 0000000..7e8b9fd
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_invalid_invoke_test.dart
@@ -0,0 +1,29 @@
+// 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.
+
+// Test that we cannot reflect on elements not covered by the `MirrorsUsed`
+// annotation.
+
+library test;
+
+@MirrorsUsed(targets: 'foo')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+import '../../language/compiler_annotations.dart';
+
+foo() => 1;
+
+@DontInline
+// Use a closure to prevent inlining until the annotation is implemented.
+bar() => () => 2;
+
+main() {
+ bar(); // Call bar, so it is included in the program.
+
+ var lm = currentMirrorSystem().findLibrary(const Symbol('test')).single;
+ Expect.equals(1, lm.invoke(const Symbol('foo'), []).reflectee);
+ Expect.throws(() => lm.invoke(const Symbol('bar'), []));
+}
diff --git a/tests/compiler/dart2js_extra/mirror_printer_test.dart b/tests/compiler/dart2js_extra/mirror_printer_test.dart
new file mode 100644
index 0000000..63c1d12
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_printer_test.dart
@@ -0,0 +1,184 @@
+// 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.
+
+/// Prints all information about all mirrors. This tests that it is possible to
+/// enumerate all reflective information without crashing.
+
+// Note: Adding imports below is fine for regression tests. For example,
+// 'crash_library_metadata.dart' is imported to ensure the compiler doesn't
+// crash.
+
+// TODO(ahe): This test should be extended until we are sure all data is
+// printed.
+
+library test.mirror_printer_test;
+
+@MirrorsUsed(targets: '*')
+import 'dart:mirrors';
+
+import 'crash_library_metadata.dart'; // This would crash dart2js.
+
+// Importing dart:html to make things interesting.
+import 'dart:html';
+
+class MirrorPrinter {
+ final StringBuffer buffer;
+ final TypeMirror dynamicType = currentMirrorSystem().dynamicType;
+
+ int indentationLevel = 0;
+
+ MirrorPrinter(this.buffer);
+
+ void w(object) {
+ buffer.write(object);
+ }
+
+ n(Symbol symbol) => MirrorSystem.getName(symbol);
+
+ void indented(action) {
+ indentationLevel++;
+ action();
+ indentationLevel--;
+ }
+
+ get indent {
+ for (int i = 0; i < indentationLevel; i++) {
+ w(' ');
+ }
+ }
+
+ String stringifyInstance(InstanceMirror mirror) {
+ var reflectee = mirror.reflectee;
+ if (reflectee is String) return '"${reflectee}"';
+ if (reflectee is Null || reflectee is bool || reflectee is num ||
+ reflectee is List || reflectee is Map) {
+ return '$reflectee';
+ }
+ StringBuffer buffer = new StringBuffer();
+ Map<Symbol, VariableMirror> variables = mirror.type.variables;
+ buffer
+ ..write(n(mirror.type.simpleName))
+ ..write('(');
+ bool first = true;
+ variables.forEach((Symbol name, VariableMirror variable) {
+ if (variable.isStatic) return;
+ // TODO(ahe): Include superclasses.
+ if (first) {
+ first = false;
+ } else {
+ buffer.write(', ');
+ }
+ buffer
+ ..write(n(name))
+ ..write(': ')
+ ..write(stringifyInstance(mirror.getField(name)));
+ });
+ buffer.write(')');
+ return buffer.toString();
+ }
+
+ String stringifyMetadata(InstanceMirror mirror) {
+ return '@${stringifyInstance(mirror)}';
+ }
+
+ bool writeType(TypeMirror mirror) {
+ if (mirror == null || mirror == dynamicType) return false;
+ w('${n(mirror.simpleName)} ');
+ return true;
+ }
+
+ writeVariable(VariableMirror mirror) {
+ bool needsVar = true;
+ if (mirror.isStatic) w('static ');
+ // TODO(ahe): What about const?
+ if (mirror.isFinal) {
+ w('final ');
+ needsVar = false;
+ }
+
+ if (writeType(mirror.type)) needsVar = false;
+
+ if (needsVar) {
+ w('var ');
+ }
+ w('${n(mirror.simpleName)};');
+ }
+
+ writeMethod(MethodMirror mirror) {
+ writeType(mirror.returnType);
+ if (mirror.isOperator) {
+ w('operator ');
+ }
+ if (mirror.isGetter) {
+ w('get ');
+ }
+ if (mirror.isSetter) {
+ w('set ');
+ }
+ w('${n(mirror.simpleName)}');
+ if (!mirror.isGetter) {
+ w('()');
+ }
+ w(';');
+ }
+
+ writeClass(ClassMirror mirror) {
+ // TODO(ahe): Write 'abstract' if [mirror] is abstract.
+ w('class ${n(mirror.simpleName)}');
+ // TODO(ahe): Write superclass and interfaces.
+ w(' {');
+ bool first = true;
+ indented(() {
+ for (DeclarationMirror declaration in mirror.members.values) {
+ if (first) {
+ first = false;
+ } else {
+ w('\n');
+ }
+ writeDeclaration(declaration);
+ }
+ });
+ w('\n}\n');
+ }
+
+ writeDeclaration(DeclarationMirror declaration) {
+ w('\n');
+ var metadata = declaration.metadata;
+ if (!metadata.isEmpty) {
+ indent;
+ buffer.writeAll(metadata.map(stringifyMetadata), ' ');
+ w('\n');
+ }
+ indent;
+ if (declaration is ClassMirror) {
+ writeClass(declaration);
+ } else if (declaration is VariableMirror) {
+ writeVariable(declaration);
+ } else if (declaration is MethodMirror) {
+ writeMethod(declaration);
+ } else {
+ // TODO(ahe): Test other subclasses of DeclarationMirror.
+ w('$declaration');
+ }
+ }
+
+ writeLibrary(LibraryMirror library) {
+ w('library ${n(library.simpleName)};\n\n');
+ library.members.values.forEach(writeDeclaration);
+ w('\n');
+ }
+
+ static StringBuffer stringify(Map<Uri, LibraryMirror> libraries) {
+ StringBuffer buffer = new StringBuffer();
+ libraries.values.forEach(new MirrorPrinter(buffer).writeLibrary);
+ return buffer;
+ }
+}
+
+main() {
+ print(MirrorPrinter.stringify(currentMirrorSystem().libraries));
+ // Clear the nodes to avoid confusing the fine test framework (by "fine" I
+ // mean something else) -- ahe.
+ document.body.nodes.clear();
+}
diff --git a/tests/compiler/dart2js_extra/mirror_type_inference_field2_test.dart b/tests/compiler/dart2js_extra/mirror_type_inference_field2_test.dart
new file mode 100644
index 0000000..0d8c34d
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_type_inference_field2_test.dart
@@ -0,0 +1,23 @@
+// 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.
+
+// Test that type inference sees the possible modification of `fisk` from
+// the mirror system and not infers the value to be an integer, or any
+// other elements that use `fisk` like `otherFisk` to be of type integer.
+library test;
+
+@MirrorsUsed(targets: 'fisk', override: '*')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+var fisk = 1;
+var otherFisk = 42;
+
+main() {
+ var lm = currentMirrorSystem().findLibrary(const Symbol('test')).single;
+ lm.setField(const Symbol('fisk'), 'hest');
+ otherFisk = fisk;
+ Expect.isTrue(otherFisk is String);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_type_inference_field_test.dart b/tests/compiler/dart2js_extra/mirror_type_inference_field_test.dart
new file mode 100644
index 0000000..860d8c7
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_type_inference_field_test.dart
@@ -0,0 +1,20 @@
+// 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.
+
+// Test that type inference sees the possible modification of `fisk` from
+// the mirror system and not infers the value to be an integer.
+library test;
+
+@MirrorsUsed(targets: 'fisk', override: '*')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+var fisk = 1;
+
+main() {
+ var lm = currentMirrorSystem().findLibrary(const Symbol('test')).single;
+ lm.setField(const Symbol('fisk'), 'hest');
+ Expect.isTrue(fisk is String);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_type_inference_function_test.dart b/tests/compiler/dart2js_extra/mirror_type_inference_function_test.dart
new file mode 100644
index 0000000..a6ed031
--- /dev/null
+++ b/tests/compiler/dart2js_extra/mirror_type_inference_function_test.dart
@@ -0,0 +1,20 @@
+// 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.
+
+// Test that type inference sees the call to `fisk` from the mirror system
+// and not infers the argument to be an integer.
+library test;
+
+@MirrorsUsed(targets: 'fisk', override: '*')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+bool fisk(a) => a is int;
+
+main() {
+ Expect.isTrue(fisk(1));
+ var lm = currentMirrorSystem().findLibrary(const Symbol('test')).single;
+ Expect.isFalse(lm.invoke(const Symbol('fisk'), ['hest']).reflectee);
+}
diff --git a/tests/compiler/dart2js_foreign/dart2js_foreign.status b/tests/compiler/dart2js_foreign/dart2js_foreign.status
index 7945115..1807eab 100644
--- a/tests/compiler/dart2js_foreign/dart2js_foreign.status
+++ b/tests/compiler/dart2js_foreign/dart2js_foreign.status
@@ -2,63 +2,4 @@
# 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 == dart2js && $runtime == none ]
-foreign_test: Fail # Cannot resolve JS.
-
-
-[ $checked ]
-native_checked_fields_test: Fail
-
-
-[ $compiler == dart2js && ( $jscl || $browser ) ]
-foreign_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_call_arity1_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_call_arity2_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_call_arity3_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_checked_arguments1_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_avoids_hidden_name_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_inheritance1_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_inheritance2_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_inheritance3_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_is_check1_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_is_check3_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_closure_identity_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_exceptions1_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_field_rename_1_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_field_rename_2_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_library_same_name_used_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_literal_class_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_method_rename1_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_method_rename2_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_method_rename3_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_method_with_keyword_name_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_named_constructors2_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_named_constructors3_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_no_such_method_exception2_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_no_such_method_exception3_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_no_such_method_exception4_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_no_such_method_exception5_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_no_such_method_exception_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_null_closure_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_null_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_parameter_names_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_property_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_use_native_name_in_table_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_wrapping_function2_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_wrapping_function3_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_wrapping_function_test: Fail # TODO(ahe): Convert to metadata syntax.
-
-native_checked_fields_test: Pass # For the wrong reason.
-native_class_inheritance4_test: Pass # For the wrong reason.
-native_class_with_dart_methods_test: Pass # For the wrong reason.
-native_to_string_test: Pass # For the wrong reason.
-native_window1_test: Pass # For the wrong reason.
-native_window2_test: Pass # For the wrong reason.
-
-native_checked_fields_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_inheritance4_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_class_with_dart_methods_test: Fail # TODO(ahe): Convert to metadata syntax.
-native_to_string_test: Fail # TODO(ahe): Convert to metadata syntax.
-
-[ $browser ]
*: Skip
diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/compiler/dart2js_native/dart2js_native.status
index cb7557d..0191a10 100644
--- a/tests/compiler/dart2js_native/dart2js_native.status
+++ b/tests/compiler/dart2js_native/dart2js_native.status
@@ -8,3 +8,9 @@
[ $compiler == dart2js ]
native_no_such_method_exception4_frog_test: Fail # Issue 9631
native_no_such_method_exception5_frog_test: Fail # Issue 9631
+
+[ $browser || $runtime == jsshell ]
+only_pass_on_d8_test: Fail, OK # This test should only pass on D8.
+
+[ $browser || $runtime == d8 ]
+only_pass_on_jsshell_test: Fail, OK # This test should only pass on jsshell.
diff --git a/tests/compiler/dart2js_native/only_pass_on_d8_test.dart b/tests/compiler/dart2js_native/only_pass_on_d8_test.dart
new file mode 100644
index 0000000..db44fc6
--- /dev/null
+++ b/tests/compiler/dart2js_native/only_pass_on_d8_test.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.
+
+import 'package:expect/expect.dart';
+
+import 'dart:_isolate_helper';
+
+main() {
+ Expect.isTrue(IsolateNatives.isD8);
+ Expect.isFalse(IsolateNatives.isJsshell);
+}
diff --git a/tests/compiler/dart2js_native/only_pass_on_jsshell_test.dart b/tests/compiler/dart2js_native/only_pass_on_jsshell_test.dart
new file mode 100644
index 0000000..8bb4811
--- /dev/null
+++ b/tests/compiler/dart2js_native/only_pass_on_jsshell_test.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.
+
+import 'package:expect/expect.dart';
+
+import 'dart:_isolate_helper';
+
+main() {
+ Expect.isFalse(IsolateNatives.isD8);
+ Expect.isTrue(IsolateNatives.isJsshell);
+}
diff --git a/tests/corelib/big_integer_vm_test.dart b/tests/corelib/big_integer_vm_test.dart
index 12be55e..e57b3be 100644
--- a/tests/corelib/big_integer_vm_test.dart
+++ b/tests/corelib/big_integer_vm_test.dart
@@ -73,6 +73,17 @@
Expect.equals(20000000000000.0, b * a);
}
+ static testBigintHugeMul() {
+ var block = 28 * 256; // 28 bit chunks with 8 bit 'carry' in a DoubleChunk.
+ var bits = block * 32; // plenty of blocks in longest column sum;
+ var a = 1 << bits;
+ var a1 = a - 1; // all 1's
+ var p1 = a1 * a1;
+ var p2 = a * a - a - a + 1;
+ // Use isTrue instead of equals to avoid trying to print such big numbers.
+ Expect.isTrue(p1 == p2, 'products do not match');
+ }
+
static testBigintTruncDiv() {
var a = 12345678901234567890;
var b = 10;
@@ -160,6 +171,7 @@
testBigintAdd();
testBigintSub();
testBigintMul();
+ testBigintHugeMul();
testBigintModulo();
testBigintTruncDiv();
testBigintDiv();
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index ecd14b0..186f01e 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -2,8 +2,6 @@
# 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.
-reg_exp_unicode_2_test: Fail # Bug 6592
-
[ $compiler == dart2js && $runtime == drt ]
hash_set_test: Pass, Fail # v8 bug: Issue 12293
list_test: Pass, Fail # v8 bug: Issue 12293
@@ -31,9 +29,7 @@
[ $runtime == ie9 ]
double_round4_test: Fail, OK # IE bug: Math.round(4503599627370497) != 4503599627370497.
double_round_to_double3_test: Fail, OK # IE bug: Math.round(4503599627370497) != 4503599627370497.
-
-[ $compiler == dart2js && ($runtime == chrome || $runtime == drt || $runtime == d8 || $runtime == safari) ]
-string_trim_unicode_test: Fail # V8 bug 2408
+collection_length_test: Pass, Timeout # Issue 12844
[ $runtime == opera ]
core_runtime_types_test: Fail
@@ -41,27 +37,18 @@
date_time7_test: Fail
unicode_test: Fail
-[ $runtime == vm ]
-string_trim_unicode_test: Fail # Bug 6569
-
[ $compiler == dart2js ]
error_stack_trace1_test: Fail # Issue 12399
-math_parse_double_test: Fail # Expect.equals(expected: <78187493520>, actual: <0>)
-math_test: Fail # issue 3333
-surrogate_pair_toUpper_test: Fail # Issue 6707
big_integer_vm_test: Fail, OK # VM specific test.
compare_to2_test: Fail, OK # Requires bigint support.
string_base_vm_test: Fail, OK # VM specific test.
-string_replace_func_test: Skip # Bug 6554 - doesn't terminate.
-
[ $compiler == dart2js && $runtime == none ]
*: Fail, Pass # TODO(ahe): Triage these tests.
[ $compiler == dart2js && $runtime == ie9 ]
date_time7_test: Fail # BUG(3304): Maybe this doesn't time out?
-json_strict_test: Fail # IE parses slightly harmless no-standard JSON.
string_base_vm_test: Fail # BUG(3304): Maybe this doesn't time out?
list_test: Fail # IE doesn't support typed data.
@@ -115,4 +102,4 @@
collection_length_test: Pass, Timeout
[ $arch == simmips && $mode == debug ]
-collection_to_string_test: Pass, Crash # Issue: 11207
+collection_to_string_test: Pass, Crash # Issue: 11207
\ No newline at end of file
diff --git a/tests/corelib/json_test.dart b/tests/corelib/json_test.dart
index f22cb98..e5d0758 100644
--- a/tests/corelib/json_test.dart
+++ b/tests/corelib/json_test.dart
@@ -115,7 +115,7 @@
testError(integers: "");
// Test for "Initial zero only allowed for zero integer part" moved to
- // json_strict_test.dart because IE's JSON.parse accepts additional initial
+ // json_strict_test.dart because IE's JSON.decode accepts additional initial
// zeros.
// Only minus allowed as sign.
diff --git a/tests/corelib/linked_hash_map_from_iterable_test.dart b/tests/corelib/linked_hash_map_from_iterable_test.dart
index 02c9029..a8de693 100644
--- a/tests/corelib/linked_hash_map_from_iterable_test.dart
+++ b/tests/corelib/linked_hash_map_from_iterable_test.dart
@@ -101,12 +101,17 @@
}
void genericTypeTest() {
- var map = new LinkedHashMap<int, String>.fromIterable([1, 2, 3], value: (x) => '$x');
+ var map = new LinkedHashMap<int, String>.fromIterable(
+ <int>[1, 2, 3], value: (x) => '$x');
Expect.isTrue(map is Map<int, String>);
Expect.isTrue(map is LinkedHashMap<int, String>);
+ map = new LinkedHashMap<String, String>.fromIterable(
+ <int>[1, 2, 3], key: (x) => '$x', value: (x) => '$x');
+ Expect.isTrue(map is Map<String, String>);
+ Expect.isTrue(map is LinkedHashMap<String, String>);
+
// Make sure it is not just LinkedHashMap<dynamic, dynamic>.
- Expect.isFalse(map is LinkedHashMap<String, dynamic>);
+ Expect.isFalse(map is LinkedHashMap<int, dynamic>);
Expect.isFalse(map is LinkedHashMap<dynamic, int>);
}
-
diff --git a/tests/corelib/map_from_iterable_test.dart b/tests/corelib/map_from_iterable_test.dart
index c5aa0c0..ed86cde 100644
--- a/tests/corelib/map_from_iterable_test.dart
+++ b/tests/corelib/map_from_iterable_test.dart
@@ -16,10 +16,10 @@
}
void defaultFunctionValuesTest() {
- var map = new Map.fromIterable([1, 2, 3]);
+ var map = new HashMap.fromIterable([1, 2, 3]);
Expect.isTrue(map is Map);
- Expect.isTrue(map is LinkedHashMap);
+ Expect.isTrue(map is HashMap);
Expect.equals(3, map.length);
Expect.equals(3, map.keys.length);
@@ -31,10 +31,10 @@
}
void defaultKeyFunctionTest() {
- var map = new Map.fromIterable([1, 2, 3], value: (x) => x + 1);
+ var map = new HashMap.fromIterable([1, 2, 3], value: (x) => x + 1);
Expect.isTrue(map is Map);
- Expect.isTrue(map is LinkedHashMap);
+ Expect.isTrue(map is HashMap);
Expect.equals(3, map.length);
Expect.equals(3, map.keys.length);
@@ -46,10 +46,10 @@
}
void defaultValueFunctionTest() {
- var map = new Map.fromIterable([1, 2, 3], key: (x) => x + 1);
+ var map = new HashMap.fromIterable([1, 2, 3], key: (x) => x + 1);
Expect.isTrue(map is Map);
- Expect.isTrue(map is LinkedHashMap);
+ Expect.isTrue(map is HashMap);
Expect.equals(3, map.length);
Expect.equals(3, map.keys.length);
@@ -61,11 +61,11 @@
}
void noDefaultValuesTest() {
- var map = new Map.fromIterable([1, 2, 3],
+ var map = new HashMap.fromIterable([1, 2, 3],
key: (x) => x + 1, value: (x) => x - 1);
Expect.isTrue(map is Map);
- Expect.isTrue(map is LinkedHashMap);
+ Expect.isTrue(map is HashMap);
Expect.equals(3, map.length);
Expect.equals(3, map.keys.length);
@@ -77,9 +77,9 @@
}
void emptyIterableTest() {
- var map = new Map.fromIterable([]);
+ var map = new HashMap.fromIterable([]);
Expect.isTrue(map is Map);
- Expect.isTrue(map is LinkedHashMap);
+ Expect.isTrue(map is HashMap);
Expect.equals(0, map.length);
Expect.equals(0, map.keys.length);
@@ -87,10 +87,10 @@
}
void equalElementsTest() {
- var map = new Map.fromIterable([1, 2, 2], key: (x) => x + 1);
+ var map = new HashMap.fromIterable([1, 2, 2], key: (x) => x + 1);
Expect.isTrue(map is Map);
- Expect.isTrue(map is LinkedHashMap);
+ Expect.isTrue(map is HashMap);
Expect.equals(2, map.length);
Expect.equals(2, map.keys.length);
@@ -101,11 +101,12 @@
}
void genericTypeTest() {
- var map = new Map<int, String>.fromIterable([1, 2, 3], value: (x) => '$x');
- Expect.isTrue(map is Map<int, String>);
+ var map = new HashMap<String, String>.fromIterable(
+ <int>[1, 2, 3], key: (x) => '$x', value: (x) => '$x');
+ Expect.isTrue(map is Map<String, String>);
// Make sure it is not just Map<dynamic, dynamic>.
- Expect.isFalse(map is Map<String, dynamic>);
+ Expect.isFalse(map is Map<int, dynamic>);
Expect.isFalse(map is Map<dynamic, int>);
}
diff --git a/tests/corelib/string_source_test.dart b/tests/corelib/string_source_test.dart
new file mode 100644
index 0000000..9c16be5
--- /dev/null
+++ b/tests/corelib/string_source_test.dart
@@ -0,0 +1,35 @@
+// 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.
+
+// Test that different representations of the same string are all equal.
+
+import "dart:json" as json;
+
+import "package:expect/expect.dart";
+
+main() {
+ var base = "\u{10412}";
+ var strings = [
+ "\u{10412}",
+ "𐐒",
+ new String.fromCharCodes([0xd801, 0xdc12]),
+ base[0] + base[1],
+ "$base",
+ "${base[0]}${base[1]}",
+ "${base[0]}${base.substring(1)}",
+ new String.fromCharCodes([0x10412]),
+ ("a" + base).substring(1),
+ (new StringBuffer()..writeCharCode(0xd801)
+ ..writeCharCode(0xdc12)).toString(),
+ (new StringBuffer()..writeCharCode(0x10412)).toString(),
+ json.parse('"\u{10412}"'),
+ json.parse('{"\u{10412}":[]}').keys.first
+ ];
+ for (String string in strings) {
+ Expect.equals(base.length, string.length);
+ Expect.equals(base, string);
+ Expect.equals(base.hashCode, string.hashCode);
+ Expect.listEquals(base.codeUnits.toList(), string.codeUnits.toList());
+ }
+}
diff --git a/tests/html/dromaeo_noop/dromaeo_smoke.dart b/tests/html/dromaeo_noop/dromaeo_smoke.dart
index 4dd24f2..68c5dc4 100644
--- a/tests/html/dromaeo_noop/dromaeo_smoke.dart
+++ b/tests/html/dromaeo_noop/dromaeo_smoke.dart
@@ -5,7 +5,7 @@
library dromaeo;
import 'dart:async';
import 'dart:html';
-import 'dart:json' as json;
+import "dart:convert";
import '../../../samples/third_party/dromaeo/common/common.dart';
import 'dart:math' as Math;
import '../../../pkg/unittest/lib/unittest.dart';
diff --git a/tests/html/element_test.dart b/tests/html/element_test.dart
index 199262f..42015fd 100644
--- a/tests/html/element_test.dart
+++ b/tests/html/element_test.dart
@@ -185,6 +185,7 @@
test('.html tr', () {
var table = new TableElement();
+ document.body.append(table);
var tBody = table.createTBody();
var node = tBody.createFragment('<tr><td>foo<td>bar').nodes.single;
expect(node, predicate((x) => x is TableRowElement,
@@ -196,6 +197,7 @@
test('.html td', () {
var table = new TableElement();
+ document.body.append(table);
var tBody = table.createTBody();
var tRow = tBody.addRow();
var node = tRow.createFragment('<td>foobar').nodes.single;
@@ -208,6 +210,7 @@
test('.html th', () {
var table = new TableElement();
+ document.body.append(table);
var tBody = table.createTBody();
var tRow = tBody.addRow();
var node = tRow.createFragment('<th>foobar').nodes.single;
@@ -593,6 +596,7 @@
group('matches', () {
test('matches', () {
var element = new DivElement();
+ document.body.append(element);
element.classes.add('test');
expect(element.matches('div'), true);
diff --git a/tests/html/html.status b/tests/html/html.status
index 98b47fb..29d55f0 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -2,6 +2,11 @@
# 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.
+cssstyledeclaration_test: Skip # Issue 12951
+indexeddb_3_test: Skip # Issue 12948
+indexeddb_4_test: Skip # Issue 12948
+indexeddb_5_test: Skip # Issue 12948
+
async_window_test: Skip #TODO(gram): investigating
event_test: Skip # Issue 1996
interactive_test: Skip # Must be run manually.
@@ -16,6 +21,9 @@
[ $compiler == none && ($runtime == drt || $runtime == dartium) && $mode == debug && $system == macos]
audiobuffersourcenode_test: Pass, Fail, Crash # http://crbug.com/256601
+[ $compiler == none && $runtime == dartium && $system == macos]
+canvasrenderingcontext2d_test/drawImage_video_element_dataUrl: Pass,Fail # Issue 11834
+
[ $compiler == none && ($runtime == drt || $runtime == dartium) ]
# postMessage in dartium always transfers the typed array buffer, never a view
postmessage_structured_test/typed_arrays: Fail
@@ -30,9 +38,11 @@
dom_isolates_test: Skip # Need to migrate to new spawnDomFunction.
[ $compiler == dart2js && $runtime == ie10 ]
-indexeddb_3_test: Pass, Timeout, Slow # Issue: http://dartbug.com/9437
-indexeddb_4_test: Pass, Timeout, Slow # Issue: http://dartbug.com/9437
async_test: Pass, Fail # timers test fails on ie10.
+indexeddb_2_test: Fail # Issue 12893
+indexeddb_3_test: Fail, Timeout # Issue 9437 + 12893
+indexeddb_4_test: Fail, Timeout # Issue 9437 + 12893
+indexeddb_5_test: Fail # Issue 12893
[ $compiler == dart2js && ( $runtime == ie9 || $runtime == ie10 ) ]
worker_api_test: Fail # IE does not support URL.createObjectURL in web workers.
@@ -84,7 +94,7 @@
dromaeo_smoke_test: Skip #TODO(efortuna): investigating.
element_test/click: Fail # IE does not support firing this event.
history_test/history: Pass, Fail # issue 8183
-indexeddb_1_test/functional: Pass, Timeout # http://dartbug.com/9269
+indexeddb_1_test/functional: Fail, Timeout # Issue 9269 + 12893
isolates_test: Skip
microtask_test: Fail, Pass # Appears to be flaky
native_gc_test: Fail, Pass # BUG(7774): Untriaged.
@@ -145,8 +155,6 @@
dom_constructors_test: Fail
dromaeo_smoke_test: Skip #TODO(efortuna): investigating.
element_test/click: Fail # IE does not support firing this event.
-element_test/constructors: Fail # IE9 does not support innerHTML on table elements
-element_test/matches: Fail # IE9 does not support matches
form_element_test: Fail # Issue 4793.
isolates_test: Skip # BUG(4016)
localstorage_test: Fail
@@ -158,6 +166,7 @@
canvasrenderingcontext2d_test/drawImage_video_element_dataUrl: Fail # IE does not support drawImage w/ video element
canvasrenderingcontext2d_test/drawImage_image_element: Pass, Fail # Issue: 11416
input_element_test/attributes: Fail # IE returns null while others ''
+xhr_cross_origin_test: Skip # Issue 12920
# IE9 Feature support statuses-
# All changes should be accompanied by platform support annotation changes.
@@ -237,7 +246,6 @@
websocket_test/supported: Fail
websql_test/supported: Fail
worker_test/supported: Fail
-xhr_cross_origin_test/supported: Fail
xhr_test/supported_HttpRequestProgressEvent: Fail
xhr_test/supported_onLoadEnd: Fail
xhr_test/supported_onProgress: Fail
@@ -356,9 +364,6 @@
xhr_test/supported_HttpRequestProgressEvent: Fail
-[ $runtime == ff && ($system == linux || $system == windows) ]
-rtc_test/functionality: Fail # Issue: 12109.
-
# 'html' tests import the HTML library, so they only make sense in
# a browser environment.
[ $runtime == vm ]
@@ -379,3 +384,6 @@
js_test: Skip # Test cannot run under CSP restrictions (times out).
postmessage_structured_test: Skip # Test cannot run under CSP restrictions (times out).
safe_dom_test: Skip # Test cannot run under CSP restrictions (times out).
+
+[ $compiler == dart2js && $runtime == drt ]
+wheelevent_test: Fail # http://dartbug.com/12958
diff --git a/tests/html/node_validator_test.dart b/tests/html/node_validator_test.dart
index 7f76762..ae25743 100644
--- a/tests/html/node_validator_test.dart
+++ b/tests/html/node_validator_test.dart
@@ -87,6 +87,11 @@
'<div><script></script><script></script></div>',
'<div></div>');
+ testHtml('blocks inline styles',
+ validator,
+ '<div style="background: red"></div>',
+ '<div></div>');
+
testHtml('blocks namespaced attributes',
validator,
'<div ns:foo="foo"></div>',
@@ -373,6 +378,34 @@
'<foreignobject width="100" height="150"></foreignobject>'
'</svg>');
});
+
+ group('allowInlineStyles', () {
+ var validator = new NodeValidatorBuilder()
+ ..allowTextElements()
+ ..allowInlineStyles();
+
+ testHtml('allows inline styles',
+ validator,
+ '<span style="background-color:red">text</span>');
+
+ testHtml('blocks other attributes',
+ validator,
+ '<span class="red-span"></span>',
+ '<span></span>');
+
+ validator = new NodeValidatorBuilder()
+ ..allowTextElements()
+ ..allowInlineStyles(tagName: 'span');
+
+ testHtml('scoped allows inline styles on spans',
+ validator,
+ '<span style="background-color:red">text</span>');
+
+ testHtml('scoped blocks inline styles on LIs',
+ validator,
+ '<li style="background-color:red">text</li>',
+ '<li>text</li>');
+ });
});
group('throws', () {
diff --git a/tests/html/safe_dom_test.dart b/tests/html/safe_dom_test.dart
index 15f781c..7407d76 100644
--- a/tests/html/safe_dom_test.dart
+++ b/tests/html/safe_dom_test.dart
@@ -70,7 +70,7 @@
}
if (Range.supportsCreateContextualFragment) {
- var range = doc.$dom_createRange();
+ var range = doc.createRange();
range.selectNode(contextElement);
return range.createContextualFragment(html);
} else {
diff --git a/tests/html/wheelevent_test.dart b/tests/html/wheelevent_test.dart
index ce801f5..4acb908 100644
--- a/tests/html/wheelevent_test.dart
+++ b/tests/html/wheelevent_test.dart
@@ -19,7 +19,7 @@
element.onMouseWheel.listen(expectAsync1((e) {
expect(e.screen.x, 100);
expect(e.deltaX, 0);
- expect(e.deltaY, 240);
+ expect(e.deltaY.toDouble(), 240.0);
expect(e.deltaMode, isNotNull);
}));
var event = new WheelEvent(eventType,
@@ -36,7 +36,7 @@
element.onMouseWheel.listen(expectAsync1((e) {
expect(e.screen.x, 100);
expect(e.deltaX, 0);
- expect(e.deltaY, 240);
+ expect(e.deltaY.toDouble(), 240.0);
}));
var event = new WheelEvent(eventType,
deltaX: 0,
diff --git a/tests/html/xhr_cross_origin_test.dart b/tests/html/xhr_cross_origin_test.dart
index a9eda40..5a0f6cb 100644
--- a/tests/html/xhr_cross_origin_test.dart
+++ b/tests/html/xhr_cross_origin_test.dart
@@ -6,7 +6,7 @@
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_individual_config.dart';
import 'dart:html';
-import 'dart:json' as json;
+import "dart:convert";
/**
* Examine the value of "crossOriginPort" as passed in from the url from
@@ -42,7 +42,7 @@
var gotError = false;
var url = '$host/root_dart/tests/html/xhr_cross_origin_data.txt';
return HttpRequest.request(url).then((xhr) {
- var data = json.parse(xhr.response);
+ var data = JSON.decode(xhr.response);
expect(data, contains('feed'));
expect(data['feed'], contains('entry'));
expect(data, isMap);
@@ -92,7 +92,7 @@
xhr.onReadyStateChange.listen((e) {
guardAsync(() {
if (xhr.readyState == HttpRequest.DONE) {
- validate(json.parse(xhr.response));
+ validate(JSON.decode(xhr.response));
}
});
});
@@ -102,7 +102,7 @@
test('XHR.getWithCredentials Cross-domain', () {
var url = '$host/root_dart/tests/html/xhr_cross_origin_data.txt';
return HttpRequest.request(url, withCredentials: true).then((xhr) {
- var data = json.parse(xhr.response);
+ var data = JSON.decode(xhr.response);
expect(data, contains('feed'));
expect(data['feed'], contains('entry'));
expect(data, isMap);
diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart
index 1d53209..b5c538b 100644
--- a/tests/html/xhr_test.dart
+++ b/tests/html/xhr_test.dart
@@ -7,7 +7,7 @@
import '../../pkg/unittest/lib/html_individual_config.dart';
import 'dart:async';
import 'dart:html';
-import 'dart:json' as json;
+import "dart:convert";
import 'dart:typed_data';
void fail(message) {
@@ -26,7 +26,7 @@
void validate200Response(xhr) {
expect(xhr.status, equals(200));
- var data = json.parse(xhr.responseText);
+ var data = JSON.decode(xhr.responseText);
expect(data, contains('feed'));
expect(data['feed'], contains('entry'));
expect(data, isMap);
diff --git a/tests/isolate/global_error_handler2_test.dart b/tests/isolate/global_error_handler2_test.dart
index d038f88..a71d595 100644
--- a/tests/isolate/global_error_handler2_test.dart
+++ b/tests/isolate/global_error_handler2_test.dart
@@ -7,7 +7,7 @@
import 'package:expect/expect.dart';
import 'dart:async';
import 'dart:isolate';
-import '../async_helper.dart';
+import "package:async_helper/async_helper.dart";
runTest() {
SendPort mainIsolate;
diff --git a/tests/isolate/global_error_handler_stream2_test.dart b/tests/isolate/global_error_handler_stream2_test.dart
index 8590046..8a1aa5f 100644
--- a/tests/isolate/global_error_handler_stream2_test.dart
+++ b/tests/isolate/global_error_handler_stream2_test.dart
@@ -7,7 +7,7 @@
import 'package:expect/expect.dart';
import 'dart:async';
import 'dart:isolate';
-import '../async_helper.dart';
+import "package:async_helper/async_helper.dart";
runTest() {
IsolateSink mainIsolate;
diff --git a/tests/isolate/illegal_msg_stream_test.dart b/tests/isolate/illegal_msg_stream_test.dart
index 2271ed5..5f80065 100644
--- a/tests/isolate/illegal_msg_stream_test.dart
+++ b/tests/isolate/illegal_msg_stream_test.dart
@@ -6,7 +6,7 @@
import 'package:expect/expect.dart';
import 'dart:isolate';
-import '../async_helper.dart';
+import "package:async_helper/async_helper.dart";
funcFoo(x) => x + 2;
diff --git a/tests/isolate/illegal_msg_test.dart b/tests/isolate/illegal_msg_test.dart
index aa17b46..ed29bd9 100644
--- a/tests/isolate/illegal_msg_test.dart
+++ b/tests/isolate/illegal_msg_test.dart
@@ -5,7 +5,7 @@
library illegal_msg_tests;
import "package:expect/expect.dart";
import 'dart:isolate';
-import '../async_helper.dart';
+import "package:async_helper/async_helper.dart";
funcFoo(x) => x + 2;
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 5798289..1e076c7 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -22,9 +22,6 @@
spawn_uri_vm_negative_test: Fail
unresolved_ports_negative_test: Fail
-[ $compiler == dart2analyzer ]
-isolate_import_negative_test: Fail
-
[ $compiler == dart2js && $jscl ]
browser/*: SkipByDesign # Browser specific tests
illegal_msg_stream_test: Fail # Issue 6750
diff --git a/tests/isolate/isolate2_negative_test.dart b/tests/isolate/isolate2_negative_test.dart
index 01cf0ed..49ccb2e 100644
--- a/tests/isolate/isolate2_negative_test.dart
+++ b/tests/isolate/isolate2_negative_test.dart
@@ -7,7 +7,7 @@
library isolate2_negative_test;
import 'dart:isolate';
-import '../async_helper.dart';
+import "package:async_helper/async_helper.dart";
void entry() {
throw "foo";
diff --git a/tests/isolate/mandel_isolate_stream_test.dart b/tests/isolate/mandel_isolate_stream_test.dart
index 302696e..ffe3c9a 100644
--- a/tests/isolate/mandel_isolate_stream_test.dart
+++ b/tests/isolate/mandel_isolate_stream_test.dart
@@ -13,6 +13,8 @@
const ISOLATES = 20;
main() {
+ // Test is really slow in debug builds of the VM.
+ unittestConfiguration.timeout = const Duration(seconds: 480);
test("Render Mandelbrot in parallel", () {
final state = new MandelbrotState();
state._validated.future.then(expectAsync1((result) {
diff --git a/tests/isolate/mandel_isolate_test.dart b/tests/isolate/mandel_isolate_test.dart
index 3e03544..9e3e14f 100644
--- a/tests/isolate/mandel_isolate_test.dart
+++ b/tests/isolate/mandel_isolate_test.dart
@@ -13,6 +13,8 @@
const ISOLATES = 20;
main() {
+ // Test is really slow in debug builds of the VM.
+ unittestConfiguration.timeout = const Duration(seconds: 480);
test("Render Mandelbrot in parallel", () {
final state = new MandelbrotState();
state._validated.future.then(expectAsync1((result) {
diff --git a/tests/json/json_test.dart b/tests/json/json_test.dart
index ca21451..891fef3 100644
--- a/tests/json/json_test.dart
+++ b/tests/json/json_test.dart
@@ -4,7 +4,7 @@
library json_tests;
import "package:expect/expect.dart";
-import 'dart:json' as json;
+import "dart:convert";
import 'dart:html';
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
@@ -13,61 +13,61 @@
useHtmlConfiguration();
test('Parse', () {
// Scalars.
- expect(json.parse(' 5 '), equals(5));
- expect(json.parse(' -42 '), equals(-42));
- expect(json.parse(' 3e0 '), equals(3));
- expect(json.parse(' 3.14 '), equals(3.14));
- expect(json.parse('true '), isTrue);
- expect(json.parse(' false'), isFalse);
- expect(json.parse(' null '), isNull);
- expect(json.parse('\n\rnull\t'), isNull);
- expect(json.parse(' "hi there\\" bob" '), equals('hi there" bob'));
- expect(json.parse(' "" '), isEmpty);
+ expect(JSON.decode(' 5 '), equals(5));
+ expect(JSON.decode(' -42 '), equals(-42));
+ expect(JSON.decode(' 3e0 '), equals(3));
+ expect(JSON.decode(' 3.14 '), equals(3.14));
+ expect(JSON.decode('true '), isTrue);
+ expect(JSON.decode(' false'), isFalse);
+ expect(JSON.decode(' null '), isNull);
+ expect(JSON.decode('\n\rnull\t'), isNull);
+ expect(JSON.decode(' "hi there\\" bob" '), equals('hi there" bob'));
+ expect(JSON.decode(' "" '), isEmpty);
// Lists.
- expect(json.parse(' [] '), isEmpty);
- expect(json.parse('[ ]'), isEmpty);
- expect(json.parse(' [3, -4.5, true, "hi", false] '),
+ expect(JSON.decode(' [] '), isEmpty);
+ expect(JSON.decode('[ ]'), isEmpty);
+ expect(JSON.decode(' [3, -4.5, true, "hi", false] '),
equals([3, -4.5, true, 'hi', false]));
// Nulls are tricky.
- expect(json.parse('[null]'), orderedEquals([null]));
- expect(json.parse(' [3, -4.5, null, true, "hi", false] '),
+ expect(JSON.decode('[null]'), orderedEquals([null]));
+ expect(JSON.decode(' [3, -4.5, null, true, "hi", false] '),
equals([3, -4.5, null, true, 'hi', false]));
- expect(json.parse('[[null]]'), equals([[null]]));
- expect(json.parse(' [ [3], [], [null], ["hi", true]] '),
+ expect(JSON.decode('[[null]]'), equals([[null]]));
+ expect(JSON.decode(' [ [3], [], [null], ["hi", true]] '),
equals([[3], [], [null], ['hi', true]]));
// Maps.
- expect(json.parse(' {} '), isEmpty);
- expect(json.parse('{ }'), isEmpty);
+ expect(JSON.decode(' {} '), isEmpty);
+ expect(JSON.decode('{ }'), isEmpty);
- expect(json.parse(
+ expect(JSON.decode(
' {"x":3, "y": -4.5, "z" : "hi","u" : true, "v": false } '),
equals({"x":3, "y": -4.5, "z" : "hi", "u" : true, "v": false }));
- expect(json.parse(' {"x":3, "y": -4.5, "z" : "hi" } '),
+ expect(JSON.decode(' {"x":3, "y": -4.5, "z" : "hi" } '),
equals({"x":3, "y": -4.5, "z" : "hi" }));
- expect(json.parse(' {"y": -4.5, "z" : "hi" ,"x":3 } '),
+ expect(JSON.decode(' {"y": -4.5, "z" : "hi" ,"x":3 } '),
equals({"y": -4.5, "z" : "hi" ,"x":3 }));
- expect(json.parse('{ " hi bob " :3, "": 4.5}'),
+ expect(JSON.decode('{ " hi bob " :3, "": 4.5}'),
equals({ " hi bob " :3, "": 4.5}));
- expect(json.parse(' { "x" : { } } '), equals({ 'x' : {}}));
- expect(json.parse('{"x":{}}'), equals({ 'x' : {}}));
+ expect(JSON.decode(' { "x" : { } } '), equals({ 'x' : {}}));
+ expect(JSON.decode('{"x":{}}'), equals({ 'x' : {}}));
// Nulls are tricky.
- expect(json.parse('{"w":null}'), equals({ 'w' : null}));
+ expect(JSON.decode('{"w":null}'), equals({ 'w' : null}));
- expect(json.parse('{"x":{"w":null}}'), equals({"x":{"w":null}}));
+ expect(JSON.decode('{"x":{"w":null}}'), equals({"x":{"w":null}}));
- expect(json.parse(' {"x":3, "y": -4.5, "z" : "hi",'
+ expect(JSON.decode(' {"x":3, "y": -4.5, "z" : "hi",'
'"w":null, "u" : true, "v": false } '),
equals({"x":3, "y": -4.5, "z" : "hi",
"w":null, "u" : true, "v": false }));
- expect(json.parse('{"x": {"a":3, "b": -4.5}, "y":[{}], '
+ expect(JSON.decode('{"x": {"a":3, "b": -4.5}, "y":[{}], '
'"z":"hi","w":{"c":null,"d":true}, "v":null}'),
equals({"x": {"a":3, "b": -4.5}, "y":[{}],
"z":"hi","w":{"c":null,"d":true}, "v":null}));
@@ -75,34 +75,34 @@
test('stringify', () {
// Scalars.
- expect(json.stringify(5), equals('5'));
- expect(json.stringify(-42), equals('-42'));
+ expect(JSON.encode(5), equals('5'));
+ expect(JSON.encode(-42), equals('-42'));
// Dart does not guarantee a formatting for doubles,
// so reparse and compare to the original.
validateRoundTrip(3.14);
- expect(json.stringify(true), equals('true'));
- expect(json.stringify(false), equals('false'));
- expect(json.stringify(null), equals('null'));
- expect(json.stringify(' hi there" bob '), equals('" hi there\\" bob "'));
- expect(json.stringify('hi\\there'), equals('"hi\\\\there"'));
+ expect(JSON.encode(true), equals('true'));
+ expect(JSON.encode(false), equals('false'));
+ expect(JSON.encode(null), equals('null'));
+ expect(JSON.encode(' hi there" bob '), equals('" hi there\\" bob "'));
+ expect(JSON.encode('hi\\there'), equals('"hi\\\\there"'));
// TODO(devoncarew): these tests break the dartium build
- //expect(json.stringify('hi\nthere'), equals('"hi\\nthere"'));
- //expect(json.stringify('hi\r\nthere'), equals('"hi\\r\\nthere"'));
- expect(json.stringify(''), equals('""'));
+ //expect(JSON.encode('hi\nthere'), equals('"hi\\nthere"'));
+ //expect(JSON.encode('hi\r\nthere'), equals('"hi\\r\\nthere"'));
+ expect(JSON.encode(''), equals('""'));
// Lists.
- expect(json.stringify([]), equals('[]'));
- expect(json.stringify(new List(0)), equals('[]'));
- expect(json.stringify(new List(3)), equals('[null,null,null]'));
+ expect(JSON.encode([]), equals('[]'));
+ expect(JSON.encode(new List(0)), equals('[]'));
+ expect(JSON.encode(new List(3)), equals('[null,null,null]'));
validateRoundTrip([3, -4.5, null, true, 'hi', false]);
- expect(json.stringify([[3], [], [null], ['hi', true]]),
+ expect(JSON.encode([[3], [], [null], ['hi', true]]),
equals('[[3],[],[null],["hi",true]]'));
// Maps.
- expect(json.stringify({}), equals('{}'));
- expect(json.stringify(new Map()), equals('{}'));
- expect(json.stringify({'x':{}}), equals('{"x":{}}'));
- expect(json.stringify({'x':{'a':3}}), equals('{"x":{"a":3}}'));
+ expect(JSON.encode({}), equals('{}'));
+ expect(JSON.encode(new Map()), equals('{}'));
+ expect(JSON.encode({'x':{}}), equals('{"x":{}}'));
+ expect(JSON.encode({'x':{'a':3}}), equals('{"x":{"a":3}}'));
// Dart does not guarantee an order on the keys
// of a map literal, so reparse and compare to the original Map.
@@ -114,17 +114,17 @@
{'x':{'a':3, 'b':-4.5}, 'y':[{}], 'z':'hi', 'w':{'c':null, 'd':true},
'v':null});
- expect(json.stringify(new ToJson(4)), "4");
- expect(json.stringify(new ToJson([4, "a"])), '[4,"a"]');
- expect(json.stringify(new ToJson([4, new ToJson({"x":42})])),
+ expect(JSON.encode(new ToJson(4)), "4");
+ expect(JSON.encode(new ToJson([4, "a"])), '[4,"a"]');
+ expect(JSON.encode(new ToJson([4, new ToJson({"x":42})])),
'[4,{"x":42}]');
Expect.throws(() {
- json.stringify([new ToJson(new ToJson(4))]);
+ JSON.encode([new ToJson(new ToJson(4))]);
});
Expect.throws(() {
- json.stringify([new Object()]);
+ JSON.encode([new Object()]);
});
});
@@ -134,7 +134,7 @@
* Checks that we get an exception (rather than silently returning null) if
* we try to stringify something that cannot be converted to json.
*/
- expect(() => json.stringify(new TestClass()), throws);
+ expect(() => JSON.encode(new TestClass()), throws);
});
}
@@ -156,7 +156,7 @@
* back, and produce something equivalent to the argument.
*/
validateRoundTrip(expected) {
- expect(json.parse(json.stringify(expected)), equals(expected));
+ expect(JSON.decode(JSON.encode(expected)), equals(expected));
}
diff --git a/tests/language/abstract_syntax_test.dart b/tests/language/abstract_syntax_test.dart
index 531b0ef2..875b203 100644
--- a/tests/language/abstract_syntax_test.dart
+++ b/tests/language/abstract_syntax_test.dart
@@ -10,8 +10,8 @@
}
class A {
- /* abstract */ foo();
- /* abstract */ static bar(); /// 01: compile-time error
+ foo(); /// 00: static type warning
+ static bar(); /// 01: compile-time error
}
class B extends A {
diff --git a/tests/language/call_nonexistent_static_test.dart b/tests/language/call_nonexistent_static_test.dart
index dd2835f..b97b542 100644
--- a/tests/language/call_nonexistent_static_test.dart
+++ b/tests/language/call_nonexistent_static_test.dart
@@ -24,7 +24,7 @@
}
alwaysThrows() {
- throw new NoSuchMethodError(null, 'foo', [], {});
+ throw new NoSuchMethodError(null, const Symbol('foo'), [], {});
}
test01() {
diff --git a/tests/language/class_cycle2_test.dart b/tests/language/class_cycle2_test.dart
new file mode 100644
index 0000000..5e352b3
--- /dev/null
+++ b/tests/language/class_cycle2_test.dart
@@ -0,0 +1,18 @@
+// 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.
+// Check fail because of cycles in super class relationship.
+
+class C extends B {}
+
+class A extends B {}
+
+class B
+ extends A /// 01: compile-time error
+ extends A /// 02: compile-time error
+{}
+
+main() {
+ new C(); /// 01: continued
+ new List<C>(); /// 02: continued
+}
diff --git a/tests/language/class_cycle_negative_test.dart b/tests/language/class_cycle_negative_test.dart
deleted file mode 100644
index f54b9f8..0000000
--- a/tests/language/class_cycle_negative_test.dart
+++ /dev/null
@@ -1,24 +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.
-// Check fail because of cycles in super class relationship.
-
-class C extends B {
-
-}
-
-class A extends B {
-
-}
-
-class B extends A {
-
-}
-
-class ClassCycleNegativeTest {
- static testMain() {
- }
-}
-main() {
- ClassCycleNegativeTest.testMain();
-}
diff --git a/tests/language/constructor2_negative_test.dart b/tests/language/constructor9_test.dart
similarity index 66%
rename from tests/language/constructor2_negative_test.dart
rename to tests/language/constructor9_test.dart
index 013ffc0..4c7a74e 100644
--- a/tests/language/constructor2_negative_test.dart
+++ b/tests/language/constructor9_test.dart
@@ -1,22 +1,18 @@
// 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.
-// Check that all final instance fields of a class are initialized by constructors.
+
+// Check that all final instance fields of a class are initialized by
+// constructors.
class Klass {
Klass(var v): field_ = v { }
- final uninitializedFinalField_;
+ final uninitializedFinalField_; /// 01: compile-time error
var field_;
}
-class Constructor2NegativeTest {
- static testMain() {
- var o = new Klass(5);
- }
-}
-
main() {
- Constructor2NegativeTest.testMain();
+ new Klass(5);
}
diff --git a/tests/language/constructor_return_negative_test.dart b/tests/language/constructor_return_negative_test.dart
deleted file mode 100644
index 112b565..0000000
--- a/tests/language/constructor_return_negative_test.dart
+++ /dev/null
@@ -1,11 +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.
-
-class A {
- A() { return null; }
-}
-
-main() {
- new A();
-}
diff --git a/tests/language/constructor_return_test.dart b/tests/language/constructor_return_test.dart
index 8f30645..f46c9ec 100644
--- a/tests/language/constructor_return_test.dart
+++ b/tests/language/constructor_return_test.dart
@@ -8,10 +8,18 @@
// statements in the form 'return;'.
class A {
int x;
- A(this.x) { return; } // 'return;' is equivalent to 'return this;'
+ A(this.x) { return; }
+ A.test1(this.x) {
+ return this; /// 01: compile-time error
+ }
+ A.test2(this.x) {
+ return null; /// 02: compile-time error
+ }
int foo(int y) => x + y;
}
main() {
Expect.equals((new A(1)).foo(10), 11);
+ Expect.equals((new A.test1(1)).foo(10), 11);
+ Expect.equals((new A.test2(1)).foo(10), 11);
}
diff --git a/tests/language/inferrer_synthesized_constructor_test.dart b/tests/language/inferrer_synthesized_constructor_test.dart
new file mode 100644
index 0000000..aa6c52b
--- /dev/null
+++ b/tests/language/inferrer_synthesized_constructor_test.dart
@@ -0,0 +1,27 @@
+// 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's type inferrer that used to not
+// propagate default types in synthesized calls.
+
+import "package:expect/expect.dart";
+
+class A {
+ final x;
+ A([this.x = 'foo']);
+}
+
+class B extends A {
+ // The synthesized constructor was not saying that it would call
+ // [A]'s constructor with its default type.
+}
+
+main() {
+ // By calling [B]'s constructor with an int parameter, the inferrer
+ // used to only see this call and consider the [A.x] field to always
+ // be int.
+ Expect.equals(84, new A(42).x + 42);
+ Expect.throws(() => new B().x + 42,
+ (e) => e is ArgumentError || e is TypeError);
+}
diff --git a/tests/language/instanceof4_test.dart b/tests/language/instanceof4_test.dart
index 1a3d1ca..86282da 100644
--- a/tests/language/instanceof4_test.dart
+++ b/tests/language/instanceof4_test.dart
@@ -22,23 +22,23 @@
Expect.isTrue(!o.isNotT());
Expect.isTrue(o.isListT());
Expect.isTrue(!o.isNotListT());
- Expect.isTrue(!o.isAlsoListT());
- Expect.isTrue(o.isNeitherListT());
+ Expect.isTrue(!o.isAlsoListT()); /// 01: ok
+ Expect.isTrue(o.isNeitherListT()); /// 01: ok
for (var i = 0; i < 20; i++) {
// Make sure methods are optimized.
o.isT();
o.isNotT();
o.isListT();
o.isNotListT();
- o.isAlsoListT();
- o.isNeitherListT();
+ o.isAlsoListT(); /// 01: ok
+ o.isNeitherListT(); /// 01: ok
}
- Expect.isTrue(o.isT());
- Expect.isTrue(!o.isNotT());
- Expect.isTrue(o.isListT());
- Expect.isTrue(!o.isNotListT());
- Expect.isTrue(!o.isAlsoListT());
- Expect.isTrue(o.isNeitherListT());
+ Expect.isTrue(o.isT(), "1");
+ Expect.isTrue(!o.isNotT(), "2");
+ Expect.isTrue(o.isListT(), "3");
+ Expect.isTrue(!o.isNotListT(), "4");
+ Expect.isTrue(!o.isAlsoListT(), "5"); /// 01: ok
+ Expect.isTrue(o.isNeitherListT(), "6"); /// 01: ok
}
testFooInt() {
diff --git a/tests/language/interface_cycle_negative_test.dart b/tests/language/interface_cycle_negative_test.dart
deleted file mode 100644
index f8e268b..0000000
--- a/tests/language/interface_cycle_negative_test.dart
+++ /dev/null
@@ -1,25 +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.
-// Check fail because of cycles in super interface relationship.
-
-abstract class C implements B {
-
-}
-
-abstract class A implements B {
-
-}
-
-abstract class B implements A {
-
-}
-
-class InterfaceCycleNegativeTest {
- static testMain() {
- }
-}
-
-main() {
- InterfaceCycleNegativeTest.testMain();
-}
diff --git a/tests/language/interface_cycle_test.dart b/tests/language/interface_cycle_test.dart
new file mode 100644
index 0000000..db57fd1
--- /dev/null
+++ b/tests/language/interface_cycle_test.dart
@@ -0,0 +1,18 @@
+// 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.
+// Check fail because of cycles in super interface relationship.
+
+class C implements B {}
+
+class A implements B {}
+
+class B
+ implements A /// 01: compile-time error
+ implements A /// 02: compile-time error
+{}
+
+main() {
+ new C(); /// 01: continued
+ new List<C>(); /// 02: continued
+}
diff --git a/tests/language/language.status b/tests/language/language.status
index 8e8443b..1470441 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -18,12 +18,10 @@
constructor5_test: Fail # Issue 6422
constructor6_test: Fail # Issue 6422
closure_in_initializer_test: Fail # Issue 6422
-call_nonexistent_constructor_test: Fail # Issue 12820
# Regular bugs which should be fixed.
super_first_constructor_test: Fail # Issue 1372.
lazy_static3_test: Fail # Issue 12593
-export_cyclic_test: Fail, Crash # Issue 6060
duplicate_export_negative_test: Fail # Issue 6134
on_catch_malformed_type_test: Fail # Issue 8601
mixin_mixin_test: Fail # Issue 9683
@@ -57,6 +55,5 @@
dynamic_prefix_core_test: Fail # Issue 12478
[ $compiler == none && $runtime == drt ]
-vm/reflect_core_vm_test: Fail # Temporarily marked as fail.
mixin_illegal_object_test/01: pass # Issue 10952.
mixin_illegal_object_test/02: pass # Issue 10952.
diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status
index 80e7313..0eea3a2 100644
--- a/tests/language/language_analyzer.status
+++ b/tests/language/language_analyzer.status
@@ -10,6 +10,10 @@
# TBD: using built-in identifers
built_in_identifier_prefix_test: fail # Issue 12694
+# TBD: these look like bad tests, no issue number
+class_literal_test: fail
+constructor_call_as_function_test/01: fail
+
# TBF: It is a static type warning if a type parameter is a supertype of its upper bound.
cyclic_type_variable_test/01: fail
cyclic_type_variable_test/02: fail
@@ -54,8 +58,6 @@
pseudo_kw_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
lazy_static3_test: fail
@@ -80,7 +82,6 @@
# test issue 11575, classes with abstrac members are not marked as abstract
abstract_factory_constructor_test/none: fail # Issue 11575
-abstract_syntax_test/none: fail # Issue 11575
get_set_syntax_test/none: fail # Issue 11575
implicit_this_test/none: fail # Issue 11575
interface_test/none: fail # Issue 11575
@@ -134,10 +135,9 @@
# test issue 11595, It is static warning to create instance (new) of the malformed type
instantiate_type_variable_negative_test: fail
-# test issue 11598, Any use of a malbounded type gives rise to a static warning
-mixin_type_parameters_errors_test/01: fail
-mixin_type_parameters_errors_test/02: fail
-mixin_type_parameters_errors_test/05: fail
+mixin_type_parameters_errors_test/01: fail # Issue 11598
+mixin_type_parameters_errors_test/02: fail # Issue 11598
+mixin_type_parameters_errors_test/05: fail # Issue 11598
# test issue 11698, no setter, so warning, not error
assign_instance_method_negative_test: fail
@@ -168,7 +168,7 @@
# test issue 12157, uninitializer instance variable is warning, so not negative test
static_final_field_negative_test: fail
-constructor2_negative_test: fail
+constructor9_test/01: fail # Issue 12157
# test issue 12159, print(exception.message_); causes static warning, not an error
throw7_negative_test: fail
@@ -196,9 +196,6 @@
# test issue 12191, ambiguous import is always warning now
prefix3_negative_test: fail # Issue 12191
library_ambiguous_test/00: fail # Issue 12191
-library_ambiguous_test/01: fail # Issue 12191
-library_ambiguous_test/02: fail # Issue 12191
-library_ambiguous_test/03: fail # Issue 12191
# test issue 12289, assignment in assert statement
type_error_test: fail # Issue 12289
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index 96785d6..1a19e14 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -7,24 +7,12 @@
# Runtime negative test. No static errors or warnings.
closure_call_wrong_argument_count_negative_test: skip
-illegal_invocation_test/01: fail # Issue: 11892
-
-# TBF: m([int p = 'String'])
-assign_static_type_test/06: fail
-
# TBD: using built-in identifers
built_in_identifier_prefix_test: fail # Issue 12694
-# TBF: (o as C) is not rolled back
-cast_test/04: fail
-cast_test/05: fail
-
-# TBF: It is a compile-time error if the superclass of a class C appears in the implements clause of C.
-const_constructor_super_test/01: fail
-
-# TBF: m([int p = 'String']) and call 'const' instance creation
-compile_time_constant_checked2_test/03: fail
-compile_time_constant_checked3_test/03: fail
+# TBD: these look like bad tests, no issue number
+class_literal_test: fail
+constructor_call_as_function_test/01: fail
# TBF: It is a static type warning if a type parameter is a supertype of its upper bound.
cyclic_type_variable_test/01: fail
@@ -49,20 +37,14 @@
list_literal_syntax_test/03: fail # Issue 12103
malformed_test/none: fail # Issue 12696
-# TBF: disallowed in the most recent spec
-named_parameters_aggregated_test/03: fail
-positional_parameters_type_test: fail
-
-# TBF: non-const superinitializer; 7.6.3 Constant Constructors: The superinitializer that appears, explicitly or implicitly, in the initializer list of a constant constructor must specify a constant constructor of the superclass of the immediately enclosing class.
-non_const_super_negative_test: fail
-
# TBF: 1is int; invalid character in number
number_identifier_negative_test: fail
# TBF: we should check conflicts not only for methods, but for accessors too
-override_field_test/01: fail
override_field_test/02: fail
override_field_test/03: fail
+method_override7_test/03: Fail # Issue 11496
+method_override8_test/03: Fail # Issue 11496
# TBF: prefix T hidden by type variable T in 'new T.Class()'
prefix10_negative_test: fail
@@ -75,28 +57,6 @@
# TBF
pseudo_kw_test: fail
-# TBF: hiding at start of the block and declared after declaration statement
-scope_negative_test: fail
-
-# TBF: 'instance.staticMethod()' is static warning
-static_field_test/01: fail
-static_field_test/02: fail
-static_field_test/03: fail
-
-# TBF
-method_override2_test/00: fail # issue 11497
-method_override2_test/01: fail # issue 11497
-method_override2_test/02: fail # issue 11497
-method_override2_test/03: fail # issue 11497
-method_override3_test/00: fail # issue 11497
-method_override3_test/01: fail # issue 11497
-method_override3_test/02: fail # issue 11497
-method_override4_test: fail # issue 11497
-method_override5_test: fail # issue 11497
-method_override6_test: fail # issue 11497
-
-
-
# test issue 10683, It is a compile-time error if e refers to the name v or the name v=.
block_scope_test: fail
@@ -117,37 +77,30 @@
const_escape_frog_test: fail
compile_time_constant_test/none: fail
-# Test issue 11544, using @TypeName as annotation is not valid
-inferrer_constructor2_test: fail
-inferrer_constructor3_test: fail
-multiple_field_assignment_constructor_test: fail
-
# Test issue 11545, using not existing constructor name in annotation
metadata_test: fail
-# Test issue 11564, named parameter starts with '_'
-named_parameters_with_object_property_names_test: fail
-
# test issue 11575, classes with abstrac members are not marked as abstract
-abstract_factory_constructor_test/none: fail
-abstract_syntax_test/none: fail
-get_set_syntax_test/none: fail
-implicit_this_test/none: fail
-interface_test/none: fail
-syntax_test/none: fail
+abstract_factory_constructor_test/none: fail # Issue 11575
+get_set_syntax_test/none: fail # Issue 11575
+implicit_this_test/none: fail # Issue 11575
+interface_test/none: fail # Issue 11575
+syntax_test/none: fail # Issue 11575
# test issue 11576
-bad_constructor_test/none: fail
+bad_constructor_test/none: fail # Issue 11576
# test issue 11577, has return type for []=
-cascade_test/none: fail
+cascade_test/none: fail # Issue 11577
# test issue 11578, redirecting factory with not subtype
-factory5_test/none: fail
-factory_redirection_test/none: fail
-type_variable_bounds_test/none: fail
-type_variable_scope_test/none: fail
-factory_implementation_test/none: fail
+factory5_test/none: fail # Issue 11578
+factory_redirection_test/none: fail # Issue 11578
+type_variable_bounds_test/none: fail # Issue 11578
+type_variable_scope_test/none: fail # Issue 11578
+factory_implementation_test/none: fail # Issue 11578
+
+redirecting_factory_malbounded_test/none: Fail # Issue 12827
# test issue 11579, assignment, no setter
getter_no_setter_test/none: fail
@@ -182,10 +135,9 @@
# test issue 11595, It is static warning to create instance (new) of the malformed type
instantiate_type_variable_negative_test: fail
-# test issue 11598, Any use of a malbounded type gives rise to a static warning
-mixin_type_parameters_errors_test/01: fail
-mixin_type_parameters_errors_test/02: fail
-mixin_type_parameters_errors_test/05: fail
+mixin_type_parameters_errors_test/01: fail # Issue 11598
+mixin_type_parameters_errors_test/02: fail # Issue 11598
+mixin_type_parameters_errors_test/05: fail # Issue 11598
# test issue 11698, no setter, so warning, not error
assign_instance_method_negative_test: fail
@@ -216,7 +168,7 @@
# test issue 12157, uninitializer instance variable is warning, so not negative test
static_final_field_negative_test: fail
-constructor2_negative_test: fail
+constructor9_test/01: fail # Issue 12157
# test issue 12159, print(exception.message_); causes static warning, not an error
throw7_negative_test: fail
@@ -236,22 +188,34 @@
# test issue 12163, unresolved identifier is static warning in static context
unresolved_in_factory_negative_test: fail # Issue 12163
-unresolved_top_level_method_negative_test: fail # Issue 12163
unresolved_top_level_var_negative_test: fail # Issue 12163
# test issue 12181, uses argument definition test
constructor_initializer_test: fail # Issue 12181
-# test issue 12191, ambuguous import is always warning now
+# test issue 12191, ambiguous import is always warning now
prefix3_negative_test: fail # Issue 12191
library_ambiguous_test/00: fail # Issue 12191
-library_ambiguous_test/01: fail # Issue 12191
-library_ambiguous_test/02: fail # Issue 12191
-library_ambiguous_test/03: fail # Issue 12191
# test issue 12289, assignment in assert statement
type_error_test: fail # Issue 12289
+# test issue 12381, It is compile-time error to invoke not existing function
+issue11724_test: fail # Issue 12381
+call_nonexistent_static_test/08: fail # Issue 12381
+
+# test issue 12397; it is static warning, not error to use variable before declaration (or hidden)
+scope_negative_test: fail # Issue 12397
+
+# test issue 12539, rules for finals were loosened, contradiction in spec was fixed
+const_syntax_test/09: fail # Issue 12539
+
+# test issue 12541; there shouldn't be a static warning
+static_field_test/01: fail # Issue 12541
+static_field_test/02: fail # Issue 12541
+static_field_test/03: fail # Issue 12541
+static_field_test/04: fail # Issue 12541
+
[ $compiler == dart2analyzer && $checked ]
factory1_test/00: fail
factory1_test/01: fail
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 113b668..7db88ec 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -67,6 +67,11 @@
compile_time_constant_checked3_test/05: Fail, OK
compile_time_constant_checked3_test/06: Fail, OK
generic_test: Fail, OK
+named_parameters_type_test/01: Fail, OK
+named_parameters_type_test/02: Fail, OK
+named_parameters_type_test/03: Fail, OK
+positional_parameters_type_test/01: Fail, OK
+positional_parameters_type_test/02: Fail, OK
[ $compiler == dart2js && $minified ]
f_bounded_quantification4_test: Fail # Issue 12605.
@@ -111,15 +116,12 @@
getter_no_setter_test/01: Fail # Issue 5519
not_enough_positional_arguments_test/01: Fail # Issue 12838
not_enough_positional_arguments_test/02: Fail # Issue 12838
-not_enough_positional_arguments_test/04: Fail # Issue 12838
not_enough_positional_arguments_test/05: Fail # Issue 12838
dynamic_test: Fail # Issue 12398
dynamic_prefix_core_test: Fail # Issue 12398
metadata_test: Fail # Issue 5841
infinity_test: Fail # Issue 4984
positive_bit_operations_test: Fail # Issue 12795
-named_parameters_type_test: Fail
-positional_parameters_type_test: Fail
# Compilation errors.
const_var_test: Fail # Issue 12793
@@ -128,11 +130,6 @@
function_type_alias5_test/01: Fail # Issue 12754
function_type_alias5_test/02: Fail # Issue 12754
function_type_alias7_test/00: Fail # Issue 12801
-get_set_syntax_test/00: Fail # Issue 12805
-get_set_syntax_test/01: Fail # Issue 12805
-get_set_syntax_test/02: Fail # Issue 12805
-get_set_syntax_test/03: Fail # Issue 12805
-get_set_syntax_test/04: Fail # Issue 12805
method_binding_test: Fail # Issue 12807
method_override_test: Fail # Issue 12808
method_override5_test: Fail # Issue 12809
@@ -140,45 +137,33 @@
named_parameters_aggregated_test/01: Fail # Issue 12801
named_parameters_aggregated_test/03: Fail # Issue 12812
pseudo_kw_test: Fail # Unexpected token '('
-super_implicit_closure_test: Fail # internal error: super property read not implemented
-
-# Missing compilation error for wrong number of type arguments.
-mixin_type_parameters_errors_test/01: Fail
-mixin_type_parameters_errors_test/02: Fail
-mixin_type_parameters_errors_test/05: Fail
-
-# External tests.
-external_test/01: Fail
-external_test/02: Fail
-external_test/11: Fail
-external_test/12: Fail
-external_test/13: Skip # Runtime error (missing patch).
-external_test/14: Fail
-external_test/20: Skip # Runtime error (missing patch).
-external_test/21: Fail
-external_test/22: Fail
-external_test/23: Fail
-external_test/30: Fail
-external_test/31: Fail
-
-
-# Implementation errors (library or generated code).
-instanceof4_test: Fail # Expect.isTrue(false) fails.
-list_literal4_test: Fail # Illegal argument(s): 0 -- checked mode test.
-map_literal4_test: Fail # Attempt to modify an immutable object -- checked mode test.
-
-class_cycle_negative_test: Fail, OK # Bad test: assumes eager loading.
-interface_cycle_negative_test: Fail, OK # Bad test: assumes eager loading.
-
+super_implicit_closure_test: Fail # Issue 12884
+mixin_type_parameters_errors_test/01: Fail # Issue 12885
+mixin_type_parameters_errors_test/02: Fail # Issue 12885
+mixin_type_parameters_errors_test/05: Fail # Issue 12885
+external_test/11: Fail # Issue 12887
+external_test/12: Fail # Issue 12887
+external_test/13: Fail # Issue 12887
+external_test/21: Fail # Issue 12887
+external_test/22: Fail # Issue 12887
+external_test/23: Fail # Issue 12887
+external_test/30: Fail # Issue 12887
+external_test/31: Fail # Issue 12887
+instanceof4_test/01: Fail # Issue 12889
+list_literal4_test: Fail # Issue 12890
+map_literal4_test: Fail # Issue 12891
#
# The following tests are all negative tests that should be fixed.
#
-abstract_syntax_test/01: Fail # Negative language test.
-const_constructor_syntax_test/04: Fail # Negative language test.
-const_syntax_test/04: Fail # Negative language test.
-constructor2_negative_test: Fail # Negative language test.
-constructor_return_negative_test: Fail # Negative language test.
+const_constructor_syntax_test/04: Fail # Issue 12900
+const_syntax_test/01: Fail # Issue 12932
+const_syntax_test/02: Fail # Issue 12932
+const_syntax_test/03: Fail # Issue 12932
+const_syntax_test/04: Fail # Issue 12932
+constructor9_test/01: Fail # Issue 12934
+constructor_return_test/01: Fail # Issue 12937
+constructor_return_test/02: Fail # Issue 12937
constructor_return_with_arrow_negative_test: Fail # Negative language test.
constructor_return_with_init_and_arrow_negative_test: Fail # Negative language test.
constructor_return_with_init_negative_test: Fail # Negative language test.
@@ -186,22 +171,12 @@
duplicate_implements_test/02: Fail # Negative language test.
duplicate_implements_test/03: Fail # Negative language test.
duplicate_implements_test/04: Fail # Negative language test.
-field3_negative_test: Fail # Negative language test.
instantiate_type_variable_negative_test: Pass # For the wrong reason.
list_literal1_negative_test: Fail # Negative language test.
map_literal1_negative_test: Fail # Negative language test.
number_identifier_negative_test: Fail # Negative language test.
-operator1_negative_test: Fail # Negative language test.
scope_negative_test: Fail # Negative language test.
static_final_field_negative_test: Fail # Negative language test.
-static_top_level_test/00: Fail # Negative language test.
-static_top_level_test/01: Fail # Negative language test.
-static_top_level_test/02: Fail # Negative language test.
-static_top_level_test/03: Fail # Negative language test.
-static_top_level_test/04: Fail # Negative language test.
-static_top_level_test/05: Fail # Negative language test.
-static_top_level_test/06: Fail # Negative language test.
-static_top_level_test/07: Fail # Negative language test.
throw7_negative_test: Fail # Negative language test.
numbers_test: Fail, OK # (unintended?) VM specific test.
@@ -210,9 +185,6 @@
final_syntax_test/02: Fail # Missing error for uninitialized final field.
final_syntax_test/03: Fail # Missing error for uninitialized final field.
final_syntax_test/04: Fail # Missing error for uninitialized final field.
-const_syntax_test/01: Fail # Missing error for uninitialized final field.
-const_syntax_test/02: Fail # Missing error for uninitialized final field.
-const_syntax_test/03: Fail # Missing error for uninitialized final field.
canonical_const2_test: Fail, OK # Dart2js only has doubles.
@@ -247,7 +219,6 @@
expect_test: Fail
stack_overflow_test: Fail
stack_overflow_stacktrace_test: Fail
-licm2_test: Pass, Timeout # Issue: 11848
[ $runtime == opera ]
@@ -279,8 +250,9 @@
on_catch_malformed_type_test: Fail # Issue 8601
-# False positive compile-time error is masking expected compile-time error
-mixin_type_parameters_errors_test/*: Skip
+mixin_type_parameters_errors_test/01: Fail # Issue 12886
+mixin_type_parameters_errors_test/02: Fail # Issue 12886
+mixin_type_parameters_errors_test/05: Fail # Issue 12886
# Mixins fail on the VM.
mixin_mixin_test: Fail # Issue 9683
@@ -325,16 +297,19 @@
compile_time_constant_arguments_test/03: Fail # Issue 5519
compile_time_constant_arguments_test/05: Fail # Issue 5519
compile_time_constant_arguments_test/06: Fail # Issue 5519
-const_constructor_syntax_test/04: Fail # Issue 5519
-const_syntax_test/01: Fail # Issue 5519
-const_syntax_test/02: Fail # Issue 5519
-const_syntax_test/03: Fail # Issue 5519
-const_syntax_test/04: Fail # Issue 5519
-const_syntax_test/05: Fail # Issue 5519
-const_syntax_test/06: Fail # Issue 5519
-const_syntax_test/07: Fail # Issue 5519
-const_syntax_test/08: Fail # Issue 5519
-const_syntax_test/10: Fail # Issue 5519
+const_constructor_syntax_test/04: Fail # Issue 12901
+const_syntax_test/01: Fail # Issue 12933
+const_syntax_test/02: Fail # Issue 12933
+const_syntax_test/03: Fail # Issue 12933
+const_syntax_test/04: Fail # Issue 12933
+const_syntax_test/05: Fail # Issue 12933
+const_syntax_test/06: Fail # Issue 12933
+const_syntax_test/07: Fail # Issue 12933
+const_syntax_test/08: Fail # Issue 12933
+const_syntax_test/10: Fail # Issue 12933
+constructor9_test/01: Fail # Issue 12935
+constructor_return_test/01: Fail # Issue 12938
+constructor_return_test/02: Fail # Issue 12938
constructor_named_arguments_test/01: Fail # Issue 5519
final_syntax_test/01: Fail # Issue 5519
final_syntax_test/02: Fail # Issue 5519
@@ -345,21 +320,23 @@
named_parameters_aggregated_test/03: Fail # Issue 12813
not_enough_positional_arguments_test/01: Fail # Issue 12839
not_enough_positional_arguments_test/02: Fail # Issue 12839
-not_enough_positional_arguments_test/04: Fail # Issue 12839
not_enough_positional_arguments_test/05: Fail # Issue 12839
metadata_test: Fail # Issue 12762
const_var_test: Pass, Fail # Issue 12794
map_literal3_test: Fail # Issue 12794
-class_cycle_negative_test: Fail, OK # Bad test: assumes eager loading.
-interface_cycle_negative_test: Fail, OK # Bad test: assumes eager loading.
# Common problems with dart2js. In illegal family, invalid
# declarations are simply not parsed. In pseudo kw dart2js
# chokes on things like typedef(x) => "typedef $x" and alike.
-abstract_syntax_test/01: Fail
pseudo_kw_test: Fail
-# external keyword is not yet supported by dart2js/dart2dart.
-external_test/*: Skip
+external_test/11: Fail # Issue 12888
+external_test/12: Fail # Issue 12888
+external_test/13: Fail # Issue 12888
+external_test/21: Fail # Issue 12888
+external_test/22: Fail # Issue 12888
+external_test/23: Fail # Issue 12888
+external_test/30: Fail # Issue 12888
+external_test/31: Fail # Issue 12888
lazy_static3_test: Fail # Issue 12593
# dart2js frontend doesn't even analyse problematic classes.
duplicate_implements_test/01: Fail
@@ -368,16 +345,7 @@
duplicate_implements_test/04: Fail
method_override4_test: Fail # Issue 12810
method_override5_test: Fail # Issue 12810
-operator1_negative_test: Fail
static_final_field_negative_test: Fail
-static_top_level_test/00: Fail
-static_top_level_test/01: Fail
-static_top_level_test/02: Fail
-static_top_level_test/03: Fail
-static_top_level_test/04: Fail
-static_top_level_test/05: Fail
-static_top_level_test/06: Fail
-static_top_level_test/07: Fail
# Bug in dart2js parser: it happily parses 1is int; variable declaration.
number_identifier_negative_test: Fail
# Common with language_dart2js.
@@ -392,6 +360,7 @@
function_type_alias5_test/02: Fail # Issue 12755
function_type_alias7_test/00: Fail # Issue 12802
parameter_initializer6_negative_test: Fail # Issue 3502
+
# DartVM problem.
constructor5_test: Fail
constructor6_test: Fail
@@ -404,12 +373,6 @@
new_expression_type_args_test/00: Fail # Wrongly reports compile-time error.
new_expression_type_args_test/01: Fail # Wrongly reports compile-time error.
-get_set_syntax_test/00: Fail # Issue 12806
-get_set_syntax_test/01: Fail # Issue 12806
-get_set_syntax_test/02: Fail # Issue 12806
-get_set_syntax_test/03: Fail # Issue 12806
-get_set_syntax_test/04: Fail # Issue 12806
-
# Only checked mode reports an error on type assignment
# problems in compile time constants.
compile_time_constant_checked_test/02: Fail, OK
@@ -426,7 +389,6 @@
compile_time_constant_checked3_test/05: Fail, OK
compile_time_constant_checked3_test/06: Fail, OK
-positional_parameters_type_test: Fail # Triage this.
final_is_not_const_test/01: Fail # Issue 12692
[ $compiler == dart2dart && $minified ]
@@ -441,3 +403,9 @@
prefix22_test: Pass
invocation_mirror_test: Fail, OK # Issue 12706 (hardcoded names).
super_call4_test: Fail, OK # hardcoded names.
+
+[ $minified ]
+stack_trace_test: Fail, OK # Stack trace not preserved in minified code.
+
+[ $runtime == ie9 ]
+stack_trace_test: Fail, OK # Stack traces not available in IE9.
diff --git a/tests/language/mixin_prefix_lib.dart b/tests/language/mixin_prefix_lib.dart
index 9c1295f..8536e28 100644
--- a/tests/language/mixin_prefix_lib.dart
+++ b/tests/language/mixin_prefix_lib.dart
@@ -4,8 +4,8 @@
library mixin_prefix_lib;
-import 'dart:json' as json;
+import "dart:convert";
class MixinClass {
- String bar() => json.stringify({'a':1});
+ String bar() => JSON.encode({'a':1});
}
diff --git a/tests/language/named_parameters_type_test.dart b/tests/language/named_parameters_type_test.dart
index 1eb7a7f..5f84489 100644
--- a/tests/language/named_parameters_type_test.dart
+++ b/tests/language/named_parameters_type_test.dart
@@ -1,54 +1,23 @@
// 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.
-// VMOptions=--enable_type_checks
+// VMOptions=--checked
//
// Dart test program for testing optional named parameters in type tests.
-import "package:expect/expect.dart";
-
-class NamedParametersTypeTest {
- static int testMain() {
- int result = 0;
- Function anyFunction;
- void acceptFunNumOptBool(void funNumOptBool(num n, {bool b})) { };
- void funNum(num n) { };
- void funNumBool(num n, bool b) { };
- void funNumOptBool(num n, {bool b: true}) { };
- void funNumOptBoolX(num n, {bool x: true}) { };
- anyFunction = funNum; // No error.
- anyFunction = funNumBool; // No error.
- anyFunction = funNumOptBool; // No error.
- anyFunction = funNumOptBoolX; // No error.
- acceptFunNumOptBool(funNumOptBool); // No error.
- try {
- acceptFunNumOptBool(funNum); // No static type warning.
- } on TypeError catch (error) {
- result += 1;
- var msg = error.toString();
- Expect.isTrue(msg.contains("(num, {b: bool}) => void")); // dstType
- Expect.isTrue(msg.contains("(num) => void")); // srcType
- }
- try {
- acceptFunNumOptBool(funNumBool); /// static type warning
- } on TypeError catch (error) {
- result += 10;
- var msg = error.toString();
- Expect.isTrue(msg.contains("(num, {b: bool}) => void")); // dstType
- Expect.isTrue(msg.contains("(num, bool) => void")); // srcType
- }
- try {
- acceptFunNumOptBool(funNumOptBoolX); /// static type warning
- } on TypeError catch (error) {
- result += 100;
- var msg = error.toString();
- Expect.isTrue(msg.contains("(num, {b: bool}) => void")); // dstType
- Expect.isTrue(msg.contains("(num, {x: bool}) => void")); // srcType
- }
- return result;
- }
-}
-
main() {
- Expect.equals(111, NamedParametersTypeTest.testMain());
+ Function anyFunction;
+ void acceptFunNumOptBool(void funNumOptBool(num n, {bool b})) { };
+ void funNum(num n) { };
+ void funNumBool(num n, bool b) { };
+ void funNumOptBool(num n, {bool b: true}) { };
+ void funNumOptBoolX(num n, {bool x: true}) { };
+ anyFunction = funNum;
+ anyFunction = funNumBool;
+ anyFunction = funNumOptBool;
+ anyFunction = funNumOptBoolX;
+ acceptFunNumOptBool(funNumOptBool);
+ acceptFunNumOptBool(funNum); /// 01: runtime error
+ acceptFunNumOptBool(funNumBool); /// 02: static type warning, runtime error
+ acceptFunNumOptBool(funNumOptBoolX); /// 03: static type warning, runtime error
}
diff --git a/tests/language/positional_parameters_type_test.dart b/tests/language/positional_parameters_type_test.dart
index 6c3c77d..7d14403 100644
--- a/tests/language/positional_parameters_type_test.dart
+++ b/tests/language/positional_parameters_type_test.dart
@@ -1,57 +1,23 @@
// 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.
-// VMOptions=--enable_type_checks
+// VMOptions=--checked
//
// Dart test program for testing optional positional parameters in type tests.
-import "package:expect/expect.dart";
-
-class NamedParametersTypeTest {
- static int testMain() {
- int result = 0;
- Function anyFunction;
- void acceptFunNumOptBool(void funNumOptBool(num n, [bool b])) { };
- void funNum(num n) { };
- void funNumBool(num n, bool b) { };
- void funNumOptBool(num n, [bool b = true]) { };
- void funNumOptBoolX(num n, [bool x = true]) { };
- anyFunction = funNum; // No error.
- anyFunction = funNumBool; // No error.
- anyFunction = funNumOptBool; // No error.
- anyFunction = funNumOptBoolX; // No error.
- acceptFunNumOptBool(funNumOptBool); // No error.
- try {
- acceptFunNumOptBool(funNum); // No static type warning.
- } on TypeError catch (error) {
- result += 1;
- var msg = error.toString();
- Expect.isTrue(msg.contains("'(num, [bool]) => void'")); // dstType
- Expect.isTrue(msg.contains("'(num) => void'")); // srcType
- Expect.isTrue(msg.contains("'funNumOptBool'")); // dstName
- Expect.isTrue(error.stackTrace.toString().contains(
- "positional_parameters_type_test.dart:14:35"));
- }
- try {
- acceptFunNumOptBool(funNumBool); /// static type warning
- } on TypeError catch (error) {
- result += 10;
- var msg = error.toString();
- Expect.isTrue(msg.contains("'(num, [bool]) => void'")); // dstType
- Expect.isTrue(msg.contains("'(num, bool) => void'")); // srcType
- Expect.isTrue(msg.contains("'funNumOptBool'")); // dstName
- Expect.isTrue(error.stackTrace.toString().contains(
- "positional_parameters_type_test.dart:14:35"));
- }
- try {
- acceptFunNumOptBool(funNumOptBoolX); // No static type warning.
- } on TypeError catch (error) {
- result += 100;
- }
- return result;
- }
-}
-
main() {
- Expect.equals(11, NamedParametersTypeTest.testMain());
+ Function anyFunction;
+ void acceptFunNumOptBool(void funNumOptBool(num n, [bool b])) { };
+ void funNum(num n) { };
+ void funNumBool(num n, bool b) { };
+ void funNumOptBool(num n, [bool b = true]) { };
+ void funNumOptBoolX(num n, [bool x = true]) { };
+ anyFunction = funNum;
+ anyFunction = funNumBool;
+ anyFunction = funNumOptBool;
+ anyFunction = funNumOptBoolX;
+ acceptFunNumOptBool(funNumOptBool);
+ acceptFunNumOptBool(funNumOptBoolX);
+ acceptFunNumOptBool(funNum); /// 01: runtime error
+ acceptFunNumOptBool(funNumBool); /// 02: static type warning, runtime error
}
diff --git a/tests/language/redirecting_factory_malbounded_test.dart b/tests/language/redirecting_factory_malbounded_test.dart
index 4c2ad37..6b754d8 100644
--- a/tests/language/redirecting_factory_malbounded_test.dart
+++ b/tests/language/redirecting_factory_malbounded_test.dart
@@ -6,7 +6,7 @@
factory Foo() = Bar;
- Foo.create() : super.create() { } // Super call required due to issue 5838.
+ Foo.create() : super.create() { }
}
class Bar<T
diff --git a/tests/language/stack_trace_test.dart b/tests/language/stack_trace_test.dart
index e2fd827..5b728a9 100644
--- a/tests/language/stack_trace_test.dart
+++ b/tests/language/stack_trace_test.dart
@@ -83,6 +83,57 @@
}
}
+
+// Test that the full stack trace is generated for rethrow.
+class RethrowStacktraceTest {
+ var config = 0;
+
+ issue12940() {
+ throw "Progy";
+ }
+
+ b() {
+ issue12940();
+ }
+
+ c() {
+ if (config == 0) {
+ try {
+ b();
+ } catch (e) {
+ rethrow;
+ }
+ } else {
+ try {
+ b();
+ } catch (e, s) {
+ rethrow;
+ }
+ }
+ }
+
+ d() {
+ c();
+ }
+
+ testBoth() {
+ for (config = 0; config < 2; config++) {
+ try {
+ d();
+ } catch (e, s) {
+ Expect.isTrue(s.toString().contains("issue12940"));
+ }
+ }
+ }
+
+ static testMain() {
+ var test = new RethrowStacktraceTest();
+ test.testBoth();
+ }
+}
+
+
main() {
StackTraceTest.testMain();
+ RethrowStacktraceTest.testMain();
}
diff --git a/tests/language/vm/reflect_core_vm_test.dart b/tests/language/vm/reflect_core_vm_test.dart
index d6e52f1..2474b21 100644
--- a/tests/language/vm/reflect_core_vm_test.dart
+++ b/tests/language/vm/reflect_core_vm_test.dart
@@ -10,11 +10,6 @@
main() {
var s = "string";
var im = reflect(s);
- try {
- im.invoke(const Symbol("_setAt"), [0, 65]);
- Expect.isTrue(false); // Unreachable.
- } catch (e) {
- Expect.equals(true, e is NoSuchMethodError);
- }
+ Expect.throws(() => im.invoke(const Symbol("_setAt"), [0, 65]), (e) => e is NoSuchMethodError);
}
diff --git a/tests/lib/analyzer/analyze_library.status b/tests/lib/analyzer/analyze_library.status
index 20a7804..227e5c6 100644
--- a/tests/lib/analyzer/analyze_library.status
+++ b/tests/lib/analyzer/analyze_library.status
@@ -3,6 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2analyzer ]
+lib/async/async: fail
lib/core/core: fail
lib/typed_data/typed_data: fail
lib/io/io: fail
diff --git a/tests/lib/analyzer/analyze_tests.status b/tests/lib/analyzer/analyze_tests.status
index a398c55..58217a9 100644
--- a/tests/lib/analyzer/analyze_tests.status
+++ b/tests/lib/analyzer/analyze_tests.status
@@ -9,7 +9,7 @@
standalone/io/status_file_parser_test: Skip # http/dartbug.com/12449
[ $compiler == dartanalyzer ]
-javascript_int_overflow_literal_test/01: fail, ok
+standalone/javascript_int_overflow_literal_test/01: fail, ok
# https://code.google.com/p/dart/issues/detail?id=11665
standalone/io/directory_invalid_arguments_test: fail
@@ -36,12 +36,11 @@
[ $compiler == dart2analyzer ]
-javascript_int_overflow_literal_test/01: fail, ok
+standalone/javascript_int_overflow_literal_test/01: fail, ok
# https://code.google.com/p/dart/issues/detail?id=11665
standalone/io/directory_invalid_arguments_test: fail
standalone/io/file_constructor_test: fail
-standalone/io/file_fuzz_test: fail
standalone/io/http_cookie_date_test: fail
standalone/io/http_headers_test: fail
standalone/io/http_parser_test: fail
@@ -60,4 +59,4 @@
standalone/typed_data_test: fail
# https://code.google.com/p/dart/issues/detail?id=11647
-standalone/package/package_isolate_test: fail
+standalone/package/package_isolate_test: fail
\ No newline at end of file
diff --git a/tests/lib/async/catch_errors10_test.dart b/tests/lib/async/catch_errors10_test.dart
index b554dbd..f2cfdee 100644
--- a/tests/lib/async/catch_errors10_test.dart
+++ b/tests/lib/async/catch_errors10_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
bool futureWasExecuted = false;
// Test that `catchErrors` waits for a future that has been delayed by
// `Timer.run`.
@@ -26,6 +24,6 @@
},
onDone: () {
Expect.isTrue(futureWasExecuted);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors11_test.dart b/tests/lib/async/catch_errors11_test.dart
index 53755261..dff9b83 100644
--- a/tests/lib/async/catch_errors11_test.dart
+++ b/tests/lib/async/catch_errors11_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that `catchErrors` catches errors that are delayed by `Timer.run`.
catchErrors(() {
@@ -28,7 +26,7 @@
"timer error",
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors12_test.dart b/tests/lib/async/catch_errors12_test.dart
index deb7cb4..af4acbc 100644
--- a/tests/lib/async/catch_errors12_test.dart
+++ b/tests/lib/async/catch_errors12_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Tests that errors that have been delayed by several milliseconds with
// Timers are still caught by `catchErrors`.
@@ -35,7 +33,7 @@
499,
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors13_test.dart b/tests/lib/async/catch_errors13_test.dart
index 7c6752a..1e3a8db 100644
--- a/tests/lib/async/catch_errors13_test.dart
+++ b/tests/lib/async/catch_errors13_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Work around bug that makes runAsync use Timers. By invoking `runAsync` here
// we make sure that asynchronous non-timer events are executed before any
@@ -54,7 +52,7 @@
"inner done throw"
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors14_test.dart b/tests/lib/async/catch_errors14_test.dart
index ebf34a1..bccc464 100644
--- a/tests/lib/async/catch_errors14_test.dart
+++ b/tests/lib/async/catch_errors14_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that periodic Timers are handled correctly by `catchErrors`.
catchErrors(() {
@@ -33,7 +31,7 @@
"error 6",
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors15_test.dart b/tests/lib/async/catch_errors15_test.dart
index 2cea6fe..e76a070 100644
--- a/tests/lib/async/catch_errors15_test.dart
+++ b/tests/lib/async/catch_errors15_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that the outer `catchErrors` waits for the nested `catchErrors` stream
// to be done.
@@ -46,7 +44,7 @@
"inner done",
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors16_test.dart b/tests/lib/async/catch_errors16_test.dart
index cb3621d..e2af768 100644
--- a/tests/lib/async/catch_errors16_test.dart
+++ b/tests/lib/async/catch_errors16_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
StreamController controller = new StreamController();
Stream stream = controller.stream;
@@ -29,7 +27,7 @@
"stream error 2",
],
events);
- port.close();
+ asyncEnd();
});
controller.add(1);
controller.addError(2);
diff --git a/tests/lib/async/catch_errors17_test.dart b/tests/lib/async/catch_errors17_test.dart
index bf19b09..8cb45c3 100644
--- a/tests/lib/async/catch_errors17_test.dart
+++ b/tests/lib/async/catch_errors17_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
StreamController controller;
// Test that errors do not cross zone boundaries.
@@ -40,6 +38,6 @@
"inner done",
],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors18_test.dart b/tests/lib/async/catch_errors18_test.dart
index 33e60ab..5d04a57 100644
--- a/tests/lib/async/catch_errors18_test.dart
+++ b/tests/lib/async/catch_errors18_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
Stream stream = new Stream.periodic(const Duration(milliseconds: 20),
(x) => x);
@@ -28,6 +26,6 @@
}).listen((x) { events.add("outer: $x"); },
onDone: () {
Expect.listEquals([0, 1, 2, 3, 4, "cancel"], events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors19_test.dart b/tests/lib/async/catch_errors19_test.dart
index dec100a..1bf5581 100644
--- a/tests/lib/async/catch_errors19_test.dart
+++ b/tests/lib/async/catch_errors19_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
Stream stream = new Stream.periodic(const Duration(milliseconds: 20),
(x) => x);
@@ -28,6 +26,6 @@
}).listen((x) { events.add("outer: $x"); },
onDone: () {
Expect.listEquals([0, 1, 2, 3, 4, 499], events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors20_test.dart b/tests/lib/async/catch_errors20_test.dart
index b0f0673..ffcf7c8 100644
--- a/tests/lib/async/catch_errors20_test.dart
+++ b/tests/lib/async/catch_errors20_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that nested stream (from `catchErrors`) that is delayed by a future
// is waited for.
@@ -31,6 +29,6 @@
"done",
],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors21_test.dart b/tests/lib/async/catch_errors21_test.dart
index 28dec7f..932a80b 100644
--- a/tests/lib/async/catch_errors21_test.dart
+++ b/tests/lib/async/catch_errors21_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
var controller = new StreamController();
// Test that stream errors, as a result of bad user-code (`map`) are correctly
@@ -34,7 +32,7 @@
"done",
],
events);
- port.close();
+ asyncEnd();
});
[1, 2, 3, 4].forEach(controller.add);
controller.close();
diff --git a/tests/lib/async/catch_errors22_test.dart b/tests/lib/async/catch_errors22_test.dart
index c47b3a3..2d92e8c 100644
--- a/tests/lib/async/catch_errors22_test.dart
+++ b/tests/lib/async/catch_errors22_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
bool onDoneWasCalled = false;
var controller = new StreamController();
@@ -36,6 +34,6 @@
"caught: 4",
],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors23_test.dart b/tests/lib/async/catch_errors23_test.dart
index 2d2ff72..d2dddab3 100644
--- a/tests/lib/async/catch_errors23_test.dart
+++ b/tests/lib/async/catch_errors23_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
StreamController controller;
Stream stream;
@@ -46,6 +44,6 @@
"inner done",
],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors24_test.dart b/tests/lib/async/catch_errors24_test.dart
index 4a5508f..c9d6e4b 100644
--- a/tests/lib/async/catch_errors24_test.dart
+++ b/tests/lib/async/catch_errors24_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
StreamController controller;
Stream stream;
@@ -50,6 +48,6 @@
"inner done",
],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors25_test.dart b/tests/lib/async/catch_errors25_test.dart
index 162a4a3..2360e9a 100644
--- a/tests/lib/async/catch_errors25_test.dart
+++ b/tests/lib/async/catch_errors25_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
StreamController controller;
// Test multiple subscribers of an asBroadcastStream inside the same
@@ -22,6 +20,6 @@
}).listen((x) { events.add("outer: $x"); },
onDone: () {
Expect.listEquals([1, 1, 2, 2], events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors26_test.dart b/tests/lib/async/catch_errors26_test.dart
index d14e1dd..8ac5431 100644
--- a/tests/lib/async/catch_errors26_test.dart
+++ b/tests/lib/async/catch_errors26_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
StreamController controller;
Stream stream;
@@ -47,6 +45,6 @@
"inner done",
],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors27_test.dart b/tests/lib/async/catch_errors27_test.dart
index a73c51d..23f8b99 100644
--- a/tests/lib/async/catch_errors27_test.dart
+++ b/tests/lib/async/catch_errors27_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
StreamController controller;
Stream stream;
@@ -52,6 +50,6 @@
"inner done",
],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors28_test.dart b/tests/lib/async/catch_errors28_test.dart
index 09a208f..1f13df4 100644
--- a/tests/lib/async/catch_errors28_test.dart
+++ b/tests/lib/async/catch_errors28_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that periodic Timers are handled correctly by `catchErrors`.
catchErrors(() {
@@ -29,7 +27,7 @@
1, 2, 3, 4, 5, 6,
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors2_test.dart b/tests/lib/async/catch_errors2_test.dart
index 18fefaf..4c0d77c 100644
--- a/tests/lib/async/catch_errors2_test.dart
+++ b/tests/lib/async/catch_errors2_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
bool futureWasExecuted = false;
// Make sure that `catchErrors` only closes the error stream when the inner
// futures are done.
@@ -24,6 +22,6 @@
},
onDone: () {
Expect.isTrue(futureWasExecuted);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors3_test.dart b/tests/lib/async/catch_errors3_test.dart
index 2edcfb2..ee55620 100644
--- a/tests/lib/async/catch_errors3_test.dart
+++ b/tests/lib/async/catch_errors3_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
bool futureWasExecuted = false;
bool future2WasExecuted = false;
@@ -32,6 +30,6 @@
onDone: () {
Expect.isTrue(futureWasExecuted);
Expect.isTrue(future2WasExecuted);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors4_test.dart b/tests/lib/async/catch_errors4_test.dart
index 5c1900b..3814ddf 100644
--- a/tests/lib/async/catch_errors4_test.dart
+++ b/tests/lib/async/catch_errors4_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that synchronous errors inside a `catchErrors` are caught.
catchErrors(() {
@@ -25,7 +23,7 @@
"catch error",
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors5_test.dart b/tests/lib/async/catch_errors5_test.dart
index 1d98f11..1bb8bba 100644
--- a/tests/lib/async/catch_errors5_test.dart
+++ b/tests/lib/async/catch_errors5_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that synchronous *and* asynchronous errors are caught by
// `catchErrors`.
@@ -28,7 +26,7 @@
"future error",
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors6_test.dart b/tests/lib/async/catch_errors6_test.dart
index f9b5261..58c4f74 100644
--- a/tests/lib/async/catch_errors6_test.dart
+++ b/tests/lib/async/catch_errors6_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var completer = new Completer();
var errorHandlerOrDoneHasBeenExecuted = false;
// Test that `catchErrors` doesn't shut down if a future is never completed.
@@ -26,6 +24,6 @@
});
Timer.run(() {
Expect.isFalse(errorHandlerOrDoneHasBeenExecuted);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors7_test.dart b/tests/lib/async/catch_errors7_test.dart
index 1d6310d..b241a2c 100644
--- a/tests/lib/async/catch_errors7_test.dart
+++ b/tests/lib/async/catch_errors7_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test that asynchronous errors are caught.
catchErrors(() {
@@ -32,7 +30,7 @@
499,
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors8_test.dart b/tests/lib/async/catch_errors8_test.dart
index f4ce992..7519fc6 100644
--- a/tests/lib/async/catch_errors8_test.dart
+++ b/tests/lib/async/catch_errors8_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test nested `catchErrors`.
// The nested `catchErrors` throws all kinds of different errors (synchronous
@@ -51,7 +49,7 @@
"inner done throw"
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/catch_errors9_test.dart b/tests/lib/async/catch_errors9_test.dart
index 5912bf1..f16bcfb 100644
--- a/tests/lib/async/catch_errors9_test.dart
+++ b/tests/lib/async/catch_errors9_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
bool futureWasExecuted = false;
// Test that `catchErrors` waits for `Timer.run` before closing its error
// stream.
@@ -24,6 +22,6 @@
},
onDone: () {
Expect.isTrue(futureWasExecuted);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/catch_errors_test.dart b/tests/lib/async/catch_errors_test.dart
index c981966..f4e0eef 100644
--- a/tests/lib/async/catch_errors_test.dart
+++ b/tests/lib/async/catch_errors_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Make sure `catchErrors` shuts down the error stream when the synchronous
// operation is done and there isn't any asynchronous pending callback.
catchErrors(() {
@@ -19,6 +17,6 @@
Expect.fail("Unexpected callback");
},
onDone: () {
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/future_delayed_error_test.dart b/tests/lib/async/future_delayed_error_test.dart
index be16cf0..b22da98 100644
--- a/tests/lib/async/future_delayed_error_test.dart
+++ b/tests/lib/async/future_delayed_error_test.dart
@@ -4,18 +4,16 @@
library future_delayed_error_test;
+import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
testImmediateError() {
- // An open ReceivePort keeps the VM running. If the error-handler below is not
- // executed then the test will fail with a timeout.
- var port = new ReceivePort();
+ asyncStart();
var future = new Future.error("error");
future.catchError((error) {
- port.close();
Expect.equals(error, "error");
+ asyncEnd();
});
}
@@ -26,10 +24,10 @@
}
testDelayedError() {
- var port = new ReceivePort();
+ asyncStart();
completedFuture.catchError((error) {
- port.close();
Expect.equals(error, "foobar");
+ asyncEnd();
});
}
diff --git a/tests/lib/async/future_test.dart b/tests/lib/async/future_test.dart
index 0074d81..2c81f05 100644
--- a/tests/lib/async/future_test.dart
+++ b/tests/lib/async/future_test.dart
@@ -4,18 +4,18 @@
library future_test;
+import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
const Duration MS = const Duration(milliseconds: 1);
void testValue() {
final future = new Future<String>.value("42");
- var port = new ReceivePort();
+ asyncStart();
future.then((x) {
Expect.equals("42", x);
- port.close();
+ asyncEnd();
});
}
@@ -78,11 +78,11 @@
int after;
- var port = new ReceivePort();
+ asyncStart();
future.then((int v) { after = v; })
.then((_) {
Expect.equals(3, after);
- port.close();
+ asyncEnd();
});
completer.complete(3);
@@ -97,11 +97,11 @@
completer.complete(3);
Expect.isNull(after);
- var port = new ReceivePort();
+ asyncStart();
future.then((int v) { after = v; })
.then((_) {
Expect.equals(3, after);
- port.close();
+ asyncEnd();
});
}
@@ -118,12 +118,12 @@
futures.add(future.then((int v) { after1 = v; }));
futures.add(future.then((int v) { after2 = v; }));
- var port = new ReceivePort();
+ asyncStart();
Future.wait(futures).then((_) {
Expect.equals(3, before);
Expect.equals(3, after1);
Expect.equals(3, after2);
- port.close();
+ asyncEnd();
});
}
@@ -134,12 +134,12 @@
final future = completer.future;
final ex = new Exception();
- var port = new ReceivePort();
+ asyncStart();
future
.then((v) { throw "Value not expected"; })
.catchError((error) {
Expect.equals(error, ex);
- port.close();
+ asyncEnd();
}, test: (e) => e == ex);
completer.completeError(ex);
}
@@ -156,10 +156,10 @@
completer.completeError(ex);
Expect.isTrue(completer.isCompleted);
- var port = new ReceivePort();
+ asyncStart();
done.then((_) {
Expect.equals(ex, ex2);
- port.close();
+ asyncEnd();
});
}
@@ -189,10 +189,10 @@
.catchError((e) { reached = true; });
completer.completeError(ex);
- var port = new ReceivePort();
+ asyncStart();
done.then((_) {
Expect.isTrue(reached);
- port.close();
+ asyncEnd();
});
}
@@ -216,7 +216,7 @@
void testFutureAsStreamCompleteAfter() {
var completer = new Completer();
bool gotValue = false;
- var port = new ReceivePort();
+ asyncStart();
completer.future.asStream().listen(
(data) {
Expect.isFalse(gotValue);
@@ -225,7 +225,7 @@
},
onDone: () {
Expect.isTrue(gotValue);
- port.close();
+ asyncEnd();
});
completer.complete("value");
}
@@ -233,7 +233,7 @@
void testFutureAsStreamCompleteBefore() {
var completer = new Completer();
bool gotValue = false;
- var port = new ReceivePort();
+ asyncStart();
completer.complete("value");
completer.future.asStream().listen(
(data) {
@@ -243,13 +243,13 @@
},
onDone: () {
Expect.isTrue(gotValue);
- port.close();
+ asyncEnd();
});
}
void testFutureAsStreamCompleteImmediate() {
bool gotValue = false;
- var port = new ReceivePort();
+ asyncStart();
new Future.value("value").asStream().listen(
(data) {
Expect.isFalse(gotValue);
@@ -258,14 +258,14 @@
},
onDone: () {
Expect.isTrue(gotValue);
- port.close();
+ asyncEnd();
});
}
void testFutureAsStreamCompleteErrorAfter() {
var completer = new Completer();
bool gotError = false;
- var port = new ReceivePort();
+ asyncStart();
completer.future.asStream().listen(
(data) {
Expect.fail("Unexpected data");
@@ -277,7 +277,7 @@
},
onDone: () {
Expect.isTrue(gotError);
- port.close();
+ asyncEnd();
});
completer.completeError("error");
}
@@ -285,7 +285,7 @@
void testFutureAsStreamWrapper() {
var completer = new Completer();
bool gotValue = false;
- var port = new ReceivePort();
+ asyncStart();
completer.complete("value");
completer.future
.catchError((_) { throw "not possible"; }) // Returns a future wrapper.
@@ -297,15 +297,15 @@
},
onDone: () {
Expect.isTrue(gotValue);
- port.close();
+ asyncEnd();
});
}
void testFutureWhenCompleteValue() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 2;
countDown() {
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
Future future = completer.future;
@@ -318,10 +318,10 @@
}
void testFutureWhenCompleteError() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 2;
countDown() {
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
Future future = completer.future;
@@ -334,10 +334,10 @@
}
void testFutureWhenCompleteValueNewError() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 2;
countDown() {
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
Future future = completer.future;
@@ -353,10 +353,10 @@
}
void testFutureWhenCompleteErrorNewError() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 2;
countDown() {
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
Future future = completer.future;
@@ -372,10 +372,10 @@
}
void testFutureWhenCompletePreValue() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 2;
countDown() {
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
Future future = completer.future;
@@ -391,11 +391,11 @@
void testFutureWhenValueFutureValue() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 3;
countDown(int expect) {
Expect.equals(expect, counter);
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
completer.future.whenComplete(() {
@@ -415,11 +415,11 @@
}
void testFutureWhenValueFutureError() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 3;
countDown(int expect) {
Expect.equals(expect, counter);
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
completer.future.whenComplete(() {
@@ -441,11 +441,11 @@
}
void testFutureWhenErrorFutureValue() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 3;
countDown(int expect) {
Expect.equals(expect, counter);
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
completer.future.whenComplete(() {
@@ -467,11 +467,11 @@
}
void testFutureWhenErrorFutureError() {
- var port = new ReceivePort();
+ asyncStart();
int counter = 3;
countDown(int expect) {
Expect.equals(expect, counter);
- if (--counter == 0) port.close();
+ if (--counter == 0) asyncEnd();
}
var completer = new Completer();
completer.future.whenComplete(() {
@@ -497,12 +497,12 @@
final future = completer.future;
int error = 42;
- var port = new ReceivePort();
+ asyncStart();
future.then((v) {
throw error;
}).catchError((e) {
Expect.identical(error, e);
- port.close();
+ asyncEnd();
});
completer.complete(0);
}
@@ -512,12 +512,12 @@
final future = completer.future;
int error = 42;
- var port = new ReceivePort();
+ asyncStart();
future.catchError((e) {
throw error;
}).catchError((e) {
Expect.identical(error, e);
- port.close();
+ asyncEnd();
});
completer.completeError(0);
}
@@ -527,13 +527,13 @@
final future = completer.future;
var error;
- var port = new ReceivePort();
+ asyncStart();
future.catchError((e) {
error = e;
throw e;
}).catchError((e) {
Expect.identical(error, e);
- port.close();
+ asyncEnd();
});
completer.completeError(0);
}
@@ -543,12 +543,12 @@
final future = completer.future;
var error = 42;
- var port = new ReceivePort();
+ asyncStart();
future.whenComplete(() {
throw error;
}).catchError((e) {
Expect.identical(error, e);
- port.close();
+ asyncEnd();
});
completer.complete(0);
}
@@ -558,10 +558,10 @@
final future = completer.future;
var error = 42;
- var port = new ReceivePort();
+ asyncStart();
future.catchError((e) {
Expect.identical(error, e);
- port.close();
+ asyncEnd();
});
completer.completeError(error);
@@ -570,12 +570,12 @@
void testChainedFutureValue() {
final completer = new Completer();
final future = completer.future;
- var port = new ReceivePort();
+ asyncStart();
future.then((v) => new Future.value(v * 2))
.then((v) {
Expect.equals(42, v);
- port.close();
+ asyncEnd();
});
completer.complete(21);
}
@@ -583,42 +583,42 @@
void testChainedFutureValueDelay() {
final completer = new Completer();
final future = completer.future;
- var port = new ReceivePort();
+ asyncStart();
future.then((v) => new Future.delayed(const Duration(milliseconds: 10),
() => v * 2))
.then((v) {
Expect.equals(42, v);
- port.close();
+ asyncEnd();
});
completer.complete(21);
}
void testChainedFutureValue2Delay() {
- var port = new ReceivePort();
+ asyncStart();
new Future.delayed(const Duration(milliseconds: 10))
.then((v) {
Expect.isNull(v);
- port.close();
+ asyncEnd();
});
}
void testChainedFutureError() {
final completer = new Completer();
final future = completer.future;
- var port = new ReceivePort();
+ asyncStart();
future.then((v) => new Future.error("Fehler"))
.then((v) { Expect.fail("unreachable!"); }, onError: (error) {
Expect.equals("Fehler", error);
- port.close();
+ asyncEnd();
});
completer.complete(21);
}
void testChainedFutureCycle() {
- var port = new ReceivePort(); // Keep alive until port is closed.
+ asyncStart();
var completer = new Completer();
var future, future2;
future = completer.future.then((_) => future2);
@@ -627,7 +627,7 @@
int ctr = 2;
void receiveError(e) {
Expect.isTrue(e is StateError);
- if (--ctr == 0) port.close();
+ if (--ctr == 0) asyncEnd();
}
future.catchError(receiveError);
future.catchError(receiveError);
diff --git a/tests/lib/async/futures_test.dart b/tests/lib/async/futures_test.dart
index 446d93b..936c5187 100644
--- a/tests/lib/async/futures_test.dart
+++ b/tests/lib/async/futures_test.dart
@@ -3,9 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
library futures_test;
+import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
Future testWaitEmpty() {
List<Future> futures = new List<Future>();
@@ -114,11 +114,9 @@
futures.add(testForEach());
futures.add(testForEachWithException());
- // Use a receive port for blocking the test.
- // Note that if the test fails, the program will not end.
- ReceivePort port = new ReceivePort();
+ asyncStart();
Future.wait(futures).then((List list) {
Expect.equals(9, list.length);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/intercept_run_async3_test.dart b/tests/lib/async/intercept_run_async3_test.dart
index 0dea800..bee8d8e 100644
--- a/tests/lib/async/intercept_run_async3_test.dart
+++ b/tests/lib/async/intercept_run_async3_test.dart
@@ -2,9 +2,9 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
var events = [];
@@ -23,9 +23,7 @@
}
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Test that runAsync inside the runAsync-handler goes to the parent zone.
var result = runZonedExperimental(body, onRunAsync: handler);
@@ -34,6 +32,6 @@
Expect.listEquals(
["body entry", "handler", "handler done", "after", "run async body"],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/intercept_run_async4_test.dart b/tests/lib/async/intercept_run_async4_test.dart
index c935bdb..30c4a27 100644
--- a/tests/lib/async/intercept_run_async4_test.dart
+++ b/tests/lib/async/intercept_run_async4_test.dart
@@ -2,9 +2,9 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
var events = [];
@@ -26,9 +26,7 @@
}
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Test that body of a runAsync goes to the zone it came from.
var result = runZonedExperimental(body, onRunAsync: handler);
@@ -43,7 +41,7 @@
"handler", "handler done",
"run nested body"],
events);
- port.close();
+ asyncEnd();
});
});
}
diff --git a/tests/lib/async/intercept_run_async5_test.dart b/tests/lib/async/intercept_run_async5_test.dart
index acf17d0..8c1882f 100644
--- a/tests/lib/async/intercept_run_async5_test.dart
+++ b/tests/lib/async/intercept_run_async5_test.dart
@@ -2,9 +2,9 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
var events = [];
@@ -32,9 +32,7 @@
}
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Test that nested runZonedExperimental go to the next outer zone.
var result = runZonedExperimental(
@@ -50,6 +48,6 @@
"handler2", "handler", "handler done", "handler2 done",
"run nested body"],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/intercept_run_async6_test.dart b/tests/lib/async/intercept_run_async6_test.dart
index 8b49edf..82cfcd0 100644
--- a/tests/lib/async/intercept_run_async6_test.dart
+++ b/tests/lib/async/intercept_run_async6_test.dart
@@ -2,9 +2,9 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
class A {
add(x) => print(x);
@@ -35,9 +35,7 @@
}
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Test that runZonedExperimental works when async, error and done are used.
var result = runZonedExperimental(
@@ -55,6 +53,6 @@
"error: foo",
"done"],
events);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/run_async4_test.dart b/tests/lib/async/run_async4_test.dart
index c4a1fc1..26db390 100644
--- a/tests/lib/async/run_async4_test.dart
+++ b/tests/lib/async/run_async4_test.dart
@@ -4,6 +4,7 @@
library run_async_test;
+import 'package:async_helper/async_helper.dart';
import 'dart:async';
import 'dart:isolate';
@@ -28,10 +29,15 @@
}
main() {
+ asyncStart();
var port = new ReceivePort();
var timer;
SendPort otherIsolate = spawnFunction(runTest, globalErrorHandler);
otherIsolate.send(port.toSendPort());
- port.receive((msg, replyPort) { port.close(); timer.cancel(); });
+ port.receive((msg, replyPort) {
+ port.close();
+ timer.cancel();
+ asyncEnd();
+ });
timer = new Timer(const Duration(seconds: 2), () { throw "failed"; });
}
diff --git a/tests/lib/async/run_zoned2_test.dart b/tests/lib/async/run_zoned2_test.dart
index 39e28a0..fa9110f 100644
--- a/tests/lib/async/run_zoned2_test.dart
+++ b/tests/lib/async/run_zoned2_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Ensure that `runZoned` is done when a synchronous call finishes.
runZonedExperimental(() => 499,
- onDone: port.close);
+ onDone: asyncEnd);
}
diff --git a/tests/lib/async/run_zoned3_test.dart b/tests/lib/async/run_zoned3_test.dart
index f880208..4545155 100644
--- a/tests/lib/async/run_zoned3_test.dart
+++ b/tests/lib/async/run_zoned3_test.dart
@@ -2,14 +2,12 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Ensure that `runZoned` is done when a synchronous call throws.
bool sawException = false;
try {
@@ -17,7 +15,7 @@
onDone: () {
// onDone is executed synchronously.
Expect.isFalse(sawException);
- port.close();
+ asyncEnd();
});
} catch (e) {
sawException = true;
diff --git a/tests/lib/async/run_zoned5_test.dart b/tests/lib/async/run_zoned5_test.dart
index bfe7c8b..6106a06 100644
--- a/tests/lib/async/run_zoned5_test.dart
+++ b/tests/lib/async/run_zoned5_test.dart
@@ -2,18 +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.
+import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Ensure that `runZoned`'s onError handles synchronous errors.
runZonedExperimental(() { throw 0; },
onError: (e) {
Expect.equals(0, e);
- port.close();
+ asyncEnd();
});
}
diff --git a/tests/lib/async/run_zoned6_test.dart b/tests/lib/async/run_zoned6_test.dart
index 2de6ca9..9ede7a7 100644
--- a/tests/lib/async/run_zoned6_test.dart
+++ b/tests/lib/async/run_zoned6_test.dart
@@ -4,24 +4,23 @@
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
+import 'package:async_helper/async_helper.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Ensure that `runZoned`'s onError handles synchronous errors but delegates
// to the top-level when the handler returns false.
try {
runZonedExperimental(() { throw 0; },
onError: (e) {
Expect.equals(0, e);
- port.close();
+ if (false) /// 01: runtime error
+ asyncEnd();
throw e; /// 01: runtime error
});
} catch (e) {
// We should never see an error here.
- if (true) /// 01: continued
+ if (false) /// 01: continued
rethrow;
}
}
diff --git a/tests/lib/async/run_zoned7_test.dart b/tests/lib/async/run_zoned7_test.dart
index 3bd3dbb..e6f4067 100644
--- a/tests/lib/async/run_zoned7_test.dart
+++ b/tests/lib/async/run_zoned7_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test runZoned with periodic Timers.
runZonedExperimental(() {
@@ -26,7 +24,7 @@
1, 2, 3, 4, 5, 6,
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/run_zoned8_test.dart b/tests/lib/async/run_zoned8_test.dart
index c8ce77d..6c0c89f 100644
--- a/tests/lib/async/run_zoned8_test.dart
+++ b/tests/lib/async/run_zoned8_test.dart
@@ -2,15 +2,13 @@
// 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:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
import 'catch_errors.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
var events = [];
// Test runZoned with periodic Timers.
runZonedExperimental(() {
@@ -30,7 +28,7 @@
1, "error: 1", 2, "error: 2",
],
events);
- port.close();
+ asyncEnd();
});
events.add("main exit");
}
diff --git a/tests/lib/async/run_zoned9_test.dart b/tests/lib/async/run_zoned9_test.dart
index aeaee5d..ab0f5ab1 100644
--- a/tests/lib/async/run_zoned9_test.dart
+++ b/tests/lib/async/run_zoned9_test.dart
@@ -4,12 +4,10 @@
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
+import 'package:async_helper/async_helper.dart';
main() {
- // We keep a ReceivePort open until all tests are done. This way the VM will
- // hang if the callbacks are not invoked and the test will time out.
- var port = new ReceivePort();
+ asyncStart();
// Ensure that `runZoned`'s onError handles synchronous errors but delegates
// to the next runZonedExperimental when the handler returns false.
bool sawInnerHandler = false;
@@ -24,12 +22,14 @@
}, onError: (e) {
Expect.equals(0, e);
Expect.isTrue(sawInnerHandler);
- port.close();
+ // If we are waiting for an error, don't asyncEnd, but let it time out.
+ if (false) /// 01: runtime error
+ asyncEnd();
throw e; /// 01: runtime error
});
} catch (e) {
// We should never see an error here.
- if (true) /// 01: continued
+ if (false) /// 01: continued
rethrow;
}
}
diff --git a/tests/lib/async/slow_consumer2_test.dart b/tests/lib/async/slow_consumer2_test.dart
index 0c56f4a..f631a77 100644
--- a/tests/lib/async/slow_consumer2_test.dart
+++ b/tests/lib/async/slow_consumer2_test.dart
@@ -6,9 +6,9 @@
library slow_consumer2_test;
+import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
const int KB = 1024;
const int MB = KB * KB;
@@ -105,7 +105,7 @@
}
main() {
- var port = new ReceivePort();
+ asyncStart();
// The data provider can deliver 800MB/s of data. It sends 100MB of data to
// the slower consumer who can only read 200MB/s. The data is sent in 1MB
// chunks. The consumer has a buffer of 5MB. That is, it can accept a few
@@ -118,7 +118,7 @@
new DataProvider(800 * MB, 100 * MB, 1 * MB).stream
.pipe(new SlowConsumer(200 * MB, 5 * MB))
.then((count) {
- port.close();
Expect.equals(100 * MB, count);
+ asyncEnd();
});
}
diff --git a/tests/lib/async/slow_consumer3_test.dart b/tests/lib/async/slow_consumer3_test.dart
index 5bb3f99..be12e12 100644
--- a/tests/lib/async/slow_consumer3_test.dart
+++ b/tests/lib/async/slow_consumer3_test.dart
@@ -6,9 +6,9 @@
library slow_consumer3_test;
+import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
const int KB = 1024;
const int MB = KB * KB;
@@ -71,7 +71,7 @@
}
main() {
- var port = new ReceivePort();
+ asyncStart();
// The data provider can deliver 800MBs of data as fast as it is
// requested. The data is sent in 0.5MB chunks. The consumer has a buffer of
// 3MB. That is, it can accept a few packages without pausing its input.
@@ -88,7 +88,7 @@
dataGenerator(100 * MB, 512 * KB)
.pipe(new SlowConsumer(200 * MB, 3 * MB))
.then((count) {
- port.close();
Expect.equals(100 * MB, count);
+ asyncEnd();
});
}
diff --git a/tests/lib/async/slow_consumer_test.dart b/tests/lib/async/slow_consumer_test.dart
index f4f6ef5..8fd6d8f 100644
--- a/tests/lib/async/slow_consumer_test.dart
+++ b/tests/lib/async/slow_consumer_test.dart
@@ -6,9 +6,9 @@
library slow_consumer_test;
+import 'package:async_helper/async_helper.dart';
import "package:expect/expect.dart";
import 'dart:async';
-import 'dart:isolate';
const int KB = 1024;
const int MB = KB * KB;
@@ -109,7 +109,7 @@
}
main() {
- var port = new ReceivePort();
+ asyncStart();
// The data provider can deliver 800MB/s of data. It sends 100MB of data to
// the slower consumer who can only read 200MB/s. The data is sent in 1MB
// chunks.
@@ -121,7 +121,7 @@
new DataProvider(800 * MB, 100 * MB, 1 * MB).stream
.pipe(new SlowConsumer(200 * MB))
.then((count) {
- port.close();
Expect.equals(100 * MB, count);
+ asyncEnd();
});
}
diff --git a/tests/lib/async/stream_controller_async_test.dart b/tests/lib/async/stream_controller_async_test.dart
index 2bfb4f0..a130b4c 100644
--- a/tests/lib/async/stream_controller_async_test.dart
+++ b/tests/lib/async/stream_controller_async_test.dart
@@ -639,11 +639,12 @@
var stream = asBroadcast ? c.stream.asBroadcastStream() : c.stream;
var actual = new Events();
var sub;
+ var pauseIsDone = false;
sub = stream.listen(
(v) {
if (v == 3) {
sub.pause(new Future.delayed(const Duration(milliseconds: 15),
- () => null));
+ () { pauseIsDone = true; }));
}
actual.add(v);
},
@@ -663,7 +664,15 @@
// the done event to the asBroadcastStream controller, which is
// before the final listener gets the event.
// Wait for the pause to end before testing the events.
- return new Future.delayed(const Duration(milliseconds: 50), () {
+ dynamic executeWhenPauseIsDone(Function f) {
+ if (!pauseIsDone) {
+ return new Future.delayed(const Duration(milliseconds: 50), () {
+ return executeWhenPauseIsDone(f);
+ });
+ }
+ return f();
+ }
+ return executeWhenPauseIsDone(() {
Expect.listEquals(expected.events, actual.events);
done();
});
diff --git a/tests/lib/convert/encoding_test.dart b/tests/lib/convert/encoding_test.dart
index cbdf72d..4c78a85 100644
--- a/tests/lib/convert/encoding_test.dart
+++ b/tests/lib/convert/encoding_test.dart
@@ -6,7 +6,7 @@
import 'dart:async';
import 'dart:convert';
import 'unicode_tests.dart';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
void runTest(List<int> bytes, expected) {
var controller = new StreamController();
diff --git a/tests/lib/convert/streamed_conversion_json_decode1_test.dart b/tests/lib/convert/streamed_conversion_json_decode1_test.dart
index 67e8383..8f58cbc 100644
--- a/tests/lib/convert/streamed_conversion_json_decode1_test.dart
+++ b/tests/lib/convert/streamed_conversion_json_decode1_test.dart
@@ -5,7 +5,7 @@
import "package:expect/expect.dart";
import 'dart:async';
import 'dart:convert';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
final TESTS = [
[ 5, '5' ],
diff --git a/tests/lib/convert/streamed_conversion_json_encode1_test.dart b/tests/lib/convert/streamed_conversion_json_encode1_test.dart
index 1a31ea6..c251215 100644
--- a/tests/lib/convert/streamed_conversion_json_encode1_test.dart
+++ b/tests/lib/convert/streamed_conversion_json_encode1_test.dart
@@ -5,7 +5,7 @@
import "package:expect/expect.dart";
import 'dart:async';
import 'dart:convert';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
final TESTS = [
[ 5, '5' ],
diff --git a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
index d40a204..7516a1d 100644
--- a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
+++ b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
@@ -6,29 +6,29 @@
import 'dart:async';
import 'dart:convert';
import 'json_unicode_tests.dart';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
final JSON_UTF8 = JSON.fuse(UTF8);
-bool isJsonEqual(o1, o2) {
- if (o1 == o2) return true;
+void expectJsonEquals(o1, o2, [path = "result"]) {
+ if (o1 == o2) return;
if (o1 is List && o2 is List) {
- if (o1.length != o2.length) return false;
+ Expect.equals(o1.length, o2.length, "$path.length");
for (int i = 0; i < o1.length; i++) {
- if (!isJsonEqual(o1[i], o2[i])) return false;
+ expectJsonEquals(o1[i], o2[i], "$path[$i]");
}
- return true;
+ return;
}
if (o1 is Map && o2 is Map) {
- if (o1.length != o2.length) return false;
+ Expect.equals(o1.length, o2.length, "$path.length");
for (var key in o1.keys) {
- Expect.isTrue(key is String);
- if (!o2.containsKey(key)) return false;
- if (!isJsonEqual(o1[key], o2[key])) return false;
+ Expect.isTrue(key is String, "$path:key = $key");
+ Expect.isTrue(o2.containsKey(key), "$path[$key] missing in $o2");
+ expectJsonEquals(o1[key], o2[key], "$path[$key]");
}
- return true;
+ return;
}
- return false;
+ Expect.equals(o1, o2);
}
Stream<Object> createStream(List<List<int>> chunks) {
@@ -61,7 +61,7 @@
void checkIsJsonEqual(expected, stream) {
asyncStart();
stream.single.then((o) {
- Expect.isTrue(isJsonEqual(expected, o));
+ expectJsonEquals(expected, o);
asyncEnd();
});
}
diff --git a/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart b/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart
index ca3f2dd..a8fe554 100644
--- a/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart
+++ b/tests/lib/convert/streamed_conversion_json_utf8_encode_test.dart
@@ -6,7 +6,7 @@
import 'dart:async';
import 'dart:convert';
import 'json_unicode_tests.dart';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
final JSON_UTF8 = JSON.fuse(UTF8);
diff --git a/tests/lib/convert/streamed_conversion_utf8_decode_test.dart b/tests/lib/convert/streamed_conversion_utf8_decode_test.dart
index e29d384..2e025f4 100644
--- a/tests/lib/convert/streamed_conversion_utf8_decode_test.dart
+++ b/tests/lib/convert/streamed_conversion_utf8_decode_test.dart
@@ -6,7 +6,7 @@
import 'dart:async';
import 'dart:convert';
import 'unicode_tests.dart';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
Stream<String> decode(List<int> bytes, int chunkSize) {
var controller;
diff --git a/tests/lib/convert/streamed_conversion_utf8_encode_test.dart b/tests/lib/convert/streamed_conversion_utf8_encode_test.dart
index a5be9bc..aec3618 100644
--- a/tests/lib/convert/streamed_conversion_utf8_encode_test.dart
+++ b/tests/lib/convert/streamed_conversion_utf8_encode_test.dart
@@ -6,7 +6,7 @@
import 'dart:async';
import 'dart:convert';
import 'unicode_tests.dart';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
Stream<List<int>> encode(String string, int chunkSize) {
var controller;
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 54ff120..c93b83e 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -13,6 +13,7 @@
mirrors/invoke_test: Fail # Issue 11954
mirrors/class_mirror_type_variables_test: Fail # Issue 12087
mirrors/invoke_private_test: Fail # Issue 12164
+mirrors/equality_test: Fail # Issue 12333, 12919
mirrors/function_type_mirror_test: Fail # Issue 12166
mirrors/generics_test: Fail # Issue 12333
mirrors/hierarchy_invariants_test: Fail # Issue 11863
@@ -22,9 +23,9 @@
mirrors/method_mirror_returntype_test : Fail # Issue 11928
mirrors/method_mirror_source_test : Fail # Issue 6490
mirrors/mirrors_test: Fail # TODO(ahe): I'm working on fixing this.
+mirrors/mixin_test: Fail # Issue 12464
mirrors/null_test : Fail # Issue 12129
mirrors/parameter_test: Fail # Issue 6490
-mirrors/library_metadata_test: Fail # Issue 10905
mirrors/library_uri_io_test: Skip # Not intended for dart2js as it uses dart:io.
mirrors/reflected_type_test: Fail # Issue 12607
mirrors/typedef_metadata_test: Fail # Issue 12785
@@ -34,6 +35,8 @@
async/run_async6_test: Fail # global error handling is not supported. http://dartbug.com/5958
async/stream_controller_async_test: Fail, Pass # http://dartbug.com/11953
+[ $runtime == safari ]
+mirrors/return_type_test: Pass, Timeout # Issue 12858
[ $csp ]
mirrors/*: Skip # Issue 6490
@@ -74,6 +77,7 @@
[ $compiler == dart2dart ]
mirrors/*: Skip # http://dartbug.com/11511
+library_metadata2_test/01: Skip # http://dartbug.com/11511
async/run_async6_test: Fail # Issue 10957 - may be related to issue 10910
[ $compiler == dart2dart && $minified ]
@@ -81,9 +85,9 @@
[ $runtime == ff ]
# FF setTimeout can fire early: https://bugzilla.mozilla.org/show_bug.cgi?id=291386
-multiple_timer_test: Pass, Fail
-timer_isolate_test: Pass, Fail
-timer_test: Pass, Fail
+async/multiple_timer_test: Pass, Fail
+async/timer_isolate_test: Pass, Fail
+async/timer_test: Pass, Fail
convert/chunked_conversion_utf88_test: Pass, Timeout # Issue 12029
convert/streamed_conversion_utf8_encode_test: Pass, Timeout # Issue 12029
convert/streamed_conversion_utf8_decode_test: Pass, Slow # Issue 12029
@@ -92,10 +96,9 @@
# IE9 doesn't support typed arrays.
typed_data/*: Fail # Issue 11971
convert/chunked_conversion_utf88_test: Pass, Slow, Timeout # Issue 12029
-convert/streamed_conversion_utf8_encode_test: Pass, Timeout # Issue 12029
convert/streamed_conversion_json_utf8_decode_test: Pass, Timeout # Issue 12029
-async/deferred/deferred_api_test: Pass, Timeout # Issue 12029
-async/run_zoned6_test/01: fail # http://dartbug.com/12817
+async/deferred/deferred_api_test: Pass, Timeout # http://dartbug.com/12635
+convert/streamed_conversion_utf8_decode_test: Pass, Timeout # http://dartbug.com/12768
[ $runtime == opera ]
@@ -113,7 +116,7 @@
[ $runtime == vm || ($compiler == none && $runtime == drt) ]
async/run_async3_test: Fail # _enqueueImmediate runs after Timer. http://dartbug.com/9001.
-mirrors/mixin_test: Fail # TODO(ahe): This test is slightly broken. http://dartbug.com/12464
+mirrors/mixin_dart2js_test: Skip # TODO(ahe): This test is slightly broken. http://dartbug.com/12464
mirrors/hierarchy_test: Fail # TODO(ahe): This test is slightly broken. http://dartbug.com/12464
[ $compiler == none && $runtime == drt ]
@@ -136,5 +139,13 @@
convert/chunked_conversion_utf88_test: Pass, Slow # Issue 12644.
[ $compiler == none && $runtime == drt ]
-run_zoned6_test/01: fail # Issue 12756.
-run_zoned9_test/01: fail # Issue 12756.
+async/run_zoned6_test/01: fail # Issue 12756.
+async/run_zoned9_test/01: fail # Issue 12756.
+
+[ $compiler == dartanalyzer ]
+mirrors/library_metadata2_test/01: Fail # http://dartbug.com/12950
+library_metadata2_test/01: Fail # http://dartbug.com/12950
+
+[ $compiler == dart2analyzer ]
+mirrors/library_metadata2_test/01: Fail # http://dartbug.com/12950
+library_metadata2_test/01: Fail # http://dartbug.com/12950
diff --git a/tests/lib/mirrors/equality_test.dart b/tests/lib/mirrors/equality_test.dart
new file mode 100644
index 0000000..2399032
--- /dev/null
+++ b/tests/lib/mirrors/equality_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.
+
+library test.class_equality_test;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class A<T> {}
+class B extends A<int> {}
+
+checkEquality(List<Map> equivalenceClasses) {
+ for (var equivalenceClass in equivalenceClasses) {
+ equivalenceClass.forEach((name, member) {
+ equivalenceClass.forEach((otherName, otherMember) {
+ // Reflexivity, symmetry and transitivity.
+ Expect.equals(member,
+ otherMember,
+ "$name == $otherName");
+ Expect.equals(member.hashCode,
+ otherMember.hashCode,
+ "$name.hashCode == $otherName.hashCode");
+ });
+ for (var otherEquivalenceClass in equivalenceClasses) {
+ if (otherEquivalenceClass == equivalenceClass) continue;
+ otherEquivalenceClass.forEach((otherName, otherMember) {
+ Expect.notEquals(member,
+ otherMember,
+ "$name != $otherName"); // Exclusion.
+ // Hash codes may or may not be equal.
+ });
+ }
+ });
+ }
+}
+
+void subroutine() {
+}
+
+main() {
+ LibraryMirror thisLibrary =
+ currentMirrorSystem()
+ .findLibrary(const Symbol('test.class_equality_test'))
+ .single;
+
+ Object o1 = new Object();
+ Object o2 = new Object();
+
+ checkEquality([
+ {'reflect(o1)' : reflect(o1),
+ 'reflect(o1), again' : reflect(o1)},
+
+ {'reflect(o2)' : reflect(o2),
+ 'reflect(o2), again' : reflect(o2)},
+
+ {'reflect(3+4)' : reflect(3+4),
+ 'reflect(6+1)' : reflect(6+1)},
+
+ {'currentMirrorSystem().voidType' : currentMirrorSystem().voidType,
+ 'thisLibrary.functions[#subroutine].returnType' :
+ thisLibrary.functions[const Symbol('subroutine')].returnType},
+
+ {'currentMirrorSystem().dynamicType' : currentMirrorSystem().dynamicType,
+ 'thisLibrary.functions[#main].returnType' :
+ thisLibrary.functions[const Symbol('main')].returnType},
+
+ {'reflectClass(A)' : reflectClass(A),
+ 'thisLibrary.classes[#A]' : thisLibrary.classes[const Symbol('A')],
+ 'reflect(new A<int>()).type.originalDeclaration' :
+ reflect(new A<int>()).type.originalDeclaration},
+
+ {'reflectClass(B).superclass' : reflectClass(B).superclass,
+ 'reflect(new A<int>()).type' : reflect(new A<int>()).type},
+
+ {'reflectClass(B)' : reflectClass(B),
+ 'thisLibrary.classes[#B]' : thisLibrary.classes[const Symbol('B')],
+ 'reflect(new B()).type' : reflect(new B()).type},
+
+ {'thisLibrary' : thisLibrary,
+ 'reflectClass(A).owner' : reflectClass(A).owner,
+ 'reflectClass(B).owner' : reflectClass(B).owner,
+ 'reflect(new A()).type.owner' : reflect(new A()).type.owner,
+ 'reflect(new A()).type.owner' : reflect(new A()).type.owner},
+ ]);
+}
diff --git a/tests/lib/mirrors/invoke_private_test.dart b/tests/lib/mirrors/invoke_private_test.dart
index cac9f1e..0e69bc6 100644
--- a/tests/lib/mirrors/invoke_private_test.dart
+++ b/tests/lib/mirrors/invoke_private_test.dart
@@ -7,7 +7,7 @@
import 'dart:mirrors';
import 'package:expect/expect.dart';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
class C {
var _field;
diff --git a/tests/lib/mirrors/invoke_test.dart b/tests/lib/mirrors/invoke_test.dart
index e306ca2..3ba6732 100644
--- a/tests/lib/mirrors/invoke_test.dart
+++ b/tests/lib/mirrors/invoke_test.dart
@@ -7,7 +7,7 @@
import 'dart:mirrors';
import 'package:expect/expect.dart';
-import '../../async_helper.dart';
+import "package:async_helper/async_helper.dart";
class C {
var field;
diff --git a/tests/lib/mirrors/libraries_test.dart b/tests/lib/mirrors/libraries_test.dart
index 70a5e58..6639083 100644
--- a/tests/lib/mirrors/libraries_test.dart
+++ b/tests/lib/mirrors/libraries_test.dart
@@ -18,12 +18,9 @@
LibraryMirror mirrorsLibrary = libraries[Uri.parse('dart:mirrors')];
Expect.isNotNull(mirrorsLibrary, 'mirrorsLibrary is null');
- print(mirrorsLibrary.classes);
ClassMirror cls = mirrorsLibrary.classes[const Symbol('LibraryMirror')];
Expect.isNotNull(cls, 'cls is null');
Expect.equals(const Symbol('dart.mirrors.LibraryMirror'), cls.qualifiedName);
- // TODO(ahe): Enable when VM implements equality of class mirrors:
- // Expect.equals(reflectClass(LibraryMirror), cls);
- print(mirrorsLibrary);
+ Expect.equals(reflectClass(LibraryMirror), cls);
}
diff --git a/tests/lib/mirrors/library_metadata2_lib1.dart b/tests/lib/mirrors/library_metadata2_lib1.dart
new file mode 100644
index 0000000..75149b3
--- /dev/null
+++ b/tests/lib/mirrors/library_metadata2_lib1.dart
@@ -0,0 +1,10 @@
+// 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.
+
+@MyConst()
+library lib1;
+
+class MyConst {
+ const MyConst();
+}
diff --git a/tests/lib/mirrors/library_metadata2_lib2.dart b/tests/lib/mirrors/library_metadata2_lib2.dart
new file mode 100644
index 0000000..b8a447f
--- /dev/null
+++ b/tests/lib/mirrors/library_metadata2_lib2.dart
@@ -0,0 +1,6 @@
+// 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.
+
+@MyConst()
+library lib2;
diff --git a/tests/lib/mirrors/library_metadata2_test.dart b/tests/lib/mirrors/library_metadata2_test.dart
new file mode 100644
index 0000000..4604f7e
--- /dev/null
+++ b/tests/lib/mirrors/library_metadata2_test.dart
@@ -0,0 +1,15 @@
+// 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 'dart:mirrors';
+
+import 'library_metadata2_lib1.dart';
+
+import 'library_metadata2_lib2.dart'; /// 01: compile-time error
+
+void main() {
+ for (var library in currentMirrorSystem().libraries.values) {
+ print(library.metadata);
+ }
+}
diff --git a/tests/lib/mirrors/mixin_dart2js_test.dart b/tests/lib/mirrors/mixin_dart2js_test.dart
new file mode 100644
index 0000000..eb70034
--- /dev/null
+++ b/tests/lib/mirrors/mixin_dart2js_test.dart
@@ -0,0 +1,306 @@
+// 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.
+
+// TODO(ahe): This test is sligthly broken but provides temporary test coverage
+// for dart2js. See http://dartbug.com/12464.
+
+library test.mixin_test;
+
+@MirrorsUsed(targets: 'test.mixin_test, test.model, Object', override: '*')
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+import 'model.dart';
+import 'stringify.dart';
+
+class Mixin {
+ int i;
+ m() {}
+}
+
+class Mixin2 {
+ int i2;
+ m2() {}
+}
+
+typedef MixinApplication = C with Mixin;
+typedef MixinApplicationA = C with Mixin, Mixin2;
+
+typedef UnusedMixinApplication = C with Mixin;
+
+class Subclass extends C with Mixin {
+ f() {}
+}
+
+class Subclass2 extends MixinApplication {
+ g() {}
+}
+
+class SubclassA extends C with Mixin, Mixin2 {
+ fa() {}
+}
+
+class Subclass2A extends MixinApplicationA {
+ ga() {}
+}
+
+checkClass(Type type, List<String> expectedSuperclasses) {
+ int i = 0;
+ for (var cls = reflectClass(type); cls != null; cls = cls.superclass) {
+ expect(expectedSuperclasses[i++], cls);
+ }
+ Expect.equals(i, expectedSuperclasses.length, '$type');
+}
+
+expectSame(ClassMirror a, ClassMirror b) {
+ Expect.equals(a, b);
+ expect(stringify(a), b);
+ expect(stringify(b), a);
+}
+
+testMixin() {
+ checkClass(Mixin, [
+ 'Class(s(Mixin) in s(test.mixin_test), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{i: Variable(s(i) in s(Mixin)),'
+ ' m: Method(s(m) in s(Mixin))}',
+ reflectClass(Mixin).members);
+
+ expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ reflectClass(Mixin).constructors);
+}
+
+testMixin2() {
+ checkClass(Mixin2, [
+ 'Class(s(Mixin2) in s(test.mixin_test), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{i2: Variable(s(i2) in s(Mixin2)),'
+ ' m2: Method(s(m2) in s(Mixin2))}',
+ reflectClass(Mixin2).members);
+
+ expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
+ reflectClass(Mixin2).constructors);
+}
+
+testMixinApplication() {
+ checkClass(MixinApplication, [
+ 'Class(s(MixinApplication) in s(test.mixin_test), top-level)',
+ 'Class(s(C) in s(test.model), top-level)',
+ 'Class(s(B) in s(test.model), top-level)',
+ 'Class(s(A) in s(test.model), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{i: Variable(s(i) in s(MixinApplication)),'
+ ' m: Method(s(m) in s(MixinApplication))}',
+ reflectClass(MixinApplication).members);
+
+ expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
+ ' constructor)}',
+ reflectClass(MixinApplication).constructors);
+
+ expectSame(reflectClass(C), reflectClass(MixinApplication).superclass);
+}
+
+testMixinApplicationA() {
+ checkClass(MixinApplicationA, [
+ 'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
+ 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
+ 'Class(s(C) in s(test.model), top-level)',
+ 'Class(s(B) in s(test.model), top-level)',
+ 'Class(s(A) in s(test.model), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ // TODO(ahe): The owner should be the mixin.
+ '{i2: Variable(s(i2) in s(MixinApplicationA)),'
+ ' m2: Method(s(m2) in s(MixinApplicationA))}',
+ reflectClass(MixinApplicationA).members);
+
+ expect(
+ '{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),'
+ ' constructor)}',
+ reflectClass(MixinApplicationA).constructors);
+
+ expect(
+ '{i: Variable(s(i) in s(Mixin)),'
+ ' m: Method(s(m) in s(Mixin))}',
+ reflectClass(MixinApplicationA).superclass.members);
+
+ expect(
+ // TODO(ahe): The owner should be the mixin application.
+ '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ reflectClass(MixinApplicationA).superclass.constructors);
+
+ expectSame(
+ reflectClass(C),
+ reflectClass(MixinApplicationA).superclass.superclass);
+}
+
+testUnusedMixinApplication() {
+ checkClass(UnusedMixinApplication, [
+ 'Class(s(UnusedMixinApplication) in s(test.mixin_test), top-level)',
+ 'Class(s(C) in s(test.model), top-level)',
+ 'Class(s(B) in s(test.model), top-level)',
+ 'Class(s(A) in s(test.model), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{i: Variable(s(i) in s(UnusedMixinApplication)),'
+ ' m: Method(s(m) in s(UnusedMixinApplication))}',
+ reflectClass(UnusedMixinApplication).members);
+
+ expect(
+ '{UnusedMixinApplication: Method(s(UnusedMixinApplication)'
+ ' in s(UnusedMixinApplication), constructor)}',
+ reflectClass(UnusedMixinApplication).constructors);
+
+ expectSame(reflectClass(C), reflectClass(UnusedMixinApplication).superclass);
+}
+
+testSubclass() {
+ checkClass(Subclass, [
+ 'Class(s(Subclass) in s(test.mixin_test), top-level)',
+ 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
+ 'Class(s(C) in s(test.model), top-level)',
+ 'Class(s(B) in s(test.model), top-level)',
+ 'Class(s(A) in s(test.model), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{f: Method(s(f) in s(Subclass))}',
+ reflectClass(Subclass).members);
+
+ expect(
+ '{Subclass: Method(s(Subclass) in s(Subclass), constructor)}',
+ reflectClass(Subclass).constructors);
+
+ expect(
+ '{i: Variable(s(i) in s(Mixin)),'
+ ' m: Method(s(m) in s(Mixin))}',
+ reflectClass(Subclass).superclass.members);
+
+ expect(
+ // TODO(ahe): The owner should be the mixin application.
+ '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ reflectClass(Subclass).superclass.constructors);
+
+ expectSame(
+ reflectClass(C),
+ reflectClass(Subclass).superclass.superclass);
+}
+
+testSubclass2() {
+ checkClass(Subclass2, [
+ 'Class(s(Subclass2) in s(test.mixin_test), top-level)',
+ 'Class(s(MixinApplication) in s(test.mixin_test), top-level)',
+ 'Class(s(C) in s(test.model), top-level)',
+ 'Class(s(B) in s(test.model), top-level)',
+ 'Class(s(A) in s(test.model), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{g: Method(s(g) in s(Subclass2))}',
+ reflectClass(Subclass2).members);
+
+ expect(
+ '{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}',
+ reflectClass(Subclass2).constructors);
+
+ expectSame(
+ reflectClass(MixinApplication),
+ reflectClass(Subclass2).superclass);
+}
+
+testSubclassA() {
+ checkClass(SubclassA, [
+ 'Class(s(SubclassA) in s(test.mixin_test), top-level)',
+ 'Class(s(test.mixin_test.Mixin2(test.mixin_test.Mixin(test.model.C))),'
+ ' top-level)',
+ 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
+ 'Class(s(C) in s(test.model), top-level)',
+ 'Class(s(B) in s(test.model), top-level)',
+ 'Class(s(A) in s(test.model), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{fa: Method(s(fa) in s(SubclassA))}',
+ reflectClass(SubclassA).members);
+
+ expect(
+ '{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}',
+ reflectClass(SubclassA).constructors);
+
+ expect(
+ '{i2: Variable(s(i2) in s(Mixin2)),'
+ ' m2: Method(s(m2) in s(Mixin2))}',
+ reflectClass(SubclassA).superclass.members);
+
+ expect(
+ // TODO(ahe): The owner should be the mixin application.
+ '{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
+ reflectClass(SubclassA).superclass.constructors);
+
+ expect(
+ '{i: Variable(s(i) in s(Mixin)),'
+ ' m: Method(s(m) in s(Mixin))}',
+ reflectClass(SubclassA).superclass.superclass.members);
+
+ expect(
+ // TODO(ahe): The owner should be the mixin application.
+ '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ reflectClass(SubclassA).superclass.superclass.constructors);
+
+ expectSame(
+ reflectClass(C),
+ reflectClass(SubclassA).superclass.superclass.superclass);
+}
+
+testSubclass2A() {
+ checkClass(Subclass2A, [
+ 'Class(s(Subclass2A) in s(test.mixin_test), top-level)',
+ 'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
+ 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
+ 'Class(s(C) in s(test.model), top-level)',
+ 'Class(s(B) in s(test.model), top-level)',
+ 'Class(s(A) in s(test.model), top-level)',
+ 'Class(s(Object) in s(dart.core), top-level)',
+ ]);
+
+ expect(
+ '{ga: Method(s(ga) in s(Subclass2A))}',
+ reflectClass(Subclass2A).members);
+
+ expect(
+ '{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}',
+ reflectClass(Subclass2A).constructors);
+
+ expectSame(reflectClass(MixinApplicationA),
+ reflectClass(Subclass2A).superclass);
+}
+
+main() {
+ testMixin();
+ testMixin2();
+ testMixinApplication();
+ testMixinApplicationA();
+ testUnusedMixinApplication();
+ testSubclass();
+ testSubclass2();
+ testSubclassA();
+ testSubclass2A();
+}
diff --git a/tests/lib/mirrors/mixin_test.dart b/tests/lib/mirrors/mixin_test.dart
index eb70034..4ccb457 100644
--- a/tests/lib/mirrors/mixin_test.dart
+++ b/tests/lib/mirrors/mixin_test.dart
@@ -2,9 +2,6 @@
// 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.
-// TODO(ahe): This test is sligthly broken but provides temporary test coverage
-// for dart2js. See http://dartbug.com/12464.
-
library test.mixin_test;
@MirrorsUsed(targets: 'test.mixin_test, test.model, Object', override: '*')
@@ -65,14 +62,13 @@
'Class(s(Mixin) in s(test.mixin_test), top-level)',
'Class(s(Object) in s(dart.core), top-level)',
]);
-
expect(
'{i: Variable(s(i) in s(Mixin)),'
' m: Method(s(m) in s(Mixin))}',
reflectClass(Mixin).members);
-
- expect('{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
- reflectClass(Mixin).constructors);
+ expect(
+ '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ reflectClass(Mixin).constructors);
}
testMixin2() {
@@ -80,14 +76,13 @@
'Class(s(Mixin2) in s(test.mixin_test), top-level)',
'Class(s(Object) in s(dart.core), top-level)',
]);
-
expect(
'{i2: Variable(s(i2) in s(Mixin2)),'
' m2: Method(s(m2) in s(Mixin2))}',
reflectClass(Mixin2).members);
-
- expect('{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
- reflectClass(Mixin2).constructors);
+ expect(
+ '{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
+ reflectClass(Mixin2).constructors);
}
testMixinApplication() {
@@ -100,13 +95,13 @@
]);
expect(
- '{i: Variable(s(i) in s(MixinApplication)),'
- ' m: Method(s(m) in s(MixinApplication))}',
+ '{i: Variable(s(i) in s(Mixin)),'
+ ' m: Method(s(m) in s(Mixin))}',
reflectClass(MixinApplication).members);
-
- expect('{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
- ' constructor)}',
- reflectClass(MixinApplication).constructors);
+ expect(
+ '{MixinApplication: Method(s(MixinApplication) in s(MixinApplication),'
+ ' constructor)}',
+ reflectClass(MixinApplication).constructors);
expectSame(reflectClass(C), reflectClass(MixinApplication).superclass);
}
@@ -114,7 +109,8 @@
testMixinApplicationA() {
checkClass(MixinApplicationA, [
'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
- 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
+ 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
+ ' top-level)',
'Class(s(C) in s(test.model), top-level)',
'Class(s(B) in s(test.model), top-level)',
'Class(s(A) in s(test.model), top-level)',
@@ -122,11 +118,9 @@
]);
expect(
- // TODO(ahe): The owner should be the mixin.
- '{i2: Variable(s(i2) in s(MixinApplicationA)),'
- ' m2: Method(s(m2) in s(MixinApplicationA))}',
+ '{i2: Variable(s(i2) in s(Mixin2)),'
+ ' m2: Method(s(m2) in s(Mixin2))}',
reflectClass(MixinApplicationA).members);
-
expect(
'{MixinApplicationA: Method(s(MixinApplicationA) in s(MixinApplicationA),'
' constructor)}',
@@ -136,10 +130,10 @@
'{i: Variable(s(i) in s(Mixin)),'
' m: Method(s(m) in s(Mixin))}',
reflectClass(MixinApplicationA).superclass.members);
-
expect(
- // TODO(ahe): The owner should be the mixin application.
- '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ '{test.model.C with test.mixin_test.Mixin:'
+ ' Method(s(test.model.C with test.mixin_test.Mixin)'
+ ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
reflectClass(MixinApplicationA).superclass.constructors);
expectSame(
@@ -157,10 +151,9 @@
]);
expect(
- '{i: Variable(s(i) in s(UnusedMixinApplication)),'
- ' m: Method(s(m) in s(UnusedMixinApplication))}',
+ '{i: Variable(s(i) in s(Mixin)),'
+ ' m: Method(s(m) in s(Mixin))}',
reflectClass(UnusedMixinApplication).members);
-
expect(
'{UnusedMixinApplication: Method(s(UnusedMixinApplication)'
' in s(UnusedMixinApplication), constructor)}',
@@ -172,7 +165,8 @@
testSubclass() {
checkClass(Subclass, [
'Class(s(Subclass) in s(test.mixin_test), top-level)',
- 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
+ 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
+ ' top-level)',
'Class(s(C) in s(test.model), top-level)',
'Class(s(B) in s(test.model), top-level)',
'Class(s(A) in s(test.model), top-level)',
@@ -182,7 +176,6 @@
expect(
'{f: Method(s(f) in s(Subclass))}',
reflectClass(Subclass).members);
-
expect(
'{Subclass: Method(s(Subclass) in s(Subclass), constructor)}',
reflectClass(Subclass).constructors);
@@ -191,10 +184,10 @@
'{i: Variable(s(i) in s(Mixin)),'
' m: Method(s(m) in s(Mixin))}',
reflectClass(Subclass).superclass.members);
-
expect(
- // TODO(ahe): The owner should be the mixin application.
- '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ '{test.model.C with test.mixin_test.Mixin:'
+ ' Method(s(test.model.C with test.mixin_test.Mixin)'
+ ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
reflectClass(Subclass).superclass.constructors);
expectSame(
@@ -215,7 +208,6 @@
expect(
'{g: Method(s(g) in s(Subclass2))}',
reflectClass(Subclass2).members);
-
expect(
'{Subclass2: Method(s(Subclass2) in s(Subclass2), constructor)}',
reflectClass(Subclass2).constructors);
@@ -228,9 +220,10 @@
testSubclassA() {
checkClass(SubclassA, [
'Class(s(SubclassA) in s(test.mixin_test), top-level)',
- 'Class(s(test.mixin_test.Mixin2(test.mixin_test.Mixin(test.model.C))),'
+ 'Class(s(test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2)'
+ ' in s(test.mixin_test), top-level)',
+ 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
' top-level)',
- 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
'Class(s(C) in s(test.model), top-level)',
'Class(s(B) in s(test.model), top-level)',
'Class(s(A) in s(test.model), top-level)',
@@ -240,7 +233,6 @@
expect(
'{fa: Method(s(fa) in s(SubclassA))}',
reflectClass(SubclassA).members);
-
expect(
'{SubclassA: Method(s(SubclassA) in s(SubclassA), constructor)}',
reflectClass(SubclassA).constructors);
@@ -249,20 +241,21 @@
'{i2: Variable(s(i2) in s(Mixin2)),'
' m2: Method(s(m2) in s(Mixin2))}',
reflectClass(SubclassA).superclass.members);
-
expect(
- // TODO(ahe): The owner should be the mixin application.
- '{Mixin2: Method(s(Mixin2) in s(Mixin2), constructor)}',
+ '{test.model.C with test.mixin_test.Mixin, test.mixin_test.Mixin2:'
+ ' Method(s(test.model.C with test.mixin_test.Mixin,'
+ ' test.mixin_test.Mixin2) in s(test.model.C with test.mixin_test.Mixin,'
+ ' test.mixin_test.Mixin2), constructor)}',
reflectClass(SubclassA).superclass.constructors);
expect(
'{i: Variable(s(i) in s(Mixin)),'
' m: Method(s(m) in s(Mixin))}',
reflectClass(SubclassA).superclass.superclass.members);
-
expect(
- // TODO(ahe): The owner should be the mixin application.
- '{Mixin: Method(s(Mixin) in s(Mixin), constructor)}',
+ '{test.model.C with test.mixin_test.Mixin:'
+ ' Method(s(test.model.C with test.mixin_test.Mixin)'
+ ' in s(test.model.C with test.mixin_test.Mixin), constructor)}',
reflectClass(SubclassA).superclass.superclass.constructors);
expectSame(
@@ -274,7 +267,8 @@
checkClass(Subclass2A, [
'Class(s(Subclass2A) in s(test.mixin_test), top-level)',
'Class(s(MixinApplicationA) in s(test.mixin_test), top-level)',
- 'Class(s(test.mixin_test.Mixin(test.model.C)), top-level)',
+ 'Class(s(test.model.C with test.mixin_test.Mixin) in s(test.mixin_test),'
+ ' top-level)',
'Class(s(C) in s(test.model), top-level)',
'Class(s(B) in s(test.model), top-level)',
'Class(s(A) in s(test.model), top-level)',
@@ -284,7 +278,6 @@
expect(
'{ga: Method(s(ga) in s(Subclass2A))}',
reflectClass(Subclass2A).members);
-
expect(
'{Subclass2A: Method(s(Subclass2A) in s(Subclass2A), constructor)}',
reflectClass(Subclass2A).constructors);
diff --git a/tests/light_unittest.dart b/tests/light_unittest.dart
index 02ed433..9128ef7 100644
--- a/tests/light_unittest.dart
+++ b/tests/light_unittest.dart
@@ -8,7 +8,7 @@
import 'dart:async';
-import 'async_helper.dart';
+import 'package:async_helper/async_helper.dart';
import '../pkg/expect/lib/expect.dart';
test(name, f) {
@@ -59,7 +59,10 @@
expectAsync1(then) {
asyncStart();
return (x) {
+ // 'then(x)' may call 'asyncStart()', so we first need to execute it, before
+ // we can call 'asyncEnd()'.
+ var result = then(x);
asyncEnd();
- return then(x);
+ return result;
};
}
diff --git a/tests/standalone/debugger/debug_lib.dart b/tests/standalone/debugger/debug_lib.dart
index 66030d9..a5f19ab 100644
--- a/tests/standalone/debugger/debug_lib.dart
+++ b/tests/standalone/debugger/debug_lib.dart
@@ -10,7 +10,6 @@
import "dart:convert";
import "dart:io";
import "dart:math";
-import "dart:json" as JSON;
// Whether or not to print the debugger wire messages on the console.
var verboseWire = false;
@@ -63,7 +62,7 @@
// buffer, or 0 if there is only a partial message in the buffer.
// The object value must start with '{' and continues to the
// matching '}'. No attempt is made to otherwise validate the contents
- // as JSON. If it is invalid, a later JSON.parse() will fail.
+ // as JSON. If it is invalid, a later JSON.decode() will fail.
int objectLength() {
int skipWhitespace(int index) {
while (index < buffer.length) {
@@ -500,7 +499,7 @@
cleanup();
return;
}
- var msgObj = JSON.parse(msg);
+ var msgObj = JSON.decode(msg);
handleMessage(msgObj);
if (errorsDetected) {
error("Error while handling script entry");
@@ -525,7 +524,7 @@
if (msg["params"] != null && msg["params"]["isolateId"] != null) {
msg["params"]["isolateId"] = isolateId;
}
- String jsonMsg = JSON.stringify(msg);
+ String jsonMsg = JSON.encode(msg);
if (verboseWire) print("SEND: $jsonMsg");
socket.write(jsonMsg);
}
diff --git a/tests/standalone/io/http_response_deadline_test.dart b/tests/standalone/io/http_response_deadline_test.dart
index ee14d0e..5f53793 100644
--- a/tests/standalone/io/http_response_deadline_test.dart
+++ b/tests/standalone/io/http_response_deadline_test.dart
@@ -14,7 +14,7 @@
void testSimpleDeadline(int connections) {
HttpServer.bind('localhost', 0).then((server) {
server.listen((request) {
- request.response.deadline = const Duration(seconds: 10);
+ request.response.deadline = const Duration(seconds: 1000);
request.response.write("stuff");
request.response.close();
});
diff --git a/tests/standalone/io/web_socket_ping_test.dart b/tests/standalone/io/web_socket_ping_test.dart
index 29fec92..3825701 100644
--- a/tests/standalone/io/web_socket_ping_test.dart
+++ b/tests/standalone/io/web_socket_ping_test.dart
@@ -7,33 +7,49 @@
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
+library dart.io;
+
import "package:expect/expect.dart";
import "dart:async";
import "dart:io";
+import "dart:math";
+part "../../../sdk/lib/io/crypto.dart";
+
+
+const String webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
void testPing(int totalConnections) {
HttpServer.bind('localhost', 0).then((server) {
- server.transform(new WebSocketTransformer()).listen((webSocket) {
- webSocket.pingInterval = const Duration(milliseconds: 500);
- webSocket.drain();
+ int closed = 0;
+ server.listen((request) {
+ var response = request.response;
+ response.statusCode = HttpStatus.SWITCHING_PROTOCOLS;
+ response.headers.set(HttpHeaders.CONNECTION, "upgrade");
+ response.headers.set(HttpHeaders.UPGRADE, "websocket");
+ String key = request.headers.value("Sec-WebSocket-Key");
+ _SHA1 sha1 = new _SHA1();
+ sha1.add("$key$webSocketGUID".codeUnits);
+ String accept = _CryptoUtils.bytesToBase64(sha1.close());
+ response.headers.add("Sec-WebSocket-Accept", accept);
+ response.headers.contentLength = 0;
+ response.detachSocket().then((socket) {
+ socket.drain().then((_) {
+ socket.close();
+ closed++;
+ if (closed == totalConnections) {
+ server.close();
+ }
+ });
+ });
});
- var futures = [];
for (int i = 0; i < totalConnections; i++) {
- futures.add(
- WebSocket.connect('ws://localhost:${server.port}').then((webSocket) {
- webSocket.pingInterval = const Duration(milliseconds: 500);
+ WebSocket.connect('ws://localhost:${server.port}').then((webSocket) {
+ webSocket.pingInterval = const Duration(milliseconds: 100);
webSocket.drain();
- new Timer(const Duration(seconds: 2), () {
- // Should not be closed yet.
- Expect.equals(null, webSocket.closeCode);
- webSocket.close();
- });
- return webSocket.done;
- }));
+ });
}
- Future.wait(futures).then((_) => server.close());
});
}
diff --git a/tests/standalone/io/web_socket_pipe_test.dart b/tests/standalone/io/web_socket_pipe_test.dart
new file mode 100644
index 0000000..e182a40
--- /dev/null
+++ b/tests/standalone/io/web_socket_pipe_test.dart
@@ -0,0 +1,69 @@
+// 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "package:expect/expect.dart";
+import "dart:async";
+import "dart:io";
+
+class IdentityTransformer extends StreamEventTransformer {
+ void handleData(data, sink) => sink.add(data);
+}
+
+class ReverseStringTransformer extends StreamEventTransformer {
+ void handleData(String data, sink) {
+ var sb = new StringBuffer();
+ for (int i = data.length - 1; i >= 0; i--) sb.write(data[i]);
+ sink.add(sb.toString());
+ }
+}
+
+testPipe({int messages, bool transform}) {
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ server.listen((request) {
+ WebSocketTransformer.upgrade(request).then((websocket) {
+ (transform ? websocket.transform(new ReverseStringTransformer())
+ : websocket)
+ .pipe(websocket)
+ .then((_) => server.close());
+ });
+ });
+ WebSocket.connect("ws://127.0.0.1:${server.port}/").then((client) {
+ var count = 0;
+ next() {
+ if (count < messages) {
+ client.add("Hello");
+ } else {
+ client.close();
+ }
+ }
+
+ next();
+ client.listen(
+ (data) {
+ count++;
+ if (transform) {
+ Expect.equals("olleH", data);
+ } else {
+ Expect.equals("Hello", data);
+ }
+ next();
+ },
+ onDone: () => print("Client received close"));
+ });
+ });
+}
+
+void main() {
+ testPipe(messages: 0, transform: false);
+ testPipe(messages: 0, transform: true);
+ testPipe(messages: 1, transform: false);
+ testPipe(messages: 1, transform: true);
+ testPipe(messages: 10, transform: false);
+ testPipe(messages: 10, transform: true);
+}
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index 19ce35c..7251e17 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -47,6 +47,9 @@
io/directory_non_ascii_test: Pass, Fail
io/process_non_ascii_test: Pass, Fail
+[ $runtime == vm && $system == windows ]
+io/http_server_early_client_close_test: Crash, Pass # Issue 12982
+
[ $compiler == none && $runtime == drt ]
typed_data_isolate_test: Skip # This test uses dart:io
io/*: Skip # Don't run tests using dart:io in the browser
@@ -134,6 +137,7 @@
[ $compiler == dart2js && $runtime == none ]
io/options_test: Fail
medium_integer_test: Pass # The test only fails at runtime, not at compilation.
+oom_error_stacktrace_test: Pass # The test only fails at runtime.
[ $compiler == dart2js && $browser ]
*: Skip
@@ -151,7 +155,6 @@
[ $arch == simarm ]
out_of_memory_test: Skip # passes on Mac, crashes on Linux
oom_error_stacktrace_test: Skip # Fails on Linux
-io/web_socket_ping_test: Skip # TODO(ajohnsen): Timeout issue
io/test_runner_test: Pass, Fail # Issue 12413
[ $arch == simmips || $arch == mips ]
@@ -160,7 +163,6 @@
io/http_server_response_test: Pass, Slow
out_of_memory_test: Skip # passes on Mac, crashes on Linux
oom_error_stacktrace_test: Skip # Fails on Linux
-io/web_socket_ping_test: Skip # TODO(ajohnsen): Timeout issue
[ $arch == mips ]
io/test_extension_test: Fail
diff --git a/tests/standalone/vmservice/test_helper.dart b/tests/standalone/vmservice/test_helper.dart
index 1eb81aed..325ecb1 100644
--- a/tests/standalone/vmservice/test_helper.dart
+++ b/tests/standalone/vmservice/test_helper.dart
@@ -7,7 +7,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
-import 'dart:json' as JSON;
import 'package:expect/expect.dart';
abstract class VmServiceRequestHelper {
@@ -45,7 +44,7 @@
print('** Response: $replyAsString');
var reply;
try {
- reply = JSON.parse(replyAsString);
+ reply = JSON.decode(replyAsString);
} catch (e) {
onRequestFailed(e);
return;
diff --git a/tests/utils/recursive_import_test.dart b/tests/utils/recursive_import_test.dart
index db0eff3..b0a042d 100644
--- a/tests/utils/recursive_import_test.dart
+++ b/tests/utils/recursive_import_test.dart
@@ -54,6 +54,10 @@
concat(x) => null;
toString() => null;
}
+class JSNull {
+}
+class JSBool {
+}
""";
const String RECURSIVE_MAIN = """
diff --git a/tools/VERSION b/tools/VERSION
index b00c238..cc8eb02 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 7
-BUILD 0
+BUILD 1
PATCH 0
diff --git a/tools/bots/compiler.py b/tools/bots/compiler.py
index 3f9d9c3..4cc6ac6 100644
--- a/tools/bots/compiler.py
+++ b/tools/bots/compiler.py
@@ -119,7 +119,7 @@
supported_platforms = {
'linux': ['ff', 'chromeOnAndroid', 'chrome'],
'mac': ['safari'],
- 'windows': ['ie9']
+ 'windows': ['ie9', 'ie10']
}
# Platforms that we run on the fyi waterfall only.
fyi_supported_platforms = {
diff --git a/tools/bots/editor.py b/tools/bots/editor.py
index ffe7311..c4a45bb 100755
--- a/tools/bots/editor.py
+++ b/tools/bots/editor.py
@@ -122,6 +122,11 @@
'-mrelease', '--arch=%s' % arch, 'editor', 'create_sdk']
RunProcess(args)
+ # before we run the editor, suppress any 'restore windows' dialogs
+ if sys.platform == 'darwin':
+ bot.RunProcess(['defaults', 'write', 'org.eclipse.eclipse.savedState',
+ 'NSQuitAlwaysKeepsWindows', '-bool', 'false'])
+
for arch in test_architectures:
editor_executable = GetEditorExecutable('Release', arch)
with bot.BuildStep('Test Editor %s' % arch):
diff --git a/tools/coverage.dart b/tools/coverage.dart
index 678fe57..34018c5 100644
--- a/tools/coverage.dart
+++ b/tools/coverage.dart
@@ -15,7 +15,6 @@
import "dart:convert";
import "dart:io";
-import "dart:json" as JSON;
// Whether or not to print debug target process on the console.
@@ -311,7 +310,7 @@
cleanup();
return;
}
- var msgObj = JSON.parse(msg);
+ var msgObj = JSON.decode(msg);
handleMessage(msgObj);
if (errorsDetected) {
error("Error while handling message from coverage target");
@@ -343,7 +342,7 @@
void sendMessage(Map<String,dynamic> msg) {
assert(msg["id"] != null);
msg["id"] = nextMessageId++;
- String jsonMsg = JSON.stringify(msg);
+ String jsonMsg = JSON.encode(msg);
if (verboseWire) print("SEND: $jsonMsg");
socket.write(jsonMsg);
}
@@ -481,7 +480,7 @@
// buffer, or 0 if there is only a partial message in the buffer.
// The object value must start with '{' and continues to the
// matching '}'. No attempt is made to otherwise validate the contents
- // as JSON. If it is invalid, a later JSON.parse() will fail.
+ // as JSON. If it is invalid, a later JSON.decode() will fail.
int objectLength() {
int skipWhitespace(int index) {
while (index < buffer.length) {
diff --git a/tools/ddbg.dart b/tools/ddbg.dart
index 29a86f4..9b164ab 100644
--- a/tools/ddbg.dart
+++ b/tools/ddbg.dart
@@ -7,7 +7,6 @@
import "dart:convert";
import "dart:io";
-import "dart:json" as json;
import "dart:async";
@@ -40,6 +39,7 @@
po <id> Print object info for given id
eval obj <id> <expr> Evaluate expr on object id
eval cls <id> <expr> Evaluate expr on class id
+ eval lib <id> <expr> Evaluate expr in toplevel of library id
pl <id> <idx> [<len>] Print list element/slice
pc <id> Print class info for given id
ll List loaded libraries
@@ -69,9 +69,9 @@
int id = cmd["id"];
outstandingCommands[id] = completer;
if (verbose) {
- print("sending: '${json.stringify(cmd)}'");
+ print("sending: '${JSON.encode(cmd)}'");
}
- vmSock.write(json.stringify(cmd));
+ vmSock.write(JSON.encode(cmd));
return completer.future;
}
@@ -139,6 +139,8 @@
target = "objectId";
} else if (target == "cls") {
target = "classId";
+ } else if (target == "lib") {
+ target = "libraryId";
} else {
huh();
return;
@@ -462,7 +464,7 @@
void processVmMessage(String jsonString) {
- var msg = json.parse(jsonString);
+ var msg = JSON.decode(jsonString);
if (msg == null) {
return;
}
diff --git a/tools/dom/docs/docs.json b/tools/dom/docs/docs.json
index ef81ce5..b2df0d0 100644
--- a/tools/dom/docs/docs.json
+++ b/tools/dom/docs/docs.json
@@ -326,45 +326,6 @@
" * for a list of common response headers.",
" */"
],
- "onabort": [
- "/**",
- " * Event listeners to be notified when request has been aborted,",
- " * generally due to calling `httpRequest.abort()`.",
- " */"
- ],
- "onerror": [
- "/**",
- " * Event listeners to be notified when a request has failed, such as when a",
- " * cross-domain error occurred or the file wasn't found on the server.",
- " */"
- ],
- "onload": [
- "/**",
- " * Event listeners to be notified once the request has completed",
- " * *successfully*.",
- " */"
- ],
- "onloadend": [
- "/**",
- " * Event listeners to be notified once the request has completed (on",
- " * either success or failure).",
- " */"
- ],
- "onloadstart": [
- "/**",
- " * Event listeners to be notified when the request starts, once",
- " * `httpRequest.send()` has been called.",
- " */"
- ],
- "onprogress": [
- "/**",
- " * Event listeners to be notified when data for the request",
- " * is being sent or loaded.",
- " *",
- " * Progress events are fired every 50ms or for every byte transmitted,",
- " * whichever is less frequent.",
- " */"
- ],
"onreadystatechange": [
"/**",
" * Event listeners to be notified every time the [HttpRequest]",
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index 57ac1bf..3bafc1d 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -64,6 +64,34 @@
},
"support_level": "experimental"
},
+ "ApplicationCache": {
+ "comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#application-cache-api",
+ "dart_action": "unstable",
+ "members": {
+ "CHECKING": {},
+ "DOWNLOADING": {},
+ "IDLE": {},
+ "OBSOLETE": {},
+ "UNCACHED": {},
+ "UPDATEREADY": {},
+ "abort": {},
+ "addEventListener": {},
+ "dispatchEvent": {},
+ "oncached": {},
+ "onchecking": {},
+ "ondownloading": {},
+ "onerror": {},
+ "onnoupdate": {},
+ "onobsolete": {},
+ "onprogress": {},
+ "onupdateready": {},
+ "removeEventListener": {},
+ "status": {},
+ "swapCache": {},
+ "update": {}
+ },
+ "support_level": "stable"
+ },
"ArrayBuffer": {
"comment": "http://www.khronos.org/registry/typedarray/specs/latest/",
"members": {
@@ -85,7 +113,13 @@
"comment": "http://www.w3.org/TR/dom/#interface-attr",
"members": {
"isId": {},
+ "localName": {
+ "support_level": "untriaged"
+ },
"name": {},
+ "namespaceURI": {
+ "support_level": "untriaged"
+ },
"ownerElement": {
"dart_action": "suppress",
"support_level": "deprecated"
@@ -383,6 +417,40 @@
},
"support_level": "stable"
},
+ "CSSKeyframeRule": {
+ "members": {
+ "keyText": {
+ "support_level": "untriaged"
+ },
+ "style": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
+ "CSSKeyframesRule": {
+ "members": {
+ "__getter__": {
+ "support_level": "untriaged"
+ },
+ "cssRules": {
+ "support_level": "untriaged"
+ },
+ "deleteRule": {
+ "support_level": "untriaged"
+ },
+ "findRule": {
+ "support_level": "untriaged"
+ },
+ "insertRule": {
+ "support_level": "untriaged"
+ },
+ "name": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"CSSMediaRule": {
"comment": "http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule",
"members": {
@@ -456,6 +524,12 @@
"support_level": "experimental"
},
"IMPORT_RULE": {},
+ "KEYFRAMES_RULE": {
+ "support_level": "untriaged"
+ },
+ "KEYFRAME_RULE": {
+ "support_level": "untriaged"
+ },
"MEDIA_RULE": {},
"PAGE_RULE": {},
"STYLE_RULE": {},
@@ -905,6 +979,9 @@
},
"Console": {
"members": {
+ "assert": {
+ "support_level": "untriaged"
+ },
"assertCondition": {
"support_level": "experimental"
},
@@ -956,6 +1033,74 @@
},
"support_level": "stable"
},
+ "ConsoleBase": {
+ "members": {
+ "assertCondition": {
+ "support_level": "untriaged"
+ },
+ "clear": {
+ "support_level": "untriaged"
+ },
+ "count": {
+ "support_level": "untriaged"
+ },
+ "debug": {
+ "support_level": "untriaged"
+ },
+ "dir": {
+ "support_level": "untriaged"
+ },
+ "dirxml": {
+ "support_level": "untriaged"
+ },
+ "error": {
+ "support_level": "untriaged"
+ },
+ "group": {
+ "support_level": "untriaged"
+ },
+ "groupCollapsed": {
+ "support_level": "untriaged"
+ },
+ "groupEnd": {
+ "support_level": "untriaged"
+ },
+ "info": {
+ "support_level": "untriaged"
+ },
+ "log": {
+ "support_level": "untriaged"
+ },
+ "markTimeline": {
+ "support_level": "untriaged"
+ },
+ "profile": {
+ "support_level": "untriaged"
+ },
+ "profileEnd": {
+ "support_level": "untriaged"
+ },
+ "table": {
+ "support_level": "untriaged"
+ },
+ "time": {
+ "support_level": "untriaged"
+ },
+ "timeEnd": {
+ "support_level": "untriaged"
+ },
+ "timeStamp": {
+ "support_level": "untriaged"
+ },
+ "trace": {
+ "support_level": "untriaged"
+ },
+ "warn": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"ConvolverNode": {
"comment": "https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#ConvolverNode",
"members": {
@@ -1035,32 +1180,51 @@
"support_level": "stable"
},
"DOMApplicationCache": {
- "comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#application-cache-api",
- "dart_action": "unstable",
"members": {
- "CHECKING": {},
- "DOWNLOADING": {},
- "IDLE": {},
- "OBSOLETE": {},
- "UNCACHED": {},
- "UPDATEREADY": {},
- "abort": {},
- "addEventListener": {},
- "dispatchEvent": {},
- "oncached": {},
- "onchecking": {},
- "ondownloading": {},
- "onerror": {},
- "onnoupdate": {},
- "onobsolete": {},
- "onprogress": {},
- "onupdateready": {},
- "removeEventListener": {},
- "status": {},
- "swapCache": {},
- "update": {}
+ "CHECKING": {
+ "support_level": "untriaged"
+ },
+ "DOWNLOADING": {
+ "support_level": "untriaged"
+ },
+ "IDLE": {
+ "support_level": "untriaged"
+ },
+ "OBSOLETE": {
+ "support_level": "untriaged"
+ },
+ "UNCACHED": {
+ "support_level": "untriaged"
+ },
+ "UPDATEREADY": {
+ "support_level": "untriaged"
+ },
+ "abort": {
+ "support_level": "untriaged"
+ },
+ "addEventListener": {
+ "support_level": "untriaged"
+ },
+ "dispatchEvent": {
+ "support_level": "untriaged"
+ },
+ "onerror": {
+ "support_level": "untriaged"
+ },
+ "removeEventListener": {
+ "support_level": "untriaged"
+ },
+ "status": {
+ "support_level": "untriaged"
+ },
+ "swapCache": {
+ "support_level": "untriaged"
+ },
+ "update": {
+ "support_level": "untriaged"
+ }
},
- "support_level": "stable"
+ "support_level": "untriaged"
},
"DOMError": {
"comment": "http://www.w3.org/TR/dom/#interface-domerror",
@@ -1276,12 +1440,18 @@
"DataTransferItemList": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#the-datatransferitemlist-interface",
"members": {
+ "__getter__": {
+ "support_level": "untriaged"
+ },
"add": {},
"addData": {},
"addFile": {},
"clear": {},
"item": {},
- "length": {}
+ "length": {},
+ "remove": {
+ "support_level": "untriaged"
+ }
},
"support_level": "experimental"
},
@@ -1950,6 +2120,12 @@
"support_level": "nonstandard"
},
"lastElementChild": {},
+ "localName": {
+ "support_level": "untriaged"
+ },
+ "namespaceURI": {
+ "support_level": "untriaged"
+ },
"nextElementSibling": {},
"offsetHeight": {},
"offsetLeft": {},
@@ -4692,6 +4868,17 @@
},
"support_level": "stable"
},
+ "HmacKeyParams": {
+ "members": {
+ "hash": {
+ "support_level": "untriaged"
+ },
+ "length": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"HmacParams": {
"members": {
"hash": {
@@ -5703,6 +5890,31 @@
},
"support_level": "stable"
},
+ "NavigatorID": {
+ "members": {
+ "appName": {
+ "support_level": "untriaged"
+ },
+ "appVersion": {
+ "support_level": "untriaged"
+ },
+ "platform": {
+ "support_level": "untriaged"
+ },
+ "userAgent": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
+ "NavigatorOnLine": {
+ "members": {
+ "onLine": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"NavigatorUserMediaError": {
"comment": "http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-NavigatorUserMediaError",
"members": {
@@ -11781,6 +11993,15 @@
"DOM_DELTA_PAGE": {},
"DOM_DELTA_PIXEL": {},
"deltaMode": {},
+ "deltaX": {
+ "support_level": "untriaged"
+ },
+ "deltaY": {
+ "support_level": "untriaged"
+ },
+ "deltaZ": {
+ "support_level": "untriaged"
+ },
"initWebKitWheelEvent": {
"support_level": "experimental"
},
@@ -12178,6 +12399,10 @@
},
"support_level": "stable"
},
+ "WorkerConsole": {
+ "members": {},
+ "support_level": "untriaged"
+ },
"WorkerContext": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#WorkerGlobalScope-partial",
"dart_action": "experimental",
@@ -12291,6 +12516,9 @@
"close": {
"support_level": "untriaged"
},
+ "console": {
+ "support_level": "untriaged"
+ },
"crypto": {
"support_level": "untriaged"
},
@@ -12471,6 +12699,38 @@
},
"support_level": "stable"
},
+ "XMLHttpRequestEventTarget": {
+ "members": {
+ "addEventListener": {
+ "support_level": "untriaged"
+ },
+ "dispatchEvent": {
+ "support_level": "untriaged"
+ },
+ "onabort": {
+ "support_level": "untriaged"
+ },
+ "onerror": {
+ "support_level": "untriaged"
+ },
+ "onload": {
+ "support_level": "untriaged"
+ },
+ "onloadend": {
+ "support_level": "untriaged"
+ },
+ "onloadstart": {
+ "support_level": "untriaged"
+ },
+ "onprogress": {
+ "support_level": "untriaged"
+ },
+ "removeEventListener": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"XMLHttpRequestException": {
"comment": "http://www.w3.org/TR/2007/WD-XMLHttpRequest-20070227/#exceptions",
"dart_action": "experimental",
diff --git a/tools/dom/idl/dart/dart.idl b/tools/dom/idl/dart/dart.idl
index a132f15..a38ee94 100644
--- a/tools/dom/idl/dart/dart.idl
+++ b/tools/dom/idl/dart/dart.idl
@@ -72,7 +72,7 @@
};
[Supplemental]
-interface Console {
+interface ConsoleBase {
[Suppressed] void assert(boolean condition);
[CallWith=ScriptArguments|ScriptState] void assertCondition(boolean condition);
};
@@ -183,14 +183,11 @@
};
[Supplemental]
interface IDBIndex {
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor([ForceOptional] optional IDBKeyRange? range, [ForceOptional] optional DOMString direction);
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor(any key, [ForceOptional] optional DOMString direction);
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openKeyCursor([ForceOptional] optional IDBKeyRange? range, [ForceOptional] optional DOMString direction);
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openKeyCursor(any key,
- [ForceOptional] optional DOMString direction);
+ [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor([Default=Undefined] optional any key, [Default=NullString] optional DOMString direction);
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest count([ForceOptional] optional IDBKeyRange? range);
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest count(any key);
+ [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openKeyCursor([Default=Undefined] optional any key, [Default=NullString] optional DOMString direction);
+
+ [CallWith=ScriptExecutionContext, RaisesException] IDBRequest count([Default=Undefined] optional any key);
};
[Supplemental]
@@ -205,13 +202,13 @@
[DartName=upperBound_] static IDBKeyRange upperBound(any bound, [ForceOptional] optional boolean open);
[DartName=bound_] static IDBKeyRange bound(any lower, any upper, [ForceOptional] optional boolean lowerOpen, [ForceOptional] optional boolean upperOpen);
};
+
[Supplemental]
interface IDBObjectStore {
[CallWith=ScriptState, RaisesException] IDBRequest put(any value, [ForceOptional] optional any key);
[CallWith=ScriptState, RaisesException] IDBRequest add(any value, [ForceOptional] optional any key);
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor([ForceOptional] optional IDBKeyRange? range, [ForceOptional] optional DOMString direction);
+ # [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key);
[CallWith=ScriptExecutionContext, RaisesException] IDBRequest openCursor(any key, [ForceOptional] optional DOMString direction);
- [CallWith=ScriptExecutionContext, RaisesException] IDBRequest count([ForceOptional] optional IDBKeyRange? range);
[CallWith=ScriptExecutionContext, RaisesException] IDBRequest count(any key);
};
@@ -301,7 +298,6 @@
[Custom] void send(FormData data);
};
-
[Suppressed]
interface AbstractView {};
diff --git a/tools/dom/scripts/dartmetadata.py b/tools/dom/scripts/dartmetadata.py
index 40b9713..8b6063c 100644
--- a/tools/dom/scripts/dartmetadata.py
+++ b/tools/dom/scripts/dartmetadata.py
@@ -384,7 +384,7 @@
'Crypto': _webkit_experimental_annotations,
'Database': _web_sql_annotations,
'DatabaseSync': _web_sql_annotations,
- 'DOMApplicationCache': [
+ 'ApplicationCache': [
"@SupportedBrowser(SupportedBrowser.CHROME)",
"@SupportedBrowser(SupportedBrowser.FIREFOX)",
"@SupportedBrowser(SupportedBrowser.IE, '10')",
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 5889566..06f4df6 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -21,6 +21,8 @@
'EventHandler',
'MediaQueryListListener',
'MutationCallback',
+ 'NavigatorID',
+ 'NavigatorOnLine',
'ParentNode',
'SVGExternalResourcesRequired',
'SVGFilterPrimitiveStandardAttributes',
@@ -98,7 +100,7 @@
# IE Firefox
'CSSStyleDeclaration,MSStyleCSSProperties,CSS2Properties',
- 'DOMApplicationCache':
+ 'ApplicationCache':
'ApplicationCache,DOMApplicationCache,OfflineResourceList',
'HTMLTableCellElement':
@@ -109,7 +111,7 @@
'IDBOpenDBRequest':
'IDBOpenDBRequest,IDBVersionChangeRequest',
- 'MouseEvent': 'MouseEvent,DragEvent',
+ 'MouseEvent': 'MouseEvent,DragEvent,PointerEvent,MSPointerEvent',
'MutationObserver': 'MutationObserver,WebKitMutationObserver',
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 73c5d92..acfccc1 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -651,13 +651,22 @@
})
self._members_emitter.Emit(template, E=element_name)
- def SecureOutputType(self, type_name, is_dart_type=False):
+ def SecureOutputType(self, type_name, is_dart_type=False,
+ can_narrow_type=False):
""" Converts the type name to the secure type name for return types.
+ Arguments:
+ can_narrow_type - True if the output type can be narrowed further than
+ what would be accepted for input, used to narrow num APIs down to double
+ or int.
"""
if is_dart_type:
dart_name = type_name
else:
- dart_name = self._DartType(type_name)
+ type_info = self._TypeInfo(type_name)
+ dart_name = type_info.dart_type()
+ if can_narrow_type and dart_name == 'num':
+ dart_name = type_info.native_type()
+
# We only need to secure Window. Only local History and Location are
# returned in generated code.
assert(dart_name != 'HistoryBase' and dart_name != 'LocationBase')
@@ -671,3 +680,6 @@
def _DartType(self, type_name):
return self._type_registry.DartType(type_name)
+
+ def _TypeInfo(self, type_name):
+ return self._type_registry.TypeInfo(type_name)
diff --git a/tools/dom/scripts/htmleventgenerator.py b/tools/dom/scripts/htmleventgenerator.py
index 4f38941..89602e0 100644
--- a/tools/dom/scripts/htmleventgenerator.py
+++ b/tools/dom/scripts/htmleventgenerator.py
@@ -115,13 +115,13 @@
'*.webkitfullscreenerror': ('fullscreenError', 'Event'),
'AbstractWorker.error': ('error', 'ErrorEvent'),
'AudioContext.complete': ('complete', 'Event'),
- 'DOMApplicationCache.cached': ('cached', 'Event'),
- 'DOMApplicationCache.checking': ('checking', 'Event'),
- 'DOMApplicationCache.downloading': ('downloading', 'Event'),
- 'DOMApplicationCache.noupdate': ('noUpdate', 'Event'),
- 'DOMApplicationCache.obsolete': ('obsolete', 'Event'),
- 'DOMApplicationCache.progress': ('progress', 'ProgressEvent'),
- 'DOMApplicationCache.updateready': ('updateReady', 'Event'),
+ 'ApplicationCache.cached': ('cached', 'Event'),
+ 'ApplicationCache.checking': ('checking', 'Event'),
+ 'ApplicationCache.downloading': ('downloading', 'Event'),
+ 'ApplicationCache.noupdate': ('noUpdate', 'Event'),
+ 'ApplicationCache.obsolete': ('obsolete', 'Event'),
+ 'ApplicationCache.progress': ('progress', 'ProgressEvent'),
+ 'ApplicationCache.updateready': ('updateReady', 'Event'),
'Document.readystatechange': ('readyStateChange', 'Event'),
'Document.securitypolicyviolation': ('securityPolicyViolation', 'SecurityPolicyViolationEvent'),
'Document.selectionchange': ('selectionChange', 'Event'),
@@ -215,19 +215,13 @@
'Window.pagehide': ('pageHide', 'Event'),
'Window.pageshow': ('pageShow', 'Event'),
'Window.progress': ('progress', 'Event'),
- 'XMLHttpRequest.abort': ('abort', 'ProgressEvent'),
- 'XMLHttpRequest.error': ('error', 'ProgressEvent'),
- 'XMLHttpRequest.load': ('load', 'ProgressEvent'),
- 'XMLHttpRequest.loadend': ('loadEnd', 'ProgressEvent'),
- 'XMLHttpRequest.loadstart': ('loadStart', 'ProgressEvent'),
- 'XMLHttpRequest.progress': ('progress', 'ProgressEvent'),
+ 'XMLHttpRequestEventTarget.abort': ('abort', 'ProgressEvent'),
+ 'XMLHttpRequestEventTarget.error': ('error', 'ProgressEvent'),
+ 'XMLHttpRequestEventTarget.load': ('load', 'ProgressEvent'),
+ 'XMLHttpRequestEventTarget.loadend': ('loadEnd', 'ProgressEvent'),
+ 'XMLHttpRequestEventTarget.loadstart': ('loadStart', 'ProgressEvent'),
+ 'XMLHttpRequestEventTarget.progress': ('progress', 'ProgressEvent'),
'XMLHttpRequest.readystatechange': ('readyStateChange', 'ProgressEvent'),
- 'XMLHttpRequestUpload.abort': ('abort', 'ProgressEvent'),
- 'XMLHttpRequestUpload.error': ('error', 'ProgressEvent'),
- 'XMLHttpRequestUpload.load': ('load', 'ProgressEvent'),
- 'XMLHttpRequestUpload.loadend': ('loadEnd', 'ProgressEvent'),
- 'XMLHttpRequestUpload.loadstart': ('loadStart', 'ProgressEvent'),
- 'XMLHttpRequestUpload.progress': ('progress', 'ProgressEvent'),
})
# These classes require an explicit declaration for the "on" method even though
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index 6834f8e0..c989f5e 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -28,7 +28,6 @@
'Clipboard': 'DataTransfer',
'Database': 'SqlDatabase', # Avoid conflict with Index DB's Database.
'DatabaseSync': 'SqlDatabaseSync',
- 'DOMApplicationCache': 'ApplicationCache',
'DOMFileSystem': 'FileSystem',
'WebKitPoint': '_DomPoint',
'Entity': '_Entity', # Not sure if we want to expose this yet, may conflict with other libs.
@@ -159,14 +158,8 @@
dom_private_html_members = monitored.Set('htmlrenamer.private_html_members', [
'Document.createElement',
'Document.createElementNS',
- 'Document.createRange',
- 'Element.getAttribute',
- 'Element.getAttributeNS',
- 'Element.setAttribute',
- 'Element.setAttributeNS',
'EventTarget.addEventListener',
'EventTarget.removeEventListener',
- 'Node.childNodes',
])
# Members from the standard dom that should not be exposed publicly in dart:html
@@ -218,9 +211,13 @@
'Element.children',
'Element.childElementCount',
'Element.firstElementChild',
+ 'Element.getAttribute',
+ 'Element.getAttributeNS',
'Element.getElementsByTagName',
'Element.scrollIntoView',
'Element.scrollIntoViewIfNeeded',
+ 'Element.setAttribute',
+ 'Element.setAttributeNS',
'Element.removeAttribute',
'Element.removeAttributeNS',
'Element.hasAttribute',
@@ -279,6 +276,7 @@
'MutationEvent.initMutationEvent',
'MutationObserver.observe',
'Node.attributes',
+ 'Node.childNodes',
'Node.localName',
'Node.namespaceURI',
'Node.removeChild',
@@ -318,8 +316,8 @@
'UIEvent.pageY',
'WebGLRenderingContext.texImage2D',
'WheelEvent.initWebKitWheelEvent',
- 'WheelEvent.wheelDeltaX',
- 'WheelEvent.wheelDeltaY',
+ 'WheelEvent.deltaX',
+ 'WheelEvent.deltaY',
'Window.createImageBitmap',
'Window.getComputedStyle',
'Window.moveTo',
@@ -395,6 +393,8 @@
'ImageBitmapFactories.createImageBitmap(ImageData data, long sx, long sy, long sw, long sh)' : 'createImageBitmap9',
'ImageBitmapFactories.createImageBitmap(ImageBitmap bitmap)' : 'createImageBitmap10',
'ImageBitmapFactories.createImageBitmap(ImageBitmap bitmap, long sx, long sy, long sw, long sh)' : 'createImageBitmap11',
+ 'ImageBitmapFactories.createImageBitmap(Blob blob)' : 'createImageBitmap12',
+ 'ImageBitmapFactories.createImageBitmap(Blob blob, long sx, long sy, long sw, long sh)' : 'createImageBitmap13',
'RTCDataChannel.send(ArrayBuffer data)': 'sendByteBuffer',
'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData',
'RTCDataChannel.send(Blob data)': 'sendBlob',
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index 5133ef6..2503ff9 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -397,7 +397,7 @@
'Crypto':
"JS('bool', '!!(window.crypto && window.crypto.getRandomValues)')",
'Database': "JS('bool', '!!(window.openDatabase)')",
- 'DOMApplicationCache': "JS('bool', '!!(window.applicationCache)')",
+ 'ApplicationCache': "JS('bool', '!!(window.applicationCache)')",
'DOMFileSystem': "JS('bool', '!!(window.webkitRequestFileSystem)')",
'FormData': "JS('bool', '!!(window.FormData)')",
'HashChangeEvent': "Device.isEventTypeSupported('HashChangeEvent')",
@@ -651,7 +651,7 @@
def AdditionalImplementedInterfaces(self):
implements = super(Dart2JSBackend, self).AdditionalImplementedInterfaces()
- if self._interface_type_info.list_item_type():
+ if self._interface_type_info.list_item_type() and self.HasIndexedGetter():
implements.append('JavaScriptIndexingBehavior')
return implements
@@ -718,6 +718,15 @@
self._current_secondary_parent = interface
self._members_emitter.Emit('\n // From $WHERE\n', WHERE=interface.id)
+ def HasIndexedGetter(self):
+ ext_attrs = self._interface.ext_attrs
+ has_indexed_getter = 'CustomIndexedGetter' in ext_attrs
+ for operation in self._interface.operations:
+ if operation.id == 'item' and 'getter' in operation.specials:
+ has_indexed_getter = True
+ break
+ return has_indexed_getter
+
def AddIndexer(self, element_type):
"""Adds all the methods required to complete implementation of List."""
# We would like to simply inherit the implementation of everything except
@@ -738,12 +747,7 @@
# class YImpl extends ListBase<T> { copies of transitive XImpl methods; }
#
- ext_attrs = self._interface.ext_attrs
- has_indexed_getter = 'CustomIndexedGetter' in ext_attrs
- for operation in self._interface.operations:
- if operation.id == 'item' and 'getter' in operation.specials:
- has_indexed_getter = True
- break
+ has_indexed_getter = self.HasIndexedGetter()
if has_indexed_getter:
indexed_getter = ('JS("%s", "#[#]", this, index)' %
@@ -763,7 +767,7 @@
' return $INDEXED_GETTER;\n'
' }',
INDEXED_GETTER=indexed_getter,
- TYPE=self.SecureOutputType(element_type))
+ TYPE=self.SecureOutputType(element_type, False, True))
if 'CustomIndexedSetter' in self._interface.ext_attrs:
self._members_emitter.Emit(
@@ -808,7 +812,7 @@
' // final $TYPE $NAME;\n',
SUPER=super_attribute_interface,
NAME=html_name,
- TYPE=self.SecureOutputType(attribute.type.id))
+ TYPE=self.SecureOutputType(attribute.type.id, False, read_only))
return
self._members_emitter.Emit('\n // Shadowing definition.')
self._AddAttributeUsingProperties(attribute, html_name, read_only)
@@ -821,7 +825,7 @@
self._AddAttributeUsingProperties(attribute, html_name, read_only)
return
- output_type = self.SecureOutputType(attribute.type.id)
+ output_type = self.SecureOutputType(attribute.type.id, False, read_only)
input_type = self._NarrowInputType(attribute.type.id)
metadata = self._Metadata(attribute.type.id, attribute.id, output_type)
rename = self._RenamingAnnotation(attribute.id, html_name)
@@ -954,7 +958,7 @@
METADATA=self._Metadata(info.type_name, info.declared_name,
self.SecureOutputType(info.type_name)),
MODIFIERS='static ' if info.IsStatic() else '',
- TYPE=self.SecureOutputType(info.type_name),
+ TYPE=self.SecureOutputType(info.type_name, False, True),
NAME=html_name,
PARAMS=info.ParametersDeclaration(self._NarrowInputType))
@@ -1059,7 +1063,7 @@
self._members_emitter.Emit(
'\n'
' $TYPE $NAME($PARAMS);\n',
- TYPE=self.SecureOutputType(info.type_name),
+ TYPE=self.SecureOutputType(info.type_name, False, True),
NAME=info.name,
PARAMS=info.ParametersDeclaration(self._NarrowInputType))
@@ -1157,9 +1161,6 @@
return FindInParent(self._interface) if attr else (None, None)
- def _DartType(self, type_name):
- return self._type_registry.DartType(type_name)
-
# ------------------------------------------------------------------------------
class DartLibraryEmitter():
diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py
index 8280e8c..d36e0cd 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -37,6 +37,7 @@
('DOMWindow', 'btoa'): 'DOMWindowBase64',
('DOMWindow', 'clearTimeout'): 'DOMWindowTimers',
('DOMWindow', 'clearInterval'): 'DOMWindowTimers',
+ ('DOMWindow', 'createImageBitmap'): 'ImageBitmapFactories',
('HTMLInputElement', 'webkitEntries'): 'HTMLInputElementFileSystem',
('Navigator', 'doNotTrack'): 'NavigatorDoNotTrack',
('Navigator', 'geolocation'): 'NavigatorGeolocation',
@@ -48,6 +49,11 @@
('Navigator', 'webkitGetGamepads'): 'NavigatorGamepad',
('Navigator', 'requestMIDIAccess'): 'NavigatorWebMIDI',
('Navigator', 'vibrate'): 'NavigatorVibration',
+ ('Navigator', 'appName'): 'NavigatorID',
+ ('Navigator', 'appVersion'): 'NavigatorID',
+ ('Navigator', 'platform'): 'NavigatorID',
+ ('Navigator', 'userAgent'): 'NavigatorID',
+ ('Navigator', 'onLine'): 'NavigatorOnLine',
('WorkerGlobalScope', 'crypto'): 'WorkerGlobalScopeCrypto',
('WorkerGlobalScope', 'indexedDB'): 'WorkerGlobalScopeIndexedDatabase',
('WorkerGlobalScope', 'webkitNotifications'): 'WorkerGlobalScopeNotifications',
@@ -64,6 +70,10 @@
('WorkerGlobalScope', 'clearInterval'): 'DOMWindowTimers',
}
+_cpp_import_map = {
+ 'ImageBitmapFactories' : 'modules/imagebitmap/ImageBitmapFactories'
+}
+
_cpp_overloaded_callback_map = {
('DOMURL', 'createObjectUrlFromSourceCallback'): 'URLMediaSource',
('DOMURL', 'createObjectUrlFromStreamCallback'): 'URLMediaStream',
@@ -81,7 +91,11 @@
for (type, member) in _cpp_callback_map.keys():
if type not in _cpp_partial_map:
_cpp_partial_map[type] = set([])
- _cpp_partial_map[type].add(_cpp_callback_map[(type, member)])
+
+ name_with_path = _cpp_callback_map[(type, member)]
+ if name_with_path in _cpp_import_map:
+ name_with_path = _cpp_import_map[name_with_path]
+ _cpp_partial_map[type].add(name_with_path)
for (type, member) in _cpp_overloaded_callback_map.keys():
if type not in _cpp_partial_map:
@@ -435,18 +449,18 @@
TO_DART=to_dart_emitter.Fragments())
def EmitAttribute(self, attribute, html_name, read_only):
- self._AddGetter(attribute, html_name)
+ self._AddGetter(attribute, html_name, read_only)
if not read_only:
self._AddSetter(attribute, html_name)
- def _AddGetter(self, attr, html_name):
+ def _AddGetter(self, attr, html_name, read_only):
# Temporary hack to force dart:scalarlist clamped array for ImageData.data.
# TODO(antonm): solve in principled way.
if self._interface.id == 'ImageData' and html_name == 'data':
html_name = '_data'
type_info = self._TypeInfo(attr.type.id)
dart_declaration = '%s get %s' % (
- self.SecureOutputType(attr.type.id), html_name)
+ self.SecureOutputType(attr.type.id, False, read_only), html_name)
is_custom = 'Custom' in attr.ext_attrs or 'CustomGetter' in attr.ext_attrs
cpp_callback_name = self._GenerateNativeBinding(attr.id, 1,
dart_declaration, 'Getter', is_custom)
@@ -616,7 +630,7 @@
dart_declaration = '%s%s %s(%s)' % (
'static ' if info.IsStatic() else '',
- self.SecureOutputType(info.type_name),
+ self.SecureOutputType(info.type_name, False, True),
html_name,
info.ParametersDeclaration(self._DartType))
@@ -1081,13 +1095,6 @@
lambda s: 'is' + s.group(1).capitalize(),
name)
- def _TypeInfo(self, type_name):
- return self._type_registry.TypeInfo(type_name)
-
- def _DartType(self, type_name):
- return self._type_registry.DartType(type_name)
-
-
class CPPLibraryEmitter():
def __init__(self, emitters, cpp_sources_dir):
self._emitters = emitters
diff --git a/tools/dom/src/AttributeMap.dart b/tools/dom/src/AttributeMap.dart
index de088a7..c926d8c 100644
--- a/tools/dom/src/AttributeMap.dart
+++ b/tools/dom/src/AttributeMap.dart
@@ -92,15 +92,15 @@
}
String operator [](String key) {
- return _element.$dom_getAttribute(key);
+ return _element._getAttribute(key);
}
void operator []=(String key, String value) {
- _element.$dom_setAttribute(key, value);
+ _element._setAttribute(key, value);
}
String remove(String key) {
- String value = _element.$dom_getAttribute(key);
+ String value = _element._getAttribute(key);
_element._removeAttribute(key);
return value;
}
@@ -129,11 +129,11 @@
}
String operator [](String key) {
- return _element.$dom_getAttributeNS(_namespace, key);
+ return _element._getAttributeNS(_namespace, key);
}
void operator []=(String key, String value) {
- _element.$dom_setAttributeNS(_namespace, key, value);
+ _element._setAttributeNS(_namespace, key, value);
}
String remove(String key) {
diff --git a/tools/dom/src/CrossFrameTypes.dart b/tools/dom/src/CrossFrameTypes.dart
index 7034d24..9353839 100644
--- a/tools/dom/src/CrossFrameTypes.dart
+++ b/tools/dom/src/CrossFrameTypes.dart
@@ -20,7 +20,7 @@
* * [DOM Window](https://developer.mozilla.org/en-US/docs/DOM/window) from MDN.
* * [Window](http://www.w3.org/TR/Window/) from the W3C.
*/
-abstract class WindowBase {
+abstract class WindowBase implements EventTarget {
// Fields.
/**
diff --git a/tools/dom/src/Isolates.dart b/tools/dom/src/Isolates.dart
index b6b0fb8..3eb4003 100644
--- a/tools/dom/src/Isolates.dart
+++ b/tools/dom/src/Isolates.dart
@@ -100,7 +100,7 @@
var source = '$target-result';
var result = null;
window.on[source].first.then((Event e) {
- result = json.parse(_getPortSyncEventData(e));
+ result = JSON.decode(_getPortSyncEventData(e));
});
_dispatchEvent(target, [source, message]);
return result;
@@ -184,7 +184,7 @@
_callback = callback;
if (_portSubscription == null) {
_portSubscription = window.on[_listenerName].listen((Event e) {
- var data = json.parse(_getPortSyncEventData(e));
+ var data = JSON.decode(_getPortSyncEventData(e));
var replyTo = data[0];
var message = _deserialize(data[1]);
var result = _callback(message);
@@ -215,7 +215,7 @@
void _dispatchEvent(String receiver, var message) {
var event = new CustomEvent(receiver, canBubble: false, cancelable:false,
- detail: json.stringify(message));
+ detail: JSON.encode(message));
window.dispatchEvent(event);
}
diff --git a/tools/dom/src/NodeValidatorBuilder.dart b/tools/dom/src/NodeValidatorBuilder.dart
index c5f0c80..41cab67 100644
--- a/tools/dom/src/NodeValidatorBuilder.dart
+++ b/tools/dom/src/NodeValidatorBuilder.dart
@@ -110,6 +110,21 @@
}
/**
+ * Allow inline styles on elements.
+ *
+ * If [tagName] is not specified then this allows inline styles on all
+ * elements. Otherwise tagName limits the styles to the specified elements.
+ */
+ void allowInlineStyles({String tagName}) {
+ if (tagName == null) {
+ tagName = '*';
+ } else {
+ tagName = tagName.toUpperCase();
+ }
+ add(new _SimpleNodeValidator(null, allowedAttributes: ['$tagName::style']));
+ }
+
+ /**
* Allow common safe HTML5 elements and attributes.
*
* This list is based off of the Caja whitelists at:
diff --git a/tools/dom/src/Validators.dart b/tools/dom/src/Validators.dart
index 430658e..5154a9d 100644
--- a/tools/dom/src/Validators.dart
+++ b/tools/dom/src/Validators.dart
@@ -165,6 +165,8 @@
Element element = node;
var attrs = element.attributes;
if (!validator.allowsElement(element)) {
+ window.console.warn(
+ 'Removing disallowed element <${element.tagName}>');
element.remove();
break;
}
@@ -172,6 +174,8 @@
var isAttr = attrs['is'];
if (isAttr != null) {
if (!validator.allowsAttribute(element, 'is', isAttr)) {
+ window.console.warn('Removing disallowed type extension '
+ '<${element.tagName} is="$isAttr">');
element.remove();
break;
}
@@ -184,6 +188,8 @@
var name = keys[i];
if (!validator.allowsAttribute(element, name.toLowerCase(),
attrs[name])) {
+ window.console.warn('Removing disallowed attribute '
+ '<${element.tagName} $name="${attrs[name]}">');
attrs.remove(name);
}
}
diff --git a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
index 5519ebc..67490a8 100644
--- a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
@@ -6,11 +6,30 @@
// https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
// Auto-generated dart:html library.
-/// The Dart HTML library.
-///
-/// For examples, see
-/// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
-/// on Github.
+/**
+ * HTML elements and other resources for web-based applications that need to
+ * interact with the browser and the DOM (Document Object Model).
+ *
+ * This library includes DOM element types, CSS styling, local storage,
+ * media, speech, events, and more.
+ * To get started,
+ * check out the [Element] class, the base class for many of the HTML
+ * DOM types.
+ *
+ * ## Other resources
+ *
+ * * If you've never written a web app before, try our
+ * tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials).
+ *
+ * * To see some web-based Dart apps in action and to play with the code,
+ * download
+ * [Dart Editor](http://www.dartlang.org/#get-started)
+ * and run its built-in examples.
+ *
+ * * For even more examples, see
+ * [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
+ * on Github.
+ */
library dart.dom.html;
import 'dart:async';
@@ -19,7 +38,7 @@
import 'dart:html_common';
import 'dart:indexed_db';
import 'dart:isolate';
-import 'dart:json' as json;
+import "dart:convert";
import 'dart:math';
import 'dart:typed_data';
// Not actually used, but imported since dart:html can generate these objects.
diff --git a/tools/dom/templates/html/dart2js/impl_Console.darttemplate b/tools/dom/templates/html/dart2js/impl_Console.darttemplate
index ceeb155..741c710 100644
--- a/tools/dom/templates/html/dart2js/impl_Console.darttemplate
+++ b/tools/dom/templates/html/dart2js/impl_Console.darttemplate
@@ -6,7 +6,9 @@
$(ANNOTATIONS)$(CLASS_MODIFIERS)class Console {
- static Console _safeConsole = new Console();
+ Console._safe() {}
+
+ static Console _safeConsole = new Console._safe();
bool get _isConsoleDefined => JS('bool', 'typeof console != "undefined"');
diff --git a/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate b/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate
index 3b8b7eef..5fb394d 100644
--- a/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/svg_dart2js.darttemplate
@@ -9,7 +9,7 @@
import 'dart:_collection-dev' hide deprecated;
import 'dart:html';
import 'dart:html_common';
-import 'dart:_js_helper' show Creates, Returns, JavaScriptIndexingBehavior, JSName;
+import 'dart:_js_helper' show Creates, Returns, JSName;
import 'dart:_foreign_helper' show JS;
import 'dart:_interceptors' show Interceptor;
diff --git a/tools/dom/templates/html/dart2js/web_sql_dart2js.darttemplate b/tools/dom/templates/html/dart2js/web_sql_dart2js.darttemplate
index 105360e..9c79d0d 100644
--- a/tools/dom/templates/html/dart2js/web_sql_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/web_sql_dart2js.darttemplate
@@ -19,7 +19,7 @@
import 'dart:_collection-dev' hide deprecated;
import 'dart:html';
import 'dart:html_common';
-import 'dart:_js_helper' show convertDartClosureToJS, Creates, JavaScriptIndexingBehavior, JSName;
+import 'dart:_js_helper' show convertDartClosureToJS, Creates, JSName;
import 'dart:_foreign_helper' show JS;
import 'dart:_interceptors' show Interceptor;
diff --git a/tools/dom/templates/html/dartium/html_dartium.darttemplate b/tools/dom/templates/html/dartium/html_dartium.darttemplate
index 8aeace0..cde3552 100644
--- a/tools/dom/templates/html/dartium/html_dartium.darttemplate
+++ b/tools/dom/templates/html/dartium/html_dartium.darttemplate
@@ -5,11 +5,30 @@
// DO NOT EDIT
// Auto-generated dart:html library.
-/// The Dart HTML library.
-///
-/// For examples, see
-/// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
-/// on Github.
+/**
+ * HTML elements and other resources for web-based applications that need to
+ * interact with the browser and the DOM (Document Object Model).
+ *
+ * This library includes DOM element types, CSS styling, local storage,
+ * media, speech, events, and more.
+ * To get started,
+ * check out the [Element] class, the base class for many of the HTML
+ * DOM types.
+ *
+ * ## Other resources
+ *
+ * * If you've never written a web app before, try our
+ * tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials).
+ *
+ * * To see some web-based Dart apps in action and to play with the code,
+ * download
+ * [Dart Editor](http://www.dartlang.org/#get-started)
+ * and run its built-in examples.
+ *
+ * * For even more examples, see
+ * [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
+ * on Github.
+ */
library dart.dom.html;
import 'dart:async';
@@ -18,7 +37,7 @@
import 'dart:html_common';
import 'dart:indexed_db';
import 'dart:isolate';
-import 'dart:json' as json;
+import "dart:convert";
import 'dart:math';
// TODO(vsm): Remove this when we can do the proper checking in
// native code for custom elements.
@@ -113,7 +132,7 @@
_callPortSync(num id, var message) {
if (!_callPortInitialized) {
window.on['js-result'].listen((event) {
- _callPortLastResult = json.parse(_getPortSyncEventData(event));
+ _callPortLastResult = JSON.decode(_getPortSyncEventData(event));
});
_callPortInitialized = true;
}
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 74cc8f7..0bf8034 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -1238,7 +1238,7 @@
}
var fragment;
if (Range.supportsCreateContextualFragment) {
- var range = _parseDocument.$dom_createRange();
+ var range = _parseDocument.createRange();
range.selectNodeContents(contextElement);
fragment = range.createContextualFragment(html);
} else {
diff --git a/tools/dom/templates/html/impl/impl_HTMLTableElement.darttemplate b/tools/dom/templates/html/impl/impl_HTMLTableElement.darttemplate
index 8548c59..c7c3212 100644
--- a/tools/dom/templates/html/impl/impl_HTMLTableElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLTableElement.darttemplate
@@ -37,6 +37,22 @@
@JSName('createTBody')
TableSectionElement _nativeCreateTBody() native;
+
+ DocumentFragment createFragment(String html,
+ {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ if (Range.supportsCreateContextualFragment) {
+ return super.createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer);
+ }
+ // IE9 workaround which does not support innerHTML on Table elements.
+ var contextualHtml = '<table>$html</table>';
+ var table = new Element.html(contextualHtml, validator: validator,
+ treeSanitizer: treeSanitizer);
+ var fragment = new DocumentFragment();
+ fragment.nodes.addAll(table.nodes);
+
+ return fragment;
+ }
$endif
$!MEMBERS}
diff --git a/tools/dom/templates/html/impl/impl_HTMLTableRowElement.darttemplate b/tools/dom/templates/html/impl/impl_HTMLTableRowElement.darttemplate
index 7716e37..d2dbc9e 100644
--- a/tools/dom/templates/html/impl/impl_HTMLTableRowElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLTableRowElement.darttemplate
@@ -17,4 +17,21 @@
TableCellElement insertCell(int index) => _insertCell(index);
+$if DART2JS
+ DocumentFragment createFragment(String html,
+ {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ if (Range.supportsCreateContextualFragment) {
+ return super.createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer);
+ }
+ // IE9 workaround which does not support innerHTML on Table elements.
+ var fragment = new DocumentFragment();
+ var section = new TableElement().createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer).nodes.single;
+ var row = section.nodes.single;
+ fragment.nodes.addAll(row.nodes);
+ return fragment;
+ }
+$endif
+
$!MEMBERS}
diff --git a/tools/dom/templates/html/impl/impl_HTMLTableSectionElement.darttemplate b/tools/dom/templates/html/impl/impl_HTMLTableSectionElement.darttemplate
index 5f47932..e15a540 100644
--- a/tools/dom/templates/html/impl/impl_HTMLTableSectionElement.darttemplate
+++ b/tools/dom/templates/html/impl/impl_HTMLTableSectionElement.darttemplate
@@ -17,4 +17,20 @@
TableRowElement insertRow(int index) => _insertRow(index);
+$if DART2JS
+ DocumentFragment createFragment(String html,
+ {NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
+ if (Range.supportsCreateContextualFragment) {
+ return super.createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer);
+ }
+ // IE9 workaround which does not support innerHTML on Table elements.
+ var fragment = new DocumentFragment();
+ var section = new TableElement().createFragment(
+ html, validator: validator, treeSanitizer: treeSanitizer).nodes.single;
+ fragment.nodes.addAll(section.nodes);
+ return fragment;
+ }
+$endif
+
$!MEMBERS}
diff --git a/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate b/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate
index afba24e..44f866c 100644
--- a/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate
+++ b/tools/dom/templates/html/impl/impl_IDBIndex.darttemplate
@@ -8,12 +8,7 @@
@DomName('IDBIndex.count')
Future<int> count([key_OR_range]) {
try {
- var request;
- if (key_OR_range != null) {
- request = _count(key_OR_range);
- } else {
- request = _count();
- }
+ var request = _count(key_OR_range);
return _completeRequest(request);
} catch (e, stacktrace) {
return new Future.error(e, stacktrace);
@@ -60,12 +55,7 @@
} else {
key_OR_range = range;
}
- var request;
- if (direction == null) {
- request = _openCursor(key_OR_range);
- } else {
- request = _openCursor(key_OR_range, direction);
- }
+ var request = _openCursor(key_OR_range, direction);
return ObjectStore._cursorStreamFromResult(request, autoAdvance);
}
@@ -87,12 +77,7 @@
} else {
key_OR_range = range;
}
- var request;
- if (direction == null) {
- request = _openKeyCursor(key_OR_range);
- } else {
- request = _openKeyCursor(key_OR_range, direction);
- }
+ var request = _openKeyCursor(key_OR_range, direction);
return ObjectStore._cursorStreamFromResult(request, autoAdvance);
}
diff --git a/tools/dom/templates/html/impl/impl_IDBObjectStore.darttemplate b/tools/dom/templates/html/impl/impl_IDBObjectStore.darttemplate
index bc55c61..6cf94ba 100644
--- a/tools/dom/templates/html/impl/impl_IDBObjectStore.darttemplate
+++ b/tools/dom/templates/html/impl/impl_IDBObjectStore.darttemplate
@@ -42,12 +42,7 @@
@DomName('IDBObjectStore.count')
Future<int> count([key_OR_range]) {
try {
- var request;
- if (key_OR_range != null) {
- request = _count(key_OR_range);
- } else {
- request = _count();
- }
+ var request = _count(key_OR_range);
return _completeRequest(request);
} catch (e, stacktrace) {
return new Future.error(e, stacktrace);
diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate
index f48bb03..e544887 100644
--- a/tools/dom/templates/html/impl/impl_Node.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Node.darttemplate
@@ -145,7 +145,7 @@
_this._replaceChild(value, this[index]);
}
- Iterator<Node> get iterator => _this.$dom_childNodes.iterator;
+ Iterator<Node> get iterator => _this._childNodes.iterator;
// From List<Node>:
@@ -167,15 +167,15 @@
// -- end List<Node> mixins.
// TODO(jacobr): benchmark whether this is more efficient or whether caching
- // a local copy of $dom_childNodes is more efficient.
- int get length => _this.$dom_childNodes.length;
+ // a local copy of _childNodes is more efficient.
+ int get length => _this._childNodes.length;
void set length(int value) {
throw new UnsupportedError(
"Cannot set length on immutable List.");
}
- Node operator[](int index) => _this.$dom_childNodes[index];
+ Node operator[](int index) => _this._childNodes[index];
}
/** Information about the instantiated template. */
diff --git a/tools/dom/templates/html/impl/impl_Range.darttemplate b/tools/dom/templates/html/impl/impl_Range.darttemplate
index 1f3013a..f152a33 100644
--- a/tools/dom/templates/html/impl/impl_Range.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Range.darttemplate
@@ -7,7 +7,7 @@
part of $LIBRARYNAME;
$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
- factory $CLASSNAME() => document.$dom_createRange();
+ factory $CLASSNAME() => document.createRange();
factory $CLASSNAME.fromPoint(Point point) =>
document._caretRangeFromPoint(point.x, point.y);
diff --git a/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate b/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate
index a11cb22..9f0600b 100644
--- a/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate
+++ b/tools/dom/templates/html/impl/impl_WheelEvent.darttemplate
@@ -64,9 +64,12 @@
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey, button, relatedTarget, axis);
} else {
+ // Chrome does an auto-convert to pixels.
+ deltaY = deltaY ~/ 120;
$else
- // Dartium always needs these flipped because we're essentially always
- // polyfilling (see similar dart2js code as well)
+ // Dartium always needs these flipped because we're using the legacy
+ // _initWebKitWheelEvent instead of the more modern WheelEvent constructor
+ // which isn't yet properly exposed by the Dartium bindings.
deltaX = -deltaX;
deltaY = -deltaY;
$endif
@@ -74,8 +77,7 @@
event._initMouseEvent(type, canBubble, cancelable, view, detail,
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey, button, relatedTarget);
- event._initWebKitWheelEvent(deltaX,
- deltaY ~/ 120, // Chrome does an auto-convert to pixels.
+ event._initWebKitWheelEvent(deltaX, deltaY,
view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey,
metaKey);
$if DART2JS
@@ -171,8 +173,6 @@
return 0;
}
- num get _deltaY => JS('num', '#.deltaY', this);
- num get _deltaX => JS('num', '#.deltaX', this);
num get _wheelDelta => JS('num', '#.wheelDelta', this);
num get _wheelDeltaX => JS('num', '#.wheelDeltaX', this);
num get _detail => JS('num', '#.detail', this);
@@ -230,7 +230,7 @@
* * [WheelEvent.deltaX](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaX) from the W3C.
*/
@DomName('WheelEvent.deltaX')
- num get deltaX => -_wheelDeltaX;
+ num get deltaX => _deltaX;
/**
* The amount that is expected to scroll vertically, in units determined by
@@ -241,6 +241,6 @@
* * [WheelEvent.deltaY](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaY) from the W3C.
*/
@DomName('WheelEvent.deltaY')
- num get deltaY => -_wheelDeltaY;
+ num get deltaY => _deltaY;
$endif
}
diff --git a/tools/dom/templates/html/impl/impl_Window.darttemplate b/tools/dom/templates/html/impl/impl_Window.darttemplate
index a4e2195..b797f0b 100644
--- a/tools/dom/templates/html/impl/impl_Window.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Window.darttemplate
@@ -32,7 +32,7 @@
if (portStr == null) {
return null;
}
- var port = json.parse(portStr);
+ var port = JSON.decode(portStr);
return _deserialize(port);
}
@@ -44,7 +44,7 @@
void registerPort(String name, var port) {
var serialized = _serialize(port);
document.documentElement.attributes['dart-port:$name'] =
- json.stringify(serialized);
+ JSON.encode(serialized);
}
/**
diff --git a/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate b/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
index aa47fc8..7919df9 100644
--- a/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
+++ b/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
@@ -250,6 +250,13 @@
completer.completeError(e);
}, 1));
+ // IE9 RTM - XDomainRequest issued requests may abort if all event handlers
+ // not specified
+ // http://social.msdn.microsoft.com/Forums/ie/en-US/30ef3add-767c-4436-b8a9-f1ca19b4812e/ie9-rtm-xdomainrequest-issued-requests-may-abort-if-all-event-handlers-not-specified
+ JS('', '#.onprogress = {}', xhr);
+ JS('', '#.ontimeout = {}', xhr);
+ JS('', '#.timeout = Number.MAX_VALUE', xhr);
+
if (sendData != null) {
JS('', '#.send(#)', xhr, sendData);
} else {
diff --git a/tools/gyp/configurations_msvs.gypi b/tools/gyp/configurations_msvs.gypi
index f2d067c..dd1d115 100644
--- a/tools/gyp/configurations_msvs.gypi
+++ b/tools/gyp/configurations_msvs.gypi
@@ -29,6 +29,10 @@
],
},
},
+ # C4351 warns MSVC follows the C++ specification regarding array
+ # initialization in member initializers. Code that expects the
+ # specified behavior should silence this warning.
+ 'msvs_disabled_warnings': [4351],
},
'Dart_Release': {
@@ -56,6 +60,10 @@
],
},
},
+ # C4351 warns MSVC follows the C++ specification regarding array
+ # initialization in member initializers. Code that expects the
+ # specified behavior should silence this warning.
+ 'msvs_disabled_warnings': [4351],
},
},
'defines': [
diff --git a/tools/task_kill.py b/tools/task_kill.py
new file mode 100755
index 0000000..b77d789
--- /dev/null
+++ b/tools/task_kill.py
@@ -0,0 +1,172 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+# A script to kill hanging processs. The tool will return non-zero if any
+# process was actually found.
+#
+
+import optparse
+import os
+import signal
+import shutil
+import string
+import subprocess
+import sys
+import utils
+
+os_name = utils.GuessOS()
+
+POSIX_INFO = 'ps -p %s -o args'
+
+EXECUTABLE_NAMES = {
+ 'win32': { 'chrome': 'chrome.exe', 'dart': 'dart.exe',
+ 'iexplore': 'iexplore.exe', 'firefox': 'firefox.exe'},
+ 'linux': { 'chrome': 'chrome', 'dart': 'dart',
+ 'firefox': 'firefox.exe'},
+ 'macos': { 'chrome': 'Chrome', 'dart': 'dart',
+ 'firefox': 'firefox', 'safari': 'Safari' }
+}
+
+INFO_COMMAND = {
+ 'win32': 'wmic process where Processid=%s get CommandLine',
+ 'macos': POSIX_INFO,
+ 'linux': POSIX_INFO,
+}
+
+def GetOptions():
+ parser = optparse.OptionParser("usage: %prog [options]")
+ parser.add_option("--kill_dart", default=True,
+ help="Kill all dart processes")
+ parser.add_option("--kill_browsers", default=False,
+ help="Kill all browser processes")
+ (options, args) = parser.parse_args()
+ return options
+
+
+def GetPidsPosix(process_name):
+ # This is to have only one posix command, on linux we could just do:
+ # pidof process_name
+ cmd = 'ps -e -o pid=,comm='
+ # Sample output:
+ # 1 /sbin/launchd
+ # 80943 /Applications/Safari.app/Contents/MacOS/Safari
+ p = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True)
+ output, stderr = p.communicate()
+ results = []
+ lines = output.splitlines()
+ for line in lines:
+ split = line.split()
+ # On mac this ps commands actually gives us the full path to non
+ # system binaries.
+ if len(split) >= 2 and " ".join(split[1:]).endswith(process_name):
+ results.append(split[0])
+ return results
+
+
+def GetPidsWindows(process_name):
+ cmd = 'tasklist /FI "IMAGENAME eq %s" /NH' % process_name
+ # Sample output:
+ # dart.exe 4356 Console 1 6,800 K
+ p = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True)
+ output, stderr = p.communicate()
+ results = []
+ lines = output.splitlines()
+
+ for line in lines:
+ split = line.split()
+ if len(split) > 2 and split[0] == process_name:
+ results.append(split[1])
+ return results
+
+def GetPids(process_name):
+ if (os_name == "win32"):
+ return GetPidsWindows(process_name)
+ else:
+ return GetPidsPosix(process_name)
+
+def PrintPidInfo(pid):
+ # We asume that the list command will return lines in the format:
+ # EXECUTABLE_PATH ARGS
+ # There may be blank strings in the output
+ p = subprocess.Popen(INFO_COMMAND[os_name] % pid,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True)
+ output, stderr = p.communicate()
+ lines = output.splitlines()
+
+ # Pop the header
+ lines.pop(0)
+ for line in lines:
+ # wmic will output a bunch of empty strings, we ignore these
+ if len(line) >= 1:
+ print("Hanging process info:")
+ print(" PID: %s" % pid)
+ print(" Command line: %s" % line)
+
+
+def KillPosix(pid):
+ try:
+ os.kill(int(pid), signal.SIGKILL);
+ except:
+ # Ignore this, the process is already dead from killing another process.
+ pass
+
+def KillWindows(pid):
+ # os.kill is not available until python 2.7
+ cmd = "taskkill /F /PID %s" % pid
+ p = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=True)
+ p.communicate()
+
+def Kill(name):
+ if (name not in EXECUTABLE_NAMES[os_name]):
+ return 0
+ print("***************** Killing %s *****************" % name)
+ platform_name = EXECUTABLE_NAMES[os_name][name]
+ pids = GetPids(platform_name)
+ for pid in pids:
+ PrintPidInfo(pid);
+ if (os_name == "win32"):
+ KillWindows(pid)
+ else:
+ KillPosix(pid)
+ print("Killed pid: %s" % pid)
+ if (len(pids) == 0):
+ print(" No %s processes found." % name)
+ return len(pids)
+
+def KillBrowsers():
+ status = Kill('firefox')
+ status += Kill('chrome')
+ status += Kill('iexplore')
+ status += Kill('safari')
+ return status
+
+def KillDart():
+ status = Kill("dart")
+ return status
+
+def Main():
+ options = GetOptions()
+ status = 0
+ if (options.kill_dart):
+ status += KillDart();
+ if (options.kill_browsers):
+ status += KillBrowsers()
+ return status
+
+if __name__ == '__main__':
+ sys.exit(Main())
diff --git a/tools/test.dart b/tools/test.dart
index 24da3d2..f84a77c 100755
--- a/tools/test.dart
+++ b/tools/test.dart
@@ -50,7 +50,7 @@
final TEST_SUITE_DIRECTORIES = [
new Path('pkg'),
new Path('runtime/tests/vm'),
- new Path('samples/tests/samples'),
+ new Path('samples'),
new Path('tests/benchmark_smoke'),
new Path('tests/chrome'),
new Path('tests/compiler/dart2js'),
@@ -154,10 +154,9 @@
}
}
- // There should not be more than one InternetExplorerDriver instance
- // running at a time. For details, see
- // http://code.google.com/p/selenium/wiki/InternetExplorerDriver.
- if (conf['runtime'].startsWith('ie') && !conf["use_browser_controller"]) {
+ // If people use selenium they will have issues if we use more than one
+ // ie browser at a time.
+ if (conf['runtime'].startsWith('ie') && !conf['use_browser_controller']) {
maxBrowserProcesses = 1;
} else if (conf['runtime'].startsWith('safari') &&
conf['use_browser_controller']) {
@@ -262,34 +261,14 @@
var completer = new Completer();
var environment = Platform.environment;
if (environment['DART_TESTING_DELETE_TEMPORARY_DIRECTORIES'] == '1') {
- Directory getTempDir() {
- // dir will be located in the system temporary directory.
- var dir = new Directory('').createTempSync();
- var path = new Path(dir.path).directoryPath;
- dir.deleteSync();
- return new Directory(path.toNativePath());
- }
-
- // These are the patterns of temporary directory names created by
- // 'Directory.createTempSync()' on linux/macos and windows.
- var regExp;
- if (['macos', 'linux'].contains(Platform.operatingSystem)) {
- regExp = new RegExp(r'^temp_dir1_......$');
- } else {
- regExp = new RegExp(r'tempdir-........-....-....-....-............$');
- }
-
- getTempDir().list().listen((directoryEntry) {
- if (directoryEntry is Directory) {
- if (regExp.hasMatch(new Path(directoryEntry.path).filename)) {
+ LeftOverTempDirPrinter.getLeftOverTemporaryDirectories().listen(
+ (Directory tempDirectory) {
try {
- directoryEntry.deleteSync(recursive: true);
+ tempDirectory.deleteSync(recursive: true);
} catch (error) {
DebugLogger.error(error);
}
- }
- }
- }, onDone: completer.complete);
+ }, onDone: completer.complete);
} else {
completer.complete();
}
diff --git a/tools/testing/dart/browser_controller.dart b/tools/testing/dart/browser_controller.dart
index 26569fb..a9992d9 100644
--- a/tools/testing/dart/browser_controller.dart
+++ b/tools/testing/dart/browser_controller.dart
@@ -535,6 +535,10 @@
String url;
int timeout;
Stopwatch stopwatch;
+
+ // This might be null
+ Duration delayUntilTestStarted;
+
// We store this here for easy access when tests time out (instead of
// capturing this in a closure)
Timer timeoutTimer;
@@ -589,6 +593,7 @@
testingServer = new BrowserTestingServer(local_ip, useIframe);
return testingServer.start().then((_) {
testingServer.testDoneCallBack = handleResults;
+ testingServer.testStartedCallBack = handleStarted;
testingServer.nextTestCallBack = getNextTest;
return getBrowsers().then((browsers) {
var futures = [];
@@ -674,6 +679,7 @@
testCache[testId] = status.currentTest.url;
Stopwatch watch = new Stopwatch()..start();
status.currentTest.doneCallback(output,
+ status.currentTest.delayUntilTestStarted,
status.currentTest.stopwatch.elapsed);
watch.stop();
status.lastTest = status.currentTest;
@@ -688,6 +694,18 @@
}
}
+ void handleStarted(String browserId, String output, int testId) {
+ var status = browserStatus[browserId];
+
+ if (status != null && !status.timeout && status.currentTest != null) {
+ status.currentTest.timeoutTimer.cancel();
+ status.currentTest.timeoutTimer =
+ createTimeoutTimer(status.currentTest, status);
+ status.currentTest.delayUntilTestStarted =
+ status.currentTest.stopwatch.elapsed;
+ }
+ }
+
void handleTimeout(BrowserTestingStatus status) {
// We simply kill the browser and starts up a new one!
// We could be smarter here, but it does not seems like it is worth it.
@@ -731,6 +749,7 @@
});
status.currentTest.stopwatch.stop();
status.currentTest.doneCallback("TIMEOUT",
+ status.currentTest.delayUntilTestStarted,
status.currentTest.stopwatch.elapsed);
status.currentTest = null;
}
@@ -756,13 +775,17 @@
}
exit(1);
}
- Timer timer = new Timer(new Duration(seconds: test.timeout),
- () { handleTimeout(status); });
- status.currentTest.timeoutTimer = timer;
+
+ status.currentTest.timeoutTimer = createTimeoutTimer(test, status);
status.currentTest.stopwatch = new Stopwatch()..start();
return test;
}
+ Timer createTimeoutTimer(BrowserTest test, BrowserTestingStatus status) {
+ return new Timer(
+ new Duration(seconds: test.timeout), () { handleTimeout(status); });
+ }
+
void queueTest(BrowserTest test) {
testQueue.add(test);
}
@@ -819,6 +842,7 @@
static const String driverPath = "/driver";
static const String nextTestPath = "/next_test";
static const String reportPath = "/report";
+ static const String startedPath = "/started";
static const String waitSignal = "WAIT";
static const String terminateSignal = "TERMINATE";
@@ -829,6 +853,7 @@
bool useIframe = false;
Function testDoneCallBack;
+ Function testStartedCallBack;
Function nextTestCallBack;
BrowserTestingServer(this.local_ip, this.useIframe);
@@ -850,6 +875,13 @@
// the closing of the streams.
return;
}
+ if (request.uri.path.startsWith(startedPath)) {
+ var browserId = request.uri.path.substring(startedPath.length + 1);
+ var testId =
+ int.parse(request.uri.queryParameters["id"].split("=")[1]);
+ handleStarted(request, browserId, testId);
+ return;
+ }
var textResponse = "";
if (request.uri.path.startsWith(driverPath)) {
var browserId = request.uri.path.substring(driverPath.length + 1);
@@ -907,11 +939,26 @@
StringBuffer buffer = new StringBuffer();
request.transform(UTF8.decoder).listen((data) {
buffer.write(data);
- }, onDone: () {
- String back = buffer.toString();
- request.response.close();
- testDoneCallBack(browserId, back, testId);
- }, onError: (error) { print(error); });
+ }, onDone: () {
+ String back = buffer.toString();
+ request.response.close();
+ testDoneCallBack(browserId, back, testId);
+ // TODO(ricow): We should do something smart if we get an error here.
+ }, onError: (error) { DebugLogger.error("$error"); });
+ }
+
+ void handleStarted(HttpRequest request, String browserId, var testId) {
+ StringBuffer buffer = new StringBuffer();
+ // If an error occurs while receiving the data from the request stream,
+ // we don't handle it specially. We can safely ignore it, since the started
+ // events are not crucial.
+ request.transform(UTF8.decoder).listen((data) {
+ buffer.write(data);
+ }, onDone: () {
+ String back = buffer.toString();
+ request.response.close();
+ testStartedCallBack(browserId, back, testId);
+ }, onError: (error) { DebugLogger.error("$error"); });
}
String getNextTest(String browserId) {
@@ -983,13 +1030,26 @@
}
}
+ function contactBrowserController(method,
+ path,
+ callback,
+ msg,
+ isUrlEncoded) {
+ var client = new XMLHttpRequest();
+ client.onreadystatechange = callback;
+ client.open(method, path);
+ if (isUrlEncoded) {
+ client.setRequestHeader('Content-type',
+ 'application/x-www-form-urlencoded');
+ }
+ client.send(msg);
+ }
+
function getNextTask() {
// Until we have the next task we set the current_id to a specific
// negative value.
- var client = new XMLHttpRequest();
- client.onreadystatechange = newTaskHandler;
- client.open('GET', '$nextTestPath/$browserId');
- client.send();
+ contactBrowserController(
+ 'GET', '$nextTestPath/$browserId', newTaskHandler, "", false);
}
function run(url) {
@@ -1015,24 +1075,23 @@
}
function reportError(msg) {
- var client = new XMLHttpRequest();
function handleReady() {
if (this.readyState == this.DONE && this.status != 200) {
// We could not report, pop up to notify if running interactively.
alert(this.status);
}
}
- client.onreadystatechange = handleReady;
- client.open('POST', '$errorReportingUrl?test=1');
- client.setRequestHeader('Content-type',
- 'application/x-www-form-urlencoded');
- client.send(msg);
+ contactBrowserController(
+ 'POST', '$errorReportingUrl?test=1', handleReady, msg, true);
}
function reportMessage(msg) {
if (msg == 'STARTING') {
test_completed = false;
current_id = next_id;
+ contactBrowserController(
+ 'POST', '$startedPath/${browserId}?id=' + current_id,
+ function () {}, msg, true);
return;
}
@@ -1050,12 +1109,9 @@
}
}
}
- var client = new XMLHttpRequest();
- client.onreadystatechange = handleReady;
- client.open('POST', '$reportPath/${browserId}?id=' + current_id);
- client.setRequestHeader('Content-type',
- 'application/x-www-form-urlencoded');
- client.send(msg);
+ contactBrowserController(
+ 'POST', '$reportPath/${browserId}?id=' + current_id, handleReady,
+ msg, true);
}
function messageHandler(e) {
diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart
index fc85e79..b942437 100644
--- a/tools/testing/dart/multitest.dart
+++ b/tools/testing/dart/multitest.dart
@@ -238,7 +238,9 @@
hasRuntimeErrors,
isNegativeIfChecked: isNegativeIfChecked,
hasFatalTypeErrors: enableFatalTypeErrors,
- multitestOutcome: outcome);
+ multitestOutcome: outcome,
+ multitestKey: key,
+ originTestPath: filePath);
}
return null;
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index fb1b11f..dc0f5ff 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -601,9 +601,8 @@
suite = pattern.substring(0, slashLocation);
pattern = pattern.substring(slashLocation + 1);
pattern = pattern.replaceAll('*', '.*');
- pattern = pattern.replaceAll('/', '.*');
} else {
- pattern = ".*";
+ pattern = ".?";
}
if (selectorMap.containsKey(suite)) {
print("Error: '$suite/$pattern'. Only one test selection"
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index 104f88c..abba2c9 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -4,6 +4,7 @@
library test_progress;
+import "dart:async";
import "dart:io";
import "dart:io" as io;
import "http_server.dart" as http_server;
@@ -327,30 +328,47 @@
class LeftOverTempDirPrinter extends EventListener {
final MIN_NUMBER_OF_TEMP_DIRS = 50;
- Path _tempDir() {
+ static Directory _getTemporaryDirectory() {
// Dir will be located in the system temporary directory.
var dir = new Directory('').createTempSync();
var path = new Path(dir.path).directoryPath;
dir.deleteSync();
- return path;
+ return new Directory(path.toNativePath());
+ }
+
+ static RegExp _getTemporaryDirectoryRegexp() {
+ // These are the patterns of temporary directory names created by
+ // 'Directory.createTempSync()' on linux/macos and windows.
+ if (['macos', 'linux'].contains(Platform.operatingSystem)) {
+ return new RegExp(r'^temp_dir1_......$');
+ } else {
+ return new RegExp(r'tempdir-........-....-....-....-............$');
+ }
+ }
+
+ static Stream<Directory> getLeftOverTemporaryDirectories() {
+ var regExp = _getTemporaryDirectoryRegexp();
+ return _getTemporaryDirectory().list().where(
+ (FileSystemEntity fse) {
+ if (fse is Directory) {
+ if (regExp.hasMatch(new Path(fse.path).filename)) {
+ return true;
+ }
+ }
+ return false;
+ });
}
void allDone() {
- var count = 0;
- var systemTempDir = _tempDir();
- var lister = new Directory(systemTempDir.toNativePath()).list().listen(
- (FileSystemEntity fse) {
- if (fse is Directory) count++;
- },
- onError: (error) {
- DebugLogger.warning("Could not list temp directories, got: $error");
- },
- onDone: () {
- if (count > MIN_NUMBER_OF_TEMP_DIRS) {
- DebugLogger.warning("There are ${count} directories "
- "in the system tempdir ('$systemTempDir')! "
- "Maybe left over directories?\n");
+ getLeftOverTemporaryDirectories().length.then((int count) {
+ if (count > MIN_NUMBER_OF_TEMP_DIRS) {
+ DebugLogger.warning("There are ${count} directories "
+ "in the system tempdir "
+ "('${_getTemporaryDirectory().path}')! "
+ "Maybe left over directories?\n");
}
+ }).catchError((error) {
+ DebugLogger.warning("Could not list temp directories, got: $error");
});
}
}
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index d7bda75..8058f04 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -1823,12 +1823,24 @@
BrowserTestCommand browserCommand, int timeout) {
var completer = new Completer<CommandOutput>();
- var callback = (var output, var duration) {
+ var callback = (output, delayUntilTestStarted, duration) {
+ bool timedOut = output == "TIMEOUT";
+ String stderr = "";
+ if (timedOut) {
+ if (delayUntilTestStarted != null) {
+ stderr = "This test timed out. The delay until the test was actually "
+ "started was: $delayUntilTestStarted.";
+ } else {
+ stderr = "This test has not notified test.py that it started running."
+ " This could be a bug in test.py! "
+ "Please contact ricow/kustermann";
+ }
+ }
var commandOutput = createCommandOutput(browserCommand,
0,
- output == "TIMEOUT",
+ timedOut,
encodeUtf8(output),
- [],
+ encodeUtf8(stderr),
duration,
false);
completer.complete(commandOutput);
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index dc7289f..aeb782b 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -38,7 +38,9 @@
bool hasRuntimeError,
{bool isNegativeIfChecked,
bool hasFatalTypeErrors,
- Set<String> multitestOutcome});
+ Set<String> multitestOutcome,
+ String multitestKey,
+ Path originTestPath});
typedef void VoidFunction();
@@ -251,6 +253,77 @@
* to be listed each time.
*/
void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]);
+
+
+ // This function is set by subclasses before enqueueing starts.
+ Function doTest;
+
+ // This function will be called for every TestCase of this test suite.
+ // It will
+ // - handle sharding
+ // - update SummaryReport
+ // - handle SKIP/SKIP_BY_DESIGN markers
+ // - test if the selector matches
+ // and will enqueue the test (if necessary).
+ void enqueueNewTestCase(TestCase testCase) {
+ var expectations = testCase.expectedOutcomes;
+
+ // Handle sharding based on the original test path (i.e. all multitests
+ // of a given original test belong to the same shard)
+ int shards = configuration['shards'];
+ if (shards > 1) {
+ int shard = configuration['shard'];
+ var testPath =
+ testCase.info.originTestPath.relativeTo(TestUtils.dartDir());
+ if ("$testPath".hashCode % shards != shard - 1) {
+ return;
+ }
+ }
+ // Test if the selector includes this test.
+ RegExp pattern = configuration['selectors'][suiteName];
+ if (!pattern.hasMatch(testCase.displayName)) {
+ return;
+ }
+
+ // Update Summary report
+ if (configuration['report']) {
+ SummaryReport.add(expectations);
+ if (testCase.info != null &&
+ testCase.info.hasCompileError &&
+ TestUtils.isBrowserRuntime(configuration['runtime']) &&
+ configuration['compiler'] != 'none') {
+ SummaryReport.addCompileErrorSkipTest();
+ return;
+ }
+ }
+
+ // Handle skipped tests
+ if (expectations.contains(SKIP) ||
+ expectations.contains(SKIP_BY_DESIGN)) {
+ return;
+ }
+
+ doTest(testCase);
+ }
+
+ String buildTestCaseDisplayName(Path suiteDir,
+ Path originTestPath,
+ {String multitestName: ""}) {
+ Path testNamePath = originTestPath.relativeTo(suiteDir);
+ var directory = testNamePath.directoryPath;
+ var filenameWithoutExt = testNamePath.filenameWithoutExtension;
+
+ String concat(String base, String part) {
+ if (base == "") return part;
+ if (part == "") return base;
+ return "$base/$part";
+ }
+
+ var testName = "$directory";
+ testName = concat(testName, "$filenameWithoutExt");
+ testName = concat(testName, multitestName);
+ return testName;
+ }
}
@@ -311,7 +384,6 @@
String hostRunnerPath;
final String dartDir;
List<String> statusFilePaths;
- Function doTest;
VoidFunction doDone;
ReceivePort receiveTestName;
TestExpectations testExpectations;
@@ -345,28 +417,17 @@
} else {
// Only run the tests that match the pattern. Use the name
// "suiteName/testName" for cc tests.
- RegExp pattern = configuration['selectors'][suiteName];
String constructedName = '$suiteName/$testPrefix$testName';
- if (!pattern.hasMatch(constructedName)) return;
var expectations = testExpectations.expectations(
'$testPrefix$testName');
- if (configuration["report"]) {
- SummaryReport.add(expectations);
- }
-
- if (expectations.contains(SKIP) ||
- expectations.contains(SKIP_BY_DESIGN)) {
- return;
- }
-
var args = TestUtils.standardOptions(configuration);
args.add(testName);
var command = CommandBuilder.instance.getCommand(
'run_vm_unittest', targetRunnerPath, args, configurationDir);
- doTest(
+ enqueueNewTestCase(
new TestCase(constructedName,
[command],
configuration,
@@ -401,6 +462,7 @@
class TestInformation {
+ Path originTestPath;
Path filePath;
Map optionsFromFile;
bool hasCompileError;
@@ -408,12 +470,15 @@
bool isNegativeIfChecked;
bool hasFatalTypeErrors;
Set<String> multitestOutcome;
+ String multitestKey;
TestInformation(this.filePath, this.optionsFromFile,
this.hasCompileError, this.hasRuntimeError,
this.isNegativeIfChecked, this.hasFatalTypeErrors,
- this.multitestOutcome) {
+ this.multitestOutcome,
+ {this.multitestKey, this.originTestPath}) {
assert(filePath.isAbsolute);
+ if (originTestPath == null) originTestPath = filePath;
}
}
@@ -424,7 +489,6 @@
class StandardTestSuite extends TestSuite {
final Path suiteDir;
final List<String> statusFilePaths;
- Function doTest;
TestExpectations testExpectations;
List<TestInformation> cachedTests;
final Path dartDir;
@@ -619,11 +683,10 @@
Path filePath = new Path(filename);
// Only run the tests that match the pattern.
- RegExp pattern = configuration['selectors'][suiteName];
if (filePath.filename.endsWith('test_config.dart')) return;
var optionsFromFile = readOptionsFromFile(filePath);
- CreateTest createTestCase = makeTestCaseCreator(pattern, optionsFromFile);
+ CreateTest createTestCase = makeTestCaseCreator(optionsFromFile);
if (optionsFromFile['isMultitest']) {
group.add(doMultitest(filePath, buildDir, suiteDir, createTestCase));
@@ -638,55 +701,10 @@
var filePath = info.filePath;
var optionsFromFile = info.optionsFromFile;
- // Look up expectations in status files using a test name generated
- // from the test file's path.
- String testName;
-
- if (optionsFromFile['isMultitest']) {
- // Multitests are in [build directory]/generated_tests/... .
- // The test name will be '[test filename (no extension)]/[multitest key].
- String name = filePath.filenameWithoutExtension;
- int middle = name.lastIndexOf('_');
- testName = '${name.substring(0, middle)}/${name.substring(middle + 1)}';
- } else {
- // The test name is the relative path from the test suite directory to
- // the test, with the .dart extension removed.
- assert(filePath.toNativePath().startsWith(
- suiteDir.toNativePath()));
- var testNamePath = filePath.relativeTo(suiteDir);
- assert(testNamePath.extension == 'dart');
- if (testNamePath.extension == 'dart') {
- testName = testNamePath.directoryPath.append(
- testNamePath.filenameWithoutExtension).toString();
- }
- }
- int shards = configuration['shards'];
- if (shards > 1) {
- int shard = configuration['shard'];
- if (testName.hashCode % shards != shard - 1) {
- return;
- }
- }
+ String testName = buildTestCaseDisplayName(suiteDir, info.originTestPath,
+ multitestName: optionsFromFile['isMultitest'] ? info.multitestKey : "");
Set<String> expectations = testExpectations.expectations(testName);
- if (info.hasCompileError &&
- TestUtils.isBrowserRuntime(configuration['runtime']) &&
- configuration['report'] &&
- configuration['compiler'] != 'none') {
- SummaryReport.addCompileErrorSkipTest();
- return;
- }
- if (configuration['report']) {
- // Tests with multiple VMOptions are counted more than once.
- for (var dummy in getVmOptions(optionsFromFile)) {
- SummaryReport.add(expectations);
- }
- }
- if (expectations.contains(SKIP) ||
- expectations.contains(SKIP_BY_DESIGN)) {
- return;
- }
-
if (configuration['compiler'] != 'none' && info.hasCompileError) {
// If a compile-time error is expected, and we're testing a
// compiler, we never need to attempt to run the program (in a
@@ -729,12 +747,13 @@
allVmOptions = new List.from(vmOptions)..addAll(extraVmOptions);
}
- doTest(new TestCase('$suiteName/$testName',
- makeCommands(info, allVmOptions, commonArguments),
- configuration,
- expectations,
- isNegative: isNegative(info),
- info: info));
+ enqueueNewTestCase(
+ new TestCase('$suiteName/$testName',
+ makeCommands(info, allVmOptions, commonArguments),
+ configuration,
+ expectations,
+ isNegative: isNegative(info),
+ info: info));
}
}
@@ -822,25 +841,27 @@
}
}
- CreateTest makeTestCaseCreator(RegExp pattern, Map optionsFromFile) {
+ CreateTest makeTestCaseCreator(Map optionsFromFile) {
return (Path filePath,
bool hasCompileError,
bool hasRuntimeError,
{bool isNegativeIfChecked: false,
bool hasFatalTypeErrors: false,
- Set<String> multitestOutcome: null}) {
- if (pattern.hasMatch('$filePath')) {
- // Cache the test information for each test case.
- var info = new TestInformation(filePath,
- optionsFromFile,
- hasCompileError,
- hasRuntimeError,
- isNegativeIfChecked,
- hasFatalTypeErrors,
- multitestOutcome);
- cachedTests.add(info);
- enqueueTestCaseFromTestInformation(info);
- }
+ Set<String> multitestOutcome: null,
+ String multitestKey,
+ Path originTestPath}) {
+ // Cache the test information for each test case.
+ var info = new TestInformation(filePath,
+ optionsFromFile,
+ hasCompileError,
+ hasRuntimeError,
+ isNegativeIfChecked,
+ hasFatalTypeErrors,
+ multitestOutcome,
+ multitestKey: multitestKey,
+ originTestPath: originTestPath);
+ cachedTests.add(info);
+ enqueueTestCaseFromTestInformation(info);
};
}
@@ -965,21 +986,29 @@
String content = null;
Path dir = filePath.directoryPath;
String nameNoExt = filePath.filenameWithoutExtension;
+
Path pngPath = dir.append('$nameNoExt.png');
Path txtPath = dir.append('$nameNoExt.txt');
+ Path customHtmlPath = dir.append('$nameNoExt.html');
Path expectedOutput = null;
- if (new File(pngPath.toNativePath()).existsSync()) {
- expectedOutput = pngPath;
- content = getHtmlLayoutContents(scriptType, new Path("$scriptPath"));
- } else if (new File(txtPath.toNativePath()).existsSync()) {
- expectedOutput = txtPath;
- content = getHtmlLayoutContents(scriptType, new Path("$scriptPath"));
+
+ if (new File(customHtmlPath.toNativePath()).existsSync()) {
+ // Use existing HTML document if available.
+ htmlPath = customHtmlPath.toNativePath();
} else {
- content = getHtmlContents(filename, scriptType,
- new Path("$scriptPath"));
+ if (new File(pngPath.toNativePath()).existsSync()) {
+ expectedOutput = pngPath;
+ content = getHtmlLayoutContents(scriptType, new Path("$scriptPath"));
+ } else if (new File(txtPath.toNativePath()).existsSync()) {
+ expectedOutput = txtPath;
+ content = getHtmlLayoutContents(scriptType, new Path("$scriptPath"));
+ } else {
+ content = getHtmlContents(filename, scriptType,
+ new Path("$scriptPath"));
+ }
+ htmlTest.writeStringSync(content);
+ htmlTest.closeSync();
}
- htmlTest.writeStringSync(content);
- htmlTest.closeSync();
// Construct the command(s) that compile all the inputs needed by the
// browser test. For running Dart in DRT, this will be noop commands.
@@ -1094,7 +1123,7 @@
info, isNegative(info), fullHtmlPath);
}
- doTest(testCase);
+ enqueueNewTestCase(testCase);
subtestIndex++;
} while(subtestIndex < subtestNames.length);
}
@@ -1570,7 +1599,6 @@
final String dartDir;
String classPath;
List<String> testClasses;
- TestCaseEvent doTest;
VoidFunction doDone;
TestExpectations testExpectations;
@@ -1651,10 +1679,10 @@
updatedConfiguration['timeout'] *= 3;
var command = CommandBuilder.instance.getCommand(
'junit_test', 'java', args, configurationDir);
- doTest(new TestCase(suiteName,
- [command],
- updatedConfiguration,
- new Set<String>.from([PASS])));
+ enqueueNewTestCase(new TestCase(suiteName,
+ [command],
+ updatedConfiguration,
+ new Set<String>.from([PASS])));
doDone();
}
diff --git a/utils/apidoc/apidoc.dart b/utils/apidoc/apidoc.dart
index 9bb299c..fe4e617 100644
--- a/utils/apidoc/apidoc.dart
+++ b/utils/apidoc/apidoc.dart
@@ -15,8 +15,8 @@
library apidoc;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'html_diff.dart';
@@ -112,7 +112,7 @@
print('Parsing MDN data...');
final mdnFile = new File(path.join(scriptDir, 'mdn', 'database.json'));
- final mdn = json.parse(mdnFile.readAsStringSync());
+ final mdn = JSON.decode(mdnFile.readAsStringSync());
print('Cross-referencing dart:html...');
// TODO(amouravski): move HtmlDiff inside of the future chain below to re-use
@@ -163,14 +163,14 @@
var libPath = '../../$lib';
if (new File(libPath).existsSync()) {
apidocLibraries.add(path.toUri(libPath));
- var libName = libPath.replaceAll('.dart', '');
+ var libName = path.basename(libPath).replaceAll('.dart', '');
includedLibraries.add(libName);
}
}
final apidoc = new Apidoc(mdn, outputDir, mode, generateAppCache,
excludedLibraries, version);
- apidoc.dartdocPath =
+ apidoc.dartdocPath =
path.join(scriptDir, '..', '..', 'sdk', 'lib', '_internal', 'dartdoc');
// Select the libraries to include in the produced documentation:
apidoc.includeApi = true;
diff --git a/utils/apidoc/mdn/extract.dart b/utils/apidoc/mdn/extract.dart
index 2e2d766..210e84c 100644
--- a/utils/apidoc/mdn/extract.dart
+++ b/utils/apidoc/mdn/extract.dart
@@ -3,8 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import "dart:collection";
+import 'dart:convert';
import 'dart:html';
-import 'dart:json' as json;
// Workaround for HTML lib missing feature.
Range newRange() {
@@ -346,8 +346,8 @@
void onEnd() {
// Hideous hack to send JSON back to JS.
- String dbJson = json.stringify(dbEntry);
- // workaround bug in json.parse.
+ String dbJson = JSON.encode(dbEntry);
+ // workaround bug in JSON.decode.
dbJson = dbJson.replaceAll("ZDARTIUMDOESNTESCAPESLASHNJXXXX", "\\n");
// Use postMessage to end the JSON to JavaScript. TODO(jacobr): use a simple
@@ -1314,7 +1314,7 @@
void documentLoaded(event) {
// Load the database of expected methods and properties with an HttpRequest.
new HttpRequest.get('${window.location}.json', (req) {
- data = json.parse(req.responseText);
+ data = JSON.decode(req.responseText);
dbEntry = {'members': [], 'srcUrl': pageUrl};
run();
});
diff --git a/utils/apidoc/mdn/postProcess.dart b/utils/apidoc/mdn/postProcess.dart
index 801e7d1..ee61723 100644
--- a/utils/apidoc/mdn/postProcess.dart
+++ b/utils/apidoc/mdn/postProcess.dart
@@ -6,13 +6,13 @@
library postProcess;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'util.dart';
void main() {
// Database of code documentation.
- Map<String, List> database = json.parse(
+ Map<String, List> database = JSON.decode(
new File('output/database.json').readAsStringSync());
final filteredDb = {};
final obsolete = [];
@@ -33,6 +33,6 @@
}
}
}
- writeFileSync("output/database.filtered.json", json.stringify(filteredDb));
- writeFileSync("output/obsolete.json", json.stringify(obsolete));
+ writeFileSync("output/database.filtered.json", JSON.encode(filteredDb));
+ writeFileSync("output/obsolete.json", JSON.encode(obsolete));
}
diff --git a/utils/apidoc/mdn/prettyPrint.dart b/utils/apidoc/mdn/prettyPrint.dart
index 0071279..3e5c12a 100644
--- a/utils/apidoc/mdn/prettyPrint.dart
+++ b/utils/apidoc/mdn/prettyPrint.dart
@@ -4,8 +4,8 @@
library prettyPrint;
+import 'dart:convert';
import 'dart:io';
-import 'dart:json' as json;
import 'util.dart';
String orEmpty(String str) {
@@ -51,7 +51,7 @@
void main() {
// Database of code documentation.
- final Map<String, Map> database = json.parse(
+ final Map<String, Map> database = JSON.decode(
new File('output/database.filtered.json').readAsStringSync());
// Types we have documentation for.
diff --git a/utils/apidoc/mdn/util.dart b/utils/apidoc/mdn/util.dart
index b338988..e5907bd 100644
--- a/utils/apidoc/mdn/util.dart
+++ b/utils/apidoc/mdn/util.dart
@@ -1,7 +1,6 @@
library util;
import 'dart:io';
-import 'dart:json' as json;
Map<String, Map> _allProps;