Version 0.6.16.0 .
svn merge -r 25743:25973 https://dart.googlecode.com/svn/branches/bleeding_edge
trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@25977 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/client/tools/buildbot_annotated_steps.py b/client/tools/buildbot_annotated_steps.py
index 347b483..4a2d187 100755
--- a/client/tools/buildbot_annotated_steps.py
+++ b/client/tools/buildbot_annotated_steps.py
@@ -13,13 +13,12 @@
chromium and headless dartium.
"""
+import imp
import os
import re
import socket
import subprocess
import sys
-import shutil
-import glob
BUILDER_NAME = 'BUILDBOT_BUILDERNAME'
BUILDER_CLOBBER = 'BUILDBOT_CLOBBER'
@@ -30,6 +29,13 @@
DARTIUM_V_MATCHER = (
'gs://dartium-archive/[^/]*/dartium-\w*-inc-([0-9]*).([0-9]*).zip')
+def GetUtils():
+ '''Dynamically load the tools/utils.py python module.'''
+ dart_dir = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
+ return imp.load_source('utils', os.path.join(dart_dir, 'tools', 'utils.py'))
+
+utils = GetUtils()
+
def GetBuildInfo():
"""Returns a tuple (name, version, mode) where:
- name: A name for the build - the buildbot host if a buildbot.
@@ -58,21 +64,7 @@
version = 'unknown'
return (name, version)
-
-def GetUtils():
- '''
- dynamically get the utils module
- We use a dynamic import for tools/util.py because we derive its location
- dynamically using sys.argv[0]. This allows us to run this script from
- different directories.
-
- args:
- '''
- sys.path.append(os.path.abspath(os.path.join('.', 'tools')))
- utils = __import__('utils')
- return utils
-
-def GetOutDir(utils, mode):
+def GetOutDir(mode):
'''
get the location to place the output
@@ -99,8 +91,7 @@
# get the latest changed revision from the current repository sub-tree
version = GetLatestChangedRevision()
- utils = GetUtils()
- outdir = GetOutDir(utils, mode)
+ outdir = GetOutDir(mode)
cmds = [sys.executable, toolsBuildScript,
'--mode=' + mode, '--revision=' + version,
'--name=' + name, '--out=' + outdir]
@@ -162,32 +153,11 @@
def GetShouldClobber():
return os.environ.get(BUILDER_CLOBBER) == "1"
-def RunDart(scriptPath):
- if sys.platform == 'darwin':
- pipe = subprocess.Popen(
- ['./tools/testing/bin/macos/dart', scriptPath],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- elif os.name == 'posix':
- pipe = subprocess.Popen(
- ['./tools/testing/bin/linux/dart', scriptPath],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- else:
- pipe = subprocess.Popen(
- ['tools\\testing\\bin\\windows\\dart.exe', scriptPath],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
-
- output = pipe.communicate()
- return output[0]
-
def GetLatestChangedRevision():
- # 0.1.2.0_r13661
- # 0.1.2.0_r13661_username
- fullVersion = RunDart("tools/version.dart")
-
- m = re.search('._r(\d+)', fullVersion)
- svnRev = m.group(1)
-
- return svnRev
+ revision = utils.GetSVNRevision()
+ if not revision:
+ raise Exception("Couldn't determine last changed revision.")
+ return revision
def main():
if len(sys.argv) == 0:
diff --git a/pkg/analyzer_experimental/bin/analyzer.dart b/pkg/analyzer_experimental/bin/analyzer.dart
index 805e960..5fed0a8 100644
--- a/pkg/analyzer_experimental/bin/analyzer.dart
+++ b/pkg/analyzer_experimental/bin/analyzer.dart
@@ -10,14 +10,8 @@
import 'dart:async';
import 'dart:io';
-import 'package:analyzer_experimental/src/generated/java_io.dart';
import 'package:analyzer_experimental/src/generated/engine.dart';
import 'package:analyzer_experimental/src/generated/error.dart';
-import 'package:analyzer_experimental/src/generated/source_io.dart';
-import 'package:analyzer_experimental/src/generated/sdk.dart';
-import 'package:analyzer_experimental/src/generated/sdk_io.dart';
-import 'package:analyzer_experimental/src/generated/ast.dart';
-import 'package:analyzer_experimental/src/generated/element.dart';
import 'package:analyzer_experimental/options.dart';
import 'package:analyzer_experimental/src/analyzer_impl.dart';
diff --git a/pkg/analyzer_experimental/lib/src/analyzer_impl.dart b/pkg/analyzer_experimental/lib/src/analyzer_impl.dart
index 4e46d61..40b436c 100644
--- a/pkg/analyzer_experimental/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_experimental/lib/src/analyzer_impl.dart
@@ -4,7 +4,6 @@
library analyzer_impl;
-import 'dart:async';
import 'dart:io';
import 'generated/java_io.dart';
@@ -13,7 +12,6 @@
import 'generated/source_io.dart';
import 'generated/sdk.dart';
import 'generated/sdk_io.dart';
-import 'generated/ast.dart';
import 'generated/element.dart';
import '../options.dart';
diff --git a/pkg/analyzer_experimental/lib/src/error.dart b/pkg/analyzer_experimental/lib/src/error.dart
index d3df0e1..5deee45 100644
--- a/pkg/analyzer_experimental/lib/src/error.dart
+++ b/pkg/analyzer_experimental/lib/src/error.dart
@@ -4,7 +4,6 @@
library error;
import 'dart:collection';
-import 'dart:io';
import 'dart:math' as math;
import 'generated/error.dart';
diff --git a/pkg/analyzer_experimental/lib/src/error_formatter.dart b/pkg/analyzer_experimental/lib/src/error_formatter.dart
index fb4b10f..47d718d 100644
--- a/pkg/analyzer_experimental/lib/src/error_formatter.dart
+++ b/pkg/analyzer_experimental/lib/src/error_formatter.dart
@@ -4,17 +4,9 @@
library error_formatter;
-import 'dart:async';
-import 'dart:io';
-
-import 'generated/java_io.dart';
import 'generated/engine.dart';
import 'generated/error.dart';
import 'generated/source_io.dart';
-import 'generated/sdk.dart';
-import 'generated/sdk_io.dart';
-import 'generated/ast.dart';
-import 'generated/element.dart';
import '../options.dart';
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/ast.dart b/pkg/analyzer_experimental/lib/src/generated/ast.dart
index 42a3cc7..8fc097e 100644
--- a/pkg/analyzer_experimental/lib/src/generated/ast.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/ast.dart
@@ -51,8 +51,11 @@
accept(ASTVisitor visitor);
/**
- * @return the [ASTNode] of given [Class] which is [ASTNode] itself, or one of
- * its parents.
+ * Return the node of the given class that most immediately encloses this node, or `null` if
+ * there is no enclosing node of the given class.
+ *
+ * @param nodeClass the class of the node to be returned
+ * @return the node of the given type that encloses this node
*/
ASTNode getAncestor(Type enclosingClass) {
ASTNode node = this;
@@ -946,7 +949,7 @@
*
* @param parameters the parameter elements corresponding to the arguments
*/
- void set correspondingParameters(List<ParameterElement> parameters) {
+ void set correspondingPropagatedParameters(List<ParameterElement> parameters) {
if (parameters.length != _arguments.length) {
throw new IllegalArgumentException("Expected ${_arguments.length} parameters, not ${parameters.length}");
}
@@ -996,7 +999,7 @@
* element representing the parameter to which the value of the given expression will be bound.
* Otherwise, return `null`.
*
- * This method is only intended to be used by [Expression#getParameterElement].
+ * This method is only intended to be used by [Expression#getPropagatedParameterElement].
*
* @param expression the expression corresponding to the parameter to be returned
* @return the parameter element representing the parameter to which the value of the expression
@@ -1088,9 +1091,9 @@
accept(ASTVisitor visitor) => visitor.visitAsExpression(this);
/**
- * Return the is operator being applied.
+ * Return the as operator being applied.
*
- * @return the is operator being applied
+ * @return the as operator being applied
*/
Token get asOperator => _asOperator;
Token get beginToken => _expression.beginToken;
@@ -1358,14 +1361,20 @@
Token get beginToken => _leftHandSide.beginToken;
/**
- * Return the element associated with the operator based on the propagated type of the
- * left-hand-side, or `null` if the AST structure has not been resolved, if the operator is
- * not a compound operator, or if the operator could not be resolved. One example of the latter
- * case is an operator that is not defined for the type of the left-hand operand.
+ * 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 the operator
+ * @return the best element available for this operator
*/
- MethodElement get element => _propagatedElement;
+ MethodElement get bestElement {
+ MethodElement element = propagatedElement;
+ if (element == null) {
+ element = staticElement;
+ }
+ return element;
+ }
Token get endToken => _rightHandSide.endToken;
/**
@@ -1383,6 +1392,16 @@
Token get operator => _operator;
/**
+ * Return the element associated with the operator based on the propagated type of the
+ * left-hand-side, or `null` if the AST structure has not been resolved, if the operator is
+ * not a compound operator, or if the operator could not be resolved. One example of the latter
+ * case is an operator that is not defined for the type of the left-hand operand.
+ *
+ * @return the element associated with the operator
+ */
+ MethodElement get propagatedElement => _propagatedElement;
+
+ /**
* Return the expression used to compute the right hand side.
*
* @return the expression used to compute the right hand side
@@ -1400,16 +1419,6 @@
MethodElement get staticElement => _staticElement;
/**
- * Set the element associated with the operator based on the propagated type of the left-hand-side
- * to the given element.
- *
- * @param element the element to be associated with the operator
- */
- void set element(MethodElement element2) {
- _propagatedElement = element2;
- }
-
- /**
* Return the expression used to compute the left hand side.
*
* @param expression the expression used to compute the left hand side
@@ -1428,6 +1437,16 @@
}
/**
+ * Set the element associated with the operator based on the propagated type of the left-hand-side
+ * to the given element.
+ *
+ * @param element the element to be associated with the operator
+ */
+ void set propagatedElement(MethodElement element) {
+ _propagatedElement = element;
+ }
+
+ /**
* Set the expression used to compute the left hand side to the given expression.
*
* @param expression the expression used to compute the left hand side
@@ -1449,6 +1468,48 @@
safelyVisitChild(_leftHandSide, visitor);
safelyVisitChild(_rightHandSide, visitor);
}
+
+ /**
+ * If the AST structure has been resolved, and the function being invoked is known based on
+ * propagated type information, then return the parameter element representing the parameter to
+ * which the value of the right operand will be bound. Otherwise, return `null`.
+ *
+ * This method is only intended to be used by [Expression#getPropagatedParameterElement].
+ *
+ * @return the parameter element representing the parameter to which the value of the right
+ * operand will be bound
+ */
+ ParameterElement get propagatedParameterElementForRightHandSide {
+ if (_propagatedElement == null) {
+ return null;
+ }
+ List<ParameterElement> parameters = _propagatedElement.parameters;
+ if (parameters.length < 1) {
+ return null;
+ }
+ return parameters[0];
+ }
+
+ /**
+ * If the AST structure has been resolved, and the function being invoked is known based on static
+ * type information, then return the parameter element representing the parameter to which the
+ * value of the right operand will be bound. Otherwise, return `null`.
+ *
+ * This method is only intended to be used by [Expression#getStaticParameterElement].
+ *
+ * @return the parameter element representing the parameter to which the value of the right
+ * operand will be bound
+ */
+ ParameterElement get staticParameterElementForRightHandSide {
+ if (_staticElement == null) {
+ return null;
+ }
+ List<ParameterElement> parameters = _staticElement.parameters;
+ if (parameters.length < 1) {
+ return null;
+ }
+ return parameters[0];
+ }
}
/**
* Instances of the class `BinaryExpression` represent a binary (infix) expression.
@@ -1516,14 +1577,20 @@
Token get beginToken => _leftOperand.beginToken;
/**
- * Return the element associated with the operator based on the propagated type of the left
- * operand, or `null` if the AST structure has not been resolved, if the operator is not
- * user definable, or if the operator could not be resolved. One example of the latter case is an
- * operator that is not defined for the type of the left-hand operand.
+ * 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 the operator
+ * @return the best element available for this operator
*/
- MethodElement get element => _propagatedElement;
+ MethodElement get bestElement {
+ MethodElement element = propagatedElement;
+ if (element == null) {
+ element = staticElement;
+ }
+ return element;
+ }
Token get endToken => _rightOperand.endToken;
/**
@@ -1541,6 +1608,16 @@
Token get operator => _operator;
/**
+ * Return the element associated with the operator based on the propagated type of the left
+ * operand, or `null` if the AST structure has not been resolved, if the operator is not
+ * user definable, or if the operator could not be resolved. One example of the latter case is an
+ * operator that is not defined for the type of the left-hand operand.
+ *
+ * @return the element associated with the operator
+ */
+ MethodElement get propagatedElement => _propagatedElement;
+
+ /**
* Return the expression used to compute the right operand.
*
* @return the expression used to compute the right operand
@@ -1558,16 +1635,6 @@
MethodElement get staticElement => _staticElement;
/**
- * Set the element associated with the operator based on the propagated type of the left operand
- * to the given element.
- *
- * @param element the element to be associated with the operator
- */
- void set element(MethodElement element2) {
- _propagatedElement = element2;
- }
-
- /**
* Set the expression used to compute the left operand to the given expression.
*
* @param expression the expression used to compute the left operand
@@ -1586,6 +1653,16 @@
}
/**
+ * Set the element associated with the operator based on the propagated type of the left operand
+ * to the given element.
+ *
+ * @param element the element to be associated with the operator
+ */
+ void set propagatedElement(MethodElement element) {
+ _propagatedElement = element;
+ }
+
+ /**
* Set the expression used to compute the right operand to the given expression.
*
* @param expression the expression used to compute the right operand
@@ -1613,7 +1690,7 @@
* propagated type information, then return the parameter element representing the parameter to
* which the value of the right operand will be bound. Otherwise, return `null`.
*
- * This method is only intended to be used by [Expression#getParameterElement].
+ * This method is only intended to be used by [Expression#getPropagatedParameterElement].
*
* @return the parameter element representing the parameter to which the value of the right
* operand will be bound
@@ -2108,12 +2185,14 @@
SimpleIdentifier _exceptionParameter;
/**
- * The comma separating the exception parameter from the stack trace parameter.
+ * The comma separating the exception parameter from the stack trace parameter, or `null` if
+ * there is no stack trace parameter.
*/
Token _comma;
/**
- * The parameter whose value will be the stack trace associated with the exception.
+ * The parameter whose value will be the stack trace associated with the exception, or
+ * `null` if there is no stack trace parameter.
*/
SimpleIdentifier _stackTraceParameter;
@@ -2190,7 +2269,7 @@
Token get catchKeyword => _catchKeyword;
/**
- * Return the comma.
+ * Return the comma, or `null` if there is no stack trace parameter.
*
* @return the comma
*/
@@ -2234,7 +2313,8 @@
Token get rightParenthesis => _rightParenthesis;
/**
- * Return the parameter whose value will be the stack trace associated with the exception.
+ * Return the parameter whose value will be the stack trace associated with the exception, or
+ * `null` if there is no stack trace parameter.
*
* @return the parameter whose value will be the stack trace associated with the exception
*/
@@ -2629,6 +2709,7 @@
safelyVisitChild(_extendsClause, visitor);
safelyVisitChild(_withClause, visitor);
safelyVisitChild(_implementsClause, visitor);
+ safelyVisitChild(_nativeClause, visitor);
members.accept(visitor);
}
Token get firstTokenAfterCommentAndMetadata {
@@ -3077,7 +3158,7 @@
* The enumeration `CommentType` encodes all the different types of comments that are
* recognized by the parser.
*/
-class CommentType implements Comparable<CommentType> {
+class CommentType implements Enum<CommentType> {
/**
* An end-of-line comment.
@@ -3247,7 +3328,7 @@
CompilationUnitElement _element;
/**
- * The [LineInfo] for this [CompilationUnit].
+ * The line information for this compilation unit.
*/
LineInfo _lineInfo;
@@ -3317,11 +3398,10 @@
Token get endToken => _endToken;
/**
- * Return an array containing all of the errors associated with the receiver. If the receiver has
- * not been resolved, then return `null`.
+ * Return an array containing all of the errors associated with the receiver. The array will be
+ * empty if the receiver has not been resolved and there were no parse errors.
*
- * @return an array of errors (contains no `null`s) or `null` if the receiver has not
- * been resolved
+ * @return the errors associated with the receiver
*/
List<AnalysisError> get errors {
List<AnalysisError> parserErrors = parsingErrors;
@@ -3346,9 +3426,9 @@
}
/**
- * Get the [LineInfo] object for this compilation unit.
+ * Return the line information for this compilation unit.
*
- * @return the associated [LineInfo]
+ * @return the line information for this compilation unit
*/
LineInfo get lineInfo => _lineInfo;
int get offset => 0;
@@ -3356,16 +3436,15 @@
/**
* Return an array containing all of the parsing errors associated with the receiver.
*
- * @return an array of errors (not `null`, contains no `null`s).
+ * @return the parsing errors associated with the receiver
*/
List<AnalysisError> get parsingErrors => _parsingErrors;
/**
- * Return an array containing all of the resolution errors associated with the receiver. If the
- * receiver has not been resolved, then return `null`.
+ * Return an array containing all of the resolution errors associated with the receiver. The array
+ * will be empty if the receiver has not been resolved.
*
- * @return an array of errors (contains no `null`s) or `null` if the receiver has not
- * been resolved
+ * @return the resolution errors associated with the receiver
*/
List<AnalysisError> get resolutionErrors => _resolutionErrors;
@@ -3387,29 +3466,27 @@
}
/**
- * Set the [LineInfo] object for this compilation unit.
+ * Set the line information for this compilation unit to the given line information.
*
- * @param errors LineInfo to associate with this compilation unit
+ * @param errors the line information to associate with this compilation unit
*/
void set lineInfo(LineInfo lineInfo2) {
this._lineInfo = lineInfo2;
}
/**
- * Called to cache the parsing errors when the unit is parsed.
+ * Set the parse errors associated with this compilation unit to the given errors.
*
- * @param errors an array of parsing errors, if `null` is passed, the error array is set to
- * an empty array, [AnalysisError#NO_ERRORS]
+ * @param the parse errors to be associated with this compilation unit
*/
void set parsingErrors(List<AnalysisError> errors) {
_parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
}
/**
- * Called to cache the resolution errors when the unit is resolved.
+ * Set the resolution errors associated with this compilation unit to the given errors.
*
- * @param errors an array of resolution errors, if `null` is passed, the error array is set
- * to an empty array, [AnalysisError#NO_ERRORS]
+ * @param the resolution errors to be associated with this compilation unit
*/
void set resolutionErrors(List<AnalysisError> errors) {
_resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
@@ -3721,19 +3798,13 @@
SimpleIdentifier _name;
/**
- * The element associated with this constructor, or `null` if the AST structure has not been
- * resolved or if this constructor could not be resolved.
- */
- ConstructorElement _element;
-
- /**
* The parameters associated with the constructor.
*/
FormalParameterList _parameters;
/**
- * The token for the separator (colon or equals) before the initializers, or `null` if there
- * are no initializers.
+ * The token for the separator (colon or equals) before the initializer list or redirection, or
+ * `null` if there are no initializers.
*/
Token _separator;
@@ -3754,6 +3825,12 @@
FunctionBody _body;
/**
+ * The element associated with this constructor, or `null` if the AST structure has not been
+ * resolved or if this constructor could not be resolved.
+ */
+ ConstructorElement _element;
+
+ /**
* Initialize a newly created constructor declaration.
*
* @param externalKeyword the token for the 'external' keyword
@@ -3893,10 +3970,10 @@
Identifier get returnType => _returnType;
/**
- * Return the token for the separator (colon or equals) before the initializers, or `null`
- * if there are no initializers.
+ * Return the token for the separator (colon or equals) before the initializer list or
+ * redirection, or `null` if there are no initializers.
*
- * @return the token for the separator (colon or equals) before the initializers
+ * @return the token for the separator before the initializer list or redirection
*/
Token get separator => _separator;
@@ -4585,7 +4662,8 @@
SimpleIdentifier get identifier => _identifier;
/**
- * Return the token representing either the 'final', 'const' or 'var' keyword.
+ * Return the token representing either the 'final', 'const' or 'var' keyword, or `null` if
+ * no keyword was used.
*
* @return the token representing either the 'final', 'const' or 'var' keyword
*/
@@ -5328,6 +5406,23 @@
Type2 _propagatedType;
/**
+ * Return the best type information available for this expression. If type propagation was able to
+ * find a better type than static analysis, that type will be returned. Otherwise, the result of
+ * static analysis will be returned. If no type analysis has been performed, then the type
+ * 'dynamic' will be returned.
+ *
+ * @return the best type information available for this expression
+ */
+ Type2 get bestType {
+ if (_propagatedType != null) {
+ return _propagatedType;
+ } else if (_staticType != null) {
+ return _staticType;
+ }
+ return DynamicTypeImpl.instance;
+ }
+
+ /**
* If this expression is an argument to an invocation, and the AST structure has been resolved,
* and the function being invoked is known based on propagated type information, and this
* expression corresponds to one of the parameters of the function being invoked, then return the
@@ -5337,7 +5432,7 @@
* @return the parameter element representing the parameter to which the value of this expression
* will be bound
*/
- ParameterElement get parameterElement {
+ ParameterElement get propagatedParameterElement {
ASTNode parent = this.parent;
if (parent is ArgumentList) {
return ((parent as ArgumentList)).getPropagatedParameterElementFor(this);
@@ -5351,6 +5446,11 @@
if (identical(binaryExpression.rightOperand, this)) {
return binaryExpression.propagatedParameterElementForRightOperand;
}
+ } else if (parent is AssignmentExpression) {
+ AssignmentExpression assignmentExpression = parent as AssignmentExpression;
+ if (identical(assignmentExpression.rightHandSide, this)) {
+ return assignmentExpression.propagatedParameterElementForRightHandSide;
+ }
} else if (parent is PrefixExpression) {
return ((parent as PrefixExpression)).propagatedParameterElementForOperand;
} else if (parent is PostfixExpression) {
@@ -5391,6 +5491,11 @@
if (identical(binaryExpression.rightOperand, this)) {
return binaryExpression.staticParameterElementForRightOperand;
}
+ } else if (parent is AssignmentExpression) {
+ AssignmentExpression assignmentExpression = parent as AssignmentExpression;
+ if (identical(assignmentExpression.rightHandSide, this)) {
+ return assignmentExpression.staticParameterElementForRightHandSide;
+ }
} else if (parent is PrefixExpression) {
return ((parent as PrefixExpression)).staticParameterElementForOperand;
} else if (parent is PostfixExpression) {
@@ -5564,7 +5669,7 @@
/**
* The semicolon terminating the statement, or `null` if the expression is a function
- * expression and isn't followed by a semicolon.
+ * expression and therefore isn't followed by a semicolon.
*/
Token _semicolon;
@@ -5603,7 +5708,8 @@
Expression get expression => _expression;
/**
- * Return the semicolon terminating the statement.
+ * Return the semicolon terminating the statement, or `null` if the expression is a function
+ * expression and therefore isn't followed by a semicolon.
*
* @return the semicolon terminating the statement
*/
@@ -5869,7 +5975,8 @@
Token _period;
/**
- * The parameters of the function-typed parameter.
+ * The parameters of the function-typed parameter, or `null` if this is not a function-typed
+ * field formal parameter.
*/
FormalParameterList _parameters;
@@ -5920,7 +6027,8 @@
Token get endToken => identifier.endToken;
/**
- * Return the token representing either the 'final', 'const' or 'var' keyword.
+ * Return the token representing either the 'final', 'const' or 'var' keyword, or `null` if
+ * no keyword was used.
*
* @return the token representing either the 'final', 'const' or 'var' keyword
*/
@@ -6258,7 +6366,8 @@
Token _leftSeparator;
/**
- * The condition used to determine when to terminate the loop.
+ * The condition used to determine when to terminate the loop, or `null` if there is no
+ * condition.
*/
Expression _condition;
@@ -6336,7 +6445,8 @@
Statement get body => _body;
/**
- * Return the condition used to determine when to terminate the loop.
+ * Return the condition used to determine when to terminate the loop, or `null` if there is
+ * no condition.
*
* @return the condition used to determine when to terminate the loop
*/
@@ -6590,12 +6700,14 @@
NodeList<FormalParameter> _parameters;
/**
- * The left square bracket ('[') or left curly brace ('{') introducing the optional parameters.
+ * The left square bracket ('[') or left curly brace ('{') introducing the optional parameters, or
+ * `null` if there are no optional parameters.
*/
Token _leftDelimiter;
/**
- * The right square bracket (']') or right curly brace ('}') introducing the optional parameters.
+ * The right square bracket (']') or right curly brace ('}') introducing the optional parameters,
+ * or `null` if there are no optional parameters.
*/
Token _rightDelimiter;
@@ -6634,26 +6746,11 @@
FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full(leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis);
accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this);
Token get beginToken => _leftParenthesis;
-
- /**
- * Return an array containing the elements representing the parameters in this list. The array
- * will contain `null`s if the parameters in this list have not been resolved.
- *
- * @return the elements representing the parameters in this list
- */
- List<ParameterElement> get elements {
- int count = _parameters.length;
- List<ParameterElement> types = new List<ParameterElement>(count);
- for (int i = 0; i < count; i++) {
- types[i] = _parameters[i].element;
- }
- return types;
- }
Token get endToken => _rightParenthesis;
/**
* Return the left square bracket ('[') or left curly brace ('{') introducing the optional
- * parameters.
+ * parameters, or `null` if there are no optional parameters.
*
* @return the left square bracket ('[') or left curly brace ('{') introducing the optional
* parameters
@@ -6668,6 +6765,21 @@
Token get leftParenthesis => _leftParenthesis;
/**
+ * Return an array containing the elements representing the parameters in this list. The array
+ * will contain `null`s if the parameters in this list have not been resolved.
+ *
+ * @return the elements representing the parameters in this list
+ */
+ List<ParameterElement> get parameterElements {
+ int count = _parameters.length;
+ List<ParameterElement> types = new List<ParameterElement>(count);
+ for (int i = 0; i < count; i++) {
+ types[i] = _parameters[i].element;
+ }
+ return types;
+ }
+
+ /**
* Return the parameters associated with the method.
*
* @return the parameters associated with the method
@@ -6676,7 +6788,7 @@
/**
* Return the right square bracket (']') or right curly brace ('}') introducing the optional
- * parameters.
+ * parameters, or `null` if there are no optional parameters.
*
* @return the right square bracket (']') or right curly brace ('}') introducing the optional
* parameters
@@ -7174,14 +7286,20 @@
Token get beginToken => _function.beginToken;
/**
- * Return the element associated with the function being invoked based on propagated type
- * information, or `null` if the AST structure has not been resolved or the function could
- * not be resolved. One common example of the latter case is an expression whose value can change
- * over time.
+ * Return the best element available for the function being invoked. 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 the function being invoked
+ * @return the best element available for this function
*/
- ExecutableElement get element => _propagatedElement;
+ ExecutableElement get bestElement {
+ ExecutableElement element = propagatedElement;
+ if (element == null) {
+ element = staticElement;
+ }
+ return element;
+ }
Token get endToken => _argumentList.endToken;
/**
@@ -7192,6 +7310,16 @@
Expression get function => _function;
/**
+ * Return the element associated with the function being invoked based on propagated type
+ * information, or `null` if the AST structure has not been resolved or the function could
+ * not be resolved. One common example of the latter case is an expression whose value can change
+ * over time.
+ *
+ * @return the element associated with the function being invoked
+ */
+ ExecutableElement get propagatedElement => _propagatedElement;
+
+ /**
* Return the element associated with the function being invoked based on static type information,
* or `null` if the AST structure has not been resolved or the function could not be
* resolved. One common example of the latter case is an expression whose value can change over
@@ -7211,16 +7339,6 @@
}
/**
- * Set the element associated with the function being invoked based on propagated type information
- * to the given element.
- *
- * @param element the element to be associated with the function being invoked
- */
- void set element(ExecutableElement element2) {
- _propagatedElement = element2;
- }
-
- /**
* Set the expression producing the function being invoked to the given expression.
*
* @param function the expression producing the function being invoked
@@ -7230,6 +7348,16 @@
}
/**
+ * Set the element associated with the function being invoked based on propagated type information
+ * to the given element.
+ *
+ * @param element the element to be associated with the function being invoked
+ */
+ void set propagatedElement(ExecutableElement element) {
+ _propagatedElement = element;
+ }
+
+ /**
* Set the element associated with the function being invoked based on static type information to
* the given element.
*
@@ -7625,7 +7753,7 @@
Statement _thenStatement;
/**
- * The token representing the 'else' keyword.
+ * The token representing the 'else' keyword, or `null` if there is no else statement.
*/
Token _elseKeyword;
@@ -7679,7 +7807,8 @@
Expression get condition => _condition;
/**
- * Return the token representing the 'else' keyword.
+ * Return the token representing the 'else' keyword, or `null` if there is no else
+ * statement.
*
* @return the token representing the 'else' keyword
*/
@@ -8074,15 +8203,6 @@
*/
IndexExpression.forCascade({Token period, Token leftBracket, Expression index, Token rightBracket}) : this.forCascade_full(period, leftBracket, index, rightBracket);
accept(ASTVisitor visitor) => visitor.visitIndexExpression(this);
-
- /**
- * Return the expression used to compute the object being indexed, or `null` if this index
- * expression is part of a cascade expression.
- *
- * @return the expression used to compute the object being indexed
- * @see #getRealTarget()
- */
- Expression get array => _target;
Token get beginToken {
if (_target != null) {
return _target.beginToken;
@@ -8091,14 +8211,20 @@
}
/**
- * Return the element associated with the operator based on the propagated type of the target, or
- * `null` if the AST structure has not been resolved or if the operator could not be
- * resolved. One example of the latter case is an operator that is not defined for the type of the
- * target.
+ * 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 operator
+ * @return the best element available for this operator
*/
- MethodElement get element => _propagatedElement;
+ MethodElement get bestElement {
+ MethodElement element = propagatedElement;
+ if (element == null) {
+ element = staticElement;
+ }
+ return element;
+ }
Token get endToken => _rightBracket;
/**
@@ -8124,13 +8250,23 @@
Token get period => _period;
/**
+ * Return the element associated with the operator based on the propagated type of the target, or
+ * `null` if the AST structure has not been resolved or if the operator could not be
+ * resolved. One example of the latter case is an operator that is not defined for the type of the
+ * target.
+ *
+ * @return the element associated with this operator
+ */
+ MethodElement get propagatedElement => _propagatedElement;
+
+ /**
* Return the expression used to compute the object being indexed. If this index expression is not
- * part of a cascade expression, then this is the same as [getArray]. If this index
+ * part of a cascade expression, then this is the same as [getTarget]. If this index
* expression is part of a cascade expression, then the target expression stored with the cascade
* expression is returned.
*
* @return the expression used to compute the object being indexed
- * @see #getArray()
+ * @see #getTarget()
*/
Expression get realTarget {
if (isCascaded) {
@@ -8164,6 +8300,15 @@
MethodElement get staticElement => _staticElement;
/**
+ * Return the expression used to compute the object being indexed, or `null` if this index
+ * expression is part of a cascade expression.
+ *
+ * @return the expression used to compute the object being indexed
+ * @see #getRealTarget()
+ */
+ Expression get target => _target;
+
+ /**
* Return `true` if this expression is computing a right-hand value.
*
* Note that [inGetterContext] and [inSetterContext] are not opposites, nor are
@@ -8216,25 +8361,6 @@
bool get isCascaded => _period != null;
/**
- * Set the expression used to compute the object being indexed to the given expression.
- *
- * @param expression the expression used to compute the object being indexed
- */
- void set array(Expression expression) {
- _target = becomeParentOf(expression);
- }
-
- /**
- * Set the element associated with the operator based on the propagated type of the target to the
- * given element.
- *
- * @param element the element to be associated with this operator
- */
- void set element(MethodElement element2) {
- _propagatedElement = element2;
- }
-
- /**
* Set the expression used to compute the index to the given expression.
*
* @param expression the expression used to compute the index
@@ -8262,6 +8388,16 @@
}
/**
+ * Set the element associated with the operator based on the propagated type of the target to the
+ * given element.
+ *
+ * @param element the element to be associated with this operator
+ */
+ void set propagatedElement(MethodElement element) {
+ _propagatedElement = element;
+ }
+
+ /**
* Set the right square bracket to the given token.
*
* @param bracket the right square bracket
@@ -8279,6 +8415,15 @@
void set staticElement(MethodElement element) {
_staticElement = element;
}
+
+ /**
+ * Set the expression used to compute the object being indexed to the given expression.
+ *
+ * @param expression the expression used to compute the object being indexed
+ */
+ void set target(Expression expression) {
+ _target = becomeParentOf(expression);
+ }
void visitChildren(ASTVisitor<Object> visitor) {
safelyVisitChild(_target, visitor);
safelyVisitChild(_index, visitor);
@@ -8289,7 +8434,7 @@
* propagated type information, then return the parameter element representing the parameter to
* which the value of the index expression will be bound. Otherwise, return `null`.
*
- * This method is only intended to be used by [Expression#getParameterElement].
+ * This method is only intended to be used by [Expression#getPropagatedParameterElement].
*
* @return the parameter element representing the parameter to which the value of the index
* expression will be bound
@@ -10313,7 +10458,9 @@
Token get keyword => _keyword;
/**
- * @return the name of the native object that implements the class.
+ * Return the name of the native object that implements the class.
+ *
+ * @return the name of the native object that implements the class
*/
StringLiteral get name => _name;
@@ -10983,14 +11130,20 @@
Token get beginToken => _operand.beginToken;
/**
- * Return the element associated with the operator based on the propagated type of the operand, or
- * `null` if the AST structure has not been resolved, if the operator is not user definable,
- * or if the operator could not be resolved. One example of the latter case is an operator that is
- * not defined for the type of the operand.
+ * 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 the operator
+ * @return the best element available for this operator
*/
- MethodElement get element => _propagatedElement;
+ MethodElement get bestElement {
+ MethodElement element = propagatedElement;
+ if (element == null) {
+ element = staticElement;
+ }
+ return element;
+ }
Token get endToken => _operator;
/**
@@ -11008,6 +11161,16 @@
Token get operator => _operator;
/**
+ * Return the element associated with the operator based on the propagated type of the operand, or
+ * `null` if the AST structure has not been resolved, if the operator is not user definable,
+ * or if the operator could not be resolved. One example of the latter case is an operator that is
+ * not defined for the type of the operand.
+ *
+ * @return the element associated with the operator
+ */
+ MethodElement get propagatedElement => _propagatedElement;
+
+ /**
* Return the element associated with the operator based on the static type of the operand, or
* `null` if the AST structure has not been resolved, if the operator is not user definable,
* or if the operator could not be resolved. One example of the latter case is an operator that is
@@ -11018,16 +11181,6 @@
MethodElement get staticElement => _staticElement;
/**
- * Set the element associated with the operator based on the propagated type of the operand to the
- * given element.
- *
- * @param element the element to be associated with the operator
- */
- void set element(MethodElement element2) {
- _propagatedElement = element2;
- }
-
- /**
* Set the expression computing the operand for the operator to the given expression.
*
* @param expression the expression computing the operand for the operator
@@ -11046,6 +11199,16 @@
}
/**
+ * Set the element associated with the operator based on the propagated type of the operand to the
+ * given element.
+ *
+ * @param element the element to be associated with the operator
+ */
+ void set propagatedElement(MethodElement element) {
+ _propagatedElement = element;
+ }
+
+ /**
* Set the element associated with the operator based on the static type of the operand to the
* given element.
*
@@ -11063,7 +11226,7 @@
* propagated type information, then return the parameter element representing the parameter to
* which the value of the operand will be bound. Otherwise, return `null`.
*
- * This method is only intended to be used by [Expression#getParameterElement].
+ * This method is only intended to be used by [Expression#getPropagatedParameterElement].
*
* @return the parameter element representing the parameter to which the value of the right
* operand will be bound
@@ -11158,14 +11321,20 @@
Token get beginToken => _operator;
/**
- * Return the element associated with the operator based on the propagated type of the operand, or
- * `null` if the AST structure has not been resolved, if the operator is not user definable,
- * or if the operator could not be resolved. One example of the latter case is an operator that is
- * not defined for the type of the operand.
+ * 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 the operator
+ * @return the best element available for this operator
*/
- MethodElement get element => _propagatedElement;
+ MethodElement get bestElement {
+ MethodElement element = propagatedElement;
+ if (element == null) {
+ element = staticElement;
+ }
+ return element;
+ }
Token get endToken => _operand.endToken;
/**
@@ -11183,6 +11352,16 @@
Token get operator => _operator;
/**
+ * Return the element associated with the operator based on the propagated type of the operand, or
+ * `null` if the AST structure has not been resolved, if the operator is not user definable,
+ * or if the operator could not be resolved. One example of the latter case is an operator that is
+ * not defined for the type of the operand.
+ *
+ * @return the element associated with the operator
+ */
+ MethodElement get propagatedElement => _propagatedElement;
+
+ /**
* Return the element associated with the operator based on the static type of the operand, or
* `null` if the AST structure has not been resolved, if the operator is not user definable,
* or if the operator could not be resolved. One example of the latter case is an operator that is
@@ -11193,16 +11372,6 @@
MethodElement get staticElement => _staticElement;
/**
- * Set the element associated with the operator based on the propagated type of the operand to the
- * given element.
- *
- * @param element the element to be associated with the operator
- */
- void set element(MethodElement element2) {
- _propagatedElement = element2;
- }
-
- /**
* Set the expression computing the operand for the operator to the given expression.
*
* @param expression the expression computing the operand for the operator
@@ -11221,6 +11390,16 @@
}
/**
+ * Set the element associated with the operator based on the propagated type of the operand to the
+ * given element.
+ *
+ * @param element the element to be associated with the operator
+ */
+ void set propagatedElement(MethodElement element) {
+ _propagatedElement = element;
+ }
+
+ /**
* Set the element associated with the operator based on the static type of the operand to the
* given element.
*
@@ -11238,7 +11417,7 @@
* propagated type information, then return the parameter element representing the parameter to
* which the value of the operand will be bound. Otherwise, return `null`.
*
- * This method is only intended to be used by [Expression#getParameterElement].
+ * This method is only intended to be used by [Expression#getPropagatedParameterElement].
*
* @return the parameter element representing the parameter to which the value of the right
* operand will be bound
@@ -13191,7 +13370,7 @@
*
* <pre>
* symbolLiteral ::=
- * '#' [SimpleIdentifier] ('.' [SimpleIdentifier])*
+ * '#' (operator | (identifier ('.' identifier)*))
* </pre>
*
* @coverage dart.engine.ast
@@ -13206,7 +13385,7 @@
/**
* The components of the literal.
*/
- NodeList<SimpleIdentifier> _components;
+ List<Token> _components;
/**
* Initialize a newly created symbol literal.
@@ -13214,10 +13393,9 @@
* @param poundSign the token introducing the literal
* @param components the components of the literal
*/
- SymbolLiteral.full(Token poundSign, List<SimpleIdentifier> components) {
- this._components = new NodeList<SimpleIdentifier>(this);
+ SymbolLiteral.full(Token poundSign, List<Token> components) {
this._poundSign = poundSign;
- this._components.addAll(components);
+ this._components = components;
}
/**
@@ -13226,7 +13404,7 @@
* @param poundSign the token introducing the literal
* @param components the components of the literal
*/
- SymbolLiteral({Token poundSign, List<SimpleIdentifier> components}) : this.full(poundSign, components);
+ SymbolLiteral({Token poundSign, List<Token> components}) : this.full(poundSign, components);
accept(ASTVisitor visitor) => visitor.visitSymbolLiteral(this);
Token get beginToken => _poundSign;
@@ -13235,8 +13413,8 @@
*
* @return the components of the literal
*/
- NodeList<SimpleIdentifier> get components => _components;
- Token get endToken => _components.endToken;
+ List<Token> get components => _components;
+ Token get endToken => _components[_components.length - 1];
/**
* Return the token introducing the literal.
@@ -13254,7 +13432,6 @@
this._poundSign = poundSign2;
}
void visitChildren(ASTVisitor<Object> visitor) {
- _components.accept(visitor);
}
}
/**
@@ -14004,9 +14181,10 @@
}
/**
- * Return the token representing the 'assert' keyword.
+ * Return the token representing the 'extends' keyword, or `null` if there was no explicit
+ * upper bound.
*
- * @return the token representing the 'assert' keyword
+ * @return the token representing the 'extends' keyword
*/
Token get keyword => _keyword;
@@ -14027,9 +14205,9 @@
}
/**
- * Set the token representing the 'assert' keyword to the given token.
+ * Set the token representing the 'extends' keyword to the given token.
*
- * @param keyword the token representing the 'assert' keyword
+ * @param keyword the token representing the 'extends' keyword
*/
void set keyword(Token keyword2) {
this._keyword = keyword2;
@@ -14881,16 +15059,35 @@
* visitor uses a breadth-first ordering rather than the depth-first ordering of
* [GeneralizingASTVisitor].
*
+ * Subclasses that override a visit method must either invoke the overridden visit method or
+ * explicitly invoke the more general visit method. Failure to do so will cause the visit methods
+ * for superclasses of the node to not be invoked and will cause the children of the visited node to
+ * not be visited.
+ *
+ * In addition, subclasses should <b>not</b> explicitly visit the children of a node, but should
+ * ensure that the method [visitNode] is used to visit the children (either directly
+ * or indirectly). Failure to do will break the order in which nodes are visited.
+ *
* @coverage dart.engine.ast
*/
class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> {
+
+ /**
+ * A queue holding the nodes that have not yet been visited in the order in which they ought to be
+ * visited.
+ */
Queue<ASTNode> _queue = new Queue<ASTNode>();
+
+ /**
+ * A visitor, used to visit the children of the current node, that will add the nodes it visits to
+ * the [queue].
+ */
GeneralizingASTVisitor<Object> _childVisitor;
/**
- * Visit all nodes in the tree starting at the given `root` node, in depth-first order.
+ * Visit all nodes in the tree starting at the given `root` node, in breadth-first order.
*
- * @param root the root of the ASTNode tree
+ * @param root the root of the AST structure to be visited
*/
void visitAllNodes(ASTNode root) {
_queue.add(root);
@@ -15189,11 +15386,11 @@
}
Object visitSymbolLiteral(SymbolLiteral node) {
JavaStringBuilder builder = new JavaStringBuilder();
- for (SimpleIdentifier component in node.components) {
+ for (Token component in node.components) {
if (builder.length > 0) {
builder.appendChar(0x2E);
}
- builder.append(component.name);
+ builder.append(component.lexeme);
}
return builder.toString();
}
@@ -15236,7 +15433,8 @@
* Visitor that maps nodes to elements.
*/
class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> {
- Element visitBinaryExpression(BinaryExpression node) => node.element;
+ Element visitAssignmentExpression(AssignmentExpression node) => node.bestElement;
+ Element visitBinaryExpression(BinaryExpression node) => node.bestElement;
Element visitClassDeclaration(ClassDeclaration node) => node.element;
Element visitCompilationUnit(CompilationUnit node) => node.element;
Element visitConstructorDeclaration(ConstructorDeclaration node) => node.element;
@@ -15266,17 +15464,21 @@
}
}
}
- return node.element;
+ Element element = node.element;
+ if (element == null) {
+ element = node.staticElement;
+ }
+ return element;
}
Element visitImportDirective(ImportDirective node) => node.element;
- Element visitIndexExpression(IndexExpression node) => node.element;
+ Element visitIndexExpression(IndexExpression node) => node.bestElement;
Element visitInstanceCreationExpression(InstanceCreationExpression node) => node.element;
Element visitLibraryDirective(LibraryDirective node) => node.element;
Element visitMethodDeclaration(MethodDeclaration node) => node.element;
Element visitMethodInvocation(MethodInvocation node) => node.methodName.element;
- Element visitPostfixExpression(PostfixExpression node) => node.element;
+ Element visitPostfixExpression(PostfixExpression node) => node.bestElement;
Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element;
- Element visitPrefixExpression(PrefixExpression node) => node.element;
+ Element visitPrefixExpression(PrefixExpression node) => node.bestElement;
Element visitStringLiteral(StringLiteral node) {
ASTNode parent = node.parent;
if (parent is UriBasedDirective) {
@@ -16461,7 +16663,7 @@
if (node.isCascaded) {
_writer.print("..");
} else {
- visit(node.array);
+ visit(node.target);
}
_writer.print('[');
visit(node.index);
@@ -16720,7 +16922,13 @@
}
Object visitSymbolLiteral(SymbolLiteral node) {
_writer.print("#");
- visitList2(node.components, ".");
+ List<Token> components = node.components;
+ for (int i = 0; i < components.length; i++) {
+ if (i > 0) {
+ _writer.print(".");
+ }
+ _writer.print(components[i].lexeme);
+ }
return null;
}
Object visitThisExpression(ThisExpression node) {
@@ -17004,7 +17212,7 @@
IndexExpression visitIndexExpression(IndexExpression node) {
Token period = node.period;
if (period == null) {
- return new IndexExpression.forTarget_full(clone2(node.array), node.leftBracket, clone2(node.index), node.rightBracket);
+ return new IndexExpression.forTarget_full(clone2(node.target), node.leftBracket, clone2(node.index), node.rightBracket);
} else {
return new IndexExpression.forCascade_full(period, node.leftBracket, clone2(node.index), node.rightBracket);
}
@@ -17048,7 +17256,7 @@
SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase.full(clone3(node.labels), node.keyword, clone2(node.expression), node.colon, clone3(node.statements));
SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault.full(clone3(node.labels), node.keyword, node.colon, clone3(node.statements));
SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatement.full(node.keyword, node.leftParenthesis, clone2(node.expression), node.rightParenthesis, node.leftBracket, clone3(node.members), node.rightBracket);
- ASTNode visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral.full(node.poundSign, clone3(node.components));
+ ASTNode visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral.full(node.poundSign, node.components);
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);
@@ -17057,8 +17265,8 @@
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));
TypeParameterList visitTypeParameterList(TypeParameterList node) => new TypeParameterList.full(node.leftBracket, clone3(node.typeParameters), node.rightBracket);
- VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration.full(clone2(node.documentationComment), clone3(node.metadata), clone2(node.name), node.equals, clone2(node.initializer));
- VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList node) => new VariableDeclarationList.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.type), clone3(node.variables));
+ VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration.full(null, clone3(node.metadata), clone2(node.name), node.equals, clone2(node.initializer));
+ VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList node) => new VariableDeclarationList.full(null, clone3(node.metadata), node.keyword, clone2(node.type), clone3(node.variables));
VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclarationStatement node) => new VariableDeclarationStatement.full(clone2(node.variables), node.semicolon);
WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement.full(node.keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, clone2(node.body));
WithClause visitWithClause(WithClause node) => new WithClause.full(node.withKeyword, clone3(node.mixinTypes));
diff --git a/pkg/analyzer_experimental/lib/src/generated/element.dart b/pkg/analyzer_experimental/lib/src/generated/element.dart
index 6effbfe..5df3e1e 100644
--- a/pkg/analyzer_experimental/lib/src/generated/element.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/element.dart
@@ -4,6 +4,7 @@
import 'dart:collection';
import 'java_core.dart';
import 'java_engine.dart';
+import 'utilities_collection.dart';
import 'source.dart';
import 'scanner.dart' show Keyword;
import 'ast.dart' show Identifier, LibraryIdentifier;
@@ -561,7 +562,7 @@
*
* @coverage dart.engine.element
*/
-class ElementKind implements Comparable<ElementKind> {
+class ElementKind implements 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");
@@ -1167,6 +1168,13 @@
* @return the elements that were defined with the same name
*/
List<Element> get conflictingElements;
+
+ /**
+ * Return the type of this element as the dynamic type.
+ *
+ * @return the type of this element as the dynamic type
+ */
+ Type2 get type;
}
/**
* The interface `NamespaceCombinator` defines the behavior common to objects that control how
@@ -2668,7 +2676,7 @@
/**
* A bit-encoded form of the modifiers associated with this element.
*/
- Set<Modifier> _modifiers;
+ int _modifiers = 0;
/**
* An array containing all of the metadata associated with this element.
@@ -2820,7 +2828,7 @@
* @param modifier the modifier being tested for
* @return `true` if this element has the given modifier associated with it
*/
- bool hasModifier(Modifier modifier) => _modifiers != null && _modifiers.contains(modifier);
+ bool hasModifier(Modifier modifier) => BooleanArray.get(_modifiers, modifier);
/**
* If the given child is not `null`, use the given visitor to visit it.
@@ -2865,19 +2873,7 @@
* @param value `true` if the modifier is to be associated with this element
*/
void setModifier(Modifier modifier, bool value) {
- if (value) {
- if (_modifiers == null) {
- _modifiers = new Set();
- }
- _modifiers.add(modifier);
- } else {
- if (_modifiers != null) {
- _modifiers.remove(modifier);
- if (_modifiers.isEmpty) {
- _modifiers = null;
- }
- }
- }
+ _modifiers = BooleanArray.set(_modifiers, modifier, value);
}
}
/**
@@ -2961,7 +2957,20 @@
}
return builder.toString();
}
- int get hashCode => JavaArrays.makeHashCode(_components);
+ int get hashCode {
+ int result = 1;
+ for (int i = 0; i < _components.length; i++) {
+ String component = _components[i];
+ int componentHash;
+ if (i <= 1) {
+ componentHash = hashSourceComponent(component);
+ } else {
+ componentHash = component.hashCode;
+ }
+ result = 31 * result + componentHash;
+ }
+ return result;
+ }
String toString() => encoding;
/**
@@ -3033,6 +3042,19 @@
}
return left.substring(1) == right.substring(1);
}
+
+ /**
+ * Return the hash code of the given encoded source component, ignoring the source type indicator.
+ *
+ * @param sourceComponent the component to compute a hash code
+ * @return the hash code of the given encoded source component
+ */
+ int hashSourceComponent(String sourceComponent) {
+ if (sourceComponent.length <= 1) {
+ return sourceComponent.hashCode;
+ }
+ return sourceComponent.substring(1).hashCode;
+ }
}
/**
* Instances of the class `EmbeddedHtmlScriptElementImpl` implement an
@@ -3597,6 +3619,28 @@
}
this._typeVariables = typeVariables2;
}
+
+ /**
+ * Set the parameters defined by this type alias to the given parameters without becoming the
+ * parent of the parameters. This should only be used by the [TypeResolverVisitor] when
+ * creating a synthetic type alias.
+ *
+ * @param parameters the parameters defined by this type alias
+ */
+ void shareParameters(List<ParameterElement> parameters2) {
+ this._parameters = parameters2;
+ }
+
+ /**
+ * Set the type variables defined for this type to the given variables without becoming the parent
+ * of the variables. This should only be used by the [TypeResolverVisitor] when creating a
+ * synthetic type alias.
+ *
+ * @param typeVariables the type variables defined for this type
+ */
+ void shareTypeVariables(List<TypeVariableElement> typeVariables2) {
+ this._typeVariables = typeVariables2;
+ }
void visitChildren(ElementVisitor<Object> visitor) {
super.visitChildren(visitor);
safelyVisitChildren(_parameters, visitor);
@@ -4313,7 +4357,7 @@
*
* @coverage dart.engine.element
*/
-class Modifier implements Comparable<Modifier> {
+class Modifier implements 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);
@@ -4396,6 +4440,7 @@
String get name => _name;
int get nameOffset => -1;
Source get source => null;
+ Type2 get type => DynamicTypeImpl.instance;
bool isAccessibleIn(LibraryElement library) {
for (Element element in _conflictingElements) {
if (element.isAccessibleIn(library)) {
@@ -5081,6 +5126,9 @@
return baseConstructor;
}
FunctionType baseType = baseConstructor.type;
+ if (baseType == null) {
+ return baseConstructor;
+ }
List<Type2> argumentTypes = definingType.typeArguments;
List<Type2> parameterTypes = definingType.element.type.typeArguments;
FunctionType substitutedType = baseType.substitute2(argumentTypes, parameterTypes);
diff --git a/pkg/analyzer_experimental/lib/src/generated/engine.dart b/pkg/analyzer_experimental/lib/src/generated/engine.dart
index d1658b1..1570f8c 100644
--- a/pkg/analyzer_experimental/lib/src/generated/engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/engine.dart
@@ -1,9 +1,9 @@
// 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;
-import 'dart:collection' show HasNextIterator;
import 'java_core.dart';
import 'java_engine.dart';
+import 'utilities_collection.dart';
import 'instrumentation.dart';
import 'error.dart';
import 'source.dart';
@@ -113,6 +113,27 @@
}
}
/**
+ * Container with statistics about the [AnalysisContext].
+ */
+abstract class AnalysisContentStatistics {
+
+ /**
+ * @return the statistics for each kind of cached data.
+ */
+ List<AnalysisContentStatistics_CacheRow> get cacheRows;
+}
+/**
+ * Information about single item in the cache.
+ */
+abstract class AnalysisContentStatistics_CacheRow {
+ int get errorCount;
+ int get flushedCount;
+ int get inProcessCount;
+ int get invalidCount;
+ String get name;
+ int get validCount;
+}
+/**
* The interface `AnalysisContext` defines the behavior of objects that represent a context in
* which a single analysis can be performed and incrementally maintained. The context includes such
* information as the version of the SDK being analyzed against as well as the package-root used to
@@ -945,15 +966,15 @@
List<AnalysisError> _parseErrors = AnalysisError.NO_ERRORS;
/**
- * The state of the cached list of included parts.
+ * The state of the cached list of imported libraries.
*/
- CacheState _includedPartsState = CacheState.INVALID;
+ CacheState _importedLibrariesState = CacheState.INVALID;
/**
- * The list of parts included in the library, or an empty array if the list is not currently
+ * The list of libraries imported by the library, or an empty array if the list is not currently
* cached. The list will be empty if the Dart file is a part rather than a library.
*/
- List<Source> _includedParts = Source.EMPTY_ARRAY;
+ List<Source> _importedLibraries = Source.EMPTY_ARRAY;
/**
* The state of the cached list of exported libraries.
@@ -967,15 +988,15 @@
List<Source> _exportedLibraries = Source.EMPTY_ARRAY;
/**
- * The state of the cached list of imported libraries.
+ * The state of the cached list of included parts.
*/
- CacheState _importedLibrariesState = CacheState.INVALID;
+ CacheState _includedPartsState = CacheState.INVALID;
/**
- * The list of libraries imported by the library, or an empty array if the list is not currently
+ * The list of parts included in the library, or an empty array if the list is not currently
* cached. The list will be empty if the Dart file is a part rather than a library.
*/
- List<Source> _importedLibraries = Source.EMPTY_ARRAY;
+ List<Source> _includedParts = Source.EMPTY_ARRAY;
/**
* The information known as a result of resolving this compilation unit as part of the library
@@ -1472,6 +1493,31 @@
_launchableState = other._launchableState;
_bitmask = other._bitmask;
}
+ void writeOn(JavaStringBuilder builder) {
+ builder.append("Dart: ");
+ super.writeOn(builder);
+ builder.append("; sourceKind = ");
+ builder.append(_sourceKindState);
+ builder.append("; parsedUnit = ");
+ builder.append(_parsedUnitState);
+ builder.append("; parseErrors = ");
+ builder.append(_parseErrorsState);
+ builder.append("; exportedLibraries = ");
+ builder.append(_exportedLibrariesState);
+ builder.append("; importedLibraries = ");
+ builder.append(_importedLibrariesState);
+ builder.append("; includedParts = ");
+ builder.append(_includedPartsState);
+ builder.append("; element = ");
+ builder.append(_elementState);
+ builder.append("; publicNamespace = ");
+ builder.append(_publicNamespaceState);
+ builder.append("; clientServer = ");
+ builder.append(_clientServerState);
+ builder.append("; launchable = ");
+ builder.append(_launchableState);
+ _resolutionState.writeOn(builder);
+ }
/**
* Return a resolution state for the specified library, creating one as necessary.
@@ -1615,6 +1661,26 @@
_hintsState = CacheState.ERROR;
_hints = AnalysisError.NO_ERRORS;
}
+
+ /**
+ * Write a textual representation of this state to the given builder. The result will only be
+ * used for debugging purposes.
+ *
+ * @param builder the builder to which the text should be written
+ */
+ void writeOn(JavaStringBuilder builder) {
+ if (_librarySource != null) {
+ builder.append("; resolvedUnit = ");
+ builder.append(_resolvedUnitState);
+ builder.append("; resolutionErrors = ");
+ builder.append(_resolutionErrorsState);
+ builder.append("; hints = ");
+ builder.append(_hintsState);
+ if (_nextState != null) {
+ _nextState.writeOn(builder);
+ }
+ }
+ }
}
/**
* Instances of the class `DataDescriptor` are immutable constants representing data that can
@@ -1850,6 +1916,18 @@
_hints = other._hints;
_hintsState = other._hintsState;
}
+ void writeOn(JavaStringBuilder builder) {
+ builder.append("Html: ");
+ super.writeOn(builder);
+ builder.append("; parsedUnit = ");
+ builder.append(_parsedUnitState);
+ builder.append("; resolutionErrors = ");
+ builder.append(_resolutionErrorsState);
+ builder.append("; referencedLibraries = ");
+ builder.append(_referencedLibrariesState);
+ builder.append("; element = ");
+ builder.append(_elementState);
+ }
}
/**
* The interface `SourceEntry` defines the behavior of objects that maintain the information
@@ -1986,6 +2064,11 @@
throw new IllegalArgumentException("Invalid descriptor: ${descriptor}");
}
}
+ String toString() {
+ JavaStringBuilder builder = new JavaStringBuilder();
+ writeOn(builder);
+ return builder.toString();
+ }
/**
* Copy the information from the given cache entry.
@@ -2015,6 +2098,74 @@
}
return defaultValue;
}
+
+ /**
+ * Write a textual representation of this entry to the given builder. The result will only be used
+ * for debugging purposes.
+ *
+ * @param builder the builder to which the text should be written
+ */
+ void writeOn(JavaStringBuilder builder) {
+ builder.append("time = ");
+ builder.append(_modificationTime.toRadixString(16));
+ builder.append("; lineInfo = ");
+ builder.append(_lineInfoState);
+ }
+}
+/**
+ * Implementation of the [AnalysisContentStatistics].
+ */
+class AnalysisContentStatisticsImpl implements AnalysisContentStatistics {
+ Map<String, AnalysisContentStatistics_CacheRow> _dataMap = new Map<String, AnalysisContentStatistics_CacheRow>();
+ List<AnalysisContentStatistics_CacheRow> get cacheRows {
+ Iterable<AnalysisContentStatistics_CacheRow> items = _dataMap.values;
+ return new List.from(items);
+ }
+ void putCacheItem(DataDescriptor<Object> rowDesc, CacheState state) {
+ String rowName = rowDesc.toString();
+ AnalysisContentStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as AnalysisContentStatisticsImpl_CacheRowImpl;
+ if (row == null) {
+ row = new AnalysisContentStatisticsImpl_CacheRowImpl(rowName);
+ _dataMap[rowName] = row;
+ }
+ row.incState(state);
+ }
+}
+class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStatistics_CacheRow {
+ String _name;
+ int _errorCount = 0;
+ int _flushedCount = 0;
+ int _inProcessCount = 0;
+ int _invalidCount = 0;
+ int _validCount = 0;
+ AnalysisContentStatisticsImpl_CacheRowImpl(String name) {
+ this._name = name;
+ }
+ bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowImpl && ((obj as AnalysisContentStatisticsImpl_CacheRowImpl))._name == _name;
+ int get errorCount => _errorCount;
+ int get flushedCount => _flushedCount;
+ int get inProcessCount => _inProcessCount;
+ int get invalidCount => _invalidCount;
+ String get name => _name;
+ int get validCount => _validCount;
+ int get hashCode => _name.hashCode;
+ void incState(CacheState state) {
+ if (identical(state, CacheState.ERROR)) {
+ _errorCount++;
+ }
+ if (identical(state, CacheState.FLUSHED)) {
+ _flushedCount++;
+ }
+ if (identical(state, CacheState.IN_PROCESS)) {
+ _inProcessCount++;
+ }
+ if (identical(state, CacheState.INVALID)) {
+ _invalidCount++;
+ }
+ if (identical(state, CacheState.VALID)) {
+ _validCount++;
+ }
+ }
}
/**
* Instances of the class `AnalysisContextImpl` implement an [AnalysisContext].
@@ -2024,6 +2175,22 @@
class AnalysisContextImpl implements InternalAnalysisContext {
/**
+ * 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) {
+ statistics.putCacheItem(key, dartEntry.getState2(key, librarySource));
+ }
+
+ /**
+ * Helper for [getStatistics], puts the library independent state into the given
+ * statistics object.
+ */
+ static void putStatCacheItem2(AnalysisContentStatisticsImpl statistics, SourceEntry entry, DataDescriptor<Object> key) {
+ statistics.putCacheItem(key, entry.getState(key));
+ }
+
+ /**
* The set of analysis options controlling the behavior of this context.
*/
AnalysisOptions _options = new AnalysisOptionsImpl();
@@ -2074,6 +2241,14 @@
static int _MAX_CACHE_SIZE = 64;
/**
+ * The maximum number of sources that can be on the priority list. This <b>must</b> be less than
+ * the [MAX_CACHE_SIZE] in order to prevent an infinite loop in performAnalysisTask().
+ *
+ * @see #setAnalysisPriorityOrder(List)
+ */
+ static int _MAX_PRIORITY_LIST_SIZE = _MAX_CACHE_SIZE - 4;
+
+ /**
* The name of the 'src' attribute in a HTML tag.
*/
static String _ATTRIBUTE_SRC = "src";
@@ -2149,8 +2324,12 @@
return null;
}
JavaStringBuilder builder = new JavaStringBuilder();
- for (Token token in comment.tokens) {
- builder.append(token.lexeme);
+ List<Token> tokens = comment.tokens;
+ for (int i = 0; i < tokens.length; i++) {
+ if (i > 0) {
+ builder.append('\n');
+ }
+ builder.append(tokens[i].lexeme);
}
return builder.toString();
}
@@ -2159,116 +2338,49 @@
return null;
}
List<AnalysisError> computeErrors(Source source) {
- {
- SourceEntry sourceEntry = getSourceEntry(source);
- if (sourceEntry is DartEntry) {
- DartEntry dartEntry = sourceEntry as DartEntry;
- CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS);
- if (parseErrorsState != CacheState.VALID && parseErrorsState != CacheState.ERROR) {
- parseCompilationUnit(source);
- dartEntry = getSourceEntry(source) as DartEntry;
- }
+ SourceEntry sourceEntry = getReadableSourceEntry(source);
+ if (sourceEntry is DartEntry) {
+ List<AnalysisError> errors = new List<AnalysisError>();
+ DartEntry dartEntry = sourceEntry as DartEntry;
+ ListUtilities.addAll(errors, internalGetDartParseData(source, dartEntry, DartEntry.PARSE_ERRORS));
+ if (identical(dartEntry.getValue(DartEntry.SOURCE_KIND), SourceKind.LIBRARY)) {
+ ListUtilities.addAll(errors, internalGetDartResolutionData(source, source, dartEntry, DartEntry.RESOLUTION_ERRORS));
+ } else {
List<Source> libraries = getLibrariesContaining(source);
for (Source librarySource in libraries) {
- CacheState resolutionErrorsState = dartEntry.getState2(DartEntry.RESOLUTION_ERRORS, librarySource);
- if (resolutionErrorsState != CacheState.VALID && resolutionErrorsState != CacheState.ERROR) {
- }
+ ListUtilities.addAll(errors, internalGetDartResolutionData(source, librarySource, dartEntry, DartEntry.RESOLUTION_ERRORS));
}
- return dartEntry.allErrors;
- } else if (sourceEntry is HtmlEntry) {
- HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
- CacheState resolutionErrorsState = htmlEntry.getState(HtmlEntry.RESOLUTION_ERRORS);
- if (resolutionErrorsState != CacheState.VALID && resolutionErrorsState != CacheState.ERROR) {
- computeHtmlElement(source);
- htmlEntry = getSourceEntry(source) as HtmlEntry;
- }
- return htmlEntry.getValue(HtmlEntry.RESOLUTION_ERRORS);
}
- return AnalysisError.NO_ERRORS;
+ if (errors.isEmpty) {
+ return AnalysisError.NO_ERRORS;
+ }
+ return new List.from(errors);
+ } else if (sourceEntry is HtmlEntry) {
+ HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+ return internalGetHtmlResolutionData(source, htmlEntry, HtmlEntry.RESOLUTION_ERRORS, AnalysisError.NO_ERRORS);
}
+ return AnalysisError.NO_ERRORS;
}
- List<Source> computeExportedLibraries(Source source) {
- {
- accessed(source);
- DartEntry dartEntry = getDartEntry(source);
- if (dartEntry == null || dartEntry.kind != SourceKind.LIBRARY) {
- return Source.EMPTY_ARRAY;
- }
- CacheState state = dartEntry.getState(DartEntry.EXPORTED_LIBRARIES);
- if (identical(state, CacheState.ERROR)) {
- return Source.EMPTY_ARRAY;
- } else if (identical(state, CacheState.VALID)) {
- return dartEntry.getValue(DartEntry.EXPORTED_LIBRARIES);
- } else {
- DartEntryImpl dartCopy = dartEntry.writableCopy;
- internalParseCompilationUnit(dartCopy, source);
- _sourceMap[source] = dartCopy;
- return dartCopy.getValue(DartEntry.EXPORTED_LIBRARIES);
- }
- }
- }
+ List<Source> computeExportedLibraries(Source source) => internalGetDartParseData2(source, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY);
HtmlElement computeHtmlElement(Source source) {
- if (!AnalysisEngine.isHtmlFileName(source.shortName)) {
+ HtmlEntry htmlEntry = getReadableHtmlEntry(source);
+ if (htmlEntry == null) {
return null;
}
- {
- HtmlEntry htmlEntry = getHtmlEntry(source);
- if (htmlEntry == null) {
- return null;
- }
- try {
- HtmlElement element = htmlEntry.getValue(HtmlEntry.ELEMENT);
- if (element == null) {
- HtmlUnit unit = htmlEntry.getValue(HtmlEntry.PARSED_UNIT);
- if (unit == null) {
- unit = parseHtmlUnit(source);
- }
- HtmlUnitBuilder builder = new HtmlUnitBuilder(this);
- element = builder.buildHtmlElement2(source, unit);
- List<AnalysisError> resolutionErrors = builder.errorListener.getErrors2(source);
- HtmlEntryImpl htmlCopy = getHtmlEntry(source).writableCopy;
- htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, resolutionErrors);
- htmlCopy.setValue(HtmlEntry.ELEMENT, element);
- _sourceMap[source] = htmlCopy;
- getNotice(source).setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_INFO));
- }
- return element;
- } on AnalysisException catch (exception) {
- HtmlEntryImpl htmlCopy = getHtmlEntry(source).writableCopy;
- htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR);
- htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.ERROR);
- _sourceMap[source] = htmlCopy;
- throw exception;
- }
+ CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT);
+ if (elementState != CacheState.ERROR && elementState != CacheState.VALID) {
+ htmlEntry = internalResolveHtml(source);
}
+ return htmlEntry.getValue(HtmlEntry.ELEMENT);
}
- List<Source> computeImportedLibraries(Source source) {
- {
- accessed(source);
- DartEntry dartEntry = getDartEntry(source);
- if (dartEntry == null || dartEntry.kind != SourceKind.LIBRARY) {
- return Source.EMPTY_ARRAY;
- }
- CacheState state = dartEntry.getState(DartEntry.IMPORTED_LIBRARIES);
- if (identical(state, CacheState.ERROR)) {
- return Source.EMPTY_ARRAY;
- } else if (identical(state, CacheState.VALID)) {
- return dartEntry.getValue(DartEntry.IMPORTED_LIBRARIES);
- } else {
- DartEntryImpl dartCopy = dartEntry.writableCopy;
- internalParseCompilationUnit(dartCopy, source);
- _sourceMap[source] = dartCopy;
- return dartCopy.getValue(DartEntry.IMPORTED_LIBRARIES);
- }
- }
- }
+ List<Source> computeImportedLibraries(Source source) => internalGetDartParseData2(source, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY);
SourceKind computeKindOf(Source source) {
SourceEntry sourceEntry = getReadableSourceEntry(source);
if (sourceEntry == null) {
return SourceKind.UNKNOWN;
} else if (sourceEntry is DartEntry) {
try {
- return internalGetDartParseData(source, (sourceEntry as DartEntry), DartEntry.SOURCE_KIND, SourceKind.UNKNOWN);
+ return internalGetDartParseData(source, (sourceEntry as DartEntry), DartEntry.SOURCE_KIND);
} on AnalysisException catch (exception) {
return SourceKind.UNKNOWN;
}
@@ -2307,21 +2419,19 @@
return null;
}
CompilationUnit computeResolvableCompilationUnit(Source source) {
- {
- DartEntry dartEntry = getDartEntry(source);
- if (dartEntry == null) {
+ 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;
}
- CompilationUnit unit = dartEntry.anyParsedCompilationUnit;
- if (unit != null) {
- return unit.accept(new ASTCloner()) as CompilationUnit;
- }
- DartEntryImpl dartCopy = dartEntry.writableCopy;
- unit = internalParseCompilationUnit(dartCopy, source);
- dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
- _sourceMap[source] = dartCopy;
- return unit;
}
+ return unit.accept(new ASTCloner()) as CompilationUnit;
}
AnalysisContext extractContext(SourceContainer container) => extractContextInto(container, (AnalysisEngine.instance.createAnalysisContext() as InternalAnalysisContext));
InternalAnalysisContext extractContextInto(SourceContainer container, InternalAnalysisContext newContext) {
@@ -2373,15 +2483,20 @@
return null;
}
List<Source> getHtmlFilesReferencing(Source source) {
+ SourceKind sourceKind = getKindOf(source);
+ if (sourceKind == null) {
+ return Source.EMPTY_ARRAY;
+ }
{
List<Source> htmlSources = new List<Source>();
while (true) {
- if (getKindOf(source) == SourceKind.LIBRARY) {
- } else if (getKindOf(source) == SourceKind.PART) {
+ if (sourceKind == SourceKind.LIBRARY) {
+ } else if (sourceKind == SourceKind.PART) {
List<Source> librarySources = getLibrariesContaining(source);
for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(_sourceMap)) {
- if (identical(entry.getValue().kind, SourceKind.HTML)) {
- List<Source> referencedLibraries = ((entry.getValue() as HtmlEntry)).getValue(HtmlEntry.REFERENCED_LIBRARIES);
+ SourceEntry sourceEntry = entry.getValue();
+ if (identical(sourceEntry.kind, SourceKind.HTML)) {
+ List<Source> referencedLibraries = ((sourceEntry as HtmlEntry)).getValue(HtmlEntry.REFERENCED_LIBRARIES);
if (containsAny(referencedLibraries, librarySources)) {
htmlSources.add(entry.getKey());
}
@@ -2432,10 +2547,15 @@
}
List<Source> getLibrariesContaining(Source source) {
{
+ SourceEntry sourceEntry = _sourceMap[source];
+ if (sourceEntry != null && identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+ return <Source> [source];
+ }
List<Source> librarySources = new List<Source>();
for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(_sourceMap)) {
- if (identical(entry.getValue().kind, SourceKind.LIBRARY)) {
- if (contains(((entry.getValue() as DartEntry)).getValue(DartEntry.INCLUDED_PARTS), source)) {
+ sourceEntry = entry.getValue();
+ if (identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+ if (contains(((sourceEntry as DartEntry)).getValue(DartEntry.INCLUDED_PARTS), source)) {
librarySources.add(entry.getKey());
}
}
@@ -2450,11 +2570,12 @@
{
List<Source> dependentLibraries = new List<Source>();
for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(_sourceMap)) {
- if (identical(entry.getValue().kind, SourceKind.LIBRARY)) {
- if (contains(((entry.getValue() as DartEntry)).getValue(DartEntry.EXPORTED_LIBRARIES), librarySource)) {
+ SourceEntry sourceEntry = entry.getValue();
+ if (identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+ if (contains(((sourceEntry as DartEntry)).getValue(DartEntry.EXPORTED_LIBRARIES), librarySource)) {
dependentLibraries.add(entry.getKey());
}
- if (contains(((entry.getValue() as DartEntry)).getValue(DartEntry.IMPORTED_LIBRARIES), librarySource)) {
+ if (contains(((sourceEntry as DartEntry)).getValue(DartEntry.IMPORTED_LIBRARIES), librarySource)) {
dependentLibraries.add(entry.getKey());
}
}
@@ -2482,11 +2603,11 @@
}
Namespace getPublicNamespace(LibraryElement library) {
Source source = library.definingCompilationUnit.source;
+ DartEntry dartEntry = getReadableDartEntry(source);
+ if (dartEntry == null) {
+ return null;
+ }
{
- DartEntry dartEntry = getDartEntry(source);
- if (dartEntry == null) {
- return null;
- }
Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE);
if (namespace == null) {
NamespaceBuilder builder = new NamespaceBuilder();
@@ -2499,11 +2620,11 @@
}
}
Namespace getPublicNamespace2(Source source) {
+ DartEntry dartEntry = getReadableDartEntry(source);
+ if (dartEntry == null) {
+ return null;
+ }
{
- DartEntry dartEntry = getDartEntry(source);
- if (dartEntry == null) {
- return null;
- }
Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE);
if (namespace == null) {
LibraryElement library = computeLibraryElement(source);
@@ -2533,6 +2654,68 @@
return null;
}
SourceFactory get sourceFactory => _sourceFactory;
+
+ /**
+ * Return a list of the sources that would be processed by [performAnalysisTask]. This
+ * method is intended to be used for testing purposes only.
+ *
+ * @return a list of the sources that would be processed by [performAnalysisTask]
+ */
+ List<Source> get sourcesNeedingProcessing {
+ List<Source> sources = new List<Source>();
+ {
+ for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(_sourceMap)) {
+ SourceEntry sourceEntry = entry.getValue();
+ if (sourceEntry is DartEntry) {
+ DartEntry dartEntry = sourceEntry as DartEntry;
+ CacheState parsedUnitState = dartEntry.getState(DartEntry.PARSED_UNIT);
+ CacheState elementState = dartEntry.getState(DartEntry.ELEMENT);
+ if (identical(parsedUnitState, CacheState.INVALID) || identical(elementState, CacheState.INVALID)) {
+ sources.add(entry.getKey());
+ }
+ } else if (sourceEntry is HtmlEntry) {
+ HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+ CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT);
+ CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT);
+ if (identical(parsedUnitState, CacheState.INVALID) || identical(elementState, CacheState.INVALID)) {
+ sources.add(entry.getKey());
+ }
+ }
+ }
+ }
+ return sources;
+ }
+ AnalysisContentStatistics get statistics {
+ AnalysisContentStatisticsImpl statistics = new AnalysisContentStatisticsImpl();
+ {
+ for (MapEntry<Source, SourceEntry> mapEntry in getMapEntrySet(_sourceMap)) {
+ SourceEntry entry = mapEntry.getValue();
+ if (entry is DartEntry) {
+ Source source = mapEntry.getKey();
+ DartEntry dartEntry = entry as DartEntry;
+ SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.PARSE_ERRORS);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.PARSED_UNIT);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.SOURCE_KIND);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.LINE_INFO);
+ if (identical(kind, SourceKind.LIBRARY)) {
+ putStatCacheItem2(statistics, dartEntry, DartEntry.ELEMENT);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.EXPORTED_LIBRARIES);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.IMPORTED_LIBRARIES);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.INCLUDED_PARTS);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.IS_CLIENT);
+ putStatCacheItem2(statistics, dartEntry, DartEntry.IS_LAUNCHABLE);
+ }
+ List<Source> librarySources = getLibrariesContaining(source);
+ for (Source librarySource in librarySources) {
+ putStatCacheItem(statistics, dartEntry, librarySource, DartEntry.RESOLUTION_ERRORS);
+ putStatCacheItem(statistics, dartEntry, librarySource, DartEntry.RESOLVED_UNIT);
+ }
+ }
+ }
+ }
+ return statistics;
+ }
bool isClientLibrary(Source librarySource) {
SourceEntry sourceEntry = getReadableSourceEntry(librarySource);
if (sourceEntry is DartEntry) {
@@ -2667,14 +2850,21 @@
if (sources == null || sources.isEmpty) {
_priorityOrder = Source.EMPTY_ARRAY;
} else {
- _priorityOrder = new List.from(sources);
+ while (sources.remove(null)) {
+ }
+ int count = Math.min(sources.length, _MAX_PRIORITY_LIST_SIZE);
+ _priorityOrder = new List<Source>(count);
+ for (int i = 0; i < count; i++) {
+ _priorityOrder[i] = sources[i];
+ }
}
}
}
void setContents(Source source, String contents) {
{
- _sourceFactory.setContents(source, contents);
- sourceChanged(source);
+ if (_sourceFactory.setContents(source, contents)) {
+ sourceChanged(source);
+ }
}
}
void set sourceFactory(SourceFactory factory) {
@@ -2703,37 +2893,6 @@
}
/**
- * Return a list of the sources that would be processed by [performAnalysisTask]. This
- * method is intended to be used for testing purposes only.
- *
- * @return a list of the sources that would be processed by [performAnalysisTask]
- */
- List<Source> get sourcesNeedingProcessing {
- List<Source> sources = new List<Source>();
- {
- for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(_sourceMap)) {
- SourceEntry sourceEntry = entry.getValue();
- if (sourceEntry is DartEntry) {
- DartEntry dartEntry = sourceEntry as DartEntry;
- CacheState parsedUnitState = dartEntry.getState(DartEntry.PARSED_UNIT);
- CacheState elementState = dartEntry.getState(DartEntry.ELEMENT);
- if (identical(parsedUnitState, CacheState.INVALID) || identical(elementState, CacheState.INVALID)) {
- sources.add(entry.getKey());
- }
- } else if (sourceEntry is HtmlEntry) {
- HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
- CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT);
- CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT);
- if (identical(parsedUnitState, CacheState.INVALID) || identical(elementState, CacheState.INVALID)) {
- sources.add(entry.getKey());
- }
- }
- }
- }
- return sources;
- }
-
- /**
* Record that the given source was just accessed for some unspecified purpose.
*
* Note: This method must only be invoked while we are synchronized on [cacheLock].
@@ -2883,7 +3042,7 @@
* Note: This method must only be invoked while we are synchronized on [cacheLock].
*/
void flushAstFromCache() {
- Source removedSource = _recentlyUsed.removeAt(0);
+ Source removedSource = removeAstToFlush();
SourceEntry sourceEntry = _sourceMap[removedSource];
if (sourceEntry is HtmlEntry) {
HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
@@ -2924,30 +3083,6 @@
}
/**
- * Return the HTML unit information associated with the given source, or `null` if the
- * source is not known to this context. This method should be used to access the HTML unit
- * information rather than accessing the HTML unit map directly because sources in the SDK are
- * implicitly part of every analysis context and are therefore only added to the map when first
- * accessed.
- *
- * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
- *
- * @param source the source for which information is being sought
- * @return the HTML unit information associated with the given source
- */
- HtmlEntry getHtmlEntry(Source source) {
- SourceEntry sourceEntry = getSourceEntry(source);
- if (sourceEntry == null) {
- sourceEntry = new HtmlEntryImpl();
- _sourceMap[source] = sourceEntry;
- return sourceEntry as HtmlEntry;
- } else if (sourceEntry is HtmlEntry) {
- return sourceEntry as HtmlEntry;
- }
- return null;
- }
-
- /**
* Return the sources of libraries that are referenced in the specified HTML file.
*
* @param htmlSource the source of the HTML file being analyzed
@@ -2964,6 +3099,117 @@
}
/**
+ * Look through the cache for a task that needs to be performed. Return the task that was found,
+ * or `null` if there is no more work to be done.
+ *
+ * @return the next task that needs to be performed
+ */
+ AnalysisContextImpl_AnalysisTask get nextTaskAnalysisTask {
+ {
+ for (Source source in _priorityOrder) {
+ SourceEntry sourceEntry = _sourceMap[source];
+ if (sourceEntry is DartEntry) {
+ DartEntry dartEntry = sourceEntry as DartEntry;
+ CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS);
+ if (identical(parseErrorsState, CacheState.INVALID) || identical(parseErrorsState, CacheState.FLUSHED)) {
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
+ _sourceMap[source] = dartCopy;
+ return new AnalysisContextImpl_ParseDartTask(this, source);
+ }
+ CacheState parseUnitState = dartEntry.getState(DartEntry.PARSED_UNIT);
+ if (identical(parseUnitState, CacheState.INVALID) || identical(parseUnitState, CacheState.FLUSHED)) {
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.IN_PROCESS);
+ _sourceMap[source] = dartCopy;
+ return new AnalysisContextImpl_ParseDartTask(this, source);
+ }
+ for (Source librarySource in getLibrariesContaining(source)) {
+ SourceEntry libraryEntry = _sourceMap[librarySource];
+ if (libraryEntry is DartEntry) {
+ CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT);
+ if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
+ DartEntryImpl libraryCopy = ((libraryEntry as DartEntry)).writableCopy;
+ libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS);
+ _sourceMap[librarySource] = libraryCopy;
+ return new AnalysisContextImpl_ResolveDartLibraryTask(this, librarySource);
+ }
+ }
+ CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_UNIT, librarySource);
+ if (identical(resolvedUnitState, CacheState.INVALID) || identical(resolvedUnitState, CacheState.FLUSHED)) {
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, CacheState.IN_PROCESS);
+ _sourceMap[source] = dartCopy;
+ return new AnalysisContextImpl_ResolveDartUnitTask(this, source, librarySource);
+ }
+ }
+ } else if (sourceEntry is HtmlEntry) {
+ HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+ CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT);
+ if (identical(parsedUnitState, CacheState.INVALID) || identical(parsedUnitState, CacheState.FLUSHED)) {
+ HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+ htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS);
+ _sourceMap[source] = htmlCopy;
+ return new AnalysisContextImpl_ParseHtmlTask(this, source);
+ }
+ CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT);
+ if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
+ HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+ htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.IN_PROCESS);
+ _sourceMap[source] = htmlCopy;
+ return new AnalysisContextImpl_ResolveHtmlTask(this, source);
+ }
+ }
+ }
+ for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(_sourceMap)) {
+ SourceEntry sourceEntry = entry.getValue();
+ if (sourceEntry is DartEntry) {
+ DartEntry dartEntry = sourceEntry as DartEntry;
+ if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.INVALID)) {
+ Source source = entry.getKey();
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
+ _sourceMap[source] = dartCopy;
+ return new AnalysisContextImpl_ParseDartTask(this, source);
+ }
+ } else if (sourceEntry is HtmlEntry) {
+ HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+ if (identical(htmlEntry.getState(HtmlEntry.PARSED_UNIT), CacheState.INVALID)) {
+ Source source = entry.getKey();
+ HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+ htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS);
+ _sourceMap[source] = htmlCopy;
+ return new AnalysisContextImpl_ParseHtmlTask(this, source);
+ }
+ }
+ }
+ for (MapEntry<Source, SourceEntry> entry in getMapEntrySet(_sourceMap)) {
+ SourceEntry sourceEntry = entry.getValue();
+ if (sourceEntry is DartEntry && identical(sourceEntry.kind, SourceKind.LIBRARY)) {
+ DartEntry dartEntry = sourceEntry as DartEntry;
+ if (identical(dartEntry.getState(DartEntry.ELEMENT), CacheState.INVALID)) {
+ Source source = entry.getKey();
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ dartCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS);
+ _sourceMap[source] = dartCopy;
+ return new AnalysisContextImpl_ResolveDartLibraryTask(this, source);
+ }
+ } else if (sourceEntry is HtmlEntry) {
+ HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
+ if (identical(htmlEntry.getState(HtmlEntry.ELEMENT), CacheState.INVALID)) {
+ Source source = entry.getKey();
+ HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+ htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.IN_PROCESS);
+ _sourceMap[source] = htmlCopy;
+ return new AnalysisContextImpl_ResolveHtmlTask(this, source);
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+ /**
* Return a change notice for the given source, creating one if one does not already exist.
*
* @param source the source for which changes are being reported
@@ -3078,26 +3324,99 @@
}
/**
- * Given a source for a Dart file, return the data represented by the given descriptor that is
- * associated with that source, or the given default value if the source is not a Dart file. This
- * method assumes that the data can be produced by parsing the source if it is not already cached.
+ * Given a source for an HTML file, return a cache entry in which all of the data represented by
+ * the given descriptors is available. This method assumes that the data can be produced by
+ * parsing the source if it is not already cached.
+ *
+ * @param htmlEntry the cache entry associated with the HTML file
+ * @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) {
+ CacheState state = htmlEntry.getState(descriptor);
+ if (state != CacheState.VALID && state != CacheState.ERROR) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Given a source for a Dart file, return a cache entry in which the data represented by the given
+ * descriptor is available. This method assumes that the data can be produced by parsing the
+ * source if it is not already cached.
*
* @param source the source representing the Dart file
* @param dartEntry the cache entry associated with the Dart file
* @param descriptor the descriptor representing the data to be returned
- * @param defaultValue the value to be returned if the source is not a Dart file
- * @return the requested data about the given source
- * @throws AnalysisException if data could not be returned because the source could not be parsed
+ * @return a cache entry containing the required data
+ * @throws AnalysisException if data could not be returned because the source could not be
+ * resolved
*/
- Object internalGetDartParseData(Source source, DartEntry dartEntry, DataDescriptor descriptor, Object defaultValue) {
- if (dartEntry == null) {
- return defaultValue;
- }
+ DartEntry internalCacheDartParseData(Source source, DartEntry dartEntry, DataDescriptor<Object> descriptor) {
CacheState state = dartEntry.getState(descriptor);
while (state != CacheState.ERROR && state != CacheState.VALID) {
dartEntry = internalParseDart(source);
state = dartEntry.getState(descriptor);
}
+ return dartEntry;
+ }
+
+ /**
+ * Given a source for a Dart file and the library that contains it, return a cache entry in which
+ * all of the data represented by the given descriptors is available. This method assumes that the
+ * data can be produced by resolving the source in the context of the library if it is not already
+ * cached.
+ *
+ * @param unitSource the source representing the Dart file
+ * @param librarySource the source representing the library containing the Dart file
+ * @param dartEntry the cache entry associated with the Dart file
+ * @param descriptor the descriptor representing the data to be returned
+ * @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) {
+ CacheState state = dartEntry.getState2(descriptor, librarySource);
+ while (state != CacheState.ERROR && state != CacheState.VALID) {
+ dartEntry = internalResolveDart(unitSource, librarySource);
+ state = dartEntry.getState2(descriptor, librarySource);
+ }
+ return dartEntry;
+ }
+
+ /**
+ * Given a source for an HTML file, return a cache entry in which all of the data represented by
+ * the given descriptors is available. This method assumes that the data can be produced by
+ * parsing the source if it is not already cached.
+ *
+ * @param source the source representing the HTML file
+ * @param htmlEntry the cache entry associated with the HTML file
+ * @param descriptor the descriptor representing the data to be returned
+ * @return a cache entry containing the required data
+ * @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) {
+ while (!hasHtmlParseDataCached(htmlEntry, descriptors)) {
+ htmlEntry = internalParseHtml(source);
+ }
+ return htmlEntry;
+ }
+
+ /**
+ * Given a source for a Dart file, return the data represented by the given descriptor that is
+ * associated with that source. This method assumes that the data can be produced by parsing the
+ * source if it is not already cached.
+ *
+ * @param source the source representing the Dart file
+ * @param dartEntry the cache entry associated with the Dart file
+ * @param descriptor the descriptor representing the data to be returned
+ * @return the requested data about the given source
+ * @throws AnalysisException if data could not be returned because the source could not be parsed
+ */
+ Object internalGetDartParseData(Source source, DartEntry dartEntry, DataDescriptor descriptor) {
+ dartEntry = internalCacheDartParseData(source, dartEntry, descriptor);
return dartEntry.getValue(descriptor);
}
@@ -3112,7 +3431,51 @@
* @return the requested data about the given source
* @throws AnalysisException if data could not be returned because the source could not be parsed
*/
- Object internalGetDartParseData2(Source source, DataDescriptor descriptor, Object defaultValue) => internalGetDartParseData(source, getReadableDartEntry(source), descriptor, defaultValue);
+ Object internalGetDartParseData2(Source source, DataDescriptor descriptor, Object defaultValue) {
+ DartEntry dartEntry = getReadableDartEntry(source);
+ if (dartEntry == null) {
+ return defaultValue;
+ }
+ return internalGetDartParseData(source, dartEntry, descriptor);
+ }
+
+ /**
+ * Given a source for a Dart file and the library that contains it, return the data represented by
+ * the given descriptor that is associated with that source. This method assumes that the data can
+ * be produced by resolving the source in the context of the library if it is not already cached.
+ *
+ * @param unitSource the source representing the Dart file
+ * @param librarySource the source representing the library containing the Dart file
+ * @param dartEntry the entry representing the Dart file
+ * @param descriptor the descriptor representing the data to be returned
+ * @return the requested data about the given source
+ * @throws AnalysisException if data could not be returned because the source could not be parsed
+ */
+ Object internalGetDartResolutionData(Source unitSource, Source librarySource, DartEntry dartEntry, DataDescriptor descriptor) {
+ dartEntry = internalCacheDartResolutionData(unitSource, librarySource, dartEntry, descriptor);
+ return dartEntry.getValue2(descriptor, librarySource);
+ }
+
+ /**
+ * Given a source for a Dart file and the library that contains it, return the data represented by
+ * the given descriptor that is associated with that source. This method assumes that the data can
+ * be produced by resolving the source in the context of the library if it is not already cached.
+ *
+ * @param unitSource the source representing the Dart file
+ * @param librarySource the source representing the library containing the Dart file
+ * @param descriptor the descriptor representing the data to be returned
+ * @param defaultValue the value to be returned if the file is not a Dart file
+ * @return the requested data about the given source
+ * @throws AnalysisException if data could not be returned because the source could not be parsed
+ */
+ Object internalGetDartResolutionData2(Source unitSource, Source librarySource, DataDescriptor descriptor, Object defaultValue) {
+ DartEntry dartEntry = getReadableDartEntry(unitSource);
+ if (dartEntry == null) {
+ return defaultValue;
+ }
+ dartEntry = internalCacheDartResolutionData(unitSource, librarySource, dartEntry, descriptor);
+ return dartEntry.getValue(descriptor);
+ }
/**
* Given a source for an HTML file, return the data represented by the given descriptor that is
@@ -3130,9 +3493,30 @@
if (htmlEntry == null) {
return defaultValue;
}
+ htmlEntry = internalCacheHtmlParseData(source, htmlEntry, [descriptor]);
+ return htmlEntry.getValue(descriptor);
+ }
+
+ /**
+ * Given a source for an HTML file, return the data represented by the given descriptor that is
+ * associated with that source, or the given default value if the source is not an HTML file. This
+ * method assumes that the data can be produced by resolving the source if it is not already
+ * cached.
+ *
+ * @param source the source representing the HTML file
+ * @param descriptor the descriptor representing the data to be returned
+ * @param defaultValue the value to be returned if the source is not an HTML file
+ * @return the requested data about the given source
+ * @throws AnalysisException if data could not be returned because the source could not be
+ * resolved
+ */
+ Object internalGetHtmlResolutionData(Source source, HtmlEntry htmlEntry, DataDescriptor descriptor, Object defaultValue) {
+ if (htmlEntry == null) {
+ return defaultValue;
+ }
CacheState state = htmlEntry.getState(descriptor);
while (state != CacheState.ERROR && state != CacheState.VALID) {
- htmlEntry = internalParseHtml(source);
+ htmlEntry = internalResolveHtml(source);
state = htmlEntry.getState(descriptor);
}
return htmlEntry.getValue(descriptor);
@@ -3254,16 +3638,22 @@
} on AnalysisException catch (exception) {
thrownException = exception;
}
- DartEntryImpl dartCopy = null;
+ DartEntry dartEntry = null;
{
SourceEntry sourceEntry = _sourceMap[source];
if (sourceEntry is! DartEntry) {
throw new AnalysisException.con1("Internal error: attempting to parse non-Dart file as a Dart file: ${source.fullName}");
}
+ dartEntry = sourceEntry as DartEntry;
accessed(source);
- int resultTime = scanResult == null ? source.modificationStamp : scanResult.modificationTime;
- if (sourceEntry.modificationTime == resultTime) {
- dartCopy = ((sourceEntry as DartEntry)).writableCopy;
+ int sourceTime = source.modificationStamp;
+ int resultTime = scanResult == null ? sourceTime : scanResult.modificationTime;
+ if (sourceTime == resultTime) {
+ if (dartEntry.modificationTime != sourceTime) {
+ sourceChanged(source);
+ dartEntry = getReadableDartEntry(source);
+ }
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
if (thrownException == null) {
dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
if (hasPartOfDirective && !hasLibraryDirective) {
@@ -3280,13 +3670,16 @@
dartCopy.recordParseError();
}
_sourceMap[source] = dartCopy;
+ dartEntry = dartCopy;
}
}
if (thrownException != null) {
- AnalysisEngine.instance.logger.logError2("Could not parse ${source.fullName}", thrownException);
+ if (thrownException.cause is! JavaIOException) {
+ AnalysisEngine.instance.logger.logError2("Could not parse ${source.fullName}", thrownException);
+ }
throw thrownException;
}
- return dartCopy;
+ return dartEntry;
}
/**
@@ -3308,16 +3701,22 @@
} on AnalysisException catch (exception) {
thrownException = exception;
}
- HtmlEntryImpl htmlCopy = null;
+ HtmlEntry htmlEntry = null;
{
SourceEntry sourceEntry = _sourceMap[source];
if (sourceEntry is! HtmlEntry) {
throw new AnalysisException.con1("Internal error: attempting to parse non-HTML file as a HTML file: ${source.fullName}");
}
+ htmlEntry = sourceEntry as HtmlEntry;
accessed(source);
- int resultTime = result == null ? source.modificationStamp : result.modificationTime;
- if (sourceEntry.modificationTime == resultTime) {
- htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
+ int sourceTime = source.modificationStamp;
+ int resultTime = result == null ? sourceTime : result.modificationTime;
+ if (sourceTime == resultTime) {
+ if (htmlEntry.modificationTime != sourceTime) {
+ sourceChanged(source);
+ htmlEntry = getReadableHtmlEntry(source);
+ }
+ HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy;
if (thrownException == null) {
HtmlUnit unit = result.htmlUnit;
htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
@@ -3329,6 +3728,7 @@
htmlCopy.setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR);
}
_sourceMap[source] = htmlCopy;
+ htmlEntry = htmlCopy;
}
}
if (thrownException != null) {
@@ -3336,8 +3736,116 @@
throw thrownException;
}
ChangeNoticeImpl notice = getNotice(source);
- notice.setErrors(htmlCopy.allErrors, lineInfo);
- return htmlCopy;
+ notice.setErrors(htmlEntry.allErrors, lineInfo);
+ return htmlEntry;
+ }
+ DartEntry internalResolveDart(Source unitSource, Source librarySource) {
+ DartEntry dartEntry = getReadableDartEntry(unitSource);
+ if (dartEntry == null) {
+ throw new AnalysisException.con1("Internal error: attempting to parse non-Dart file as a Dart file: ${unitSource.fullName}");
+ }
+ LibraryResolver resolver = null;
+ AnalysisException thrownException = null;
+ try {
+ resolver = new LibraryResolver(this);
+ resolver.resolveLibrary(librarySource, true);
+ } on AnalysisException catch (exception) {
+ thrownException = exception;
+ }
+ if (thrownException == null) {
+ {
+ accessed(unitSource);
+ }
+ recordResolutionResults(resolver);
+ dartEntry = getReadableDartEntry(unitSource);
+ } else {
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${unitSource.fullName}", thrownException);
+ bool unitIsLibrary = unitSource == librarySource;
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ dartCopy.setState2(DartEntry.RESOLUTION_ERRORS, librarySource, CacheState.ERROR);
+ if (unitIsLibrary) {
+ dartCopy.setState(DartEntry.ELEMENT, CacheState.ERROR);
+ }
+ _sourceMap[unitSource] = dartCopy;
+ if (!unitIsLibrary) {
+ DartEntry libraryEntry = getReadableDartEntry(librarySource);
+ if (libraryEntry != null) {
+ DartEntryImpl libraryCopy = dartEntry.writableCopy;
+ libraryCopy.setState2(DartEntry.RESOLUTION_ERRORS, librarySource, CacheState.ERROR);
+ libraryCopy.setState(DartEntry.ELEMENT, CacheState.ERROR);
+ _sourceMap[librarySource] = libraryCopy;
+ }
+ }
+ throw thrownException;
+ }
+ ChangeNoticeImpl notice = getNotice(unitSource);
+ notice.setErrors(dartEntry.allErrors, dartEntry.getValue(SourceEntry.LINE_INFO));
+ return dartEntry;
+ }
+
+ /**
+ * Scan and parse the given HTML file, updating the cache as appropriate, and return the updated
+ * cache entry associated with the source.
+ *
+ * @param source the source representing the HTML file to be parsed
+ * @return the updated cache entry associated with the source
+ * @throws AnalysisException if the source does not represent an HTML file or if the file cannot
+ * be parsed for some reason
+ */
+ HtmlEntry internalResolveHtml(Source source) {
+ HtmlEntry htmlEntry = getReadableHtmlEntry(source);
+ if (htmlEntry == null) {
+ throw new AnalysisException.con1("Internal error: attempting to parse non-HTML file as a HTML file: ${source.fullName}");
+ }
+ int resultTime = 0;
+ HtmlElement element = null;
+ List<AnalysisError> resolutionErrors = null;
+ AnalysisException thrownException = null;
+ try {
+ htmlEntry = internalCacheHtmlParseData(source, htmlEntry, [HtmlEntry.PARSED_UNIT]);
+ HtmlUnit unit = htmlEntry.getValue(HtmlEntry.PARSED_UNIT);
+ if (unit == null) {
+ throw new AnalysisException.con1("Internal error: internalCacheHtmlParseData returned an entry without a parsed HTML unit");
+ }
+ resultTime = htmlEntry.modificationTime;
+ HtmlUnitBuilder builder = new HtmlUnitBuilder(this);
+ element = builder.buildHtmlElement2(source, unit);
+ resolutionErrors = builder.errorListener.getErrors2(source);
+ } on AnalysisException catch (exception) {
+ thrownException = exception;
+ }
+ {
+ SourceEntry sourceEntry = _sourceMap[source];
+ if (sourceEntry is! HtmlEntry) {
+ throw new AnalysisException.con1("Internal error: attempting to resolve non-HTML file as a HTML file: ${source.fullName}");
+ }
+ htmlEntry = sourceEntry as HtmlEntry;
+ accessed(source);
+ int sourceTime = source.modificationStamp;
+ if (sourceTime == resultTime) {
+ if (htmlEntry.modificationTime != sourceTime) {
+ sourceChanged(source);
+ htmlEntry = getReadableHtmlEntry(source);
+ }
+ HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
+ if (thrownException == null) {
+ htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, resolutionErrors);
+ htmlCopy.setValue(HtmlEntry.ELEMENT, element);
+ } else {
+ htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR);
+ htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.ERROR);
+ }
+ _sourceMap[source] = htmlCopy;
+ htmlEntry = htmlCopy;
+ }
+ }
+ if (thrownException != null) {
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${source.fullName}", thrownException);
+ throw thrownException;
+ }
+ ChangeNoticeImpl notice = getNotice(source);
+ notice.setErrors(htmlEntry.allErrors, htmlEntry.getValue(SourceEntry.LINE_INFO));
+ return htmlEntry;
}
AnalysisContextImpl_ScanResult internalScan(Source source, AnalysisErrorListener errorListener) {
AnalysisContextImpl_ScanResult result = new AnalysisContextImpl_ScanResult();
@@ -3425,6 +3933,20 @@
}
/**
+ * Return `true` if the given source is in the array of priority sources.
+ *
+ * Note: This method must only be invoked while we are synchronized on [cacheLock].
+ */
+ bool isPrioritySource(Source source) {
+ for (Source prioritySource in _priorityOrder) {
+ if (source == prioritySource) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Perform a single analysis task.
*
* <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
@@ -3436,19 +3958,34 @@
SourceEntry sourceEntry = _sourceMap[source];
if (sourceEntry is DartEntry) {
DartEntry dartEntry = sourceEntry as DartEntry;
- if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.INVALID)) {
+ CacheState parsedUnitState = dartEntry.getState(DartEntry.PARSED_UNIT);
+ if (identical(parsedUnitState, CacheState.INVALID) || identical(parsedUnitState, CacheState.FLUSHED)) {
safelyParseCompilationUnit(source, dartEntry);
return true;
- } else if (identical(dartEntry.getState(DartEntry.RESOLVED_UNIT), CacheState.INVALID)) {
- safelyResolveCompilationUnit(source);
- return true;
+ }
+ for (Source librarySource in getLibrariesContaining(source)) {
+ SourceEntry libraryEntry = _sourceMap[librarySource];
+ if (libraryEntry is DartEntry) {
+ CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT);
+ if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
+ safelyResolveCompilationUnit(librarySource);
+ return true;
+ }
+ }
+ if (identical(dartEntry.getState2(DartEntry.RESOLVED_UNIT, librarySource), CacheState.FLUSHED)) {
+ safelyResolveCompilationUnit2(source, librarySource);
+ return true;
+ }
}
} else if (sourceEntry is HtmlEntry) {
HtmlEntry htmlEntry = sourceEntry as HtmlEntry;
- if (identical(htmlEntry.getState(HtmlEntry.PARSED_UNIT), CacheState.INVALID)) {
+ CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT);
+ if (identical(parsedUnitState, CacheState.INVALID) || identical(parsedUnitState, CacheState.FLUSHED)) {
safelyParseHtmlUnit(source);
return true;
- } else if (identical(htmlEntry.getState(HtmlEntry.ELEMENT), CacheState.INVALID)) {
+ }
+ CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT);
+ if (identical(elementState, CacheState.INVALID) || identical(elementState, CacheState.FLUSHED)) {
safelyResolveHtmlUnit(source);
return true;
}
@@ -3529,18 +4066,24 @@
{
DartEntry dartEntry = getDartEntry(source);
if (dartEntry != null) {
- DartEntryImpl dartCopy = dartEntry.writableCopy;
- dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
- dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
- dartCopy.setValue2(DartEntry.RESOLVED_UNIT, librarySource, unit);
- dartCopy.setValue2(DartEntry.RESOLUTION_ERRORS, librarySource, errors);
- if (identical(source, librarySource)) {
- recordElementData(dartCopy, library.libraryElement, htmlSource);
+ int sourceTime = source.modificationStamp;
+ int resultTime = dartEntry.modificationTime;
+ if (sourceTime == resultTime) {
+ DartEntryImpl dartCopy = dartEntry.writableCopy;
+ dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
+ dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED);
+ dartCopy.setValue2(DartEntry.RESOLVED_UNIT, librarySource, unit);
+ dartCopy.setValue2(DartEntry.RESOLUTION_ERRORS, librarySource, errors);
+ if (identical(source, librarySource)) {
+ recordElementData(dartCopy, library.libraryElement, htmlSource);
+ }
+ _sourceMap[source] = dartCopy;
+ ChangeNoticeImpl notice = getNotice(source);
+ notice.compilationUnit = unit;
+ notice.setErrors(dartCopy.allErrors, lineInfo);
+ } else {
+ sourceChanged(source);
}
- _sourceMap[source] = dartCopy;
- ChangeNoticeImpl notice = getNotice(source);
- notice.compilationUnit = unit;
- notice.setErrors(dartCopy.allErrors, lineInfo);
}
}
}
@@ -3548,6 +4091,26 @@
}
/**
+ * 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
+ *
+ * Note: This method must only be invoked while we are synchronized on [cacheLock].
+ */
+ 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 is greater than the maximum cache size", new JavaException());
+ return _recentlyUsed.removeAt(0);
+ }
+
+ /**
* Return the result of resolving the URI of the given URI-based directive against the URI of the
* given library, or `null` if the URI is not valid.
*
@@ -3564,6 +4127,7 @@
if (uriContent == null) {
return null;
}
+ uriContent = Uri.encodeFull(uriContent);
try {
parseUriWithException(uriContent);
return _sourceFactory.resolveUri(librarySource, uriContent);
@@ -3585,7 +4149,9 @@
try {
internalParseCompilationUnit(dartCopy, 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);
+ }
}
_sourceMap[source] = dartCopy;
}
@@ -3620,6 +4186,25 @@
}
/**
+ * Resolve the given source within the given library and update the cache.
+ *
+ * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
+ *
+ * @param unitSource the source to be resolved
+ * @param librarySource the source
+ */
+ void safelyResolveCompilationUnit2(Source unitSource, Source librarySource) {
+ try {
+ resolveCompilationUnit2(unitSource, librarySource);
+ } on AnalysisException catch (exception) {
+ DartEntryImpl dartCopy = getReadableDartEntry(unitSource).writableCopy;
+ dartCopy.recordResolutionError();
+ _sourceMap[unitSource] = dartCopy;
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${unitSource.fullName} in ${librarySource.fullName}", exception);
+ }
+ }
+
+ /**
* Resolve the given source and update the cache.
*
* <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
@@ -3733,6 +4318,164 @@
}
}
/**
+ * The interface `AnalysisTask` defines the behavior of objects used to perform an analysis
+ * task.
+ */
+abstract class AnalysisContextImpl_AnalysisTask {
+
+ /**
+ * Perform a single analysis task. Implementors should assume that the cache is not locked.
+ */
+ void perform();
+}
+/**
+ * Instances of the class `ParseDartTask` parse a specific source as a Dart file.
+ */
+class AnalysisContextImpl_ParseDartTask implements AnalysisContextImpl_AnalysisTask {
+ final AnalysisContextImpl AnalysisContextImpl_this;
+
+ /**
+ * The source to be parsed.
+ */
+ Source _source;
+
+ /**
+ * Initialize a newly created task to parse the given source as a Dart file.
+ *
+ * @param source the source to be resolved
+ */
+ AnalysisContextImpl_ParseDartTask(this.AnalysisContextImpl_this, Source source) {
+ this._source = source;
+ }
+ void perform() {
+ try {
+ AnalysisContextImpl_this.internalParseDart(_source);
+ } on AnalysisException catch (exception) {
+ AnalysisEngine.instance.logger.logError2("Could not parse ${_source.fullName}", exception);
+ }
+ }
+}
+/**
+ * Instances of the class `ParseHtmlTask` parse a specific source as an HTML file.
+ */
+class AnalysisContextImpl_ParseHtmlTask implements AnalysisContextImpl_AnalysisTask {
+ final AnalysisContextImpl AnalysisContextImpl_this;
+
+ /**
+ * The source to be parsed.
+ */
+ Source _source;
+
+ /**
+ * Initialize a newly created task to parse the given source as an HTML file.
+ *
+ * @param source the source to be resolved
+ */
+ AnalysisContextImpl_ParseHtmlTask(this.AnalysisContextImpl_this, Source source) {
+ this._source = source;
+ }
+ void perform() {
+ try {
+ AnalysisContextImpl_this.internalParseHtml(_source);
+ } on AnalysisException catch (exception) {
+ AnalysisEngine.instance.logger.logError2("Could not parse ${_source.fullName}", exception);
+ }
+ }
+}
+/**
+ * Instances of the class `ResolveDartLibraryTask` resolve a specific source as a Dart
+ * library.
+ */
+class AnalysisContextImpl_ResolveDartLibraryTask implements AnalysisContextImpl_AnalysisTask {
+ final AnalysisContextImpl AnalysisContextImpl_this;
+
+ /**
+ * The source to be resolved.
+ */
+ Source _source;
+
+ /**
+ * Initialize a newly created task to resolve the given source as a Dart file.
+ *
+ * @param source the source to be resolved
+ */
+ AnalysisContextImpl_ResolveDartLibraryTask(this.AnalysisContextImpl_this, Source source) {
+ this._source = source;
+ }
+ void perform() {
+ try {
+ AnalysisContextImpl_this.computeLibraryElement(_source);
+ } on AnalysisException catch (exception) {
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${_source.fullName}", exception);
+ }
+ }
+}
+/**
+ * Instances of the class `ResolveDartUnitTask` resolve a specific source as a Dart file
+ * within a library.
+ */
+class AnalysisContextImpl_ResolveDartUnitTask implements AnalysisContextImpl_AnalysisTask {
+ final AnalysisContextImpl AnalysisContextImpl_this;
+
+ /**
+ * The source to be resolved.
+ */
+ Source _unitSource;
+
+ /**
+ * The source of the library in which the source is to be resolved.
+ */
+ Source _librarySource;
+
+ /**
+ * Initialize a newly created task to resolve the given source as a Dart file.
+ *
+ * @param unitSource the source to be resolved
+ * @param librarySource the source of the library in which the source is to be resolved
+ */
+ AnalysisContextImpl_ResolveDartUnitTask(this.AnalysisContextImpl_this, Source unitSource, Source librarySource) {
+ this._unitSource = unitSource;
+ this._librarySource = librarySource;
+ }
+ void perform() {
+ try {
+ AnalysisContextImpl_this.resolveCompilationUnit2(_unitSource, _librarySource);
+ } on AnalysisException catch (exception) {
+ DartEntryImpl dartCopy = AnalysisContextImpl_this.getReadableDartEntry(_unitSource).writableCopy;
+ dartCopy.recordResolutionError();
+ AnalysisContextImpl_this._sourceMap[_unitSource] = dartCopy;
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${_unitSource.fullName} in ${_librarySource.fullName}", exception);
+ }
+ }
+}
+/**
+ * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML file.
+ */
+class AnalysisContextImpl_ResolveHtmlTask implements AnalysisContextImpl_AnalysisTask {
+ final AnalysisContextImpl AnalysisContextImpl_this;
+
+ /**
+ * The source to be resolved.
+ */
+ Source _source;
+
+ /**
+ * Initialize a newly created task to resolve the given source as an HTML file.
+ *
+ * @param source the source to be resolved
+ */
+ AnalysisContextImpl_ResolveHtmlTask(this.AnalysisContextImpl_this, Source source) {
+ this._source = source;
+ }
+ void perform() {
+ try {
+ AnalysisContextImpl_this.computeHtmlElement(_source);
+ } on AnalysisException catch (exception) {
+ AnalysisEngine.instance.logger.logError2("Could not resolve ${_source.fullName}", exception);
+ }
+ }
+}
+/**
* Instances of the class `ScanResult` represent the results of scanning a source.
*/
class AnalysisContextImpl_ScanResult {
@@ -3786,7 +4529,7 @@
libraries.add(librarySource);
}
} catch (exception) {
- AnalysisEngine.instance.logger.logError2("Invalid URL ('${scriptAttribute.text}') in script tag in '${htmlSource.fullName}'", exception);
+ AnalysisEngine.instance.logger.logInformation2("Invalid URL ('${scriptAttribute.text}') in script tag in '${htmlSource.fullName}'", exception);
}
}
}
@@ -3903,7 +4646,7 @@
/**
* The enumeration `CacheState` defines the possible states of cached data.
*/
-class CacheState implements Comparable<CacheState> {
+class CacheState implements Enum<CacheState> {
/**
* The data is not in the cache and the last time an attempt was made to compute the data an
@@ -4582,7 +5325,7 @@
}
return ret;
} finally {
- instrumentation.log();
+ instrumentation.log2(2);
}
}
List<Source> getLibrariesDependingOn(Source librarySource) {
@@ -4646,7 +5389,7 @@
instrumentation.metric3("contextId", _contextId);
return _basis.getResolvedCompilationUnit2(unitSource, librarySource);
} finally {
- instrumentation.log();
+ instrumentation.log2(2);
}
}
SourceFactory get sourceFactory {
@@ -4655,9 +5398,10 @@
instrumentation.metric3("contextId", _contextId);
return _basis.sourceFactory;
} finally {
- instrumentation.log();
+ instrumentation.log2(2);
}
}
+ AnalysisContentStatistics get statistics => _basis.statistics;
bool isClientLibrary(Source librarySource) {
InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-isClientLibrary");
try {
@@ -4722,7 +5466,7 @@
}
return ret;
} finally {
- instrumentation.log();
+ instrumentation.log2(2);
}
}
void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
@@ -4888,6 +5632,11 @@
Namespace getPublicNamespace2(Source source);
/**
+ * Returns a statistics about this context.
+ */
+ AnalysisContentStatistics get statistics;
+
+ /**
* Given a table mapping the source for the libraries represented by the corresponding elements to
* the elements representing the libraries, record those mappings.
*
@@ -4971,12 +5720,12 @@
class ResolutionEraser extends GeneralizingASTVisitor<Object> {
Object visitAssignmentExpression(AssignmentExpression node) {
node.staticElement = null;
- node.element = null;
+ node.propagatedElement = null;
return super.visitAssignmentExpression(node);
}
Object visitBinaryExpression(BinaryExpression node) {
node.staticElement = null;
- node.element = null;
+ node.propagatedElement = null;
return super.visitBinaryExpression(node);
}
Object visitCompilationUnit(CompilationUnit node) {
@@ -5007,12 +5756,12 @@
}
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
node.staticElement = null;
- node.element = null;
+ node.propagatedElement = null;
return super.visitFunctionExpressionInvocation(node);
}
Object visitIndexExpression(IndexExpression node) {
node.staticElement = null;
- node.element = null;
+ node.propagatedElement = null;
return super.visitIndexExpression(node);
}
Object visitInstanceCreationExpression(InstanceCreationExpression node) {
@@ -5022,12 +5771,12 @@
}
Object visitPostfixExpression(PostfixExpression node) {
node.staticElement = null;
- node.element = null;
+ node.propagatedElement = null;
return super.visitPostfixExpression(node);
}
Object visitPrefixExpression(PrefixExpression node) {
node.staticElement = null;
- node.element = null;
+ node.propagatedElement = null;
return super.visitPrefixExpression(node);
}
Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation node) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/error.dart b/pkg/analyzer_experimental/lib/src/generated/error.dart
index 9729ec5..22e3162 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 Comparable<ErrorSeverity> {
+class ErrorSeverity implements Enum<ErrorSeverity> {
/**
* The severity representing a non-error. This is never used for any error code, but is useful for
@@ -405,7 +405,7 @@
* The enumeration `ErrorProperty` defines the properties that can be associated with an
* [AnalysisError].
*/
-class ErrorProperty implements Comparable<ErrorProperty> {
+class ErrorProperty implements Enum<ErrorProperty> {
/**
* A property whose value is an array of [ExecutableElement] that should
@@ -428,7 +428,7 @@
* The enumeration `HintCode` defines the hints and coding recommendations for best practices
* which are not mentioned in the Dart Language Specification.
*/
-class HintCode implements Comparable<HintCode>, ErrorCode {
+class HintCode implements Enum<HintCode>, ErrorCode {
/**
* Dead code is code that is never reached, this can happen for instance if a statement follows a
@@ -450,10 +450,16 @@
* @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'");
+
+ /**
+ * Unused imports are imports which are never not used.
+ */
+ static final HintCode UNUSED_IMPORT = new HintCode('UNUSED_IMPORT', 3, "Unused import");
static final List<HintCode> values = [
DEAD_CODE,
DEAD_CODE_CATCH_FOLLOWING_CATCH,
- DEAD_CODE_ON_CATCH_SUBTYPE];
+ DEAD_CODE_ON_CATCH_SUBTYPE,
+ UNUSED_IMPORT];
/// The name of this enum constant, as declared in the enum declaration.
final String name;
@@ -515,7 +521,7 @@
*
* @coverage dart.engine.error
*/
-class ErrorType implements Comparable<ErrorType> {
+class ErrorType implements Enum<ErrorType> {
/**
* Extra analysis run over the code to follow best practices, which are not in the Dart Language
@@ -597,7 +603,7 @@
*
* @coverage dart.engine.error
*/
-class CompileTimeErrorCode implements Comparable<CompileTimeErrorCode>, ErrorCode {
+class CompileTimeErrorCode implements Enum<CompileTimeErrorCode>, ErrorCode {
/**
* 14.2 Exports: It is a compile-time error if a name <i>N</i> is re-exported by a library
@@ -611,28 +617,12 @@
static final CompileTimeErrorCode AMBIGUOUS_EXPORT = new CompileTimeErrorCode('AMBIGUOUS_EXPORT', 0, "The element '%s' is defined in the libraries '%s' and '%s'");
/**
- * 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and <i>N</i> is introduced
- * into the top level scope <i>L</i> by more than one import then:
- * <ol>
- * * It is a static warning if <i>N</i> is used as a type annotation.
- * * In checked mode, it is a dynamic error if <i>N</i> is used as a type annotation and
- * referenced during a subtype test.
- * * Otherwise, it is a compile-time error.
- * </ol>
- *
- * @param ambiguousElementName the name of the ambiguous element
- * @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_IMPORT = new CompileTimeErrorCode('AMBIGUOUS_IMPORT', 1, "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
* parameter.
*
* @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', 2, "'%s' 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");
/**
* 12.14.2 Binding Actuals to Formals: In checked mode, it is a dynamic type error if
@@ -645,57 +635,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', 3, "The argument type '%s' cannot be assigned to the parameter type '%s'");
+ 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'");
/**
* 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', 4, "The built-in identifier '%s' cannot be as a type");
+ 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");
/**
* 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', 5, "The built-in identifier '%s' cannot be used as a type name");
+ 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");
/**
* 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', 6, "The built-in identifier '%s' cannot be used as a type alias name");
+ 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");
/**
* 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', 7, "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('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', 8, "The switch case expression type '%s' cannot override the == operator");
+ 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");
/**
* 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', 9, "");
+ static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = new CompileTimeErrorCode('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', 10, "Class '%s' cannot have both getter '%s.%s' and method with the same name");
+ 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");
/**
* 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', 11, "Class '%s' cannot have both method '%s.%s' and getter with the same name");
+ 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");
/**
* 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
@@ -703,7 +693,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', 12, "'%s' cannot be used to name a constructor and a field in this 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");
/**
* 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
@@ -711,13 +701,13 @@
* 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', 13, "'%s' cannot be used to name a constructor and a method in this 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");
/**
* 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', 14, "'const' constructors cannot throw exceptions");
+ static final CompileTimeErrorCode CONST_CONSTRUCTOR_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_CONSTRUCTOR_THROWS_EXCEPTION', 13, "'const' constructors cannot throw exceptions");
/**
* 7.6.3 Constant Constructors: It is a compile-time error if a constant constructor is declared
@@ -725,7 +715,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', 15, "Cannot define the 'const' constructor for a class with non-final fields");
+ 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");
/**
* 7.6.1 Generative Constructors: In checked mode, it is a dynamic type error if o is not
@@ -738,63 +728,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', 16, "The initializer type '%s' cannot be assigned to the field type '%s'");
+ 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'");
/**
* 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', 17, "Parameters cannot be 'const'");
+ static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErrorCode('CONST_FORMAL_PARAMETER', 16, "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', 18, "'const' variables must be constant value");
+ static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 17, "'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', 19, "Only static fields can be declared as 'const'");
+ static final CompileTimeErrorCode CONST_INSTANCE_FIELD = new CompileTimeErrorCode('CONST_INSTANCE_FIELD', 18, "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', 20, "An expression of type 'bool' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL = new CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL', 19, "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', 21, "An expression of type 'bool', 'num', 'String' or 'null' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_BOOL_NUM_STRING = new CompileTimeErrorCode('CONST_EVAL_TYPE_BOOL_NUM_STRING', 20, "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', 22, "An expression of type 'int' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_INT = new CompileTimeErrorCode('CONST_EVAL_TYPE_INT', 21, "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', 23, "An expression of type 'num' was expected");
+ static final CompileTimeErrorCode CONST_EVAL_TYPE_NUM = new CompileTimeErrorCode('CONST_EVAL_TYPE_NUM', 22, "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', 24, "Evaluation of this constant expression causes exception");
+ static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', 23, "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', 25, "Evaluation of this constant expression throws IntegerDivisionByZeroException");
+ static final CompileTimeErrorCode CONST_EVAL_THROWS_IDBZE = new CompileTimeErrorCode('CONST_EVAL_THROWS_IDBZE', 24, "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>, …,
@@ -807,7 +797,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', 26, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
+ static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 25, "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>,
@@ -815,13 +805,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', 27, "The constructor being called is not a 'const' constructor");
+ static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode('CONST_WITH_NON_CONST', 26, "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', 28, "Arguments of a constant creation must be constant expressions");
+ 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");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class accessible in the current
@@ -834,12 +824,12 @@
*
* @param name the name of the non-type element
*/
- static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 29, "The name '%s' is not a class");
+ static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 28, "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', 30, "The constant creation cannot use a type parameter");
+ static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', 29, "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
@@ -848,7 +838,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', 31, "The class '%s' does not have a constant constructor '%s'");
+ static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 30, "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
@@ -856,19 +846,19 @@
*
* @param typeName the name of the type
*/
- static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 32, "The class '%s' does not have a default constant constructor");
+ static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT', 31, "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', 33, "Default values aren't allowed in typedefs");
+ 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");
/**
* 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', 34, "The default constructor is already defined");
+ static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_DEFAULT = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_DEFAULT', 33, "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
@@ -876,7 +866,7 @@
*
* @param duplicateName the name of the duplicate entity
*/
- static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME', 35, "The constructor with name '%s' is already defined");
+ static final CompileTimeErrorCode DUPLICATE_CONSTRUCTOR_NAME = new CompileTimeErrorCode('DUPLICATE_CONSTRUCTOR_NAME', 34, "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
@@ -889,7 +879,7 @@
*
* @param duplicateName the name of the duplicate entity
*/
- static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 36, "The name '%s' is already defined");
+ static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 35, "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
@@ -901,21 +891,21 @@
* @param name the name of the conflicting members
* @see #DUPLICATE_DEFINITION
*/
- static final CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = new CompileTimeErrorCode('DUPLICATE_DEFINITION_INHERITANCE', 37, "The name '%s' is already defined in '%s'");
+ static final CompileTimeErrorCode DUPLICATE_DEFINITION_INHERITANCE = new CompileTimeErrorCode('DUPLICATE_DEFINITION_INHERITANCE', 36, "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', 38, "The argument for the named parameter '%s' was already specified");
+ static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', 37, "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', 39, "The library %s is internal and cannot be exported");
+ static final CompileTimeErrorCode EXPORT_INTERNAL_LIBRARY = new CompileTimeErrorCode('EXPORT_INTERNAL_LIBRARY', 38, "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
@@ -923,7 +913,7 @@
*
* @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 40, "The exported library '%s' must not have a part-of directive");
+ 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");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a class <i>C</i> includes
@@ -931,7 +921,7 @@
*
* @param typeName the name of the superclass that was not found
*/
- static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 41, "Classes can only extend other classes");
+ static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 40, "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.
@@ -950,7 +940,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', 42, "Classes cannot extend '%s'");
+ static final CompileTimeErrorCode EXTENDS_DISALLOWED_CLASS = new CompileTimeErrorCode('EXTENDS_DISALLOWED_CLASS', 41, "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 >
@@ -962,28 +952,28 @@
* @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', 43, "%d positional arguments expected, but %d found");
+ static final CompileTimeErrorCode EXTRA_POSITIONAL_ARGUMENTS = new CompileTimeErrorCode('EXTRA_POSITIONAL_ARGUMENTS', 42, "%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', 44, "The field '%s' cannot be initialized twice in the same constructor");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 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', 45, "Values cannot be set in the constructor if they are final, and have already been set");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 44, "Values cannot be set in the constructor if they are final, and have already been set");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if <i>k</i>'s initializer list contains an initializer for a variable that is initialized
* by means of an initializing formal of <i>k</i>.
*/
- static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 46, "Fields cannot be initialized in both the parameter list and the initializers");
+ static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 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
@@ -991,7 +981,7 @@
*
* @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', 47, "'%s' is final and was given a value when it was declared, so it cannot be set to a new value");
+ static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 46, "'%s' is final and was given a value when it was declared, so it cannot be set to a new value");
/**
* 5 Variables: It is a compile-time error if a final instance variable that has is initialized by
@@ -1000,19 +990,19 @@
*
* @param name the name of the field in question
*/
- static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 48, "'%s' is a final field and so can only be set once");
+ static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 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', 49, "Initializing formal fields cannot be used in factory constructors");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_FACTORY_CONSTRUCTOR = new CompileTimeErrorCode('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', 50, "Initializing formal fields can only be used in constructors");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode('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
@@ -1021,7 +1011,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', 51, "The redirecting constructor cannot have a field initializer");
+ static final CompileTimeErrorCode FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR = new CompileTimeErrorCode('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
@@ -1029,7 +1019,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', 52, "'%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('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.
@@ -1048,13 +1038,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', 53, "Classes cannot implement '%s'");
+ static final CompileTimeErrorCode IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode('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', 54, "Classes cannot implement 'dynamic'");
+ static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCode('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>
@@ -1063,7 +1053,7 @@
*
* @param typeName the name of the interface that was not found
*/
- static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode('IMPLEMENTS_NON_CLASS', 55, "Classes can only implement other classes");
+ static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode('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
@@ -1071,7 +1061,7 @@
*
* @param className the name of the class that is implemented more than once
*/
- static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode('IMPLEMENTS_REPEATED', 56, "'%s' can only be implemented once");
+ static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode('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
@@ -1079,7 +1069,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', 57, "'%s' cannot be used 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");
/**
* 7.6.1 Generative Constructors: Note that <b>this</b> is not in scope on the right hand side of
@@ -1091,14 +1081,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', 58, "The 'this' expression cannot be implicitly used in initializers");
+ 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");
/**
* 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', 59, "The library %s is internal and cannot be imported");
+ static final CompileTimeErrorCode IMPORT_INTERNAL_LIBRARY = new CompileTimeErrorCode('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
@@ -1106,7 +1096,7 @@
*
* @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY', 60, "The imported library '%s' must not have a part-of directive");
+ 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");
/**
* 13.9 Switch: It is a compile-time error if values of the expressions <i>e<sub>k</sub></i> are
@@ -1115,7 +1105,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', 61, "Case expressions must have the same types, '%s' is not a %s'");
+ 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'");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
@@ -1126,7 +1116,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', 62, "'%s' is not a variable in the enclosing class");
+ 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");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
@@ -1137,7 +1127,7 @@
* enclosing class
* @see #INITIALIZING_FORMAL_FOR_STATIC_FIELD
*/
- static final CompileTimeErrorCode INITIALIZER_FOR_STATIC_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_STATIC_FIELD', 63, "'%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('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
@@ -1149,7 +1139,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', 64, "'%s' is not a variable in the enclosing class");
+ 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");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
@@ -1160,20 +1150,20 @@
* enclosing class
* @see #INITIALIZER_FOR_STATIC_FIELD
*/
- static final CompileTimeErrorCode INITIALIZING_FORMAL_FOR_STATIC_FIELD = new CompileTimeErrorCode('INITIALIZING_FORMAL_FOR_STATIC_FIELD', 65, "'%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('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', 66, "Instance member cannot be accessed from static method");
+ static final CompileTimeErrorCode INSTANCE_MEMBER_ACCESS_FROM_STATIC = new CompileTimeErrorCode('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', 67, "Annotation can be only constant variable or constant constructor invocation");
+ static final CompileTimeErrorCode INVALID_ANNOTATION = new CompileTimeErrorCode('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
@@ -1181,19 +1171,19 @@
*
* See TODOs in ConstantVisitor
*/
- static final CompileTimeErrorCode INVALID_CONSTANT = new CompileTimeErrorCode('INVALID_CONSTANT', 68, "Invalid constant value");
+ static final CompileTimeErrorCode INVALID_CONSTANT = new CompileTimeErrorCode('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', 69, "Invalid constructor name");
+ static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeErrorCode('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', 70, "The name of the immediately enclosing class expected");
+ 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
@@ -1203,7 +1193,7 @@
* @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', 71, "Missing the named parameter '%s' to match the overridden method from '%s'");
+ 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
@@ -1213,7 +1203,7 @@
* @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', 72, "Must have at least %d optional parameters to match the overridden method from '%s'");
+ 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
@@ -1223,20 +1213,20 @@
* @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', 73, "Must have at exactly %d required parameters to match the overridden method from '%s'");
+ 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'");
/**
* 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', 74, "Invalid reference to 'this' expression");
+ 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', 75, "The first type argument to a map literal must be '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'");
/**
* 12.6 Lists: It is a compile time error if the type argument of a constant list literal includes
@@ -1244,7 +1234,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', 76, "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('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 75, "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
@@ -1252,7 +1242,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', 77, "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('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 76, "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
@@ -1267,7 +1257,7 @@
* @param uri the URI that is invalid
* @see #URI_DOES_NOT_EXIST
*/
- static final CompileTimeErrorCode INVALID_URI = new CompileTimeErrorCode('INVALID_URI', 78, "Invalid URI syntax: '%s'");
+ static final CompileTimeErrorCode INVALID_URI = new CompileTimeErrorCode('INVALID_URI', 77, "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
@@ -1278,7 +1268,7 @@
*
* @param labelName the name of the unresolvable label
*/
- static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', 79, "Cannot reference label '%s' declared in an outer method");
+ static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', 78, "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
@@ -1289,7 +1279,7 @@
*
* @param labelName the name of the unresolvable label
*/
- static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('LABEL_UNDEFINED', 80, "Cannot reference undefined label '%s'");
+ static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('LABEL_UNDEFINED', 79, "Cannot reference undefined label '%s'");
/**
* 12.6 Lists: A run-time list literal <<i>E</i>> [<i>e<sub>1</sub></i> ...
@@ -1305,7 +1295,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', 81, "The element type '%s' cannot be assigned to the list type '%s'");
+ 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'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -1321,7 +1311,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', 82, "The element type '%s' cannot be assigned to the map key type '%s'");
+ 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'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -1337,13 +1327,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', 83, "The element type '%s' cannot be assigned to the map value type '%s'");
+ 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'");
/**
* 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', 84, "Class members cannot have the same name as the enclosing class");
+ 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");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
@@ -1351,17 +1341,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', 85, "'%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('METHOD_AND_GETTER_WITH_SAME_NAME', 84, "'%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', 86, "List literals must be prefixed with 'const' when used as a constant expression");
+ 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");
/**
* 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', 87, "Map literals must be prefixed with 'const' when used as a constant expression");
+ 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");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin explicitly declares a
@@ -1369,7 +1359,7 @@
*
* @param typeName the name of the mixin that is invalid
*/
- static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', 88, "The class '%s' cannot be used as a mixin because it declares a constructor");
+ 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");
/**
* 9 Mixins: It is a compile-time error if a mixin is derived from a class whose superclass is not
@@ -1377,43 +1367,43 @@
*
* @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', 89, "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('MIXIN_INHERITS_FROM_NOT_OBJECT', 88, "The class '%s' cannot be used as a mixin because it extends a class other than Object");
/**
* 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', 90, "Classes can only mixin other classes");
+ static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCode('MIXIN_OF_NON_CLASS', 89, "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', 91, "The class '%s' cannot be used as a mixin because it references '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'");
/**
* 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', 92, "Mixin can only be applied to class");
+ static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', 91, "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', 93, "Constructor may have at most one 'this' redirection");
+ static final CompileTimeErrorCode MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS = new CompileTimeErrorCode('MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS', 92, "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', 94, "Constructor may have at most one 'super' initializer");
+ static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', 93, "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', 95, "Annotation creation must have arguments");
+ static final CompileTimeErrorCode NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS = new CompileTimeErrorCode('NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS', 94, "Annotation creation must have arguments");
/**
* 7.6.1 Generative Constructors: If no superinitializer is provided, an implicit superinitializer
@@ -1423,7 +1413,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', 96, "The class '%s' does not have a default constructor");
+ 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");
/**
* 7.6 Constructors: Iff no constructor is specified for a class <i>C</i>, it implicitly has a
@@ -1432,13 +1422,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', 97, "The class '%s' does not have a default constructor");
+ 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");
/**
* 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', 98, "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('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 97, "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> …
@@ -1449,44 +1439,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', 99, "Case expressions must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTimeErrorCode('NON_CONSTANT_CASE_EXPRESSION', 98, "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', 100, "Default values of an optional parameter must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', 99, "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', 101, "'const' lists must have all constant values");
+ static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', 100, "'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', 102, "The keys in a map must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorCode('NON_CONSTANT_MAP_KEY', 101, "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', 103, "The values in a 'const' map must be constant");
+ static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', 102, "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', 104, "Annotation creation can use only 'const' constructor");
+ static final CompileTimeErrorCode NON_CONSTANT_ANNOTATION_CONSTRUCTOR = new CompileTimeErrorCode('NON_CONSTANT_ANNOTATION_CONSTRUCTOR', 103, "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', 105, "Initializer expressions in constant constructors must be constants");
+ static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', 104, "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>.
@@ -1497,7 +1487,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', 106, "%d required argument(s) expected, but %d found");
+ static final CompileTimeErrorCode NOT_ENOUGH_REQUIRED_ARGUMENTS = new CompileTimeErrorCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', 105, "%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
@@ -1505,17 +1495,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', 107, "The generative constructor '%s' expected, but factory found");
+ static final CompileTimeErrorCode NON_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('NON_GENERATIVE_CONSTRUCTOR', 106, "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', 108, "");
+ static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 107, "");
/**
* 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', 109, "Optional parameters are not allowed when defining 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");
/**
* 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
@@ -1523,25 +1513,25 @@
*
* @param uri the uri pointing to a non-library declaration
*/
- static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode('PART_OF_NON_PART', 110, "The included part '%s' must have a part-of directive");
+ static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode('PART_OF_NON_PART', 109, "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', 111, "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('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");
/**
* 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', 112, "Named optional parameters cannot start with an underscore");
+ static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER', 111, "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', 113, "");
+ static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', 112, "");
/**
* 7.6.1 Generative Constructors: A generative constructor may be redirecting, in which case its
@@ -1552,13 +1542,13 @@
*
* https://code.google.com/p/dart/issues/detail?id=954
*/
- static final CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = new CompileTimeErrorCode('RECURSIVE_CONSTRUCTOR_REDIRECT', 114, "Cycle in redirecting generative constructors");
+ static final CompileTimeErrorCode RECURSIVE_CONSTRUCTOR_REDIRECT = new CompileTimeErrorCode('RECURSIVE_CONSTRUCTOR_REDIRECT', 113, "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', 115, "Cycle in redirecting factory constructors");
+ static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT', 114, "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
@@ -1571,7 +1561,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', 116, "'%s' cannot be a superinterface of itself: %s");
+ static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', 115, "'%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
@@ -1583,7 +1573,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', 117, "'%s' cannot extend itself");
+ static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS', 116, "'%s' cannot extend itself");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a class <i>C</i> is a
@@ -1595,31 +1585,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', 118, "'%s' cannot implement itself");
+ static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS', 117, "'%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', 119, "Constant factory constructor cannot delegate to a non-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");
/**
* 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', 120, "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('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 119, "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', 121, "rethrow must be inside of a catch clause");
+ static final CompileTimeErrorCode RETHROW_OUTSIDE_CATCH = new CompileTimeErrorCode('RETHROW_OUTSIDE_CATCH', 120, "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', 122, "Constructors cannot return a value");
+ static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', 121, "Constructors cannot return a value");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
@@ -1629,19 +1619,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', 123, "Invalid context for 'super' invocation");
+ static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeErrorCode('SUPER_IN_INVALID_CONTEXT', 122, "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', 124, "The redirecting constructor cannot have a 'super' initializer");
+ static final CompileTimeErrorCode SUPER_IN_REDIRECTING_CONSTRUCTOR = new CompileTimeErrorCode('SUPER_IN_REDIRECTING_CONSTRUCTOR', 123, "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', 125, "");
+ static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', 124, "");
/**
* 12.11 Instance Creation: It is a static type warning if any of the type arguments to a
@@ -1660,19 +1650,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', 126, "'%s' does not extend '%s'");
+ static final CompileTimeErrorCode TYPE_ARGUMENT_NOT_MATCHING_BOUNDS = new CompileTimeErrorCode('TYPE_ARGUMENT_NOT_MATCHING_BOUNDS', 125, "'%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', 127, "Type alias cannot reference itself directly or via other typedefs");
+ 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");
/**
* 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', 128, "Undefined class '%s'");
+ static final CompileTimeErrorCode UNDEFINED_CLASS = new CompileTimeErrorCode('UNDEFINED_CLASS', 127, "Undefined class '%s'");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the superinitializer appears
@@ -1680,7 +1670,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', 129, "The class '%s' does not have a generative constructor '%s'");
+ static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 128, "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
@@ -1688,7 +1678,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_DEFAULT = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT', 130, "The class '%s' does not have a default generative constructor");
+ 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");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
@@ -1700,7 +1690,7 @@
*
* @param name the name of the requested named parameter
*/
- static final CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = new CompileTimeErrorCode('UNDEFINED_NAMED_PARAMETER', 131, "The named parameter '%s' is not defined");
+ static final CompileTimeErrorCode UNDEFINED_NAMED_PARAMETER = new CompileTimeErrorCode('UNDEFINED_NAMED_PARAMETER', 130, "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
@@ -1715,7 +1705,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', 132, "Target of URI does not exist: '%s'");
+ static final CompileTimeErrorCode URI_DOES_NOT_EXIST = new CompileTimeErrorCode('URI_DOES_NOT_EXIST', 131, "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
@@ -1727,7 +1717,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', 133, "URIs cannot use string interpolation");
+ static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErrorCode('URI_WITH_INTERPOLATION', 132, "URIs cannot use string interpolation");
/**
* 7.1.1 Operators: It is a compile-time error if the arity of the user-declared operator []= is
@@ -1740,7 +1730,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', 134, "Operator '%s' should declare exactly %d parameter(s), but %d found");
+ 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");
/**
* 7.1.1 Operators: It is a compile time error if the arity of the user-declared operator - is not
@@ -1748,16 +1738,15 @@
*
* @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', 135, "Operator '-' should declare 0 or 1 parameter, but %d found");
+ 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");
/**
* 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', 136, "Setters should declare exactly one required parameter");
+ 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 List<CompileTimeErrorCode> values = [
AMBIGUOUS_EXPORT,
- AMBIGUOUS_IMPORT,
ARGUMENT_DEFINITION_TEST_NON_PARAMETER,
ARGUMENT_TYPE_NOT_ASSIGNABLE,
BUILT_IN_IDENTIFIER_AS_TYPE,
@@ -1926,7 +1915,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 Comparable<PubSuggestionCode>, ErrorCode {
+class PubSuggestionCode implements Enum<PubSuggestionCode>, ErrorCode {
/**
* It is a bad practice for a source file in a package "lib" directory hierarchy to traverse
@@ -1989,16 +1978,16 @@
*
* @coverage dart.engine.error
*/
-class StaticWarningCode implements Comparable<StaticWarningCode>, ErrorCode {
+class StaticWarningCode implements Enum<StaticWarningCode>, ErrorCode {
/**
* 14.1 Imports: If a name <i>N</i> is referenced by a library <i>L</i> and <i>N</i> is introduced
* into the top level scope <i>L</i> by more than one import then:
* <ol>
- * * It is a static warning if <i>N</i> is used as a type annotation.
- * * In checked mode, it is a dynamic error if <i>N</i> is used as a type annotation and
- * referenced during a subtype test.
- * * Otherwise, it is a compile-time error.
+ * * A static warning occurs.
+ * * If <i>N</i> is referenced as a function, getter or setter, a <i>NoSuchMethodError</i> is
+ * raised.
+ * * If <i>N</i> is referenced as a type, it is treated as a malformed type.
* </ol>
*
* @param ambiguousTypeName the name of the ambiguous type
@@ -2034,26 +2023,35 @@
* 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.
+ *
+ * A constant variable is always implicitly final.
*/
- static final StaticWarningCode ASSIGNMENT_TO_FINAL = new StaticWarningCode('ASSIGNMENT_TO_FINAL', 2, "Final variables cannot be assigned a value");
+ static final StaticWarningCode ASSIGNMENT_TO_CONST = new StaticWarningCode('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");
/**
* 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', 3, "Methods cannot be assigned a value");
+ static final StaticWarningCode ASSIGNMENT_TO_METHOD = new StaticWarningCode('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', 4, "The last statement of the 'case' should be 'break', 'continue', 'return' or 'throw'");
+ 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'");
/**
* 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', 5, "The name '%s' is not a type and cannot be used in an 'as' expression");
+ 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");
/**
* 16.1.2 Comments: A token of the form <i>[new c](uri)</i> will be replaced by a link in the
@@ -2062,7 +2060,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', 6, "");
+ static final StaticWarningCode COMMENT_REFERENCE_CONSTRUCTOR_NOT_VISIBLE = new StaticWarningCode('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
@@ -2070,19 +2068,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', 7, "");
+ static final StaticWarningCode COMMENT_REFERENCE_IDENTIFIER_NOT_VISIBLE = new StaticWarningCode('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', 8, "");
+ static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_CONSTRUCTOR = new StaticWarningCode('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', 9, "");
+ static final StaticWarningCode COMMENT_REFERENCE_UNDECLARED_IDENTIFIER = new StaticWarningCode('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
@@ -2090,13 +2088,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', 10, "");
+ static final StaticWarningCode COMMENT_REFERENCE_URI_NOT_LIBRARY = new StaticWarningCode('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', 11, "'%s' must have a method body because '%s' is not abstract");
+ 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");
/**
* 7.2 Getters: It is a static warning if a class <i>C</i> declares an instance getter named
@@ -2105,7 +2103,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', 12, "Superclass '%s' declares static member with the same name");
+ 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");
/**
* 7.3 Setters: It is a static warning if a class <i>C</i> declares an instance setter named
@@ -2114,31 +2112,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', 13, "Superclass '%s' declares static member with the same name");
+ 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");
/**
* 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', 14, "Class '%s' declares non-static setter with the same name");
+ 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");
/**
* 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', 15, "Class '%s' declares non-static member with the same name");
+ 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");
/**
* 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', 16, "Abstract classes cannot be created with a 'const' expression");
+ static final StaticWarningCode CONST_WITH_ABSTRACT_CLASS = new StaticWarningCode('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', 17, "Keys in a map cannot be equal");
+ static final StaticWarningCode EQUAL_KEYS_IN_MAP = new StaticWarningCode('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.
@@ -2147,7 +2145,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', 18, "The exported libraries '%s' and '%s' should not have the same name '%s'");
+ 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'");
/**
* 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m < h</i> or if <i>m >
@@ -2157,7 +2155,7 @@
* @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', 19, "%d positional arguments expected, but %d found");
+ static final StaticWarningCode EXTRA_POSITIONAL_ARGUMENTS = new StaticWarningCode('EXTRA_POSITIONAL_ARGUMENTS', 20, "%d positional arguments expected, but %d found");
/**
* 7.6.1 Generative Constructors: Execution of an initializer of the form <b>this</b>.<i>v</i> =
@@ -2174,7 +2172,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', 20, "The initializer type '%s' cannot be assigned to the field type '%s'");
+ 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'");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
@@ -2183,7 +2181,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', 21, "The parameter type '%s' is incompatable with the field type '%s'");
+ 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'");
/**
* 5 Variables: It is a static warning if a library, static or local variable <i>v</i> is final
@@ -2200,7 +2198,7 @@
*
* @param name the name of the uninitialized final variable
*/
- static final StaticWarningCode FINAL_NOT_INITIALIZED = new StaticWarningCode('FINAL_NOT_INITIALIZED', 22, "The final variable '%s' must be initialized");
+ static final StaticWarningCode FINAL_NOT_INITIALIZED = new StaticWarningCode('FINAL_NOT_INITIALIZED', 23, "The final variable '%s' must be initialized");
/**
* 14.1 Imports: It is a static warning to import two different libraries with the same name.
@@ -2209,7 +2207,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', 23, "The imported libraries '%s' and '%s' should not have the same name '%s'");
+ static final StaticWarningCode IMPORT_DUPLICATED_LIBRARY_NAME = new StaticWarningCode('IMPORT_DUPLICATED_LIBRARY_NAME', 24, "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>,
@@ -2221,7 +2219,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', 24, "'%s' is inherited as a getter and also a method");
+ static final StaticWarningCode INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD = new StaticWarningCode('INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD', 25, "'%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
@@ -2231,7 +2229,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', 25, "'%s' collides with a static member in the superclass '%s'");
+ static final StaticWarningCode INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC = new StaticWarningCode('INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC', 26, "'%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
@@ -2243,7 +2241,7 @@
* @param className the name of the class where the overridden getter is declared
* @see #INVALID_METHOD_OVERRIDE_RETURN_TYPE
*/
- static final StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 26, "The return type '%s' is not assignable to '%s' as required from getter it is overriding from '%s'");
+ static final StaticWarningCode INVALID_GETTER_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_GETTER_OVERRIDE_RETURN_TYPE', 27, "The return type '%s' is not assignable to '%s' as required from getter it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -2254,7 +2252,7 @@
* actualParamTypeName
* @param className the name of the class where the overridden method is declared
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 27, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE', 28, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -2266,7 +2264,7 @@
* @param className the name of the class where the overridden method is declared
* @see #INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 28, "The parameter type '%s' is not assignable to '%s' as required by the method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE', 29, "The parameter type '%s' is not assignable to '%s' as required by the method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -2277,7 +2275,7 @@
* actualParamTypeName
* @param className the name of the class where the overridden method is declared
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 29, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE', 30, "The parameter type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -2289,7 +2287,7 @@
* @param className the name of the class where the overridden method is declared
* @see #INVALID_GETTER_OVERRIDE_RETURN_TYPE
*/
- static final StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 30, "The return type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
+ static final StaticWarningCode INVALID_METHOD_OVERRIDE_RETURN_TYPE = new StaticWarningCode('INVALID_METHOD_OVERRIDE_RETURN_TYPE', 31, "The return type '%s' is not assignable to '%s' as required from method it is overriding from '%s'");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
@@ -2297,7 +2295,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', 31, "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('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED', 32, "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
@@ -2305,7 +2303,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_POSITIONAL = new StaticWarningCode('INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL', 32, "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('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");
/**
* 7.3 Setters: It is a static warning if a setter <i>m1</i> overrides a setter <i>m2</i> and the
@@ -2317,7 +2315,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', 33, "The parameter type '%s' is not assignable to '%s' as required by the setter it is overriding from '%s'");
+ static final StaticWarningCode INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE = new StaticWarningCode('INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE', 34, "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> ...
@@ -2333,7 +2331,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', 34, "The element type '%s' cannot be assigned to the list type '%s'");
+ 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'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -2349,7 +2347,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', 35, "The element type '%s' cannot be assigned to the map key type '%s'");
+ 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'");
/**
* 12.7 Map: A run-time map literal <<i>K</i>, <i>V</i>> [<i>k<sub>1</sub></i> :
@@ -2365,20 +2363,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', 36, "The element type '%s' cannot be assigned to the map value type '%s'");
+ 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'");
/**
* 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', 37, "The parameter type for setter '%s' is %s which is not assignable to its getter (of type %s)");
+ static final StaticWarningCode MISMATCHED_GETTER_AND_SETTER_TYPES = new StaticWarningCode('MISMATCHED_GETTER_AND_SETTER_TYPES', 38, "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', 38, "Abstract classes cannot be created with a 'new' expression");
+ static final StaticWarningCode NEW_WITH_ABSTRACT_CLASS = new StaticWarningCode('NEW_WITH_ABSTRACT_CLASS', 39, "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.
@@ -2389,7 +2387,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', 39, "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('NEW_WITH_INVALID_TYPE_PARAMETERS', 40, "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,
@@ -2397,7 +2395,7 @@
*
* @param name the name of the non-type element
*/
- static final StaticWarningCode NEW_WITH_NON_TYPE = new StaticWarningCode('NEW_WITH_NON_TYPE', 40, "The name '%s' is not a class");
+ static final StaticWarningCode NEW_WITH_NON_TYPE = new StaticWarningCode('NEW_WITH_NON_TYPE', 41, "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:
@@ -2408,7 +2406,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', 41, "The class '%s' does not have a constructor '%s'");
+ static final StaticWarningCode NEW_WITH_UNDEFINED_CONSTRUCTOR = new StaticWarningCode('NEW_WITH_UNDEFINED_CONSTRUCTOR', 42, "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:
@@ -2419,15 +2417,19 @@
* 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', 42, "The class '%s' does not have a default constructor");
+ 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");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
* abstract method.
*
- * 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
- * <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
- * corresponding instance member <i>m</i>.
+ * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declare its own
+ * <i>noSuchMethod()</i> method. It is a static warning if the implicit interface of <i>C</i>
+ * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
+ * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
+ *
+ * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
+ * inherited in a concrete class unless that member overrides a concrete one.
*
* @param memberName the name of the first member
* @param memberName the name of the second member
@@ -2435,61 +2437,77 @@
* @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', 43, "Missing inherited members: '%s', '%s', '%s', '%s' and %d more");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', 44, "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
* abstract method.
*
- * 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
- * <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
- * corresponding instance member <i>m</i>.
+ * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declare its own
+ * <i>noSuchMethod()</i> method. It is a static warning if the implicit interface of <i>C</i>
+ * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
+ * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
+ *
+ * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
+ * inherited in a concrete class unless that member overrides a concrete one.
*
* @param memberName the name of the first member
* @param memberName the name of the second member
* @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', 44, "Missing inherited members: '%s', '%s', '%s' and '%s'");
+ 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'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
* abstract method.
*
- * 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
- * <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
- * corresponding instance member <i>m</i>.
+ * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declare its own
+ * <i>noSuchMethod()</i> method. It is a static warning if the implicit interface of <i>C</i>
+ * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
+ * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
+ *
+ * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
+ * inherited in a concrete class unless that member overrides a concrete one.
*
* @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', 45, "Missing inherited member '%s'");
+ static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = new StaticWarningCode('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', 46, "Missing inherited member '%s'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
* abstract method.
*
- * 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
- * <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
- * corresponding instance member <i>m</i>.
+ * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declare its own
+ * <i>noSuchMethod()</i> method. It is a static warning if the implicit interface of <i>C</i>
+ * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
+ * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
+ *
+ * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
+ * inherited in a concrete class unless that member overrides a concrete one.
*
* @param memberName the name of the first member
* @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', 46, "Missing inherited members: '%s', '%s' and '%s'");
+ 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'");
/**
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
* abstract method.
*
- * 7.10 Superinterfaces: It is a static warning if the implicit interface of a non-abstract class
- * <i>C</i> includes an instance member <i>m</i> and <i>C</i> does not declare or inherit a
- * corresponding instance member <i>m</i>.
+ * 7.10 Superinterfaces: Let <i>C</i> be a concrete class that does not declare its own
+ * <i>noSuchMethod()</i> method. It is a static warning if the implicit interface of <i>C</i>
+ * includes an instance member <i>m</i> of type <i>F</i> and <i>C</i> does not declare or inherit
+ * a corresponding instance member <i>m</i> of type <i>F'</i> such that <i>F' <: F</i>.
+ *
+ * 7.4 Abstract Instance Members: It is a static warning if an abstract member is declared or
+ * inherited in a concrete class unless that member overrides a concrete one.
*
* @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', 47, "Missing inherited members: '%s' and '%s'");
+ 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'");
/**
* 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
@@ -2499,18 +2517,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', 48, "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('NON_TYPE_IN_CATCH_CLAUSE', 49, "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', 49, "The return type of the operator []= must be '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'");
/**
* 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', 50, "The return type of the setter must be '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'");
/**
* 15.1 Static Types: A type <i>T</i> is malformed iff: * <i>T</i> has the form <i>id</i> or the
@@ -2524,7 +2542,7 @@
*
* @param nonTypeName the name that is not a type
*/
- static final StaticWarningCode NOT_A_TYPE = new StaticWarningCode('NOT_A_TYPE', 51, "%s is not a type");
+ static final StaticWarningCode NOT_A_TYPE = new StaticWarningCode('NOT_A_TYPE', 52, "%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 >
@@ -2534,7 +2552,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', 52, "%d required argument(s) expected, but %d found");
+ static final StaticWarningCode NOT_ENOUGH_REQUIRED_ARGUMENTS = new StaticWarningCode('NOT_ENOUGH_REQUIRED_ARGUMENTS', 53, "%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
@@ -2543,7 +2561,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', 53, "Expected this library to be part of '%s', not '%s'");
+ static final StaticWarningCode PART_OF_DIFFERENT_LIBRARY = new StaticWarningCode('PART_OF_DIFFERENT_LIBRARY', 54, "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
@@ -2552,7 +2570,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', 54, "The redirected constructor '%s' has incompatible parameters with '%s'");
+ 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'");
/**
* 7.6.2 Factories: It is a static warning if the function type of <i>k'</i> is not a subtype of
@@ -2561,21 +2579,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', 55, "The return type '%s' of the redirected constructor is not a subclass of '%s'");
+ 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'");
/**
* 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', 56, "The constructor '%s' could not be found in '%s'");
+ static final StaticWarningCode REDIRECT_TO_MISSING_CONSTRUCTOR = new StaticWarningCode('REDIRECT_TO_MISSING_CONSTRUCTOR', 57, "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', 57, "The name '%s' is not a type and cannot be used in a redirected constructor");
+ 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");
/**
* 13.11 Return: Let <i>f</i> be the function immediately enclosing a return statement of the form
@@ -2585,7 +2603,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', 58, "Missing return value after 'return'");
+ static final StaticWarningCode RETURN_WITHOUT_VALUE = new StaticWarningCode('RETURN_WITHOUT_VALUE', 59, "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
@@ -2593,19 +2611,19 @@
*
* @param memberName the name of the instance member
*/
- static final StaticWarningCode STATIC_ACCESS_TO_INSTANCE_MEMBER = new StaticWarningCode('STATIC_ACCESS_TO_INSTANCE_MEMBER', 59, "Instance member '%s' cannot be accessed using static access");
+ 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");
/**
* 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', 60, "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('SWITCH_EXPRESSION_NOT_ASSIGNABLE', 61, "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', 61, "The name '%s' is not a type and cannot be used in an 'is' expression");
+ 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");
/**
* 10 Generics: However, a type parameter is considered to be a malformed type when referenced by
@@ -2614,7 +2632,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', 62, "Static members cannot reference type parameters");
+ static final StaticWarningCode TYPE_PARAMETER_REFERENCED_BY_STATIC = new StaticWarningCode('TYPE_PARAMETER_REFERENCED_BY_STATIC', 63, "Static members cannot reference type parameters");
/**
* 12.15.3 Static Invocation: A static method invocation <i>i</i> has the form
@@ -2624,12 +2642,12 @@
*
* @param undefinedClassName the name of the undefined class
*/
- static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 63, "Undefined class '%s'");
+ static final StaticWarningCode UNDEFINED_CLASS = new StaticWarningCode('UNDEFINED_CLASS', 64, "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', 64, "Undefined class 'boolean'; did you mean 'bool'?");
+ static final StaticWarningCode UNDEFINED_CLASS_BOOLEAN = new StaticWarningCode('UNDEFINED_CLASS_BOOLEAN', 65, "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
@@ -2639,7 +2657,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', 65, "There is no such getter '%s' in '%s'");
+ static final StaticWarningCode UNDEFINED_GETTER = new StaticWarningCode('UNDEFINED_GETTER', 66, "There is no such getter '%s' in '%s'");
/**
* 12.30 Identifier Reference: It is as static warning if an identifier expression of the form
@@ -2647,7 +2665,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', 66, "Undefined name '%s'");
+ static final StaticWarningCode UNDEFINED_IDENTIFIER = new StaticWarningCode('UNDEFINED_IDENTIFIER', 67, "Undefined name '%s'");
/**
* 12.14.2 Binding Actuals to Formals: Furthermore, each <i>q<sub>i</sub></i>, <i>1<=i<=l</i>,
@@ -2656,7 +2674,7 @@
*
* @param name the name of the requested named parameter
*/
- static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode('UNDEFINED_NAMED_PARAMETER', 67, "The named parameter '%s' is not defined");
+ static final StaticWarningCode UNDEFINED_NAMED_PARAMETER = new StaticWarningCode('UNDEFINED_NAMED_PARAMETER', 68, "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
@@ -2671,7 +2689,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', 68, "There is no such setter '%s' in '%s'");
+ static final StaticWarningCode UNDEFINED_SETTER = new StaticWarningCode('UNDEFINED_SETTER', 69, "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
@@ -2680,10 +2698,11 @@
* @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', 69, "There is no such static method '%s' in '%s'");
+ 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 List<StaticWarningCode> values = [
AMBIGUOUS_IMPORT,
ARGUMENT_TYPE_NOT_ASSIGNABLE,
+ ASSIGNMENT_TO_CONST,
ASSIGNMENT_TO_FINAL,
ASSIGNMENT_TO_METHOD,
CASE_BLOCK_NOT_TERMINATED,
@@ -2811,7 +2830,7 @@
*
* @coverage dart.engine.error
*/
-class HtmlWarningCode implements Comparable<HtmlWarningCode>, ErrorCode {
+class HtmlWarningCode implements Enum<HtmlWarningCode>, ErrorCode {
/**
* An error code indicating that the value of the 'src' attribute of a Dart script tag is not a
@@ -2864,7 +2883,7 @@
*
* @coverage dart.engine.error
*/
-class StaticTypeWarningCode implements Comparable<StaticTypeWarningCode>, ErrorCode {
+class StaticTypeWarningCode implements Enum<StaticTypeWarningCode>, ErrorCode {
/**
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
diff --git a/pkg/analyzer_experimental/lib/src/generated/html.dart b/pkg/analyzer_experimental/lib/src/generated/html.dart
index c0e83c9..b69bda3 100644
--- a/pkg/analyzer_experimental/lib/src/generated/html.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/html.dart
@@ -924,7 +924,7 @@
*
* @coverage dart.engine.html
*/
-class TokenType implements Comparable<TokenType> {
+class TokenType implements Enum<TokenType> {
/**
* The type of the token that marks the end of the input.
diff --git a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
index 6f1da08..5dbf578 100644
--- a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
@@ -38,13 +38,13 @@
/**
* A builder that will silently ignore all data and logging requests.
*/
- static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new InstrumentationBuilder_13();
+ static InstrumentationBuilder _NULL_INSTRUMENTATION_BUILDER = new InstrumentationBuilder_14();
/**
* An instrumentation logger that can be used when no other instrumentation logger has been
* configured. This logger will silently ignore all data and logging requests.
*/
- static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_14();
+ static InstrumentationLogger _NULL_LOGGER = new InstrumentationLogger_15();
/**
* The current instrumentation logger.
@@ -96,7 +96,7 @@
_CURRENT_LOGGER = logger2 == null ? _NULL_LOGGER : logger2;
}
}
-class InstrumentationBuilder_13 implements InstrumentationBuilder {
+class InstrumentationBuilder_14 implements InstrumentationBuilder {
InstrumentationBuilder data(String name, bool value) => this;
InstrumentationBuilder data2(String name, int value) => this;
InstrumentationBuilder data3(String name, String value) => this;
@@ -104,13 +104,15 @@
InstrumentationLevel get instrumentationLevel => InstrumentationLevel.OFF;
void log() {
}
+ void log2(int minTimeToLong) {
+ }
InstrumentationBuilder metric(String name, bool value) => this;
InstrumentationBuilder metric2(String name, int value) => this;
InstrumentationBuilder metric3(String name, String value) => this;
InstrumentationBuilder metric4(String name, List<String> value) => this;
InstrumentationBuilder record(Exception exception) => this;
}
-class InstrumentationLogger_14 implements InstrumentationLogger {
+class InstrumentationLogger_15 implements InstrumentationLogger {
InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INSTRUMENTATION_BUILDER;
}
/**
@@ -183,6 +185,15 @@
void log();
/**
+ * Log the data that has been collected. The instrumentation builder should not be used after this
+ * method is invoked. The behavior of any method defined on this interface that is used after this
+ * method is invoked is undefined.
+ *
+ * @param minTimeToLog if the total elapsed time is less than this, do not record
+ */
+ void log2(int minTimeToLog);
+
+ /**
* Append the given metric to the data being collected by this builder. The information is
* declared to contain only metrics data (data that is not user identifiable and does not contain
* user intellectual property).
@@ -244,7 +255,7 @@
*
* @coverage dart.engine.utilities
*/
-class InstrumentationLevel implements Comparable<InstrumentationLevel> {
+class InstrumentationLevel implements Enum<InstrumentationLevel> {
/** Recording all instrumented information */
static final InstrumentationLevel EVERYTHING = new InstrumentationLevel('EVERYTHING', 0);
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_core.dart b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
index 01ffd5d..4e9d258 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_core.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
@@ -258,10 +258,14 @@
class JavaException implements Exception {
final String message;
- final Exception e;
- JavaException([this.message = "", this.e = null]);
- JavaException.withCause(this.e) : message = null;
- String toString() => "JavaException: $message $e";
+ final Exception cause;
+ JavaException([this.message = "", this.cause = null]);
+ JavaException.withCause(this.cause) : message = null;
+ String toString() => "JavaException: $message $cause";
+}
+
+class JavaIOException extends JavaException {
+ JavaIOException([message = "", cause = null]) : super(message, cause);
}
class IllegalArgumentException implements Exception {
@@ -478,6 +482,12 @@
return false;
}
+javaMapPut(Map target, key, value) {
+ var oldValue = target[key];
+ target[key] = value;
+ return oldValue;
+}
+
void javaMapPutAll(Map target, Map source) {
source.forEach((k, v) {
target[k] = v;
@@ -521,3 +531,8 @@
sb = new StringBuffer();
}
}
+
+abstract class Enum<E> implements Comparable<E> {
+ int get ordinal;
+ String get name;
+}
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_engine_io.dart b/pkg/analyzer_experimental/lib/src/generated/java_engine_io.dart
index 32923b6..3c713d6 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_engine_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_engine_io.dart
@@ -5,6 +5,7 @@
class OSUtilities {
+ static String LINE_SEPARATOR = isWindows() ? '\r\n' : '\n';
static bool isWindows() => Platform.operatingSystem == 'windows';
static bool isMac() => Platform.operatingSystem == 'macos';
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_io.dart b/pkg/analyzer_experimental/lib/src/generated/java_io.dart
index 41c2e24..3e23f8d 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_io.dart
@@ -1,6 +1,7 @@
library java.io;
import "dart:io";
+import 'java_core.dart' show JavaIOException;
import 'package:path/path.dart' as pathos;
class JavaSystemIO {
@@ -90,7 +91,13 @@
return new JavaFile(parent);
}
String getAbsolutePath() => pathos.absolute(_path);
- String getCanonicalPath() => _newFile().fullPathSync();
+ String getCanonicalPath() {
+ try {
+ return _newFile().fullPathSync();
+ } catch (e) {
+ throw new JavaIOException('IOException', e);
+ }
+ }
JavaFile getAbsoluteFile() => new JavaFile(getAbsolutePath());
JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath());
bool exists() {
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_junit.dart b/pkg/analyzer_experimental/lib/src/generated/java_junit.dart
index 876d345..3888427 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_junit.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_junit.dart
@@ -75,10 +75,6 @@
Description describe(Description mismatchDescription) {
return mismatchDescription.replace(msg);
}
- Description describeMismatch(item, Description mismatchDescription,
- Map matchState, bool verbose) {
- return mismatchDescription.replace(msg).add(" $item != $expectedValue");
- }
}
Matcher isTrueMsg(String msg) => new _IsTrueWithMessage(msg);
@@ -91,10 +87,6 @@
Description describe(Description mismatchDescription) {
return mismatchDescription.replace(msg);
}
- Description describeMismatch(item, Description mismatchDescription,
- Map matchState, bool verbose) {
- return mismatchDescription.replace(msg).add(" $item is not true");
- }
}
Matcher isFalseMsg(String msg) => new _IsFalseWithMessage(msg);
@@ -107,10 +99,6 @@
Description describe(Description mismatchDescription) {
return mismatchDescription.replace(msg);
}
- Description describeMismatch(item, Description mismatchDescription,
- Map matchState, bool verbose) {
- return mismatchDescription.replace(msg).add(" $item is not false");
- }
}
Matcher isNotNullMsg(String msg) => new _IsNotNullWithMessage(msg);
@@ -123,8 +111,4 @@
Description describe(Description mismatchDescription) {
return mismatchDescription.replace(msg);
}
- Description describeMismatch(item, Description mismatchDescription,
- Map matchState, bool verbose) {
- return mismatchDescription.replace(msg).add(" $item is null");
- }
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/parser.dart b/pkg/analyzer_experimental/lib/src/generated/parser.dart
index c406289..84fec68 100644
--- a/pkg/analyzer_experimental/lib/src/generated/parser.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/parser.dart
@@ -3,13 +3,13 @@
library engine.parser;
import 'dart:collection';
import 'java_core.dart';
-import 'java_engine.dart';
import 'instrumentation.dart';
import 'error.dart';
import 'source.dart';
import 'scanner.dart';
import 'ast.dart';
import 'utilities_dart.dart';
+import 'engine.dart' show AnalysisEngine;
/**
* Instances of the class `CommentAndMetadata` implement a simple data-holder for a method
* that needs to return multiple values.
@@ -441,29 +441,40 @@
* Compute the content of a string with the given literal representation.
*
* @param lexeme the literal representation of the string
+ * @param first `true` if this is the first token in a string literal
+ * @param last `true` if this is the last token in a string literal
* @return the actual value of the string
*/
- String computeStringValue(String lexeme) {
- if (lexeme.startsWith("r\"\"\"") || lexeme.startsWith("r'''")) {
- if (lexeme.length > 4) {
- return lexeme.substring(4, lexeme.length - 3);
- }
- } else if (lexeme.startsWith("r\"") || lexeme.startsWith("r'")) {
- if (lexeme.length > 2) {
- return lexeme.substring(2, lexeme.length - 1);
- }
- }
+ String computeStringValue(String lexeme, bool first, bool last) {
+ bool isRaw = false;
int start = 0;
- if (lexeme.startsWith("\"\"\"") || lexeme.startsWith("'''")) {
- start += 3;
- } else if (lexeme.startsWith("\"") || lexeme.startsWith("'")) {
- start += 1;
+ if (first) {
+ if (lexeme.startsWith("r\"\"\"") || lexeme.startsWith("r'''")) {
+ isRaw = true;
+ start += 4;
+ } else if (lexeme.startsWith("r\"") || lexeme.startsWith("r'")) {
+ isRaw = true;
+ start += 2;
+ } else if (lexeme.startsWith("\"\"\"") || lexeme.startsWith("'''")) {
+ start += 3;
+ } else if (lexeme.startsWith("\"") || lexeme.startsWith("'")) {
+ start += 1;
+ }
}
int end = lexeme.length;
- if (end > 3 && (lexeme.endsWith("\"\"\"") || lexeme.endsWith("'''"))) {
- end -= 3;
- } else if (end > 1 && (lexeme.endsWith("\"") || lexeme.endsWith("'"))) {
- end -= 1;
+ if (last) {
+ if (lexeme.endsWith("\"\"\"") || lexeme.endsWith("'''")) {
+ end -= 3;
+ } else if (lexeme.endsWith("\"") || lexeme.endsWith("'")) {
+ end -= 1;
+ }
+ }
+ if (end - start + 1 < 0) {
+ AnalysisEngine.instance.logger.logError("Internal error: computeStringValue(${lexeme}, ${first}, ${last})");
+ return "";
+ }
+ if (isRaw) {
+ return lexeme.substring(start, end);
}
JavaStringBuilder builder = new JavaStringBuilder();
int index = start;
@@ -532,7 +543,7 @@
*
* @return the synthetic token that was created
*/
- Token createSyntheticToken(Keyword keyword) => new KeywordToken_11(keyword, _currentToken.offset);
+ Token createSyntheticToken(Keyword keyword) => new KeywordToken_12(keyword, _currentToken.offset);
/**
* Create a synthetic token with the given type.
@@ -1819,7 +1830,7 @@
}
try {
List<bool> errorFound = [false];
- AnalysisErrorListener listener = new AnalysisErrorListener_12(errorFound);
+ AnalysisErrorListener listener = new AnalysisErrorListener_13(errorFound);
StringScanner scanner = new StringScanner(null, referenceSource, listener);
scanner.setSourceStart(1, 1, sourceOffset);
Token firstToken = scanner.tokenize();
@@ -4259,8 +4270,9 @@
*/
StringInterpolation parseStringInterpolation(Token string) {
List<InterpolationElement> elements = new List<InterpolationElement>();
- elements.add(new InterpolationString.full(string, computeStringValue(string.lexeme)));
- while (matches5(TokenType.STRING_INTERPOLATION_EXPRESSION) || matches5(TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
+ bool hasMore = matches5(TokenType.STRING_INTERPOLATION_EXPRESSION) || matches5(TokenType.STRING_INTERPOLATION_IDENTIFIER);
+ elements.add(new InterpolationString.full(string, computeStringValue(string.lexeme, true, !hasMore)));
+ while (hasMore) {
if (matches5(TokenType.STRING_INTERPOLATION_EXPRESSION)) {
Token openToken = andAdvance;
Expression expression = parseExpression2();
@@ -4278,7 +4290,8 @@
}
if (matches5(TokenType.STRING)) {
string = andAdvance;
- elements.add(new InterpolationString.full(string, computeStringValue(string.lexeme)));
+ hasMore = matches5(TokenType.STRING_INTERPOLATION_EXPRESSION) || matches5(TokenType.STRING_INTERPOLATION_IDENTIFIER);
+ elements.add(new InterpolationString.full(string, computeStringValue(string.lexeme, false, !hasMore)));
}
}
return new StringInterpolation.full(elements);
@@ -4302,7 +4315,7 @@
if (matches5(TokenType.STRING_INTERPOLATION_EXPRESSION) || matches5(TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
strings.add(parseStringInterpolation(string));
} else {
- strings.add(new SimpleStringLiteral.full(string, computeStringValue(string.lexeme)));
+ strings.add(new SimpleStringLiteral.full(string, computeStringValue(string.lexeme, true, true)));
}
}
if (strings.length < 1) {
@@ -4419,24 +4432,26 @@
*/
SymbolLiteral parseSymbolLiteral() {
Token poundSign = andAdvance;
- List<SimpleIdentifier> components = new List<SimpleIdentifier>();
+ List<Token> components = new List<Token>();
if (matches5(TokenType.IDENTIFIER)) {
- components.add(parseSimpleIdentifier());
+ components.add(andAdvance);
while (matches5(TokenType.PERIOD)) {
advance();
if (matches5(TokenType.IDENTIFIER)) {
- components.add(parseSimpleIdentifier());
+ components.add(andAdvance);
} else {
reportError7(ParserErrorCode.MISSING_IDENTIFIER, []);
- components.add(createSyntheticIdentifier());
+ components.add(createSyntheticToken2(TokenType.IDENTIFIER));
break;
}
}
+ } else if (_currentToken.isOperator) {
+ components.add(andAdvance);
} else {
reportError7(ParserErrorCode.MISSING_IDENTIFIER, []);
- components.add(createSyntheticIdentifier());
+ components.add(createSyntheticToken2(TokenType.IDENTIFIER));
}
- return new SymbolLiteral.full(poundSign, components);
+ return new SymbolLiteral.full(poundSign, new List.from(components));
}
/**
@@ -5711,13 +5726,13 @@
}
}
}
-class KeywordToken_11 extends KeywordToken {
- KeywordToken_11(Keyword arg0, int arg1) : super(arg0, arg1);
+class KeywordToken_12 extends KeywordToken {
+ KeywordToken_12(Keyword arg0, int arg1) : super(arg0, arg1);
int get length => 0;
}
-class AnalysisErrorListener_12 implements AnalysisErrorListener {
+class AnalysisErrorListener_13 implements AnalysisErrorListener {
List<bool> errorFound;
- AnalysisErrorListener_12(this.errorFound);
+ AnalysisErrorListener_13(this.errorFound);
void onError(AnalysisError error) {
errorFound[0] = true;
}
@@ -5730,7 +5745,7 @@
*
* @coverage dart.engine.parser
*/
-class ParserErrorCode implements Comparable<ParserErrorCode>, ErrorCode {
+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'");
@@ -5823,40 +5838,41 @@
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_FUNCTION_BODY_IN_NON_SDK_CODE = new ParserErrorCode.con2('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 92, "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', 93, "Only constructors can be declared to be a 'factory'");
- static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode.con2('NON_IDENTIFIER_LIBRARY_NAME', 94, "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', 95, "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', 96, "The operator '%s' is not user definable");
- static final ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = new ParserErrorCode.con2('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 97, "Normal parameters must occur before optional parameters");
- static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 98, "Positional arguments must occur before named arguments");
- static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 99, "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', 100, "Only factory constructor can specify '=' redirection.");
- static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 101, "The modifier 'static' should be before the modifier 'const'");
- static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 102, "The modifier 'static' should be before the modifier 'final'");
- static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 103, "The modifier 'static' should be before the modifier 'var'");
- static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 104, "Constructors cannot be static");
- static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_GETTER_WITHOUT_BODY', 105, "A 'static' getter must have a body");
- static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 106, "Operators cannot be static");
- static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode.con2('STATIC_SETTER_WITHOUT_BODY', 107, "A 'static' setter must have a body");
- static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 108, "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', 109, "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', 110, "The 'default' case can only be declared once");
- static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con2('TOP_LEVEL_OPERATOR', 111, "Operators must be declared within a class");
- static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 112, "There is no '%s' to open a parameter group");
- static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 113, "Unexpected token '%s'");
- static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 114, "The extends clause must be before the with clause");
- static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 115, "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', 116, "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', 117, "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', 118, "Expected '%s' to close parameter group");
- static final ParserErrorCode VAR_AND_TYPE = new ParserErrorCode.con2('VAR_AND_TYPE', 119, "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', 120, "The keyword 'var' cannot be used as a type name");
- static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 121, "Classes cannot be declared to be 'var'");
- static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 122, "The return type cannot be 'var'");
- static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 123, "Type aliases cannot be declared to be 'var'");
- static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 124, "Parameters cannot have a type of 'void'");
- static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 125, "Variables cannot have a type of 'void'");
+ 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'");
static final List<ParserErrorCode> values = [
ABSTRACT_CLASS_MEMBER,
ABSTRACT_STATIC_METHOD,
@@ -5950,6 +5966,7 @@
MULTIPLE_WITH_CLAUSES,
NAMED_FUNCTION_EXPRESSION,
NAMED_PARAMETER_OUTSIDE_GROUP,
+ NATIVE_CLAUSE_IN_NON_SDK_CODE,
NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE,
NON_CONSTRUCTOR_FACTORY,
NON_IDENTIFIER_LIBRARY_NAME,
@@ -6447,7 +6464,7 @@
if (node.isCascaded) {
_writer.print("..");
} else {
- visit(node.array);
+ visit(node.target);
}
_writer.print('[');
visit(node.index);
@@ -6733,7 +6750,7 @@
}
Object visitSymbolLiteral(SymbolLiteral node) {
_writer.print("#");
- visitList5(node.components, ".");
+ visitList8(node.components, ".");
return null;
}
Object visitThisExpression(ThisExpression node) {
@@ -6950,4 +6967,23 @@
}
}
}
+
+ /**
+ * Print a list of tokens, separated by the given separator.
+ *
+ * @param tokens the tokens to be printed
+ * @param separator the separator to be printed between adjacent tokens
+ */
+ void visitList8(List<Token> tokens, String separator) {
+ int size = tokens.length;
+ for (int i = 0; i < size; i++) {
+ if ("\n" == separator) {
+ _writer.print("\n");
+ indent();
+ } else if (i > 0) {
+ _writer.print(separator);
+ }
+ _writer.print(tokens[i].lexeme);
+ }
+ }
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/resolver.dart b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
index 3891934..2b056f4 100644
--- a/pkg/analyzer_experimental/lib/src/generated/resolver.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
@@ -1248,6 +1248,625 @@
}
}
/**
+ * Instances of the class `DeadCodeVerifier` traverse an AST structure looking for cases of
+ * [HintCode#DEAD_CODE].
+ *
+ * @coverage dart.engine.resolver
+ */
+class DeadCodeVerifier extends RecursiveASTVisitor<Object> {
+
+ /**
+ * The error reporter by which errors will be reported.
+ */
+ ErrorReporter _errorReporter;
+
+ /**
+ * Create a new instance of the [DeadCodeVerifier].
+ *
+ * @param errorReporter the error reporter
+ */
+ DeadCodeVerifier(ErrorReporter errorReporter) {
+ this._errorReporter = errorReporter;
+ }
+ Object visitBinaryExpression(BinaryExpression node) {
+ sc.Token operator = node.operator;
+ bool isAmpAmp = identical(operator.type, sc.TokenType.AMPERSAND_AMPERSAND);
+ bool isBarBar = identical(operator.type, sc.TokenType.BAR_BAR);
+ if (isAmpAmp || isBarBar) {
+ Expression lhsCondition = node.leftOperand;
+ ValidResult lhsResult = getConstantBooleanValue(lhsCondition);
+ if (lhsResult != null) {
+ if (identical(lhsResult, ValidResult.RESULT_TRUE) && isBarBar) {
+ _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, []);
+ safelyVisit(lhsCondition);
+ return null;
+ } else if (identical(lhsResult, ValidResult.RESULT_FALSE) && isAmpAmp) {
+ _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, []);
+ safelyVisit(lhsCondition);
+ return null;
+ }
+ }
+ }
+ return super.visitBinaryExpression(node);
+ }
+
+ /**
+ * For each [Block], this method reports and error on all statements between the end of the
+ * block and the first return statement (assuming there it is not at the end of the block.)
+ *
+ * @param node the block to evaluate
+ */
+ Object visitBlock(Block node) {
+ NodeList<Statement> statements = node.statements;
+ int size = statements.length;
+ for (int i = 0; i < size; i++) {
+ Statement currentStatement = statements[i];
+ safelyVisit(currentStatement);
+ if (currentStatement is ReturnStatement && i != size - 1) {
+ Statement nextStatement = statements[i + 1];
+ Statement lastStatement = statements[size - 1];
+ int offset = nextStatement.offset;
+ int length = lastStatement.end - offset;
+ _errorReporter.reportError3(HintCode.DEAD_CODE, offset, length, []);
+ return null;
+ }
+ }
+ return null;
+ }
+ Object visitConditionalExpression(ConditionalExpression node) {
+ Expression conditionExpression = node.condition;
+ ValidResult result = getConstantBooleanValue(conditionExpression);
+ if (result != null) {
+ if (identical(result, ValidResult.RESULT_TRUE)) {
+ _errorReporter.reportError2(HintCode.DEAD_CODE, node.elseExpression, []);
+ safelyVisit(node.thenExpression);
+ return null;
+ } else {
+ _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenExpression, []);
+ safelyVisit(node.elseExpression);
+ return null;
+ }
+ }
+ return super.visitConditionalExpression(node);
+ }
+ Object visitIfStatement(IfStatement node) {
+ Expression conditionExpression = node.condition;
+ ValidResult result = getConstantBooleanValue(conditionExpression);
+ if (result != null) {
+ if (identical(result, ValidResult.RESULT_TRUE)) {
+ Statement elseStatement = node.elseStatement;
+ if (elseStatement != null) {
+ _errorReporter.reportError2(HintCode.DEAD_CODE, elseStatement, []);
+ safelyVisit(node.thenStatement);
+ return null;
+ }
+ } else {
+ _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenStatement, []);
+ safelyVisit(node.elseStatement);
+ return null;
+ }
+ }
+ return super.visitIfStatement(node);
+ }
+ Object visitTryStatement(TryStatement node) {
+ safelyVisit(node.body);
+ safelyVisit(node.finallyClause);
+ NodeList<CatchClause> catchClauses = node.catchClauses;
+ int numOfCatchClauses = catchClauses.length;
+ List<Type2> visitedTypes = new List<Type2>();
+ for (int i = 0; i < numOfCatchClauses; i++) {
+ CatchClause catchClause = catchClauses[i];
+ if (catchClause.onKeyword != null) {
+ TypeName typeName = catchClause.exceptionType;
+ if (typeName != null && typeName.type != null) {
+ Type2 currentType = typeName.type;
+ if (currentType.isObject) {
+ safelyVisit(catchClause);
+ if (i + 1 != numOfCatchClauses) {
+ CatchClause nextCatchClause = catchClauses[i + 1];
+ CatchClause lastCatchClause = catchClauses[numOfCatchClauses - 1];
+ int offset = nextCatchClause.offset;
+ int length = lastCatchClause.end - offset;
+ _errorReporter.reportError3(HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH, offset, length, []);
+ return null;
+ }
+ }
+ for (Type2 type in visitedTypes) {
+ if (currentType.isSubtypeOf(type)) {
+ CatchClause lastCatchClause = catchClauses[numOfCatchClauses - 1];
+ int offset = catchClause.offset;
+ int length = lastCatchClause.end - offset;
+ _errorReporter.reportError3(HintCode.DEAD_CODE_ON_CATCH_SUBTYPE, offset, length, [currentType.displayName, type.displayName]);
+ return null;
+ }
+ }
+ visitedTypes.add(currentType);
+ }
+ safelyVisit(catchClause);
+ } else {
+ safelyVisit(catchClause);
+ if (i + 1 != numOfCatchClauses) {
+ CatchClause nextCatchClause = catchClauses[i + 1];
+ CatchClause lastCatchClause = catchClauses[numOfCatchClauses - 1];
+ int offset = nextCatchClause.offset;
+ int length = lastCatchClause.end - offset;
+ _errorReporter.reportError3(HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH, offset, length, []);
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+ Object visitWhileStatement(WhileStatement node) {
+ Expression conditionExpression = node.condition;
+ safelyVisit(conditionExpression);
+ ValidResult result = getConstantBooleanValue(conditionExpression);
+ if (result != null) {
+ if (identical(result, ValidResult.RESULT_FALSE)) {
+ _errorReporter.reportError2(HintCode.DEAD_CODE, node.body, []);
+ return null;
+ }
+ }
+ safelyVisit(node.body);
+ return null;
+ }
+
+ /**
+ * Given some [Expression], this method returns [ValidResult#RESULT_TRUE] if it is
+ * `true`, [ValidResult#RESULT_FALSE] if it is `false`, or `null` if the
+ * expression is not a constant boolean value.
+ *
+ * @param expression the expression to evaluate
+ * @return [ValidResult#RESULT_TRUE] if it is `true`, [ValidResult#RESULT_FALSE]
+ * if it is `false`, or `null` if the expression is not a constant boolean
+ * value
+ */
+ ValidResult getConstantBooleanValue(Expression expression) {
+ if (expression is BooleanLiteral) {
+ if (((expression as BooleanLiteral)).value) {
+ return ValidResult.RESULT_TRUE;
+ } else {
+ return ValidResult.RESULT_FALSE;
+ }
+ } else {
+ EvaluationResultImpl result = expression.accept(new ConstantVisitor());
+ if (identical(result, ValidResult.RESULT_TRUE)) {
+ return ValidResult.RESULT_TRUE;
+ } else if (identical(result, ValidResult.RESULT_FALSE)) {
+ return ValidResult.RESULT_FALSE;
+ }
+ return null;
+ }
+ }
+
+ /**
+ * If the given node is not `null`, visit this instance of the dead code verifier.
+ *
+ * @param node the node to be visited
+ */
+ void safelyVisit(ASTNode node) {
+ if (node != null) {
+ node.accept(this);
+ }
+ }
+}
+/**
+ * Instances of the class `HintGenerator` traverse a library's worth of dart code at a time to
+ * generate hints over the set of sources.
+ *
+ * @see HintCode
+ * @coverage dart.engine.resolver
+ */
+class HintGenerator {
+ List<CompilationUnit> _compilationUnits;
+ AnalysisContext _context;
+ AnalysisErrorListener _errorListener;
+ ImportsVerifier _importsVerifier;
+ DeadCodeVerifier _deadCodeVerifier;
+ HintGenerator(List<CompilationUnit> compilationUnits, AnalysisContext context, AnalysisErrorListener errorListener) {
+ this._compilationUnits = compilationUnits;
+ this._context = context;
+ this._errorListener = errorListener;
+ LibraryElement library = compilationUnits[0].element.library;
+ _importsVerifier = new ImportsVerifier(library);
+ }
+ void generateForLibrary() {
+ for (int i = 0; i < _compilationUnits.length; i++) {
+ CompilationUnitElement element = _compilationUnits[i].element;
+ if (element != null) {
+ if (i == 0) {
+ _importsVerifier.inDefiningCompilationUnit = true;
+ generateForCompilationUnit(_compilationUnits[i], element.source);
+ _importsVerifier.inDefiningCompilationUnit = false;
+ } else {
+ generateForCompilationUnit(_compilationUnits[i], element.source);
+ }
+ }
+ }
+ _importsVerifier.generateUnusedImportHints(new ErrorReporter(_errorListener, _compilationUnits[0].element.source));
+ }
+ void generateForCompilationUnit(CompilationUnit unit, Source source) {
+ ErrorReporter errorReporter = new ErrorReporter(_errorListener, source);
+ _importsVerifier.visitCompilationUnit(unit);
+ _deadCodeVerifier = new DeadCodeVerifier(errorReporter);
+ _deadCodeVerifier.visitCompilationUnit(unit);
+ }
+}
+/**
+ * Instances of the class `ImportsVerifier` visit all of the referenced libraries in the
+ * source code verifying that all of the imports are used, otherwise a
+ * [HintCode#UNUSED_IMPORT] is generated with
+ * [generateUnusedImportHints].
+ *
+ * While this class does not yet have support for an "Organize Imports" action, this logic built up
+ * in this class could be used for such an action in the future.
+ *
+ * @coverage dart.engine.resolver
+ */
+class ImportsVerifier extends RecursiveASTVisitor<Object> {
+
+ /**
+ * This is set to `true` if the current compilation unit which is being visited is the
+ * defining compilation unit for the library, its value can be set with
+ * [setInDefiningCompilationUnit].
+ */
+ bool _inDefiningCompilationUnit = false;
+
+ /**
+ * The current library.
+ */
+ LibraryElement _currentLibrary;
+
+ /**
+ * A list of [ImportDirective]s that the current library imports, as identifiers are visited
+ * by this visitor and an import has been identified as being used by the library, the
+ * [ImportDirective] is removed from this list. After all the sources in the library have
+ * been evaluated, this list represents the set of unused imports.
+ *
+ * @see ImportsVerifier#generateUnusedImportErrors(ErrorReporter)
+ */
+ List<ImportDirective> _unusedImports;
+
+ /**
+ * This is a map between the set of [LibraryElement]s that the current library imports, and
+ * a list of [ImportDirective]s that imports the library. In cases where the current library
+ * imports a library with a single directive (such as `import lib1.dart;`), the library
+ * element will map to a list of one [ImportDirective], which will then be removed from the
+ * [unusedImports] list. In cases where the current library imports a library with multiple
+ * directives (such as `import lib1.dart; import lib1.dart show C;`), the
+ * [LibraryElement] will be mapped to a list of the import directives, and the namespace
+ * will need to be used to compute the correct [ImportDirective] being used, see
+ * [namespaceMap].
+ */
+ Map<LibraryElement, List<ImportDirective>> _libraryMap;
+
+ /**
+ * In cases where there is more than one import directive per library element, this mapping is
+ * used to determine which of the multiple import directives are used by generating a
+ * [Namespace] for each of the imports to do lookups in the same way that they are done from
+ * the [ElementResolver].
+ */
+ Map<ImportDirective, Namespace> _namespaceMap;
+
+ /**
+ * This is a map between prefix elements and the import directive from which they are derived. In
+ * cases where a type is referenced via a prefix element, the import directive can be marked as
+ * used (removed from the unusedImports) by looking at the resolved `lib` in `lib.X`,
+ * instead of looking at which library the `lib.X` resolves.
+ */
+ Map<PrefixElement, ImportDirective> _prefixElementMap;
+
+ /**
+ * Create a new instance of the [ImportsVerifier].
+ *
+ * @param errorReporter the error reporter
+ */
+ ImportsVerifier(LibraryElement library) {
+ this._currentLibrary = library;
+ this._unusedImports = new List<ImportDirective>();
+ this._libraryMap = new Map<LibraryElement, List<ImportDirective>>();
+ this._namespaceMap = new Map<ImportDirective, Namespace>();
+ this._prefixElementMap = new Map<PrefixElement, ImportDirective>();
+ }
+
+ /**
+ * After all of the compilation units have been visited by this visitor, this method can be called
+ * to report an [HintCode#UNUSED_IMPORT] hint for each of the import directives in the
+ * [unusedImports] list.
+ *
+ * @param errorReporter the error reporter to report the set of [HintCode#UNUSED_IMPORT]
+ * hints to
+ */
+ void generateUnusedImportHints(ErrorReporter errorReporter) {
+ for (ImportDirective unusedImport in _unusedImports) {
+ errorReporter.reportError2(HintCode.UNUSED_IMPORT, unusedImport.uri, []);
+ }
+ }
+ Object visitCompilationUnit(CompilationUnit node) {
+ if (_inDefiningCompilationUnit) {
+ NodeList<Directive> directives = node.directives;
+ for (Directive directive in directives) {
+ if (directive is ImportDirective) {
+ ImportDirective importDirective = directive as ImportDirective;
+ LibraryElement libraryElement = importDirective.uriElement;
+ if (libraryElement != null) {
+ _unusedImports.add(importDirective);
+ if (importDirective.asToken != null) {
+ SimpleIdentifier prefixIdentifier = importDirective.prefix;
+ if (prefixIdentifier != null) {
+ Element element = prefixIdentifier.element;
+ if (element is PrefixElement) {
+ PrefixElement prefixElementKey = element as PrefixElement;
+ _prefixElementMap[prefixElementKey] = importDirective;
+ }
+ }
+ }
+ putIntoLibraryMap(libraryElement, importDirective);
+ addAdditionalLibrariesForExports(_libraryMap, libraryElement, importDirective, new List<LibraryElement>());
+ }
+ }
+ }
+ }
+ if (_unusedImports.isEmpty) {
+ return null;
+ }
+ return super.visitCompilationUnit(node);
+ }
+ Object visitExportDirective(ExportDirective node) => null;
+ Object visitImportDirective(ImportDirective node) => null;
+ Object visitLibraryDirective(LibraryDirective node) => null;
+ Object visitPrefixedIdentifier(PrefixedIdentifier node) {
+ SimpleIdentifier prefixIdentifier = node.prefix;
+ Element element = prefixIdentifier.element;
+ if (element is PrefixElement) {
+ _unusedImports.remove(_prefixElementMap[element]);
+ return null;
+ }
+ return visitIdentifier(element, prefixIdentifier.name);
+ }
+ Object visitSimpleIdentifier(SimpleIdentifier node) => visitIdentifier(node.element, node.name);
+ void set inDefiningCompilationUnit(bool inDefiningCompilationUnit2) {
+ this._inDefiningCompilationUnit = inDefiningCompilationUnit2;
+ }
+
+ /**
+ * Recursively add any exported library elements into the [libraryMap].
+ */
+ void addAdditionalLibrariesForExports(Map<LibraryElement, List<ImportDirective>> map, LibraryElement library, ImportDirective importDirective, List<LibraryElement> exportPath) {
+ if (exportPath.contains(library)) {
+ return;
+ }
+ for (LibraryElement exportedLibraryElt in library.exportedLibraries) {
+ putIntoLibraryMap(exportedLibraryElt, importDirective);
+ exportPath.add(exportedLibraryElt);
+ addAdditionalLibrariesForExports(map, exportedLibraryElt, importDirective, exportPath);
+ }
+ }
+
+ /**
+ * Lookup and return the [Namespace] from the [namespaceMap], if the map does not
+ * have the computed namespace, compute it and cache it in the map. If the import directive is not
+ * resolved or is not resolvable, `null` is returned.
+ *
+ * @param importDirective the import directive used to compute the returned namespace
+ * @return the computed or looked up [Namespace]
+ */
+ Namespace computeNamespace(ImportDirective importDirective) {
+ Namespace namespace = _namespaceMap[importDirective];
+ if (namespace == null) {
+ ImportElement importElement = importDirective.element as ImportElement;
+ if (importElement != null) {
+ NamespaceBuilder builder = new NamespaceBuilder();
+ namespace = builder.createImportNamespace(importElement);
+ _namespaceMap[importDirective] = namespace;
+ }
+ }
+ return namespace;
+ }
+
+ /**
+ * The [libraryMap] is a mapping between a library elements and a list of import
+ * directives, but when adding these mappings into the [libraryMap], this method can be
+ * used to simply add the mapping between the library element an an import directive without
+ * needing to check to see if a list needs to be created.
+ */
+ void putIntoLibraryMap(LibraryElement libraryElement, ImportDirective importDirective) {
+ List<ImportDirective> importList = _libraryMap[libraryElement];
+ if (importList == null) {
+ importList = new List<ImportDirective>();
+ _libraryMap[libraryElement] = importList;
+ }
+ importList.add(importDirective);
+ }
+ Object visitIdentifier(Element element, String name) {
+ if (element == null) {
+ return null;
+ }
+ if (element is MultiplyDefinedElement) {
+ MultiplyDefinedElement multiplyDefinedElement = element as MultiplyDefinedElement;
+ for (Element elt in multiplyDefinedElement.conflictingElements) {
+ visitIdentifier(elt, name);
+ }
+ return null;
+ }
+ LibraryElement containingLibrary = element.library;
+ if (containingLibrary == null) {
+ return null;
+ }
+ if (_currentLibrary == containingLibrary) {
+ return null;
+ }
+ List<ImportDirective> importsFromSameLibrary = _libraryMap[containingLibrary];
+ if (importsFromSameLibrary == null) {
+ return null;
+ }
+ if (importsFromSameLibrary.length == 1) {
+ ImportDirective usedImportDirective = importsFromSameLibrary[0];
+ _unusedImports.remove(usedImportDirective);
+ } else {
+ for (ImportDirective importDirective in importsFromSameLibrary) {
+ Namespace namespace = computeNamespace(importDirective);
+ if (namespace != null && namespace.get(name) != null) {
+ _unusedImports.remove(importDirective);
+ }
+ }
+ }
+ return null;
+ }
+}
+/**
+ * Instances of the class `PubVerifier` traverse an AST structure looking for deviations from
+ * pub best practices.
+ */
+class PubVerifier extends RecursiveASTVisitor<Object> {
+ static String _PUBSPEC_YAML = "pubspec.yaml";
+
+ /**
+ * The analysis context containing the sources to be analyzed
+ */
+ AnalysisContext _context;
+
+ /**
+ * The error reporter by which errors will be reported.
+ */
+ ErrorReporter _errorReporter;
+ PubVerifier(AnalysisContext context, ErrorReporter errorReporter) {
+ this._context = context;
+ this._errorReporter = errorReporter;
+ }
+ Object visitImportDirective(ImportDirective directive) {
+ return null;
+ }
+
+ /**
+ * This verifies that the passed file import directive is not contained in a source inside a
+ * package "lib" directory hierarchy referencing a source outside that package "lib" directory
+ * hierarchy.
+ *
+ * @param uriLiteral the import URL (not `null`)
+ * @param path the file path being verified (not `null`)
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE
+ */
+ bool checkForFileImportInsideLibReferencesFileOutside(StringLiteral uriLiteral, String path) {
+ Source source = getSource(uriLiteral);
+ String fullName = getSourceFullName(source);
+ if (fullName != null) {
+ int pathIndex = 0;
+ int fullNameIndex = fullName.length;
+ while (pathIndex < path.length && JavaString.startsWithBefore(path, "../", pathIndex)) {
+ fullNameIndex = JavaString.lastIndexOf(fullName, '/', fullNameIndex);
+ if (fullNameIndex < 4) {
+ return false;
+ }
+ 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()) {
+ _errorReporter.reportError2(PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE, uriLiteral, []);
+ }
+ return true;
+ }
+ pathIndex += 3;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This verifies that the passed file import directive is not contained in a source outside a
+ * package "lib" directory hierarchy referencing a source inside that package "lib" directory
+ * hierarchy.
+ *
+ * @param uriLiteral the import URL (not `null`)
+ * @param path the file path being verified (not `null`)
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE
+ */
+ bool checkForFileImportOutsideLibReferencesFileInside(StringLiteral uriLiteral, String path) {
+ if (path.startsWith("lib/")) {
+ if (checkForFileImportOutsideLibReferencesFileInside2(uriLiteral, path, 0)) {
+ return true;
+ }
+ }
+ int pathIndex = path.indexOf("/lib/");
+ while (pathIndex != -1) {
+ if (checkForFileImportOutsideLibReferencesFileInside2(uriLiteral, path, pathIndex + 1)) {
+ return true;
+ }
+ pathIndex = JavaString.indexOf(path, "/lib/", pathIndex + 4);
+ }
+ return false;
+ }
+ bool checkForFileImportOutsideLibReferencesFileInside2(StringLiteral uriLiteral, String path, int pathIndex) {
+ Source source = getSource(uriLiteral);
+ String relativePubspecPath = path.substring(0, pathIndex) + _PUBSPEC_YAML;
+ Source pubspecSource = _context.sourceFactory.resolveUri(source, relativePubspecPath);
+ if (!pubspecSource.exists()) {
+ return false;
+ }
+ String fullName = getSourceFullName(source);
+ if (fullName != null) {
+ if (!fullName.contains("/lib/")) {
+ _errorReporter.reportError2(PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE, uriLiteral, []);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This verifies that the passed package import directive does not contain ".."
+ *
+ * @param uriLiteral the import URL (not `null`)
+ * @param path the path to be validated (not `null`)
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
+ */
+ bool checkForPackageImportContainsDotDot(StringLiteral uriLiteral, String path) {
+ if (path.startsWith("../") || path.contains("/../")) {
+ _errorReporter.reportError2(PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT, uriLiteral, []);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Answer the source associated with the compilation unit containing the given AST node.
+ *
+ * @param node the node (not `null`)
+ * @return the source or `null` if it could not be determined
+ */
+ Source getSource(ASTNode node) {
+ Source source = null;
+ CompilationUnit unit = node.getAncestor(CompilationUnit);
+ if (unit != null) {
+ CompilationUnitElement element = unit.element;
+ if (element != null) {
+ source = element.source;
+ }
+ }
+ return source;
+ }
+
+ /**
+ * Answer the full name of the given source. The returned value will have all
+ * [File#separatorChar] replace by '/'.
+ *
+ * @param source the source
+ * @return the full name or `null` if it could not be determined
+ */
+ String getSourceFullName(Source source) {
+ if (source != null) {
+ String fullName = source.fullName;
+ if (fullName != null) {
+ return fullName.replaceAll(r'\', '/');
+ }
+ }
+ return null;
+ }
+}
+/**
* Instances of the class `DeclarationResolver` are used to resolve declarations in an AST
* structure to already built elements.
*/
@@ -1889,7 +2508,7 @@
* The name of the method that will be invoked if an attempt is made to invoke an undefined method
* on an object.
*/
- static String _NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod";
+ static String NO_SUCH_METHOD_METHOD_NAME = "noSuchMethod";
/**
* Initialize a newly created visitor to resolve the nodes in a compilation unit.
@@ -1913,7 +2532,7 @@
node.staticElement = staticMethod;
Type2 propagatedType = getPropagatedType(leftHandSide);
MethodElement propagatedMethod = lookUpMethod(leftHandSide, propagatedType, methodName);
- node.element = select2(staticMethod, propagatedMethod);
+ node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
_resolver.reportError6(StaticTypeWarningCode.UNDEFINED_METHOD, operator, [methodName, staticType.displayName]);
}
@@ -1932,7 +2551,7 @@
node.staticElement = staticMethod;
Type2 propagatedType = getPropagatedType(leftOperand);
MethodElement propagatedMethod = lookUpMethod(leftOperand, propagatedType, methodName);
- node.element = select2(staticMethod, propagatedMethod);
+ node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
_resolver.reportError6(StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
}
@@ -2235,15 +2854,15 @@
recordResolution2(methodName, staticElement, propagatedElement);
ArgumentList argumentList = node.argumentList;
if (staticElement != null) {
- List<ParameterElement> parameters = computePropagatedParameters(argumentList, staticElement);
+ List<ParameterElement> parameters = computeCorrespondingParameters(argumentList, staticElement);
if (parameters != null) {
argumentList.correspondingStaticParameters = parameters;
}
}
if (propagatedElement != null) {
- List<ParameterElement> parameters = computePropagatedParameters(argumentList, propagatedElement);
+ List<ParameterElement> parameters = computeCorrespondingParameters(argumentList, propagatedElement);
if (parameters != null) {
- argumentList.correspondingParameters = parameters;
+ argumentList.correspondingPropagatedParameters = parameters;
}
}
ErrorCode errorCode = checkForInvocationError(target, staticElement);
@@ -2290,7 +2909,7 @@
node.staticElement = staticMethod;
Type2 propagatedType = getPropagatedType(operand);
MethodElement propagatedMethod = lookUpMethod(operand, propagatedType, methodName);
- node.element = select2(staticMethod, propagatedMethod);
+ node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
_resolver.reportError6(StaticTypeWarningCode.UNDEFINED_OPERATOR, node.operator, [methodName, staticType.displayName]);
}
@@ -2341,7 +2960,7 @@
node.staticElement = staticMethod;
Type2 propagatedType = getPropagatedType(operand);
MethodElement propagatedMethod = lookUpMethod(operand, propagatedType, methodName);
- node.element = select2(staticMethod, propagatedMethod);
+ node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
_resolver.reportError6(StaticTypeWarningCode.UNDEFINED_OPERATOR, operator, [methodName, staticType.displayName]);
}
@@ -2385,16 +3004,16 @@
return null;
}
Object visitSimpleIdentifier(SimpleIdentifier node) {
- if (node.element != null) {
+ if (node.staticElement != null || node.element != null) {
return null;
}
Element element = resolveSimpleIdentifier(node);
if (isFactoryConstructorReturnType(node) && element != _resolver.enclosingClass) {
_resolver.reportError(CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS, node, []);
- } else if (element == null) {
+ } else if (element == null || (element is PrefixElement && !isValidAsPrefix(node))) {
if (isConstructorReturnType(node)) {
_resolver.reportError(CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME, node, []);
- } else if (!classDeclaresNoSuchMethod(_resolver.enclosingClass)) {
+ } else {
_resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, node, [node.name]);
}
}
@@ -2491,22 +3110,22 @@
* @param element the element to be invoked
* @return the error code that should be reported
*/
- ErrorCode checkForInvocationError(Expression target, Element element2) {
- if (element2 is PropertyAccessorElement) {
- FunctionType getterType = ((element2 as PropertyAccessorElement)).type;
+ ErrorCode checkForInvocationError(Expression target, Element element) {
+ if (element is PropertyAccessorElement) {
+ FunctionType getterType = ((element as PropertyAccessorElement)).type;
if (getterType != null) {
Type2 returnType = getterType.returnType;
if (!isExecutableType(returnType)) {
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
}
- } else if (element2 is ExecutableElement) {
+ } else if (element is ExecutableElement) {
return null;
- } else if (element2 == null && target is SuperExpression) {
+ } else if (element == null && target is SuperExpression) {
return StaticTypeWarningCode.UNDEFINED_SUPER_METHOD;
} else {
- if (element2 is PropertyInducingElement) {
- PropertyAccessorElement getter = ((element2 as PropertyInducingElement)).getter;
+ if (element is PropertyInducingElement) {
+ PropertyAccessorElement getter = ((element as PropertyInducingElement)).getter;
FunctionType getterType = getter.type;
if (getterType != null) {
Type2 returnType = getterType.returnType;
@@ -2514,8 +3133,8 @@
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
}
- } else if (element2 is VariableElement) {
- Type2 variableType = ((element2 as VariableElement)).type;
+ } else if (element is VariableElement) {
+ Type2 variableType = ((element as VariableElement)).type;
if (!isExecutableType(variableType)) {
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
@@ -2524,10 +3143,8 @@
ClassElement enclosingClass = _resolver.enclosingClass;
if (enclosingClass == null) {
return StaticTypeWarningCode.UNDEFINED_FUNCTION;
- } else if (element2 == null) {
- if (!classDeclaresNoSuchMethod(enclosingClass)) {
- return StaticTypeWarningCode.UNDEFINED_METHOD;
- }
+ } else if (element == null) {
+ return StaticTypeWarningCode.UNDEFINED_METHOD;
} else {
return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
}
@@ -2535,7 +3152,7 @@
Type2 targetType = getStaticType(target);
if (targetType == null) {
return StaticTypeWarningCode.UNDEFINED_FUNCTION;
- } else if (!targetType.isDynamic && !classDeclaresNoSuchMethod2(targetType.element)) {
+ } else if (!targetType.isDynamic) {
return StaticTypeWarningCode.UNDEFINED_METHOD;
}
}
@@ -2545,36 +3162,6 @@
}
/**
- * Return `true` if the given class declares a method named "noSuchMethod" and is not the
- * class 'Object'.
- *
- * @param element the class being tested
- * @return `true` if the given class declares a method named "noSuchMethod"
- */
- bool classDeclaresNoSuchMethod(ClassElement classElement) {
- if (classElement == null) {
- return false;
- }
- MethodElement methodElement = classElement.lookUpMethod(_NO_SUCH_METHOD_METHOD_NAME, _resolver.definingLibrary);
- return methodElement != null && methodElement.enclosingElement.supertype != null;
- }
-
- /**
- * Return `true` if the given element represents a class that declares a method named
- * "noSuchMethod" and is not the class 'Object'.
- *
- * @param element the element being tested
- * @return `true` if the given element represents a class that declares a method named
- * "noSuchMethod"
- */
- bool classDeclaresNoSuchMethod2(Element element) {
- if (element is ClassElement) {
- return classDeclaresNoSuchMethod((element as ClassElement));
- }
- 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.
@@ -2583,7 +3170,7 @@
* @param executableElement the element that will be invoked with the arguments
* @return the parameters that correspond to the arguments
*/
- List<ParameterElement> computePropagatedParameters(ArgumentList argumentList, Element element2) {
+ List<ParameterElement> computeCorrespondingParameters(ArgumentList argumentList, Element element2) {
if (element2 is PropertyAccessorElement) {
FunctionType getterType = ((element2 as PropertyAccessorElement)).type;
if (getterType != null) {
@@ -2780,6 +3367,28 @@
}
/**
+ * Return `true` if the given node can validly be resolved to a prefix:
+ *
+ * * it is the prefix in an import directive, or
+ * * it is the prefix in a prefixed identifier.
+ *
+ *
+ * @param node the node being tested
+ * @return `true` if the given node is the prefix in an import directive
+ */
+ bool isValidAsPrefix(SimpleIdentifier node) {
+ ASTNode parent = node.parent;
+ if (parent is ImportDirective) {
+ return identical(((parent as ImportDirective)).prefix, node);
+ } else if (parent is PrefixedIdentifier) {
+ return true;
+ } else if (parent is MethodInvocation) {
+ return identical(((parent as MethodInvocation)).target, node);
+ }
+ return false;
+ }
+
+ /**
* Looks up the method element with the given name for index expression, reports
* [StaticWarningCode#UNDEFINED_OPERATOR] if not found.
*
@@ -2793,7 +3402,7 @@
MethodElement staticMethod = lookUpMethod(target, staticType, methodName);
MethodElement propagatedMethod = lookUpMethod(target, propagatedType, methodName);
node.staticElement = staticMethod;
- node.element = select2(staticMethod, propagatedMethod);
+ node.propagatedElement = propagatedMethod;
if (shouldReportMissingMember(staticType, staticMethod) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedMethod))) {
sc.Token leftBracket = node.leftBracket;
sc.Token rightBracket = node.rightBracket;
@@ -3315,7 +3924,7 @@
String name = nameNode.name;
ParameterElement element = namedParameters[name];
if (element == null) {
- ErrorCode errorCode = reportError2 ? CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER : StaticWarningCode.UNDEFINED_NAMED_PARAMETER;
+ ErrorCode errorCode = (reportError2 ? CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER : StaticWarningCode.UNDEFINED_NAMED_PARAMETER) as ErrorCode;
_resolver.reportError(errorCode, nameNode, [name]);
} else {
resolvedParameters[i] = element;
@@ -3332,10 +3941,10 @@
}
}
if (positionalArgumentCount < requiredParameters.length) {
- ErrorCode errorCode = reportError2 ? CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS;
+ ErrorCode errorCode = (reportError2 ? CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS) as ErrorCode;
_resolver.reportError(errorCode, argumentList, [requiredParameters.length, positionalArgumentCount]);
} else if (positionalArgumentCount > unnamedParameterCount) {
- ErrorCode errorCode = reportError2 ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS;
+ ErrorCode errorCode = (reportError2 ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS) as ErrorCode;
_resolver.reportError(errorCode, argumentList, [unnamedParameterCount, positionalArgumentCount]);
}
return resolvedParameters;
@@ -3462,25 +4071,21 @@
Element selectedElement = select(staticElement, propagatedElement);
propertyName.element = selectedElement;
if (shouldReportMissingMember(staticType, staticElement) && (_strictMode || propagatedType == null || shouldReportMissingMember(propagatedType, propagatedElement))) {
- bool staticNoSuchMethod = staticType != null && classDeclaresNoSuchMethod2(staticType.element);
- bool propagatedNoSuchMethod = propagatedType != null && classDeclaresNoSuchMethod2(propagatedType.element);
- if (!staticNoSuchMethod && (_strictMode || !propagatedNoSuchMethod)) {
- bool isStaticProperty = isStatic(selectedElement);
- if (propertyName.inSetterContext()) {
- if (isStaticProperty) {
- _resolver.reportError(StaticWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
- } else {
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
- }
- } else if (propertyName.inGetterContext()) {
- if (isStaticProperty) {
- _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
- } else {
- _resolver.reportError(StaticTypeWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
- }
+ bool isStaticProperty = isStatic(selectedElement);
+ if (propertyName.inSetterContext()) {
+ if (isStaticProperty) {
+ _resolver.reportError(StaticWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
} else {
- _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, propertyName, [propertyName.name]);
+ _resolver.reportError(StaticTypeWarningCode.UNDEFINED_SETTER, propertyName, [propertyName.name, staticType.displayName]);
}
+ } else if (propertyName.inGetterContext()) {
+ if (isStaticProperty) {
+ _resolver.reportError(StaticWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
+ } else {
+ _resolver.reportError(StaticTypeWarningCode.UNDEFINED_GETTER, propertyName, [propertyName.name, staticType.displayName]);
+ }
+ } else {
+ _resolver.reportError(StaticWarningCode.UNDEFINED_IDENTIFIER, propertyName, [propertyName.name]);
}
}
}
@@ -3607,9 +4212,6 @@
if (member != null || type == null || type.isDynamic) {
return false;
}
- if (type is InterfaceType) {
- return !classDeclaresNoSuchMethod(((type as InterfaceType)).element);
- }
return true;
}
}
@@ -3926,8 +4528,9 @@
}
InterfaceType supertype = classElt.supertype;
ClassElement superclassElement = supertype != null ? supertype.element : null;
+ List<InterfaceType> mixins = classElt.mixins;
List<InterfaceType> interfaces = classElt.interfaces;
- if ((superclassElement == null || supertype.isObject) && interfaces.length == 0) {
+ if ((superclassElement == null || supertype.isObject) && mixins.length == 0 && interfaces.length == 0) {
_interfaceLookup[classElt] = resultMap;
return resultMap;
}
@@ -3950,6 +4553,15 @@
}
}
}
+ for (InterfaceType mixinType in mixins) {
+ ClassElement mixinElement = mixinType.element;
+ if (mixinElement == null) {
+ continue;
+ }
+ Map<String, ExecutableElement> mapWithMixinMembers = new Map<String, ExecutableElement>();
+ recordMapWithClassMembers(mapWithMixinMembers, mixinElement);
+ lookupMaps.add(mapWithMixinMembers);
+ }
for (InterfaceType interfaceType in interfaces) {
ClassElement interfaceElement = interfaceType.element;
if (interfaceElement != null) {
@@ -4141,7 +4753,8 @@
* Record the passed map with the set of all members (methods, getters and setters) in the class
* into the passed map.
*
- * @param map some non-`null`
+ * @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
*/
void recordMapWithClassMembers(Map<String, ExecutableElement> map, ClassElement classElt) {
@@ -4280,6 +4893,24 @@
}
/**
+ * Return an array of the [CompilationUnit]s that make up the library. The first unit is
+ * always the defining unit.
+ *
+ * @return an array of the [CompilationUnit]s that make up the library. The first unit is
+ * always the defining unit
+ */
+ List<CompilationUnit> get compilationUnits {
+ List<CompilationUnit> unitArrayList = new List<CompilationUnit>();
+ unitArrayList.add(definingCompilationUnit);
+ for (Source source in _astMap.keys.toSet()) {
+ if (_librarySource != source) {
+ unitArrayList.add(getAST(source));
+ }
+ }
+ return new List.from(unitArrayList);
+ }
+
+ /**
* Return a collection containing the sources for the compilation units in this library, including
* the defining compilation unit.
*
@@ -4396,6 +5027,7 @@
}
String uriContent = uriLiteral.stringValue.trim();
_directiveUris[directive] = uriContent;
+ uriContent = Uri.encodeFull(uriContent);
try {
parseUriWithException(uriContent);
Source source = getSource2(uriContent);
@@ -4969,6 +5601,7 @@
nameToPrefixMap[prefixName] = prefix;
}
importElement.prefix = prefix;
+ prefixNode.staticElement = prefix;
}
directive.element = importElement;
imports.add(importElement);
@@ -5313,6 +5946,7 @@
if (uriContent == null) {
return null;
}
+ uriContent = Uri.encodeFull(uriContent);
try {
parseUriWithException(uriContent);
return _analysisContext.sourceFactory.resolveUri(librarySource, uriContent);
@@ -5350,9 +5984,10 @@
unit.accept(constantVerifier);
ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, library.libraryElement, _typeProvider, library.inheritanceManager);
unit.accept(errorVerifier);
- if (_enableHints) {
- new HintVerifier(_analysisContext, errorReporter).visitCompilationUnit(unit);
- }
+ }
+ if (_enableHints) {
+ HintGenerator hintGenerator = new HintGenerator(library.compilationUnits, _analysisContext, _errorListener);
+ hintGenerator.generateForLibrary();
}
}
}
@@ -5674,7 +6309,7 @@
try {
_overrideManager.enterScope();
propagateTrueState(condition);
- thenStatement.accept(this);
+ visitStatementInScope(thenStatement);
} finally {
thenOverrides = _overrideManager.captureLocalOverrides();
_overrideManager.exitScope();
@@ -5686,7 +6321,7 @@
try {
_overrideManager.enterScope();
propagateFalseState(condition);
- elseStatement.accept(this);
+ visitStatementInScope(elseStatement);
} finally {
elseOverrides = _overrideManager.captureLocalOverrides();
_overrideManager.exitScope();
@@ -5798,7 +6433,7 @@
try {
_overrideManager.enterScope();
propagateTrueState(condition);
- body.accept(this);
+ visitStatementInScope(body);
} finally {
_overrideManager.exitScope();
}
@@ -5886,7 +6521,7 @@
recordPropagatedType(loopVariable.identifier, iteratorElementType);
}
}
- body.accept(this);
+ visitStatementInScope(body);
} finally {
_overrideManager.exitScope();
}
@@ -5901,7 +6536,7 @@
_overrideManager.enterScope();
try {
propagateTrueState(node.condition);
- safelyVisit(node.body);
+ visitStatementInScope(node.body);
node.updaters.accept(this);
} finally {
_overrideManager.exitScope();
@@ -5988,7 +6623,7 @@
*/
void inferFunctionExpressionsParametersTypes(ArgumentList argumentList) {
for (Expression argument in argumentList.arguments) {
- ParameterElement parameter = argument.parameterElement;
+ ParameterElement parameter = argument.propagatedParameterElement;
if (parameter == null) {
parameter = argument.staticParameterElement;
}
@@ -6216,8 +6851,8 @@
TypeProvider get typeProvider => _typeProvider;
Object visitBlock(Block node) {
Scope outerScope = _nameScope;
- _nameScope = new EnclosedScope(_nameScope);
try {
+ _nameScope = new EnclosedScope(_nameScope);
super.visitBlock(node);
} finally {
_nameScope = outerScope;
@@ -6228,8 +6863,8 @@
SimpleIdentifier exception = node.exceptionParameter;
if (exception != null) {
Scope outerScope = _nameScope;
- _nameScope = new EnclosedScope(_nameScope);
try {
+ _nameScope = new EnclosedScope(_nameScope);
_nameScope.define(exception.element);
SimpleIdentifier stackTrace = node.stackTraceParameter;
if (stackTrace != null) {
@@ -6281,38 +6916,39 @@
return null;
}
Object visitDoStatement(DoStatement node) {
- LabelScope outerScope = _labelScope;
- _labelScope = new LabelScope.con1(outerScope, false, false);
+ LabelScope outerLabelScope = _labelScope;
try {
- super.visitDoStatement(node);
+ _labelScope = new LabelScope.con1(_labelScope, false, false);
+ visitStatementInScope(node.body);
+ safelyVisit(node.condition);
} finally {
- _labelScope = outerScope;
+ _labelScope = outerLabelScope;
}
return null;
}
Object visitForEachStatement(ForEachStatement node) {
- LabelScope outerLabelScope = _labelScope;
- _labelScope = new LabelScope.con1(outerLabelScope, false, false);
Scope outerNameScope = _nameScope;
- _nameScope = new EnclosedScope(_nameScope);
+ LabelScope outerLabelScope = _labelScope;
try {
+ _nameScope = new EnclosedScope(_nameScope);
+ _labelScope = new LabelScope.con1(outerLabelScope, false, false);
visitForEachStatementInScope(node);
} finally {
- _nameScope = outerNameScope;
_labelScope = outerLabelScope;
+ _nameScope = outerNameScope;
}
return null;
}
Object visitForStatement(ForStatement node) {
- LabelScope outerLabelScope = _labelScope;
- _labelScope = new LabelScope.con1(outerLabelScope, false, false);
Scope outerNameScope = _nameScope;
- _nameScope = new EnclosedScope(_nameScope);
+ LabelScope outerLabelScope = _labelScope;
try {
+ _nameScope = new EnclosedScope(_nameScope);
+ _labelScope = new LabelScope.con1(outerLabelScope, false, false);
visitForStatementInScope(node);
} finally {
- _nameScope = outerNameScope;
_labelScope = outerLabelScope;
+ _nameScope = outerNameScope;
}
return null;
}
@@ -6358,6 +6994,12 @@
}
return null;
}
+ Object visitIfStatement(IfStatement node) {
+ safelyVisit(node.condition);
+ visitStatementInScope(node.thenStatement);
+ visitStatementInScope(node.elseStatement);
+ return null;
+ }
Object visitLabeledStatement(LabeledStatement node) {
LabelScope outerScope = addScopesFor(node.labels);
try {
@@ -6380,8 +7022,8 @@
Object visitSwitchCase(SwitchCase node) {
node.expression.accept(this);
Scope outerNameScope = _nameScope;
- _nameScope = new EnclosedScope(_nameScope);
try {
+ _nameScope = new EnclosedScope(_nameScope);
node.statements.accept(this);
} finally {
_nameScope = outerNameScope;
@@ -6390,8 +7032,8 @@
}
Object visitSwitchDefault(SwitchDefault node) {
Scope outerNameScope = _nameScope;
- _nameScope = new EnclosedScope(_nameScope);
try {
+ _nameScope = new EnclosedScope(_nameScope);
node.statements.accept(this);
} finally {
_nameScope = outerNameScope;
@@ -6400,15 +7042,15 @@
}
Object visitSwitchStatement(SwitchStatement node) {
LabelScope outerScope = _labelScope;
- _labelScope = new LabelScope.con1(outerScope, true, false);
- for (SwitchMember member in node.members) {
- for (Label label in member.labels) {
- SimpleIdentifier labelName = label.label;
- LabelElement labelElement = labelName.element as LabelElement;
- _labelScope = new LabelScope.con2(_labelScope, labelName.name, labelElement);
- }
- }
try {
+ _labelScope = new LabelScope.con1(outerScope, true, false);
+ for (SwitchMember member in node.members) {
+ for (Label label in member.labels) {
+ SimpleIdentifier labelName = label.label;
+ LabelElement labelElement = labelName.element as LabelElement;
+ _labelScope = new LabelScope.con2(_labelScope, labelName.name, labelElement);
+ }
+ }
super.visitSwitchStatement(node);
} finally {
_labelScope = outerScope;
@@ -6427,9 +7069,10 @@
}
Object visitWhileStatement(WhileStatement node) {
LabelScope outerScope = _labelScope;
- _labelScope = new LabelScope.con1(outerScope, false, false);
try {
- super.visitWhileStatement(node);
+ _labelScope = new LabelScope.con1(outerScope, false, false);
+ safelyVisit(node.condition);
+ visitStatementInScope(node.body);
} finally {
_labelScope = outerScope;
}
@@ -6505,7 +7148,7 @@
void visitForEachStatementInScope(ForEachStatement node) {
safelyVisit(node.iterator);
safelyVisit(node.loopVariable);
- safelyVisit(node.body);
+ visitStatementInScope(node.body);
}
/**
@@ -6516,7 +7159,31 @@
* @param node the statement to be visited
*/
void visitForStatementInScope(ForStatement node) {
- super.visitForStatement(node);
+ safelyVisit(node.variables);
+ safelyVisit(node.initialization);
+ safelyVisit(node.condition);
+ node.updaters.accept(this);
+ visitStatementInScope(node.body);
+ }
+
+ /**
+ * Visit the given statement after it's scope has been created. This is used by ResolverVisitor to
+ * correctly visit the 'then' and 'else' statements of an 'if' statement.
+ *
+ * @param node the statement to be visited
+ */
+ void visitStatementInScope(Statement node) {
+ if (node is Block) {
+ visitBlock((node as Block));
+ } else if (node != null) {
+ Scope outerNameScope = _nameScope;
+ try {
+ _nameScope = new EnclosedScope(_nameScope);
+ node.accept(this);
+ } finally {
+ _nameScope = outerNameScope;
+ }
+ }
}
/**
@@ -6753,7 +7420,7 @@
Type2 staticType = getStaticType(rightHandSide);
recordStaticType(node, staticType);
Type2 overrideType = staticType;
- Type2 propagatedType = getPropagatedType(rightHandSide);
+ Type2 propagatedType = rightHandSide.propagatedType;
if (propagatedType != null) {
if (propagatedType.isMoreSpecificThan(staticType)) {
recordPropagatedType2(node, propagatedType);
@@ -6768,7 +7435,7 @@
ExecutableElement staticMethodElement = node.staticElement;
Type2 staticType = computeStaticReturnType(staticMethodElement);
recordStaticType(node, staticType);
- MethodElement propagatedMethodElement = node.element;
+ MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
@@ -6821,7 +7488,7 @@
Type2 staticType = computeStaticReturnType(staticMethodElement);
staticType = refineBinaryExpressionType(node, staticType);
recordStaticType(node, staticType);
- MethodElement propagatedMethodElement = node.element;
+ MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
@@ -6847,7 +7514,7 @@
*/
Object visitCascadeExpression(CascadeExpression node) {
recordStaticType(node, getStaticType(node.target));
- recordPropagatedType2(node, getPropagatedType(node.target));
+ recordPropagatedType2(node, node.target.propagatedType);
return null;
}
@@ -6874,8 +7541,8 @@
staticType = _dynamicType;
}
recordStaticType(node, staticType);
- Type2 propagatedThenType = getPropagatedType(node.thenExpression);
- Type2 propagatedElseType = getPropagatedType(node.elseExpression);
+ Type2 propagatedThenType = node.thenExpression.propagatedType;
+ Type2 propagatedElseType = node.elseExpression.propagatedType;
if (propagatedThenType != null || propagatedElseType != null) {
if (propagatedThenType == null) {
propagatedThenType = staticThenType;
@@ -6969,7 +7636,7 @@
if (staticPropagatedType != null && (staticStaticType == null || staticPropagatedType.isMoreSpecificThan(staticStaticType))) {
recordPropagatedType2(node, staticPropagatedType);
}
- ExecutableElement propagatedMethodElement = node.element;
+ ExecutableElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
Type2 propagatedStaticType = computeStaticReturnType(propagatedMethodElement);
if (propagatedStaticType != null && (staticStaticType == null || propagatedStaticType.isMoreSpecificThan(staticStaticType)) && (staticPropagatedType == null || propagatedStaticType.isMoreSpecificThan(staticPropagatedType))) {
@@ -6993,7 +7660,7 @@
ExecutableElement staticMethodElement = node.staticElement;
Type2 staticType = computeArgumentType(staticMethodElement);
recordStaticType(node, staticType);
- MethodElement propagatedMethodElement = node.element;
+ MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
Type2 propagatedType = computeArgumentType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
@@ -7004,7 +7671,7 @@
ExecutableElement staticMethodElement = node.staticElement;
Type2 staticType = computeStaticReturnType(staticMethodElement);
recordStaticType(node, staticType);
- MethodElement propagatedMethodElement = node.element;
+ MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
@@ -7095,9 +7762,9 @@
NodeList<Expression> elements = node.elements;
int count = elements.length;
if (count > 0) {
- Type2 propagatedType = getBestType(elements[0]);
+ Type2 propagatedType = elements[0].bestType;
for (int i = 1; i < count; i++) {
- Type2 elementType = getBestType(elements[i]);
+ Type2 elementType = elements[i].bestType;
if (propagatedType != elementType) {
propagatedType = _dynamicType;
} else {
@@ -7150,11 +7817,11 @@
int count = entries.length;
if (count > 0) {
MapLiteralEntry entry = entries[0];
- Type2 propagatedKeyType = getBestType(entry.key);
- Type2 propagatedValueType = getBestType(entry.value);
+ Type2 propagatedKeyType = entry.key.bestType;
+ Type2 propagatedValueType = entry.value.bestType;
for (int i = 1; i < count; i++) {
entry = entries[i];
- Type2 elementKeyType = getBestType(entry.key);
+ Type2 elementKeyType = entry.key.bestType;
if (propagatedKeyType != elementKeyType) {
propagatedKeyType = _dynamicType;
} else {
@@ -7163,7 +7830,7 @@
propagatedKeyType = _dynamicType;
}
}
- Type2 elementValueType = getBestType(entry.value);
+ Type2 elementValueType = entry.value.bestType;
if (propagatedValueType != elementValueType) {
propagatedValueType = _dynamicType;
} else {
@@ -7239,7 +7906,7 @@
String methodName = methodNameNode.name;
if (methodName == "then") {
Expression target = node.realTarget;
- Type2 targetType = target == null ? null : getBestType(target);
+ Type2 targetType = target == null ? null : target.bestType;
if (isAsyncFutureType(targetType)) {
NodeList<Expression> arguments = node.argumentList.arguments;
if (arguments.length == 1) {
@@ -7266,7 +7933,7 @@
if (methodName == "\$dom_createEvent") {
Expression target = node.realTarget;
if (target != null) {
- Type2 targetType = getBestType(target);
+ Type2 targetType = target.bestType;
if (targetType is InterfaceType && (targetType.name == "HtmlDocument" || targetType.name == "Document")) {
LibraryElement library = targetType.element.library;
if (isHtmlLibrary(library)) {
@@ -7291,7 +7958,7 @@
}
}
} else {
- Type2 targetType = getBestType(target);
+ Type2 targetType = target.bestType;
if (targetType is InterfaceType && (targetType.name == "HtmlDocument" || targetType.name == "Document")) {
LibraryElement library = targetType.element.library;
if (isHtmlLibrary(library)) {
@@ -7304,7 +7971,7 @@
}
} else if (methodName == "\$dom_createElement") {
Expression target = node.realTarget;
- Type2 targetType = getBestType(target);
+ Type2 targetType = target.bestType;
if (targetType is InterfaceType && (targetType.name == "HtmlDocument" || targetType.name == "Document")) {
LibraryElement library = targetType.element.library;
if (isHtmlLibrary(library)) {
@@ -7337,7 +8004,7 @@
Object visitNamedExpression(NamedExpression node) {
Expression expression = node.expression;
recordStaticType(node, getStaticType(expression));
- recordPropagatedType2(node, getPropagatedType(expression));
+ recordPropagatedType2(node, expression.propagatedType);
return null;
}
@@ -7352,7 +8019,7 @@
Object visitParenthesizedExpression(ParenthesizedExpression node) {
Expression expression = node.expression;
recordStaticType(node, getStaticType(expression));
- recordPropagatedType2(node, getPropagatedType(expression));
+ recordPropagatedType2(node, expression.propagatedType);
return null;
}
@@ -7393,7 +8060,7 @@
}
}
recordStaticType(node, staticType);
- recordPropagatedType2(node, getPropagatedType(operand));
+ recordPropagatedType2(node, operand.propagatedType);
return null;
}
@@ -7452,7 +8119,7 @@
}
}
recordStaticType(node, staticType);
- MethodElement propagatedMethodElement = node.element;
+ MethodElement propagatedMethodElement = node.propagatedElement;
if (propagatedMethodElement != staticMethodElement) {
Type2 propagatedType = computeStaticReturnType(propagatedMethodElement);
if (propagatedType != null && propagatedType.isMoreSpecificThan(staticType)) {
@@ -7635,6 +8302,10 @@
}
return null;
}
+ Object visitSymbolLiteral(SymbolLiteral node) {
+ recordStaticType(node, _typeProvider.symbolType);
+ return null;
+ }
/**
* The Dart Language Specification, 12.10: <blockquote>The static type of `this` is the
@@ -7660,7 +8331,7 @@
Object visitVariableDeclaration(VariableDeclaration node) {
Expression initializer = node.initializer;
if (initializer != null) {
- Type2 rightType = getBestType(initializer);
+ Type2 rightType = initializer.bestType;
SimpleIdentifier name = node.name;
recordPropagatedType2(name, rightType);
VariableElement element = name.element as VariableElement;
@@ -7711,11 +8382,11 @@
Type2 computePropagatedReturnType2(FunctionBody body) {
if (body is ExpressionFunctionBody) {
ExpressionFunctionBody expressionBody = body as ExpressionFunctionBody;
- return getBestType(expressionBody.expression);
+ return expressionBody.expression.bestType;
}
if (body is BlockFunctionBody) {
List<Type2> result = [null];
- body.accept(new GeneralizingASTVisitor_8(this, result));
+ body.accept(new GeneralizingASTVisitor_8(result));
return result[0];
}
return null;
@@ -7799,24 +8470,6 @@
}
/**
- * Return the propagated type of the given expression if it is available, or the static type if
- * there is no propagated type.
- *
- * @param expression the expression whose type is to be returned
- * @return the propagated or static type of the given expression
- */
- Type2 getBestType(Expression expression) {
- Type2 type = expression.propagatedType;
- if (type == null) {
- type = expression.staticType;
- if (type == null) {
- return _dynamicType;
- }
- }
- return type;
- }
-
- /**
* If the given element name can be mapped to the name of a class defined within the given
* library, return the type specified by the argument.
*
@@ -7909,17 +8562,6 @@
Type2 getFirstArgumentAsType2(LibraryElement library, ArgumentList argumentList, Map<String, String> nameMap) => getElementNameAsType(library, getFirstArgumentAsString(argumentList), nameMap);
/**
- * Return the propagated type of the given expression.
- *
- * @param expression the expression whose type is to be returned
- * @return the propagated type of the given expression
- */
- Type2 getPropagatedType(Expression expression) {
- Type2 type = expression.propagatedType;
- return type;
- }
-
- /**
* Return the static type of the given expression.
*
* @param expression the expression whose type is to be returned
@@ -8105,15 +8747,14 @@
set thisType_J2DAccessor(__v) => _thisType = __v;
}
class GeneralizingASTVisitor_8 extends GeneralizingASTVisitor<Object> {
- final StaticTypeAnalyzer StaticTypeAnalyzer_this;
List<Type2> result;
- GeneralizingASTVisitor_8(this.StaticTypeAnalyzer_this, this.result) : super();
+ GeneralizingASTVisitor_8(this.result) : super();
Object visitExpression(Expression node) => null;
Object visitReturnStatement(ReturnStatement node) {
Type2 type;
Expression expression = node.expression;
if (expression != null) {
- type = StaticTypeAnalyzer_this.getBestType(expression);
+ type = expression.bestType;
} else {
type = BottomTypeImpl.instance;
}
@@ -8638,7 +9279,7 @@
InterfaceType superclassType = null;
ExtendsClause extendsClause = node.extendsClause;
if (extendsClause != null) {
- ErrorCode errorCode = node.withClause == null ? CompileTimeErrorCode.EXTENDS_NON_CLASS : CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS;
+ ErrorCode errorCode = (node.withClause == null ? CompileTimeErrorCode.EXTENDS_NON_CLASS : CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS) as ErrorCode;
superclassType = resolveType(extendsClause.superclass, errorCode, errorCode);
if (superclassType != typeProvider.objectType) {
classElement.validMixin = false;
@@ -8826,6 +9467,7 @@
} else {
reportError(StaticWarningCode.NEW_WITH_NON_TYPE, prefixedIdentifier.identifier, [prefixedIdentifier.identifier.name]);
}
+ setElement(prefix, element);
return null;
} else if (element != null) {
name.name = prefixedIdentifier.identifier;
@@ -8874,7 +9516,11 @@
elementValid = false;
}
if (!elementValid) {
- setElement(typeName, _dynamicType.element);
+ if (element is MultiplyDefinedElement) {
+ setElement(typeName, element);
+ } else {
+ setElement(typeName, _dynamicType.element);
+ }
typeName.staticType = _dynamicType;
node.type = _dynamicType;
return null;
@@ -9369,12 +10015,12 @@
List<ParameterElement> parameters = getElements(parameterList);
FunctionTypeAliasElementImpl aliasElement = new FunctionTypeAliasElementImpl(null);
aliasElement.synthetic = true;
- aliasElement.parameters = parameters;
+ aliasElement.shareParameters(parameters);
aliasElement.returnType = computeReturnType(returnType2);
FunctionTypeImpl type = new FunctionTypeImpl.con2(aliasElement);
ClassElement definingClass = element.getAncestor(ClassElement);
if (definingClass != null) {
- aliasElement.typeVariables = definingClass.typeVariables;
+ aliasElement.shareTypeVariables(definingClass.typeVariables);
type.typeArguments = definingClass.type.typeArguments;
} else {
FunctionTypeAliasElement alias = element.getAncestor(FunctionTypeAliasElement);
@@ -9654,51 +10300,6 @@
class LibraryImportScope extends Scope {
/**
- * @return `true` if the given [Identifier] is the part of type annotation.
- */
- static bool isTypeAnnotation(Identifier identifier) {
- ASTNode parent = identifier.parent;
- if (parent is TypeName) {
- ASTNode parent2 = parent.parent;
- if (parent2 is FunctionDeclaration) {
- FunctionDeclaration decl = parent2 as FunctionDeclaration;
- return identical(decl.returnType, parent);
- }
- if (parent2 is FunctionTypeAlias) {
- FunctionTypeAlias decl = parent2 as FunctionTypeAlias;
- return identical(decl.returnType, parent);
- }
- if (parent2 is MethodDeclaration) {
- MethodDeclaration decl = parent2 as MethodDeclaration;
- return identical(decl.returnType, parent);
- }
- if (parent2 is VariableDeclarationList) {
- VariableDeclarationList decl = parent2 as VariableDeclarationList;
- return identical(decl.type, parent);
- }
- if (parent2 is SimpleFormalParameter) {
- SimpleFormalParameter decl = parent2 as SimpleFormalParameter;
- return identical(decl.type, parent);
- }
- if (parent2 is TypeParameter) {
- TypeParameter decl = parent2 as TypeParameter;
- return identical(decl.bound, parent);
- }
- if (parent2 is TypeArgumentList) {
- ASTNode parent3 = parent2.parent;
- if (parent3 is TypeName) {
- TypeName typeName = parent3 as TypeName;
- if (identical((typeName).typeArguments, parent2)) {
- return isTypeAnnotation(typeName.name);
- }
- }
- }
- return false;
- }
- return false;
- }
-
- /**
* The element representing the library in which this scope is enclosed.
*/
LibraryElement _definingLibrary;
@@ -9760,8 +10361,7 @@
if (enclosingLibrary != null) {
libName2 = enclosingLibrary.definingCompilationUnit.displayName;
}
- ErrorCode errorCode = isTypeAnnotation(identifier) ? StaticWarningCode.AMBIGUOUS_IMPORT : CompileTimeErrorCode.AMBIGUOUS_IMPORT;
- _errorListener.onError(new AnalysisError.con2(source, identifier.offset, identifier.length, errorCode, [foundEltName, libName1, libName2]));
+ _errorListener.onError(new AnalysisError.con2(source, identifier.offset, identifier.length, StaticWarningCode.AMBIGUOUS_IMPORT, [foundEltName, libName1, libName2]));
return foundElement;
}
if (foundElement != null) {
@@ -10579,7 +11179,7 @@
* @param constructor the constant constructor declaration to validate
*/
void validateInitializers(ConstructorDeclaration constructor) {
- List<ParameterElement> parameterElements = constructor.parameters.elements;
+ List<ParameterElement> parameterElements = constructor.parameters.parameterElements;
NodeList<ConstructorInitializer> initializers = constructor.initializers;
for (ConstructorInitializer initializer in initializers) {
if (initializer is ConstructorFieldInitializer) {
@@ -10630,209 +11230,6 @@
}
}
/**
- * Instances of the class `DeadCodeVerifier` traverse an AST structure looking for cases of
- * [HintCode#DEAD_CODE].
- *
- * @coverage dart.engine.resolver
- */
-class DeadCodeVerifier extends RecursiveASTVisitor<Object> {
-
- /**
- * The error reporter by which errors will be reported.
- */
- ErrorReporter _errorReporter;
-
- /**
- * Create a new instance of the [DeadCodeVerifier].
- *
- * @param errorReporter the error reporter
- */
- DeadCodeVerifier(ErrorReporter errorReporter) {
- this._errorReporter = errorReporter;
- }
- Object visitBinaryExpression(BinaryExpression node) {
- sc.Token operator = node.operator;
- bool isAmpAmp = identical(operator.type, sc.TokenType.AMPERSAND_AMPERSAND);
- bool isBarBar = identical(operator.type, sc.TokenType.BAR_BAR);
- if (isAmpAmp || isBarBar) {
- Expression lhsCondition = node.leftOperand;
- ValidResult lhsResult = getConstantBooleanValue(lhsCondition);
- if (lhsResult != null) {
- if (identical(lhsResult, ValidResult.RESULT_TRUE) && isBarBar) {
- _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, []);
- safelyVisit(lhsCondition);
- return null;
- } else if (identical(lhsResult, ValidResult.RESULT_FALSE) && isAmpAmp) {
- _errorReporter.reportError2(HintCode.DEAD_CODE, node.rightOperand, []);
- safelyVisit(lhsCondition);
- return null;
- }
- }
- }
- return super.visitBinaryExpression(node);
- }
-
- /**
- * For each [Block], this method reports and error on all statements between the end of the
- * block and the first return statement (assuming there it is not at the end of the block.)
- *
- * @param node the block to evaluate
- */
- Object visitBlock(Block node) {
- NodeList<Statement> statements = node.statements;
- int size = statements.length;
- for (int i = 0; i < size; i++) {
- Statement currentStatement = statements[i];
- safelyVisit(currentStatement);
- if (currentStatement is ReturnStatement && i != size - 1) {
- Statement nextStatement = statements[i + 1];
- Statement lastStatement = statements[size - 1];
- int offset = nextStatement.offset;
- int length = lastStatement.end - offset;
- _errorReporter.reportError3(HintCode.DEAD_CODE, offset, length, []);
- return null;
- }
- }
- return null;
- }
- Object visitConditionalExpression(ConditionalExpression node) {
- Expression conditionExpression = node.condition;
- ValidResult result = getConstantBooleanValue(conditionExpression);
- if (result != null) {
- if (identical(result, ValidResult.RESULT_TRUE)) {
- _errorReporter.reportError2(HintCode.DEAD_CODE, node.elseExpression, []);
- safelyVisit(node.thenExpression);
- return null;
- } else {
- _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenExpression, []);
- safelyVisit(node.elseExpression);
- return null;
- }
- }
- return super.visitConditionalExpression(node);
- }
- Object visitIfStatement(IfStatement node) {
- Expression conditionExpression = node.condition;
- ValidResult result = getConstantBooleanValue(conditionExpression);
- if (result != null) {
- if (identical(result, ValidResult.RESULT_TRUE)) {
- Statement elseStatement = node.elseStatement;
- if (elseStatement != null) {
- _errorReporter.reportError2(HintCode.DEAD_CODE, elseStatement, []);
- safelyVisit(node.thenStatement);
- return null;
- }
- } else {
- _errorReporter.reportError2(HintCode.DEAD_CODE, node.thenStatement, []);
- safelyVisit(node.elseStatement);
- return null;
- }
- }
- return super.visitIfStatement(node);
- }
- Object visitTryStatement(TryStatement node) {
- safelyVisit(node.body);
- safelyVisit(node.finallyClause);
- NodeList<CatchClause> catchClauses = node.catchClauses;
- int numOfCatchClauses = catchClauses.length;
- List<Type2> visitedTypes = new List<Type2>();
- for (int i = 0; i < numOfCatchClauses; i++) {
- CatchClause catchClause = catchClauses[i];
- if (catchClause.onKeyword != null) {
- TypeName typeName = catchClause.exceptionType;
- if (typeName != null && typeName.type != null) {
- Type2 currentType = typeName.type;
- if (currentType.isObject) {
- safelyVisit(catchClause);
- if (i + 1 != numOfCatchClauses) {
- CatchClause nextCatchClause = catchClauses[i + 1];
- CatchClause lastCatchClause = catchClauses[numOfCatchClauses - 1];
- int offset = nextCatchClause.offset;
- int length = lastCatchClause.end - offset;
- _errorReporter.reportError3(HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH, offset, length, []);
- return null;
- }
- }
- for (Type2 type in visitedTypes) {
- if (currentType.isSubtypeOf(type)) {
- CatchClause lastCatchClause = catchClauses[numOfCatchClauses - 1];
- int offset = catchClause.offset;
- int length = lastCatchClause.end - offset;
- _errorReporter.reportError3(HintCode.DEAD_CODE_ON_CATCH_SUBTYPE, offset, length, [currentType.displayName, type.displayName]);
- return null;
- }
- }
- visitedTypes.add(currentType);
- }
- safelyVisit(catchClause);
- } else {
- safelyVisit(catchClause);
- if (i + 1 != numOfCatchClauses) {
- CatchClause nextCatchClause = catchClauses[i + 1];
- CatchClause lastCatchClause = catchClauses[numOfCatchClauses - 1];
- int offset = nextCatchClause.offset;
- int length = lastCatchClause.end - offset;
- _errorReporter.reportError3(HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH, offset, length, []);
- return null;
- }
- }
- }
- return null;
- }
- Object visitWhileStatement(WhileStatement node) {
- Expression conditionExpression = node.condition;
- safelyVisit(conditionExpression);
- ValidResult result = getConstantBooleanValue(conditionExpression);
- if (result != null) {
- if (identical(result, ValidResult.RESULT_FALSE)) {
- _errorReporter.reportError2(HintCode.DEAD_CODE, node.body, []);
- return null;
- }
- }
- safelyVisit(node.body);
- return null;
- }
-
- /**
- * Given some [Expression], this method returns [ValidResult#RESULT_TRUE] if it is
- * `true`, [ValidResult#RESULT_FALSE] if it is `false`, or `null` if the
- * expression is not a constant boolean value.
- *
- * @param expression the expression to evaluate
- * @return [ValidResult#RESULT_TRUE] if it is `true`, [ValidResult#RESULT_FALSE]
- * if it is `false`, or `null` if the expression is not a constant boolean
- * value
- */
- ValidResult getConstantBooleanValue(Expression expression) {
- if (expression is BooleanLiteral) {
- if (((expression as BooleanLiteral)).value) {
- return ValidResult.RESULT_TRUE;
- } else {
- return ValidResult.RESULT_FALSE;
- }
- } else {
- EvaluationResultImpl result = expression.accept(new ConstantVisitor());
- if (identical(result, ValidResult.RESULT_TRUE)) {
- return ValidResult.RESULT_TRUE;
- } else if (identical(result, ValidResult.RESULT_FALSE)) {
- return ValidResult.RESULT_FALSE;
- }
- return null;
- }
- }
-
- /**
- * If the given node is not `null`, visit this instance of the dead code verifier.
- *
- * @param node the node to be visited
- */
- void safelyVisit(ASTNode node) {
- if (node != null) {
- node.accept(this);
- }
- }
-}
-/**
* Instances of the class `ErrorVerifier` traverse an AST structure looking for additional
* errors and warnings not covered by the parser and resolver.
*
@@ -11045,6 +11442,7 @@
checkForInvalidAssignment(node);
}
checkForAssignmentToFinal(node);
+ checkForArgumentTypeNotAssignable2(node.rightHandSide);
return super.visitAssignmentExpression(node);
}
Object visitBinaryExpression(BinaryExpression node) {
@@ -11331,12 +11729,19 @@
checkForStaticAccessToInstanceMember(node.target, node.methodName);
return super.visitMethodInvocation(node);
}
+ Object visitNativeClause(NativeClause node) {
+ if (!_isInSystemLibrary) {
+ _errorReporter.reportError2(ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE, node, []);
+ }
+ return super.visitNativeClause(node);
+ }
Object visitNativeFunctionBody(NativeFunctionBody node) {
checkForNativeFunctionBodyInNonSDKCode(node);
return super.visitNativeFunctionBody(node);
}
Object visitPostfixExpression(PostfixExpression node) {
checkForAssignmentToFinal2(node.operand);
+ checkForIntNotAssignable(node.operand);
return super.visitPostfixExpression(node);
}
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
@@ -11349,6 +11754,7 @@
if (node.operator.type.isIncrementOperator) {
checkForAssignmentToFinal2(node.operand);
}
+ checkForIntNotAssignable(node.operand);
return super.visitPrefixExpression(node);
}
Object visitPropertyAccess(PropertyAccess node) {
@@ -11857,7 +12263,7 @@
if (redirectedElement == null) {
TypeName constructorTypeName = redirectedNode.type;
Type2 redirectedType = constructorTypeName.type;
- if (redirectedType != null && redirectedType.element != null && redirectedType.element != DynamicElementImpl.instance) {
+ if (redirectedType != null && redirectedType.element != null && !redirectedType.isDynamic) {
String constructorStrName = constructorTypeName.name.name;
if (redirectedNode.name != null) {
constructorStrName += ".${redirectedNode.name.name}";
@@ -12010,7 +12416,7 @@
}
ParameterElement staticParameterElement = argument.staticParameterElement;
Type2 staticParameterType = staticParameterElement == null ? null : staticParameterElement.type;
- ParameterElement propagatedParameterElement = argument.parameterElement;
+ ParameterElement propagatedParameterElement = argument.propagatedParameterElement;
Type2 propagatedParameterType = propagatedParameterElement == null ? null : propagatedParameterElement.type;
return checkForArgumentTypeNotAssignable3(argument, staticParameterType, propagatedParameterType, errorCode);
}
@@ -12025,35 +12431,48 @@
* @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
* @see CompileTimeErrorCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
*/
- bool checkForArgumentTypeNotAssignable3(Expression expression, Type2 expectedStaticType, Type2 expectedPropagatedType, ErrorCode errorCode) {
- Type2 staticArgumentType = getStaticType(expression);
- if (staticArgumentType == null || expectedStaticType == null) {
+ bool checkForArgumentTypeNotAssignable3(Expression expression, Type2 expectedStaticType, Type2 expectedPropagatedType, ErrorCode errorCode) => checkForArgumentTypeNotAssignable4(expression, expectedStaticType, getStaticType(expression), expectedPropagatedType, expression.propagatedType, errorCode);
+
+ /**
+ * This verifies that the passed expression can be assigned to its corresponding parameters.
+ *
+ * @param expression the expression to evaluate
+ * @param expectedStaticType the expected static type of the parameter
+ * @param actualStaticType the actual static type of the argument
+ * @param expectedPropagatedType the expected propagated type of the parameter, may be
+ * `null`
+ * @param actualPropagatedType the expected propagated type of the parameter, may be `null`
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
+ * @see CompileTimeErrorCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
+ */
+ bool checkForArgumentTypeNotAssignable4(Expression expression, Type2 expectedStaticType, Type2 actualStaticType, Type2 expectedPropagatedType, Type2 actualPropagatedType, ErrorCode errorCode) {
+ if (actualStaticType == null || expectedStaticType == null) {
return false;
}
if (_strictMode) {
- if (staticArgumentType.isAssignableTo(expectedStaticType)) {
+ if (actualStaticType.isAssignableTo(expectedStaticType)) {
return false;
}
_errorReporter.reportError2(errorCode, expression, [
- staticArgumentType.displayName,
+ actualStaticType.displayName,
expectedStaticType.displayName]);
return true;
}
- Type2 propagatedArgumentType = getPropagatedType(expression);
- if (propagatedArgumentType == null || expectedPropagatedType == null) {
- if (staticArgumentType.isAssignableTo(expectedStaticType)) {
+ if (actualPropagatedType == null || expectedPropagatedType == null) {
+ if (actualStaticType.isAssignableTo(expectedStaticType)) {
return false;
}
_errorReporter.reportError2(errorCode, expression, [
- staticArgumentType.displayName,
+ actualStaticType.displayName,
expectedStaticType.displayName]);
return true;
}
- if (staticArgumentType.isAssignableTo(expectedStaticType) || staticArgumentType.isAssignableTo(expectedPropagatedType) || propagatedArgumentType.isAssignableTo(expectedStaticType) || propagatedArgumentType.isAssignableTo(expectedPropagatedType)) {
+ if (actualStaticType.isAssignableTo(expectedStaticType) || actualStaticType.isAssignableTo(expectedPropagatedType) || actualPropagatedType.isAssignableTo(expectedStaticType) || actualPropagatedType.isAssignableTo(expectedPropagatedType)) {
return false;
}
_errorReporter.reportError2(errorCode, expression, [
- (propagatedArgumentType == null ? staticArgumentType : propagatedArgumentType).displayName,
+ (actualPropagatedType == null ? actualStaticType : actualPropagatedType).displayName,
(expectedPropagatedType == null ? expectedStaticType : expectedPropagatedType).displayName]);
return true;
}
@@ -12075,6 +12494,7 @@
*
* @param node the expression to evaluate
* @return `true` if and only if an error code is generated on the passed node
+ * @see StaticWarningCode#ASSIGNMENT_TO_CONST
* @see StaticWarningCode#ASSIGNMENT_TO_FINAL
* @see StaticWarningCode#ASSIGNMENT_TO_METHOD
*/
@@ -12086,17 +12506,17 @@
if (expression is PropertyAccess) {
element = ((expression as PropertyAccess)).propertyName.element;
}
+ if (element is PropertyAccessorElement) {
+ PropertyAccessorElement accessor = element as PropertyAccessorElement;
+ element = accessor.variable;
+ }
if (element is VariableElement) {
- VariableElement leftVar = element as VariableElement;
- if (leftVar.isFinal) {
- _errorReporter.reportError2(StaticWarningCode.ASSIGNMENT_TO_FINAL, expression, []);
+ VariableElement variable = element as VariableElement;
+ if (variable.isConst) {
+ _errorReporter.reportError2(StaticWarningCode.ASSIGNMENT_TO_CONST, expression, []);
return true;
}
- return false;
- }
- if (element is PropertyAccessorElement) {
- PropertyAccessorElement leftAccessor = element as PropertyAccessorElement;
- if (!leftAccessor.isSetter) {
+ if (variable.isFinal) {
_errorReporter.reportError2(StaticWarningCode.ASSIGNMENT_TO_FINAL, expression, []);
return true;
}
@@ -12864,7 +13284,7 @@
}
return true;
}
- Type2 propagatedType = getPropagatedType(expression);
+ Type2 propagatedType = expression.propagatedType;
if (propagatedType != null && propagatedType.isAssignableTo(fieldType)) {
return false;
}
@@ -13113,9 +13533,9 @@
SwitchCase switchCase = switchMember as SwitchCase;
Expression expression = switchCase.expression;
if (firstType == null) {
- firstType = getBestType(expression);
+ firstType = expression.bestType;
} else {
- Type2 nType = getBestType(expression);
+ Type2 nType = expression.bestType;
if (firstType != nType) {
_errorReporter.reportError2(CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, expression, [expression.toSource(), firstType.displayName]);
foundError = true;
@@ -13149,6 +13569,33 @@
}
/**
+ * 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.
+ *
+ * @param argument the expression to which the operator is being applied
+ * @return `true` if and only if an error code is generated on the passed node
+ * @see StaticWarningCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
+ * @see CompileTimeErrorCode#ARGUMENT_TYPE_NOT_ASSIGNABLE
+ */
+ bool checkForIntNotAssignable(Expression argument) {
+ if (argument == null) {
+ return false;
+ }
+ ErrorCode errorCode;
+ if (_isInConstInstanceCreation || _isEnclosingConstructorConst) {
+ errorCode = CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE;
+ } else {
+ errorCode = StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE;
+ }
+ ParameterElement staticParameterElement = argument.staticParameterElement;
+ Type2 staticParameterType = staticParameterElement == null ? null : staticParameterElement.type;
+ ParameterElement propagatedParameterElement = argument.propagatedParameterElement;
+ Type2 propagatedParameterType = propagatedParameterElement == null ? null : propagatedParameterElement.type;
+ return checkForArgumentTypeNotAssignable4(argument, staticParameterType, _typeProvider.intType, propagatedParameterType, _typeProvider.intType, errorCode);
+ }
+
+ /**
* Given an assignment using a compound assignment operator, this verifies that the given
* assignment is valid.
*
@@ -13163,7 +13610,7 @@
}
VariableElement leftElement = getVariableElement(lhs);
Type2 leftType = (leftElement == null) ? getStaticType(lhs) : leftElement.type;
- MethodElement invokedMethod = node.element;
+ MethodElement invokedMethod = node.staticElement;
if (invokedMethod == null) {
return false;
}
@@ -13194,7 +13641,7 @@
Type2 leftType = (leftElement == null) ? getStaticType(lhs) : leftElement.type;
Type2 staticRightType = getStaticType(rhs);
bool isStaticAssignable = staticRightType.isAssignableTo(leftType);
- Type2 propagatedRightType = getPropagatedType(rhs);
+ Type2 propagatedRightType = rhs.propagatedType;
if (_strictMode || propagatedRightType == null) {
if (!isStaticAssignable) {
_errorReporter.reportError2(StaticTypeWarningCode.INVALID_ASSIGNMENT, rhs, [staticRightType.displayName, leftType.displayName]);
@@ -13574,39 +14021,22 @@
if (_enclosingClass.isAbstract) {
return false;
}
- Set<ExecutableElement> missingOverrides = new Set<ExecutableElement>();
+ List<MethodElement> methods = _enclosingClass.methods;
+ List<PropertyAccessorElement> accessors = _enclosingClass.accessors;
Set<String> methodsInEnclosingClass = new Set<String>();
Set<String> accessorsInEnclosingClass = new Set<String>();
- List<MethodElement> methods = _enclosingClass.methods;
for (MethodElement method in methods) {
javaSetAdd(methodsInEnclosingClass, method.name);
}
- List<PropertyAccessorElement> accessors = _enclosingClass.accessors;
for (PropertyAccessorElement accessor in accessors) {
javaSetAdd(accessorsInEnclosingClass, accessor.name);
}
- Map<String, ExecutableElement> membersInheritedFromSuperclasses = _inheritanceManager.getMapOfMembersInheritedFromClasses(_enclosingClass);
- for (MapEntry<String, ExecutableElement> entry in getMapEntrySet(membersInheritedFromSuperclasses)) {
- ExecutableElement executableElt = entry.getValue();
- if (executableElt is MethodElement) {
- MethodElement methodElt = executableElt as MethodElement;
- if (methodElt.isAbstract) {
- String methodName = entry.getKey();
- if (!methodsInEnclosingClass.contains(methodName)) {
- javaSetAdd(missingOverrides, executableElt);
- }
- }
- } else if (executableElt is PropertyAccessorElement) {
- PropertyAccessorElement propertyAccessorElt = executableElt as PropertyAccessorElement;
- if (propertyAccessorElt.isAbstract) {
- String accessorName = entry.getKey();
- if (!accessorsInEnclosingClass.contains(accessorName)) {
- javaSetAdd(missingOverrides, executableElt);
- }
- }
- }
+ if (methodsInEnclosingClass.contains(ElementResolver.NO_SUCH_METHOD_METHOD_NAME)) {
+ return false;
}
+ Set<ExecutableElement> missingOverrides = new Set<ExecutableElement>();
Map<String, ExecutableElement> membersInheritedFromInterfaces = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(_enclosingClass);
+ Map<String, ExecutableElement> membersInheritedFromSuperclasses = _inheritanceManager.getMapOfMembersInheritedFromClasses(_enclosingClass);
for (MapEntry<String, ExecutableElement> entry in getMapEntrySet(membersInheritedFromInterfaces)) {
ExecutableElement executableElt = entry.getValue();
ExecutableElement elt = membersInheritedFromSuperclasses[executableElt.name];
@@ -13619,12 +14049,12 @@
}
if (executableElt is MethodElement) {
String methodName = entry.getKey();
- if (!methodsInEnclosingClass.contains(methodName)) {
+ if (!methodsInEnclosingClass.contains(methodName) && !memberHasConcreteMethodImplementationInSuperclassChain(_enclosingClass, methodName, new List<ClassElement>())) {
javaSetAdd(missingOverrides, executableElt);
}
} else if (executableElt is PropertyAccessorElement) {
String accessorName = entry.getKey();
- if (!accessorsInEnclosingClass.contains(accessorName)) {
+ if (!accessorsInEnclosingClass.contains(accessorName) && !memberHasConcreteAccessorImplementationInSuperclassChain(_enclosingClass, accessorName, new List<ClassElement>())) {
javaSetAdd(missingOverrides, executableElt);
}
}
@@ -13905,7 +14335,7 @@
_errorReporter.reportError3(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, _enclosingClass.nameOffset, enclosingClassName.length, [enclosingClassName, builder.toString()]);
return true;
} else if (list.length == 2) {
- ErrorCode errorCode = supertype != null && _enclosingClass == supertype.element ? CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS : CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS;
+ ErrorCode errorCode = (supertype != null && _enclosingClass == supertype.element ? CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS : CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS) as ErrorCode;
_errorReporter.reportError3(errorCode, _enclosingClass.nameOffset, enclosingClassName.length, [enclosingClassName]);
return true;
}
@@ -14115,7 +14545,7 @@
return true;
}
bool isStaticAssignable = staticReturnType.isAssignableTo(expectedReturnType);
- Type2 propagatedReturnType = getPropagatedType(returnExpression);
+ Type2 propagatedReturnType = returnExpression.propagatedType;
if (_strictMode || propagatedReturnType == null) {
if (isStaticAssignable) {
return false;
@@ -14203,7 +14633,7 @@
*/
bool checkForTypeAliasCannotReferenceItself_function(FunctionTypeAlias node) {
FunctionTypeAliasElement element = node.element;
- if (!hasFunctionTypeAliasSelfReference(element)) {
+ if (!hasTypedefSelfReference(element)) {
return false;
}
_errorReporter.reportError2(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, node, []);
@@ -14218,7 +14648,7 @@
*/
bool checkForTypeAliasCannotReferenceItself_mixin(ClassTypeAlias node) {
ClassElement element = node.element;
- if (!hasClassTypeAliasSelfReference(element, new Set<ClassElement>())) {
+ if (!hasTypedefSelfReference(element)) {
return false;
}
_errorReporter.reportError2(CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, node, []);
@@ -14432,21 +14862,6 @@
}
/**
- * Return the propagated type of the given expression, or the static type if there is no
- * propagated type information.
- *
- * @param expression the expression whose type is to be returned
- * @return the propagated or static type of the given expression, whichever is best
- */
- Type2 getBestType(Expression expression) {
- Type2 type = getPropagatedType(expression);
- if (type == null) {
- type = getStaticType(expression);
- }
- return type;
- }
-
- /**
* Returns the Type (return type) for a given getter.
*
* @param propertyAccessorElement
@@ -14462,14 +14877,6 @@
}
/**
- * Return the propagated type of the given expression that is to be used for type analysis.
- *
- * @param expression the expression whose type is to be returned
- * @return the propagated type of the given expression
- */
- Type2 getPropagatedType(Expression expression) => expression.propagatedType;
-
- /**
* Returns the Type (first and only parameter) for a given setter.
*
* @param propertyAccessorElement
@@ -14515,78 +14922,6 @@
}
/**
- * @return <code>true</code> if given [ClassElement] has direct or indirect reference to
- * itself using only other typedef [ClassElement]s.
- */
- bool hasClassTypeAliasSelfReference(ClassElement element2, Set<ClassElement> seenMixins) {
- if (seenMixins.contains(element2)) {
- return true;
- }
- javaSetAdd(seenMixins, element2);
- for (InterfaceType mixin in element2.mixins) {
- ClassElement mixinElement = mixin.element;
- if (!mixinElement.isTypedef) {
- continue;
- }
- if (hasClassTypeAliasSelfReference(mixinElement, seenMixins)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Checks if "target" is referenced by "current".
- */
- bool hasFunctionTypeAliasReference(Set<FunctionTypeAliasElement> visited, FunctionTypeAliasElement target, Element currentElement) {
- if (currentElement is! FunctionTypeAliasElement) {
- return false;
- }
- FunctionTypeAliasElement current = currentElement as FunctionTypeAliasElement;
- if (target == current) {
- return true;
- }
- if (visited.contains(current)) {
- return false;
- }
- javaSetAdd(visited, current);
- return hasFunctionTypeAliasReference2(visited, target, current);
- }
-
- /**
- * Checks if "target" is referenced by "current".
- */
- bool hasFunctionTypeAliasReference2(Set<FunctionTypeAliasElement> visited, FunctionTypeAliasElement target, FunctionTypeAliasElement current) {
- FunctionType type = current.type;
- Set<Type2> referencedTypes = new Set();
- if (type != null) {
- for (TypeVariableElement typeVariable in current.typeVariables) {
- Type2 bound = typeVariable.bound;
- javaSetAdd(referencedTypes, bound);
- }
- javaSetAdd(referencedTypes, type.returnType);
- for (ParameterElement parameter in type.parameters) {
- javaSetAdd(referencedTypes, parameter.type);
- }
- }
- for (Type2 referencedType in referencedTypes) {
- if (referencedType != null && hasFunctionTypeAliasReference(visited, target, referencedType.element)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return <code>true</code> if given [FunctionTypeAliasElement] has direct or indirect
- * reference to itself using other [FunctionTypeAliasElement]s.
- */
- bool hasFunctionTypeAliasSelfReference(FunctionTypeAliasElement target) {
- Set<FunctionTypeAliasElement> visited = new Set();
- return hasFunctionTypeAliasReference2(visited, target, target);
- }
-
- /**
* @return `true` if the given constructor redirects to itself, directly or indirectly
*/
bool hasRedirectingFactoryConstructorCycle(ConstructorElement element) {
@@ -14606,6 +14941,39 @@
}
/**
+ * @return <code>true</code> if given [Element] has direct or indirect reference to itself
+ * form anywhere except [ClassElement] or type variable bounds.
+ */
+ bool hasTypedefSelfReference(Element target) {
+ Set<Element> checked = new Set<Element>();
+ List<Element> toCheck = new List<Element>();
+ toCheck.add(target);
+ bool firstIteration = true;
+ while (true) {
+ Element current;
+ while (true) {
+ if (toCheck.isEmpty) {
+ return false;
+ }
+ current = toCheck.removeAt(toCheck.length - 1);
+ if (target == current) {
+ if (firstIteration) {
+ firstIteration = false;
+ break;
+ } else {
+ return true;
+ }
+ }
+ if (current != null && !checked.contains(current)) {
+ break;
+ }
+ }
+ current.accept(new GeneralizingElementVisitor_11(target, toCheck));
+ javaSetAdd(checked, current);
+ }
+ }
+
+ /**
* @return `true` if the given [ASTNode] is the part of constant constructor
* invocation.
*/
@@ -14640,13 +15008,95 @@
}
return false;
}
+
+ /**
+ * Return `true` iff the passed [ClassElement] has a concrete implementation of the
+ * passed accessor name in the superclass chain.
+ */
+ bool memberHasConcreteAccessorImplementationInSuperclassChain(ClassElement classElement, String accessorName, List<ClassElement> superclassChain) {
+ if (superclassChain.contains(classElement)) {
+ return false;
+ } else {
+ superclassChain.add(classElement);
+ }
+ for (PropertyAccessorElement accessor in classElement.accessors) {
+ if (accessor.name == accessorName) {
+ if (!accessor.isAbstract) {
+ return true;
+ }
+ }
+ }
+ for (InterfaceType mixinType in classElement.mixins) {
+ if (mixinType != null) {
+ ClassElement mixinElement = mixinType.element;
+ if (mixinElement != null) {
+ for (PropertyAccessorElement accessor in mixinElement.accessors) {
+ if (accessor.name == accessorName) {
+ if (!accessor.isAbstract) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ InterfaceType superType = classElement.supertype;
+ if (superType != null) {
+ ClassElement superClassElt = superType.element;
+ if (superClassElt != null) {
+ return memberHasConcreteAccessorImplementationInSuperclassChain(superClassElt, accessorName, superclassChain);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return `true` iff the passed [ClassElement] has a concrete implementation of the
+ * passed method name in the superclass chain.
+ */
+ bool memberHasConcreteMethodImplementationInSuperclassChain(ClassElement classElement, String methodName, List<ClassElement> superclassChain) {
+ if (superclassChain.contains(classElement)) {
+ return false;
+ } else {
+ superclassChain.add(classElement);
+ }
+ for (MethodElement method in classElement.methods) {
+ if (method.name == methodName) {
+ if (!method.isAbstract) {
+ return true;
+ }
+ }
+ }
+ for (InterfaceType mixinType in classElement.mixins) {
+ if (mixinType != null) {
+ ClassElement mixinElement = mixinType.element;
+ if (mixinElement != null) {
+ for (MethodElement method in mixinElement.methods) {
+ if (method.name == methodName) {
+ if (!method.isAbstract) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ InterfaceType superType = classElement.supertype;
+ if (superType != null) {
+ ClassElement superClassElt = superType.element;
+ if (superClassElt != null) {
+ return memberHasConcreteMethodImplementationInSuperclassChain(superClassElt, methodName, superclassChain);
+ }
+ }
+ return false;
+ }
}
/**
* This enum holds one of four states of a field initialization state through a constructor
* signature, not initialized, initialized in the field declaration, initialized in the field
* formal, and finally, initialized in the initializers list.
*/
-class INIT_STATE implements Comparable<INIT_STATE> {
+class INIT_STATE implements 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);
@@ -14667,171 +15117,58 @@
int get hashCode => ordinal;
String toString() => name;
}
-/**
- * Instances of the class `HintVerifier` traverse an AST structure looking for additional
- * additional suggestions not mentioned in the Dart Language Specification.
- *
- * @coverage dart.engine.resolver
- */
-class HintVerifier {
- DeadCodeVerifier _deadCodeVerifier;
- HintVerifier(AnalysisContext context, ErrorReporter errorReporter) {
- _deadCodeVerifier = new DeadCodeVerifier(errorReporter);
+class GeneralizingElementVisitor_11 extends GeneralizingElementVisitor<Object> {
+ Element target;
+ List<Element> toCheck;
+ GeneralizingElementVisitor_11(this.target, this.toCheck) : super();
+ bool _inClass = false;
+ Object visitClassElement(ClassElement element) {
+ addTypeToCheck(element.supertype);
+ for (InterfaceType mixin in element.mixins) {
+ addTypeToCheck(mixin);
+ }
+ _inClass = !element.isTypedef;
+ try {
+ return super.visitClassElement(element);
+ } finally {
+ _inClass = false;
+ }
}
- void visitCompilationUnit(CompilationUnit node) {
- node.accept(_deadCodeVerifier);
+ Object visitExecutableElement(ExecutableElement element) {
+ if (element.isSynthetic) {
+ return null;
+ }
+ addTypeToCheck(element.returnType);
+ return super.visitExecutableElement(element);
}
-}
-/**
- * Instances of the class `PubVerifier` traverse an AST structure looking for deviations from
- * pub best practices.
- */
-class PubVerifier extends RecursiveASTVisitor<Object> {
- static String _PUBSPEC_YAML = "pubspec.yaml";
-
- /**
- * The analysis context containing the sources to be analyzed
- */
- AnalysisContext _context;
-
- /**
- * The error reporter by which errors will be reported.
- */
- ErrorReporter _errorReporter;
- PubVerifier(AnalysisContext context, ErrorReporter errorReporter) {
- this._context = context;
- this._errorReporter = errorReporter;
+ Object visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
+ addTypeToCheck(element.returnType);
+ return super.visitFunctionTypeAliasElement(element);
}
- Object visitImportDirective(ImportDirective directive) {
- return null;
+ Object visitParameterElement(ParameterElement element) {
+ addTypeToCheck(element.type);
+ return super.visitParameterElement(element);
}
-
- /**
- * This verifies that the passed file import directive is not contained in a source inside a
- * package "lib" directory hierarchy referencing a source outside that package "lib" directory
- * hierarchy.
- *
- * @param uriLiteral the import URL (not `null`)
- * @param path the file path being verified (not `null`)
- * @return `true` if and only if an error code is generated on the passed node
- * @see PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE
- */
- bool checkForFileImportInsideLibReferencesFileOutside(StringLiteral uriLiteral, String path) {
- Source source = getSource(uriLiteral);
- String fullName = getSourceFullName(source);
- if (fullName != null) {
- int pathIndex = 0;
- int fullNameIndex = fullName.length;
- while (pathIndex < path.length && JavaString.startsWithBefore(path, "../", pathIndex)) {
- fullNameIndex = JavaString.lastIndexOf(fullName, '/', fullNameIndex);
- if (fullNameIndex < 4) {
- return false;
- }
- 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()) {
- _errorReporter.reportError2(PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE, uriLiteral, []);
- }
- return true;
- }
- pathIndex += 3;
+ Object visitTypeVariableElement(TypeVariableElement element) => null;
+ Object visitVariableElement(VariableElement element) {
+ addTypeToCheck(element.type);
+ return super.visitVariableElement(element);
+ }
+ void addTypeToCheck(Type2 type) {
+ if (type == null) {
+ return;
+ }
+ Element element = type.element;
+ if (_inClass && target == element) {
+ return;
+ }
+ toCheck.add(element);
+ if (type is InterfaceType) {
+ InterfaceType interfaceType = type as InterfaceType;
+ for (Type2 typeArgument in interfaceType.typeArguments) {
+ addTypeToCheck(typeArgument);
}
}
- return false;
- }
-
- /**
- * This verifies that the passed file import directive is not contained in a source outside a
- * package "lib" directory hierarchy referencing a source inside that package "lib" directory
- * hierarchy.
- *
- * @param uriLiteral the import URL (not `null`)
- * @param path the file path being verified (not `null`)
- * @return `true` if and only if an error code is generated on the passed node
- * @see PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE
- */
- bool checkForFileImportOutsideLibReferencesFileInside(StringLiteral uriLiteral, String path) {
- if (path.startsWith("lib/")) {
- if (checkForFileImportOutsideLibReferencesFileInside2(uriLiteral, path, 0)) {
- return true;
- }
- }
- int pathIndex = path.indexOf("/lib/");
- while (pathIndex != -1) {
- if (checkForFileImportOutsideLibReferencesFileInside2(uriLiteral, path, pathIndex + 1)) {
- return true;
- }
- pathIndex = JavaString.indexOf(path, "/lib/", pathIndex + 4);
- }
- return false;
- }
- bool checkForFileImportOutsideLibReferencesFileInside2(StringLiteral uriLiteral, String path, int pathIndex) {
- Source source = getSource(uriLiteral);
- String relativePubspecPath = path.substring(0, pathIndex) + _PUBSPEC_YAML;
- Source pubspecSource = _context.sourceFactory.resolveUri(source, relativePubspecPath);
- if (!pubspecSource.exists()) {
- return false;
- }
- String fullName = getSourceFullName(source);
- if (fullName != null) {
- if (!fullName.contains("/lib/")) {
- _errorReporter.reportError2(PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE, uriLiteral, []);
- return true;
- }
- }
- return false;
- }
-
- /**
- * This verifies that the passed package import directive does not contain ".."
- *
- * @param uriLiteral the import URL (not `null`)
- * @param path the path to be validated (not `null`)
- * @return `true` if and only if an error code is generated on the passed node
- * @see PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
- */
- bool checkForPackageImportContainsDotDot(StringLiteral uriLiteral, String path) {
- if (path.startsWith("../") || path.contains("/../")) {
- _errorReporter.reportError2(PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT, uriLiteral, []);
- return true;
- }
- return false;
- }
-
- /**
- * Answer the source associated with the compilation unit containing the given AST node.
- *
- * @param node the node (not `null`)
- * @return the source or `null` if it could not be determined
- */
- Source getSource(ASTNode node) {
- Source source = null;
- CompilationUnit unit = node.getAncestor(CompilationUnit);
- if (unit != null) {
- CompilationUnitElement element = unit.element;
- if (element != null) {
- source = element.source;
- }
- }
- return source;
- }
-
- /**
- * Answer the full name of the given source. The returned value will have all
- * [File#separatorChar] replace by '/'.
- *
- * @param source the source
- * @return the full name or `null` if it could not be determined
- */
- String getSourceFullName(Source source) {
- if (source != null) {
- String fullName = source.fullName;
- if (fullName != null) {
- return fullName.replaceAll(r'\', '/');
- }
- }
- return null;
}
}
/**
@@ -14842,7 +15179,7 @@
*
* @coverage dart.engine.resolver
*/
-class ResolverErrorCode implements Comparable<ResolverErrorCode>, ErrorCode {
+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");
diff --git a/pkg/analyzer_experimental/lib/src/generated/scanner.dart b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
index 1d7676e..0f816df 100644
--- a/pkg/analyzer_experimental/lib/src/generated/scanner.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
@@ -135,7 +135,7 @@
*
* @coverage dart.engine.parser
*/
-class ScannerErrorCode implements Comparable<ScannerErrorCode>, ErrorCode {
+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");
@@ -209,7 +209,7 @@
*
* @coverage dart.engine.parser
*/
-class Keyword implements Comparable<Keyword> {
+class Keyword implements 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");
@@ -503,7 +503,7 @@
instrumentation.metric2("tokensCount", tokenCounter);
return firstToken();
} finally {
- instrumentation.log();
+ instrumentation.log2(2);
}
}
@@ -1233,7 +1233,7 @@
while (true) {
next = advance();
if (0xA == next || 0xD == next || -1 == next) {
- appendCommentToken(TokenType.SINGLE_LINE_COMMENT, getString(_tokenStart, 0));
+ appendCommentToken(TokenType.SINGLE_LINE_COMMENT, getString(_tokenStart, -1));
return next;
}
}
@@ -1800,7 +1800,7 @@
*
* @coverage dart.engine.parser
*/
-class TokenClass implements Comparable<TokenClass> {
+class TokenClass implements Enum<TokenClass> {
/**
* A value used to indicate that the token type is not part of any specific class of token.
@@ -1958,7 +1958,7 @@
*
* @coverage dart.engine.parser
*/
-class TokenType implements Comparable<TokenType> {
+class TokenType implements Enum<TokenType> {
/**
* The type of the token that marks the end of the input.
diff --git a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
index 143b072..71f1e68 100644
--- a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
@@ -272,7 +272,7 @@
if (revision != null) {
_sdkVersion = revision;
}
- } on IOException catch (exception) {
+ } on JavaIOException catch (exception) {
}
}
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/source.dart b/pkg/analyzer_experimental/lib/src/generated/source.dart
index e6463ff..cf901a3 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source.dart
@@ -135,6 +135,9 @@
* @return the source representing the contained URI
*/
Source resolveUri(Source containingSource, String containedUri) {
+ if (containedUri == null) {
+ return null;
+ }
try {
return resolveUri2(containingSource, parseUriWithException(containedUri));
} on URISyntaxException catch (exception) {
@@ -165,10 +168,9 @@
*
* @param source the source whose contents are being overridden
* @param contents the new contents of the source
+ * @return `true` if the new cached contents are different from the old, else `false`
*/
- void setContents(Source source, String contents) {
- _contentCache.setContents(source, contents);
- }
+ bool setContents(Source source, String contents) => _contentCache.setContents(source, contents);
/**
* Set the analysis context that this source factory is associated with to the given context.
@@ -420,7 +422,7 @@
*
* @coverage dart.engine.source
*/
-class SourceKind implements Comparable<SourceKind> {
+class SourceKind implements Enum<SourceKind> {
/**
* A source containing HTML. The HTML might or might not contain Dart scripts.
@@ -462,7 +464,7 @@
*
* @coverage dart.engine.source
*/
-class UriKind implements Comparable<UriKind> {
+class UriKind implements Enum<UriKind> {
/**
* A 'dart:' URI.
@@ -877,14 +879,16 @@
*
* @param source the source whose contents are being overridden
* @param contents the new contents of the source
+ * @return `true` if the new cached contents are different than the old, else `false`
*/
- void setContents(Source source, String contents) {
+ bool setContents(Source source, String contents) {
if (contents == null) {
- _contentMap.remove(source);
_stampMap.remove(source);
+ return _contentMap.remove(source) != null;
} else {
- _contentMap[source] = contents;
_stampMap[source] = JavaSystem.currentTimeMillis();
+ String originalContents = javaMapPut(_contentMap, source, contents);
+ return contents != originalContents;
}
}
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/source_io.dart b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
index c2277eb..23f6c1b 100644
--- a/pkg/analyzer_experimental/lib/src/generated/source_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/source_io.dart
@@ -56,7 +56,14 @@
this._contentCache = contentCache;
this._file = file;
this._uriKind = uriKind;
- this._encoding = "${uriKind.encoding}${file.toURI().toString()}";
+ if (file.getPath().indexOf(':') > 2) {
+ try {
+ throw new IllegalArgumentException("Invalid source path: ${file}");
+ } on IllegalArgumentException catch (e) {
+ AnalysisEngine.instance.logger.logError3(e);
+ throw e;
+ }
+ }
}
bool operator ==(Object object) => object != null && this.runtimeType == object.runtimeType && _file == ((object as FileBasedSource))._file;
bool exists() => _contentCache.getContents(this) != null || (_file.exists() && !_file.isDirectory());
@@ -70,7 +77,12 @@
}
receiver.accept2(_file.readAsStringSync(), _file.lastModified());
}
- String get encoding => _encoding;
+ String get encoding {
+ if (_encoding == null) {
+ _encoding = "${_uriKind.encoding}${_file.toURI().toString()}";
+ }
+ return _encoding;
+ }
String get fullName => _file.getAbsolutePath();
int get modificationStamp {
int stamp = _contentCache.getModificationStamp(this);
@@ -226,7 +238,7 @@
JavaFile pkgDir = new JavaFile.relative(packagesDirectory, pkgName);
try {
pkgDir = pkgDir.getCanonicalFile();
- } on IOException catch (e) {
+ } on JavaIOException catch (e) {
if (!e.toString().contains("Required key not available")) {
AnalysisEngine.instance.logger.logError2("Canonical failed: ${pkgDir}", e);
} else if (_CanLogRequiredKeyIoException) {
diff --git a/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart b/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
new file mode 100644
index 0000000..9e33a1a
--- /dev/null
+++ b/pkg/analyzer_experimental/lib/src/generated/utilities_collection.dart
@@ -0,0 +1,92 @@
+// 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.utilities.collection;
+import 'java_core.dart';
+/**
+ * The class `BooleanArray` defines methods for operating on integers as if they were arrays
+ * of booleans. These arrays can be indexed by either integers or by enumeration constants.
+ */
+class BooleanArray {
+
+ /**
+ * Return the value of the element at the given index.
+ *
+ * @param array the array being accessed
+ * @param index the index of the element being accessed
+ * @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);
+
+ /**
+ * Return the value of the element at the given index.
+ *
+ * @param array the array being accessed
+ * @param index the index of the element being accessed
+ * @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 get2(int array, int index) {
+ checkIndex(index);
+ return (array & (1 << index)) > 0;
+ }
+
+ /**
+ * Set the value of the element at the given index to the given value.
+ *
+ * @param array the array being modified
+ * @param index the index of the element being set
+ * @param value the value to be assigned to the element
+ * @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);
+
+ /**
+ * Set the value of the element at the given index to the given value.
+ *
+ * @param array the array being modified
+ * @param index the index of the element being set
+ * @param value the value to be assigned to the element
+ * @return the updated value of the array
+ * @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
+ */
+ static int set2(int array, int index, bool value) {
+ checkIndex(index);
+ if (value) {
+ return array | (1 << index);
+ } else {
+ return array & ~(1 << index);
+ }
+ }
+
+ /**
+ * Throw an exception if the index is not within the bounds allowed for an integer-encoded array
+ * of boolean values.
+ *
+ * @throws IndexOutOfBoundsException if the index is not between zero (0) and 31, inclusive
+ */
+ static void checkIndex(int index) {
+ if (index < 0 || index > 30) {
+ throw new RangeError("Index not between 0 and 30: ${index}");
+ }
+ }
+}
+/**
+ * The class `ListUtilities` defines utility methods useful for working with [List
+ ].
+ */
+class ListUtilities {
+
+ /**
+ * Add all of the elements in the given array to the given list.
+ *
+ * @param list the list to which the elements are to be added
+ * @param elements the elements to be added to the list
+ */
+ static void addAll(List list, List<Object> elements) {
+ for (Object element in elements) {
+ list.add(element);
+ }
+ }
+}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
index 714c4ce..c7879f6 100644
--- a/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/utilities_dart.dart
@@ -1,6 +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.utilities.dart;
+import 'java_core.dart';
/**
* The enumeration `ParameterKind` defines the different kinds of parameters. There are two
* basic kinds of parameters: required and optional. Optional parameters are further divided into
@@ -8,7 +9,7 @@
*
* @coverage dart.engine.utilities
*/
-class ParameterKind implements Comparable<ParameterKind> {
+class ParameterKind implements 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);
diff --git a/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart b/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
index c778711..cb2b7b9 100644
--- a/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
+++ b/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart
@@ -4,8 +4,7 @@
library formatter_impl;
-
-import 'dart:io';
+import 'dart:math';
import 'package:analyzer_experimental/analyzer.dart';
import 'package:analyzer_experimental/src/generated/parser.dart';
@@ -41,7 +40,7 @@
class FormatterException implements Exception {
/// A message describing the error.
- final message;
+ final String message;
/// Creates a new FormatterException with an optional error [message].
const FormatterException([this.message = '']);
@@ -56,15 +55,15 @@
/// Specifies the kind of code snippet to format.
class CodeKind {
- final index;
+ final int _index;
- const CodeKind(this.index);
+ const CodeKind._(this._index);
/// A compilation unit snippet.
- static const COMPILATION_UNIT = const CodeKind(0);
+ static const COMPILATION_UNIT = const CodeKind._(0);
/// A statement snippet.
- static const STATEMENT = const CodeKind(1);
+ static const STATEMENT = const CodeKind._(1);
}
@@ -77,7 +76,7 @@
/// Format the specified portion (from [offset] with [length]) of the given
/// [source] string, optionally providing an [indentationLevel].
String format(CodeKind kind, String source, {int offset, int end,
- int indentationLevel:0});
+ int indentationLevel: 0});
}
@@ -91,7 +90,7 @@
CodeFormatterImpl(this.options);
String format(CodeKind kind, String source, {int offset, int end,
- int indentationLevel:0}) {
+ int indentationLevel: 0}) {
var start = tokenize(source);
checkForErrors();
@@ -119,7 +118,7 @@
throw new FormatterException('Unsupported format kind: $kind');
}
- checkForErrors() {
+ void checkForErrors() {
if (errors.length > 0) {
throw new FormatterException.forError(errors);
}
@@ -139,15 +138,18 @@
}
-
/// An AST visitor that drives formatting heuristics.
class SourceVisitor implements ASTVisitor {
/// The writer to which the source is to be written.
- SourceWriter writer;
+ final SourceWriter writer;
+ /// Cached line info for calculating blank lines.
LineInfo lineInfo;
+ /// Cached previous token for calculating preceding whitespace.
+ Token previousToken;
+
/// Initialize a newly created visitor to write source code representing
/// the visited nodes to the given [writer].
SourceVisitor(FormatterOptions options, this.lineInfo) :
@@ -216,6 +218,7 @@
writer.unindent();
writer.newline();
writer.print('}');
+ previousToken = node.rightBracket;
}
visitBlockFunctionBody(BlockFunctionBody node) {
@@ -254,23 +257,26 @@
}
visitClassDeclaration(ClassDeclaration node) {
- visitToken(node.abstractKeyword, ' ');
- writer.print('class ');
+ emitToken(node.abstractKeyword, ' ');
+ emitToken(node.classKeyword, ' ');
visit(node.name);
visit(node.typeParameters);
visitPrefixed(' ', node.extendsClause);
visitPrefixed(' ', node.withClause);
visitPrefixed(' ', node.implementsClause);
- writer.print(' {');
+// writer.print(' {');
+// writer.print(' ');
+// emit(node.leftBracket);
+ emitPrefixedToken(' ', node.leftBracket);
writer.indent();
- for (var member in node.members) {
- writer.newline();
- visit(member);
+
+ for (var i = 0; i < node.members.length; i++) {
+ visit(node.members[i]);
}
writer.unindent();
- writer.newline();
- writer.print('}');
+
+ emit(node.rightBracket, min: 1);
}
visitClassTypeAlias(ClassTypeAlias node) {
@@ -297,8 +303,9 @@
visit(scriptTag);
var prefix = scriptTag == null ? '' : ' ';
visitPrefixedList(prefix, directives, ' ');
- prefix = scriptTag == null && directives.isEmpty ? '' : ' ';
- visitPrefixedListWithBlanks(prefix, node.declarations);
+ //prefix = scriptTag == null && directives.isEmpty ? '' : ' ';
+ prefix = '';
+ visitPrefixedList(prefix, node.declarations);
//TODO(pquitslund): move this?
writer.newline();
@@ -313,9 +320,9 @@
}
visitConstructorDeclaration(ConstructorDeclaration node) {
- visitToken(node.externalKeyword, ' ');
- visitToken(node.constKeyword, ' ');
- visitToken(node.factoryKeyword, ' ');
+ emitToken(node.externalKeyword, ' ');
+ emitToken(node.constKeyword, ' ');
+ emitToken(node.factoryKeyword, ' ');
visit(node.returnType);
visitPrefixed('.', node.name);
visit(node.parameters);
@@ -325,7 +332,7 @@
}
visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
- visitToken(node.keyword, '.');
+ emitToken(node.keyword, '.');
visit(node.fieldName);
writer.print(' = ');
visit(node.expression);
@@ -343,7 +350,7 @@
}
visitDeclaredIdentifier(DeclaredIdentifier node) {
- visitToken(node.keyword, ' ');
+ emitToken(node.keyword, ' ');
visitSuffixed(node.type, ' ');
visit(node.identifier);
}
@@ -403,13 +410,13 @@
}
visitFieldDeclaration(FieldDeclaration node) {
- visitToken(node.keyword, ' ');
+ emitToken(node.keyword, ' ');
visit(node.fields);
writer.print(';');
}
visitFieldFormalParameter(FieldFormalParameter node) {
- visitToken(node.keyword, ' ');
+ emitToken(node.keyword, ' ');
visitSuffixed(node.type, ' ');
writer.print('this.');
visit(node.identifier);
@@ -470,7 +477,7 @@
visitFunctionDeclaration(FunctionDeclaration node) {
visitSuffixed(node.returnType, ' ');
- visitToken(node.propertyKeyword, ' ');
+ emitToken(node.propertyKeyword, ' ');
visit(node.name);
visit(node.functionExpression);
}
@@ -529,14 +536,16 @@
visit(node.uri);
visitPrefixed(' as ', node.prefix);
visitPrefixedList(' ', node.combinators, ' ');
- writer.print(';');
+// writer.print(';');
+ emit(node.semicolon);
+// writer.newline();
}
visitIndexExpression(IndexExpression node) {
if (node.isCascaded) {
writer.print('..');
} else {
- visit(node.array);
+ visit(node.target);
}
writer.print('[');
visit(node.index);
@@ -544,7 +553,7 @@
}
visitInstanceCreationExpression(InstanceCreationExpression node) {
- visitToken(node.keyword, ' ');
+ emitToken(node.keyword, ' ');
visit(node.constructorName);
visit(node.argumentList);
}
@@ -627,11 +636,11 @@
}
visitMethodDeclaration(MethodDeclaration node) {
- visitToken(node.externalKeyword, ' ');
- visitToken(node.modifierKeyword, ' ');
+ emitToken(node.externalKeyword, ' ');
+ emitToken(node.modifierKeyword, ' ');
visitSuffixed(node.returnType, ' ');
- visitToken(node.propertyKeyword, ' ');
- visitToken(node.operatorKeyword, ' ');
+ emitToken(node.propertyKeyword, ' ');
+ emitToken(node.operatorKeyword, ' ');
visit(node.name);
if (!node.isGetter) {
visit(node.parameters);
@@ -744,13 +753,14 @@
}
visitSimpleFormalParameter(SimpleFormalParameter node) {
- visitToken(node.keyword, ' ');
+ emitToken(node.keyword, ' ');
visitSuffixed(node.type, ' ');
visit(node.identifier);
}
visitSimpleIdentifier(SimpleIdentifier node) {
- writer.print(node.token.lexeme);
+ emit(node.token);
+// writer.print(node.token.lexeme);
}
visitSimpleStringLiteral(SimpleStringLiteral node) {
@@ -845,7 +855,7 @@
}
visitVariableDeclarationList(VariableDeclarationList node) {
- visitToken(node.keyword, ' ');
+ emitToken(node.keyword, ' ');
visitSuffixed(node.type, ' ');
visitList(node.variables, ', ');
}
@@ -901,11 +911,20 @@
visit(body);
}
- /// Safely visit the given [token], printing the suffix after the [token]
- /// node if it is non-null.
- visitToken(Token token, String suffix) {
+ /// Emit the given [token], printing the prefix before the [token]
+ /// if it is non-null.
+ emitPrefixedToken(String prefix, Token token) {
if (token != null) {
- writer.print(token.lexeme);
+ writer.print(prefix);
+ emit(token);
+ }
+ }
+
+ /// Emit the given [token], printing the suffix after the [token]
+ /// node if it is non-null.
+ emitToken(Token token, String suffix) {
+ if (token != null) {
+ emit(token);
writer.print(suffix);
}
}
@@ -940,13 +959,14 @@
}
/// Print a list of [nodes], separated by the given [separator].
- visitPrefixedList(String prefix, NodeList<ASTNode> nodes, String separator) {
+ visitPrefixedList(String prefix, NodeList<ASTNode> nodes,
+ [String separator = null]) {
if (nodes != null) {
var size = nodes.length;
if (size > 0) {
writer.print(prefix);
for (var i = 0; i < size; i++) {
- if (i > 0) {
+ if (i > 0 && separator != null) {
writer.print(separator);
}
nodes[i].accept(this);
@@ -955,29 +975,45 @@
}
}
- /// Print a list of [nodes], preserving blank lines between nodes.
- visitPrefixedListWithBlanks(String prefix,
- NodeList<ASTNode> nodes) {
- if (nodes != null) {
- var size = nodes.length;
- if (size > 0) {
- writer.print(prefix);
- for (var i = 0; i < size; i++) {
- if (i > 0) {
- // Emit blanks lines
- var lastLine =
- lineInfo.getLocation(nodes[i-1].endToken.offset).lineNumber;
- var currentLine =
- lineInfo.getLocation(nodes[i].beginToken.offset).lineNumber;
- var blanks = currentLine - lastLine;
- for (var i = 0; i < blanks; i++) {
- writer.newline();
- }
- }
- nodes[i].accept(this);
- }
- }
+ /// Emit the given [token], preceeded by any detected newlines or a minimum
+ /// as specified by [min].
+ emit(Token token, {min: 0}) {
+ var comment = token.precedingComments;
+ var currentToken = comment != null ? comment : token;
+ var newlines = max(min, countNewlinesBetween(previousToken, currentToken));
+ writer.newlines(newlines);
+ while (comment != null) {
+ writer.print(comment.toString().trim());
+ writer.newline();
+ comment = comment.next;
}
+
+ previousToken = token;
+ writer.print(token.lexeme);
+ }
+
+ /// Count the blanks between these two nodes.
+ int countBlankLinesBetween(ASTNode lastNode, ASTNode currentNode) =>
+ countNewlinesBetween(lastNode.endToken, currentNode.beginToken);
+
+ /// Count newlines preceeding this [node].
+ int countPrecedingNewlines(ASTNode node) =>
+ countNewlinesBetween(node.beginToken.previous, node.beginToken);
+
+ /// Count newlines succeeding this [node].
+ int countSucceedingNewlines(ASTNode node) => node == null ? 0 :
+ countNewlinesBetween(node.endToken, node.endToken.next);
+
+ /// Count the blanks between these two nodes.
+ int countNewlinesBetween(Token last, Token current) {
+ if (last == null || current == null) {
+ return 0;
+ }
+ var lastLine =
+ lineInfo.getLocation(last.offset).lineNumber;
+ var currentLine =
+ lineInfo.getLocation(current.offset).lineNumber;
+ return currentLine - lastLine;
}
}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart b/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart
index 109ca39..c1f3956 100644
--- a/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart
+++ b/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart
@@ -8,11 +8,9 @@
import 'dart:async';
import 'dart:collection' show SplayTreeMap;
import 'dart:io';
-import 'dart:json' as json;
import 'package:path/path.dart' as pathos;
-import 'package:analyzer_experimental/src/generated/source.dart' show Source, SourceRange;
import 'package:analyzer_experimental/src/generated/scanner.dart' show StringScanner;
import 'package:analyzer_experimental/src/generated/parser.dart' show Parser;
import 'package:analyzer_experimental/src/generated/ast.dart';
@@ -20,7 +18,6 @@
import '../log.dart' as log;
import 'models.dart';
-import 'utils.dart';
/// Run the [targetPath] with code coverage rewriting.
/// Redirects stdandard process streams.
diff --git a/pkg/analyzer_experimental/lib/src/services/writer.dart b/pkg/analyzer_experimental/lib/src/services/writer.dart
index 4171733..d73a1fa 100644
--- a/pkg/analyzer_experimental/lib/src/services/writer.dart
+++ b/pkg/analyzer_experimental/lib/src/services/writer.dart
@@ -19,21 +19,23 @@
}
}
- addSpace() {
+ void addSpace() {
addSpaces(1);
}
- addSpaces(int n) {
+ void addSpaces(int n) {
if (n > 0) {
tokens.add(new SpaceToken(n));
}
}
- addToken(LineToken token) {
+ void addToken(LineToken token) {
tokens.add(token);
}
- _indent(int n) {
+ bool isWhitespace() => tokens.every((tok) => tok is SpaceToken);
+
+ void _indent(int n) {
tokens.add(useTabs ? new TabToken(n) : new SpaceToken(n * spacesPerIndent));
}
@@ -87,47 +89,59 @@
currentLine = new Line(indent: indentCount);
}
- indent() {
+ void indent() {
++indentCount;
}
- unindent() {
+ void unindent() {
--indentCount;
}
- print(x) {
+ void print(x) {
currentLine.addToken(new LineToken(x));
}
- newline() {
+ void newline() {
+ if (currentLine.isWhitespace()) {
+ currentLine.tokens.clear();
+ }
currentLine.addToken(new NewlineToken(this.lineSeparator));
buffer.write(currentLine.toString());
currentLine = new Line(indent: indentCount);
}
- space() {
+ void newlines(int num) {
+ while (num-- > 0) {
+ newline();
+ }
+ }
+
+ void space() {
spaces(1);
}
- spaces(n) {
+ void spaces(n) {
currentLine.addSpaces(n);
}
- println(String s) {
+ void println(String s) {
print(s);
newline();
}
String toString() {
var source = new StringBuffer(buffer.toString());
- source.write(currentLine);
+ if (!currentLine.isWhitespace()) {
+ source.write(currentLine);
+ }
return source.toString();
}
+
}
const SPACE = ' ';
-final SPACES = [
+const SPACES = const [
'',
' ',
' ',
@@ -146,7 +160,7 @@
' ',
' ',
];
-final TABS = [
+const TABS = const [
'',
'\t',
'\t\t',
diff --git a/pkg/analyzer_experimental/test/generated/ast_test.dart b/pkg/analyzer_experimental/test/generated/ast_test.dart
index ba2c406..a839e84 100644
--- a/pkg/analyzer_experimental/test/generated/ast_test.dart
+++ b/pkg/analyzer_experimental/test/generated/ast_test.dart
@@ -401,11 +401,11 @@
static SwitchDefault switchDefault2(List<Statement> statements) => switchDefault(new List<Label>(), statements);
static SwitchStatement switchStatement(Expression expression, List<SwitchMember> members) => new SwitchStatement.full(TokenFactory.token(Keyword.SWITCH), TokenFactory.token3(TokenType.OPEN_PAREN), expression, TokenFactory.token3(TokenType.CLOSE_PAREN), TokenFactory.token3(TokenType.OPEN_CURLY_BRACKET), list(members), TokenFactory.token3(TokenType.CLOSE_CURLY_BRACKET));
static SymbolLiteral symbolLiteral(List<String> components) {
- List<SimpleIdentifier> identifierList = new List<SimpleIdentifier>();
+ List<Token> identifierList = new List<Token>();
for (String component in components) {
- identifierList.add(identifier3(component));
+ identifierList.add(TokenFactory.token4(TokenType.IDENTIFIER, component));
}
- return new SymbolLiteral.full(TokenFactory.token3(TokenType.HASH), identifierList);
+ return new SymbolLiteral.full(TokenFactory.token3(TokenType.HASH), new List.from(identifierList));
}
static ThisExpression thisExpression() => new ThisExpression.full(TokenFactory.token(Keyword.THIS));
static ThrowExpression throwExpression() => throwExpression2(null);
@@ -717,7 +717,7 @@
});
}
}
-class AssignmentKind implements Comparable<AssignmentKind> {
+class AssignmentKind implements 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);
@@ -750,7 +750,7 @@
int get hashCode => ordinal;
String toString() => name;
}
-class WrapperKind implements Comparable<WrapperKind> {
+class WrapperKind implements 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);
@@ -796,7 +796,7 @@
"}"]);
CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []);
List<ASTNode> nodes = new List<ASTNode>();
- BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_15(nodes);
+ BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_16(nodes);
visitor.visitAllNodes(unit);
EngineTestCase.assertSize(59, nodes);
EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]);
@@ -814,9 +814,9 @@
});
}
}
-class BreadthFirstVisitor_15 extends BreadthFirstVisitor<Object> {
+class BreadthFirstVisitor_16 extends BreadthFirstVisitor<Object> {
List<ASTNode> nodes;
- BreadthFirstVisitor_15(this.nodes) : super();
+ BreadthFirstVisitor_16(this.nodes) : super();
Object visitNode(ASTNode node) {
nodes.add(node);
return super.visitNode(node);
diff --git a/pkg/analyzer_experimental/test/generated/element_test.dart b/pkg/analyzer_experimental/test/generated/element_test.dart
index 23b15b9..c5d24f1 100644
--- a/pkg/analyzer_experimental/test/generated/element_test.dart
+++ b/pkg/analyzer_experimental/test/generated/element_test.dart
@@ -64,6 +64,17 @@
ElementLocationImpl location = new ElementLocationImpl.con2(encoding);
JUnitTestCase.assertEquals(encoding, location.encoding);
}
+ void test_hashCode_equal() {
+ String encoding = "a;b;c";
+ ElementLocationImpl first = new ElementLocationImpl.con2(encoding);
+ ElementLocationImpl second = new ElementLocationImpl.con2(encoding);
+ JUnitTestCase.assertTrue(first.hashCode == second.hashCode);
+ }
+ void test_hashCode_equalWithDifferentUriKind() {
+ ElementLocationImpl first = new ElementLocationImpl.con2("fa;fb;c");
+ ElementLocationImpl second = new ElementLocationImpl.con2("pa;pb;c");
+ JUnitTestCase.assertTrue(first.hashCode == second.hashCode);
+ }
static dartSuite() {
_ut.group('ElementLocationImplTest', () {
_ut.test('test_create_encoding', () {
@@ -98,6 +109,14 @@
final __test = new ElementLocationImplTest();
runJUnitTest(__test, __test.test_getEncoding);
});
+ _ut.test('test_hashCode_equal', () {
+ final __test = new ElementLocationImplTest();
+ runJUnitTest(__test, __test.test_hashCode_equal);
+ });
+ _ut.test('test_hashCode_equalWithDifferentUriKind', () {
+ final __test = new ElementLocationImplTest();
+ runJUnitTest(__test, __test.test_hashCode_equalWithDifferentUriKind);
+ });
});
}
}
@@ -2339,7 +2358,7 @@
}
void test_isSubtypeOf_baseCase_classFunction() {
ClassElementImpl functionElement = ElementFactory.classElement2("Function", []);
- InterfaceTypeImpl functionType = new InterfaceTypeImpl_20(functionElement);
+ InterfaceTypeImpl functionType = new InterfaceTypeImpl_21(functionElement);
FunctionType f = ElementFactory.functionElement("f").type;
JUnitTestCase.assertTrue(f.isSubtypeOf(functionType));
}
@@ -2799,8 +2818,8 @@
});
}
}
-class InterfaceTypeImpl_20 extends InterfaceTypeImpl {
- InterfaceTypeImpl_20(ClassElement arg0) : super.con1(arg0);
+class InterfaceTypeImpl_21 extends InterfaceTypeImpl {
+ InterfaceTypeImpl_21(ClassElement arg0) : super.con1(arg0);
bool get isDartCoreFunction => true;
}
main() {
diff --git a/pkg/analyzer_experimental/test/generated/parser_test.dart b/pkg/analyzer_experimental/test/generated/parser_test.dart
index 2cb648e..077e787 100644
--- a/pkg/analyzer_experimental/test/generated/parser_test.dart
+++ b/pkg/analyzer_experimental/test/generated/parser_test.dart
@@ -31,52 +31,64 @@
JUnitTestCase.assertEquals(5, identifier.offset);
}
void test_computeStringValue_emptyInterpolationPrefix() {
- JUnitTestCase.assertEquals("", computeStringValue("'''"));
+ JUnitTestCase.assertEquals("", computeStringValue("'''", true, false));
}
void test_computeStringValue_escape_b() {
- JUnitTestCase.assertEquals("\b", computeStringValue("'\\b'"));
+ JUnitTestCase.assertEquals("\b", computeStringValue("'\\b'", true, true));
}
void test_computeStringValue_escape_f() {
- JUnitTestCase.assertEquals("\f", computeStringValue("'\\f'"));
+ JUnitTestCase.assertEquals("\f", computeStringValue("'\\f'", true, true));
}
void test_computeStringValue_escape_n() {
- JUnitTestCase.assertEquals("\n", computeStringValue("'\\n'"));
+ JUnitTestCase.assertEquals("\n", computeStringValue("'\\n'", true, true));
}
void test_computeStringValue_escape_notSpecial() {
- JUnitTestCase.assertEquals(":", computeStringValue("'\\:'"));
+ JUnitTestCase.assertEquals(":", computeStringValue("'\\:'", true, true));
}
void test_computeStringValue_escape_r() {
- JUnitTestCase.assertEquals("\r", computeStringValue("'\\r'"));
+ JUnitTestCase.assertEquals("\r", computeStringValue("'\\r'", true, true));
}
void test_computeStringValue_escape_t() {
- JUnitTestCase.assertEquals("\t", computeStringValue("'\\t'"));
+ JUnitTestCase.assertEquals("\t", computeStringValue("'\\t'", true, true));
}
void test_computeStringValue_escape_u_fixed() {
- JUnitTestCase.assertEquals("\u4321", computeStringValue("'\\u4321'"));
+ JUnitTestCase.assertEquals("\u4321", computeStringValue("'\\u4321'", true, true));
}
void test_computeStringValue_escape_u_variable() {
- JUnitTestCase.assertEquals("\u0123", computeStringValue("'\\u{123}'"));
+ JUnitTestCase.assertEquals("\u0123", computeStringValue("'\\u{123}'", true, true));
}
void test_computeStringValue_escape_v() {
- JUnitTestCase.assertEquals("\u000B", computeStringValue("'\\v'"));
+ JUnitTestCase.assertEquals("\u000B", computeStringValue("'\\v'", true, true));
}
void test_computeStringValue_escape_x() {
- JUnitTestCase.assertEquals("\u00FF", computeStringValue("'\\xFF'"));
+ JUnitTestCase.assertEquals("\u00FF", computeStringValue("'\\xFF'", true, true));
}
void test_computeStringValue_noEscape_single() {
- JUnitTestCase.assertEquals("text", computeStringValue("'text'"));
+ JUnitTestCase.assertEquals("text", computeStringValue("'text'", true, true));
}
void test_computeStringValue_noEscape_triple() {
- JUnitTestCase.assertEquals("text", computeStringValue("'''text'''"));
+ JUnitTestCase.assertEquals("text", computeStringValue("'''text'''", true, true));
}
void test_computeStringValue_raw_single() {
- JUnitTestCase.assertEquals("text", computeStringValue("r'text'"));
+ JUnitTestCase.assertEquals("text", computeStringValue("r'text'", true, true));
}
void test_computeStringValue_raw_triple() {
- JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''"));
+ JUnitTestCase.assertEquals("text", computeStringValue("r'''text'''", true, true));
}
void test_computeStringValue_raw_withEscape() {
- JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines'"));
+ JUnitTestCase.assertEquals("two\\nlines", computeStringValue("r'two\\nlines'", true, true));
+ }
+ void test_computeStringValue_triple_internalQuote_first_empty() {
+ JUnitTestCase.assertEquals("'", computeStringValue("''''", true, false));
+ }
+ void test_computeStringValue_triple_internalQuote_first_nonEmpty() {
+ JUnitTestCase.assertEquals("'text", computeStringValue("''''text", true, false));
+ }
+ void test_computeStringValue_triple_internalQuote_last_empty() {
+ JUnitTestCase.assertEquals("", computeStringValue("'''", false, true));
+ }
+ void test_computeStringValue_triple_internalQuote_last_nonEmpty() {
+ JUnitTestCase.assertEquals("text", computeStringValue("text'''", false, true));
}
void test_constFactory() {
ParserTestCase.parse("parseClassMember", <Object> ["C"], "const factory C() = A;");
@@ -326,7 +338,7 @@
}
void test_parseAssignableExpression_expression_index() {
IndexExpression expression = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "(x)[y]");
- JUnitTestCase.assertNotNull(expression.array);
+ JUnitTestCase.assertNotNull(expression.target);
JUnitTestCase.assertNotNull(expression.leftBracket);
JUnitTestCase.assertNotNull(expression.index);
JUnitTestCase.assertNotNull(expression.rightBracket);
@@ -353,7 +365,7 @@
}
void test_parseAssignableExpression_identifier_index() {
IndexExpression expression = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "x[y]");
- JUnitTestCase.assertNotNull(expression.array);
+ JUnitTestCase.assertNotNull(expression.target);
JUnitTestCase.assertNotNull(expression.leftBracket);
JUnitTestCase.assertNotNull(expression.index);
JUnitTestCase.assertNotNull(expression.rightBracket);
@@ -366,7 +378,7 @@
}
void test_parseAssignableExpression_super_index() {
IndexExpression expression = ParserTestCase.parse("parseAssignableExpression", <Object> [false], "super[y]");
- EngineTestCase.assertInstanceOf(SuperExpression, expression.array);
+ EngineTestCase.assertInstanceOf(SuperExpression, expression.target);
JUnitTestCase.assertNotNull(expression.leftBracket);
JUnitTestCase.assertNotNull(expression.index);
JUnitTestCase.assertNotNull(expression.rightBracket);
@@ -454,7 +466,7 @@
}
void test_parseCascadeSection_i() {
IndexExpression section = ParserTestCase.parse5("parseCascadeSection", "..[i]", []);
- JUnitTestCase.assertNull(section.array);
+ JUnitTestCase.assertNull(section.target);
JUnitTestCase.assertNotNull(section.leftBracket);
JUnitTestCase.assertNotNull(section.index);
JUnitTestCase.assertNotNull(section.rightBracket);
@@ -2828,7 +2840,7 @@
}
void test_parsePostfixExpression_none_indexExpression() {
IndexExpression expression = ParserTestCase.parse5("parsePostfixExpression", "a[0]", []);
- JUnitTestCase.assertNotNull(expression.array);
+ JUnitTestCase.assertNotNull(expression.target);
JUnitTestCase.assertNotNull(expression.index);
}
void test_parsePostfixExpression_none_methodInvocation() {
@@ -3197,18 +3209,25 @@
void test_parseSymbolLiteral_multiple() {
SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a.b.c", []);
JUnitTestCase.assertNotNull(literal.poundSign);
- NodeList<SimpleIdentifier> components = literal.components;
- EngineTestCase.assertSize(3, components);
- JUnitTestCase.assertEquals("a", components[0].name);
- JUnitTestCase.assertEquals("b", components[1].name);
- JUnitTestCase.assertEquals("c", components[2].name);
+ List<Token> components = literal.components;
+ EngineTestCase.assertLength(3, components);
+ JUnitTestCase.assertEquals("a", components[0].lexeme);
+ JUnitTestCase.assertEquals("b", components[1].lexeme);
+ JUnitTestCase.assertEquals("c", components[2].lexeme);
+ }
+ void test_parseSymbolLiteral_operator() {
+ SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#==", []);
+ JUnitTestCase.assertNotNull(literal.poundSign);
+ List<Token> components = literal.components;
+ EngineTestCase.assertLength(1, components);
+ JUnitTestCase.assertEquals("==", components[0].lexeme);
}
void test_parseSymbolLiteral_single() {
SymbolLiteral literal = ParserTestCase.parse5("parseSymbolLiteral", "#a", []);
JUnitTestCase.assertNotNull(literal.poundSign);
- NodeList<SimpleIdentifier> components = literal.components;
- EngineTestCase.assertSize(1, components);
- JUnitTestCase.assertEquals("a", components[0].name);
+ List<Token> components = literal.components;
+ EngineTestCase.assertLength(1, components);
+ JUnitTestCase.assertEquals("a", components[0].lexeme);
}
void test_parseThrowExpression() {
ThrowExpression expression = ParserTestCase.parse5("parseThrowExpression", "throw x;", []);
@@ -3753,13 +3772,15 @@
* Invoke the method [Parser#computeStringValue] with the given argument.
*
* @param lexeme the argument to the method
+ * @param first `true` if this is the first token in a string literal
+ * @param last `true` if this is the last token in a string literal
* @return the result of invoking the method
* @throws Exception if the method could not be invoked or throws an exception
*/
- String computeStringValue(String lexeme) {
- AnalysisErrorListener listener = new AnalysisErrorListener_21();
+ String computeStringValue(String lexeme, bool first, bool last) {
+ AnalysisErrorListener listener = new AnalysisErrorListener_22();
Parser parser = new Parser(null, listener);
- return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme], null) as String;
+ return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme, first, last], null) as String;
}
/**
@@ -3930,6 +3951,22 @@
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_computeStringValue_raw_withEscape);
});
+ _ut.test('test_computeStringValue_triple_internalQuote_first_empty', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote_first_empty);
+ });
+ _ut.test('test_computeStringValue_triple_internalQuote_first_nonEmpty', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote_first_nonEmpty);
+ });
+ _ut.test('test_computeStringValue_triple_internalQuote_last_empty', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote_last_empty);
+ });
+ _ut.test('test_computeStringValue_triple_internalQuote_last_nonEmpty', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_computeStringValue_triple_internalQuote_last_nonEmpty);
+ });
_ut.test('test_constFactory', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_constFactory);
@@ -5654,6 +5691,10 @@
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseSymbolLiteral_multiple);
});
+ _ut.test('test_parseSymbolLiteral_operator', () {
+ final __test = new SimpleParserTest();
+ runJUnitTest(__test, __test.test_parseSymbolLiteral_operator);
+ });
_ut.test('test_parseSymbolLiteral_single', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseSymbolLiteral_single);
@@ -5965,7 +6006,7 @@
});
}
}
-class AnalysisErrorListener_21 implements AnalysisErrorListener {
+class AnalysisErrorListener_22 implements AnalysisErrorListener {
void onError(AnalysisError event) {
JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.offset}, ${event.length})");
}
@@ -9256,7 +9297,7 @@
'parseStatements_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseStatements(arg0)),
'advance_0': new MethodTrampoline(0, (Parser target) => target.advance()),
'appendScalarValue_5': new MethodTrampoline(5, (Parser target, arg0, arg1, arg2, arg3, arg4) => target.appendScalarValue(arg0, arg1, arg2, arg3, arg4)),
- 'computeStringValue_1': new MethodTrampoline(1, (Parser target, arg0) => target.computeStringValue(arg0)),
+ 'computeStringValue_3': new MethodTrampoline(3, (Parser target, arg0, arg1, arg2) => target.computeStringValue(arg0, arg1, arg2)),
'convertToFunctionDeclaration_1': new MethodTrampoline(1, (Parser target, arg0) => target.convertToFunctionDeclaration(arg0)),
'couldBeStartOfCompilationUnitMember_0': new MethodTrampoline(0, (Parser target) => target.couldBeStartOfCompilationUnitMember()),
'createSyntheticIdentifier_0': new MethodTrampoline(0, (Parser target) => target.createSyntheticIdentifier()),
diff --git a/pkg/analyzer_experimental/test/generated/resolver_test.dart b/pkg/analyzer_experimental/test/generated/resolver_test.dart
index 6087c87..99404c3 100644
--- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
+++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
@@ -1465,13 +1465,13 @@
" A() {}",
"}"]));
resolve(source);
- assertNoErrors();
+ assertErrors([ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
verify([source]);
}
void test_finalNotInitialized_hasNativeClause_noConstructor() {
Source source = addSource(EngineTestCase.createSource(["class A native 'something' {", " final int x;", "}"]));
resolve(source);
- assertNoErrors();
+ assertErrors([ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
verify([source]);
}
void test_finalNotInitialized_initializer() {
@@ -1635,19 +1635,19 @@
"import 'lib.dart';"]));
addSource2("/lib.dart", "library lib;");
resolve(source);
- assertNoErrors();
+ assertErrors([HintCode.UNUSED_IMPORT, HintCode.UNUSED_IMPORT]);
verify([source]);
}
void test_importOfNonLibrary_libraryDeclared() {
- Source source = addSource(EngineTestCase.createSource(["library lib;", "import 'part.dart';"]));
- addSource2("/part.dart", EngineTestCase.createSource(["library lib1;"]));
+ Source source = addSource(EngineTestCase.createSource(["library lib;", "import 'part.dart';", "A a;"]));
+ addSource2("/part.dart", EngineTestCase.createSource(["library lib1;", "class A {}"]));
resolve(source);
assertNoErrors();
verify([source]);
}
void test_importOfNonLibrary_libraryNotDeclared() {
- Source source = addSource(EngineTestCase.createSource(["library lib;", "import 'part.dart';"]));
- addSource2("/part.dart", EngineTestCase.createSource([""]));
+ Source source = addSource(EngineTestCase.createSource(["library lib;", "import 'part.dart';", "A a;"]));
+ addSource2("/part.dart", EngineTestCase.createSource(["class A {}"]));
resolve(source);
assertNoErrors();
verify([source]);
@@ -2142,6 +2142,46 @@
assertNoErrors();
verify([source]);
}
+ void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_accessor() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " int get g => 0;",
+ "}",
+ "abstract class B extends A {",
+ " int get g;",
+ "}",
+ "class C extends B {",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_method() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " m(p) {}",
+ "}",
+ "abstract class B extends A {",
+ " m(p);",
+ "}",
+ "class C extends B {",
+ "}"]));
+ resolve(source);
+ 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;",
@@ -2458,13 +2498,14 @@
verify([source]);
}
void test_prefixCollidesWithTopLevelMembers() {
- addSource2("/lib.dart", "library lib;");
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class A {}"]));
Source source = addSource(EngineTestCase.createSource([
- "import '/lib.dart' as p;",
+ "import 'lib.dart' as p;",
"typedef P();",
"p2() {}",
"var p3;",
- "class p4 {}"]));
+ "class p4 {}",
+ "p.A a;"]));
resolve(source);
assertNoErrors();
verify([source]);
@@ -2718,6 +2759,12 @@
assertNoErrors();
verify([source]);
}
+ void test_typeAliasCannotReferenceItself_typeVariableBounds() {
+ Source source = addSource(EngineTestCase.createSource(["typedef A<T extends A>();"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_typeArgumentNotMatchingBounds_const() {
Source source = addSource(EngineTestCase.createSource([
"class A {}",
@@ -2830,31 +2877,6 @@
assertNoErrors();
verify([source]);
}
- void test_undefinedGetter_noSuchMethod_getter() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " noSuchMethod(invocation) {}",
- "}",
- "f() {",
- " (new A()).g;",
- "}"]));
- resolve(source);
- assertNoErrors();
- }
- void test_undefinedGetter_noSuchMethod_getter2() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " noSuchMethod(invocation) {}",
- "}",
- "class B {",
- " A a = new A();",
- " m() {",
- " a.g;",
- " }",
- "}"]));
- resolve(source);
- assertNoErrors();
- }
void test_undefinedGetter_typeSubstitution() {
Source source = addSource(EngineTestCase.createSource([
"class A<E> {",
@@ -2876,17 +2898,6 @@
assertNoErrors();
verify([source]);
}
- void test_undefinedIdentifier_noSuchMethod() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " noSuchMethod(invocation) {}",
- " f() {",
- " var v = a;",
- " }",
- "}"]));
- resolve(source);
- assertNoErrors();
- }
void test_undefinedIdentifier_show() {
Source source = addSource(EngineTestCase.createSource(["library L;", "export 'lib1.dart' show a;"]));
addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"]));
@@ -2904,17 +2915,6 @@
resolve(source);
assertNoErrors();
}
- void test_undefinedMethod_noSuchMethod() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " noSuchMethod(invocation) {}",
- "}",
- "f() {",
- " (new A()).m();",
- "}"]));
- resolve(source);
- assertNoErrors();
- }
void test_undefinedOperator_index() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -2935,17 +2935,6 @@
assertNoErrors();
verify([source]);
}
- void test_undefinedSetter_noSuchMethod() {
- Source source = addSource(EngineTestCase.createSource([
- "class A {",
- " noSuchMethod(invocation) {}",
- "}",
- "f() {",
- " (new A()).s = 1;",
- "}"]));
- resolve(source);
- assertNoErrors();
- }
void test_undefinedSuperMethod_field() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -3527,6 +3516,18 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_newWithUndefinedConstructorDefault);
});
+ _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_accessor', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_accessor);
+ });
+ _ut.test('test_nonAbstractClassInheritsAbstractMemberOne_abstractOverridesConcrete_method', () {
+ 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);
@@ -3747,6 +3748,10 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnClass_withTypeAlias);
});
+ _ut.test('test_typeAliasCannotReferenceItself_typeVariableBounds', () {
+ final __test = new NonErrorResolverTest();
+ runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_typeVariableBounds);
+ });
_ut.test('test_typeArgumentNotMatchingBounds_const', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_typeArgumentNotMatchingBounds_const);
@@ -3791,14 +3796,6 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedConstructorInInitializer_redirecting);
});
- _ut.test('test_undefinedGetter_noSuchMethod_getter', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_undefinedGetter_noSuchMethod_getter);
- });
- _ut.test('test_undefinedGetter_noSuchMethod_getter2', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_undefinedGetter_noSuchMethod_getter2);
- });
_ut.test('test_undefinedGetter_typeSubstitution', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedGetter_typeSubstitution);
@@ -3807,10 +3804,6 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_hide);
});
- _ut.test('test_undefinedIdentifier_noSuchMethod', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_undefinedIdentifier_noSuchMethod);
- });
_ut.test('test_undefinedIdentifier_show', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_show);
@@ -3823,10 +3816,6 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedMethod_functionExpression_directCall);
});
- _ut.test('test_undefinedMethod_noSuchMethod', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_undefinedMethod_noSuchMethod);
- });
_ut.test('test_undefinedOperator_index', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedOperator_index);
@@ -3835,10 +3824,6 @@
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedOperator_tilde);
});
- _ut.test('test_undefinedSetter_noSuchMethod', () {
- final __test = new NonErrorResolverTest();
- runJUnitTest(__test, __test.test_undefinedSetter_noSuchMethod);
- });
_ut.test('test_undefinedSuperMethod_field', () {
final __test = new NonErrorResolverTest();
runJUnitTest(__test, __test.test_undefinedSuperMethod_field);
@@ -5044,6 +5029,46 @@
assertErrors([HintCode.DEAD_CODE]);
verify([source]);
}
+ void test_unusedImport() {
+ Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;"]));
+ resolve(source);
+ assertErrors([HintCode.UNUSED_IMPORT]);
+ verify([source]);
+ }
+ void test_unusedImport_as() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'lib1.dart';",
+ "import 'lib1.dart' as one;",
+ "one.A a;"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class A {}"]));
+ resolve(source);
+ assertErrors([HintCode.UNUSED_IMPORT]);
+ verify([source]);
+ }
+ void test_unusedImport_hide() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'lib1.dart';",
+ "import 'lib1.dart' hide A;",
+ "A a;"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class A {}"]));
+ resolve(source);
+ assertErrors([HintCode.UNUSED_IMPORT]);
+ verify([source]);
+ }
+ void test_unusedImport_show() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'lib1.dart' show A;",
+ "import 'lib1.dart' show B;",
+ "A a;"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class A {}", "class B {}"]));
+ resolve(source);
+ assertErrors([HintCode.UNUSED_IMPORT]);
+ verify([source]);
+ }
static dartSuite() {
_ut.group('HintCodeTest', () {
_ut.test('test_deadCode_deadBlock_conditionalElse', () {
@@ -5146,6 +5171,22 @@
final __test = new HintCodeTest();
runJUnitTest(__test, __test.test_deadCode_statementAfterReturn_twoReturns);
});
+ _ut.test('test_unusedImport', () {
+ final __test = new HintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport);
+ });
+ _ut.test('test_unusedImport_as', () {
+ final __test = new HintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport_as);
+ });
+ _ut.test('test_unusedImport_hide', () {
+ final __test = new HintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport_hide);
+ });
+ _ut.test('test_unusedImport_show', () {
+ final __test = new HintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport_show);
+ });
});
}
}
@@ -5785,6 +5826,150 @@
_typeProvider = new TestTypeProvider();
_inheritanceManager = createInheritanceManager();
}
+ 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]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromClasses_accessor_implements() {
+ 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.interfaces = <InterfaceType> [classA.type];
+ Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ JUnitTestCase.assertNull(map[getterName]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromClasses_accessor_with() {
+ 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.mixins = <InterfaceType> [classA.type];
+ Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromClasses(classB);
+ JUnitTestCase.assertSame(getterG, map[getterName]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromClasses_method_extends() {
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ 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.getMapOfMembersInheritedFromClasses(classB);
+ JUnitTestCase.assertSame(methodM, map[methodName]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromClasses_method_implements() {
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ String methodName = "m";
+ MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvider.intType, []);
+ 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]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromClasses_method_with() {
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ String methodName = "m";
+ MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvider.intType, []);
+ 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]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromInterfaces_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.getMapOfMembersInheritedFromInterfaces(classB);
+ JUnitTestCase.assertSame(getterG, map[getterName]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromInterfaces_accessor_implements() {
+ 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.interfaces = <InterfaceType> [classA.type];
+ Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ JUnitTestCase.assertSame(getterG, map[getterName]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromInterfaces_accessor_with() {
+ 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.mixins = <InterfaceType> [classA.type];
+ Map<String, ExecutableElement> map = _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classB);
+ JUnitTestCase.assertSame(getterG, map[getterName]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromInterfaces_method_extends() {
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ 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]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromInterfaces_method_implements() {
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ String methodName = "m";
+ MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvider.intType, []);
+ 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]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
+ void test_getMapOfMembersInheritedFromInterfaces_method_with() {
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ String methodName = "m";
+ MethodElement methodM = ElementFactory.methodElement(methodName, _typeProvider.intType, []);
+ 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]);
+ assertNoErrors(classA);
+ assertNoErrors(classB);
+ }
void test_lookupInheritance_interface_getter() {
ClassElementImpl classA = ElementFactory.classElement2("A", []);
String getterName = "g";
@@ -6100,6 +6285,54 @@
}
static dartSuite() {
_ut.group('InheritanceManagerTest', () {
+ _ut.test('test_getMapOfMembersInheritedFromClasses_accessor_extends', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_accessor_extends);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromClasses_accessor_implements', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_accessor_implements);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromClasses_accessor_with', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_accessor_with);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromClasses_method_extends', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_method_extends);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromClasses_method_implements', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_method_implements);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromClasses_method_with', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromClasses_method_with);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromInterfaces_accessor_extends', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_accessor_extends);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromInterfaces_accessor_implements', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_accessor_implements);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromInterfaces_accessor_with', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_accessor_with);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromInterfaces_method_extends', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_method_extends);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromInterfaces_method_implements', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_method_implements);
+ });
+ _ut.test('test_getMapOfMembersInheritedFromInterfaces_method_with', () {
+ final __test = new InheritanceManagerTest();
+ runJUnitTest(__test, __test.test_getMapOfMembersInheritedFromInterfaces_method_with);
+ });
_ut.test('test_lookupInheritance_interface_getter', () {
final __test = new InheritanceManagerTest();
runJUnitTest(__test, __test.test_lookupInheritance_interface_getter);
@@ -6299,115 +6532,6 @@
assertErrors([CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
verify([source]);
}
- void test_ambiguousImport_as() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "f(p) {p as N;}"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
- }
- void test_ambiguousImport_extends() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "class A extends N {}"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
- resolve(source);
- assertErrors([
- CompileTimeErrorCode.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([
- CompileTimeErrorCode.AMBIGUOUS_IMPORT,
- StaticTypeWarningCode.UNDEFINED_FUNCTION]);
- }
- void test_ambiguousImport_implements() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "class A implements N {}"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
- resolve(source);
- assertErrors([
- CompileTimeErrorCode.AMBIGUOUS_IMPORT,
- CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
- }
- void test_ambiguousImport_instanceCreation() {
- Source source = addSource(EngineTestCase.createSource([
- "library L;",
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "f() {new N();}"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
- }
- void test_ambiguousImport_is() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "f(p) {p is N;}"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
- }
- void test_ambiguousImport_qualifier() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "g() { N.FOO; }"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
- }
- void test_ambiguousImport_typeArgument_instanceCreation() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "class A<T> {}",
- "f() {new A<N>();}"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
- }
- void test_ambiguousImport_varRead() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "f() { g(v); }",
- "g(p) {}"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var v;"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var v;"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
- }
- void test_ambiguousImport_varWrite() {
- Source source = addSource(EngineTestCase.createSource([
- "import 'lib1.dart';",
- "import 'lib2.dart';",
- "f() { v = 0; }"]));
- addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var v;"]));
- addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var v;"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
- }
void test_argumentDefinitionTestNonParameter() {
Source source = addSource(EngineTestCase.createSource(["f() {", " var v = 0;", " return ?v;", "}"]));
resolve(source);
@@ -7399,18 +7523,22 @@
void test_importInternalLibrary() {
Source source = addSource(EngineTestCase.createSource(["import 'dart:_interceptors';"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]);
+ assertErrors([
+ CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY,
+ HintCode.UNUSED_IMPORT]);
verify([source]);
}
void test_importInternalLibrary_collection() {
Source source = addSource(EngineTestCase.createSource(["import 'dart:_collection-dev';"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY]);
+ assertErrors([
+ CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY,
+ HintCode.UNUSED_IMPORT]);
verify([source]);
}
void test_importOfNonLibrary() {
- Source source = addSource(EngineTestCase.createSource(["library lib;", "import 'part.dart';"]));
- addSource2("/part.dart", EngineTestCase.createSource(["part of lib;"]));
+ Source source = addSource(EngineTestCase.createSource(["library lib;", "import 'part.dart';", "A a;"]));
+ addSource2("/part.dart", EngineTestCase.createSource(["part of lib;", "class A{}"]));
resolve(source);
assertErrors([CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]);
verify([source]);
@@ -7926,6 +8054,12 @@
assertErrors([CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]);
verify([source]);
}
+ void test_nativeClauseInNonSDKCode() {
+ Source source = addSource(EngineTestCase.createSource(["class A native 'string' {}"]));
+ resolve(source);
+ assertErrors([ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
+ verify([source]);
+ }
void test_nativeFunctionBodyInNonSDKCode_function() {
Source source = addSource(EngineTestCase.createSource(["int m(a) native 'string';"]));
resolve(source);
@@ -8222,29 +8356,29 @@
verify([source]);
}
void test_prefixCollidesWithTopLevelMembers_functionTypeAlias() {
- addSource2("/lib.dart", "library lib;");
- Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' as p;", "typedef p();"]));
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class A{}"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as p;", "typedef p();", "p.A a;"]));
resolve(source);
assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
verify([source]);
}
void test_prefixCollidesWithTopLevelMembers_topLevelFunction() {
- addSource2("/lib.dart", "library lib;");
- Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' as p;", "p() {}"]));
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class A{}"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as p;", "p() {}", "p.A a;"]));
resolve(source);
assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
verify([source]);
}
void test_prefixCollidesWithTopLevelMembers_topLevelVariable() {
- addSource2("/lib.dart", "library lib;");
- Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' as p;", "var p = null;"]));
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class A{}"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as p;", "var p = null;", "p.A a;"]));
resolve(source);
assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
verify([source]);
}
void test_prefixCollidesWithTopLevelMembers_type() {
- addSource2("/lib.dart", "library lib;");
- Source source = addSource(EngineTestCase.createSource(["import '/lib.dart' as p;", "class p {}"]));
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class A{}"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as p;", "class p {}", "p.A a;"]));
resolve(source);
assertErrors([CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
verify([source]);
@@ -8620,6 +8754,23 @@
assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
verify([source]);
}
+ void test_typeAliasCannotReferenceItself_parameterType_typeArgument() {
+ Source source = addSource(EngineTestCase.createSource(["typedef A(List<A> a);"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
+ verify([source]);
+ }
+ void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() {
+ Source source = addSource(EngineTestCase.createSource([
+ "typedef C A();",
+ "typedef A B();",
+ "class C {",
+ " B a;",
+ "}"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
+ verify([source]);
+ }
void test_typeAliasCannotReferenceItself_returnType() {
Source source = addSource(EngineTestCase.createSource(["typedef A A();"]));
resolve(source);
@@ -8634,12 +8785,6 @@
CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
verify([source]);
}
- void test_typeAliasCannotReferenceItself_typeVariableBounds() {
- Source source = addSource(EngineTestCase.createSource(["typedef A<T extends A>();"]));
- resolve(source);
- assertErrors([CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
- verify([source]);
- }
void test_typeAliasCannotRereferenceItself_mixin_direct() {
Source source = addSource(EngineTestCase.createSource(["typedef M = Object with M;"]));
resolve(source);
@@ -8888,46 +9033,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_ambiguousExport);
});
- _ut.test('test_ambiguousImport_as', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_as);
- });
- _ut.test('test_ambiguousImport_extends', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_extends);
- });
- _ut.test('test_ambiguousImport_function', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_function);
- });
- _ut.test('test_ambiguousImport_implements', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_implements);
- });
- _ut.test('test_ambiguousImport_instanceCreation', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_instanceCreation);
- });
- _ut.test('test_ambiguousImport_is', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_is);
- });
- _ut.test('test_ambiguousImport_qualifier', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_qualifier);
- });
- _ut.test('test_ambiguousImport_typeArgument_instanceCreation', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_instanceCreation);
- });
- _ut.test('test_ambiguousImport_varRead', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_varRead);
- });
- _ut.test('test_ambiguousImport_varWrite', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_ambiguousImport_varWrite);
- });
_ut.test('test_argumentDefinitionTestNonParameter', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_argumentDefinitionTestNonParameter);
@@ -9644,6 +9749,10 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_multipleSuperInitializers);
});
+ _ut.test('test_nativeClauseInNonSDKCode', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_nativeClauseInNonSDKCode);
+ });
_ut.test('test_nativeFunctionBodyInNonSDKCode_function', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_nativeFunctionBodyInNonSDKCode_function);
@@ -9960,6 +10069,14 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_parameterType_required);
});
+ _ut.test('test_typeAliasCannotReferenceItself_parameterType_typeArgument', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_parameterType_typeArgument);
+ });
+ _ut.test('test_typeAliasCannotReferenceItself_returnClass_withTypeAlias', () {
+ final __test = new CompileTimeErrorCodeTest();
+ runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnClass_withTypeAlias);
+ });
_ut.test('test_typeAliasCannotReferenceItself_returnType', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnType);
@@ -9968,10 +10085,6 @@
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_returnType_indirect);
});
- _ut.test('test_typeAliasCannotReferenceItself_typeVariableBounds', () {
- final __test = new CompileTimeErrorCodeTest();
- runJUnitTest(__test, __test.test_typeAliasCannotReferenceItself_typeVariableBounds);
- });
_ut.test('test_typeAliasCannotRereferenceItself_mixin_direct', () {
final __test = new CompileTimeErrorCodeTest();
runJUnitTest(__test, __test.test_typeAliasCannotRereferenceItself_mixin_direct);
@@ -10517,13 +10630,13 @@
leftHandSide.staticType = intType;
AssignmentExpression assignment = ASTFactory.assignmentExpression(leftHandSide, TokenType.PLUS_EQ, ASTFactory.integer(1));
resolveNode(assignment, []);
- JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.element);
+ JUnitTestCase.assertSame(getMethod(_typeProvider.numType, "+"), assignment.staticElement);
_listener.assertNoErrors();
}
void test_visitAssignmentExpression_simple() {
AssignmentExpression expression = ASTFactory.assignmentExpression(ASTFactory.identifier3("x"), TokenType.EQ, ASTFactory.integer(0));
resolveNode(expression, []);
- JUnitTestCase.assertNull(expression.element);
+ JUnitTestCase.assertNull(expression.staticElement);
_listener.assertNoErrors();
}
void test_visitBinaryExpression() {
@@ -10532,7 +10645,7 @@
left.staticType = numType;
BinaryExpression expression = ASTFactory.binaryExpression(left, TokenType.PLUS, ASTFactory.identifier3("j"));
resolveNode(expression, []);
- JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.element);
+ JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement);
_listener.assertNoErrors();
}
void test_visitBreakStatement_withLabel() {
@@ -10705,7 +10818,7 @@
operand.staticType = numType;
PostfixExpression expression = ASTFactory.postfixExpression(operand, TokenType.PLUS_PLUS);
resolveNode(expression, []);
- JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.element);
+ JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement);
_listener.assertNoErrors();
}
void test_visitPrefixedIdentifier_dynamic() {
@@ -10743,7 +10856,7 @@
operand.staticType = numType;
PrefixExpression expression = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, operand);
resolveNode(expression, []);
- JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.element);
+ JUnitTestCase.assertEquals(getMethod(numType, "+"), expression.staticElement);
_listener.assertNoErrors();
}
void test_visitPropertyAccess_getter_identifier() {
@@ -10918,7 +11031,7 @@
*/
Element resolve5(IndexExpression node, List<Element> definedElements) {
resolveNode(node, definedElements);
- return node.element;
+ return node.staticElement;
}
/**
@@ -11420,12 +11533,6 @@
StaticWarningCode.UNDEFINED_IDENTIFIER,
StaticWarningCode.UNDEFINED_IDENTIFIER]);
}
- void fail_undefinedIdentifier_function() {
- Source source = addSource(EngineTestCase.createSource(["int a() => b;"]));
- resolve(source);
- assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
- verify([source]);
- }
void fail_undefinedSetter() {
Source source = addSource(EngineTestCase.createSource(["class C {}", "f(var p) {", " C.m = 0;", "}"]));
resolve(source);
@@ -11444,6 +11551,83 @@
assertErrors([StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER]);
verify([source]);
}
+ void test_ambiguousImport_as() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "f(p) {p as N;}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
+ }
+ void test_ambiguousImport_extends() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "class A extends N {}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
+ resolve(source);
+ assertErrors([
+ 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';",
+ "import 'lib2.dart';",
+ "class A implements N {}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
+ resolve(source);
+ assertErrors([
+ StaticWarningCode.AMBIGUOUS_IMPORT,
+ CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
+ }
+ void test_ambiguousImport_instanceCreation() {
+ Source source = addSource(EngineTestCase.createSource([
+ "library L;",
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "f() {new N();}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
+ }
+ void test_ambiguousImport_is() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "f(p) {p is N;}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
+ }
+ void test_ambiguousImport_qualifier() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "g() { N.FOO; }"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
+ }
void test_ambiguousImport_typeAnnotation() {
Source source = addSource(EngineTestCase.createSource([
"import 'lib1.dart';",
@@ -11479,6 +11663,38 @@
resolve(source);
assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
}
+ void test_ambiguousImport_typeArgument_instanceCreation() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "class A<T> {}",
+ "f() {new A<N>();}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "class N {}"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "class N {}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
+ }
+ void test_ambiguousImport_varRead() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "f() { g(v); }",
+ "g(p) {}"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var v;"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var v;"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
+ }
+ void test_ambiguousImport_varWrite() {
+ Source source = addSource(EngineTestCase.createSource([
+ "import 'lib1.dart';",
+ "import 'lib2.dart';",
+ "f() { v = 0; }"]));
+ addSource2("/lib1.dart", EngineTestCase.createSource(["library lib1;", "var v;"]));
+ addSource2("/lib2.dart", EngineTestCase.createSource(["library lib2;", "var v;"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.AMBIGUOUS_IMPORT]);
+ }
void test_argumentTypeNotAssignable_annotation_namedConstructor() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -11648,6 +11864,25 @@
assertErrors([StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
verify([source]);
}
+ void test_assignmentToConst_instanceVariable() {
+ Source source = addSource(EngineTestCase.createSource([
+ "class A {",
+ " static const v = 0;",
+ "}",
+ "f() {",
+ " A a = new A();",
+ " a.v = 1;",
+ "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.ASSIGNMENT_TO_CONST]);
+ verify([source]);
+ }
+ void test_assignmentToConst_localVariable() {
+ Source source = addSource(EngineTestCase.createSource(["f() {", " const x = 0;", " x = 1;", "}"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.ASSIGNMENT_TO_CONST]);
+ verify([source]);
+ }
void test_assignmentToFinal_instanceVariable() {
Source source = addSource(EngineTestCase.createSource([
"class A {",
@@ -11988,7 +12223,10 @@
addSource2("/lib1.dart", "library lib;");
addSource2("/lib2.dart", "library lib;");
resolve(source);
- assertErrors([StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME]);
+ assertErrors([
+ StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAME,
+ HintCode.UNUSED_IMPORT,
+ HintCode.UNUSED_IMPORT]);
verify([source]);
}
void test_inconsistentMethodInheritanceGetterAndMethod() {
@@ -12362,12 +12600,13 @@
verify([source]);
}
void test_newWithNonType_fromLibrary() {
- Source source1 = addSource2("lib.dart", "");
+ Source source1 = addSource2("lib.dart", "class B {}");
Source source2 = addSource2("lib2.dart", EngineTestCase.createSource([
"import 'lib.dart' as lib;",
"void f() {",
" var a = new lib.A();",
- "}"]));
+ "}",
+ "lib.B b;"]));
resolve(source1);
resolve(source2);
assertErrors([StaticWarningCode.NEW_WITH_NON_TYPE]);
@@ -12790,11 +13029,29 @@
assertErrors([StaticWarningCode.UNDEFINED_GETTER]);
verify([source1]);
}
+ void test_undefinedIdentifier_function() {
+ Source source = addSource(EngineTestCase.createSource(["int a() => b;"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
+ }
+ void test_undefinedIdentifier_function_prefix() {
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class C {}"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as b;", "", "int a() => b;", "b.C c;"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
+ verify([source]);
+ }
void test_undefinedIdentifier_initializer() {
Source source = addSource(EngineTestCase.createSource(["var a = b;"]));
resolve(source);
assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
}
+ void test_undefinedIdentifier_initializer_prefix() {
+ addSource2("/lib.dart", EngineTestCase.createSource(["library lib;", "class C {}"]));
+ Source source = addSource(EngineTestCase.createSource(["import 'lib.dart' as b;", "", "var a = b;", "b.C c;"]));
+ resolve(source);
+ assertErrors([StaticWarningCode.UNDEFINED_IDENTIFIER]);
+ }
void test_undefinedIdentifier_metadata() {
Source source = addSource(EngineTestCase.createSource(["@undefined class A {}"]));
resolve(source);
@@ -12812,6 +13069,34 @@
}
static dartSuite() {
_ut.group('StaticWarningCodeTest', () {
+ _ut.test('test_ambiguousImport_as', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_as);
+ });
+ _ut.test('test_ambiguousImport_extends', () {
+ 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);
+ });
+ _ut.test('test_ambiguousImport_instanceCreation', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_instanceCreation);
+ });
+ _ut.test('test_ambiguousImport_is', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_is);
+ });
+ _ut.test('test_ambiguousImport_qualifier', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_qualifier);
+ });
_ut.test('test_ambiguousImport_typeAnnotation', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_ambiguousImport_typeAnnotation);
@@ -12820,6 +13105,18 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_annotation);
});
+ _ut.test('test_ambiguousImport_typeArgument_instanceCreation', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_typeArgument_instanceCreation);
+ });
+ _ut.test('test_ambiguousImport_varRead', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_varRead);
+ });
+ _ut.test('test_ambiguousImport_varWrite', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_ambiguousImport_varWrite);
+ });
_ut.test('test_argumentTypeNotAssignable_annotation_namedConstructor', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_argumentTypeNotAssignable_annotation_namedConstructor);
@@ -12888,6 +13185,14 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_argumentTypeNotAssignable_new_required);
});
+ _ut.test('test_assignmentToConst_instanceVariable', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_assignmentToConst_instanceVariable);
+ });
+ _ut.test('test_assignmentToConst_localVariable', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_assignmentToConst_localVariable);
+ });
_ut.test('test_assignmentToFinal_instanceVariable', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_assignmentToFinal_instanceVariable);
@@ -13364,10 +13669,22 @@
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedGetter_fromLibrary);
});
+ _ut.test('test_undefinedIdentifier_function', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedIdentifier_function);
+ });
+ _ut.test('test_undefinedIdentifier_function_prefix', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedIdentifier_function_prefix);
+ });
_ut.test('test_undefinedIdentifier_initializer', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_initializer);
});
+ _ut.test('test_undefinedIdentifier_initializer_prefix', () {
+ final __test = new StaticWarningCodeTest();
+ runJUnitTest(__test, __test.test_undefinedIdentifier_initializer_prefix);
+ });
_ut.test('test_undefinedIdentifier_metadata', () {
final __test = new StaticWarningCodeTest();
runJUnitTest(__test, __test.test_undefinedIdentifier_metadata);
@@ -13855,7 +14172,7 @@
JUnitTestCase.assertEquals(typeC, scope.lookup(ASTFactory.identifier3(typeNameC), importingLibrary));
errorListener.assertNoErrors();
Element element = scope.lookup(ASTFactory.identifier3(typeNameB), importingLibrary);
- errorListener.assertErrors2([CompileTimeErrorCode.AMBIGUOUS_IMPORT]);
+ errorListener.assertErrors2([StaticWarningCode.AMBIGUOUS_IMPORT]);
EngineTestCase.assertInstanceOf(MultiplyDefinedElement, element);
List<Element> conflictingElements = ((element as MultiplyDefinedElement)).conflictingElements;
JUnitTestCase.assertEquals(typeB1, conflictingElements[0]);
@@ -13894,13 +14211,13 @@
void test_getDefiningLibrary() {
LibraryElement definingLibrary = createTestLibrary();
GatheringErrorListener errorListener = new GatheringErrorListener();
- Scope scope = new LibraryImportScope(definingLibrary, errorListener);
+ LibraryImportScope scope = new LibraryImportScope(definingLibrary, errorListener);
JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary);
}
void test_getErrorListener() {
LibraryElement definingLibrary = createTestLibrary();
GatheringErrorListener errorListener = new GatheringErrorListener();
- Scope scope = new LibraryImportScope(definingLibrary, errorListener);
+ LibraryImportScope scope = new LibraryImportScope(definingLibrary, errorListener);
JUnitTestCase.assertEquals(errorListener, scope.errorListener);
}
void test_prefixedAndNonPrefixed() {
@@ -14026,7 +14343,7 @@
if (operandType == null || operandType.isDynamic) {
return null;
}
- return checkResolved2(node, node.element, MethodElement);
+ return checkResolved2(node, node.staticElement, MethodElement);
}
Object visitCommentReference(CommentReference node) => null;
Object visitCompilationUnit(CompilationUnit node) {
@@ -14059,7 +14376,7 @@
if (targetType == null || targetType.isDynamic) {
return null;
}
- return checkResolved2(node, node.element, MethodElement);
+ return checkResolved2(node, node.staticElement, MethodElement);
}
Object visitLibraryDirective(LibraryDirective node) => checkResolved2(node, node.element, LibraryElement);
Object visitNamedExpression(NamedExpression node) => node.expression.accept(this);
@@ -14074,7 +14391,7 @@
if (operandType == null || operandType.isDynamic) {
return null;
}
- return checkResolved2(node, node.element, MethodElement);
+ return checkResolved2(node, node.staticElement, MethodElement);
}
Object visitPrefixedIdentifier(PrefixedIdentifier node) {
SimpleIdentifier prefix = node.prefix;
@@ -14094,7 +14411,7 @@
if (operandType == null || operandType.isDynamic) {
return null;
}
- return checkResolved2(node, node.element, MethodElement);
+ return checkResolved2(node, node.staticElement, MethodElement);
}
Object visitPropertyAccess(PropertyAccess node) {
Expression target = node.realTarget;
@@ -14186,13 +14503,13 @@
void test_getDefiningLibrary() {
LibraryElement definingLibrary = createTestLibrary();
GatheringErrorListener errorListener = new GatheringErrorListener();
- Scope scope = new LibraryScope(definingLibrary, errorListener);
+ LibraryScope scope = new LibraryScope(definingLibrary, errorListener);
JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary);
}
void test_getErrorListener() {
LibraryElement definingLibrary = createTestLibrary();
GatheringErrorListener errorListener = new GatheringErrorListener();
- Scope scope = new LibraryScope(definingLibrary, errorListener);
+ LibraryScope scope = new LibraryScope(definingLibrary, errorListener);
JUnitTestCase.assertEquals(errorListener, scope.errorListener);
}
static dartSuite() {
@@ -14278,7 +14595,6 @@
AssignmentExpression node = ASTFactory.assignmentExpression(identifier, TokenType.PLUS_EQ, resolvedInteger(1));
MethodElement plusMethod = getMethod(numType, "+");
node.staticElement = plusMethod;
- node.element = plusMethod;
JUnitTestCase.assertSame(numType, analyze(node));
_listener.assertNoErrors();
}
@@ -14310,19 +14626,19 @@
}
void test_visitBinaryExpression_plusID() {
BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), TokenType.PLUS, resolvedDouble(2.0));
- setStaticElement(node, getMethod(_typeProvider.numType, "+"));
+ node.staticElement = getMethod(_typeProvider.numType, "+");
JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node));
_listener.assertNoErrors();
}
void test_visitBinaryExpression_plusII() {
BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), TokenType.PLUS, resolvedInteger(2));
- setStaticElement(node, getMethod(_typeProvider.numType, "+"));
+ node.staticElement = getMethod(_typeProvider.numType, "+");
JUnitTestCase.assertSame(_typeProvider.intType, analyze(node));
_listener.assertNoErrors();
}
void test_visitBinaryExpression_slash() {
BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(2), TokenType.SLASH, resolvedInteger(2));
- setStaticElement(node, getMethod(_typeProvider.numType, "/"));
+ node.staticElement = getMethod(_typeProvider.numType, "/");
JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node));
_listener.assertNoErrors();
}
@@ -14332,13 +14648,13 @@
MethodElement operator = ElementFactory.methodElement("*", typeA, [_typeProvider.doubleType]);
classA.methods = <MethodElement> [operator];
BinaryExpression node = ASTFactory.binaryExpression(ASTFactory.asExpression(ASTFactory.identifier3("a"), ASTFactory.typeName(classA, [])), TokenType.PLUS, resolvedDouble(2.0));
- setStaticElement(node, operator);
+ node.staticElement = operator;
JUnitTestCase.assertSame(typeA, analyze(node));
_listener.assertNoErrors();
}
void test_visitBinaryExpression_starID() {
BinaryExpression node = ASTFactory.binaryExpression(resolvedInteger(1), TokenType.PLUS, resolvedDouble(2.0));
- setStaticElement(node, getMethod(_typeProvider.numType, "*"));
+ node.staticElement = getMethod(_typeProvider.numType, "*");
JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node));
_listener.assertNoErrors();
}
@@ -14506,7 +14822,6 @@
IndexExpression node = ASTFactory.indexExpression(identifier, resolvedInteger(2));
MethodElement indexMethod = listType.element.methods[0];
node.staticElement = indexMethod;
- node.element = indexMethod;
JUnitTestCase.assertSame(listType.typeArguments[0], analyze(node));
_listener.assertNoErrors();
}
@@ -14516,7 +14831,6 @@
IndexExpression node = ASTFactory.indexExpression(identifier, resolvedInteger(2));
MethodElement indexMethod = listType.element.methods[1];
node.staticElement = indexMethod;
- node.element = indexMethod;
ASTFactory.assignmentExpression(node, TokenType.EQ, ASTFactory.integer(0));
JUnitTestCase.assertSame(listType.typeArguments[0], analyze(node));
_listener.assertNoErrors();
@@ -14531,7 +14845,6 @@
IndexExpression indexExpression = ASTFactory.indexExpression(identifier, ASTFactory.integer(0));
MethodElement indexMethod = MethodMember.from(methodElement, listOfIntType);
indexExpression.staticElement = indexMethod;
- indexExpression.element = indexMethod;
JUnitTestCase.assertSame(intType, analyze(indexExpression));
_listener.assertNoErrors();
}
@@ -14545,7 +14858,6 @@
IndexExpression indexExpression = ASTFactory.indexExpression(identifier, ASTFactory.integer(0));
MethodElement indexMethod = MethodMember.from(methodElement, listOfIntType);
indexExpression.staticElement = indexMethod;
- indexExpression.element = indexMethod;
ASTFactory.assignmentExpression(indexExpression, TokenType.EQ, ASTFactory.integer(0));
JUnitTestCase.assertSame(intType, analyze(indexExpression));
_listener.assertNoErrors();
@@ -14696,7 +15008,6 @@
PrefixExpression node = ASTFactory.prefixExpression(TokenType.MINUS, resolvedInteger(0));
MethodElement minusMethod = getMethod(_typeProvider.numType, "-");
node.staticElement = minusMethod;
- node.element = minusMethod;
JUnitTestCase.assertSame(_typeProvider.numType, analyze(node));
_listener.assertNoErrors();
}
@@ -14704,7 +15015,6 @@
PrefixExpression node = ASTFactory.prefixExpression(TokenType.MINUS_MINUS, resolvedInteger(0));
MethodElement minusMethod = getMethod(_typeProvider.numType, "-");
node.staticElement = minusMethod;
- node.element = minusMethod;
JUnitTestCase.assertSame(_typeProvider.intType, analyze(node));
_listener.assertNoErrors();
}
@@ -14717,7 +15027,6 @@
PrefixExpression node = ASTFactory.prefixExpression(TokenType.PLUS_PLUS, resolvedInteger(0));
MethodElement plusMethod = getMethod(_typeProvider.numType, "+");
node.staticElement = plusMethod;
- node.element = plusMethod;
JUnitTestCase.assertSame(_typeProvider.intType, analyze(node));
_listener.assertNoErrors();
}
@@ -14725,7 +15034,6 @@
PrefixExpression node = ASTFactory.prefixExpression(TokenType.TILDE, resolvedInteger(0));
MethodElement tildeMethod = getMethod(_typeProvider.intType, "~");
node.staticElement = tildeMethod;
- node.element = tildeMethod;
JUnitTestCase.assertSame(_typeProvider.intType, analyze(node));
_listener.assertNoErrors();
}
@@ -14766,6 +15074,9 @@
JUnitTestCase.assertSame(thisType, analyze2(node, thisType));
_listener.assertNoErrors();
}
+ void test_visitSymbolLiteral() {
+ JUnitTestCase.assertSame(_typeProvider.symbolType, analyze(ASTFactory.symbolLiteral(["a"])));
+ }
void test_visitThisExpression() {
InterfaceType thisType = ElementFactory.classElement("B", ElementFactory.classElement2("A", []).type, []).type;
Expression node = ASTFactory.thisExpression();
@@ -14988,14 +15299,6 @@
}
/**
- * Sets the element for the node and remembers it as the static resolution.
- */
- void setStaticElement(BinaryExpression node, MethodElement element2) {
- node.staticElement = element2;
- node.element = element2;
- }
-
- /**
* Set the type of the given parameter to the given type.
*
* @param parameter the parameter whose type is to be set
@@ -15268,6 +15571,10 @@
final __test = new StaticTypeAnalyzerTest();
runJUnitTest(__test, __test.test_visitSuperExpression);
});
+ _ut.test('test_visitSymbolLiteral', () {
+ final __test = new StaticTypeAnalyzerTest();
+ runJUnitTest(__test, __test.test_visitSymbolLiteral);
+ });
_ut.test('test_visitThisExpression', () {
final __test = new StaticTypeAnalyzerTest();
runJUnitTest(__test, __test.test_visitThisExpression);
@@ -15295,12 +15602,50 @@
assertNoErrors();
verify([source]);
}
+ void test_unusedImport_export() {
+ 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;", "class Two {}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_unusedImport_export_infiniteLoop() {
+ Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two one;"]));
+ 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 {}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
+ void test_unusedImport_export2() {
+ Source source = addSource(EngineTestCase.createSource(["library L;", "import 'lib1.dart';", "Two one;"]));
+ 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 {}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
static dartSuite() {
_ut.group('NonHintCodeTest', () {
_ut.test('test_deadCode_deadCatch_onCatchSubtype', () {
final __test = new NonHintCodeTest();
runJUnitTest(__test, __test.test_deadCode_deadCatch_onCatchSubtype);
});
+ _ut.test('test_unusedImport_export', () {
+ final __test = new NonHintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport_export);
+ });
+ _ut.test('test_unusedImport_export2', () {
+ final __test = new NonHintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport_export2);
+ });
+ _ut.test('test_unusedImport_export_infiniteLoop', () {
+ final __test = new NonHintCodeTest();
+ runJUnitTest(__test, __test.test_unusedImport_export_infiniteLoop);
+ });
});
}
}
@@ -15308,7 +15653,7 @@
void test_define_duplicate() {
LibraryElement definingLibrary2 = createTestLibrary();
GatheringErrorListener errorListener2 = new GatheringErrorListener();
- Scope rootScope = new Scope_18(definingLibrary2, errorListener2);
+ Scope rootScope = new Scope_19(definingLibrary2, errorListener2);
EnclosedScope scope = new EnclosedScope(rootScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -15319,7 +15664,7 @@
void test_define_normal() {
LibraryElement definingLibrary3 = createTestLibrary();
GatheringErrorListener errorListener3 = new GatheringErrorListener();
- Scope rootScope = new Scope_19(definingLibrary3, errorListener3);
+ Scope rootScope = new Scope_20(definingLibrary3, errorListener3);
EnclosedScope outerScope = new EnclosedScope(rootScope);
EnclosedScope innerScope = new EnclosedScope(outerScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -15341,18 +15686,18 @@
});
}
}
-class Scope_18 extends Scope {
+class Scope_19 extends Scope {
LibraryElement definingLibrary2;
GatheringErrorListener errorListener2;
- Scope_18(this.definingLibrary2, this.errorListener2) : super();
+ Scope_19(this.definingLibrary2, this.errorListener2) : super();
LibraryElement get definingLibrary => definingLibrary2;
AnalysisErrorListener get errorListener => errorListener2;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
}
-class Scope_19 extends Scope {
+class Scope_20 extends Scope {
LibraryElement definingLibrary3;
GatheringErrorListener errorListener3;
- Scope_19(this.definingLibrary3, this.errorListener3) : super();
+ Scope_20(this.definingLibrary3, this.errorListener3) : super();
LibraryElement get definingLibrary => definingLibrary3;
AnalysisErrorListener get errorListener => errorListener3;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
@@ -15567,13 +15912,13 @@
}
void test_getDefiningLibrary() {
LibraryElement definingLibrary = createTestLibrary();
- Scope scope = new ScopeTest_TestScope(definingLibrary, null);
+ ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, null);
JUnitTestCase.assertEquals(definingLibrary, scope.definingLibrary);
}
void test_getErrorListener() {
LibraryElement definingLibrary = new LibraryElementImpl(new AnalysisContextImpl(), ASTFactory.libraryIdentifier2(["test"]));
GatheringErrorListener errorListener = new GatheringErrorListener();
- Scope scope = new ScopeTest_TestScope(definingLibrary, errorListener);
+ ScopeTest_TestScope scope = new ScopeTest_TestScope(definingLibrary, errorListener);
JUnitTestCase.assertEquals(errorListener, scope.errorListener);
}
void test_isPrivateName_nonPrivate() {
@@ -15878,7 +16223,7 @@
verify([source]);
}
void test_import_hide() {
- addSource2("lib1.dart", EngineTestCase.createSource(["library lib1;", "set foo(value) {}"]));
+ addSource2("lib1.dart", EngineTestCase.createSource(["library lib1;", "set foo(value) {}", "class A {}"]));
addSource2("lib2.dart", EngineTestCase.createSource(["library lib2;", "set foo(value) {}"]));
Source source = addSource2("lib3.dart", EngineTestCase.createSource([
"import 'lib1.dart' hide foo;",
@@ -15886,7 +16231,8 @@
"",
"main() {",
" foo = 0;",
- "}"]));
+ "}",
+ "A a;"]));
resolve(source);
assertNoErrors();
verify([source]);
@@ -15903,6 +16249,18 @@
assertNoErrors();
verify([source]);
}
+ void test_import_spaceInUri() {
+ addSource2("sub folder/lib.dart", EngineTestCase.createSource(["library lib;", "foo() {}"]));
+ Source source = addSource2("app.dart", EngineTestCase.createSource([
+ "import 'sub folder/lib.dart';",
+ "",
+ "main() {",
+ " foo();",
+ "}"]));
+ resolve(source);
+ assertNoErrors();
+ verify([source]);
+ }
void test_indexExpression_typeParameters() {
Source source = addSource(EngineTestCase.createSource([
"f() {",
@@ -16313,6 +16671,10 @@
final __test = new SimpleResolverTest();
runJUnitTest(__test, __test.test_import_prefix);
});
+ _ut.test('test_import_spaceInUri', () {
+ final __test = new SimpleResolverTest();
+ runJUnitTest(__test, __test.test_import_spaceInUri);
+ });
_ut.test('test_indexExpression_typeParameters', () {
final __test = new SimpleResolverTest();
runJUnitTest(__test, __test.test_indexExpression_typeParameters);
diff --git a/pkg/analyzer_experimental/test/generated/scanner_test.dart b/pkg/analyzer_experimental/test/generated/scanner_test.dart
index 55ee345..e3dbb64 100644
--- a/pkg/analyzer_experimental/test/generated/scanner_test.dart
+++ b/pkg/analyzer_experimental/test/generated/scanner_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.scanner_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';
@@ -2149,7 +2147,7 @@
}
Token scan(String source, GatheringErrorListener listener);
void assertComment(TokenType commentType, String source) {
- Token token = scan2(source);
+ Token token = scan2("${source}\n");
JUnitTestCase.assertNotNull(token);
JUnitTestCase.assertEquals(TokenType.EOF, token.type);
Token comment = token.precedingComments;
diff --git a/pkg/analyzer_experimental/test/services/formatter_test.dart b/pkg/analyzer_experimental/test/services/formatter_test.dart
index 41e5379..b232cd1 100644
--- a/pkg/analyzer_experimental/test/services/formatter_test.dart
+++ b/pkg/analyzer_experimental/test/services/formatter_test.dart
@@ -4,9 +4,7 @@
import 'package:unittest/unittest.dart';
-import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:analyzer_experimental/src/generated/scanner.dart';
-import 'package:analyzer_experimental/src/services/formatter.dart';
import 'package:analyzer_experimental/src/services/formatter_impl.dart';
import 'package:analyzer_experimental/src/services/writer.dart';
@@ -57,6 +55,20 @@
);
});
+ test('CU w/class decl comment', () {
+ expectCUFormatsTo(
+ 'import "foo";\n\n'
+ '//Killer class\n'
+ 'class A {\n'
+ '}',
+ 'import "foo";\n\n'
+ '//Killer class\n'
+ 'class A {\n'
+ '}\n'
+ );
+ });
+
+
test('CU (method indent)', () {
expectCUFormatsTo(
'class A {\n'
@@ -99,7 +111,7 @@
'class A {\n'
' int x() { \n'
'if (true) {return 42;\n'
- '} else { return false; }\n'
+ '} else { return 13; }\n'
' }'
'}',
'class A {\n'
@@ -107,7 +119,7 @@
' if (true) {\n'
' return 42;\n'
' } else {\n'
- ' return false;\n'
+ ' return 13;\n'
' }\n'
' }\n'
'}\n'
@@ -131,15 +143,18 @@
expectCUFormatsTo(
'class A {\n'
'}\n\n'
- 'class B {\n'
+ 'class B {\n\n\n'
+ ' int b() => 42;\n\n'
+ ' int c() => b();\n\n'
'}\n',
'class A {\n'
'}\n\n'
- 'class B {\n'
+ 'class B {\n\n\n'
+ ' int b() => 42;\n\n'
+ ' int c() => b();\n\n'
'}\n'
);
});
-
test('stmt', () {
expectStmtFormatsTo(
@@ -168,7 +183,6 @@
);
});
-
test('initialIndent', () {
var formatter = new CodeFormatter(
new FormatterOptions(initialIndentationLevel: 2));
@@ -210,6 +224,11 @@
expect(line.toString(), equals(' foo'));
});
+ test('isWhitespace', () {
+ var line = new Line(indent: 1);
+ expect(line.isWhitespace(), isTrue);
+ });
+
});
@@ -231,6 +250,12 @@
expect(writer.toString(), equals('foo\n'));
});
+ test('newline trims whitespace', () {
+ var writer = new SourceWriter(indentCount:2);
+ writer.newline();
+ expect(writer.toString(), equals('\n'));
+ });
+
test('basic print (with indents)', () {
var writer = new SourceWriter();
writer.print('foo');
diff --git a/pkg/analyzer_experimental/test/services/test_utils.dart b/pkg/analyzer_experimental/test/services/test_utils.dart
index 0f4433c..62b77159 100644
--- a/pkg/analyzer_experimental/test/services/test_utils.dart
+++ b/pkg/analyzer_experimental/test/services/test_utils.dart
@@ -4,8 +4,6 @@
library test_utils;
-import 'dart:collection';
-
import 'package:unittest/unittest.dart';
import 'package:analyzer_experimental/src/generated/engine.dart' show AnalysisContext, AnalysisContextImpl;
diff --git a/pkg/barback/lib/barback.dart b/pkg/barback/lib/barback.dart
index 539d732..d10827f 100644
--- a/pkg/barback/lib/barback.dart
+++ b/pkg/barback/lib/barback.dart
@@ -7,6 +7,7 @@
export 'src/asset.dart';
export 'src/asset_id.dart';
export 'src/barback.dart';
+export 'src/build_result.dart';
export 'src/errors.dart';
export 'src/package_provider.dart';
export 'src/transform.dart' show Transform;
diff --git a/pkg/barback/lib/src/asset_cascade.dart b/pkg/barback/lib/src/asset_cascade.dart
index 40a615c..2ffe489 100644
--- a/pkg/barback/lib/src/asset_cascade.dart
+++ b/pkg/barback/lib/src/asset_cascade.dart
@@ -7,11 +7,10 @@
import 'dart:async';
import 'dart:collection';
-import 'package:stack_trace/stack_trace.dart';
-
import 'asset.dart';
import 'asset_id.dart';
import 'asset_node.dart';
+import 'build_result.dart';
import 'cancelable_future.dart';
import 'errors.dart';
import 'change_batch.dart';
@@ -24,7 +23,7 @@
///
/// This keeps track of which [Transformer]s are applied to which assets, and
/// re-runs those transformers when their dependencies change. The transformed
-/// assets are accessible via [getAssetById].
+/// asset nodes are accessible via [getAssetNode].
///
/// A cascade consists of one or more [Phases], each of which has one or more
/// [Transformer]s that run in parallel, potentially on the same inputs. The
@@ -37,7 +36,7 @@
/// The [PackageGraph] that tracks all [AssetCascade]s for all dependencies of
/// the current app.
- final PackageGraph _graph;
+ final PackageGraph graph;
/// The controllers for the [AssetNode]s that provide information about this
/// cascade's package's source assets.
@@ -89,7 +88,7 @@
/// It loads source assets within [package] using [provider] and then uses
/// [transformerPhases] to generate output files from them.
//TODO(rnystrom): Better way of specifying transformers and their ordering.
- AssetCascade(this._graph, this.package,
+ AssetCascade(this.graph, this.package,
Iterable<Iterable<Transformer>> transformerPhases) {
// Flatten the phases to a list so we can traverse backwards to wire up
// each phase to its next.
@@ -103,16 +102,20 @@
for (var transformers in phases.reversed) {
nextPhase = new Phase(this, _phases.length, transformers.toList(),
nextPhase);
+ nextPhase.onDirty.listen((_) {
+ _newChanges = true;
+ _waitForProcess();
+ });
_phases.insert(0, nextPhase);
}
}
/// Gets the asset identified by [id].
///
- /// If [id] is for a generated or transformed asset, this will wait until
- /// it has been created and return it. If the asset cannot be found, throws
- /// [AssetNotFoundException].
- Future<Asset> getAssetById(AssetId id) {
+ /// If [id] is for a generated or transformed asset, this will wait until it
+ /// has been created and return it. If the asset cannot be found, returns
+ /// null.
+ Future<AssetNode> getAssetNode(AssetId id) {
assert(id.package == package);
// TODO(rnystrom): Waiting for the entire build to complete is unnecessary
@@ -127,17 +130,17 @@
var node = _getAssetNode(id);
// If the requested asset is available, we can just return it.
- if (node != null) return node.asset;
+ if (node != null) return node;
// If there's a build running, that build might generate the asset, so we
// wait for it to complete and then try again.
if (_processDone != null) {
- return _processDone.then((_) => getAssetById(id));
+ return _processDone.then((_) => getAssetNode(id));
}
// If the asset hasn't been built and nothing is building now, the asset
- // won't be generated, so we throw an error.
- throw new AssetNotFoundException(id);
+ // won't be generated, so we return null.
+ return null;
});
}
@@ -165,8 +168,6 @@
/// given source is already known, it is considered modified and all
/// transforms that use it will be re-applied.
void updateSources(Iterable<AssetId> sources) {
- _newChanges = true;
-
for (var id in sources) {
var controller = _sourceControllerMap[id];
if (controller != null) {
@@ -181,7 +182,7 @@
if (_loadingSources.containsKey(id)) _loadingSources[id].cancel();
_loadingSources[id] =
- new CancelableFuture<Asset>(_graph.provider.getAsset(id));
+ new CancelableFuture<Asset>(graph.provider.getAsset(id));
_loadingSources[id].whenComplete(() {
_loadingSources.remove(id);
}).then((asset) {
@@ -193,14 +194,10 @@
_sourceControllerMap.remove(id).setRemoved();
});
}
-
- _waitForProcess();
}
/// Removes [removed] from the graph's known set of source assets.
void removeSources(Iterable<AssetId> removed) {
- _newChanges = true;
-
removed.forEach((id) {
// If the source was being loaded, cancel that load.
if (_loadingSources.containsKey(id)) _loadingSources.remove(id).cancel();
@@ -209,8 +206,6 @@
// Don't choke if an id is double-removed for some reason.
if (controller != null) controller.setRemoved();
});
-
- _waitForProcess();
}
void reportError(error) {
@@ -276,43 +271,3 @@
});
}
}
-
-/// An event indicating that the cascade has finished building all assets.
-///
-/// A build can end either in success or failure. If there were no errors during
-/// the build, it's considered to be a success; any errors render it a failure,
-/// although individual assets may still have built successfully.
-class BuildResult {
- /// All errors that occurred during the build.
- final List errors;
-
- /// `true` if the build succeeded.
- bool get succeeded => errors.isEmpty;
-
- BuildResult(Iterable errors)
- : errors = errors.toList();
-
- /// Creates a build result indicating a successful build.
- ///
- /// This equivalent to a build result with no errors.
- BuildResult.success()
- : this([]);
-
- String toString() {
- if (succeeded) return "success";
-
- return "errors:\n" + errors.map((error) {
- var stackTrace = getAttachedStackTrace(error);
- if (stackTrace != null) stackTrace = new Trace.from(stackTrace);
-
- var msg = new StringBuffer();
- msg.write(prefixLines(error.toString()));
- if (stackTrace != null) {
- msg.write("\n\n");
- msg.write("Stack trace:\n");
- msg.write(prefixLines(stackTrace.toString()));
- }
- return msg.toString();
- }).join("\n\n");
- }
-}
diff --git a/pkg/barback/lib/src/barback.dart b/pkg/barback/lib/src/barback.dart
index 2797c1a..27c4d47 100644
--- a/pkg/barback/lib/src/barback.dart
+++ b/pkg/barback/lib/src/barback.dart
@@ -8,7 +8,8 @@
import 'asset.dart';
import 'asset_id.dart';
-import 'asset_cascade.dart';
+import 'build_result.dart';
+import 'errors.dart';
import 'package_graph.dart';
import 'package_provider.dart';
@@ -69,7 +70,12 @@
/// If [id] is for a generated or transformed asset, this will wait until
/// it has been created and return it. If the asset cannot be found, throws
/// [AssetNotFoundException].
- Future<Asset> getAssetById(AssetId id) => _graph.getAssetById(id);
+ Future<Asset> getAssetById(AssetId id) {
+ return _graph.getAssetNode(id).then((node) {
+ if (node == null) throw new AssetNotFoundException(id);
+ return node.whenAvailable;
+ });
+ }
/// Adds [sources] to the graph's known set of source assets.
///
diff --git a/pkg/barback/lib/src/build_result.dart b/pkg/barback/lib/src/build_result.dart
new file mode 100644
index 0000000..32ee7c7
--- /dev/null
+++ b/pkg/barback/lib/src/build_result.dart
@@ -0,0 +1,51 @@
+// 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 barback.build_result;
+
+import 'dart:async';
+
+import 'package:stack_trace/stack_trace.dart';
+
+import 'utils.dart';
+
+/// An event indicating that the cascade has finished building all assets.
+///
+/// A build can end either in success or failure. If there were no errors during
+/// the build, it's considered to be a success; any errors render it a failure,
+/// although individual assets may still have built successfully.
+class BuildResult {
+ /// All errors that occurred during the build.
+ final List errors;
+
+ /// `true` if the build succeeded.
+ bool get succeeded => errors.isEmpty;
+
+ BuildResult(Iterable errors)
+ : errors = errors.toList();
+
+ /// Creates a build result indicating a successful build.
+ ///
+ /// This equivalent to a build result with no errors.
+ BuildResult.success()
+ : this([]);
+
+ String toString() {
+ if (succeeded) return "success";
+
+ return "errors:\n" + errors.map((error) {
+ var stackTrace = getAttachedStackTrace(error);
+ if (stackTrace != null) stackTrace = new Trace.from(stackTrace);
+
+ var msg = new StringBuffer();
+ msg.write(prefixLines(error.toString()));
+ if (stackTrace != null) {
+ msg.write("\n\n");
+ msg.write("Stack trace:\n");
+ msg.write(prefixLines(stackTrace.toString()));
+ }
+ return msg.toString();
+ }).join("\n\n");
+ }
+}
diff --git a/pkg/barback/lib/src/package_graph.dart b/pkg/barback/lib/src/package_graph.dart
index 4dc2719..c85fdd7 100644
--- a/pkg/barback/lib/src/package_graph.dart
+++ b/pkg/barback/lib/src/package_graph.dart
@@ -11,6 +11,8 @@
import 'asset.dart';
import 'asset_cascade.dart';
import 'asset_id.dart';
+import 'asset_node.dart';
+import 'build_result.dart';
import 'errors.dart';
import 'package_provider.dart';
import 'utils.dart';
@@ -80,17 +82,15 @@
_errors = mergeStreams(_cascades.values.map((cascade) => cascade.errors));
}
- /// Gets the asset identified by [id].
+ /// Gets the asset node identified by [id].
///
- /// If [id] is for a generated or transformed asset, this will wait until
- /// it has been created and return it. If the asset cannot be found, throws
- /// [AssetNotFoundException].
- Future<Asset> getAssetById(AssetId id) {
+ /// If [id] is for a generated or transformed asset, this will wait until it
+ /// has been created and return it. If the asset cannot be found, returns
+ /// null.
+ Future<AssetNode> getAssetNode(AssetId id) {
var cascade = _cascades[id.package];
- if (cascade != null) return cascade.getAssetById(id);
- return new Future.error(
- new AssetNotFoundException(id),
- new Trace.current().vmTrace);
+ if (cascade != null) return cascade.getAssetNode(id);
+ return new Future.value(null);
}
/// Adds [sources] to the graph's known set of source assets.
diff --git a/pkg/barback/lib/src/phase.dart b/pkg/barback/lib/src/phase.dart
index 4d2afb4..82ec521 100644
--- a/pkg/barback/lib/src/phase.dart
+++ b/pkg/barback/lib/src/phase.dart
@@ -12,6 +12,7 @@
import 'asset_node.dart';
import 'asset_set.dart';
import 'errors.dart';
+import 'stream_pool.dart';
import 'transform_node.dart';
import 'transformer.dart';
import 'utils.dart';
@@ -44,7 +45,7 @@
///
/// For the first phase, these will be the source assets. For all other
/// phases, they will be the outputs from the previous phase.
- final inputs = new Map<AssetId, AssetNode>();
+ final _inputs = new Map<AssetId, AssetNode>();
/// The transforms currently applicable to assets in [inputs], indexed by
/// the ids of their primary inputs.
@@ -73,12 +74,31 @@
/// output.
final _outputs = new Set<AssetId>();
+ /// A stream that emits an event whenever this phase becomes dirty and needs
+ /// to be run.
+ ///
+ /// This may emit events when the phase was already dirty or while processing
+ /// transforms. Events are emitted synchronously to ensure that the dirty
+ /// state is thoroughly propagated as soon as any assets are changed.
+ Stream get onDirty => _onDirtyPool.stream;
+ final _onDirtyPool = new StreamPool.broadcast();
+
+ /// A controller whose stream feeds into [_onDirtyPool].
+ ///
+ /// This is used whenever an input is added, changed, or removed. It's
+ /// sometimes redundant with the events collected from [_transforms], but this
+ /// stream is necessary for new and removed inputs, and the transform stream
+ /// is necessary for modified secondary inputs.
+ final _onDirtyController = new StreamController.broadcast(sync: true);
+
/// The phase after this one.
///
/// Outputs from this phase will be passed to it.
final Phase _next;
- Phase(this.cascade, this._index, this._transformers, this._next);
+ Phase(this.cascade, this._index, this._transformers, this._next) {
+ _onDirtyPool.add(_onDirtyController.stream);
+ }
/// Adds a new asset as an input for this phase.
///
@@ -96,8 +116,8 @@
// have to wait on [_adjustTransformers]. It's important that [inputs] is
// always up-to-date so that the [AssetCascade] can look there for available
// assets.
- inputs[node.id] = node;
- node.whenRemoved.then((_) => inputs.remove(node.id));
+ _inputs[node.id] = node;
+ node.whenRemoved.then((_) => _inputs.remove(node.id));
if (!_adjustTransformersFutures.containsKey(node.id)) {
_transforms[node.id] = new Set<TransformNode>();
@@ -146,7 +166,7 @@
/// returned instead. This means that the return value is guaranteed to always
/// be [AssetState.AVAILABLE].
AssetNode getUnconsumedInput(AssetId id) {
- if (!inputs.containsKey(id)) return null;
+ if (!_inputs.containsKey(id)) return null;
// If the asset has transforms, it's not unconsumed.
if (!_transforms[id].isEmpty) return null;
@@ -157,8 +177,20 @@
// The asset should be available. If it were removed, it wouldn't be in
// _inputs, and if it were dirty, it'd be in _adjustTransformersFutures.
- assert(inputs[id].state.isAvailable);
- return inputs[id];
+ assert(_inputs[id].state.isAvailable);
+ return _inputs[id];
+ }
+
+ /// Gets the asset node for an input [id].
+ ///
+ /// If an input with that ID cannot be found, returns null.
+ Future<AssetNode> getInput(AssetId id) {
+ return newFuture(() {
+ // TODO(rnystrom): Need to handle passthrough where an asset from a
+ // previous phase can be found.
+ if (id.package == cascade.package) return _inputs[id];
+ return cascade.graph.getAssetNode(id);
+ });
}
/// Asynchronously determines which transformers can consume [node] as a
@@ -168,6 +200,11 @@
/// time it takes to adjust its transformers, they're appropriately
/// re-adjusted. Its progress can be tracked in [_adjustTransformersFutures].
void _adjustTransformers(AssetNode node) {
+ // Mark the phase as dirty. This may not actually end up creating any new
+ // transforms, but we want adding or removing a source asset to consistently
+ // kick off a build, even if that build does nothing.
+ _onDirtyController.add(null);
+
// Once the input is available, hook up transformers for it. If it changes
// while that's happening, try again.
_adjustTransformersFutures[node.id] = node.tryUntilStable((asset) {
@@ -182,6 +219,7 @@
// future.
node.onStateChange.first.then((state) {
if (state.isRemoved) {
+ _onDirtyController.add(null);
_transforms.remove(node.id);
} else {
_adjustTransformers(node);
@@ -214,6 +252,7 @@
return transform.transformer.isPrimary(asset).then((isPrimary) {
if (isPrimary) return;
_transforms[asset.id].remove(transform);
+ _onDirtyPool.remove(transform.onDirty);
transform.remove();
});
}));
@@ -240,7 +279,9 @@
// results.
return transformer.isPrimary(node.asset).then((isPrimary) {
if (!isPrimary) return;
- _transforms[node.id].add(new TransformNode(this, transformer, node));
+ var transform = new TransformNode(this, transformer, node);
+ _transforms[node.id].add(transform);
+ _onDirtyPool.add(transform.onDirty);
});
}));
}
diff --git a/pkg/barback/lib/src/stream_pool.dart b/pkg/barback/lib/src/stream_pool.dart
new file mode 100644
index 0000000..da5c715
--- /dev/null
+++ b/pkg/barback/lib/src/stream_pool.dart
@@ -0,0 +1,66 @@
+// 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 barback.stream_pool;
+
+import 'dart:async';
+
+/// A pool of streams whose events are unified and emitted through a central
+/// stream.
+class StreamPool<T> {
+ /// The stream through which all events from streams in the pool are emitted.
+ Stream<T> get stream => _controller.stream;
+ final StreamController<T> _controller;
+
+ /// Subscriptions to the streams that make up the pool.
+ final _subscriptions = new Map<Stream<T>, StreamSubscription<T>>();
+
+ /// Creates a new stream pool that only supports a single subscriber.
+ ///
+ /// Any events from broadcast streams in the pool will be buffered until a
+ /// listener is subscribed.
+ StreamPool()
+ // Create the controller as sync so that any sync input streams will be
+ // forwarded synchronously. Async input streams will have their asynchrony
+ // preserved, since _controller.add will be called asynchronously.
+ : _controller = new StreamController<T>(sync: true);
+
+ /// Creates a new stream pool where [stream] can be listened to more than
+ /// once.
+ ///
+ /// Any events from buffered streams in the pool will be emitted immediately,
+ /// regardless of whether [stream] has any subscribers.
+ StreamPool.broadcast()
+ // Create the controller as sync so that any sync input streams will be
+ // forwarded synchronously. Async input streams will have their asynchrony
+ // preserved, since _controller.add will be called asynchronously.
+ : _controller = new StreamController<T>.broadcast(sync: true);
+
+ /// Adds [stream] as a member of this pool.
+ ///
+ /// Any events from [stream] will be emitted through [this.stream]. If
+ /// [stream] is sync, they'll be emitted synchronously; if [stream] is async,
+ /// they'll be emitted asynchronously.
+ void add(Stream<T> stream) {
+ if (_subscriptions.containsKey(stream)) return;
+ _subscriptions[stream] = stream.listen(_controller.add,
+ onError: _controller.addError,
+ onDone: () => remove(stream));
+ }
+
+ /// Removes [stream] as a member of this pool.
+ void remove(Stream<T> stream) {
+ var subscription = _subscriptions.remove(stream);
+ if (subscription != null) subscription.cancel();
+ }
+
+ /// Removes all streams from this pool and closes [stream].
+ void close() {
+ for (var subscription in _subscriptions.values) {
+ subscription.cancel();
+ }
+ _subscriptions.clear();
+ _controller.close();
+ }
+}
diff --git a/pkg/barback/lib/src/transform.dart b/pkg/barback/lib/src/transform.dart
index 77800db..d61e15c 100644
--- a/pkg/barback/lib/src/transform.dart
+++ b/pkg/barback/lib/src/transform.dart
@@ -50,7 +50,7 @@
Transform._(this._node, this._outputs);
- /// Gets the asset for for an input [id].
+ /// Gets the asset for an input [id].
///
/// If an input with that ID cannot be found, throws an
/// [AssetNotFoundException].
diff --git a/pkg/barback/lib/src/transform_node.dart b/pkg/barback/lib/src/transform_node.dart
index 863bac5..a7241ae 100644
--- a/pkg/barback/lib/src/transform_node.dart
+++ b/pkg/barback/lib/src/transform_node.dart
@@ -45,6 +45,15 @@
/// The controllers for the asset nodes emitted by this node.
var _outputControllers = new Map<AssetId, AssetNodeController>();
+ /// A stream that emits an event whenever this transform becomes dirty and
+ /// needs to be re-run.
+ ///
+ /// This may emit events when the transform was already dirty or while
+ /// processing transforms. Events are emitted synchronously to ensure that the
+ /// dirty state is thoroughly propagated as soon as any assets are changed.
+ Stream get onDirty => _onDirtyController.stream;
+ final _onDirtyController = new StreamController.broadcast(sync: true);
+
TransformNode(this.phase, this.transformer, this.primary) {
_primarySubscription = primary.onStateChange.listen((state) {
if (state.isRemoved) {
@@ -63,6 +72,7 @@
/// valid even if its primary input still exists.
void remove() {
_isDirty = true;
+ _onDirtyController.close();
_primarySubscription.cancel();
for (var subscription in _inputSubscriptions.values) {
subscription.cancel();
@@ -80,6 +90,7 @@
for (var controller in _outputControllers.values) {
controller.setDirty();
}
+ _onDirtyController.add(null);
}
/// Applies this transform.
@@ -116,12 +127,12 @@
});
}
+ /// Gets the asset for an input [id].
+ ///
+ /// If an input with that ID cannot be found, throws an
+ /// [AssetNotFoundException].
Future<Asset> getInput(AssetId id) {
- return newFuture(() {
- var node = phase.inputs[id];
- // TODO(rnystrom): Need to handle passthrough where an asset from a
- // previous phase can be found.
-
+ return phase.getInput(id).then((node) {
// Throw if the input isn't found. This ensures the transformer's apply
// is exited. We'll then catch this and report it through the proper
// results stream.
diff --git a/pkg/barback/test/package_graph/transform_test.dart b/pkg/barback/test/package_graph/transform_test.dart
index 670848a..c413528 100644
--- a/pkg/barback/test/package_graph/transform_test.dart
+++ b/pkg/barback/test/package_graph/transform_test.dart
@@ -894,4 +894,123 @@
resumeProvider();
buildShouldSucceed();
});
+
+ group('cross-package transforms', () {
+ test("can access other packages' source assets", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "a"
+ }, {"pkg1": [[new ManyToOneTransformer("txt")]]});
+
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|a.out", "a");
+ buildShouldSucceed();
+ });
+
+ test("can access other packages' transformed assets", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.txt": "a"
+ }, {
+ "pkg1": [[new ManyToOneTransformer("txt")]],
+ "pkg2": [[new RewriteTransformer("txt", "inc")]]
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.txt"]);
+ expectAsset("pkg1|a.out", "a.inc");
+ buildShouldSucceed();
+ });
+
+ test("re-runs a transform when an input from another package changes", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "a"
+ }, {
+ "pkg1": [[new ManyToOneTransformer("txt")]]
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|a.out", "a");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.inc", "new a");
+ schedule(() => updateSources(["pkg2|a.inc"]));
+ expectAsset("pkg1|a.out", "new a");
+ buildShouldSucceed();
+ });
+
+ test("re-runs a transform when a transformed input from another package "
+ "changes", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.txt": "a"
+ }, {
+ "pkg1": [[new ManyToOneTransformer("txt")]],
+ "pkg2": [[new RewriteTransformer("txt", "inc")]]
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.txt"]);
+ expectAsset("pkg1|a.out", "a.inc");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.txt", "new a");
+ schedule(() => updateSources(["pkg2|a.txt"]));
+ expectAsset("pkg1|a.out", "new a.inc");
+ buildShouldSucceed();
+ });
+
+ test("runs a transform that's added because of a change in another package",
+ () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "b"
+ }, {
+ "pkg1": [
+ [new ManyToOneTransformer("txt")],
+ [new OneToManyTransformer("out")],
+ [new RewriteTransformer("md", "done")]
+ ],
+ });
+
+ // pkg1|a.txt generates outputs based on the contents of pkg2|a.inc. At
+ // first pkg2|a.inc only includes "b", which is not transformed. Then
+ // pkg2|a.inc is updated to include "b,c.md". pkg1|c.md triggers the
+ // md->done rewrite transformer, producing pkg1|c.done.
+
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|b", "spread out");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.inc", "b,c.md");
+ schedule(() => updateSources(["pkg2|a.inc"]));
+ expectAsset("pkg1|b", "spread out");
+ expectAsset("pkg1|c.done", "spread out.done");
+ buildShouldSucceed();
+ });
+
+ test("doesn't run a transform that's removed because of a change in "
+ "another package", () {
+ initGraph({
+ "pkg1|a.txt": "pkg2|a.inc",
+ "pkg2|a.inc": "b,c.md"
+ }, {
+ "pkg1": [
+ [new ManyToOneTransformer("txt")],
+ [new OneToManyTransformer("out")],
+ [new RewriteTransformer("md", "done")]
+ ],
+ });
+
+ updateSources(["pkg1|a.txt", "pkg2|a.inc"]);
+ expectAsset("pkg1|b", "spread out");
+ expectAsset("pkg1|c.done", "spread out.done");
+ buildShouldSucceed();
+
+ modifyAsset("pkg2|a.inc", "b");
+ schedule(() => updateSources(["pkg2|a.inc"]));
+ expectAsset("pkg1|b", "spread out");
+ expectNoAsset("pkg1|c.done");
+ buildShouldSucceed();
+ });
+ });
}
diff --git a/pkg/barback/test/stream_pool_test.dart b/pkg/barback/test/stream_pool_test.dart
new file mode 100644
index 0000000..d701329
--- /dev/null
+++ b/pkg/barback/test/stream_pool_test.dart
@@ -0,0 +1,216 @@
+// 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 barback.test.stream_pool_test;
+
+import 'dart:async';
+
+import 'package:barback/src/stream_pool.dart';
+import 'package:barback/src/utils.dart';
+import 'package:scheduled_test/scheduled_test.dart';
+
+import 'utils.dart';
+
+main() {
+ initConfig();
+
+ group("buffered", () {
+ test("buffers events from multiple inputs", () {
+ var pool = new StreamPool<String>();
+
+ var controller1 = new StreamController<String>();
+ pool.add(controller1.stream);
+ controller1.add("first");
+
+ var controller2 = new StreamController<String>();
+ pool.add(controller2.stream);
+ controller2.add("second");
+
+ // Call [toList] asynchronously to be sure that the events have been
+ // buffered beforehand and aren't just being received unbuffered.
+ expect(newFuture(() => pool.stream.toList()),
+ completion(equals(["first", "second"])));
+
+ pumpEventQueue().then((_) => pool.close());
+ });
+
+ test("buffers errors from multiple inputs", () {
+ var pool = new StreamPool<String>();
+
+ var controller1 = new StreamController<String>();
+ pool.add(controller1.stream);
+ controller1.add("first");
+
+ var controller2 = new StreamController<String>();
+ pool.add(controller2.stream);
+ controller2.add("second");
+ controller1.addError("third");
+ controller2.addError("fourth");
+ controller1.add("fifth");
+
+ expect(newFuture(() {
+ return pool.stream.transform(new StreamTransformer(
+ handleData: (data, sink) => sink.add(["data", data]),
+ handleError: (error, sink) => sink.add(["error", error]))).toList();
+ }), completion(equals([
+ ["data", "first"],
+ ["data", "second"],
+ ["error", "third"],
+ ["error", "fourth"],
+ ["data", "fifth"]
+ ])));
+
+ pumpEventQueue().then((_) => pool.close());
+ });
+
+ test("buffers inputs from a broadcast stream", () {
+ var pool = new StreamPool<String>();
+ var controller = new StreamController<String>.broadcast();
+ pool.add(controller.stream);
+ controller.add("first");
+ controller.add("second");
+
+ // Call [toList] asynchronously to be sure that the events have been
+ // buffered beforehand and aren't just being received unbuffered.
+ expect(newFuture(() => pool.stream.toList()),
+ completion(equals(["first", "second"])));
+
+ pumpEventQueue().then((_) => pool.close());
+ });
+ });
+
+ group("broadcast", () {
+ test("doesn't buffer inputs", () {
+ var pool = new StreamPool<String>.broadcast();
+
+ var controller1 = new StreamController<String>.broadcast();
+ pool.add(controller1.stream);
+ controller1.add("first");
+
+ var controller2 = new StreamController<String>.broadcast();
+ pool.add(controller2.stream);
+ controller2.add("second");
+
+ // Call [toList] asynchronously to be sure that the events have been
+ // buffered beforehand and aren't just being received unbuffered.
+ expect(newFuture(() => pool.stream.toList()), completion(isEmpty));
+
+ pumpEventQueue().then((_) => pool.close());
+ });
+
+ test("doesn't buffer errors", () {
+ var pool = new StreamPool<String>.broadcast();
+
+ var controller1 = new StreamController<String>.broadcast();
+ pool.add(controller1.stream);
+ controller1.addError("first");
+
+ var controller2 = new StreamController<String>.broadcast();
+ pool.add(controller2.stream);
+ controller2.addError("second");
+
+ expect(newFuture(() {
+ return pool.stream.transform(new StreamTransformer(
+ handleData: (data, sink) => sink.add(data),
+ handleError: (error, sink) => sink.add(error))).toList();
+ }), completion(isEmpty));
+
+ pumpEventQueue().then((_) => pool.close());
+ });
+
+ test("doesn't buffer inputs from a buffered stream", () {
+ var pool = new StreamPool<String>.broadcast();
+ var controller = new StreamController<String>();
+ pool.add(controller.stream);
+ controller.add("first");
+ controller.add("second");
+
+ expect(pumpEventQueue().then((_) => pool.stream.toList()),
+ completion(isEmpty));
+
+ pumpEventQueue().then((_) => pool.close());
+ });
+ });
+
+ for (var type in ["buffered", "broadcast"]) {
+ group(type, () {
+ var pool;
+ var bufferedController;
+ var bufferedStream;
+ var bufferedSyncController;
+ var broadcastController;
+ var broadcastStream;
+ var broadcastSyncController;
+
+ setUp(() {
+ if (type == "buffered") {
+ pool = new StreamPool<String>();
+ } else {
+ pool = new StreamPool<String>.broadcast();
+ }
+
+ bufferedController = new StreamController<String>();
+ pool.add(bufferedController.stream);
+
+ bufferedSyncController = new StreamController<String>(sync: true);
+ pool.add(bufferedSyncController.stream);
+
+ broadcastController = new StreamController<String>.broadcast();
+ pool.add(broadcastController.stream);
+
+ broadcastSyncController =
+ new StreamController<String>.broadcast(sync: true);
+ pool.add(broadcastSyncController.stream);
+ });
+
+ test("emits events to a listener", () {
+ expect(pool.stream.toList(), completion(equals(["first", "second"])));
+
+ bufferedController.add("first");
+ broadcastController.add("second");
+ pumpEventQueue().then((_) => pool.close());
+ });
+
+ test("emits sync events synchronously", () {
+ var events = [];
+ pool.stream.listen(events.add);
+
+ bufferedSyncController.add("first");
+ expect(events, equals(["first"]));
+
+ broadcastSyncController.add("second");
+ expect(events, equals(["first", "second"]));
+ });
+
+ test("emits async events asynchronously", () {
+ var events = [];
+ pool.stream.listen(events.add);
+
+ bufferedController.add("first");
+ broadcastController.add("second");
+ expect(events, isEmpty);
+
+ expect(pumpEventQueue().then((_) => events),
+ completion(equals(["first", "second"])));
+ });
+
+ test("doesn't emit events from removed streams", () {
+ expect(pool.stream.toList(), completion(equals(["first", "third"])));
+
+ bufferedController.add("first");
+ expect(pumpEventQueue().then((_) {
+ pool.remove(bufferedController.stream);
+ bufferedController.add("second");
+ }).then((_) {
+ broadcastController.add("third");
+ return pumpEventQueue();
+ }).then((_) {
+ pool.remove(broadcastController.stream);
+ broadcastController.add("fourth");
+ pool.close();
+ }), completes);
+ });
+ });
+ }
+}
diff --git a/pkg/barback/test/transformer/many_to_one.dart b/pkg/barback/test/transformer/many_to_one.dart
index efaf3c47..45f8f25 100644
--- a/pkg/barback/test/transformer/many_to_one.dart
+++ b/pkg/barback/test/transformer/many_to_one.dart
@@ -33,7 +33,12 @@
.then((contents) {
// Get all of the included inputs.
return Future.wait(contents.split(",").map((path) {
- var id = new AssetId(transform.primaryId.package, path);
+ var id;
+ if (path.contains("|")) {
+ id = new AssetId.parse(path);
+ } else {
+ id = new AssetId(transform.primaryId.package, path);
+ }
return getInput(transform, id).then((input) => input.readAsString());
}));
}).then((outputs) {
diff --git a/pkg/barback/test/utils.dart b/pkg/barback/test/utils.dart
index ab41a59..57d9c43 100644
--- a/pkg/barback/test/utils.dart
+++ b/pkg/barback/test/utils.dart
@@ -9,10 +9,8 @@
import 'dart:io';
import 'package:barback/barback.dart';
-import 'package:barback/src/asset_cascade.dart';
import 'package:barback/src/asset_set.dart';
import 'package:barback/src/cancelable_future.dart';
-import 'package:barback/src/package_graph.dart';
import 'package:barback/src/utils.dart';
import 'package:path/path.dart' as pathos;
import 'package:scheduled_test/scheduled_test.dart';
@@ -30,11 +28,11 @@
var _configured = false;
MockProvider _provider;
-PackageGraph _graph;
+Barback _barback;
/// Calls to [buildShouldSucceed] and [buildShouldFail] set expectations on
-/// successive [BuildResult]s from [_graph]. This keeps track of how many calls
-/// have already been made so later calls know which result to look for.
+/// successive [BuildResult]s from [_barback]. This keeps track of how many
+/// calls have already been made so later calls know which result to look for.
int _nextBuildResult;
void initConfig() {
@@ -64,7 +62,7 @@
if (transformers == null) transformers = {};
_provider = new MockProvider(assets, transformers);
- _graph = new PackageGraph(_provider);
+ _barback = new Barback(_provider);
_nextBuildResult = 0;
}
@@ -79,7 +77,7 @@
return asset;
});
- _graph.updateSources(assets);
+ _barback.updateSources(assets);
}
/// Removes [assets] from the current [PackageProvider].
@@ -93,7 +91,7 @@
return asset;
});
- _graph.removeSources(assets);
+ _barback.removeSources(assets);
}
/// Schedules a change to the contents of an asset identified by [name] to
@@ -138,7 +136,7 @@
/// after this.
void buildShouldNotBeDone() {
_futureShouldNotCompleteUntil(
- _graph.results.elementAt(_nextBuildResult),
+ _barback.results.elementAt(_nextBuildResult),
schedule(() => pumpEventQueue(), "build should not terminate"),
"build");
}
@@ -167,14 +165,14 @@
}
Future<BuildResult> _getNextBuildResult() =>
- _graph.results.elementAt(_nextBuildResult++);
+ _barback.results.elementAt(_nextBuildResult++);
/// Pauses the schedule until the currently running build completes.
///
/// Validates that the build completed successfully.
void waitForBuild() {
schedule(() {
- return _graph.results.first.then((result) {
+ return _barback.results.first.then((result) {
expect(result.succeeded, isTrue);
});
}, "wait for build");
@@ -193,7 +191,7 @@
}
schedule(() {
- return _graph.getAssetById(id).then((asset) {
+ return _barback.getAssetById(id).then((asset) {
// TODO(rnystrom): Make an actual Matcher class for this.
expect(asset.id, equals(id));
expect(asset.readAsString(), completion(equals(contents)));
@@ -208,7 +206,7 @@
// Make sure the future gets the error.
schedule(() {
- return _graph.getAssetById(id).then((asset) {
+ return _barback.getAssetById(id).then((asset) {
fail("Should have thrown error but got $asset.");
}).catchError((error) {
expect(error, new isInstanceOf<AssetNotFoundException>());
@@ -224,7 +222,7 @@
schedule(() {
return _futureShouldNotCompleteUntil(
- _graph.getAssetById(id),
+ _barback.getAssetById(id),
pumpEventQueue(),
"asset $id");
}, "asset $id should not complete");
diff --git a/pkg/custom_element/lib/custom_element.dart b/pkg/custom_element/lib/custom_element.dart
index 50cc1a6..aa540e5 100644
--- a/pkg/custom_element/lib/custom_element.dart
+++ b/pkg/custom_element/lib/custom_element.dart
@@ -591,6 +591,8 @@
Stream<KeyboardEvent> get onKeyUp => host.onKeyUp;
Stream<Event> get onLoad => host.onLoad;
Stream<MouseEvent> get onMouseDown => host.onMouseDown;
+ Stream<MouseEvent> get onMouseEnter => host.onMouseEnter;
+ Stream<MouseEvent> get onMouseLeave => host.onMouseLeave;
Stream<MouseEvent> get onMouseMove => host.onMouseMove;
Stream<Event> get onFullscreenChange => host.onFullscreenChange;
Stream<Event> get onFullscreenError => host.onFullscreenError;
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index 8a182b0..b960db7 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -30,7 +30,6 @@
import '../../../sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart'
as dart2js;
import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors_util.dart';
import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart';
import '../../../sdk/lib/_internal/libraries.dart';
@@ -47,14 +46,18 @@
/// Current member being documented to be used for comment links.
MemberMirror _currentMember;
+/// Support for [:foo:]-style code comments to the markdown parser.
+List<markdown.InlineSyntax> markdownSyntaxes =
+ [new markdown.CodeSyntax(r'\[:\s?((?:.|\n)*?)\s?:\]')];
+
/// Resolves reference links in doc comments.
markdown.Resolver linkResolver;
-/// Index of all indexable items. This also ensures that no class is
-/// created more than once.
+/// Index of all indexable items. This also ensures that no class is
+/// created more than once.
Map<String, Indexable> entityMap = new Map<String, Indexable>();
-/// This is set from the command line arguments flag --include-private
+/// This is set from the command line arguments flag --include-private
bool _includePrivate = false;
/**
@@ -77,7 +80,7 @@
var dir = new Directory('docs');
if (dir.existsSync()) dir.deleteSync(recursive: true);
}
-
+
if (packageRoot == null && !parseSdk) {
var type = FileSystemEntity.typeSync(files.first);
if (type == FileSystemEntityType.DIRECTORY) {
@@ -97,8 +100,8 @@
if (mirrorSystem.libraries.isEmpty) {
throw new StateError('No library mirrors were created.');
}
- _documentLibraries(mirrorSystem.libraries.values,
- includeSdk: includeSdk, outputToYaml: outputToYaml, append: append);
+ _documentLibraries(mirrorSystem.libraries.values,includeSdk: includeSdk,
+ outputToYaml: outputToYaml, append: append, parseSdk: parseSdk);
return true;
});
@@ -124,7 +127,7 @@
// containing '/packages' will be added. The only exception is if the file to
// analyze already has a '/package' in its path.
return files.where((f) => f.endsWith('.dart') &&
- (!f.contains('${path.separator}packages') ||
+ (!f.contains('${path.separator}packages') ||
args.contains('${path.separator}packages'))).toList()
..forEach((lib) => logger.info('Added to libraries: $lib'));
}
@@ -178,7 +181,7 @@
Uri libraryUri = new Uri(scheme: 'file', path: appendSlash(libraryRoot));
Uri packageUri = null;
if (packageRoot != null) {
- packageUri = new Uri(scheme: 'file', path: appendSlash(packageRoot));
+ packageUri = new Uri(scheme: 'file', path: appendSlash(packageRoot));
}
List<Uri> librariesUri = <Uri>[];
libraries.forEach((library) {
@@ -200,8 +203,8 @@
/**
* Creates documentation for filtered libraries.
*/
-void _documentLibraries(List<LibraryMirror> libs,
- {bool includeSdk: false, bool outputToYaml: true, bool append: false}) {
+void _documentLibraries(List<LibraryMirror> libs, {bool includeSdk: false,
+ bool outputToYaml: true, bool append: false, bool parseSdk: false}) {
libs.forEach((lib) {
// Files belonging to the SDK have a uri that begins with 'dart:'.
if (includeSdk || !lib.uri.toString().startsWith('dart:')) {
@@ -210,12 +213,12 @@
}
});
// After everything is created, do a pass through all classes to make sure no
- // intermediate classes created by mixins are included.
+ // intermediate classes created by mixins are included.
entityMap.values.where((e) => e is Class).forEach((c) => c.makeValid());
// Everything is a subclass of Object, therefore empty the list to avoid a
- // giant list of subclasses to be printed out.
- entityMap['dart.core.Object'].subclasses.clear();
-
+ // giant list of subclasses to be printed out.
+ if (parseSdk) entityMap['dart.core.Object'].subclasses.clear();
+
var filteredEntities = entityMap.values.where(_isVisible);
// Output libraries and classes to file after all information is generated.
filteredEntities.where((e) => e is Class || e is Library).forEach((output) {
@@ -225,11 +228,11 @@
// the libraries. This will help the viewer know what libraries are available
// to read in.
_writeToFile(filteredEntities.where((e) => e is Library)
- .map((e) => e.qualifiedName).join('\n'), 'library_list.txt',
+ .map((e) => e.qualifiedName).join('\n'), 'library_list.txt',
append: append);
// Outputs all the qualified names documented. This will help generate search
- // results.
- _writeToFile(filteredEntities.map((e) => e.qualifiedName).join('\n'),
+ // results.
+ _writeToFile(filteredEntities.map((e) => e.qualifiedName).join('\n'),
'index.txt', append: append);
}
@@ -238,7 +241,7 @@
var result = new Library(library.qualifiedName, _commentToHtml(library),
_variables(library.variables),
_methods(library.functions),
- _classes(library.classes), _isPrivate(library));
+ _classes(library.classes), _isHidden(library));
logger.fine('Generated library for ${result.name}');
return result;
}
@@ -252,13 +255,13 @@
}
/**
- * Returns true if a library name starts with an underscore, and false
+ * Returns true if a library name starts with an underscore, and false
* otherwise.
- *
+ *
* An example that starts with _ is _js_helper.
* An example that contains ._ is dart._collection.dev
*/
-// This is because LibraryMirror.isPrivate returns `false` all the time.
+// This is because LibraryMirror.isPrivate returns `false` all the time.
bool _isLibraryPrivate(LibraryMirror mirror) {
if (mirror.simpleName.startsWith('_') || mirror.simpleName.contains('._')) {
return true;
@@ -267,15 +270,16 @@
}
/**
- * A declaration is private if itself is private, or the owner is private.
+ * A declaration is private if itself is private, or the owner is private.
*/
-bool _isPrivate(DeclarationMirror mirror) {
+// Issue(12202) - A declaration is public even if it's owner is private.
+bool _isHidden(DeclarationMirror mirror) {
if (mirror is LibraryMirror) {
return _isLibraryPrivate(mirror);
} else if (mirror.owner is LibraryMirror) {
return (mirror.isPrivate || _isLibraryPrivate(mirror.owner));
- } else {
- return (mirror.isPrivate || _isPrivate(mirror.owner));
+ } else {
+ return (mirror.isPrivate || _isHidden(mirror.owner));
}
}
@@ -287,9 +291,19 @@
* Returns a list of meta annotations assocated with a mirror.
*/
List<String> _annotations(DeclarationMirror mirror) {
- var annotations = mirror.metadata.where((e) =>
+ var annotationMirrors = mirror.metadata.where((e) =>
e is dart2js.Dart2JsConstructedConstantMirror);
- return annotations.map((e) => e.type.qualifiedName).toList();
+ var annotations = [];
+ annotationMirrors.forEach((annotation) {
+ var parameterList = annotation.type.variables.values
+ .where((e) => e.isFinal)
+ .map((e) => annotation.getField(e.simpleName).reflectee)
+ .where((e) => e != null)
+ .toList();
+ annotations.add(new Annotation(annotation.type.qualifiedName,
+ parameterList));
+ });
+ return annotations;
}
/**
@@ -310,9 +324,10 @@
}
}
});
-
- commentText = commentText == null ? '' :
- markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver);
+
+ commentText = commentText == null ? '' :
+ markdown.markdownToHtml(commentText.trim(), linkResolver: linkResolver,
+ inlineSyntaxes: markdownSyntaxes);
return commentText;
}
@@ -324,11 +339,18 @@
var reference;
var memberScope = currentMember == null ?
null : currentMember.lookupInScope(name);
- if (memberScope != null) reference = memberScope.qualifiedName;
- else {
+ if (memberScope != null) {
+ reference = memberScope.qualifiedName;
+ } else {
var classScope = currentClass == null ?
null : currentClass.lookupInScope(name);
- reference = classScope != null ? classScope.qualifiedName : name;
+ if (classScope != null) {
+ reference = classScope.qualifiedName;
+ } else {
+ var libraryScope = currentLibrary == null ?
+ null : currentLibrary.lookupInScope(name);
+ reference = libraryScope != null ? libraryScope.qualifiedName : name;
+ }
}
return new markdown.Element.text('a', reference);
}
@@ -342,11 +364,11 @@
// a filter. Issue(#9590).
mirrorMap.forEach((String mirrorName, VariableMirror mirror) {
_currentMember = mirror;
- if (_includePrivate || !_isPrivate(mirror)) {
+ if (_includePrivate || !_isHidden(mirror)) {
entityMap[mirror.qualifiedName] = new Variable(mirrorName, mirror.isFinal,
mirror.isStatic, mirror.isConst, _type(mirror.type),
_commentToHtml(mirror), _annotations(mirror), mirror.qualifiedName,
- _isPrivate(mirror), mirror.owner.qualifiedName);
+ _isHidden(mirror), mirror.owner.qualifiedName);
data[mirrorName] = entityMap[mirror.qualifiedName];
}
});
@@ -359,28 +381,34 @@
MethodGroup _methods(Map<String, MethodMirror> mirrorMap) {
var group = new MethodGroup();
mirrorMap.forEach((String mirrorName, MethodMirror mirror) {
- if (_includePrivate || !_isPrivate(mirror)) {
+ if (_includePrivate || !_isHidden(mirror)) {
group.addMethod(mirror);
}
});
return group;
-}
+}
/**
- * Returns the [Class] for the given [mirror] has already been created, and if
+ * Returns the [Class] for the given [mirror] has already been created, and if
* it does not exist, creates it.
*/
Class _class(ClassMirror mirror) {
var clazz = entityMap[mirror.qualifiedName];
if (clazz == null) {
- var superclass = mirror.superclass != null ?
+ var superclass = mirror.superclass != null ?
_class(mirror.superclass) : null;
- var interfaces =
+ var interfaces =
mirror.superinterfaces.map((interface) => _class(interface));
- clazz = new Class(mirror.simpleName, superclass, _commentToHtml(mirror),
+ clazz = new Class(mirror.simpleName, superclass, _commentToHtml(mirror),
interfaces.toList(), _variables(mirror.variables),
- _methods(mirror.methods), _annotations(mirror), _generics(mirror),
- mirror.qualifiedName, _isPrivate(mirror), mirror.owner.qualifiedName);
+ _methods(mirror.methods), _annotations(mirror), _generics(mirror),
+ mirror.qualifiedName, _isHidden(mirror), mirror.owner.qualifiedName,
+ mirror.isAbstract);
+ if (superclass != null)
+ clazz.addInherited(superclass);
+ interfaces.forEach((interface) {
+ clazz.addInherited(interface);
+ });
entityMap[mirror.qualifiedName] = clazz;
}
return clazz;
@@ -391,7 +419,7 @@
*/
ClassGroup _classes(Map<String, ClassMirror> mirrorMap) {
var group = new ClassGroup();
- mirrorMap.forEach((String mirrorName, ClassMirror mirror) {
+ mirrorMap.forEach((String mirrorName, ClassMirror mirror) {
group.addClass(mirror);
});
return group;
@@ -404,33 +432,33 @@
var data = {};
mirrorList.forEach((ParameterMirror mirror) {
_currentMember = mirror;
- data[mirror.simpleName] = new Parameter(mirror.simpleName,
- mirror.isOptional, mirror.isNamed, mirror.hasDefaultValue,
- _type(mirror.type), mirror.defaultValue,
+ data[mirror.simpleName] = new Parameter(mirror.simpleName,
+ mirror.isOptional, mirror.isNamed, mirror.hasDefaultValue,
+ _type(mirror.type), mirror.defaultValue,
_annotations(mirror));
});
return data;
}
/**
- * Returns a map of [Generic] objects constructed from the class mirror.
+ * Returns a map of [Generic] objects constructed from the class mirror.
*/
Map<String, Generic> _generics(ClassMirror mirror) {
- return new Map.fromIterable(mirror.typeVariables,
- key: (e) => e.toString(),
+ return new Map.fromIterable(mirror.typeVariables,
+ key: (e) => e.toString(),
value: (e) => new Generic(e.toString(), e.upperBound.qualifiedName));
}
/**
- * Returns a single [Type] object constructed from the Method.returnType
- * Type mirror.
+ * Returns a single [Type] object constructed from the Method.returnType
+ * Type mirror.
*/
Type _type(TypeMirror mirror) {
return new Type(mirror.qualifiedName, _typeGenerics(mirror));
}
/**
- * Returns a list of [Type] objects constructed from TypeMirrors.
+ * Returns a list of [Type] objects constructed from TypeMirrors.
*/
List<Type> _typeGenerics(TypeMirror mirror) {
if (mirror is ClassMirror && !mirror.isTypedef) {
@@ -455,7 +483,7 @@
if (!file.existsSync()) {
file.createSync();
}
- file.writeAsString(text, mode: append ? FileMode.APPEND : FileMode.WRITE);
+ file.writeAsStringSync(text, mode: append ? FileMode.APPEND : FileMode.WRITE);
}
/**
@@ -473,26 +501,21 @@
return outputMap;
}
-bool isError(String qualifiedName) {
- return qualifiedName.toLowerCase().contains('error') ||
- qualifiedName.toLowerCase().contains('exception');
-}
-
/**
- * A class representing all programming constructs, like library or class.
+ * A class representing all programming constructs, like library or class.
*/
class Indexable {
String name;
String qualifiedName;
bool isPrivate;
-
+
/// Documentation comment with converted markdown.
String comment;
-
+
/// Qualified Name of the owner of this Indexable Item.
- /// For Library, owner will be "";
+ /// For Library, owner will be "";
String owner;
-
+
Indexable(this.name, this.comment, this.qualifiedName, this.isPrivate,
this.owner);
}
@@ -507,18 +530,18 @@
/// Top-level functions in the library.
MethodGroup functions;
-
+
/// Classes defined within the library
ClassGroup classes;
Library(String name, String comment, this.variables,
- this.functions, this.classes, bool isPrivate) : super(name, comment,
+ this.functions, this.classes, bool isPrivate) : super(name, comment,
name, isPrivate, "") {}
/// Generates a map describing the [Library] object.
Map toMap() => {
'name': name,
- 'qualifiedname': qualifiedName,
+ 'qualifiedName': qualifiedName,
'comment': comment,
'variables': recurseMap(variables),
'functions': functions.toMap(),
@@ -533,48 +556,49 @@
/// List of the names of interfaces that this class implements.
List<Class> interfaces = [];
-
- /// Names of classes that extends or implements this class.
+
+ /// Names of classes that extends or implements this class.
Set<String> subclasses = new Set<String>();
/// Top-level variables in the class.
Map<String, Variable> variables;
-
+
/// Inherited variables in the class.
Map<String, Variable> inheritedVariables = {};
/// Methods in the class.
MethodGroup methods;
-
+
/// Inherited methods in the class.
MethodGroup inheritedMethods = new MethodGroup();
-
- /// Generic infomation about the class.
+
+ /// Generic infomation about the class.
Map<String, Generic> generics;
-
+
Class superclass;
+ bool isAbstract;
/// List of the meta annotations on the class.
List<String> annotations;
-
- Class(String name, this.superclass, String comment, this.interfaces,
+
+ Class(String name, this.superclass, String comment, this.interfaces,
this.variables, this.methods, this.annotations, this.generics,
- String qualifiedName, bool isPrivate, String owner) : super(name, comment,
- qualifiedName, isPrivate, owner) {}
+ String qualifiedName, bool isPrivate, String owner, this.isAbstract)
+ : super(name, comment, qualifiedName, isPrivate, owner);
/**
- * Returns a list of all the parent classes.
+ * Returns a list of all the parent classes.
*/
List<Class> parent() {
var parent = superclass == null ? [] : [superclass];
parent.addAll(interfaces);
return parent;
}
-
+
/**
* Add all inherited variables and methods from the provided superclass.
- * If [_includePrivate] is true, it also adds the variables and methods from
- * the superclass.
+ * If [_includePrivate] is true, it also adds the variables and methods from
+ * the superclass.
*/
void addInherited(Class superclass) {
inheritedVariables.addAll(superclass.inheritedVariables);
@@ -583,12 +607,12 @@
}
inheritedMethods.addInherited(superclass);
}
-
+
/**
- * Add the subclass to the class.
- *
+ * Add the subclass to the class.
+ *
* If [this] is private, it will add the subclass to the list of subclasses in
- * the superclasses.
+ * the superclasses.
*/
void addSubclass(Class subclass) {
if (!_includePrivate && isPrivate) {
@@ -602,137 +626,168 @@
}
/**
+ * Check if this [Class] is an error or exception.
+ */
+ bool isError() {
+ if (qualifiedName == 'dart.core.Error' ||
+ qualifiedName == 'dart.core.Exception')
+ return true;
+ for (var interface in interfaces) {
+ if (interface.isError()) return true;
+ }
+ if (superclass == null) return false;
+ return superclass.isError();
+ }
+
+ /**
* Check that the class exists in the owner library.
- *
- * If it does not exist in the owner library, it is a mixin applciation and
- * should be removed.
+ *
+ * If it does not exist in the owner library, it is a mixin applciation and
+ * should be removed.
*/
void makeValid() {
var library = entityMap[owner];
- if (!library.classes.containsKey(name)) {
+ if (library != null && !library.classes.containsKey(name)) {
this.isPrivate = true;
- // Since we are now making the mixin a private class, make all elements
- // with the mixin as an owner private too.
+ // Since we are now making the mixin a private class, make all elements
+ // with the mixin as an owner private too.
entityMap.values.where((e) => e.owner == qualifiedName)
.forEach((element) => element.isPrivate = true);
// Move the subclass up to the next public superclass
subclasses.forEach((subclass) => addSubclass(entityMap[subclass]));
}
}
-
- /**
+
+ /**
+ * Makes sure that all methods with inherited equivalents have comments.
+ */
+ void ensureComments() {
+ inheritedMethods.forEach((qualifiedName, inheritedMethod) {
+ var method = methods[qualifiedName];
+ if (method != null) method.ensureCommentFor(inheritedMethod);
+ });
+ }
+
+ /**
* If a class extends a private superclass, find the closest public superclass
- * of the private superclass.
+ * of the private superclass.
*/
String validSuperclass() {
if (superclass == null) return 'dart.core.Object';
if (_isVisible(superclass)) return superclass.qualifiedName;
return superclass.validSuperclass();
}
-
+
/// Generates a map describing the [Class] object.
Map toMap() => {
'name': name,
- 'qualifiedname': qualifiedName,
+ 'qualifiedName': qualifiedName,
'comment': comment,
+ 'isAbstract' : isAbstract,
'superclass': validSuperclass(),
- 'implements': new List.from(interfaces.where(_isVisible)
- .map((e) => e.qualifiedName)),
- 'subclass': new List.from(subclasses),
+ 'implements': interfaces.where(_isVisible)
+ .map((e) => e.qualifiedName).toList(),
+ 'subclass': subclasses.toList(),
'variables': recurseMap(variables),
- 'inheritedvariables': recurseMap(inheritedVariables),
+ 'inheritedVariables': recurseMap(inheritedVariables),
'methods': methods.toMap(),
- 'inheritedmethods': inheritedMethods.toMap(),
- 'annotations': new List.from(annotations),
+ 'inheritedMethods': inheritedMethods.toMap(),
+ 'annotations': annotations.map((a) => a.toMap()).toList(),
'generics': recurseMap(generics)
};
}
/**
- * A container to categorize classes into the following groups: abstract
- * classes, regular classes, typedefs, and errors.
+ * A container to categorize classes into the following groups: abstract
+ * classes, regular classes, typedefs, and errors.
*/
class ClassGroup {
- Map<String, Class> abstractClasses = {};
- Map<String, Class> regularClasses = {};
+ Map<String, Class> classes = {};
Map<String, Typedef> typedefs = {};
Map<String, Class> errors = {};
-
+
void addClass(ClassMirror mirror) {
_currentClass = mirror;
var clazz = _class(mirror);
-
- // Adding inherited parent variables and methods.
+
+ // Adding inherited parent variables and methods.
clazz.parent().forEach((parent) {
if (_isVisible(clazz)) {
parent.addSubclass(clazz);
}
- clazz.addInherited(parent);
});
-
- if (isError(mirror.qualifiedName)) {
+
+ clazz.ensureComments();
+
+ if (clazz.isError()) {
errors[mirror.simpleName] = clazz;
} else if (mirror.isTypedef) {
if (_includePrivate || !mirror.isPrivate) {
- entityMap[mirror.qualifiedName] = new Typedef(mirror.simpleName,
- mirror.value.returnType.qualifiedName, _commentToHtml(mirror),
+ entityMap[mirror.qualifiedName] = new Typedef(mirror.simpleName,
+ mirror.value.returnType.qualifiedName, _commentToHtml(mirror),
_generics(mirror), _parameters(mirror.value.parameters),
- _annotations(mirror), mirror.qualifiedName, _isPrivate(mirror),
+ _annotations(mirror), mirror.qualifiedName, _isHidden(mirror),
mirror.owner.qualifiedName);
typedefs[mirror.simpleName] = entityMap[mirror.qualifiedName];
}
- } else if (mirror.isAbstract) {
- abstractClasses[mirror.simpleName] = clazz;
} else if (mirror.isClass) {
- regularClasses[mirror.simpleName] = clazz;
+ classes[mirror.simpleName] = clazz;
} else {
throw new ArgumentError('${mirror.simpleName} - no class type match. ');
}
}
-
+
/**
- * Checks if the given name is a key for any of the Class Maps.
+ * Checks if the given name is a key for any of the Class Maps.
*/
bool containsKey(String name) {
- return abstractClasses.containsKey(name) ||
- regularClasses.containsKey(name) ||
- errors.containsKey(name);
+ return classes.containsKey(name) || errors.containsKey(name);
+ }
+
+ /**
+ * Creates a [Map] with [Class] names and a preview comment.
+ */
+ Map classMap(Class clazz) {
+ var finalMap = { 'name' : clazz.qualifiedName };
+ if (clazz.comment != '') {
+ var index = clazz.comment.indexOf('</p>');
+ finalMap['preview'] = '${clazz.comment.substring(0, index)}</p>';
+ }
+ return finalMap;
}
Map toMap() => {
- 'abstract': new List.from(abstractClasses.values
- .where(_isVisible).map((e) => e.qualifiedName)),
- 'class': new List.from(regularClasses.values
- .where(_isVisible).map((e) => e.qualifiedName)),
+ 'class': classes.values.where(_isVisible)
+ .map((e) => classMap(e)).toList(),
'typedef': recurseMap(typedefs),
- 'error': new List.from(errors.values
- .where(_isVisible).map((e) => e.qualifiedName))
+ 'error': errors.values.where(_isVisible)
+ .map((e) => classMap(e)).toList()
};
}
class Typedef extends Indexable {
String returnType;
-
+
Map<String, Parameter> parameters;
-
- /// Generic information about the typedef.
+
+ /// Generic information about the typedef.
Map<String, Generic> generics;
-
- /// List of the meta annotations on the typedef.
+
+ /// List of the meta annotations on the typedef.
List<String> annotations;
-
- Typedef(String name, this.returnType, String comment, this.generics,
+
+ Typedef(String name, this.returnType, String comment, this.generics,
this.parameters, this.annotations,
- String qualifiedName, bool isPrivate, String owner) : super(name, comment,
- qualifiedName, isPrivate, owner) {}
-
+ String qualifiedName, bool isPrivate, String owner)
+ : super(name, comment, qualifiedName, isPrivate, owner);
+
Map toMap() => {
'name': name,
- 'qualifiedname': qualifiedName,
+ 'qualifiedName': qualifiedName,
'comment': comment,
'return': returnType,
'parameters': recurseMap(parameters),
- 'annotations': new List.from(annotations),
+ 'annotations': annotations.map((a) => a.toMap()).toList(),
'generics': recurseMap(generics)
};
}
@@ -749,21 +804,21 @@
/// List of the meta annotations on the variable.
List<String> annotations;
-
- Variable(String name, this.isFinal, this.isStatic, this.isConst, this.type,
+
+ Variable(String name, this.isFinal, this.isStatic, this.isConst, this.type,
String comment, this.annotations, String qualifiedName, bool isPrivate,
String owner) : super(name, comment, qualifiedName, isPrivate, owner);
-
+
/// Generates a map describing the [Variable] object.
Map toMap() => {
'name': name,
- 'qualifiedname': qualifiedName,
+ 'qualifiedName': qualifiedName,
'comment': comment,
'final': isFinal.toString(),
'static': isStatic.toString(),
'constant': isConst.toString(),
'type': new List.filled(1, type.toMap()),
- 'annotations': new List.from(annotations)
+ 'annotations': annotations.map((a) => a.toMap()).toList()
};
}
@@ -779,32 +834,47 @@
bool isAbstract;
bool isConst;
Type returnType;
-
+
+ /// Qualified name to state where the comment is inherited from.
+ String commentInheritedFrom = "";
+
/// List of the meta annotations on the method.
List<String> annotations;
-
- Method(String name, this.isStatic, this.isAbstract, this.isConst,
+
+ Method(String name, this.isStatic, this.isAbstract, this.isConst,
this.returnType, String comment, this.parameters, this.annotations,
String qualifiedName, bool isPrivate, String owner) : super(name, comment,
qualifiedName, isPrivate, owner);
-
+
+ /**
+ * Makes sure that the method with an inherited equivalent have comments.
+ */
+ void ensureCommentFor(Method inheritedMethod) {
+ if (comment.isNotEmpty) return;
+ entityMap[inheritedMethod.owner].ensureComments();
+ comment = inheritedMethod.comment;
+ commentInheritedFrom = inheritedMethod.commentInheritedFrom == '' ?
+ inheritedMethod.qualifiedName : inheritedMethod.commentInheritedFrom;
+ }
+
/// Generates a map describing the [Method] object.
Map toMap() => {
'name': name,
- 'qualifiedname': qualifiedName,
+ 'qualifiedName': qualifiedName,
'comment': comment,
+ 'commentFrom': commentInheritedFrom,
'static': isStatic.toString(),
'abstract': isAbstract.toString(),
'constant': isConst.toString(),
'return': new List.filled(1, returnType.toMap()),
'parameters': recurseMap(parameters),
- 'annotations': new List.from(annotations)
+ 'annotations': annotations.map((a) => a.toMap()).toList()
};
}
/**
- * A container to categorize methods into the following groups: setters,
- * getters, constructors, operators, regular methods.
+ * A container to categorize methods into the following groups: setters,
+ * getters, constructors, operators, regular methods.
*/
class MethodGroup {
Map<String, Method> setters = {};
@@ -812,12 +882,12 @@
Map<String, Method> constructors = {};
Map<String, Method> operators = {};
Map<String, Method> regularMethods = {};
-
+
void addMethod(MethodMirror mirror) {
- var method = new Method(mirror.simpleName, mirror.isStatic,
- mirror.isAbstract, mirror.isConstConstructor, _type(mirror.returnType),
- _commentToHtml(mirror), _parameters(mirror.parameters),
- _annotations(mirror), mirror.qualifiedName, _isPrivate(mirror),
+ var method = new Method(mirror.simpleName, mirror.isStatic,
+ mirror.isAbstract, mirror.isConstConstructor, _type(mirror.returnType),
+ _commentToHtml(mirror), _parameters(mirror.parameters),
+ _annotations(mirror), mirror.qualifiedName, _isHidden(mirror),
mirror.owner.qualifiedName);
entityMap[mirror.qualifiedName] = method;
_currentMember = mirror;
@@ -835,7 +905,7 @@
throw new ArgumentError('${mirror.simpleName} - no method type match');
}
}
-
+
void addInherited(Class parent) {
setters.addAll(parent.inheritedMethods.setters);
getters.addAll(parent.inheritedMethods.getters);
@@ -848,7 +918,7 @@
regularMethods.addAll(parent.methods.regularMethods);
}
}
-
+
Map toMap() => {
'setters': recurseMap(setters),
'getters': recurseMap(getters),
@@ -856,6 +926,23 @@
'operators': recurseMap(operators),
'methods': recurseMap(regularMethods)
};
+
+ Method operator [](String qualifiedName) {
+ if (setters.containsKey(qualifiedName)) return setters[qualifiedName];
+ if (getters.containsKey(qualifiedName)) return getters[qualifiedName];
+ if (operators.containsKey(qualifiedName)) return operators[qualifiedName];
+ if (regularMethods.containsKey(qualifiedName)) {
+ return regularMethods[qualifiedName];
+ }
+ return null;
+ }
+
+ void forEach(void f(String key, Method value)) {
+ setters.forEach(f);
+ getters.forEach(f);
+ operators.forEach(f);
+ regularMethods.forEach(f);
+ }
}
/**
@@ -872,10 +959,10 @@
/// List of the meta annotations on the parameter.
List<String> annotations;
-
- Parameter(this.name, this.isOptional, this.isNamed, this.hasDefaultValue,
+
+ Parameter(this.name, this.isOptional, this.isNamed, this.hasDefaultValue,
this.type, this.defaultValue, this.annotations);
-
+
/// Generates a map describing the [Parameter] object.
Map toMap() => {
'name': name,
@@ -884,19 +971,19 @@
'default': hasDefaultValue.toString(),
'type': new List.filled(1, type.toMap()),
'value': defaultValue,
- 'annotations': new List.from(annotations)
+ 'annotations': annotations.map((a) => a.toMap()).toList()
};
}
/**
- * A class containing properties of a Generic.
+ * A class containing properties of a Generic.
*/
class Generic {
String name;
String type;
-
+
Generic(this.name, this.type);
-
+
Map toMap() => {
'name': name,
'type': type
@@ -905,25 +992,25 @@
/**
* Holds the name of a return type, and its generic type parameters.
- *
+ *
* Return types are of a form [outer]<[inner]>.
- * If there is no [inner] part, [inner] will be an empty list.
- *
+ * If there is no [inner] part, [inner] will be an empty list.
+ *
* For example:
- * int size()
- * "return" :
+ * int size()
+ * "return" :
* - "outer" : "dart.core.int"
* "inner" :
- *
+ *
* List<String> toList()
* "return" :
* - "outer" : "dart.core.List"
- * "inner" :
+ * "inner" :
* - "outer" : "dart.core.String"
* "inner" :
- *
+ *
* Map<String, List<int>>
- * "return" :
+ * "return" :
* - "outer" : "dart.core.Map"
* "inner" :
* - "outer" : "dart.core.String"
@@ -936,11 +1023,26 @@
class Type {
String outer;
List<Type> inner;
-
+
Type(this.outer, this.inner);
-
+
Map toMap() => {
'outer': outer,
- 'inner': new List.from(inner.map((e) => e.toMap()))
+ 'inner': inner.map((e) => e.toMap()).toList()
+ };
+}
+
+/**
+ * Holds the name of the annotation, and its parameters.
+ */
+class Annotation {
+ String qualifiedName;
+ List<String> parameters;
+
+ Annotation(this.qualifiedName, this.parameters);
+
+ Map toMap() => {
+ 'name': qualifiedName,
+ 'parameters': parameters
};
}
\ No newline at end of file
diff --git a/pkg/docgen/pubspec.yaml b/pkg/docgen/pubspec.yaml
index 79220e4..70e3958 100644
--- a/pkg/docgen/pubspec.yaml
+++ b/pkg/docgen/pubspec.yaml
@@ -5,5 +5,5 @@
logging: any
markdown: any
path: any
- scheduled_test: any
+dev_dependencies:
unittest: any
diff --git a/pkg/docgen/test/single_library_test.dart b/pkg/docgen/test/single_library_test.dart
index 0ca4b09..78c8a5d 100644
--- a/pkg/docgen/test/single_library_test.dart
+++ b/pkg/docgen/test/single_library_test.dart
@@ -56,8 +56,7 @@
expect(classTypes is ClassGroup, isTrue);
var classes = [];
- classes.addAll(classTypes.abstractClasses.values);
- classes.addAll(classTypes.regularClasses.values);
+ classes.addAll(classTypes.classes.values);
classes.addAll(classTypes.errors.values);
expect(classes.every((e) => e is Class), isTrue);
diff --git a/pkg/http/lib/src/client.dart b/pkg/http/lib/src/client.dart
index 2757ea0..27626cc 100644
--- a/pkg/http/lib/src/client.dart
+++ b/pkg/http/lib/src/client.dart
@@ -12,7 +12,6 @@
import 'io_client.dart';
import 'streamed_response.dart';
import 'response.dart';
-import 'utils.dart';
/// The interface for HTTP clients that take care of maintaining persistent
/// connections across multiple requests to the same server. If you only need to
diff --git a/pkg/http/lib/src/io_client.dart b/pkg/http/lib/src/io_client.dart
index b7a6730..6695fb8 100644
--- a/pkg/http/lib/src/io_client.dart
+++ b/pkg/http/lib/src/io_client.dart
@@ -10,7 +10,6 @@
import 'base_client.dart';
import 'base_request.dart';
import 'streamed_response.dart';
-import 'utils.dart';
/// A `dart:io`-based HTTP client. This is the default client.
class IOClient extends BaseClient {
diff --git a/pkg/http/lib/src/mock_client.dart b/pkg/http/lib/src/mock_client.dart
index ec88af4..b81bf06 100644
--- a/pkg/http/lib/src/mock_client.dart
+++ b/pkg/http/lib/src/mock_client.dart
@@ -5,7 +5,6 @@
library mock_client;
import 'dart:async';
-import 'dart:io';
import 'base_client.dart';
import 'base_request.dart';
diff --git a/pkg/http/lib/src/request.dart b/pkg/http/lib/src/request.dart
index 982d2fb..9f024e6 100644
--- a/pkg/http/lib/src/request.dart
+++ b/pkg/http/lib/src/request.dart
@@ -4,7 +4,6 @@
library request;
-import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index 1cbe6aa..420a3d5 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -9,8 +9,6 @@
import 'dart:typed_data';
import 'dart:utf';
-import "package:crypto/crypto.dart";
-
import 'byte_stream.dart';
/// Converts a URL query string (or `application/x-www-form-urlencoded` body)
diff --git a/pkg/http/test/client_test.dart b/pkg/http/test/client_test.dart
index 287aee5..6f397fa 100644
--- a/pkg/http/test/client_test.dart
+++ b/pkg/http/test/client_test.dart
@@ -7,7 +7,6 @@
import 'dart:io';
import 'package:http/http.dart' as http;
-import 'package:http/src/utils.dart';
import 'package:unittest/unittest.dart';
import 'utils.dart';
diff --git a/pkg/http/test/multipart_test.dart b/pkg/http/test/multipart_test.dart
index 0d44d8e..cdbb4cd 100644
--- a/pkg/http/test/multipart_test.dart
+++ b/pkg/http/test/multipart_test.dart
@@ -9,7 +9,6 @@
import 'dart:utf';
import 'package:http/http.dart' as http;
-import 'package:http/src/utils.dart';
import 'package:path/path.dart' as path;
import 'package:unittest/unittest.dart';
diff --git a/pkg/http/test/request_test.dart b/pkg/http/test/request_test.dart
index 3ebe3e5..c9d82ce 100644
--- a/pkg/http/test/request_test.dart
+++ b/pkg/http/test/request_test.dart
@@ -7,7 +7,6 @@
import 'dart:io';
import 'package:http/http.dart' as http;
-import 'package:http/src/utils.dart';
import 'package:unittest/unittest.dart';
import 'utils.dart';
diff --git a/pkg/http/test/utils.dart b/pkg/http/test/utils.dart
index a3f0f6e..9c6e584 100644
--- a/pkg/http/test/utils.dart
+++ b/pkg/http/test/utils.dart
@@ -8,7 +8,6 @@
import 'dart:io';
import 'dart:json' as json;
-import 'package:http/http.dart' as http;
import 'package:http/src/byte_stream.dart';
import 'package:http/src/utils.dart';
import 'package:unittest/unittest.dart';
diff --git a/pkg/http_server/pubspec.yaml b/pkg/http_server/pubspec.yaml
index 3f29100..3112d77 100644
--- a/pkg/http_server/pubspec.yaml
+++ b/pkg/http_server/pubspec.yaml
@@ -1,7 +1,8 @@
name: http_server
-author: "Dart Team <misc@dartlang.org>"
+author: Dart Team <misc@dartlang.org>
+description: Library of HTTP server classes.
homepage: http://www.dartlang.org
-description: >
- Library of HTTP server classes.
dependencies:
mime: any
+dev_dependencies:
+ unittest: any
diff --git a/pkg/intl/example/basic/basic_example.dart b/pkg/intl/example/basic/basic_example.dart
index 1ecb2a0..41a63a0 100644
--- a/pkg/intl/example/basic/basic_example.dart
+++ b/pkg/intl/example/basic/basic_example.dart
@@ -19,7 +19,6 @@
import 'dart:async';
import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
-import 'package:intl/message_lookup_by_library.dart';
import 'messages_all.dart';
/**
diff --git a/pkg/intl/lib/extract_messages.dart b/pkg/intl/lib/extract_messages.dart
index 2fa06ad..0679ff8 100644
--- a/pkg/intl/lib/extract_messages.dart
+++ b/pkg/intl/lib/extract_messages.dart
@@ -33,6 +33,21 @@
bool suppressWarnings = false;
/**
+ * If this is true, then treat all warnings as errors.
+ */
+bool warningsAreErrors = false;
+
+/**
+ * This accumulates a list of all warnings/errors we have found. These are
+ * saved as strings right now, so all that can really be done is print and
+ * count them.
+ */
+List<String> warnings = [];
+
+/** Were there any warnings or errors in extracting messages. */
+bool get hasWarnings => warnings.isNotEmpty;
+
+/**
* Parse the source of the Dart program file [file] and return a Map from
* message names to [IntlMessage] instances.
*/
@@ -58,13 +73,15 @@
*/
String _origin;
-void _reportErrorLocation(ASTNode node) {
- if (_origin != null) print(" from $_origin");
+String _reportErrorLocation(ASTNode node) {
+ var result = new StringBuffer();
+ if (_origin != null) result.write(" from $_origin");
var info = _root.lineInfo;
if (info != null) {
var line = info.getLocation(node.offset);
- print(" line: ${line.lineNumber}, column: ${line.columnNumber}");
+ result.write(" line: ${line.lineNumber}, column: ${line.columnNumber}");
}
+ return result.toString();
}
/**
@@ -92,7 +109,7 @@
/** Return true if [node] matches the pattern we expect for Intl.message() */
bool looksLikeIntlMessage(MethodInvocation node) {
- const validNames = const ["message", "plural", "gender"];
+ const validNames = const ["message", "plural", "gender", "select"];
if (!validNames.contains(node.methodName.name)) return false;
if (!(node.target is SimpleIdentifier)) return false;
SimpleIdentifier target = node.target;
@@ -100,6 +117,16 @@
return true;
}
+ Message _expectedInstance(String type) {
+ switch (type) {
+ case 'message' : return new MainMessage();
+ case 'plural' : return new Plural();
+ case 'gender' : return new Gender();
+ case 'select' : return new Select();
+ default: return null;
+ }
+ }
+
/**
* Returns a String describing why the node is invalid, or null if no
* reason is found, so it's presumed valid.
@@ -110,34 +137,8 @@
return "Named parameters on message functions are not supported.";
}
var arguments = node.argumentList.arguments;
-
- if (node.methodName.name == 'message') {
- if (!(arguments.first is StringLiteral)) {
- return "Intl.message messages must be string literals";
- }
- }
-
- var namedArguments = arguments.skip(1);
- // This seems unlikely to happen, but make sure all are NamedExpression
- // before doing the tests below.
- if (!namedArguments.every((each) => each is NamedExpression)) {
- return "Message arguments except the message must be named";
- }
- var notArgs = namedArguments.where(
- (each) => each.name.label.name != 'args');
- var values = notArgs.map((each) => each.expression).toList();
- if (!values.every((each) => each is SimpleStringLiteral)) {
- "Intl.message arguments must be simple string literals";
- }
- if (!notArgs.any((each) => each.name.label.name == 'name')) {
- return "The 'name' argument for Intl.message must be specified";
- }
- var hasArgs = namedArguments.any((each) => each.name.label.name == 'args');
- var hasParameters = !parameters.parameters.isEmpty;
- if (!hasArgs && hasParameters) {
- return "The 'args' argument for Intl.message must be specified";
- }
- return null;
+ var instance = _expectedInstance(node.methodName.name);
+ return instance.checkValidity(node, arguments, name, parameters);
}
/**
@@ -146,7 +147,7 @@
*/
void visitMethodDeclaration(MethodDeclaration node) {
parameters = node.parameters;
- String name = node.name.name;
+ name = node.name.name;
super.visitMethodDeclaration(node);
}
@@ -154,16 +155,6 @@
* Record the parameters of the function or method declaration we last
* encountered before seeing the Intl.message call.
*/
- void visitFunctionExpression(FunctionExpression node) {
- parameters = node.parameters;
- name = null;
- super.visitFunctionExpression(node);
- }
-
- /**
- * Record the parameters of the function or method declaration we last
- * encountered before seeing the Intl.message call.
- */
void visitFunctionDeclaration(FunctionDeclaration node) {
parameters = node.functionExpression.parameters;
name = node.name.name;
@@ -193,9 +184,12 @@
var reason = checkValidity(node);
if (reason != null) {
if (!suppressWarnings) {
- print("Skipping invalid Intl.message invocation\n <$node>");
- print(" reason: $reason");
- _reportErrorLocation(node);
+ var err = new StringBuffer();
+ err.write("Skipping invalid Intl.message invocation\n <$node>\n");
+ err.write(" reason: $reason\n");
+ err.write(_reportErrorLocation(node));
+ warnings.add(err.toString());
+ print(err);
}
// We found one, but it's not valid. Stop recursing.
return true;
@@ -226,7 +220,7 @@
var arguments = node.argumentList.arguments.elements;
extract(message, arguments);
- for (NamedExpression namedArgument in arguments.skip(1)) {
+ for (var namedArgument in arguments.where((x) => x is NamedExpression)) {
var name = namedArgument.name.label.name;
var exp = namedArgument.expression;
var string = exp is SimpleStringLiteral ? exp.value : exp.toString();
@@ -249,9 +243,12 @@
message.messagePieces.addAll(interpolation.pieces);
} on IntlMessageExtractionException catch (e) {
message = null;
- print("Error $e");
- print("Processing <$node>");
- _reportErrorLocation(node);
+ var err = new StringBuffer();
+ err.write("Error $e\n");
+ err.write("Processing <$node>\n");
+ err.write(_reportErrorLocation(node));
+ print(err);
+ warnings.add(err);
}
}
@@ -398,7 +395,9 @@
/** Return true if [node] matches the pattern for plural or gender message.*/
bool looksLikePluralOrGender(MethodInvocation node) {
- if (!["plural", "gender"].contains(node.methodName.name)) return false;
+ if (!["plural", "gender", "select"].contains(node.methodName.name)) {
+ return false;
+ }
if (!(node.target is SimpleIdentifier)) return false;
SimpleIdentifier target = node.target;
if (target.token.toString() != "Intl") return false;
@@ -420,28 +419,31 @@
*/
Message messageFromMethodInvocation(MethodInvocation node) {
var message;
- if (node.methodName.name == "gender") {
- message = new Gender();
- } else if (node.methodName.name == "plural") {
- message = new Plural();
- } else {
- throw new IntlMessageExtractionException("Invalid plural/gender message");
+ switch(node.methodName.name) {
+ case "gender" : message = new Gender(); break;
+ case "plural" : message = new Plural(); break;
+ case "select" : message = new Select(); break;
+ default: throw new IntlMessageExtractionException(
+ "Invalid plural/gender/select message");
}
message.parent = parent;
- var arguments = node.argumentList.arguments.elements;
- for (var arg in arguments.where((each) => each is NamedExpression)) {
+ var arguments = message.argumentsOfInterestFor(node);
+ arguments.forEach((key, value) {
try {
var interpolation = new InterpolationVisitor(message);
- arg.expression.accept(interpolation);
- message[arg.name.label.token.toString()] = interpolation.pieces;
+ value.accept(interpolation);
+ message[key] = interpolation.pieces;
} on IntlMessageExtractionException catch (e) {
message = null;
- print("Error $e");
- print("Processing <$node>");
- _reportErrorLocation(node);
+ var err = new StringBuffer();
+ err.write("Error $e");
+ err.write("Processing <$node>");
+ err.write(_reportErrorLocation(node));
+ print(err);
+ warnings.add(err);
}
- }
+ });
var mainArg = node.argumentList.arguments.elements.firstWhere(
(each) => each is! NamedExpression);
if (mainArg is SimpleStringLiteral) {
diff --git a/pkg/intl/lib/generate_localized.dart b/pkg/intl/lib/generate_localized.dart
index f5e3921..a232fd3 100644
--- a/pkg/intl/lib/generate_localized.dart
+++ b/pkg/intl/lib/generate_localized.dart
@@ -13,7 +13,6 @@
*/
library generate_localized;
-import 'extract_messages.dart';
import 'src/intl_message.dart';
import 'dart:io';
import 'package:path/path.dart' as path;
diff --git a/pkg/intl/lib/intl.dart b/pkg/intl/lib/intl.dart
index fb71f88..e91c2b2 100644
--- a/pkg/intl/lib/intl.dart
+++ b/pkg/intl/lib/intl.dart
@@ -31,7 +31,7 @@
*/
library intl;
-import 'dart:async';
+import 'dart:collection';
import 'src/intl_helpers.dart';
import 'dart:math';
import 'date_symbols.dart';
@@ -302,6 +302,33 @@
}
/**
+ * Format a message differently depending on [choice]. We look up the value
+ * of [choice] in [cases] and return the result, or an empty string if
+ * it is not found. Normally used as part
+ * of an Intl.message message that is to be translated.
+ */
+ static String select(String choice, Map<String, String> cases,
+ {String desc, Map examples, String locale, String name,
+ List<String>args}) {
+ // If we are passed a name and arguments, then we are operating as a
+ // top-level message, so look up our translation by calling Intl.message
+ // with ourselves as an argument.
+ if (name != null) {
+ return Intl.message(
+ Intl.select(choice, cases),
+ name: name,
+ args: args,
+ locale: locale);
+ }
+ var exact = cases[choice];
+ if (exact != null) return exact;
+ var other = cases["other"];
+ if (other == null)
+ throw new ArgumentError("The 'other' case must be specified");
+ return other;
+ }
+
+ /**
* Format the given function with a specific [locale], given a
* [message_function] that takes no parameters. The [message_function] can be
* a simple message function that just returns the result of `Intl.message()`
@@ -325,17 +352,6 @@
}
/**
- * Support method for message formatting. Select the correct exact (gender,
- * usually) form from [cases] given the user [choice].
- */
- static String select(String choice, Map cases) {
- var exact = cases[choice];
- if (exact != null) return exact;
- var other = cases["other"];
- return (other == null) ? '' : other;
- }
-
- /**
* Accessor for the current locale. This should always == the default locale,
* unless for some reason this gets called inside a message that resets the
* locale.
diff --git a/pkg/intl/lib/message_lookup_by_library.dart b/pkg/intl/lib/message_lookup_by_library.dart
index fde0551..2e92dbd 100644
--- a/pkg/intl/lib/message_lookup_by_library.dart
+++ b/pkg/intl/lib/message_lookup_by_library.dart
@@ -13,9 +13,7 @@
*/
library message_lookup_by_library;
-import 'dart:async';
import 'intl.dart';
-import 'src/intl_helpers.dart';
/**
* This is a message lookup mechanism that delegates to one of a collection
diff --git a/pkg/intl/lib/number_format.dart b/pkg/intl/lib/number_format.dart
index c8816d8..bdc5e46 100644
--- a/pkg/intl/lib/number_format.dart
+++ b/pkg/intl/lib/number_format.dart
@@ -699,7 +699,7 @@
* Provides an Iterable that wraps [_iterator] so it can be used in a `for`
* loop.
*/
-class _StringIterable extends Iterable<String> {
+class _StringIterable extends IterableBase<String> {
final Iterator<String> iterator;
_StringIterable(String s)
diff --git a/pkg/intl/lib/src/intl_helpers.dart b/pkg/intl/lib/src/intl_helpers.dart
index 229d044..0aa3f4d 100644
--- a/pkg/intl/lib/src/intl_helpers.dart
+++ b/pkg/intl/lib/src/intl_helpers.dart
@@ -8,7 +8,6 @@
*/
library intl_helpers;
-import '../date_symbols.dart';
import 'dart:async';
diff --git a/pkg/intl/lib/src/intl_message.dart b/pkg/intl/lib/src/intl_message.dart
index ae31798..5dfb9c8 100644
--- a/pkg/intl/lib/src/intl_message.dart
+++ b/pkg/intl/lib/src/intl_message.dart
@@ -33,6 +33,8 @@
*/
library intl_message;
+import 'package:analyzer_experimental/analyzer.dart';
+
/** A default function for the [Message.expanded] method. */
_nullTransform(msg, chunk) => chunk;
@@ -59,6 +61,39 @@
*/
get arguments => parent == null ? const [] : parent.arguments;
+ String checkValidity(MethodInvocation node, List arguments,
+ String outerName, FormalParameterList outerArgs) {
+ var hasArgs = arguments.any(
+ (each) => each is NamedExpression && each.name.label.name == 'args');
+ var hasParameters = !outerArgs.parameters.isEmpty;
+ if (!hasArgs && hasParameters) {
+ return "The 'args' argument for Intl.message must be specified";
+ }
+
+ var messageName = arguments.firstWhere(
+ (eachArg) => eachArg is NamedExpression &&
+ eachArg.name.label.name == 'name',
+ orElse: () => null);
+ if (messageName == null) {
+ return "The 'name' argument for Intl.message must be specified";
+ }
+ if ((messageName.expression is! SimpleStringLiteral)
+ || messageName.expression.value != outerName) {
+ return "The 'name' argument for Intl.message must be a simple string "
+ "literal and match the containing function name.";
+ }
+ var simpleArguments = arguments.where(
+ (each) => each is NamedExpression
+ && ["desc", "locale", "name"].contains(each.name.label.name));
+ var values = simpleArguments.map((each) => each.expression).toList();
+ for (var arg in values) {
+ if (arg is! SimpleStringLiteral) {
+ return "Intl.message argument '${arg.name.label.name}' must be "
+ "a simple string literal";
+ }
+ }
+ }
+
/**
* Turn a value, typically read from a translation file or created out of an
* AST for a source program, into the appropriate
@@ -234,6 +269,16 @@
*/
List<Message> messagePieces = [];
+ /** Verify that this looks like a correct Intl.message invocation. */
+ String checkValidity(MethodInvocation node, List arguments,
+ String outerName, FormalParameterList outerArgs) {
+ if (arguments.first is! StringLiteral) {
+ return "Intl.message messages must be string literals";
+ }
+
+ return super.checkValidity(node, arguments, outerName, outerArgs);
+ }
+
void addPieces(List<Message> messages) {
for (var each in messages) {
messagePieces.add(Message.from(each, this));
@@ -384,6 +429,18 @@
String mainArgument;
/**
+ * Return the arguments that affect this SubMessage as a map of
+ * argument names and values.
+ */
+ Map argumentsOfInterestFor(MethodInvocation node) {
+ var basicArguments = node.argumentList.arguments.elements;
+ var others = basicArguments.where((each) => each is NamedExpression);
+ return new Map.fromIterable(others,
+ key: (node) => node.name.label.token.value(),
+ value: (node) => node.expression);
+ }
+
+ /**
* Return the list of attribute names to use when generating code. This
* may be different from [attributeNames] if there are multiple aliases
* that map to the same clause.
@@ -423,12 +480,12 @@
Gender();
/**
- * Create a new IntlGender providing [mainArgument] and the list of possible
+ * Create a new Gender providing [mainArgument] and the list of possible
* clauses. Each clause is expected to be a list whose first element is a
- * variable name and whose second element is either a String or
- * a list of strings and IntlMessageSends or IntlVariableSubstitution.
+ * variable name and whose second element is either a [String] or
+ * a list of strings and [Message] or [VariableSubstitution].
*/
- Gender.from(mainArgument, List clauses, parent) :
+ Gender.from(String mainArgument, List clauses, Message parent) :
super.from(mainArgument, clauses, parent);
Message female;
@@ -467,7 +524,7 @@
class Plural extends SubMessage {
Plural();
- Plural.from(mainArgument, clauses, parent) :
+ Plural.from(String mainArgument, List clauses, Message parent) :
super.from(mainArgument, clauses, parent);
Message zero;
@@ -519,3 +576,69 @@
}
}
+/**
+ * Represents a message send of [Intl.select] inside a message that is to
+ * be internationalized. This corresponds to an ICU message syntax "select"
+ * with arbitrary options.
+ */
+class Select extends SubMessage {
+
+ Select();
+ /**
+ * Create a new [Select] providing [mainArgument] and the list of possible
+ * clauses. Each clause is expected to be a list whose first element is a
+ * variable name and whose second element is either a String or
+ * a list of strings and [Message]s or [VariableSubstitution]s.
+ */
+ Select.from(String mainArgument, List clauses, Message parent) :
+ super.from(mainArgument, clauses, parent);
+
+ Map<String, Message> cases = new Map<String, Message>();
+
+ String get icuMessageName => "select";
+ String get dartMessageName => 'Intl.select';
+
+ get attributeNames => cases.keys;
+ get codeAttributeNames => attributeNames;
+
+ void operator []=(attributeName, rawValue) {
+ var value = Message.from(rawValue, this);
+ cases[attributeName] = value;
+ }
+
+ Message operator [](String attributeName) {
+ var exact = cases[attributeName];
+ return exact == null ? cases["other"] : exact;
+ }
+
+ /**
+ * Return the arguments that we care about for the select. In this
+ * case they will all be passed in as a Map rather than as the named
+ * arguments used in Plural/Gender.
+ */
+ Map argumentsOfInterestFor(MethodInvocation node) {
+ var casesArgument = node.argumentList.arguments.elements[1];
+ return new Map.fromIterable(casesArgument.entries,
+ key: (node) => node.key.value,
+ value: (node) => node.value);
+ }
+
+ /**
+ * Write out the generated representation of this message. This differs
+ * from Plural/Gender in that it prints a literal map rather than
+ * named arguments.
+ */
+ String toCode() {
+ var out = new StringBuffer();
+ out.write('\${');
+ out.write(dartMessageName);
+ out.write('(');
+ out.write(mainArgument);
+ var args = codeAttributeNames;
+ out.write(", {");
+ args.fold(out, (buffer, arg) => buffer..write(
+ "'$arg': '${this[arg].toCode()}', "));
+ out.write("})}");
+ return out.toString();
+ }
+}
\ No newline at end of file
diff --git a/pkg/intl/test/find_default_locale_standalone_test.dart b/pkg/intl/test/find_default_locale_standalone_test.dart
index 80bb454..2518133 100644
--- a/pkg/intl/test/find_default_locale_standalone_test.dart
+++ b/pkg/intl/test/find_default_locale_standalone_test.dart
@@ -7,7 +7,6 @@
import 'package:intl/intl.dart';
import 'package:intl/intl_standalone.dart';
import 'package:unittest/unittest.dart';
-import 'dart:io';
main() {
test("Find system locale standalone", () {
diff --git a/pkg/intl/test/intl_message_basic_example_test.dart b/pkg/intl/test/intl_message_basic_example_test.dart
index e9281ee..249776c 100644
--- a/pkg/intl/test/intl_message_basic_example_test.dart
+++ b/pkg/intl/test/intl_message_basic_example_test.dart
@@ -7,7 +7,6 @@
*/
library intl_message_test_2;
-import 'package:intl/intl.dart';
import '../example/basic/basic_example.dart';
import 'package:unittest/unittest.dart';
import 'dart:async';
diff --git a/pkg/intl/test/message_extraction/extract_to_json.dart b/pkg/intl/test/message_extraction/extract_to_json.dart
index 4c1d718..9720506 100644
--- a/pkg/intl/test/message_extraction/extract_to_json.dart
+++ b/pkg/intl/test/message_extraction/extract_to_json.dart
@@ -33,6 +33,8 @@
var parser = new ArgParser();
parser.addFlag("suppress-warnings", defaultsTo: false,
callback: (x) => suppressWarnings = x);
+ parser.addFlag("warnings-are-errors", defaultsTo: false,
+ callback: (x) => warningsAreErrors = x);
parser.addOption("output-dir", defaultsTo: '.',
callback: (value) => targetDir = value);
@@ -49,6 +51,9 @@
}
var file = new File(path.join(targetDir, 'intl_messages.json'));
file.writeAsStringSync(json.stringify(allMessages));
+ if (hasWarnings && warningsAreErrors) {
+ exit(1);
+ }
}
/**
diff --git a/pkg/intl/test/message_extraction/failed_extraction_test.dart b/pkg/intl/test/message_extraction/failed_extraction_test.dart
new file mode 100644
index 0000000..38361b8
--- /dev/null
+++ b/pkg/intl/test/message_extraction/failed_extraction_test.dart
@@ -0,0 +1,16 @@
+import "message_extraction_test.dart";
+import "dart:io";
+import "package:unittest/unittest.dart";
+
+main() {
+ run(null, ["extract_to_json.dart",
+ "sample_with_messages.dart", "part_of_sample_with_messages.dart"])
+ .then((ProcessResult result) {
+ expect(result.exitCode, 0);
+ });
+ run(null, ["extract_to_json.dart", "--warnings-are-errors",
+ "sample_with_messages.dart", "part_of_sample_with_messages.dart"])
+ .then((ProcessResult result) {
+ expect(result.exitCode, 1);
+ });
+}
\ 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 70cc5bd..ef79fb6 100644
--- a/pkg/intl/test/message_extraction/generate_from_json.dart
+++ b/pkg/intl/test/message_extraction/generate_from_json.dart
@@ -18,7 +18,6 @@
import 'dart:io';
import 'package:intl/extract_messages.dart';
import 'package:intl/src/intl_message.dart';
-import 'extract_to_json.dart';
import 'package:intl/generate_localized.dart';
import 'dart:json' as json;
import 'package:path/path.dart' as path;
diff --git a/pkg/intl/test/message_extraction/make_hardcoded_translation.dart b/pkg/intl/test/message_extraction/make_hardcoded_translation.dart
index 1fddfaf..dd907de 100644
--- a/pkg/intl/test/message_extraction/make_hardcoded_translation.dart
+++ b/pkg/intl/test/message_extraction/make_hardcoded_translation.dart
@@ -61,7 +61,7 @@
], null)),
// TODO(alanknight): These are pretty horrible to write out manually. Provide
// a better way of reading/writing translations. A real format would be good.
- "whereTheyWent" : writer.write(new Gender.from("gender",
+ "whereTheyWentMessage" : writer.write(new Gender.from("gender",
[
["male", [0, " est allé à sa ", 2]],
["female", [0, " est allée à sa ", 2]],
@@ -103,6 +103,21 @@
[["male", "\$number homme"], ["other", "\$number autre"]], null),
]
], null)),
+ "outerSelect" : writer.write(new Select.from("currency",
+ [
+ ['CDN', '\$amount dollars Canadiens'],
+ ['other', '\$amount certaine devise ou autre.'],
+ ], null)),
+ "nestedSelect" : writer.write(new Select.from("currency",
+ [
+ ['CDN', new Plural.from('amount',
+ [
+ ["other", '\$amount dollars Canadiens'],
+ ["one", '\$amount dollar Canadien'],
+ ], null)
+ ],
+ ['other', 'N''importe quoi'],
+ ], null)),
};
/** A list of the German translations that we will produce. */
@@ -131,7 +146,7 @@
], null)),
// TODO(alanknight): These are pretty horrible to write out manually. Provide
// a better way of reading/writing translations. A real format would be good.
- "whereTheyWent" : writer.write(new Gender.from("gender",
+ "whereTheyWentMessage" : writer.write(new Gender.from("gender",
[
["male", [0, " ging zu seinem ", 2]],
["female", [0, " ging zu ihrem ", 2]],
@@ -174,6 +189,21 @@
[["male", "\$number Mann"], ["other", "\$number andere"]], null),
]
], null)),
+ "outerSelect" : writer.write(new Select.from("currency",
+ [
+ ['CDN', '\$amount Kanadischen dollar'],
+ ['other', '\$amount einige Währung oder anderen.'],
+ ], null)),
+ "nestedSelect" : writer.write(new Select.from("currency",
+ [
+ ['CDN', new Plural.from('amount',
+ [
+ ["other", '\$amount Kanadischen dollar'],
+ ["one", '\$amount Kanadischer dollar'],
+ ], null)
+ ],
+ ['other', 'whatever'],
+ ], null)),
};
/** The output directory for translated files. */
diff --git a/pkg/intl/test/message_extraction/message_extraction_test.dart b/pkg/intl/test/message_extraction/message_extraction_test.dart
index ff856f0..40c664e 100644
--- a/pkg/intl/test/message_extraction/message_extraction_test.dart
+++ b/pkg/intl/test/message_extraction/message_extraction_test.dart
@@ -177,6 +177,10 @@
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();
@@ -220,6 +224,10 @@
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();
@@ -263,4 +271,8 @@
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/part_of_sample_with_messages.dart b/pkg/intl/test/message_extraction/part_of_sample_with_messages.dart
index 2d36862..085459c 100644
--- a/pkg/intl/test/message_extraction/part_of_sample_with_messages.dart
+++ b/pkg/intl/test/message_extraction/part_of_sample_with_messages.dart
@@ -44,7 +44,7 @@
female: '$name went to her $place',
other: '$name went to its $place')
}",
- name: "whereTheyWent",
+ name: "whereTheyWentMessage",
args: [name, gender, place],
desc: 'A person went to some place that they own, e.g. their room'
);
diff --git a/pkg/intl/test/message_extraction/sample_with_messages.dart b/pkg/intl/test/message_extraction/sample_with_messages.dart
index 9bad4b9..292273c 100644
--- a/pkg/intl/test/message_extraction/sample_with_messages.dart
+++ b/pkg/intl/test/message_extraction/sample_with_messages.dart
@@ -10,9 +10,6 @@
library sample;
import "package:intl/intl.dart";
-import "package:intl/message_lookup_by_library.dart";
-import "dart:async";
-import "package:intl/src/intl_helpers.dart";
import "foo_messages_all.dart";
part 'part_of_sample_with_messages.dart';
@@ -38,7 +35,7 @@
// This string will be printed with a French locale, so it will always show
// up in the French version, regardless of the current locale.
-alwaysAccented() =>
+alwaysTranslated() =>
Intl.message("This string is always translated", locale: 'fr',
name: 'alwaysTranslated');
@@ -78,6 +75,25 @@
// be rejected by validation code.
invalidOuterGender(g) => Intl.gender(g, other: 'o');
+// A general select
+outerSelect(currency, amount) => Intl.select(currency,
+ {
+ "CDN" : "$amount Canadian dollars",
+ "other" : "$amount some currency or other."
+ },
+ name: "outerSelect",
+ args: [currency, amount]);
+
+// A select with a plural inside the expressions.
+nestedSelect(currency, amount) => Intl.select(currency,
+ {
+ "CDN" : """${Intl.plural(amount, one: '$amount Canadian dollar',
+ other: '$amount Canadian dollars')}""",
+ "other" : "Whatever",
+ },
+ name: "nestedSelect",
+ args: [currency, amount]);
+
// A trivial nested plural/gender where both are done directly rather than
// in interpolations.
nestedOuter(number, gen) => Intl.plural(number,
@@ -99,14 +115,15 @@
}
}
- // A function that is unnamed and assigned to a variable. It's also nested
+ // A function that is assigned to a variable. It's also nested
// within another function definition.
- var messageVariable = (a, b, c) => Intl.message(
+ message3(a, b, c) => Intl.message(
"Characters that need escaping, e.g slashes \\ dollars \${ (curly braces "
"are ok) and xml reserved characters <& and quotes \" "
"parameters $a, $b, and $c",
name: 'message3',
args: [a, b, c]);
+ var messageVariable = message3;
print("-------------------------------------------");
print("Printing messages for ${locale.locale}");
@@ -117,7 +134,7 @@
print(multiLine());
print(types(1, "b", ["c", "d"]));
print(leadingQuotes());
- print(alwaysAccented());
+ print(alwaysTranslated());
print(trickyInterpolation("this"));
var thing = new YouveGotMessages();
print(thing.method());
@@ -148,6 +165,10 @@
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));
});
}
diff --git a/pkg/intl/test/number_format_test.dart b/pkg/intl/test/number_format_test.dart
index 2306470..3b9aed6 100644
--- a/pkg/intl/test/number_format_test.dart
+++ b/pkg/intl/test/number_format_test.dart
@@ -7,7 +7,6 @@
library number_format_test;
import 'package:unittest/unittest.dart';
-import 'package:intl/number_symbols.dart';
import 'package:intl/number_symbols_data.dart';
import 'package:intl/intl.dart';
import 'number_test_data.dart';
diff --git a/pkg/intl/tool/generate_locale_data_files.dart b/pkg/intl/tool/generate_locale_data_files.dart
index 6c77a87..b1ffb3f 100644
--- a/pkg/intl/tool/generate_locale_data_files.dart
+++ b/pkg/intl/tool/generate_locale_data_files.dart
@@ -12,7 +12,6 @@
* which is sourced by the date_symbol_data... files.
*/
-import '../lib/date_symbols.dart';
import '../lib/date_symbol_data_local.dart';
import '../lib/date_time_patterns.dart';
import '../lib/intl.dart';
diff --git a/pkg/mdv/lib/mdv.dart b/pkg/mdv/lib/mdv.dart
index feec831..fe9d9c8 100644
--- a/pkg/mdv/lib/mdv.dart
+++ b/pkg/mdv/lib/mdv.dart
@@ -5,15 +5,13 @@
// TODO(jmesserly): more commentary here.
/**
* This library provides access to Model-Driven-Views APIs on HTML elements.
- * More information can be found at: <https://github.com/toolkitchen/mdv>.
+ * More information can be found at: <https://github.com/Polymer/mdv>.
*/
library mdv;
import 'dart:async';
import 'dart:collection';
import 'dart:html';
-import 'dart:math' as math;
-import 'dart:mirrors';
import 'package:observe/observe.dart';
// TODO(jmesserly): get this from somewhere else. See http://dartbug.com/4161.
diff --git a/pkg/mdv/lib/src/element.dart b/pkg/mdv/lib/src/element.dart
index a126161..d1f62da 100644
--- a/pkg/mdv/lib/src/element.dart
+++ b/pkg/mdv/lib/src/element.dart
@@ -13,6 +13,10 @@
// (see "BindImperative" test in original JS code).
NodeBinding createBinding(String name, model, String path) =>
new _AttributeBinding(node, name, model, path);
+
+ // Normally we issue this error in Element._ensureTemplate, but we
+ // avoid calling that from the model getter, so issue the error here.
+ get model => throw new UnsupportedError('$node is not a template.');
}
class _AttributeBinding extends NodeBinding {
diff --git a/pkg/mdv/test/binding_syntax_test.dart b/pkg/mdv/test/binding_syntax_test.dart
index 9ef9c68..b4d0381 100644
--- a/pkg/mdv/test/binding_syntax_test.dart
+++ b/pkg/mdv/test/binding_syntax_test.dart
@@ -4,7 +4,6 @@
library binding_syntax_test;
-import 'dart:async';
import 'dart:collection';
import 'dart:html';
import 'package:mdv/mdv.dart' as mdv;
diff --git a/pkg/mdv/test/custom_element_bindings_test.dart b/pkg/mdv/test/custom_element_bindings_test.dart
index c4dd565..882bf16 100644
--- a/pkg/mdv/test/custom_element_bindings_test.dart
+++ b/pkg/mdv/test/custom_element_bindings_test.dart
@@ -4,10 +4,8 @@
library custom_element_bindings_test;
-import 'dart:async';
import 'dart:html';
import 'package:mdv/mdv.dart' as mdv;
-import 'package:observe/observe.dart';
import 'package:unittest/html_config.dart';
import 'package:unittest/unittest.dart';
import 'mdv_test_utils.dart';
diff --git a/pkg/mdv/test/mdv_test_utils.dart b/pkg/mdv/test/mdv_test_utils.dart
index 1b068c2..3033fba 100644
--- a/pkg/mdv/test/mdv_test_utils.dart
+++ b/pkg/mdv/test/mdv_test_utils.dart
@@ -4,7 +4,6 @@
library observe_utils;
-import 'dart:async';
import 'dart:html';
import 'package:observe/observe.dart';
import 'package:unittest/unittest.dart';
diff --git a/pkg/mdv/test/node_bindings_test.dart b/pkg/mdv/test/node_bindings_test.dart
index fa0413f..2609d9c 100644
--- a/pkg/mdv/test/node_bindings_test.dart
+++ b/pkg/mdv/test/node_bindings_test.dart
@@ -4,10 +4,8 @@
library node_bindings_test;
-import 'dart:async';
import 'dart:html';
import 'package:mdv/mdv.dart' as mdv;
-import 'package:observe/observe.dart';
import 'package:unittest/html_config.dart';
import 'package:unittest/unittest.dart';
import 'mdv_test_utils.dart';
diff --git a/pkg/mime/pubspec.yaml b/pkg/mime/pubspec.yaml
index 82493f8..174820c 100644
--- a/pkg/mime/pubspec.yaml
+++ b/pkg/mime/pubspec.yaml
@@ -1,5 +1,6 @@
name: mime
-author: "Dart Team <misc@dartlang.org>"
+author: Dart Team <misc@dartlang.org>
+description: Helper-package for working with MIME.
homepage: http://www.dartlang.org
-description: >
- Helper-package for working with MIME.
+dev_dependencies:
+ unittest: any
diff --git a/pkg/mime/test/mime_multipart_transformer_test.dart b/pkg/mime/test/mime_multipart_transformer_test.dart
index 43b542f..7d7baca 100644
--- a/pkg/mime/test/mime_multipart_transformer_test.dart
+++ b/pkg/mime/test/mime_multipart_transformer_test.dart
@@ -6,7 +6,6 @@
import "package:mime/mime.dart";
import 'dart:async';
import 'dart:math';
-import 'dart:isolate';
void testParse(String message,
String boundary,
diff --git a/pkg/mutation_observer/test/mutation_observer_test.dart b/pkg/mutation_observer/test/mutation_observer_test.dart
index c4c84e3e4..24dbccf 100644
--- a/pkg/mutation_observer/test/mutation_observer_test.dart
+++ b/pkg/mutation_observer/test/mutation_observer_test.dart
@@ -62,7 +62,7 @@
var mutationObserver = new MutationObserver(
(mutations, observer) { expect(false, isTrue,
reason: 'Should not be reached'); });
- expect(() { mutationObserver.observe(document, {}); },
+ expect(() { mutationObserver.observe(document); },
throws);
});
diff --git a/pkg/oauth2/lib/src/authorization_exception.dart b/pkg/oauth2/lib/src/authorization_exception.dart
index d48c3b1..2a19cd1 100644
--- a/pkg/oauth2/lib/src/authorization_exception.dart
+++ b/pkg/oauth2/lib/src/authorization_exception.dart
@@ -4,8 +4,6 @@
library authorization_exception;
-import 'dart:io';
-
/// An exception raised when OAuth2 authorization fails.
class AuthorizationException implements Exception {
/// The name of the error. Possible names are enumerated in [the spec][].
diff --git a/pkg/oauth2/lib/src/expiration_exception.dart b/pkg/oauth2/lib/src/expiration_exception.dart
index 8c8ad1f..9829de1 100644
--- a/pkg/oauth2/lib/src/expiration_exception.dart
+++ b/pkg/oauth2/lib/src/expiration_exception.dart
@@ -4,8 +4,6 @@
library expiration_exception;
-import 'dart:io';
-
import 'credentials.dart';
/// An exception raised when attempting to use expired OAuth2 credentials.
diff --git a/pkg/oauth2/lib/src/utils.dart b/pkg/oauth2/lib/src/utils.dart
index 759357e..12a429e 100644
--- a/pkg/oauth2/lib/src/utils.dart
+++ b/pkg/oauth2/lib/src/utils.dart
@@ -5,9 +5,6 @@
library utils;
import 'dart:async';
-import 'dart:isolate';
-
-import "package:crypto/crypto.dart";
/// Adds additional query parameters to [url], overwriting the original
/// parameters if a name conflict occurs.
diff --git a/pkg/oauth2/test/authorization_code_grant_test.dart b/pkg/oauth2/test/authorization_code_grant_test.dart
index 0d4a5fc..473fee1 100644
--- a/pkg/oauth2/test/authorization_code_grant_test.dart
+++ b/pkg/oauth2/test/authorization_code_grant_test.dart
@@ -5,12 +5,10 @@
library authorization_code_grant_test;
import 'dart:async';
-import 'dart:io';
import 'dart:json' as JSON;
import 'package:unittest/unittest.dart';
import 'package:http/http.dart' as http;
-import 'package:http/testing.dart';
import 'package:oauth2/oauth2.dart' as oauth2;
import 'utils.dart';
diff --git a/pkg/oauth2/test/client_test.dart b/pkg/oauth2/test/client_test.dart
index d55eef7..922302d 100644
--- a/pkg/oauth2/test/client_test.dart
+++ b/pkg/oauth2/test/client_test.dart
@@ -5,7 +5,6 @@
library client_test;
import 'dart:async';
-import 'dart:io';
import 'dart:json' as JSON;
import 'package:http/http.dart' as http;
diff --git a/pkg/oauth2/test/credentials_test.dart b/pkg/oauth2/test/credentials_test.dart
index 768b85a..6a873f2 100644
--- a/pkg/oauth2/test/credentials_test.dart
+++ b/pkg/oauth2/test/credentials_test.dart
@@ -5,7 +5,6 @@
library credentials_test;
import 'dart:async';
-import 'dart:io';
import 'dart:json' as JSON;
import 'package:http/http.dart' as http;
@@ -82,7 +81,7 @@
}), 200, headers: {'content-type': 'application/json'}));
});
-
+
expect(credentials.refresh('identifier', 'secret', httpClient: httpClient)
.then((credentials) {
expect(credentials.accessToken, equals('new access token'));
@@ -111,7 +110,7 @@
}), 200, headers: {'content-type': 'application/json'}));
});
-
+
expect(credentials.refresh('identifier', 'secret', httpClient: httpClient)
.then((credentials) {
expect(credentials.accessToken, equals('new access token'));
diff --git a/pkg/oauth2/test/handle_access_token_response_test.dart b/pkg/oauth2/test/handle_access_token_response_test.dart
index 45860ab..10e6f75 100644
--- a/pkg/oauth2/test/handle_access_token_response_test.dart
+++ b/pkg/oauth2/test/handle_access_token_response_test.dart
@@ -4,7 +4,6 @@
library handle_access_token_response_test;
-import 'dart:io';
import 'dart:json' as JSON;
import 'package:http/http.dart' as http;
diff --git a/pkg/observe/lib/observe.dart b/pkg/observe/lib/observe.dart
index 06136df..f2f8283 100644
--- a/pkg/observe/lib/observe.dart
+++ b/pkg/observe/lib/observe.dart
@@ -80,10 +80,6 @@
// above.
import 'src/dirty_check.dart';
-// TODO(jmesserly): should this be public? For now we're just using it inside
-// Polymer.
-import 'src/microtask.dart';
-
part 'src/change_notifier.dart';
part 'src/change_record.dart';
part 'src/compound_binding.dart';
diff --git a/pkg/observe/pubspec.yaml b/pkg/observe/pubspec.yaml
index 6479be6..77f2bc4 100644
--- a/pkg/observe/pubspec.yaml
+++ b/pkg/observe/pubspec.yaml
@@ -1,11 +1,13 @@
name: observe
-author: "Web UI Team <web-ui-dev@dartlang.org>"
-homepage: https://github.com/dart-lang/web-ui
+author: Web UI Team <web-ui-dev@dartlang.org>
description: >
Observable properties and objects for use in Model-Driven-Views (MDV).
MDV extends HTML and the DOM APIs to support a sensible separation between the
UI (DOM) of a document or application and its underlying data (model).
Updates to the model are reflected in the DOM and user input into the DOM is
immediately assigned to the model.
+homepage: https://github.com/dart-lang/web-ui
+dependencies:
+ logging: any
dev_dependencies:
unittest: any
diff --git a/pkg/observe/test/observe_test_utils.dart b/pkg/observe/test/observe_test_utils.dart
index fe3e869..2937c07 100644
--- a/pkg/observe/test/observe_test_utils.dart
+++ b/pkg/observe/test/observe_test_utils.dart
@@ -4,8 +4,6 @@
library observe.test.observe_test_utils;
-import 'dart:async';
-import 'package:observe/observe.dart';
import 'package:unittest/unittest.dart';
import 'package:observe/src/microtask.dart';
diff --git a/pkg/path/pubspec.yaml b/pkg/path/pubspec.yaml
index 35047ac..a366122 100644
--- a/pkg/path/pubspec.yaml
+++ b/pkg/path/pubspec.yaml
@@ -1,8 +1,10 @@
name: path
-author: "Dart Team <misc@dartlang.org>"
-homepage: http://www.dartlang.org
-documentation: http://api.dartlang.org/docs/pkg/path
+author: Dart Team <misc@dartlang.org>
description: >
A string-based path manipulation library. All of the path operations you know
and love, with solid support on both Windows and POSIX (Linux and Mac OS X)
machines.
+homepage: http://www.dartlang.org
+documentation: http://api.dartlang.org/docs/pkg/path
+dev_dependencies:
+ unittest: any
diff --git a/pkg/pkg.gyp b/pkg/pkg.gyp
index c06b517..3da13fc 100644
--- a/pkg/pkg.gyp
+++ b/pkg/pkg.gyp
@@ -13,6 +13,8 @@
'inputs': [
'../tools/make_links.py',
'<!@(["python", "../tools/list_pkg_directories.py", "."])',
+ '<!@(["python", "../tools/list_pkg_directories.py", '
+ '"../third_party/pkg"])',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
@@ -24,24 +26,6 @@
'<@(_inputs)',
],
},
- {
- 'action_name': 'make_third_party_packages',
- 'inputs': [
- '../tools/make_links.py',
- '<!@(["python", "../tools/list_pkg_directories.py", '
- '"../third_party/pkg"])',
- ],
- 'outputs': [
- '<(SHARED_INTERMEDIATE_DIR)/third_party_packages.stamp',
- ],
- 'action': [
- 'python', '../tools/make_links.py',
- '--timestamp_file=<(SHARED_INTERMEDIATE_DIR)/third_party_packages.'
- 'stamp',
- '<(PRODUCT_DIR)/packages',
- '<@(_inputs)',
- ],
- },
],
}
],
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 7eeb233..0c4304c 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -15,9 +15,14 @@
scheduled_test/test/scheduled_server_test: Pass, Fail, Slow, Crash # Issue 9231, 9582
scheduled_test/test/scheduled_process_test: Pass, Slow # Issue 9231
-[ $runtime == vm ]
-watcher/test/no_subscription_test: Pass, Fail # Issue 12107
-watcher/test/directory_watcher_test: Pass, Fail # Issue 12107
+[ $compiler == dart2js ]
+analyzer_experimental/test/generated/ast_test: Fail #Issue 12341
+
+[ $compiler == dart2js && ($runtime == d8 || $runtime == drt) ]
+crypto/test/hmac_sha256_test: Pass, Fail # v8 bug: Issue 12293
+crypto/test/sha1_test: Pass, Fail # v8 bug: Issue 12293
+crypto/test/sha256_test: Pass, Fail # v8 bug: Issue 12293
+path/test/relative_test: Pass, Fail # v8 bug: Issue 12293
[ $runtime == d8 || $runtime == jsshell ]
unittest/test/unittest_nested_groups_setup_teardown_test: Pass, Fail # http://dartbug.com/10109
@@ -40,6 +45,9 @@
intl/test/date_time_format_http_request_test: Fail # Issue 8983
mime/test/mime_multipart_transformer_test: Skip # No typed_data on IE9.
+[ $runtime == chrome && $compiler == dart2js ]
+intl/test/date_time_format_http_request_test: Pass, Fail # Issue: 12239
+
[ $runtime == safari ]
fixnum/test/int_64_test: Pass, Fail # Bug in JSC.
crypto/test/hmac_sha1_test: Fail # Issue 11407.
@@ -57,7 +65,6 @@
intl/test/message_extraction/message_extraction_test: Fail # Issue 9167
[ $compiler == dart2js ]
-analyzer_experimental/test/generated/ast_test: Fail, Slow # Issue 11230
stack_trace/test/trace_test: Pass, Timeout # Issue 11645
[ $compiler == dartanalyzer || $compiler == dart2analyzer]
@@ -107,6 +114,7 @@
intl/test/date_time_format_file_odd_test: Fail, OK # Uses dart:io.
intl/test/find_default_locale_standalone_test: Fail, OK # Uses dart:io.
intl/test/message_extraction/message_extraction_test: Fail, OK # Uses dart:io.
+intl/test/message_extraction/failed_extraction_test: Fail, OK # Users dart:io
oauth2/test/authorization_code_grant_test: Fail, OK # Uses dart:io.
oauth2/test/client_test: Fail, OK # Uses dart:io.
oauth2/test/credentials_test: Fail, OK # Uses dart:io.
@@ -168,7 +176,6 @@
# test on Dartium, which requires all tests to have a library.
[ $runtime == dartium || $runtime == drt ]
serialization/test/no_library_test: Skip # Expected Failure
-mdv/test/template_element_test: Pass, Fail # Issue 12177
# Skip tests on the VM if the package depends on dart:html
[ $runtime == vm ]
@@ -179,3 +186,6 @@
[ $runtime == safari || $runtime == chrome || $runtime == ie9 || $runtime == ff || $runtime == dartium || $runtime == drt ]
docgen/test/single_library_test: Skip # Uses dart:io
+[ $compiler == none && ($runtime == drt || $runtime == dartium) ]
+# TODO(vsm): Triage from latest Blink merge
+custom_element/test/custom_element_test: Skip
diff --git a/pkg/scheduled_test/lib/scheduled_server.dart b/pkg/scheduled_test/lib/scheduled_server.dart
index 293545b..8c1ad81 100644
--- a/pkg/scheduled_test/lib/scheduled_server.dart
+++ b/pkg/scheduled_test/lib/scheduled_server.dart
@@ -9,7 +9,6 @@
import 'dart:io';
import 'scheduled_test.dart';
-import 'src/utils.dart';
import 'src/scheduled_server/handler.dart';
import 'src/scheduled_server/safe_http_server.dart';
diff --git a/pkg/scheduled_test/lib/scheduled_test.dart b/pkg/scheduled_test/lib/scheduled_test.dart
index 05beb14..c91aad7 100644
--- a/pkg/scheduled_test/lib/scheduled_test.dart
+++ b/pkg/scheduled_test/lib/scheduled_test.dart
@@ -195,7 +195,6 @@
import 'src/schedule.dart';
import 'src/schedule_error.dart';
-import 'src/utils.dart';
export 'package:unittest/matcher.dart' hide completes, completion;
export 'package:unittest/unittest.dart' show
@@ -327,7 +326,7 @@
_setUpFn = setUpFn;
}
});
-
+
unittest.tearDown(() {
_currentSchedule = null;
_setUpFn = null;
diff --git a/pkg/scheduled_test/lib/src/descriptor/async_descriptor.dart b/pkg/scheduled_test/lib/src/descriptor/async_descriptor.dart
index e46e17b..95eff42 100644
--- a/pkg/scheduled_test/lib/src/descriptor/async_descriptor.dart
+++ b/pkg/scheduled_test/lib/src/descriptor/async_descriptor.dart
@@ -5,11 +5,9 @@
library descriptor.async;
import 'dart:async';
-import 'dart:io' as io;
import '../../descriptor.dart';
import '../../scheduled_test.dart';
-import '../utils.dart';
/// A descriptor that wraps a [Future<Descriptor>] and forwards all asynchronous
/// operations to the result of the future. It's designed for use when the full
diff --git a/pkg/scheduled_test/lib/src/descriptor/descriptor.dart b/pkg/scheduled_test/lib/src/descriptor/descriptor.dart
index 82342c4..2be0b59 100644
--- a/pkg/scheduled_test/lib/src/descriptor/descriptor.dart
+++ b/pkg/scheduled_test/lib/src/descriptor/descriptor.dart
@@ -6,8 +6,6 @@
import 'dart:async';
-import '../utils.dart';
-
/// The base class for various declarative descriptions of filesystem entries.
/// All asynchronous operations on descriptors are [schedule]d unless otherwise
/// noted.
diff --git a/pkg/scheduled_test/lib/src/descriptor/nothing_descriptor.dart b/pkg/scheduled_test/lib/src/descriptor/nothing_descriptor.dart
index 483a9cf..8a80be2 100644
--- a/pkg/scheduled_test/lib/src/descriptor/nothing_descriptor.dart
+++ b/pkg/scheduled_test/lib/src/descriptor/nothing_descriptor.dart
@@ -11,7 +11,6 @@
import '../../descriptor.dart';
import '../../scheduled_test.dart';
-import '../utils.dart';
/// A descriptor that validates that no file exists with the given name.
/// Creating this descriptor is a no-op and loading from it is invalid.
diff --git a/pkg/scheduled_test/lib/src/schedule.dart b/pkg/scheduled_test/lib/src/schedule.dart
index 9fecc99..ab21150 100644
--- a/pkg/scheduled_test/lib/src/schedule.dart
+++ b/pkg/scheduled_test/lib/src/schedule.dart
@@ -8,14 +8,12 @@
import 'dart:collection';
import 'package:stack_trace/stack_trace.dart';
-import 'package:unittest/unittest.dart' as unittest;
import 'mock_clock.dart' as mock_clock;
import 'schedule_error.dart';
import 'substitute_future.dart';
import 'task.dart';
import 'utils.dart';
-import 'value_future.dart';
/// The schedule of tasks to run for a single test. This has three separate task
/// queues: [tasks], [onComplete], and [onException]. It also provides
diff --git a/pkg/scheduled_test/lib/src/scheduled_server/handler.dart b/pkg/scheduled_test/lib/src/scheduled_server/handler.dart
index 4d6c6b8..8f61be1 100644
--- a/pkg/scheduled_test/lib/src/scheduled_server/handler.dart
+++ b/pkg/scheduled_test/lib/src/scheduled_server/handler.dart
@@ -5,7 +5,6 @@
library scheduled_server.handler;
import 'dart:async';
-import 'dart:io';
import '../../scheduled_server.dart';
import '../../scheduled_test.dart';
diff --git a/pkg/scheduled_test/lib/src/task.dart b/pkg/scheduled_test/lib/src/task.dart
index 44f6833..8d0ec18 100644
--- a/pkg/scheduled_test/lib/src/task.dart
+++ b/pkg/scheduled_test/lib/src/task.dart
@@ -9,7 +9,6 @@
import 'package:stack_trace/stack_trace.dart';
-import '../scheduled_test.dart' show currentSchedule;
import 'future_group.dart';
import 'schedule.dart';
import 'utils.dart';
diff --git a/pkg/scheduled_test/test/descriptor/async_test.dart b/pkg/scheduled_test/test/descriptor/async_test.dart
index 46f5ef3..b4fde98 100644
--- a/pkg/scheduled_test/test/descriptor/async_test.dart
+++ b/pkg/scheduled_test/test/descriptor/async_test.dart
@@ -3,9 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
-import 'package:path/path.dart' as path;
import 'package:scheduled_test/descriptor.dart' as d;
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/descriptor/file_test.dart b/pkg/scheduled_test/test/descriptor/file_test.dart
index bf22905..e22a992 100644
--- a/pkg/scheduled_test/test/descriptor/file_test.dart
+++ b/pkg/scheduled_test/test/descriptor/file_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 'dart:io';
import 'package:path/path.dart' as path;
diff --git a/pkg/scheduled_test/test/descriptor/nothing_test.dart b/pkg/scheduled_test/test/descriptor/nothing_test.dart
index f925dcb..5d14592 100644
--- a/pkg/scheduled_test/test/descriptor/nothing_test.dart
+++ b/pkg/scheduled_test/test/descriptor/nothing_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 'dart:io';
import 'package:path/path.dart' as path;
diff --git a/pkg/scheduled_test/test/descriptor/pattern_test.dart b/pkg/scheduled_test/test/descriptor/pattern_test.dart
index 04dd3e5..7bd33a3 100644
--- a/pkg/scheduled_test/test/descriptor/pattern_test.dart
+++ b/pkg/scheduled_test/test/descriptor/pattern_test.dart
@@ -2,10 +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 'dart:io';
-
-import 'package:path/path.dart' as path;
import 'package:scheduled_test/descriptor.dart' as d;
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/scheduled_future_matchers_test.dart b/pkg/scheduled_test/test/scheduled_future_matchers_test.dart
index bd253ba..e1e3699 100644
--- a/pkg/scheduled_test/test/scheduled_future_matchers_test.dart
+++ b/pkg/scheduled_test/test/scheduled_future_matchers_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/scheduled_process_test.dart b/pkg/scheduled_test/test/scheduled_process_test.dart
index 85f6eae..b855e02 100644
--- a/pkg/scheduled_test/test/scheduled_process_test.dart
+++ b/pkg/scheduled_test/test/scheduled_process_test.dart
@@ -10,7 +10,6 @@
import 'package:path/path.dart' as path;
import 'package:scheduled_test/scheduled_process.dart';
import 'package:scheduled_test/scheduled_test.dart';
-import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
import 'metatest.dart';
import 'utils.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/abort_test.dart b/pkg/scheduled_test/test/scheduled_test/abort_test.dart
index 7fc8b1a..ef313a1 100644
--- a/pkg/scheduled_test/test/scheduled_test/abort_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/abort_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/current_schedule_current_task_test.dart b/pkg/scheduled_test/test/scheduled_test/current_schedule_current_task_test.dart
index 5dc3361..ab8a19e 100644
--- a/pkg/scheduled_test/test/scheduled_test/current_schedule_current_task_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/current_schedule_current_task_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/current_schedule_errors_test.dart b/pkg/scheduled_test/test/scheduled_test/current_schedule_errors_test.dart
index 4766b43..e372cc6 100644
--- a/pkg/scheduled_test/test/scheduled_test/current_schedule_errors_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/current_schedule_errors_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/scheduled_test/current_schedule_state_test.dart b/pkg/scheduled_test/test/scheduled_test/current_schedule_state_test.dart
index 0c40ff9..15ddf29 100644
--- a/pkg/scheduled_test/test/scheduled_test/current_schedule_state_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/current_schedule_state_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.
-import 'dart:async';
-import 'dart:io';
-
import 'package:scheduled_test/scheduled_test.dart';
import '../metatest.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/nested_task_test.dart b/pkg/scheduled_test/test/scheduled_test/nested_task_test.dart
index 047cd3b..f4f8924 100644
--- a/pkg/scheduled_test/test/scheduled_test/nested_task_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/nested_task_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/scheduled_test/on_complete_test.dart b/pkg/scheduled_test/test/scheduled_test/on_complete_test.dart
index 2c37da5..f9a02b9 100644
--- a/pkg/scheduled_test/test/scheduled_test/on_complete_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/on_complete_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/on_exception_test.dart b/pkg/scheduled_test/test/scheduled_test/on_exception_test.dart
index 3e98864..8a97038 100644
--- a/pkg/scheduled_test/test/scheduled_test/on_exception_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/on_exception_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/out_of_band_task_test.dart b/pkg/scheduled_test/test/scheduled_test/out_of_band_task_test.dart
index 35bd68e..b3cc1b6 100644
--- a/pkg/scheduled_test/test/scheduled_test/out_of_band_task_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/out_of_band_task_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/scheduled_test/set_up_test.dart b/pkg/scheduled_test/test/scheduled_test/set_up_test.dart
index 5462f51..7d6c538 100644
--- a/pkg/scheduled_test/test/scheduled_test/set_up_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/set_up_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.
-import 'dart:async';
-import 'dart:io';
-
import 'package:scheduled_test/scheduled_test.dart';
import '../metatest.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/signal_error_test.dart b/pkg/scheduled_test/test/scheduled_test/signal_error_test.dart
index ba52515..395157f 100644
--- a/pkg/scheduled_test/test/scheduled_test/signal_error_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/signal_error_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/scheduled_test/simple_test.dart b/pkg/scheduled_test/test/scheduled_test/simple_test.dart
index 8c67bf3..7cf83ec 100644
--- a/pkg/scheduled_test/test/scheduled_test/simple_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/simple_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/scheduled_test/test/scheduled_test/task_return_value_test.dart b/pkg/scheduled_test/test/scheduled_test/task_return_value_test.dart
index e597167..b935dd7 100644
--- a/pkg/scheduled_test/test/scheduled_test/task_return_value_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/task_return_value_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/scheduled_test/timeout_test.dart b/pkg/scheduled_test/test/scheduled_test/timeout_test.dart
index ffcf32f..a14063a 100644
--- a/pkg/scheduled_test/test/scheduled_test/timeout_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/timeout_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/scheduled_test/wrap_async_test.dart b/pkg/scheduled_test/test/scheduled_test/wrap_async_test.dart
index 322e17f..a83d66a 100644
--- a/pkg/scheduled_test/test/scheduled_test/wrap_async_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/wrap_async_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/scheduled_test/wrap_future_test.dart b/pkg/scheduled_test/test/scheduled_test/wrap_future_test.dart
index 2a44cc5..add75ee 100644
--- a/pkg/scheduled_test/test/scheduled_test/wrap_future_test.dart
+++ b/pkg/scheduled_test/test/scheduled_test/wrap_future_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io' hide sleep;
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
diff --git a/pkg/scheduled_test/test/utils.dart b/pkg/scheduled_test/test/utils.dart
index a52b137..88c0fa3 100644
--- a/pkg/scheduled_test/test/utils.dart
+++ b/pkg/scheduled_test/test/utils.dart
@@ -4,7 +4,6 @@
library test_utils;
-import 'dart:io';
import 'dart:async';
import 'package:scheduled_test/scheduled_test.dart';
diff --git a/pkg/serialization/lib/serialization.dart b/pkg/serialization/lib/serialization.dart
index 5ec329d..2205181b 100644
--- a/pkg/serialization/lib/serialization.dart
+++ b/pkg/serialization/lib/serialization.dart
@@ -207,8 +207,6 @@
import 'src/mirrors_helpers.dart';
import 'src/serialization_helpers.dart';
-import 'dart:async';
-import 'dart:json' as json;
import 'dart:collection';
part 'src/reader_writer.dart';
diff --git a/pkg/serialization/test/serialization_test.dart b/pkg/serialization/test/serialization_test.dart
index 3c20605..abf0d2d 100644
--- a/pkg/serialization/test/serialization_test.dart
+++ b/pkg/serialization/test/serialization_test.dart
@@ -248,7 +248,7 @@
} else {
s = null;
return new Serialization.blank()
- ..namedObjects['Node'] = reflect(new Node('')).type;;
+ ..namedObjects['Node'] = reflect(new Node('')).type;
}
}
diff --git a/pkg/shadow_dom/lib/shadow_dom.debug.js b/pkg/shadow_dom/lib/shadow_dom.debug.js
index bd4252d..4ea1ab8 100644
--- a/pkg/shadow_dom/lib/shadow_dom.debug.js
+++ b/pkg/shadow_dom/lib/shadow_dom.debug.js
@@ -1437,10 +1437,19 @@
// This only wraps, it therefore only operates on the composed DOM and not
// the logical DOM.
return originalCompareDocumentPosition.call(this.impl, unwrap(otherNode));
+ },
+
+ // TODO(jmesserly): this is a workaround for
+ // https://github.com/Polymer/ShadowDOM/issues/200
+ get ownerDocument() {
+ scope.renderAllPending();
+ return wrap(this.impl.ownerDocument);
}
});
- defineWrapGetter(Node, 'ownerDocument');
+ // TODO(jmesserly): this is commented out to workaround:
+ // https://github.com/Polymer/ShadowDOM/issues/200
+ //defineWrapGetter(Node, 'ownerDocument');
// We use a DocumentFragment as a base and then delete the properties of
// DocumentFragment.prototype from the wrapper Node. Since delete makes
diff --git a/pkg/shadow_dom/lib/shadow_dom.min.js b/pkg/shadow_dom/lib/shadow_dom.min.js
index 8606fcf..e9d570e 100644
--- a/pkg/shadow_dom/lib/shadow_dom.min.js
+++ b/pkg/shadow_dom/lib/shadow_dom.min.js
@@ -1,2 +1,2 @@
-if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateShadowRoot||window.__forceShadowDomPolyfill){!function(){Element.prototype.webkitCreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return window.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})}();var SideTable;"undefined"!=typeof WeakMap&&navigator.userAgent.indexOf("Firefox/")<0?SideTable=WeakMap:function(){var a=Object.defineProperty,b=Object.hasOwnProperty,c=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(c++ +"__")},SideTable.prototype={set:function(b,c){a(b,this.name,{value:c,writable:!0})},get:function(a){return b.call(a,this.name)?a[this.name]:void 0},"delete":function(a){this.set(a,void 0)}}}();var ShadowDOMPolyfill={};!function(a){"use strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function d(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){switch(c){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":return}Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function e(a){var b=a.__proto__||Object.getPrototypeOf(a),c=y.get(b);if(c)return c;var d=e(b),f=m(d);return j(b,f,a),f}function f(a,b){h(a,b,!0)}function g(a,b){h(b,a,!1)}function h(a,b,c){Object.getOwnPropertyNames(a).forEach(function(d){if(!(d in b)){A&&a.__lookupGetter__(d);var e;try{e=Object.getOwnPropertyDescriptor(a,d)}catch(f){e=B}var g,h;if(c&&"function"==typeof e.value)return b[d]=function(){return this.impl[d].apply(this.impl,arguments)},void 0;g=function(){return this.impl[d]},(e.writable||e.set)&&(h=function(a){this.impl[d]=a}),Object.defineProperty(b,d,{get:g,set:h,configurable:e.configurable,enumerable:e.enumerable})}})}function i(a,b,c){var e=a.prototype;j(e,b,c),d(b,a)}function j(a,c,d){var e=c.prototype;b(void 0===y.get(a)),y.set(a,c),f(a,e),d&&g(e,d)}function k(a,b){return y.get(b.prototype)===a}function l(a){var b=Object.getPrototypeOf(a),c=e(b),d=m(c);return j(b,d,a),d}function m(a){function b(b){a.call(this,b)}return b.prototype=Object.create(a.prototype),b.prototype.constructor=b,b._ShadowDOMPolyfill$isGeneratedWrapper=!0,b}function n(a){return a instanceof z.EventTarget||a instanceof z.Event||a instanceof z.DOMImplementation}function o(a){return a instanceof E||a instanceof D||a instanceof F||a instanceof C}function p(a){if(null===a)return null;b(o(a));var c=x.get(a);if(!c){var d=e(a);c=new d(a),x.set(a,c)}return c}function q(a){return null===a?null:(b(n(a)),a.impl)}function r(a){return a&&n(a)?q(a):a}function s(a){return a&&!n(a)?p(a):a}function t(a,c){null!==c&&(b(o(a)),b(void 0===c||n(c)),x.set(a,c))}function u(a,b,c){Object.defineProperty(a.prototype,b,{get:c,configurable:!0,enumerable:!0})}function v(a,b){u(a,b,function(){return p(this.impl[b])})}function w(a,b){a.forEach(function(a){b.forEach(function(b){a.prototype[b]=function(){var a=p(this);return a[b].apply(a,arguments)}})})}var x=new SideTable,y=new SideTable,z=Object.create(null);Object.getOwnPropertyNames(window);var A=/Firefox/.test(navigator.userAgent),B={get:function(){},set:function(){},configurable:!0,enumerable:!0},C=DOMImplementation,D=Event,E=Node,F=Window;a.assert=b,a.defineGetter=u,a.defineWrapGetter=v,a.forwardMethodsToWrapper=w,a.isWrapper=n,a.isWrapperFor=k,a.mixin=c,a.registerObject=l,a.registerWrapper=i,a.rewrap=t,a.unwrap=q,a.unwrapIfNeeded=r,a.wrap=p,a.wrapIfNeeded=s,a.wrappers=z}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){return a instanceof J.ShadowRoot}function c(a){var b=a.localName;return"content"===b||"shadow"===b}function d(a){return!!a.shadowRoot}function e(a){var b;return a.parentNode||(b=a.defaultView)&&I(b)||null}function f(f,g,h){if(h.length)return h.shift();if(b(f))return f.insertionParent||a.getHostForShadowRoot(f);var i=a.eventParentsTable.get(f);if(i){for(var j=1;j<i.length;j++)h[j-1]=i[j];return i[0]}if(g&&c(f)){var k=f.parentNode;if(k&&d(k))for(var l=a.getShadowTrees(k),m=g.insertionParent,j=0;j<l.length;j++)if(l[j].contains(m))return m}return e(f)}function g(a){for(var d=[],e=a,g=[],i=[];e;){var j=null;if(c(e)){j=h(d);var k=d[d.length-1]||e;d.push(k)}else d.length||d.push(e);var l=d[d.length-1];g.push({target:l,currentTarget:e}),b(e)&&d.pop(),e=f(e,j,i)}return g}function h(a){for(var b=a.length-1;b>=0;b--)if(!c(a[b]))return a[b];return null}function i(d,e){for(var g=[];d;){for(var i=[],k=e,m=void 0;k;){var n=null;if(i.length){if(c(k)&&(n=h(i),j(m))){var o=i[i.length-1];i.push(o)}}else i.push(k);if(l(k,d))return i[i.length-1];b(k)&&i.pop(),m=k,k=f(k,n,g)}d=b(d)?a.getHostForShadowRoot(d):d.parentNode}}function j(a){return a.insertionParent}function k(a){for(var b;b=a.parentNode;)a=b;return a}function l(a,b){return k(a)===k(b)}function m(a){switch(a){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function n(b){if(!L.get(b)){L.set(b,!0),m(b.type)||a.renderAllPending();var c=I(b.target),d=I(b);return o(d,c)}}function o(a,b){var c=g(b);return"load"===a.type&&2===c.length&&c[0].target instanceof J.Document&&c.shift(),p(a,c)&&q(a,c)&&r(a,c),P.set(a,u.NONE),N.set(a,null),a.defaultPrevented}function p(a,b){for(var c,d=b.length-1;d>0;d--){var e=b[d].target,f=b[d].currentTarget;if(e!==f&&(c=u.CAPTURING_PHASE,!s(b[d],a,c)))return!1}return!0}function q(a,b){var c=u.AT_TARGET;return s(b[0],a,c)}function r(a,b){for(var c,d=a.bubbles,e=1;e<b.length;e++){var f=b[e].target,g=b[e].currentTarget;if(f===g)c=u.AT_TARGET;else{if(!d||R.get(a))continue;c=u.BUBBLING_PHASE}if(!s(b[e],a,c))return}}function s(a,b,c){var d=a.target,e=a.currentTarget,f=K.get(e);if(!f)return!0;if("relatedTarget"in b){var g=H(b),h=I(g.relatedTarget),j=i(e,h);if(j===d)return!0;O.set(b,j)}P.set(b,c);var k=b.type,l=!1;M.set(b,d),N.set(b,e);for(var m=0;m<f.length;m++){var n=f[m];if(n.removed)l=!0;else if(!(n.type!==k||!n.capture&&c===u.CAPTURING_PHASE||n.capture&&c===u.BUBBLING_PHASE))try{if("function"==typeof n.handler?n.handler.call(e,b):n.handler.handleEvent(b),R.get(b))return!1}catch(o){window.onerror?window.onerror(o.message):console.error(o)}}if(l){var p=f.slice();f.length=0;for(var m=0;m<p.length;m++)p[m].removed||f.push(p[m])}return!Q.get(b)}function t(a,b,c){this.type=a,this.handler=b,this.capture=Boolean(c)}function u(a,b){return a instanceof S?(this.impl=a,void 0):I(y(S,"Event",a,b))}function v(a){return a&&a.relatedTarget?Object.create(a,{relatedTarget:{value:H(a.relatedTarget)}}):a}function w(a,b,c){var d=window[a],e=function(b,c){return b instanceof d?(this.impl=b,void 0):I(y(d,a,b,c))};return e.prototype=Object.create(b.prototype),c&&F(e.prototype,c),d&&G(d,e,document.createEvent(a)),e}function x(a,b){return function(){arguments[b]=H(arguments[b]);var c=H(this);c[a].apply(c,arguments)}}function y(a,b,c,d){if(ab)return new a(c,v(d));var e=H(document.createEvent(b)),f=_[b],g=[c];return Object.keys(f).forEach(function(a){var b=null!=d&&a in d?d[a]:f[a];"relatedTarget"===a&&(b=H(b)),g.push(b)}),e["init"+b].apply(e,g),e}function z(a){return"function"==typeof a?!0:a&&a.handleEvent}function A(a){this.impl=a}function B(b){return b instanceof J.ShadowRoot&&(b=a.getHostForShadowRoot(b)),H(b)}function C(a){E(a,db)}function D(b,c,d,e){a.renderAllPending();for(var f=I(eb.call(c.impl,d,e)),h=g(f,this),i=0;i<h.length;i++){var j=h[i];if(j.currentTarget===b)return j.target}return null}var E=a.forwardMethodsToWrapper,F=a.mixin,G=a.registerWrapper,H=a.unwrap,I=a.wrap,J=a.wrappers;new SideTable;var K=new SideTable,L=new SideTable,M=new SideTable,N=new SideTable,O=new SideTable,P=new SideTable,Q=new SideTable,R=new SideTable;t.prototype={equals:function(a){return this.handler===a.handler&&this.type===a.type&&this.capture===a.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var S=window.Event;u.prototype={get target(){return M.get(this)},get currentTarget(){return N.get(this)},get eventPhase(){return P.get(this)},stopPropagation:function(){Q.set(this,!0)},stopImmediatePropagation:function(){Q.set(this,!0),R.set(this,!0)}},G(S,u,document.createEvent("Event"));var T=w("UIEvent",u),U=w("CustomEvent",u),V={get relatedTarget(){return O.get(this)||I(H(this).relatedTarget)}},W=F({initMouseEvent:x("initMouseEvent",14)},V),X=F({initFocusEvent:x("initFocusEvent",5)},V),Y=w("MouseEvent",T,W),Z=w("FocusEvent",T,X),$=w("MutationEvent",u,{initMutationEvent:x("initMutationEvent",3),get relatedNode(){return I(this.impl.relatedNode)}}),_=Object.create(null),ab=function(){try{new window.MouseEvent("click")}catch(a){return!1}return!0}();if(!ab){var bb=function(a,b,c){if(c){var d=_[c];b=F(F({},d),b)}_[a]=b};bb("Event",{bubbles:!1,cancelable:!1}),bb("CustomEvent",{detail:null},"Event"),bb("UIEvent",{view:null,detail:0},"Event"),bb("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),bb("FocusEvent",{relatedTarget:null},"UIEvent")}var cb=window.EventTarget,db=["addEventListener","removeEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(a){var b=a.prototype;db.forEach(function(a){Object.defineProperty(b,a+"_",{value:b[a]})})}),A.prototype={addEventListener:function(a,b,c){if(z(b)){var d=new t(a,b,c),e=K.get(this);if(e){for(var f=0;f<e.length;f++)if(d.equals(e[f]))return}else e=[],K.set(this,e);e.push(d);var g=B(this);g.addEventListener_(a,n,!0)}},removeEventListener:function(a,b,c){c=Boolean(c);var d=K.get(this);if(d){for(var e=0,f=!1,g=0;g<d.length;g++)d[g].type===a&&d[g].capture===c&&(e++,d[g].handler===b&&(f=!0,d[g].remove()));if(f&&1===e){var h=B(this);h.removeEventListener_(a,n,!0)}}},dispatchEvent:function(b){a.renderAllPending();var c=B(this);return c.dispatchEvent_(H(b))}},cb&&G(cb,A);var eb=document.elementFromPoint;a.adjustRelatedTarget=i,a.elementFromPoint=D,a.wrapEventTargetMethods=C,a.wrappers.CustomEvent=U,a.wrappers.Event=u,a.wrappers.EventTarget=A,a.wrappers.FocusEvent=Z,a.wrappers.MouseEvent=Y,a.wrappers.MutationEvent=$,a.wrappers.UIEvent=T}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,b){Object.defineProperty(a,b,{enumerable:!1})}function c(){this.length=0,b(this,"length")}function d(a){if(null==a)return a;for(var b=new c,d=0,e=a.length;e>d;d++)b[d]=f(a[d]);return b.length=e,b}function e(a,b){a.prototype[b]=function(){return d(this.impl[b].apply(this.impl,arguments))}}var f=a.wrap;c.prototype={item:function(a){return this[a]}},b(c.prototype,"item"),a.wrappers.NodeList=c,a.addWrapNodeListMethod=e,a.wrapNodeList=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){j(a instanceof f)}function c(a,b,c,d){if(a.nodeType!==f.DOCUMENT_FRAGMENT_NODE)return a.parentNode&&a.parentNode.removeChild(a),a.parentNode_=b,a.previousSibling_=c,a.nextSibling_=d,c&&(c.nextSibling_=a),d&&(d.previousSibling_=a),[a];for(var e,g=[];e=a.firstChild;)a.removeChild(e),g.push(e),e.parentNode_=b;for(var h=0;h<g.length;h++)g[h].previousSibling_=g[h-1]||c,g[h].nextSibling_=g[h+1]||d;return c&&(c.nextSibling_=g[0]),d&&(d.previousSibling_=g[g.length-1]),g}function d(a){if(1===a.length)return m(a[0]);for(var b=m(document.createDocumentFragment()),c=0;c<a.length;c++)b.appendChild(m(a[c]));return b}function e(a){for(var b=a.firstChild;b;){j(b.parentNode===a);var c=b.nextSibling,d=m(b),e=d.parentNode;e&&s.call(e,d),b.previousSibling_=b.nextSibling_=b.parentNode_=null,b=c}a.firstChild_=a.lastChild_=null}function f(a){j(a instanceof o),g.call(this,a),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0}var g=a.wrappers.EventTarget,h=a.wrappers.NodeList,i=a.defineWrapGetter,j=a.assert,k=a.mixin,l=a.registerWrapper,m=a.unwrap,n=a.wrap,o=window.Node,p=o.prototype.appendChild,q=o.prototype.insertBefore,r=o.prototype.replaceChild,s=o.prototype.removeChild,t=o.prototype.compareDocumentPosition;f.prototype=Object.create(g.prototype),k(f.prototype,{appendChild:function(a){b(a),this.invalidateShadowRenderer();var e=this.lastChild,f=null,g=c(a,this,e,f);return this.lastChild_=g[g.length-1],e||(this.firstChild_=g[0]),p.call(this.impl,d(g)),a},insertBefore:function(a,e){if(!e)return this.appendChild(a);b(a),b(e),j(e.parentNode===this),this.invalidateShadowRenderer();var f=e.previousSibling,g=e,h=c(a,this,f,g);this.firstChild===e&&(this.firstChild_=h[0]);var i=m(e),k=i.parentNode;return k&&q.call(k,d(h),i),a},removeChild:function(a){if(b(a),a.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var c=this.firstChild,d=this.lastChild,e=a.nextSibling,f=a.previousSibling,g=m(a),h=g.parentNode;return h&&s.call(h,g),c===a&&(this.firstChild_=e),d===a&&(this.lastChild_=f),f&&(f.nextSibling_=e),e&&(e.previousSibling_=f),a.previousSibling_=a.nextSibling_=a.parentNode_=null,a},replaceChild:function(a,e){if(b(a),b(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var f=e.previousSibling,g=e.nextSibling;g===a&&(g=a.nextSibling);var h=c(a,this,f,g);this.firstChild===e&&(this.firstChild_=h[0]),this.lastChild===e&&(this.lastChild_=h[h.length-1]),e.previousSibling_=null,e.nextSibling_=null,e.parentNode_=null;var i=m(e);return i.parentNode&&r.call(i.parentNode,d(h),i),e},hasChildNodes:function(){return null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:n(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:n(this.impl.firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:n(this.impl.lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:n(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:n(this.impl.previousSibling)},get parentElement(){for(var a=this.parentNode;a&&a.nodeType!==f.ELEMENT_NODE;)a=a.parentNode;return a},get textContent(){for(var a="",b=this.firstChild;b;b=b.nextSibling)a+=b.textContent;return a},set textContent(a){if(e(this),this.invalidateShadowRenderer(),""!==a){var b=this.impl.ownerDocument.createTextNode(a);this.appendChild(b)}},get childNodes(){for(var a=new h,b=0,c=this.firstChild;c;c=c.nextSibling)a[b++]=c;return a.length=b,a},cloneNode:function(a){if(!this.invalidateShadowRenderer())return n(this.impl.cloneNode(a));var b=n(this.impl.cloneNode(!1));if(a)for(var c=this.firstChild;c;c=c.nextSibling)b.appendChild(c.cloneNode(!0));return b},contains:function(a){if(!a)return!1;if(a===this)return!0;var b=a.parentNode;return b?this.contains(b):!1},compareDocumentPosition:function(a){return t.call(this.impl,m(a))}}),i(f,"ownerDocument"),l(o,f,document.createDocumentFragment()),delete f.prototype.querySelector,delete f.prototype.querySelectorAll,f.prototype=k(Object.create(g.prototype),f.prototype),a.wrappers.Node=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,c){for(var d,e=a.firstElementChild;e;){if(e.matches(c))return e;if(d=b(e,c))return d;e=e.nextElementSibling}return null}function c(a,b,d){for(var e=a.firstElementChild;e;)e.matches(b)&&(d[d.length++]=e),c(e,b,d),e=e.nextElementSibling;return d}var d={querySelector:function(a){return b(this,a)},querySelectorAll:function(a){return c(this,a,new NodeList)}},e={getElementsByTagName:function(a){return this.querySelectorAll(a)},getElementsByClassName:function(a){return this.querySelectorAll("."+a)},getElementsByTagNameNS:function(a,b){if("*"===a)return this.getElementsByTagName(b);for(var c=new NodeList,d=this.getElementsByTagName(b),e=0,f=0;e<d.length;e++)d[e].namespaceURI===a&&(c[f++]=d[e]);return c.length=f,c}};a.GetElementsByInterface=e,a.SelectorsInterface=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}function c(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}var d=a.wrappers.NodeList,e={get firstElementChild(){return b(this.firstChild)},get lastElementChild(){return c(this.lastChild)},get childElementCount(){for(var a=0,b=this.firstElementChild;b;b=b.nextElementSibling)a++;return a},get children(){for(var a=new d,b=0,c=this.firstElementChild;c;c=c.nextElementSibling)a[b++]=c;return a.length=b,a}},f={get nextElementSibling(){return b(this.nextSibling)},get previousElementSibling(){return c(this.nextSibling)}};a.ChildNodeInterface=f,a.ParentNodeInterface=e}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){d.call(this,a)}var c=a.ChildNodeInterface,d=a.wrappers.Node,e=a.mixin,f=a.registerWrapper,g=window.CharacterData;b.prototype=Object.create(d.prototype),e(b.prototype,{get textContent(){return this.data},set textContent(a){this.data=a}}),e(b.prototype,c),f(g,b,document.createTextNode("")),a.wrappers.CharacterData=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){e.call(this,a)}var c=a.ChildNodeInterface,d=a.GetElementsByInterface,e=a.wrappers.Node,f=a.ParentNodeInterface,g=a.SelectorsInterface;a.addWrapNodeListMethod;var h=a.mixin,i=a.registerWrapper,j=a.wrappers,k=new SideTable,l=window.Element,m=l.prototype.matches||l.prototype.mozMatchesSelector||l.prototype.msMatchesSelector||l.prototype.webkitMatchesSelector;b.prototype=Object.create(e.prototype),h(b.prototype,{createShadowRoot:function(){var b=new j.ShadowRoot(this);return k.set(this,b),a.getRendererForHost(this),this.invalidateShadowRenderer(!0),b},get shadowRoot(){return k.get(this)||null},setAttribute:function(a,b){this.impl.setAttribute(a,b),this.invalidateShadowRenderer()},matches:function(a){return m.call(this.impl,a)}}),h(b.prototype,c),h(b.prototype,d),h(b.prototype,f),h(b.prototype,g),i(l,b),a.wrappers.Element=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a){case"&":return"&";case"<":return"<";case'"':return"""}}function c(a){return a.replace(p,b)}function d(a){switch(a.nodeType){case Node.ELEMENT_NODE:for(var b,d=a.tagName.toLowerCase(),f="<"+d,g=a.attributes,h=0;b=g[h];h++)f+=" "+b.name+'="'+c(b.value)+'"';return f+=">",q[d]?f:f+e(a)+"</"+d+">";case Node.TEXT_NODE:return c(a.nodeValue);case Node.COMMENT_NODE:return"<!--"+c(a.nodeValue)+"-->";default:throw console.error(a),new Error("not implemented")}}function e(a){for(var b="",c=a.firstChild;c;c=c.nextSibling)b+=d(c);return b}function f(a,b,c){var d=c||"div";a.textContent="";var e=n(a.ownerDocument.createElement(d));e.innerHTML=b;for(var f;f=e.firstChild;)a.appendChild(o(f))}function g(a){j.call(this,a)}function h(b){k(g,b,function(){return a.renderAllPending(),this.impl[b]})}function i(b){Object.defineProperty(g.prototype,b,{value:function(){return a.renderAllPending(),this.impl[b].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var j=a.wrappers.Element,k=a.defineGetter,l=a.mixin,m=a.registerWrapper,n=a.unwrap,o=a.wrap,p=/&|<|"/g,q={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},r=window.HTMLElement;g.prototype=Object.create(j.prototype),l(g.prototype,{get innerHTML(){return e(this)},set innerHTML(a){f(this,a,this.tagName)},get outerHTML(){return d(this)},set outerHTML(a){if(this.invalidateShadowRenderer())throw new Error("not implemented");this.impl.outerHTML=a}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(h),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(i),m(r,g,document.createElement("b")),a.wrappers.HTMLElement=g,a.getInnerHTML=e,a.setInnerHTML=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLContentElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get select(){return this.getAttribute("select")},set select(a){this.setAttribute("select",a)},setAttribute:function(a,b){c.prototype.setAttribute.call(this,a,b),"select"===String(a).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),f&&e(f,b),a.wrappers.HTMLContentElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a),this.olderShadowRoot_=null}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLShadowElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRenderer:function(){c.prototype.invalidateShadowRenderer.call(this,!0)}}),f&&e(f,b),a.wrappers.HTMLShadowElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){if(!a.defaultView)return a;var b=l.get(a);if(!b){for(b=a.implementation.createHTMLDocument("");b.lastChild;)b.removeChild(b.lastChild);l.set(a,b)}return b}function c(a){for(var c,d=b(a.ownerDocument),e=d.createDocumentFragment();c=a.firstChild;)e.appendChild(c);return e}function d(a){e.call(this,a)}var e=a.wrappers.HTMLElement,f=a.getInnerHTML,g=a.mixin,h=a.registerWrapper,i=a.setInnerHTML,j=a.wrap,k=new SideTable,l=new SideTable,m=window.HTMLTemplateElement;d.prototype=Object.create(e.prototype),g(d.prototype,{get content(){if(m)return j(this.impl.content);var a=k.get(this);return a||(a=c(this),k.set(this,a)),a},get innerHTML(){return f(this.content)},set innerHTML(a){i(this.content,a),this.invalidateShadowRenderer()}}),m&&h(m,d),a.wrappers.HTMLTemplateElement=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a.localName){case"content":return new c(a);case"shadow":return new e(a);case"template":return new f(a)}d.call(this,a)}var c=a.wrappers.HTMLContentElement,d=a.wrappers.HTMLElement,e=a.wrappers.HTMLShadowElement,f=a.wrappers.HTMLTemplateElement;a.mixin;var g=a.registerWrapper,h=window.HTMLUnknownElement;b.prototype=Object.create(d.prototype),g(h,b),a.wrappers.HTMLUnknownElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";var b=a.GetElementsByInterface,c=a.ParentNodeInterface,d=a.SelectorsInterface,e=a.mixin,f=a.registerObject,g=f(document.createDocumentFragment());e(g.prototype,c),e(g.prototype,d),e(g.prototype,b);var h=f(document.createTextNode("")),i=f(document.createComment(""));a.wrappers.Comment=i,a.wrappers.DocumentFragment=g,a.wrappers.Text=h}(this.ShadowDOMPolyfill),function(a){"use strict";function b(b){var d=i(b.impl.ownerDocument.createDocumentFragment());c.call(this,d),g(d,this);var e=b.shadowRoot;a.nextOlderShadowTreeTable.set(this,e),j.set(this,b)}var c=a.wrappers.DocumentFragment,d=a.elementFromPoint,e=a.getInnerHTML,f=a.mixin,g=a.rewrap,h=a.setInnerHTML,i=a.unwrap,j=new SideTable;b.prototype=Object.create(c.prototype),f(b.prototype,{get innerHTML(){return e(this)},set innerHTML(a){h(this,a),this.invalidateShadowRenderer()},invalidateShadowRenderer:function(){return j.get(this).invalidateShadowRenderer()},elementFromPoint:function(a,b){return d(this,this.ownerDocument,a,b)},getElementById:function(a){return this.querySelector("#"+a)}}),a.wrappers.ShadowRoot=b,a.getHostForShadowRoot=function(a){return j.get(a)}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){a.previousSibling_=a.previousSibling,a.nextSibling_=a.nextSibling,a.parentNode_=a.parentNode}function c(a){a.firstChild_=a.firstChild,a.lastChild_=a.lastChild}function d(a){F(a instanceof E);for(var d=a.firstChild;d;d=d.nextSibling)b(d);c(a)}function e(a){var b=H(a);d(a),b.textContent=""}function f(a,c){var e=H(a),f=H(c);f.nodeType===E.DOCUMENT_FRAGMENT_NODE?d(c):(h(c),b(c)),a.lastChild_=a.lastChild,a.lastChild===a.firstChild&&(a.firstChild_=a.firstChild);var g=I(e.lastChild);g&&(g.nextSibling_=g.nextSibling),e.appendChild(f)}function g(a,c){var d=H(a),e=H(c);b(c),c.previousSibling&&(c.previousSibling.nextSibling_=c),c.nextSibling&&(c.nextSibling.previousSibling_=c),a.lastChild===c&&(a.lastChild_=c),a.firstChild===c&&(a.firstChild_=c),d.removeChild(e)}function h(a){var b=H(a),c=b.parentNode;c&&g(I(c),a)}function i(a,b){k(b).push(a),L.set(a,b);var c=K.get(a);c||K.set(a,c=[]),c.push(b)}function j(a){J.set(a,[])}function k(a){return J.get(a)}function l(a){for(var b=[],c=0,d=a.firstChild;d;d=d.nextSibling)b[c++]=d;return b}function m(a,b,c){for(var d=l(a),e=0;e<d.length;e++){var f=d[e];if(b(f)){if(c(f)===!1)return}else m(f,b,c)}}function n(a,b){var c=!1;return m(a,u,function(a){j(a);for(var d=0;d<b.length;d++){var e=b[d];void 0!==e&&p(e,a)&&(i(e,a),b[d]=void 0,c=!0)}}),c?b.filter(function(a){return void 0!==a}):b}function o(a,b){for(var c=0;c<b.length;c++)if(b[c]in a)return b[c]}function p(a,b){var c=b.getAttribute("select");if(!c)return!0;if(c=c.trim(),!c)return!0;if(a.nodeType!==E.ELEMENT_NODE)return!1;if(!P.test(c))return!1;if(":"===c[0]&&!Q.test(c))return!1;try{return a.matches(c)}catch(d){return!1}}function q(){C=null,S.forEach(function(a){a.render()}),S=[]}function r(a){this.host=a,this.dirty=!1,this.associateNode(a)}function s(a){var b=N.get(a);return b||(b=new r(a),N.set(a,b)),b}function t(a){return"content"===a.localName}function u(a){return"content"===a.localName}function v(a){return"shadow"===a.localName}function w(a){return"shadow"===a.localName}function x(a){return!!a.shadowRoot}function y(a){return M.get(a)}function z(a){for(var b=[],c=a.shadowRoot;c;c=M.get(c))b.push(c);return b}function A(a,b){L.set(a,b)}function B(a){new r(a).render()}var C,D=a.wrappers.HTMLContentElement,E=a.wrappers.Node,F=a.assert,G=a.mixin,H=a.unwrap,I=a.wrap,J=new SideTable,K=new SideTable,L=new SideTable,M=new SideTable,N=new SideTable,O=new SideTable,P=/^[*.:#[a-zA-Z_|]/,Q=new RegExp("^:("+["link","visited","target","enabled","disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type","last-of-type","only-of-type"].join("|")+")"),R=o(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),S=[];r.prototype={render:function(){if(this.dirty){var a=this.host;this.treeComposition();var b=a.shadowRoot;if(b){this.removeAllChildNodes(this.host);var c=l(b);c.forEach(function(c){this.renderNode(a,b,c,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this.dirty){if(this.dirty=!0,S.push(this),C)return;C=window[R](q,0)}},renderNode:function(a,b,c,d){if(x(c)){this.appendChild(a,c);var e=s(c);e.dirty=!0,e.render()}else t(c)?this.renderInsertionPoint(a,b,c,d):v(c)?this.renderShadowInsertionPoint(a,b,c):this.renderAsAnyDomTree(a,b,c,d)},renderAsAnyDomTree:function(a,b,c,d){if(this.appendChild(a,c),x(c))B(c);else{var e=c,f=l(e);f.forEach(function(a){this.renderNode(e,b,a,d)},this)}},renderInsertionPoint:function(a,b,c,d){var e=k(c);e.length?(this.removeAllChildNodes(c),e.forEach(function(c){t(c)&&d?this.renderInsertionPoint(a,b,c,d):this.renderAsAnyDomTree(a,b,c,d)},this)):this.renderFallbackContent(a,c),this.remove(c)},renderShadowInsertionPoint:function(a,b,c){var d=y(b);if(d){L.set(d,c),c.olderShadowRoot_=d,this.remove(c);var e=l(d);e.forEach(function(b){this.renderNode(a,d,b,!0)},this)}else this.renderFallbackContent(a,c)},renderFallbackContent:function(a,b){var c=l(b);c.forEach(function(b){this.appendChild(a,b)},this)},treeComposition:function(){var a=this.host,b=a.shadowRoot,c=[],d=l(a);d.forEach(function(a){if(t(a)){var b=k(a);b&&b.length||(b=l(a)),c.push.apply(c,b)}else c.push(a)});for(var e,f;b;){if(e=void 0,m(b,w,function(a){return e=a,!1}),f=e,c=n(b,c),f){var g=y(b);if(g){b=g,A(b,f);continue}break}break}},appendChild:function(a,b){f(a,b),this.associateNode(b)},remove:function(a){h(a),this.associateNode(a)},removeAllChildNodes:function(a){e(a)},associateNode:function(a){O.set(a,this)}},E.prototype.invalidateShadowRenderer=function(a){var b=O.get(this);if(!b)return!1;var c;return(a||this.shadowRoot||(c=this.parentNode)&&(c.shadowRoot||c instanceof ShadowRoot))&&b.invalidate(),!0},D.prototype.getDistributedNodes=function(){return q(),k(this)},G(E.prototype,{get insertionParent(){return L.get(this)||null}}),a.eventParentsTable=K,a.getRendererForHost=s,a.getShadowTrees=z,a.nextOlderShadowTreeTable=M,a.renderAllPending=q,a.visual={removeAllChildNodes:e,appendChild:f,removeChild:g}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){h.call(this,a)}function c(a){var c=document[a];b.prototype[a]=function(){return q(c.apply(this.impl,arguments))}}function d(a){this.impl=a}function e(a,b){var c=document.implementation[b];a.prototype[b]=function(){return q(c.apply(this.impl,arguments))}}function f(a,b){var c=document.implementation[b];a.prototype[b]=function(){return c.apply(this.impl,arguments)}}var g=a.GetElementsByInterface,h=a.wrappers.Node,i=a.ParentNodeInterface,j=a.SelectorsInterface,k=a.defineWrapGetter,l=a.elementFromPoint,m=a.forwardMethodsToWrapper,n=a.mixin,o=a.registerWrapper,p=a.unwrap,q=a.wrap,r=a.wrapEventTargetMethods;a.wrapNodeList;var s=new SideTable;b.prototype=Object.create(h.prototype),k(b,"documentElement"),k(b,"body"),k(b,"head"),["getElementById","createElement","createElementNS","createTextNode","createDocumentFragment","createEvent","createEventNS"].forEach(c);var t=document.adoptNode,u=document.write;n(b.prototype,{adoptNode:function(a){return t.call(this.impl,p(a)),a},elementFromPoint:function(a,b){return l(this,this,a,b)},write:function(a){for(var b=this.querySelectorAll("*"),c=b[b.length-1];c.nextSibling;)c=c.nextSibling;var d=c.parentNode;d.lastChild_=void 0,c.nextSibling_=void 0,u.call(this.impl,a)}}),m([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement],["appendChild","compareDocumentPosition","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),m([window.HTMLDocument||window.Document],["adoptNode","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createTextNode","elementFromPoint","getElementById","write"]),n(b.prototype,g),n(b.prototype,i),n(b.prototype,j),n(b.prototype,{get implementation(){var a=s.get(this);return a?a:(a=new d(p(this).implementation),s.set(this,a),a)}}),o(window.Document,b,document.implementation.createHTMLDocument("")),window.HTMLDocument&&o(window.HTMLDocument,b),r([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),e(d,"createDocumentType"),e(d,"createDocument"),e(d,"createHTMLDocument"),f(d,"hasFeature"),o(window.DOMImplementation,d),m([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),a.wrappers.Document=b,a.wrappers.DOMImplementation=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.EventTarget,d=a.mixin,e=a.registerWrapper,f=a.unwrap,g=a.unwrapIfNeeded,h=a.wrap,i=window.Window;b.prototype=Object.create(c.prototype);var j=window.getComputedStyle;i.prototype.getComputedStyle=function(a,b){return j.call(this||window,g(a),b)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function(a){i.prototype[a]=function(){var b=h(this||window);return b[a].apply(b,arguments)}}),d(b.prototype,{getComputedStyle:function(a,b){return j.call(f(this),g(a),b)}}),e(i,b),a.wrappers.Window=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){this.impl=a}function c(a){return new b(a)}function d(a){return a.map(c)}function e(a){var b=this;this.impl=new k(function(c){a.call(b,d(c),b)})}var f=a.defineGetter,g=a.defineWrapGetter,h=a.registerWrapper,i=a.unwrapIfNeeded,j=a.wrapNodeList;a.wrappers;var k=window.MutationObserver||window.WebKitMutationObserver;if(k){var l=window.MutationRecord;b.prototype={get addedNodes(){return j(this.impl.addedNodes)},get removedNodes(){return j(this.impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function(a){g(b,a)}),["type","attributeName","attributeNamespace","oldValue"].forEach(function(a){f(b,a,function(){return this.impl[a]})}),l&&h(l,b),window.Node,e.prototype={observe:function(a,b){this.impl.observe(i(a),b)
-},disconnect:function(){this.impl.disconnect()},takeRecords:function(){return d(this.impl.takeRecords())}},a.wrappers.MutationObserver=e,a.wrappers.MutationRecord=b}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=c[a],d=window[b];if(d){var e=document.createElement(a),f=e.constructor;window[b]=f}}a.isWrapperFor;var c={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};Object.keys(c).forEach(b),Object.getOwnPropertyNames(a.wrappers).forEach(function(b){window[b]=a.wrappers[b]}),a.knownElements=c}(this.ShadowDOMPolyfill),function(){var a=window.ShadowDOMPolyfill;a.wrap,Object.defineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.createShadowRoot,window.dartExperimentalFixupGetTag=function(b){function c(a){if(a instanceof d)return"NodeList";if(a instanceof e)return"ShadowRoot";if(a instanceof MutationRecord)return"MutationRecord";if(a instanceof MutationObserver)return"MutationObserver";if(f(a)){a=g(a);var c=a.constructor;if(c&&c._ShadowDOMPolyfill$isGeneratedWrapper){var h=c._ShadowDOMPolyfill$cacheTag_;return h||(h=Object.prototype.toString.call(a),h=h.substring(8,h.length-1),c._ShadowDOMPolyfill$cacheTag_=h),h}}return b(a)}var d=a.wrappers.NodeList,e=a.wrappers.ShadowRoot,f=a.isWrapper,g=a.unwrap;return c}}()}
\ No newline at end of file
+if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateShadowRoot||window.__forceShadowDomPolyfill){(function(){Element.prototype.webkitCreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return window.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})})();var SideTable;"undefined"!=typeof WeakMap&&0>navigator.userAgent.indexOf("Firefox/")?SideTable=WeakMap:function(){var e=Object.defineProperty,t=Object.hasOwnProperty,n=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(n++ +"__")},SideTable.prototype={set:function(t,n){e(t,this.name,{value:n,writable:!0})},get:function(e){return t.call(e,this.name)?e[this.name]:void 0},"delete":function(e){this.set(e,void 0)}}}();var ShadowDOMPolyfill={};(function(e){"use strict";function t(e){if(!e)throw new Error("Assertion failed")}function n(e,t){return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function r(e,t){return Object.getOwnPropertyNames(t).forEach(function(n){switch(n){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":return}Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function i(e){var t=e.__proto__||Object.getPrototypeOf(e),n=M.get(t);if(n)return n;var r=i(t),o=p(r);return u(t,o,e),o}function o(e,t){l(e,t,!0)}function a(e,t){l(t,e,!1)}function l(e,t,n){Object.getOwnPropertyNames(e).forEach(function(r){if(!(r in t)){L&&e.__lookupGetter__(r);var i;try{i=Object.getOwnPropertyDescriptor(e,r)}catch(o){i=C}var a,l;if(n&&"function"==typeof i.value)return t[r]=function(){return this.impl[r].apply(this.impl,arguments)},void 0;a=function(){return this.impl[r]},(i.writable||i.set)&&(l=function(e){this.impl[r]=e}),Object.defineProperty(t,r,{get:a,set:l,configurable:i.configurable,enumerable:i.enumerable})}})}function s(e,t,n){var i=e.prototype;u(i,t,n),r(t,e)}function u(e,n,r){var i=n.prototype;t(void 0===M.get(e)),M.set(e,n),o(e,i),r&&a(i,r)}function c(e,t){return M.get(t.prototype)===e}function d(e){var t=Object.getPrototypeOf(e),n=i(t),r=p(n);return u(t,r,e),r}function p(e){function t(t){e.call(this,t)}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t._ShadowDOMPolyfill$isGeneratedWrapper=!0,t}function h(e){return e instanceof N.EventTarget||e instanceof N.Event||e instanceof N.DOMImplementation}function f(e){return e instanceof D||e instanceof O||e instanceof _||e instanceof H}function m(e){if(null===e)return null;t(f(e));var n=S.get(e);if(!n){var r=i(e);n=new r(e),S.set(e,n)}return n}function g(e){return null===e?null:(t(h(e)),e.impl)}function w(e){return e&&h(e)?g(e):e}function v(e){return e&&!h(e)?m(e):e}function E(e,n){null!==n&&(t(f(e)),t(void 0===n||h(n)),S.set(e,n))}function y(e,t,n){Object.defineProperty(e.prototype,t,{get:n,configurable:!0,enumerable:!0})}function T(e,t){y(e,t,function(){return m(this.impl[t])})}function b(e,t){e.forEach(function(e){t.forEach(function(t){e.prototype[t]=function(){var e=m(this);return e[t].apply(e,arguments)}})})}var S=new SideTable,M=new SideTable,N=Object.create(null);Object.getOwnPropertyNames(window);var L=/Firefox/.test(navigator.userAgent),C={get:function(){},set:function(){},configurable:!0,enumerable:!0},H=DOMImplementation,O=Event,D=Node,_=Window;e.assert=t,e.defineGetter=y,e.defineWrapGetter=T,e.forwardMethodsToWrapper=b,e.isWrapper=h,e.isWrapperFor=c,e.mixin=n,e.registerObject=d,e.registerWrapper=s,e.rewrap=E,e.unwrap=g,e.unwrapIfNeeded=w,e.wrap=m,e.wrapIfNeeded=v,e.wrappers=N})(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e instanceof I.ShadowRoot}function n(e){var t=e.localName;return"content"===t||"shadow"===t}function r(e){return!!e.shadowRoot}function i(e){var t;return e.parentNode||(t=e.defaultView)&&R(t)||null}function o(o,a,l){if(l.length)return l.shift();if(t(o))return o.insertionParent||e.getHostForShadowRoot(o);var s=e.eventParentsTable.get(o);if(s){for(var u=1;s.length>u;u++)l[u-1]=s[u];return s[0]}if(a&&n(o)){var c=o.parentNode;if(c&&r(c))for(var d=e.getShadowTrees(c),p=a.insertionParent,u=0;d.length>u;u++)if(d[u].contains(p))return p}return i(o)}function a(e){for(var r=[],i=e,a=[],s=[];i;){var u=null;if(n(i)){u=l(r);var c=r[r.length-1]||i;r.push(c)}else r.length||r.push(i);var d=r[r.length-1];a.push({target:d,currentTarget:i}),t(i)&&r.pop(),i=o(i,u,s)}return a}function l(e){for(var t=e.length-1;t>=0;t--)if(!n(e[t]))return e[t];return null}function s(r,i){for(var a=[];r;){for(var s=[],c=i,p=void 0;c;){var h=null;if(s.length){if(n(c)&&(h=l(s),u(p))){var f=s[s.length-1];s.push(f)}}else s.push(c);if(d(c,r))return s[s.length-1];t(c)&&s.pop(),p=c,c=o(c,h,a)}r=t(r)?e.getHostForShadowRoot(r):r.parentNode}}function u(e){return e.insertionParent}function c(e){for(var t;t=e.parentNode;)e=t;return e}function d(e,t){return c(e)===c(t)}function p(e){switch(e){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function h(t){if(!F.get(t)){F.set(t,!0),p(t.type)||e.renderAllPending();var n=R(t.target),r=R(t);return f(r,n)}}function f(e,t){var n=a(t);return"load"===e.type&&2===n.length&&n[0].target instanceof I.Document&&n.shift(),m(e,n)&&g(e,n)&&w(e,n),k.set(e,y.NONE),W.set(e,null),e.defaultPrevented}function m(e,t){for(var n,r=t.length-1;r>0;r--){var i=t[r].target,o=t[r].currentTarget;if(i!==o&&(n=y.CAPTURING_PHASE,!v(t[r],e,n)))return!1}return!0}function g(e,t){var n=y.AT_TARGET;return v(t[0],e,n)}function w(e,t){for(var n,r=e.bubbles,i=1;t.length>i;i++){var o=t[i].target,a=t[i].currentTarget;if(o===a)n=y.AT_TARGET;else{if(!r||q.get(e))continue;n=y.BUBBLING_PHASE}if(!v(t[i],e,n))return}}function v(e,t,n){var r=e.target,i=e.currentTarget,o=A.get(i);if(!o)return!0;if("relatedTarget"in t){var a=x(t),l=R(a.relatedTarget),u=s(i,l);if(u===r)return!0;B.set(t,u)}k.set(t,n);var c=t.type,d=!1;j.set(t,r),W.set(t,i);for(var p=0;o.length>p;p++){var h=o[p];if(h.removed)d=!0;else if(!(h.type!==c||!h.capture&&n===y.CAPTURING_PHASE||h.capture&&n===y.BUBBLING_PHASE))try{if("function"==typeof h.handler?h.handler.call(i,t):h.handler.handleEvent(t),q.get(t))return!1}catch(f){window.onerror?window.onerror(f.message):console.error(f)}}if(d){var m=o.slice();o.length=0;for(var p=0;m.length>p;p++)m[p].removed||o.push(m[p])}return!G.get(t)}function E(e,t,n){this.type=e,this.handler=t,this.capture=Boolean(n)}function y(e,t){return e instanceof U?(this.impl=e,void 0):R(M(U,"Event",e,t))}function T(e){return e&&e.relatedTarget?Object.create(e,{relatedTarget:{value:x(e.relatedTarget)}}):e}function b(e,t,n){var r=window[e],i=function(t,n){return t instanceof r?(this.impl=t,void 0):R(M(r,e,t,n))};return i.prototype=Object.create(t.prototype),n&&_(i.prototype,n),r&&P(r,i,document.createEvent(e)),i}function S(e,t){return function(){arguments[t]=x(arguments[t]);var n=x(this);n[e].apply(n,arguments)}}function M(e,t,n,r){if(et)return new e(n,T(r));var i=x(document.createEvent(t)),o=J[t],a=[n];return Object.keys(o).forEach(function(e){var t=null!=r&&e in r?r[e]:o[e];"relatedTarget"===e&&(t=x(t)),a.push(t)}),i["init"+t].apply(i,a),i}function N(e){return"function"==typeof e?!0:e&&e.handleEvent}function L(e){this.impl=e}function C(t){return t instanceof I.ShadowRoot&&(t=e.getHostForShadowRoot(t)),x(t)}function H(e){D(e,rt)}function O(t,n,r,i){e.renderAllPending();for(var o=R(it.call(n.impl,r,i)),l=a(o,this),s=0;l.length>s;s++){var u=l[s];if(u.currentTarget===t)return u.target}return null}var D=e.forwardMethodsToWrapper,_=e.mixin,P=e.registerWrapper,x=e.unwrap,R=e.wrap,I=e.wrappers;new SideTable;var A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new SideTable,k=new SideTable,G=new SideTable,q=new SideTable;E.prototype={equals:function(e){return this.handler===e.handler&&this.type===e.type&&this.capture===e.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var U=window.Event;y.prototype={get target(){return j.get(this)},get currentTarget(){return W.get(this)},get eventPhase(){return k.get(this)},stopPropagation:function(){G.set(this,!0)},stopImmediatePropagation:function(){G.set(this,!0),q.set(this,!0)}},P(U,y,document.createEvent("Event"));var V=b("UIEvent",y),K=b("CustomEvent",y),$={get relatedTarget(){return B.get(this)||R(x(this).relatedTarget)}},z=_({initMouseEvent:S("initMouseEvent",14)},$),X=_({initFocusEvent:S("initFocusEvent",5)},$),Y=b("MouseEvent",V,z),Q=b("FocusEvent",V,X),Z=b("MutationEvent",y,{initMutationEvent:S("initMutationEvent",3),get relatedNode(){return R(this.impl.relatedNode)}}),J=Object.create(null),et=function(){try{new window.MouseEvent("click")}catch(e){return!1}return!0}();if(!et){var tt=function(e,t,n){if(n){var r=J[n];t=_(_({},r),t)}J[e]=t};tt("Event",{bubbles:!1,cancelable:!1}),tt("CustomEvent",{detail:null},"Event"),tt("UIEvent",{view:null,detail:0},"Event"),tt("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),tt("FocusEvent",{relatedTarget:null},"UIEvent")}var nt=window.EventTarget,rt=["addEventListener","removeEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(e){var t=e.prototype;rt.forEach(function(e){Object.defineProperty(t,e+"_",{value:t[e]})})}),L.prototype={addEventListener:function(e,t,n){if(N(t)){var r=new E(e,t,n),i=A.get(this);if(i){for(var o=0;i.length>o;o++)if(r.equals(i[o]))return}else i=[],A.set(this,i);i.push(r);var a=C(this);a.addEventListener_(e,h,!0)}},removeEventListener:function(e,t,n){n=Boolean(n);var r=A.get(this);if(r){for(var i=0,o=!1,a=0;r.length>a;a++)r[a].type===e&&r[a].capture===n&&(i++,r[a].handler===t&&(o=!0,r[a].remove()));if(o&&1===i){var l=C(this);l.removeEventListener_(e,h,!0)}}},dispatchEvent:function(t){e.renderAllPending();var n=C(this);return n.dispatchEvent_(x(t))}},nt&&P(nt,L);var it=document.elementFromPoint;e.adjustRelatedTarget=s,e.elementFromPoint=O,e.wrapEventTargetMethods=H,e.wrappers.CustomEvent=K,e.wrappers.Event=y,e.wrappers.EventTarget=L,e.wrappers.FocusEvent=Q,e.wrappers.MouseEvent=Y,e.wrappers.MutationEvent=Z,e.wrappers.UIEvent=V}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,{enumerable:!1})}function n(){this.length=0,t(this,"length")}function r(e){if(null==e)return e;for(var t=new n,r=0,i=e.length;i>r;r++)t[r]=o(e[r]);return t.length=i,t}function i(e,t){e.prototype[t]=function(){return r(this.impl[t].apply(this.impl,arguments))}}var o=e.wrap;n.prototype={item:function(e){return this[e]}},t(n.prototype,"item"),e.wrappers.NodeList=n,e.addWrapNodeListMethod=i,e.wrapNodeList=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){s(e instanceof o)}function n(e,t,n,r){if(e.nodeType!==o.DOCUMENT_FRAGMENT_NODE)return e.parentNode&&e.parentNode.removeChild(e),e.parentNode_=t,e.previousSibling_=n,e.nextSibling_=r,n&&(n.nextSibling_=e),r&&(r.previousSibling_=e),[e];for(var i,a=[];i=e.firstChild;)e.removeChild(i),a.push(i),i.parentNode_=t;for(var l=0;a.length>l;l++)a[l].previousSibling_=a[l-1]||n,a[l].nextSibling_=a[l+1]||r;return n&&(n.nextSibling_=a[0]),r&&(r.previousSibling_=a[a.length-1]),a}function r(e){if(1===e.length)return d(e[0]);for(var t=d(document.createDocumentFragment()),n=0;e.length>n;n++)t.appendChild(d(e[n]));return t}function i(e){for(var t=e.firstChild;t;){s(t.parentNode===e);var n=t.nextSibling,r=d(t),i=r.parentNode;i&&w.call(i,r),t.previousSibling_=t.nextSibling_=t.parentNode_=null,t=n}e.firstChild_=e.lastChild_=null}function o(e){s(e instanceof h),a.call(this,e),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0}var a=e.wrappers.EventTarget,l=e.wrappers.NodeList;e.defineWrapGetter;var s=e.assert,u=e.mixin,c=e.registerWrapper,d=e.unwrap,p=e.wrap,h=window.Node,f=h.prototype.appendChild,m=h.prototype.insertBefore,g=h.prototype.replaceChild,w=h.prototype.removeChild,v=h.prototype.compareDocumentPosition;o.prototype=Object.create(a.prototype),u(o.prototype,{appendChild:function(e){t(e),this.invalidateShadowRenderer();var i=this.lastChild,o=null,a=n(e,this,i,o);return this.lastChild_=a[a.length-1],i||(this.firstChild_=a[0]),f.call(this.impl,r(a)),e},insertBefore:function(e,i){if(!i)return this.appendChild(e);t(e),t(i),s(i.parentNode===this),this.invalidateShadowRenderer();var o=i.previousSibling,a=i,l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]);var u=d(i),c=u.parentNode;return c&&m.call(c,r(l),u),e},removeChild:function(e){if(t(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var n=this.firstChild,r=this.lastChild,i=e.nextSibling,o=e.previousSibling,a=d(e),l=a.parentNode;return l&&w.call(l,a),n===e&&(this.firstChild_=i),r===e&&(this.lastChild_=o),o&&(o.nextSibling_=i),i&&(i.previousSibling_=o),e.previousSibling_=e.nextSibling_=e.parentNode_=null,e},replaceChild:function(e,i){if(t(e),t(i),i.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var o=i.previousSibling,a=i.nextSibling;a===e&&(a=e.nextSibling);var l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]),this.lastChild===i&&(this.lastChild_=l[l.length-1]),i.previousSibling_=null,i.nextSibling_=null,i.parentNode_=null;var s=d(i);return s.parentNode&&g.call(s.parentNode,r(l),s),i},hasChildNodes:function(){return null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:p(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:p(this.impl.firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:p(this.impl.lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:p(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:p(this.impl.previousSibling)},get parentElement(){for(var e=this.parentNode;e&&e.nodeType!==o.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="",t=this.firstChild;t;t=t.nextSibling)e+=t.textContent;return e},set textContent(e){if(i(this),this.invalidateShadowRenderer(),""!==e){var t=this.impl.ownerDocument.createTextNode(e);this.appendChild(t)}},get childNodes(){for(var e=new l,t=0,n=this.firstChild;n;n=n.nextSibling)e[t++]=n;return e.length=t,e},cloneNode:function(e){if(!this.invalidateShadowRenderer())return p(this.impl.cloneNode(e));var t=p(this.impl.cloneNode(!1));if(e)for(var n=this.firstChild;n;n=n.nextSibling)t.appendChild(n.cloneNode(!0));return t},contains:function(e){if(!e)return!1;if(e===this)return!0;var t=e.parentNode;return t?this.contains(t):!1},compareDocumentPosition:function(e){return v.call(this.impl,d(e))},get ownerDocument(){return e.renderAllPending(),p(this.impl.ownerDocument)}}),c(h,o,document.createDocumentFragment()),delete o.prototype.querySelector,delete o.prototype.querySelectorAll,o.prototype=u(Object.create(a.prototype),o.prototype),e.wrappers.Node=o}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e,n){for(var r,i=e.firstElementChild;i;){if(i.matches(n))return i;if(r=t(i,n))return r;i=i.nextElementSibling}return null}function n(e,t,r){for(var i=e.firstElementChild;i;)i.matches(t)&&(r[r.length++]=i),n(i,t,r),i=i.nextElementSibling;return r}var r={querySelector:function(e){return t(this,e)},querySelectorAll:function(e){return n(this,e,new NodeList)}},i={getElementsByTagName:function(e){return this.querySelectorAll(e)},getElementsByClassName:function(e){return this.querySelectorAll("."+e)},getElementsByTagNameNS:function(e,t){if("*"===e)return this.getElementsByTagName(t);for(var n=new NodeList,r=this.getElementsByTagName(t),i=0,o=0;r.length>i;i++)r[i].namespaceURI===e&&(n[o++]=r[i]);return n.length=o,n}};e.GetElementsByInterface=i,e.SelectorsInterface=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r=e.wrappers.NodeList,i={get firstElementChild(){return t(this.firstChild)},get lastElementChild(){return n(this.lastChild)},get childElementCount(){for(var e=0,t=this.firstElementChild;t;t=t.nextElementSibling)e++;return e},get children(){for(var e=new r,t=0,n=this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;return e.length=t,e}},o={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibling(){return n(this.nextSibling)}};e.ChildNodeInterface=o,e.ParentNodeInterface=i}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}var n=e.ChildNodeInterface,r=e.wrappers.Node,i=e.mixin,o=e.registerWrapper,a=window.CharacterData;t.prototype=Object.create(r.prototype),i(t.prototype,{get textContent(){return this.data},set textContent(e){this.data=e}}),i(t.prototype,n),o(a,t,document.createTextNode("")),e.wrappers.CharacterData=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){i.call(this,e)}var n=e.ChildNodeInterface,r=e.GetElementsByInterface,i=e.wrappers.Node,o=e.ParentNodeInterface,a=e.SelectorsInterface;e.addWrapNodeListMethod;var l=e.mixin,s=e.registerWrapper,u=e.wrappers,c=new SideTable,d=window.Element,p=d.prototype.matches||d.prototype.mozMatchesSelector||d.prototype.msMatchesSelector||d.prototype.webkitMatchesSelector;t.prototype=Object.create(i.prototype),l(t.prototype,{createShadowRoot:function(){var t=new u.ShadowRoot(this);return c.set(this,t),e.getRendererForHost(this),this.invalidateShadowRenderer(!0),t},get shadowRoot(){return c.get(this)||null},setAttribute:function(e,t){this.impl.setAttribute(e,t),this.invalidateShadowRenderer()},matches:function(e){return p.call(this.impl,e)}}),l(t.prototype,n),l(t.prototype,r),l(t.prototype,o),l(t.prototype,a),s(d,t),e.wrappers.Element=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e){case"&":return"&";case"<":return"<";case'"':return"""}}function n(e){return e.replace(m,t)}function r(e){switch(e.nodeType){case Node.ELEMENT_NODE:for(var t,r=e.tagName.toLowerCase(),o="<"+r,a=e.attributes,l=0;t=a[l];l++)o+=" "+t.name+'="'+n(t.value)+'"';return o+=">",g[r]?o:o+i(e)+"</"+r+">";case Node.TEXT_NODE:return n(e.nodeValue);case Node.COMMENT_NODE:return"<!--"+n(e.nodeValue)+"-->";default:throw console.error(e),new Error("not implemented")}}function i(e){for(var t="",n=e.firstChild;n;n=n.nextSibling)t+=r(n);return t}function o(e,t,n){var r=n||"div";e.textContent="";var i=h(e.ownerDocument.createElement(r));i.innerHTML=t;for(var o;o=i.firstChild;)e.appendChild(f(o))}function a(e){u.call(this,e)}function l(t){c(a,t,function(){return e.renderAllPending(),this.impl[t]})}function s(t){Object.defineProperty(a.prototype,t,{value:function(){return e.renderAllPending(),this.impl[t].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var u=e.wrappers.Element,c=e.defineGetter,d=e.mixin,p=e.registerWrapper,h=e.unwrap,f=e.wrap,m=/&|<|"/g,g={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},w=window.HTMLElement;a.prototype=Object.create(u.prototype),d(a.prototype,{get innerHTML(){return i(this)},set innerHTML(e){o(this,e,this.tagName)},get outerHTML(){return r(this)},set outerHTML(e){if(this.invalidateShadowRenderer())throw new Error("not implemented");this.impl.outerHTML=e}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(l),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(s),p(w,a,document.createElement("b")),e.wrappers.HTMLElement=a,e.getInnerHTML=i,e.setInnerHTML=o}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLContentElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get select(){return this.getAttribute("select")},set select(e){this.setAttribute("select",e)},setAttribute:function(e,t){n.prototype.setAttribute.call(this,e,t),"select"===String(e).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),o&&i(o,t),e.wrappers.HTMLContentElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e),this.olderShadowRoot_=null}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLShadowElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRenderer:function(){n.prototype.invalidateShadowRenderer.call(this,!0)}}),o&&i(o,t),e.wrappers.HTMLShadowElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){if(!e.defaultView)return e;var t=d.get(e);if(!t){for(t=e.implementation.createHTMLDocument("");t.lastChild;)t.removeChild(t.lastChild);d.set(e,t)}return t}function n(e){for(var n,r=t(e.ownerDocument),i=r.createDocumentFragment();n=e.firstChild;)i.appendChild(n);return i}function r(e){i.call(this,e)}var i=e.wrappers.HTMLElement,o=e.getInnerHTML,a=e.mixin,l=e.registerWrapper,s=e.setInnerHTML,u=e.wrap,c=new SideTable,d=new SideTable,p=window.HTMLTemplateElement;r.prototype=Object.create(i.prototype),a(r.prototype,{get content(){if(p)return u(this.impl.content);var e=c.get(this);return e||(e=n(this),c.set(this,e)),e},get innerHTML(){return o(this.content)},set innerHTML(e){s(this.content,e),this.invalidateShadowRenderer()}}),p&&l(p,r),e.wrappers.HTMLTemplateElement=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e.localName){case"content":return new n(e);case"shadow":return new i(e);case"template":return new o(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e.wrappers.HTMLElement,i=e.wrappers.HTMLShadowElement,o=e.wrappers.HTMLTemplateElement;e.mixin;var a=e.registerWrapper,l=window.HTMLUnknownElement;t.prototype=Object.create(r.prototype),a(l,t),e.wrappers.HTMLUnknownElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";var t=e.GetElementsByInterface,n=e.ParentNodeInterface,r=e.SelectorsInterface,i=e.mixin,o=e.registerObject,a=o(document.createDocumentFragment());i(a.prototype,n),i(a.prototype,r),i(a.prototype,t);var l=o(document.createTextNode("")),s=o(document.createComment(""));e.wrappers.Comment=s,e.wrappers.DocumentFragment=a,e.wrappers.Text=l}(this.ShadowDOMPolyfill),function(e){"use strict";function t(t){var r=s(t.impl.ownerDocument.createDocumentFragment());n.call(this,r),a(r,this);var i=t.shadowRoot;e.nextOlderShadowTreeTable.set(this,i),u.set(this,t)}var n=e.wrappers.DocumentFragment,r=e.elementFromPoint,i=e.getInnerHTML,o=e.mixin,a=e.rewrap,l=e.setInnerHTML,s=e.unwrap,u=new SideTable;t.prototype=Object.create(n.prototype),o(t.prototype,{get innerHTML(){return i(this)},set innerHTML(e){l(this,e),this.invalidateShadowRenderer()},invalidateShadowRenderer:function(){return u.get(this).invalidateShadowRenderer()},elementFromPoint:function(e,t){return r(this,this.ownerDocument,e,t)},getElementById:function(e){return this.querySelector("#"+e)}}),e.wrappers.ShadowRoot=t,e.getHostForShadowRoot=function(e){return u.get(e)}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nextSibling,e.parentNode_=e.parentNode}function n(e){e.firstChild_=e.firstChild,e.lastChild_=e.lastChild}function r(e){_(e instanceof D);for(var r=e.firstChild;r;r=r.nextSibling)t(r);n(e)}function i(e){var t=x(e);r(e),t.textContent=""}function o(e,n){var i=x(e),o=x(n);o.nodeType===D.DOCUMENT_FRAGMENT_NODE?r(n):(l(n),t(n)),e.lastChild_=e.lastChild,e.lastChild===e.firstChild&&(e.firstChild_=e.firstChild);var a=R(i.lastChild);a&&(a.nextSibling_=a.nextSibling),i.appendChild(o)}function a(e,n){var r=x(e),i=x(n);t(n),n.previousSibling&&(n.previousSibling.nextSibling_=n),n.nextSibling&&(n.nextSibling.previousSibling_=n),e.lastChild===n&&(e.lastChild_=n),e.firstChild===n&&(e.firstChild_=n),r.removeChild(i)}function l(e){var t=x(e),n=t.parentNode;n&&a(R(n),e)}function s(e,t){c(t).push(e),F.set(e,t);var n=A.get(e);n||A.set(e,n=[]),n.push(t)}function u(e){I.set(e,[])}function c(e){return I.get(e)}function d(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t}function p(e,t,n){for(var r=d(e),i=0;r.length>i;i++){var o=r[i];if(t(o)){if(n(o)===!1)return}else p(o,t,n)}}function h(e,t){var n=!1;return p(e,y,function(e){u(e);for(var r=0;t.length>r;r++){var i=t[r];void 0!==i&&m(i,e)&&(s(i,e),t[r]=void 0,n=!0)}}),n?t.filter(function(e){return void 0!==e}):t}function f(e,t){for(var n=0;t.length>n;n++)if(t[n]in e)return t[n]}function m(e,t){var n=t.getAttribute("select");if(!n)return!0;if(n=n.trim(),!n)return!0;if(e.nodeType!==D.ELEMENT_NODE)return!1;if(!k.test(n))return!1;if(":"===n[0]&&!G.test(n))return!1;try{return e.matches(n)}catch(r){return!1}}function g(){H=null,U.forEach(function(e){e.render()}),U=[]}function w(e){this.host=e,this.dirty=!1,this.associateNode(e)}function v(e){var t=W.get(e);return t||(t=new w(e),W.set(e,t)),t}function E(e){return"content"===e.localName}function y(e){return"content"===e.localName}function T(e){return"shadow"===e.localName}function b(e){return"shadow"===e.localName}function S(e){return!!e.shadowRoot}function M(e){return j.get(e)}function N(e){for(var t=[],n=e.shadowRoot;n;n=j.get(n))t.push(n);return t}function L(e,t){F.set(e,t)}function C(e){new w(e).render()}var H,O=e.wrappers.HTMLContentElement,D=e.wrappers.Node,_=e.assert,P=e.mixin,x=e.unwrap,R=e.wrap,I=new SideTable,A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new SideTable,k=/^[*.:#[a-zA-Z_|]/,G=new RegExp("^:("+["link","visited","target","enabled","disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type","last-of-type","only-of-type"].join("|")+")"),q=f(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),U=[];w.prototype={render:function(){if(this.dirty){var e=this.host;this.treeComposition();var t=e.shadowRoot;if(t){this.removeAllChildNodes(this.host);var n=d(t);n.forEach(function(n){this.renderNode(e,t,n,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this.dirty){if(this.dirty=!0,U.push(this),H)return;H=window[q](g,0)}},renderNode:function(e,t,n,r){if(S(n)){this.appendChild(e,n);var i=v(n);i.dirty=!0,i.render()}else E(n)?this.renderInsertionPoint(e,t,n,r):T(n)?this.renderShadowInsertionPoint(e,t,n):this.renderAsAnyDomTree(e,t,n,r)},renderAsAnyDomTree:function(e,t,n,r){if(this.appendChild(e,n),S(n))C(n);else{var i=n,o=d(i);o.forEach(function(e){this.renderNode(i,t,e,r)},this)}},renderInsertionPoint:function(e,t,n,r){var i=c(n);i.length?(this.removeAllChildNodes(n),i.forEach(function(n){E(n)&&r?this.renderInsertionPoint(e,t,n,r):this.renderAsAnyDomTree(e,t,n,r)},this)):this.renderFallbackContent(e,n),this.remove(n)},renderShadowInsertionPoint:function(e,t,n){var r=M(t);if(r){F.set(r,n),n.olderShadowRoot_=r,this.remove(n);var i=d(r);i.forEach(function(t){this.renderNode(e,r,t,!0)},this)}else this.renderFallbackContent(e,n)},renderFallbackContent:function(e,t){var n=d(t);n.forEach(function(t){this.appendChild(e,t)},this)},treeComposition:function(){var e=this.host,t=e.shadowRoot,n=[],r=d(e);r.forEach(function(e){if(E(e)){var t=c(e);t&&t.length||(t=d(e)),n.push.apply(n,t)}else n.push(e)});for(var i,o;t;){if(i=void 0,p(t,b,function(e){return i=e,!1}),o=i,n=h(t,n),o){var a=M(t);if(a){t=a,L(t,o);continue}break}break}},appendChild:function(e,t){o(e,t),this.associateNode(t)},remove:function(e){l(e),this.associateNode(e)},removeAllChildNodes:function(e){i(e)},associateNode:function(e){B.set(e,this)}},D.prototype.invalidateShadowRenderer=function(e){var t=B.get(this);if(!t)return!1;var n;return(e||this.shadowRoot||(n=this.parentNode)&&(n.shadowRoot||n instanceof ShadowRoot))&&t.invalidate(),!0},O.prototype.getDistributedNodes=function(){return g(),c(this)},P(D.prototype,{get insertionParent(){return F.get(this)||null}}),e.eventParentsTable=A,e.getRendererForHost=v,e.getShadowTrees=N,e.nextOlderShadowTreeTable=j,e.renderAllPending=g,e.visual={removeAllChildNodes:i,appendChild:o,removeChild:a}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){l.call(this,e)}function n(e){var n=document[e];t.prototype[e]=function(){return g(n.apply(this.impl,arguments))}}function r(e){this.impl=e}function i(e,t){var n=document.implementation[t];e.prototype[t]=function(){return g(n.apply(this.impl,arguments))}}function o(e,t){var n=document.implementation[t];e.prototype[t]=function(){return n.apply(this.impl,arguments)}}var a=e.GetElementsByInterface,l=e.wrappers.Node,s=e.ParentNodeInterface,u=e.SelectorsInterface,c=e.defineWrapGetter,d=e.elementFromPoint,p=e.forwardMethodsToWrapper,h=e.mixin,f=e.registerWrapper,m=e.unwrap,g=e.wrap,w=e.wrapEventTargetMethods;e.wrapNodeList;var v=new SideTable;t.prototype=Object.create(l.prototype),c(t,"documentElement"),c(t,"body"),c(t,"head"),["getElementById","createElement","createElementNS","createTextNode","createDocumentFragment","createEvent","createEventNS"].forEach(n);var E=document.adoptNode,y=document.write;h(t.prototype,{adoptNode:function(e){return E.call(this.impl,m(e)),e},elementFromPoint:function(e,t){return d(this,this,e,t)},write:function(e){for(var t=this.querySelectorAll("*"),n=t[t.length-1];n.nextSibling;)n=n.nextSibling;var r=n.parentNode;r.lastChild_=void 0,n.nextSibling_=void 0,y.call(this.impl,e)}}),p([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement],["appendChild","compareDocumentPosition","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),p([window.HTMLDocument||window.Document],["adoptNode","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createTextNode","elementFromPoint","getElementById","write"]),h(t.prototype,a),h(t.prototype,s),h(t.prototype,u),h(t.prototype,{get implementation(){var e=v.get(this);return e?e:(e=new r(m(this).implementation),v.set(this,e),e)}}),f(window.Document,t,document.implementation.createHTMLDocument("")),window.HTMLDocument&&f(window.HTMLDocument,t),w([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),i(r,"createDocumentType"),i(r,"createDocument"),i(r,"createHTMLDocument"),o(r,"hasFeature"),f(window.DOMImplementation,r),p([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),e.wrappers.Document=t,e.wrappers.DOMImplementation=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.mixin,i=e.registerWrapper,o=e.unwrap,a=e.unwrapIfNeeded,l=e.wrap,s=window.Window;t.prototype=Object.create(n.prototype);var u=window.getComputedStyle;s.prototype.getComputedStyle=function(e,t){return u.call(this||window,a(e),t)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){s.prototype[e]=function(){var t=l(this||window);return t[e].apply(t,arguments)}}),r(t.prototype,{getComputedStyle:function(e,t){return u.call(o(this),a(e),t)}}),i(s,t),e.wrappers.Window=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){this.impl=e}function n(e){return new t(e)}function r(e){return e.map(n)}function i(e){var t=this;this.impl=new c(function(n){e.call(t,r(n),t)})}var o=e.defineGetter,a=e.defineWrapGetter,l=e.registerWrapper,s=e.unwrapIfNeeded,u=e.wrapNodeList;e.wrappers;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){var d=window.MutationRecord;t.prototype={get addedNodes(){return u(this.impl.addedNodes)},get removedNodes(){return u(this.impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function(e){a(t,e)}),["type","attributeName","attributeNamespace","oldValue"].forEach(function(e){o(t,e,function(){return this.impl[e]
+})}),d&&l(d,t),window.Node,i.prototype={observe:function(e,t){this.impl.observe(s(e),t)},disconnect:function(){this.impl.disconnect()},takeRecords:function(){return r(this.impl.takeRecords())}},e.wrappers.MutationObserver=i,e.wrappers.MutationRecord=t}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e],r=window[t];if(r){var i=document.createElement(e),o=i.constructor;window[t]=o}}e.isWrapperFor;var n={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};Object.keys(n).forEach(t),Object.getOwnPropertyNames(e.wrappers).forEach(function(t){window[t]=e.wrappers[t]}),e.knownElements=n}(this.ShadowDOMPolyfill),function(){var e=window.ShadowDOMPolyfill;e.wrap,Object.defineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.createShadowRoot,window.dartExperimentalFixupGetTag=function(t){function n(e){if(e instanceof r)return"NodeList";if(e instanceof i)return"ShadowRoot";if(e instanceof MutationRecord)return"MutationRecord";if(e instanceof MutationObserver)return"MutationObserver";if(o(e)){e=a(e);var n=e.constructor;if(n&&n._ShadowDOMPolyfill$isGeneratedWrapper){var l=n._ShadowDOMPolyfill$cacheTag_;return l||(l=Object.prototype.toString.call(e),l=l.substring(8,l.length-1),n._ShadowDOMPolyfill$cacheTag_=l),l}}return t(e)}var r=e.wrappers.NodeList,i=e.wrappers.ShadowRoot,o=e.isWrapper,a=e.unwrap;return n}}()}
\ No newline at end of file
diff --git a/pkg/unittest/lib/interactive_html_config.dart b/pkg/unittest/lib/interactive_html_config.dart
index 4f5dccd..106b071 100644
--- a/pkg/unittest/lib/interactive_html_config.dart
+++ b/pkg/unittest/lib/interactive_html_config.dart
@@ -20,7 +20,6 @@
import 'dart:html';
import 'dart:async';
import 'dart:json' as json;
-import 'dart:math';
import 'package:stack_trace/stack_trace.dart';
diff --git a/pkg/unittest/lib/mirror_matchers.dart b/pkg/unittest/lib/mirror_matchers.dart
index 7e91529..7d1597f 100644
--- a/pkg/unittest/lib/mirror_matchers.dart
+++ b/pkg/unittest/lib/mirror_matchers.dart
@@ -27,9 +27,7 @@
*/
library mirror_matchers;
-import 'dart:async';
import 'dart:mirrors';
-import 'package:meta/meta.dart';
import 'matcher.dart';
diff --git a/pkg/unittest/lib/src/test_case.dart b/pkg/unittest/lib/src/test_case.dart
index 75e126c..d965082 100644
--- a/pkg/unittest/lib/src/test_case.dart
+++ b/pkg/unittest/lib/src/test_case.dart
@@ -68,7 +68,14 @@
bool get isComplete => !enabled || result != null;
Function _errorHandler(String stage) => (e) {
- var stack = getAttachedStackTrace(e);
+ var stack;
+ // TODO(kevmoo): Ideally, getAttachedStackTrace should handle Error as well?
+ // https://code.google.com/p/dart/issues/detail?id=12240
+ if(e is Error) {
+ stack = e.stackTrace;
+ } else {
+ stack = getAttachedStackTrace(e);
+ }
if (result == null || result == PASS) {
if (e is TestFailure) {
fail("$e", stack);
diff --git a/pkg/unittest/lib/unittest.dart b/pkg/unittest/lib/unittest.dart
index 081439f..43365f4 100644
--- a/pkg/unittest/lib/unittest.dart
+++ b/pkg/unittest/lib/unittest.dart
@@ -146,7 +146,6 @@
import 'dart:async';
import 'dart:collection';
import 'dart:isolate';
-import 'dart:math' show max;
import 'matcher.dart';
export 'matcher.dart';
diff --git a/pkg/unittest/test/matchers_test.dart b/pkg/unittest/test/matchers_test.dart
index b78ee47..1ec1e92 100644
--- a/pkg/unittest/test/matchers_test.dart
+++ b/pkg/unittest/test/matchers_test.dart
@@ -7,7 +7,6 @@
import 'package:unittest/unittest.dart';
-import 'test_common.dart';
import 'test_utils.dart';
void main() {
diff --git a/pkg/unittest/test/mirror_matchers_test.dart b/pkg/unittest/test/mirror_matchers_test.dart
index 22e011c..4a445ed 100644
--- a/pkg/unittest/test/mirror_matchers_test.dart
+++ b/pkg/unittest/test/mirror_matchers_test.dart
@@ -2,13 +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 'dart:async';
-import 'dart:collection';
-
import 'package:unittest/unittest.dart';
import 'package:unittest/mirror_matchers.dart';
-import 'test_common.dart';
import 'test_utils.dart';
void main() {
diff --git a/pkg/unmodifiable_collection/test/unmodifiable_collection_test.dart b/pkg/unmodifiable_collection/test/unmodifiable_collection_test.dart
index 2e96e48..c71b7e8 100644
--- a/pkg/unmodifiable_collection/test/unmodifiable_collection_test.dart
+++ b/pkg/unmodifiable_collection/test/unmodifiable_collection_test.dart
@@ -443,11 +443,11 @@
});
testThrows("$name - removeWhere throws", () {
- wrapped.removeWhere((E element) => false);
+ wrapped.removeWhere((element) => false);
});
testThrows("$name - retainWhere throws", () {
- wrapped.retainWhere((E element) => true);
+ wrapped.retainWhere((element) => true);
});
testThrows("$name - removeRange throws", () {
diff --git a/pkg/watcher/lib/src/async_queue.dart b/pkg/watcher/lib/src/async_queue.dart
new file mode 100644
index 0000000..9456631
--- /dev/null
+++ b/pkg/watcher/lib/src/async_queue.dart
@@ -0,0 +1,74 @@
+// 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 watcher.async_queue;
+
+import 'dart:async';
+import 'dart:collection';
+
+typedef Future ItemProcessor<T>(T item);
+typedef void ErrorHandler(error);
+
+/// A queue of items that are sequentially, asynchronously processed.
+///
+/// Unlike [Stream.map] or [Stream.forEach], the callback used to process each
+/// item returns a [Future], and it will not advance to the next item until the
+/// current item is finished processing.
+///
+/// Items can be added at any point in time and processing will be started as
+/// needed. When all items are processed, it stops processing until more items
+/// are added.
+class AsyncQueue<T> {
+ final _items = new Queue<T>();
+
+ /// Whether or not the queue is currently waiting on a processing future to
+ /// complete.
+ bool _isProcessing = false;
+
+ /// The callback to invoke on each queued item.
+ ///
+ /// The next item in the queue will not be processed until the [Future]
+ /// returned by this completes.
+ final ItemProcessor<T> _processor;
+
+ /// The handler for errors thrown during processing.
+ ///
+ /// Used to avoid top-leveling asynchronous errors.
+ final ErrorHandler _errorHandler;
+
+ AsyncQueue(this._processor, {ErrorHandler onError})
+ : _errorHandler = onError;
+
+ /// Enqueues [item] to be processed and starts asynchronously processing it
+ /// if a process isn't already running.
+ void add(T item) {
+ _items.add(item);
+
+ // Start up the asynchronous processing if not already running.
+ if (_isProcessing) return;
+ _isProcessing = true;
+
+ _processNextItem().catchError(_errorHandler);
+ }
+
+ /// Removes all remaining items to be processed.
+ void clear() {
+ _items.clear();
+ }
+
+ /// Pulls the next item off [_items] and processes it.
+ ///
+ /// When complete, recursively calls itself to continue processing unless
+ /// the process was cancelled.
+ Future _processNextItem() {
+ var item = _items.removeFirst();
+ return _processor(item).then((_) {
+ if (_items.isNotEmpty) return _processNextItem();
+
+ // We have drained the queue, stop processing and wait until something
+ // has been enqueued.
+ _isProcessing = false;
+ });
+ }
+}
\ No newline at end of file
diff --git a/pkg/watcher/lib/src/directory_watcher.dart b/pkg/watcher/lib/src/directory_watcher.dart
index 61bf6c5..c5dd9db 100644
--- a/pkg/watcher/lib/src/directory_watcher.dart
+++ b/pkg/watcher/lib/src/directory_watcher.dart
@@ -9,6 +9,7 @@
import 'package:crypto/crypto.dart';
+import 'async_queue.dart';
import 'stat.dart';
import 'watch_event.dart';
@@ -27,7 +28,7 @@
Stream<WatchEvent> get events => _events.stream;
StreamController<WatchEvent> _events;
- _WatchState _state = _WatchState.notWatching;
+ _WatchState _state = _WatchState.UNSUBSCRIBED;
/// A [Future] that completes when the watcher is initialized and watching
/// for file changes.
@@ -51,6 +52,26 @@
/// Used to tell which files have been modified.
final _statuses = new Map<String, _FileStatus>();
+ /// The subscription used while [directory] is being listed.
+ ///
+ /// Will be `null` if a list is not currently happening.
+ StreamSubscription<FileSystemEntity> _listSubscription;
+
+ /// The queue of files waiting to be processed to see if they have been
+ /// modified.
+ ///
+ /// Processing a file is asynchronous, as is listing the directory, so the
+ /// queue exists to let each of those proceed at their own rate. The lister
+ /// will enqueue files as quickly as it can. Meanwhile, files are dequeued
+ /// and processed sequentially.
+ AsyncQueue<String> _filesToProcess;
+
+ /// The set of files that have been seen in the current directory listing.
+ ///
+ /// Used to tell which files have been removed: files that are in [_statuses]
+ /// but not in here when a poll completes have been removed.
+ final _polledFiles = new Set<String>();
+
/// Creates a new [DirectoryWatcher] monitoring [directory].
///
/// If [pollingDelay] is passed, it specifies the amount of time the watcher
@@ -60,82 +81,133 @@
DirectoryWatcher(this.directory, {Duration pollingDelay})
: pollingDelay = pollingDelay != null ? pollingDelay :
new Duration(seconds: 1) {
- _events = new StreamController<WatchEvent>.broadcast(onListen: () {
- _state = _state.listen(this);
- }, onCancel: () {
- _state = _state.cancel(this);
- });
+ _events = new StreamController<WatchEvent>.broadcast(
+ onListen: _watch, onCancel: _cancel);
+
+ _filesToProcess = new AsyncQueue<String>(_processFile,
+ onError: _events.addError);
}
- /// Starts the asynchronous polling process.
- ///
- /// Scans the contents of the directory and compares the results to the
- /// previous scan. Loops to continue monitoring as long as there are
- /// subscribers to the [events] stream.
- Future _watch() {
- var files = new Set<String>();
+ /// Scans to see which files were already present before the watcher was
+ /// subscribed to, and then starts watching the directory for changes.
+ void _watch() {
+ assert(_state == _WatchState.UNSUBSCRIBED);
+ _state = _WatchState.SCANNING;
+ _poll();
+ }
+
+ /// Stops watching the directory when there are no more subscribers.
+ void _cancel() {
+ assert(_state != _WatchState.UNSUBSCRIBED);
+ _state = _WatchState.UNSUBSCRIBED;
+
+ // If we're in the middle of listing the directory, stop.
+ if (_listSubscription != null) _listSubscription.cancel();
+
+ // Don't process any remaining files.
+ _filesToProcess.clear();
+ _polledFiles.clear();
+ _statuses.clear();
+
+ _ready = new Completer();
+ }
+
+ /// Scans the contents of the directory once to see which files have been
+ /// added, removed, and modified.
+ void _poll() {
+ _filesToProcess.clear();
+ _polledFiles.clear();
var stream = new Directory(directory).list(recursive: true);
+ _listSubscription = stream.listen((entity) {
+ assert(_state != _WatchState.UNSUBSCRIBED);
- return stream.map((entity) {
- if (entity is! File) return new Future.value();
- files.add(entity.path);
- // TODO(rnystrom): These all run as fast as possible and read the
- // contents of the files. That means there's a pretty big IO hit all at
- // once. Maybe these should be queued up and rate limited?
- return _refreshFile(entity.path);
- }).toList().then((futures) {
- // Once the listing is done, make sure to wait until each file is also
- // done.
- return Future.wait(futures);
- }).then((_) {
- var removedFiles = _statuses.keys.toSet().difference(files);
- for (var removed in removedFiles) {
- if (_state.shouldNotify) {
- _events.add(new WatchEvent(ChangeType.REMOVE, removed));
- }
- _statuses.remove(removed);
- }
+ if (entity is! File) return;
+ _filesToProcess.add(entity.path);
+ }, onDone: () {
+ assert(_state != _WatchState.UNSUBSCRIBED);
+ _listSubscription = null;
- var previousState = _state;
- _state = _state.finish(this);
-
- // If we were already sending notifications, add a bit of delay before
- // restarting just so that we don't whale on the file system.
- // TODO(rnystrom): Tune this and/or make it tunable?
- if (_state.shouldNotify) {
- return new Future.delayed(pollingDelay);
- }
- }).then((_) {
- // Make sure we haven't transitioned to a non-watching state during the
- // delay.
- if (_state.shouldWatch) _watch();
+ // Null tells the queue consumer that we're done listing.
+ _filesToProcess.add(null);
});
}
- /// Compares the current state of the file at [path] to the state it was in
- /// the last time it was scanned.
- Future _refreshFile(String path) {
- return getModificationTime(path).then((modified) {
- var lastStatus = _statuses[path];
+ /// Processes [file] to determine if it has been modified since the last
+ /// time it was scanned.
+ Future _processFile(String file) {
+ assert(_state != _WatchState.UNSUBSCRIBED);
- // If it's modification time hasn't changed, assume the file is unchanged.
- if (lastStatus != null && lastStatus.modified == modified) return;
+ // `null` is the sentinel which means the directory listing is complete.
+ if (file == null) return _completePoll();
- return _hashFile(path).then((hash) {
+ return getModificationTime(file).then((modified) {
+ if (_checkForCancel()) return;
+
+ var lastStatus = _statuses[file];
+
+ // If its modification time hasn't changed, assume the file is unchanged.
+ if (lastStatus != null && lastStatus.modified == modified) {
+ // The file is still here.
+ _polledFiles.add(file);
+ return;
+ }
+
+ return _hashFile(file).then((hash) {
+ if (_checkForCancel()) return;
+
var status = new _FileStatus(modified, hash);
- _statuses[path] = status;
+ _statuses[file] = status;
+ _polledFiles.add(file);
- // Only notify if the file contents changed.
- if (_state.shouldNotify &&
- (lastStatus == null || !_sameHash(lastStatus.hash, hash))) {
- var change = lastStatus == null ? ChangeType.ADD : ChangeType.MODIFY;
- _events.add(new WatchEvent(change, path));
- }
+ // Only notify while in the watching state.
+ if (_state != _WatchState.WATCHING) return;
+
+ // And the file is different.
+ var changed = lastStatus == null || !_sameHash(lastStatus.hash, hash);
+ if (!changed) return;
+
+ var type = lastStatus == null ? ChangeType.ADD : ChangeType.MODIFY;
+ _events.add(new WatchEvent(type, file));
});
});
}
+ /// After the directory listing is complete, this determines which files were
+ /// removed and then restarts the next poll.
+ Future _completePoll() {
+ // Any files that were not seen in the last poll but that we have a
+ // status for must have been removed.
+ var removedFiles = _statuses.keys.toSet().difference(_polledFiles);
+ for (var removed in removedFiles) {
+ if (_state == _WatchState.WATCHING) {
+ _events.add(new WatchEvent(ChangeType.REMOVE, removed));
+ }
+ _statuses.remove(removed);
+ }
+
+ if (_state == _WatchState.SCANNING) {
+ _state = _WatchState.WATCHING;
+ _ready.complete();
+ }
+
+ // Wait and then poll again.
+ return new Future.delayed(pollingDelay).then((_) {
+ if (_checkForCancel()) return;
+ _poll();
+ });
+ }
+
+ /// Returns `true` and clears the processing queue if the watcher has been
+ /// unsubscribed.
+ bool _checkForCancel() {
+ if (_state != _WatchState.UNSUBSCRIBED) return false;
+
+ // Don't process any more files.
+ _filesToProcess.clear();
+ return true;
+ }
+
/// Calculates the SHA-1 hash of the file at [path].
Future<List<int>> _hashFile(String path) {
return new File(path).readAsBytes().then((bytes) {
@@ -159,71 +231,29 @@
}
}
-/// An "event" that is sent to the [_WatchState] FSM to trigger state
-/// transitions.
-typedef _WatchState _WatchStateEvent(DirectoryWatcher watcher);
-
-/// The different states that the watcher can be in and the transitions between
-/// them.
-///
-/// This class defines a finite state machine for keeping track of what the
-/// asynchronous file polling is doing. Each instance of this is a state in the
-/// machine and its [listen], [cancel], and [finish] fields define the state
-/// transitions when those events occur.
+/// Enum class for the states that the [DirectoryWatcher] can be in.
class _WatchState {
- /// The watcher has no subscribers.
- static final notWatching = new _WatchState(
- listen: (watcher) {
- watcher._watch();
- return _WatchState.scanning;
- });
+ /// There are no subscribers to the watcher's event stream and no watching
+ /// is going on.
+ static const UNSUBSCRIBED = const _WatchState("unsubscribed");
- /// The watcher has subscribers and is scanning for pre-existing files.
- static final scanning = new _WatchState(
- cancel: (watcher) {
- // No longer watching, so create a new incomplete ready future.
- watcher._ready = new Completer();
- return _WatchState.cancelling;
- }, finish: (watcher) {
- watcher._ready.complete();
- return _WatchState.watching;
- }, shouldWatch: true);
+ /// There are subscribers and the watcher is doing an initial scan of the
+ /// directory to see which files were already present before watching started.
+ ///
+ /// The watcher does not send notifications for changes that occurred while
+ /// there were no subscribers, or for files already present before watching.
+ /// The initial scan is used to determine what "before watching" state of
+ /// the file system was.
+ static const SCANNING = const _WatchState("scanning");
- /// The watcher was unsubscribed while polling and we're waiting for the poll
- /// to finish.
- static final cancelling = new _WatchState(
- listen: (_) => _WatchState.scanning,
- finish: (_) => _WatchState.notWatching);
+ /// There are subscribers and the watcher is polling the directory to look
+ /// for changes.
+ static const WATCHING = const _WatchState("watching");
- /// The watcher has subscribers, we have scanned for pre-existing files and
- /// now we're polling for changes.
- static final watching = new _WatchState(
- cancel: (watcher) {
- // No longer watching, so create a new incomplete ready future.
- watcher._ready = new Completer();
- return _WatchState.cancelling;
- }, finish: (_) => _WatchState.watching,
- shouldWatch: true, shouldNotify: true);
+ /// The name of the state.
+ final String name;
- /// Called when the first subscriber to the watcher has been added.
- final _WatchStateEvent listen;
-
- /// Called when all subscriptions on the watcher have been cancelled.
- final _WatchStateEvent cancel;
-
- /// Called when a poll loop has finished.
- final _WatchStateEvent finish;
-
- /// If the directory watcher should be watching the file system while in
- /// this state.
- final bool shouldWatch;
-
- /// If a change event should be sent for a file modification while in this
- /// state.
- final bool shouldNotify;
-
- _WatchState({this.listen, this.cancel, this.finish,
- this.shouldWatch: false, this.shouldNotify: false});
+ const _WatchState(this.name);
}
class _FileStatus {
diff --git a/pkg/watcher/test/directory_watcher_test.dart b/pkg/watcher/test/directory_watcher_test.dart
index 800d54d..9070179 100644
--- a/pkg/watcher/test/directory_watcher_test.dart
+++ b/pkg/watcher/test/directory_watcher_test.dart
@@ -2,11 +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:async';
-import 'dart:io';
-
import 'package:scheduled_test/scheduled_test.dart';
-import 'package:watcher/watcher.dart';
import 'utils.dart';
diff --git a/pkg/watcher/test/no_subscription_test.dart b/pkg/watcher/test/no_subscription_test.dart
index e9cb4e3..d0a396a 100644
--- a/pkg/watcher/test/no_subscription_test.dart
+++ b/pkg/watcher/test/no_subscription_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:watcher/watcher.dart';
@@ -23,11 +22,11 @@
// Subscribe to the events.
var completer = new Completer();
- var subscription = watcher.events.listen((event) {
+ var subscription = watcher.events.listen(wrapAsync((event) {
expect(event.type, equals(ChangeType.ADD));
expect(event.path, endsWith("file.txt"));
completer.complete();
- });
+ }));
writeFile("file.txt");
@@ -45,20 +44,20 @@
// Then start listening again.
schedule(() {
completer = new Completer();
- subscription = watcher.events.listen((event) {
+ subscription = watcher.events.listen(wrapAsync((event) {
// We should get an event for the third file, not the one added while
// we weren't subscribed.
expect(event.type, equals(ChangeType.ADD));
expect(event.path, endsWith("added.txt"));
completer.complete();
- });
+ }));
});
// The watcher will have been cancelled and then resumed in the middle of
// its pause between polling loops. That means the second scan to skip
// what changed while we were unsubscribed won't happen until after that
// delay is done. Wait long enough for that to happen.
- schedule(() => new Future.delayed(new Duration(seconds: 1)));
+ schedule(() => new Future.delayed(watcher.pollingDelay * 2));
// And add a third file.
writeFile("added.txt");
diff --git a/pkg/watcher/test/ready_test.dart b/pkg/watcher/test/ready_test.dart
index dd799ce..11b77e0 100644
--- a/pkg/watcher/test/ready_test.dart
+++ b/pkg/watcher/test/ready_test.dart
@@ -3,10 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
-import 'package:watcher/watcher.dart';
import 'utils.dart';
diff --git a/pkg/watcher/test/utils.dart b/pkg/watcher/test/utils.dart
index 5053b76..65d4719 100644
--- a/pkg/watcher/test/utils.dart
+++ b/pkg/watcher/test/utils.dart
@@ -84,7 +84,7 @@
// Wait until the scan is finished so that we don't miss changes to files
// that could occur before the scan completes.
if (waitForReady != false) {
- schedule(() => _watcher.ready);
+ schedule(() => _watcher.ready, "wait for watcher to be ready");
}
currentSchedule.onComplete.schedule(() {
@@ -107,7 +107,7 @@
// Schedule it so that later file modifications don't occur until after this
// event is received.
- schedule(() => future);
+ schedule(() => future, "wait for $type event");
}
void expectAddEvent(String path) {
@@ -149,14 +149,14 @@
var milliseconds = _mockFileModificationTimes.putIfAbsent(path, () => 0);
_mockFileModificationTimes[path]++;
}
- });
+ }, "write file $path");
}
/// Schedules deleting a file in the sandbox at [path].
void deleteFile(String path) {
schedule(() {
new File(p.join(_sandboxDir, path)).deleteSync();
- });
+ }, "delete file $path");
}
/// Schedules renaming a file in the sandbox from [from] to [to].
@@ -172,7 +172,7 @@
// Manually update the mock modification time for the file.
var milliseconds = _mockFileModificationTimes.putIfAbsent(to, () => 0);
_mockFileModificationTimes[to]++;
- });
+ }, "rename file $from to $to");
}
/// A [Matcher] for [WatchEvent]s.
diff --git a/pkg/yaml/lib/src/model.dart b/pkg/yaml/lib/src/model.dart
index d7ee481..37247f0 100644
--- a/pkg/yaml/lib/src/model.dart
+++ b/pkg/yaml/lib/src/model.dart
@@ -7,7 +7,6 @@
/// representation graph.
library model;
-import 'model.dart';
import 'parser.dart';
import 'utils.dart';
import 'visitor.dart';
diff --git a/runtime/bin/builtin_natives.cc b/runtime/bin/builtin_natives.cc
index e45088f..36d7a75 100644
--- a/runtime/bin/builtin_natives.cc
+++ b/runtime/bin/builtin_natives.cc
@@ -97,7 +97,6 @@
// Implementation of native functions which are used for some
// test/debug functionality in standalone dart mode.
void FUNCTION_NAME(Logger_PrintString)(Dart_NativeArguments args) {
- Dart_EnterScope();
intptr_t length = 0;
uint8_t* chars = NULL;
Dart_Handle str = Dart_GetNativeArgument(args, 0);
@@ -113,7 +112,6 @@
}
fputc('\n', stdout);
fflush(stdout);
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/crypto.cc b/runtime/bin/crypto.cc
index af3d386b4a..4c0943a 100644
--- a/runtime/bin/crypto.cc
+++ b/runtime/bin/crypto.cc
@@ -12,7 +12,6 @@
namespace bin {
void FUNCTION_NAME(Crypto_GetRandomBytes)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle count_obj = Dart_GetNativeArgument(args, 0);
int64_t count = 0;
if (!DartUtils::GetInt64Value(count_obj, &count)) {
@@ -35,7 +34,6 @@
Dart_ListSetAsBytes(result, 0, buffer, count);
Dart_SetReturnValue(args, result);
delete[] buffer;
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index a90694d..a2fdf9d 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -364,12 +364,12 @@
static const uint8_t* ReadFileFully(const char* filename,
intptr_t* file_len,
const char** error_msg) {
+ *file_len = -1;
void* stream = DartUtils::OpenFile(filename, false);
if (stream == NULL) {
SET_ERROR_MSG(error_msg, "Unable to open file: %s", filename);
return NULL;
}
- *file_len = -1;
const uint8_t* text_buffer = NULL;
DartUtils::ReadFile(&text_buffer, file_len, stream);
if (text_buffer == NULL || *file_len == -1) {
diff --git a/runtime/bin/dbg_connection_macos.cc b/runtime/bin/dbg_connection_macos.cc
index d6766fd..3ee5bf3 100644
--- a/runtime/bin/dbg_connection_macos.cc
+++ b/runtime/bin/dbg_connection_macos.cc
@@ -88,7 +88,10 @@
int status =
TEMP_FAILURE_RETRY(kevent(kqueue_fd_, &ev_add, 1, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed adding debugger socket to kqueue: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed adding debugger socket to kqueue: %s\n", error_message);
}
*/
} else if (ident == wakeup_fds_[0]) {
@@ -112,7 +115,10 @@
int result = TEMP_FAILURE_RETRY(
kevent(kqueue_fd_, NULL, 0, events, kMaxEvents, NULL));
if (result == -1) {
- FATAL1("kevent failed %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("kevent failed %s\n", error_message);
} else {
ASSERT(result <= kMaxEvents);
for (int i = 0; i < result; i++) {
@@ -141,7 +147,10 @@
EV_SET(&event, wakeup_fds_[0], EVFILT_READ, EV_ADD, 0, 0, NULL);
int status = TEMP_FAILURE_RETRY(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed adding wakeup pipe fd to kqueue: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed adding wakeup pipe fd to kqueue: %s\n", error_message);
}
// Register the listening socket.
@@ -149,7 +158,10 @@
EVFILT_READ, EV_ADD, 0, 0, NULL);
status = TEMP_FAILURE_RETRY(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed adding listener socket to kqueue: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed adding listener socket to kqueue: %s\n", error_message);
}
}
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 3d86916..0f771ee 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -22,18 +22,15 @@
void FUNCTION_NAME(Directory_Current)(Dart_NativeArguments args) {
- Dart_EnterScope();
char* current = Directory::Current();
if (current != NULL) {
Dart_SetReturnValue(args, DartUtils::NewString(current));
free(current);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Directory_SetCurrent)(Dart_NativeArguments args) {
- Dart_EnterScope();
int argc = Dart_GetNativeArgumentCount(args);
Dart_Handle path;
if (argc == 1) {
@@ -50,14 +47,12 @@
Dart_SetReturnValue(args, err);
}
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Directory_Exists)(Dart_NativeArguments args) {
static const int kExists = 1;
static const int kDoesNotExist = 0;
- Dart_EnterScope();
Dart_Handle path = Dart_GetNativeArgument(args, 0);
Directory::ExistsResult result =
Directory::Exists(DartUtils::GetStringValue(path));
@@ -70,12 +65,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Directory_Create)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle path = Dart_GetNativeArgument(args, 0);
if (Directory::Create(DartUtils::GetStringValue(path))) {
Dart_SetReturnValue(args, Dart_True());
@@ -84,12 +77,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle path = Dart_GetNativeArgument(args, 0);
char* result = Directory::CreateTemp(DartUtils::GetStringValue(path));
if (result != NULL) {
@@ -100,12 +91,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle path = Dart_GetNativeArgument(args, 0);
Dart_Handle recursive = Dart_GetNativeArgument(args, 1);
if (Directory::Delete(DartUtils::GetStringValue(path),
@@ -116,12 +105,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Directory_Rename)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle path = Dart_GetNativeArgument(args, 0);
Dart_Handle newPath = Dart_GetNativeArgument(args, 1);
if (Directory::Rename(DartUtils::GetStringValue(path),
@@ -132,12 +119,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Directory_List)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle path = Dart_GetNativeArgument(args, 0);
Dart_Handle recursive = Dart_GetNativeArgument(args, 1);
// Create the list to hold the directory listing here, and pass it to the
@@ -156,7 +141,6 @@
DartUtils::GetBooleanValue(follow_links));
Directory::List(&sync_listing);
Dart_SetReturnValue(args, results);
- Dart_ExitScope();
}
@@ -356,7 +340,6 @@
void FUNCTION_NAME(Directory_NewServicePort)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, Dart_Null());
Dart_Port service_port = Directory::GetServicePort();
if (service_port != ILLEGAL_PORT) {
@@ -364,7 +347,6 @@
Dart_Handle send_port = Dart_NewSendPort(service_port);
Dart_SetReturnValue(args, send_port);
}
- Dart_ExitScope();
}
diff --git a/runtime/bin/eventhandler.cc b/runtime/bin/eventhandler.cc
index 3cb5456..a07cf3d 100644
--- a/runtime/bin/eventhandler.cc
+++ b/runtime/bin/eventhandler.cc
@@ -89,7 +89,6 @@
* holds the reference to the dart EventHandler object.
*/
void FUNCTION_NAME(EventHandler_SendData)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle sender = Dart_GetNativeArgument(args, 1);
intptr_t id = kInvalidId;
if (Dart_IsNull(sender)) {
@@ -109,7 +108,6 @@
event_handler->SendData(id, dart_port, data);
}
}
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/eventhandler_android.cc b/runtime/bin/eventhandler_android.cc
index 258a96b..90f94b4 100644
--- a/runtime/bin/eventhandler_android.cc
+++ b/runtime/bin/eventhandler_android.cc
@@ -88,7 +88,10 @@
sd->set_tracked_by_epoll(true);
}
if (status == -1) {
- FATAL1("Failed updating epoll instance: %s", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed updating epoll instance: %s", error_message);
}
}
}
@@ -306,7 +309,10 @@
event_mask = (1 << kCloseEvent);
sd->MarkClosedRead();
} else if (errno != EWOULDBLOCK) {
- Log::PrintErr("Error recv: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error recv: %s\n", error_message);
}
}
}
diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
index cae7403..111e7e6 100644
--- a/runtime/bin/eventhandler_linux.cc
+++ b/runtime/bin/eventhandler_linux.cc
@@ -320,7 +320,10 @@
event_mask = (1 << kCloseEvent);
sd->MarkClosedRead();
} else if (errno != EWOULDBLOCK) {
- Log::PrintErr("Error recv: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ Log::PrintErr("Error recv: %s\n",
+ strerror_r(errno, error_buf, kBufferSize));
}
}
}
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index 1570015..971ef1b 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -63,7 +63,10 @@
int status =
TEMP_FAILURE_RETRY(kevent(kqueue_fd_, events, changes, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed deleting events from kqueue: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed deleting events from kqueue: %s\n", error_message);
}
}
}
@@ -142,7 +145,10 @@
EV_SET(&event, interrupt_fds_[0], EVFILT_READ, EV_ADD, 0, 0, NULL);
int status = TEMP_FAILURE_RETRY(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed adding interrupt fd to kqueue: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed adding interrupt fd to kqueue: %s\n", error_message);
}
}
@@ -337,7 +343,10 @@
for (int i = 0; i < size; i++) {
// If flag EV_ERROR is set it indicates an error in kevent processing.
if ((events[i].flags & EV_ERROR) != 0) {
- FATAL1("kevent failed %s\n", strerror(events[i].data));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(events[i].data, error_message, kBufferSize);
+ FATAL1("kevent failed %s\n", error_message);
}
if (events[i].udata != NULL) {
SocketData* sd = reinterpret_cast<SocketData*>(events[i].udata);
@@ -405,7 +414,10 @@
kMaxEvents,
timeout));
if (result == -1) {
- FATAL1("kevent failed %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("kevent failed %s\n", error_message);
} else {
handler_impl->HandleTimeout();
handler_impl->HandleEvents(events, result);
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index ad1d6c0..bb68071 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -77,7 +77,6 @@
void FUNCTION_NAME(File_Open)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* filename =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
int64_t mode = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
@@ -98,32 +97,26 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Exists)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* filename =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
bool exists = File::Exists(filename);
Dart_SetReturnValue(args, Dart_NewBoolean(exists));
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Close)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
delete file;
Dart_SetReturnValue(args, Dart_NewInteger(0));
- Dart_ExitScope();
}
void FUNCTION_NAME(File_ReadByte)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
uint8_t buffer;
@@ -137,12 +130,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_WriteByte)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
int64_t byte = 0;
@@ -162,12 +153,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Read)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
Dart_Handle length_object = Dart_GetNativeArgument(args, 1);
@@ -208,12 +197,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_ReadInto)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
Dart_Handle buffer_obj = Dart_GetNativeArgument(args, 1);
@@ -246,12 +233,10 @@
Dart_SetReturnValue(args, err);
}
delete[] buffer;
- Dart_ExitScope();
}
void FUNCTION_NAME(File_WriteFrom)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
@@ -292,12 +277,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Position)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
intptr_t return_value = file->Position();
@@ -308,12 +291,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_SetPosition)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
int64_t position = 0;
@@ -331,12 +312,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Truncate)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
int64_t length = 0;
@@ -354,12 +333,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Length)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
intptr_t return_value = file->Length();
@@ -370,12 +347,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_LengthFromPath)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* path =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
intptr_t return_value = File::LengthFromPath(path);
@@ -386,12 +361,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_LastModified)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* name =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
int64_t return_value = File::LastModified(name);
@@ -402,12 +375,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Flush)(Dart_NativeArguments args) {
- Dart_EnterScope();
File* file = GetFilePointer(Dart_GetNativeArgument(args, 0));
ASSERT(file != NULL);
if (file->Flush()) {
@@ -417,12 +388,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* str =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
bool result = File::Create(str);
@@ -433,12 +402,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_CreateLink)(Dart_NativeArguments args) {
- Dart_EnterScope();
if (Dart_IsString(Dart_GetNativeArgument(args, 0)) &&
Dart_IsString(Dart_GetNativeArgument(args, 1))) {
const char* name =
@@ -456,12 +423,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_LinkTarget)(Dart_NativeArguments args) {
- Dart_EnterScope();
if (Dart_IsString(Dart_GetNativeArgument(args, 0))) {
const char* name =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
@@ -480,12 +445,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* str =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
bool result = File::Delete(str);
@@ -496,12 +459,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_DeleteLink)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* str =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
bool result = File::DeleteLink(str);
@@ -512,12 +473,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Rename)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* old_path =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
const char* new_path =
@@ -530,12 +489,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_RenameLink)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* old_path =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
const char* new_path =
@@ -548,12 +505,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) {
- Dart_EnterScope();
const char* str =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
char* path = File::GetCanonicalPath(str);
@@ -565,32 +520,26 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_OpenStdio)(Dart_NativeArguments args) {
- Dart_EnterScope();
int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
ASSERT(fd == 0 || fd == 1 || fd == 2);
File* file = File::OpenStdio(static_cast<int>(fd));
Dart_SetReturnValue(args, Dart_NewInteger(reinterpret_cast<intptr_t>(file)));
- Dart_ExitScope();
}
void FUNCTION_NAME(File_GetStdioHandleType)(Dart_NativeArguments args) {
- Dart_EnterScope();
int64_t fd = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 0));
ASSERT(fd == 0 || fd == 1 || fd == 2);
File::StdioHandleType type = File::GetStdioHandleType(static_cast<int>(fd));
Dart_SetReturnValue(args, Dart_NewInteger(type));
- Dart_ExitScope();
}
void FUNCTION_NAME(File_GetType)(Dart_NativeArguments args) {
- Dart_EnterScope();
if (Dart_IsString(Dart_GetNativeArgument(args, 0)) &&
Dart_IsBoolean(Dart_GetNativeArgument(args, 1))) {
const char* str =
@@ -605,12 +554,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_Stat)(Dart_NativeArguments args) {
- Dart_EnterScope();
if (Dart_IsString(Dart_GetNativeArgument(args, 0))) {
const char* path =
DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
@@ -644,12 +591,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(File_AreIdentical)(Dart_NativeArguments args) {
- Dart_EnterScope();
if (Dart_IsString(Dart_GetNativeArgument(args, 0)) &&
Dart_IsString(Dart_GetNativeArgument(args, 1))) {
const char* path_1 =
@@ -670,7 +615,6 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
@@ -1324,7 +1268,6 @@
void FUNCTION_NAME(File_NewServicePort)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, Dart_Null());
Dart_Port service_port = File::GetServicePort();
if (service_port != ILLEGAL_PORT) {
@@ -1332,7 +1275,6 @@
Dart_Handle send_port = Dart_NewSendPort(service_port);
Dart_SetReturnValue(args, send_port);
}
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc
index 9b5ff1b..54ad86a 100644
--- a/runtime/bin/file_android.cc
+++ b/runtime/bin/file_android.cc
@@ -317,7 +317,10 @@
struct stat buf;
int result = fstat(fd, &buf);
if (result == -1) {
- FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL2("Failed stat on file descriptor %d: %s", fd, error_message);
}
if (S_ISCHR(buf.st_mode)) return kTerminal;
if (S_ISFIFO(buf.st_mode)) return kPipe;
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index b45ce04..1e9b49e 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -48,9 +48,8 @@
int err = TEMP_FAILURE_RETRY(close(handle_->fd()));
if (err != 0) {
const int kBufferSize = 1024;
- char error_message[kBufferSize];
- strerror_r(errno, error_message, kBufferSize);
- Log::PrintErr("%s\n", error_message);
+ char error_buf[kBufferSize];
+ Log::PrintErr("%s\n", strerror_r(errno, error_buf, kBufferSize));
}
handle_->set_fd(kClosedFd);
}
@@ -311,7 +310,10 @@
struct stat buf;
int result = fstat(fd, &buf);
if (result == -1) {
- FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ FATAL2("Failed stat on file descriptor %d: %s", fd,
+ strerror_r(errno, error_buf, kBufferSize));
}
if (S_ISCHR(buf.st_mode)) return kTerminal;
if (S_ISFIFO(buf.st_mode)) return kPipe;
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
index 3cf40de..7b3815a 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -319,7 +319,10 @@
struct stat buf;
int result = fstat(fd, &buf);
if (result == -1) {
- FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL2("Failed stat on file descriptor %d: %s", fd, error_message);
}
if (S_ISCHR(buf.st_mode)) return kTerminal;
if (S_ISFIFO(buf.st_mode)) return kPipe;
diff --git a/runtime/bin/filter.cc b/runtime/bin/filter.cc
index d864c34..43b08e7 100644
--- a/runtime/bin/filter.cc
+++ b/runtime/bin/filter.cc
@@ -37,7 +37,6 @@
}
void FUNCTION_NAME(Filter_CreateZLibInflate)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
Filter* filter = new ZLibInflateFilter();
if (filter == NULL || !filter->Init()) {
@@ -50,11 +49,9 @@
delete filter;
Dart_PropagateError(result);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_CreateZLibDeflate)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
Dart_Handle gzip_obj = Dart_GetNativeArgument(args, 1);
Dart_Handle level_obj = Dart_GetNativeArgument(args, 2);
@@ -79,11 +76,9 @@
delete filter;
Dart_PropagateError(result);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
Filter* filter = GetFilter(filter_obj);
Dart_Handle data_obj = Dart_GetNativeArgument(args, 1);
@@ -121,12 +116,10 @@
Dart_ThrowException(DartUtils::NewInternalError(
"Call to Process while still processing data"));
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_Processed)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
Filter* filter = GetFilter(filter_obj);
Dart_Handle flush_obj = Dart_GetNativeArgument(args, 1);
@@ -158,16 +151,13 @@
memmove(io_buffer, filter->processed_buffer(), read);
Dart_SetReturnValue(args, result);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_End)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle filter_obj = Dart_GetNativeArgument(args, 0);
Filter* filter = GetFilter(filter_obj);
EndFilter(filter_obj, filter);
- Dart_ExitScope();
}
diff --git a/runtime/bin/filter_unsupported.cc b/runtime/bin/filter_unsupported.cc
index 617e1c9..1742559 100644
--- a/runtime/bin/filter_unsupported.cc
+++ b/runtime/bin/filter_unsupported.cc
@@ -12,32 +12,22 @@
namespace bin {
void FUNCTION_NAME(Filter_CreateZLibInflate)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewInternalError(
"ZLibInflater and Deflater not supported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_CreateZLibDeflate)(Dart_NativeArguments args) {
- Dart_EnterScope();
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_Process)(Dart_NativeArguments args) {
- Dart_EnterScope();
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_Processed)(Dart_NativeArguments args) {
- Dart_EnterScope();
- Dart_ExitScope();
}
void FUNCTION_NAME(Filter_End)(Dart_NativeArguments args) {
- Dart_EnterScope();
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/io_natives.cc b/runtime/bin/io_natives.cc
index e771d89..30cfb06 100644
--- a/runtime/bin/io_natives.cc
+++ b/runtime/bin/io_natives.cc
@@ -33,6 +33,7 @@
V(Platform_OperatingSystem, 0) \
V(Platform_PathSeparator, 0) \
V(Platform_LocalHostname, 0) \
+ V(Platform_ExecutableName, 0) \
V(Platform_Environment, 0) \
V(Platform_GetVersion, 0) \
V(Process_Start, 10) \
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index b1d60ee..57c5168 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -289,7 +289,6 @@
static int ParseArguments(int argc,
char** argv,
CommandLineOptions* vm_options,
- char** executable_name,
char** script_name,
CommandLineOptions* dart_options,
bool* print_flags_seen,
@@ -297,8 +296,8 @@
const char* kPrefix = "--";
const intptr_t kPrefixLen = strlen(kPrefix);
- // Get the executable name.
- *executable_name = argv[0];
+ // Store the executable name.
+ Platform::SetExecutableName(argv[0]);
// Start the rest after the executable name.
int i = 1;
@@ -360,17 +359,8 @@
static Dart_Handle SetupRuntimeOptions(CommandLineOptions* options,
- const char* executable_name,
const char* script_name) {
int options_count = options->count();
- Dart_Handle dart_executable = DartUtils::NewString(executable_name);
- if (Dart_IsError(dart_executable)) {
- return dart_executable;
- }
- Dart_Handle dart_script = DartUtils::NewString(script_name);
- if (Dart_IsError(dart_script)) {
- return dart_script;
- }
Dart_Handle dart_arguments = Dart_NewList(options_count);
if (Dart_IsError(dart_arguments)) {
return dart_arguments;
@@ -394,35 +384,6 @@
if (Dart_IsError(io_lib)) {
return io_lib;
}
- Dart_Handle platform_class_name = DartUtils::NewString("Platform");
- if (Dart_IsError(platform_class_name)) {
- return platform_class_name;
- }
- Dart_Handle platform_type =
- Dart_GetType(io_lib, platform_class_name, 0, NULL);
- if (Dart_IsError(platform_type)) {
- return platform_type;
- }
- Dart_Handle executable_name_name = DartUtils::NewString("_nativeExecutable");
- if (Dart_IsError(executable_name_name)) {
- return executable_name_name;
- }
- Dart_Handle set_executable_name =
- Dart_SetField(platform_type,
- executable_name_name,
- dart_executable);
- if (Dart_IsError(set_executable_name)) {
- return set_executable_name;
- }
- Dart_Handle script_name_name = DartUtils::NewString("_nativeScript");
- if (Dart_IsError(script_name_name)) {
- return script_name_name;
- }
- Dart_Handle set_script_name =
- Dart_SetField(platform_type, script_name_name, dart_script);
- if (Dart_IsError(set_script_name)) {
- return set_script_name;
- }
Dart_Handle runtime_options_class_name = DartUtils::NewString("_OptionsImpl");
if (Dart_IsError(runtime_options_class_name)) {
return runtime_options_class_name;
@@ -500,7 +461,26 @@
return NULL;
}
- VmService::SendIsolateStartupMessage(Dart_GetMainPortId());
+ Dart_Handle io_lib_url = DartUtils::NewString("dart:io");
+ CHECK_RESULT(io_lib_url);
+ Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url);
+ CHECK_RESULT(io_lib);
+ Dart_Handle platform_class_name = DartUtils::NewString("Platform");
+ CHECK_RESULT(platform_class_name);
+ Dart_Handle platform_type =
+ Dart_GetType(io_lib, platform_class_name, 0, NULL);
+ CHECK_RESULT(platform_type);
+ Dart_Handle script_name_name = DartUtils::NewString("_nativeScript");
+ CHECK_RESULT(script_name_name);
+ Dart_Handle dart_script = DartUtils::NewString(script_uri);
+ CHECK_RESULT(dart_script);
+ Dart_Handle set_script_name =
+ Dart_SetField(platform_type, script_name_name, dart_script);
+ CHECK_RESULT(set_script_name);
+
+ Dart_Handle debug_name = Dart_DebugName();
+ CHECK_RESULT(debug_name);
+ VmService::SendIsolateStartupMessage(Dart_GetMainPortId(), debug_name);
// Make the isolate runnable so that it is ready to handle messages.
Dart_ExitScope();
@@ -696,7 +676,6 @@
int main(int argc, char** argv) {
- char* executable_name;
char* script_name;
CommandLineOptions vm_options(argc);
CommandLineOptions dart_options(argc);
@@ -716,7 +695,6 @@
if (ParseArguments(argc,
argv,
&vm_options,
- &executable_name,
&script_name,
&dart_options,
&print_flags_seen,
@@ -833,7 +811,7 @@
// Create a dart options object that can be accessed from dart code.
Dart_Handle options_result =
- SetupRuntimeOptions(&dart_options, executable_name, script_name);
+ SetupRuntimeOptions(&dart_options, script_name);
if (Dart_IsError(options_result)) {
return DartErrorExit(options_result);
}
diff --git a/runtime/bin/platform.cc b/runtime/bin/platform.cc
index 495ffe3..4d1bbed 100644
--- a/runtime/bin/platform.cc
+++ b/runtime/bin/platform.cc
@@ -12,29 +12,24 @@
namespace dart {
namespace bin {
+const char* Platform::executable_name_ = NULL;
+
void FUNCTION_NAME(Platform_NumberOfProcessors)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, Dart_NewInteger(Platform::NumberOfProcessors()));
- Dart_ExitScope();
}
void FUNCTION_NAME(Platform_OperatingSystem)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, DartUtils::NewString(Platform::OperatingSystem()));
- Dart_ExitScope();
}
void FUNCTION_NAME(Platform_PathSeparator)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, DartUtils::NewString(File::PathSeparator()));
- Dart_ExitScope();
}
void FUNCTION_NAME(Platform_LocalHostname)(Dart_NativeArguments args) {
- Dart_EnterScope();
const intptr_t HOSTNAME_LENGTH = 256;
char hostname[HOSTNAME_LENGTH];
if (Platform::LocalHostname(hostname, HOSTNAME_LENGTH)) {
@@ -42,12 +37,16 @@
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
- Dart_ExitScope();
}
+void FUNCTION_NAME(Platform_ExecutableName)(Dart_NativeArguments args) {
+ ASSERT(Platform::GetExecutableName() != NULL);
+ Dart_SetReturnValue(
+ args, Dart_NewStringFromCString(Platform::GetExecutableName()));
+}
+
void FUNCTION_NAME(Platform_Environment)(Dart_NativeArguments args) {
- Dart_EnterScope();
intptr_t count = 0;
char** env = Platform::Environment(&count);
if (env == NULL) {
@@ -76,14 +75,11 @@
Platform::FreeEnvironment(env, count);
Dart_SetReturnValue(args, result);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Platform_GetVersion)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString()));
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/platform.h b/runtime/bin/platform.h
index 54412ba..dd195c3 100644
--- a/runtime/bin/platform.h
+++ b/runtime/bin/platform.h
@@ -34,7 +34,17 @@
static char** Environment(intptr_t* count);
static void FreeEnvironment(char** env, intptr_t count);
+ // Stores and gets the executable name.
+ static void SetExecutableName(const char* executable_name) {
+ executable_name_ = executable_name;
+ }
+ static const char* GetExecutableName() {
+ return executable_name_;
+ }
+
private:
+ static const char* executable_name_;
+
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(Platform);
};
diff --git a/runtime/bin/platform_patch.dart b/runtime/bin/platform_patch.dart
index 9d21d48..cfe7a80 100644
--- a/runtime/bin/platform_patch.dart
+++ b/runtime/bin/platform_patch.dart
@@ -9,6 +9,7 @@
/* patch */ static String _operatingSystem()
native "Platform_OperatingSystem";
/* patch */ static _localHostname() native "Platform_LocalHostname";
+ /* patch */ static _executable() native "Platform_ExecutableName";
/* patch */ static _environment() native "Platform_Environment";
/* patch */ static String _version() native "Platform_GetVersion";
}
diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc
index a6a5e2c..21750f1 100644
--- a/runtime/bin/process.cc
+++ b/runtime/bin/process.cc
@@ -59,7 +59,6 @@
}
void FUNCTION_NAME(Process_Start)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle process = Dart_GetNativeArgument(args, 0);
intptr_t process_stdin;
intptr_t process_stdout;
@@ -157,54 +156,44 @@
delete[] string_environment;
free(os_error_message);
Dart_SetReturnValue(args, Dart_NewBoolean(error_code == 0));
- Dart_ExitScope();
}
void FUNCTION_NAME(Process_Kill)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle process = Dart_GetNativeArgument(args, 1);
intptr_t pid = -1;
Process::GetProcessIdNativeField(process, &pid);
int signal = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
bool success = Process::Kill(pid, signal);
Dart_SetReturnValue(args, Dart_NewBoolean(success));
- Dart_ExitScope();
}
void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) {
- Dart_EnterScope();
int64_t status = 0;
// Ignore result if passing invalid argument and just exit 0.
DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
- Dart_ExitScope();
exit(static_cast<int>(status));
}
void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) {
- Dart_EnterScope();
int64_t status = 0;
// Ignore result if passing invalid argument and just set exit code to 0.
DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
Process::SetGlobalExitCode(status);
- Dart_ExitScope();
}
void FUNCTION_NAME(Process_Sleep)(Dart_NativeArguments args) {
- Dart_EnterScope();
int64_t milliseconds = 0;
// Ignore result if passing invalid argument and just set exit code to 0.
DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &milliseconds);
TimerUtils::Sleep(milliseconds);
- Dart_ExitScope();
}
void FUNCTION_NAME(Process_Pid)(Dart_NativeArguments args) {
- Dart_EnterScope();
// Ignore result if passing invalid argument and just set exit code to 0.
intptr_t pid = -1;
Dart_Handle process = Dart_GetNativeArgument(args, 0);
@@ -214,7 +203,6 @@
Process::GetProcessIdNativeField(process, &pid);
}
Dart_SetReturnValue(args, Dart_NewInteger(pid));
- Dart_ExitScope();
}
@@ -231,7 +219,6 @@
void FUNCTION_NAME(SystemEncodingToString)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle bytes = Dart_GetNativeArgument(args, 0);
intptr_t bytes_length = 0;
Dart_Handle result = Dart_ListLength(bytes, &bytes_length);
@@ -247,12 +234,10 @@
StringUtils::ConsoleStringToUtf8(reinterpret_cast<char*>(buffer));
Dart_SetReturnValue(args, DartUtils::NewString(str));
if (str != reinterpret_cast<char*>(buffer)) free(str);
- Dart_ExitScope();
}
void FUNCTION_NAME(StringToSystemEncoding)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle str = Dart_GetNativeArgument(args, 0);
const char* utf8 = DartUtils::GetStringValue(str);
const char* system_string = StringUtils::Utf8ToConsoleString(utf8);
@@ -262,7 +247,6 @@
memmove(buffer, system_string, external_length);
if (utf8 != system_string) free(const_cast<char*>(system_string));
Dart_SetReturnValue(args, external_array);
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc
index 49df0c5..30a488b 100644
--- a/runtime/bin/process_android.cc
+++ b/runtime/bin/process_android.cc
@@ -267,7 +267,10 @@
static void SetChildOsErrorMessage(char** os_error_message) {
- *os_error_message = strdup(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ *os_error_message = strdup(error_message);
}
@@ -290,7 +293,9 @@
// In the case of failure in the child process write the errno and
// the OS error message to the exec control pipe and exit.
int child_errno = errno;
- char* os_error_message = strerror(errno);
+ const int kBufferSize = 1024;
+ char os_error_message[kBufferSize];
+ strerror_r(errno, os_error_message, kBufferSize);
ASSERT(sizeof(child_errno) == sizeof(errno));
int bytes_written =
FDUtils::WriteToBlocking(
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index 7d97425..6102e70 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -269,7 +269,9 @@
static void SetChildOsErrorMessage(char** os_error_message) {
- *os_error_message = strdup(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ *os_error_message = strdup(strerror_r(errno, error_buf, kBufferSize));
}
@@ -292,7 +294,9 @@
// In the case of failure in the child process write the errno and
// the OS error message to the exec control pipe and exit.
int child_errno = errno;
- char* os_error_message = strerror(errno);
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ char* os_error_message = strerror_r(errno, error_buf, kBufferSize);
ASSERT(sizeof(child_errno) == sizeof(errno));
int bytes_written =
FDUtils::WriteToBlocking(
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index 3335181..c87523c 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -268,7 +268,10 @@
static void SetChildOsErrorMessage(char** os_error_message) {
- *os_error_message = strdup(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ *os_error_message = strdup(error_message);
}
@@ -291,7 +294,9 @@
// In the case of failure in the child process write the errno and
// the OS error message to the exec control pipe and exit.
int child_errno = errno;
- char* os_error_message = strerror(errno);
+ const int kBufferSize = 1024;
+ char os_error_message[kBufferSize];
+ strerror_r(errno, os_error_message, kBufferSize);
ASSERT(sizeof(child_errno) == sizeof(errno));
int bytes_written =
FDUtils::WriteToBlocking(
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index ad6ae82..8a45101 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -106,17 +106,14 @@
void FUNCTION_NAME(SecureSocket_Init)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle dart_this = ThrowIfError(Dart_GetNativeArgument(args, 0));
SSLFilter* filter = new SSLFilter;
SetFilter(args, filter);
filter->Init(dart_this);
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Connect)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle host_name_object = ThrowIfError(Dart_GetNativeArgument(args, 1));
Dart_Handle host_sockaddr_storage_object =
ThrowIfError(Dart_GetNativeArgument(args, 2));
@@ -168,29 +165,23 @@
request_client_certificate,
require_client_certificate,
send_client_certificate);
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Destroy)(Dart_NativeArguments args) {
- Dart_EnterScope();
SSLFilter* filter = GetFilter(args);
SetFilter(args, NULL);
filter->Destroy();
delete filter;
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Handshake)(Dart_NativeArguments args) {
- Dart_EnterScope();
GetFilter(args)->Handshake();
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Renegotiate)(Dart_NativeArguments args) {
- Dart_EnterScope();
bool use_session_cache =
DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1));
bool request_client_certificate =
@@ -200,13 +191,11 @@
GetFilter(args)->Renegotiate(use_session_cache,
request_client_certificate,
require_client_certificate);
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_RegisterHandshakeCompleteCallback)(
Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle handshake_complete =
ThrowIfError(Dart_GetNativeArgument(args, 1));
if (!Dart_IsClosure(handshake_complete)) {
@@ -214,13 +203,11 @@
"Illegal argument to RegisterHandshakeCompleteCallback"));
}
GetFilter(args)->RegisterHandshakeCompleteCallback(handshake_complete);
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_RegisterBadCertificateCallback)(
Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle callback =
ThrowIfError(Dart_GetNativeArgument(args, 1));
if (!Dart_IsClosure(callback) && !Dart_IsNull(callback)) {
@@ -228,13 +215,11 @@
"Illegal argument to RegisterBadCertificateCallback"));
}
GetFilter(args)->RegisterBadCertificateCallback(callback);
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_InitializeLibrary)
(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle certificate_database_object =
ThrowIfError(Dart_GetNativeArgument(args, 0));
// Check that the type is string, and get the UTF-8 C string value from it.
@@ -274,7 +259,6 @@
}
SSLFilter::InitializeLibrary(certificate_database, password, builtin_roots);
- Dart_ExitScope();
}
@@ -318,7 +302,6 @@
void FUNCTION_NAME(SecureSocket_AddCertificate)
(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle certificate_object =
ThrowIfError(Dart_GetNativeArgument(args, 0));
Dart_Handle trust_object = ThrowIfError(Dart_GetNativeArgument(args, 1));
@@ -358,7 +341,6 @@
}
Dart_SetReturnValue(args, X509FromCertificate(cert));
- Dart_ExitScope();
return;
}
@@ -366,17 +348,13 @@
void FUNCTION_NAME(SecureSocket_PeerCertificate)
(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, GetFilter(args)->PeerCertificate());
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_FilterPointer)(Dart_NativeArguments args) {
- Dart_EnterScope();
intptr_t filter_pointer = reinterpret_cast<intptr_t>(GetFilter(args));
Dart_SetReturnValue(args, Dart_NewInteger(filter_pointer));
- Dart_ExitScope();
}
@@ -1039,7 +1017,6 @@
void FUNCTION_NAME(SecureSocket_NewServicePort)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, Dart_Null());
Dart_Port service_port = SSLFilter::GetServicePort();
if (service_port != ILLEGAL_PORT) {
@@ -1047,7 +1024,6 @@
Dart_Handle send_port = Dart_NewSendPort(service_port);
Dart_SetReturnValue(args, send_port);
}
- Dart_ExitScope();
}
diff --git a/runtime/bin/secure_socket_unsupported.cc b/runtime/bin/secure_socket_unsupported.cc
index 6695fa9..f382425 100644
--- a/runtime/bin/secure_socket_unsupported.cc
+++ b/runtime/bin/secure_socket_unsupported.cc
@@ -12,110 +12,84 @@
namespace bin {
void FUNCTION_NAME(SecureSocket_Init)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Connect)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_AddCertificate)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Destroy)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Handshake)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_RegisterHandshakeCompleteCallback)(
Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_RegisterBadCertificateCallback)(
Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_ProcessBuffer)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_InitializeLibrary)
(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_PeerCertificate)
(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_FilterPointer)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_Renegotiate)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
void FUNCTION_NAME(SecureSocket_NewServicePort)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_ThrowException(DartUtils::NewDartArgumentError(
"Secure Sockets unsupported on this platform"));
- Dart_ExitScope();
}
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 68d40d8..13467af 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -39,7 +39,6 @@
void FUNCTION_NAME(InternetAddress_Fixed)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle id_obj = Dart_GetNativeArgument(args, 0);
ASSERT(!Dart_IsError(id_obj));
int64_t id = 0;
@@ -79,12 +78,10 @@
if (Dart_IsError(result)) Dart_PropagateError(result);
Dart_ListSetAsBytes(result, 0, reinterpret_cast<uint8_t *>(&raw), len);
Dart_SetReturnValue(args, result);
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
Dart_Handle host_obj = Dart_GetNativeArgument(args, 1);
RawAddr addr;
@@ -108,12 +105,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_Available)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -124,12 +119,10 @@
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_Read)(Dart_NativeArguments args) {
- Dart_EnterScope();
static bool short_socket_reads = Dart_IsVMFlagSet("short_socket_read");
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
@@ -181,13 +174,10 @@
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
-
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_WriteList)(Dart_NativeArguments args) {
- Dart_EnterScope();
static bool short_socket_writes = Dart_IsVMFlagSet("short_socket_write");
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
@@ -220,12 +210,10 @@
Dart_TypedDataReleaseData(buffer_obj);
Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error));
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_GetPort)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -237,12 +225,10 @@
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -259,12 +245,10 @@
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -272,12 +256,10 @@
OSError os_error;
Socket::GetError(socket, &os_error);
Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error));
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_GetType)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -288,12 +270,10 @@
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t num =
DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
@@ -302,12 +282,10 @@
Dart_Handle err = Socket::SetSocketIdNativeField(socket_obj, socket);
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0));
- Dart_ExitScope();
}
void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
Dart_Handle host_obj = Dart_GetNativeArgument(args, 1);
RawAddr addr;
@@ -343,12 +321,10 @@
if (Dart_IsError(err)) Dart_PropagateError(err);
Dart_SetReturnValue(args, err);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(ServerSocket_Accept)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
Dart_Handle err = Socket::GetSocketIdNativeField(socket_obj, &socket);
@@ -365,7 +341,6 @@
} else {
Dart_SetReturnValue(args, DartUtils::NewDartOSError());
}
- Dart_ExitScope();
}
@@ -546,7 +521,6 @@
void FUNCTION_NAME(Socket_NewServicePort)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, Dart_Null());
Dart_Port service_port = Socket::GetServicePort();
if (service_port != ILLEGAL_PORT) {
@@ -554,12 +528,10 @@
Dart_Handle send_port = Dart_NewSendPort(service_port);
Dart_SetReturnValue(args, send_port);
}
- Dart_ExitScope();
}
void FUNCTION_NAME(Socket_SetOption)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
intptr_t socket = 0;
bool result = false;
@@ -581,7 +553,6 @@
break;
}
Dart_SetReturnValue(args, Dart_NewBoolean(result));
- Dart_ExitScope();
}
diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc
index 976efcf..8ef4234 100644
--- a/runtime/bin/socket_android.cc
+++ b/runtime/bin/socket_android.cc
@@ -47,7 +47,10 @@
fd = TEMP_FAILURE_RETRY(socket(addr.ss.ss_family, SOCK_STREAM, 0));
if (fd < 0) {
- Log::PrintErr("Error Create: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error Create: %s\n", error_message);
return -1;
}
@@ -121,7 +124,10 @@
getsockname(fd,
&raw.addr,
&size))) {
- Log::PrintErr("Error getsockname: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error getsockname: %s\n", error_message);
return 0;
}
return SocketAddress::GetAddrPort(&raw);
@@ -136,7 +142,10 @@
getpeername(fd,
&raw.addr,
&size))) {
- Log::PrintErr("Error getpeername: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error getpeername: %s\n", error_message);
return false;
}
const void* src;
@@ -149,7 +158,10 @@
src,
host,
INET_ADDRSTRLEN) == NULL) {
- Log::PrintErr("Error inet_ntop: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error inet_ntop: %s\n", error_message);
return false;
}
*port = SocketAddress::GetAddrPort(&raw);
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc
index 571a876..f247f5d 100644
--- a/runtime/bin/socket_linux.cc
+++ b/runtime/bin/socket_linux.cc
@@ -48,7 +48,10 @@
fd = TEMP_FAILURE_RETRY(socket(addr.ss.ss_family, SOCK_STREAM, 0));
if (fd < 0) {
- Log::PrintErr("Error Create: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ Log::PrintErr("Error Create: %s\n",
+ strerror_r(errno, error_buf, kBufferSize));
return -1;
}
@@ -122,7 +125,10 @@
getsockname(fd,
&raw.addr,
&size))) {
- Log::PrintErr("Error getsockname: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ Log::PrintErr("Error getsockname: %s\n",
+ strerror_r(errno, error_buf, kBufferSize));
return 0;
}
return SocketAddress::GetAddrPort(&raw);
@@ -137,7 +143,10 @@
getpeername(fd,
&raw.addr,
&size))) {
- Log::PrintErr("Error getpeername: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ Log::PrintErr("Error getpeername: %s\n",
+ strerror_r(errno, error_buf, kBufferSize));
return false;
}
const void* src;
@@ -150,7 +159,10 @@
src,
host,
INET_ADDRSTRLEN) == NULL) {
- Log::PrintErr("Error inet_ntop: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ Log::PrintErr("Error inet_ntop: %s\n",
+ strerror_r(errno, error_buf, kBufferSize));
return false;
}
*port = SocketAddress::GetAddrPort(&raw);
@@ -382,9 +394,8 @@
int err = TEMP_FAILURE_RETRY(close(fd));
if (err != 0) {
const int kBufferSize = 1024;
- char error_message[kBufferSize];
- strerror_r(errno, error_message, kBufferSize);
- Log::PrintErr("%s\n", error_message);
+ char error_buf[kBufferSize];
+ Log::PrintErr("%s\n", strerror_r(errno, error_buf, kBufferSize));
}
}
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc
index 81b2d02..2e2dbb6 100644
--- a/runtime/bin/socket_macos.cc
+++ b/runtime/bin/socket_macos.cc
@@ -48,7 +48,10 @@
fd = TEMP_FAILURE_RETRY(socket(addr.ss.ss_family, SOCK_STREAM, 0));
if (fd < 0) {
- Log::PrintErr("Error Create: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error Create: %s\n", error_message);
return -1;
}
@@ -122,7 +125,10 @@
getsockname(fd,
&raw.addr,
&size))) {
- Log::PrintErr("Error getsockname: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error getsockname: %s\n", error_message);
return 0;
}
return SocketAddress::GetAddrPort(&raw);
@@ -137,7 +143,10 @@
getpeername(fd,
&raw.addr,
&size))) {
- Log::PrintErr("Error getpeername: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error getpeername: %s\n", error_message);
return false;
}
const void* src;
@@ -150,7 +159,10 @@
src,
host,
INET_ADDRSTRLEN) == NULL) {
- Log::PrintErr("Error inet_ntop: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ Log::PrintErr("Error inet_ntop: %s\n", error_message);
return false;
}
*port = SocketAddress::GetAddrPort(&raw);
diff --git a/runtime/bin/stdin.cc b/runtime/bin/stdin.cc
index 808bf8a..5b21b5b 100644
--- a/runtime/bin/stdin.cc
+++ b/runtime/bin/stdin.cc
@@ -18,27 +18,21 @@
namespace bin {
void FUNCTION_NAME(Stdin_ReadByte)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_SetReturnValue(args, Dart_NewInteger(Stdin::ReadByte()));
- Dart_ExitScope();
}
void FUNCTION_NAME(Stdin_SetEchoMode)(Dart_NativeArguments args) {
- Dart_EnterScope();
bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1));
Stdin::SetEchoMode(enabled);
Dart_SetReturnValue(args, Dart_Null());
- Dart_ExitScope();
}
void FUNCTION_NAME(Stdin_SetLineMode)(Dart_NativeArguments args) {
- Dart_EnterScope();
bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 1));
Stdin::SetLineMode(enabled);
Dart_SetReturnValue(args, Dart_Null());
- Dart_ExitScope();
}
} // namespace bin
diff --git a/runtime/bin/utils_android.cc b/runtime/bin/utils_android.cc
index 25022b5..e88d248 100644
--- a/runtime/bin/utils_android.cc
+++ b/runtime/bin/utils_android.cc
@@ -19,7 +19,10 @@
OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) {
set_sub_system(kSystem);
set_code(errno);
- SetMessage(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ SetMessage(error_message);
}
@@ -27,7 +30,10 @@
set_sub_system(sub_system);
set_code(code);
if (sub_system == kSystem) {
- SetMessage(strerror(code));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(code, error_message, kBufferSize);
+ SetMessage(error_message);
} else if (sub_system == kGetAddressInfo) {
SetMessage(gai_strerror(code));
} else {
diff --git a/runtime/bin/utils_linux.cc b/runtime/bin/utils_linux.cc
index e8230c8..66e6929 100644
--- a/runtime/bin/utils_linux.cc
+++ b/runtime/bin/utils_linux.cc
@@ -19,7 +19,9 @@
OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) {
set_sub_system(kSystem);
set_code(errno);
- SetMessage(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ SetMessage(strerror_r(errno, error_buf, kBufferSize));
}
@@ -27,7 +29,9 @@
set_sub_system(sub_system);
set_code(code);
if (sub_system == kSystem) {
- SetMessage(strerror(code));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ SetMessage(strerror_r(code, error_buf, kBufferSize));
} else if (sub_system == kGetAddressInfo) {
SetMessage(gai_strerror(code));
} else {
diff --git a/runtime/bin/utils_macos.cc b/runtime/bin/utils_macos.cc
index 69c738e..c47fedd 100644
--- a/runtime/bin/utils_macos.cc
+++ b/runtime/bin/utils_macos.cc
@@ -19,7 +19,10 @@
OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) {
set_sub_system(kSystem);
set_code(errno);
- SetMessage(strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ SetMessage(error_message);
}
@@ -27,7 +30,10 @@
set_sub_system(sub_system);
set_code(code);
if (sub_system == kSystem) {
- SetMessage(strerror(code));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(code, error_message, kBufferSize);
+ SetMessage(error_message);
} else if (sub_system == kGetAddressInfo) {
SetMessage(gai_strerror(code));
} else {
diff --git a/runtime/bin/vmservice/running_isolate.dart b/runtime/bin/vmservice/running_isolate.dart
index 6c7749a..2d4af13 100644
--- a/runtime/bin/vmservice/running_isolate.dart
+++ b/runtime/bin/vmservice/running_isolate.dart
@@ -6,9 +6,9 @@
class RunningIsolate implements ServiceRequestRouter {
final SendPort sendPort;
- String name = 'Unknown';
+ final String name;
- RunningIsolate(this.sendPort);
+ RunningIsolate(this.sendPort, this.name);
Future sendMessage(List request) {
final completer = new Completer.sync();
@@ -33,23 +33,4 @@
return new Future.value(request);
});
}
-
- void _sendNameRequest() {
- var request = new ServiceRequest();
- request.parse(Uri.parse('/name'));
- sendMessage(request.toServiceCallMessage()).then(_handleNameResponse);
- }
-
- void _handleNameResponse(String responseString) {
- try {
- var response = JSON.parse(responseString);
- name = response['name'];
- } catch (e) {
- name = 'Error retrieving isolate name.';
- return;
- }
- if (name == null) {
- name = 'Error retrieving isolate name.';
- }
- }
}
diff --git a/runtime/bin/vmservice/running_isolates.dart b/runtime/bin/vmservice/running_isolates.dart
index 57e56fb..945e4f2 100644
--- a/runtime/bin/vmservice/running_isolates.dart
+++ b/runtime/bin/vmservice/running_isolates.dart
@@ -9,13 +9,12 @@
RunningIsolates();
- void isolateStartup(SendPort sp) {
+ void isolateStartup(SendPort sp, String name) {
if (isolates[sp.hashCode] != null) {
throw new StateError('Duplicate isolate startup.');
}
- var ri = new RunningIsolate(sp);
+ var ri = new RunningIsolate(sp, name);
isolates[sp.hashCode] = ri;
- ri._sendNameRequest();
}
void isolateShutdown(SendPort sp) {
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index 9eed701..08e8d9b 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-part of vmservice;
+part of vmservice_io;
class Server {
int port;
diff --git a/runtime/bin/vmservice/vmservice.dart b/runtime/bin/vmservice/vmservice.dart
index f1f8995..a9790f1 100644
--- a/runtime/bin/vmservice/vmservice.dart
+++ b/runtime/bin/vmservice/vmservice.dart
@@ -6,21 +6,25 @@
import 'dart:async';
import 'dart:json' as JSON;
-// TODO(11927): Factor 'dart:io' dependency into separate library.
-import 'dart:io';
import 'dart:isolate';
import 'dart:typed_data';
import 'dart:utf' as UTF;
+part 'constants.dart';
+part 'resources.dart';
+part 'running_isolate.dart';
+part 'running_isolates.dart';
+part 'service_request.dart';
+part 'service_request_router.dart';
-class VmService {
- static VmService _instance;
+class VMService {
+ static VMService _instance;
RunningIsolates runningIsolates = new RunningIsolates();
- void controlMessageHandler(int code, SendPort sp) {
+ void controlMessageHandler(int code, SendPort sp, String name) {
switch (code) {
case Constants.ISOLATE_STARTUP_MESSAGE_ID:
- runningIsolates.isolateStartup(sp);
+ runningIsolates.isolateStartup(sp, name);
break;
case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID:
runningIsolates.isolateShutdown(sp);
@@ -29,18 +33,18 @@
}
void messageHandler(message, SendPort replyTo) {
- if (message is List && message.length == 2) {
- controlMessageHandler(message[0], message[1]);
+ if (message is List && message.length == 3) {
+ controlMessageHandler(message[0], message[1], message[2]);
}
}
- VmService._internal() {
+ VMService._internal() {
port.receive(messageHandler);
}
- factory VmService() {
- if (VmService._instance == null) {
- VmService._instance = new VmService._internal();
+ factory VMService() {
+ if (VMService._instance == null) {
+ VMService._instance = new VMService._internal();
}
return _instance;
}
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart
index 0ae0b6c..ee4ffb2 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -2,15 +2,19 @@
// 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(johnmccutchan): Convert this into separate library which imports
-// the vmservice library.
+library vmservice_io;
-part of vmservice;
+import 'dart:io';
+import 'vmservice.dart';
+
+part 'server.dart';
var _port;
main() {
- var service = new VmService();
+ // Create VmService.
+ var service = new VMService();
+ // Start HTTP server.
var server = new Server(service, _port);
server.startServer();
}
diff --git a/runtime/bin/vmservice_impl.cc b/runtime/bin/vmservice_impl.cc
index 69c2d48..a1a8e2c 100644
--- a/runtime/bin/vmservice_impl.cc
+++ b/runtime/bin/vmservice_impl.cc
@@ -42,19 +42,10 @@
}
#define kLibraryResourceNamePrefix "/vmservice"
-static const char* kLibraryScriptResourceName =
+static const char* kVMServiceIOLibraryScriptResourceName =
+ kLibraryResourceNamePrefix "/vmservice_io.dart";
+static const char* kVMServiceLibraryName =
kLibraryResourceNamePrefix "/vmservice.dart";
-static const char* kLibrarySourceResourceNames[] = {
- kLibraryResourceNamePrefix "/constants.dart",
- kLibraryResourceNamePrefix "/resources.dart",
- kLibraryResourceNamePrefix "/running_isolate.dart",
- kLibraryResourceNamePrefix "/running_isolates.dart",
- kLibraryResourceNamePrefix "/server.dart",
- kLibraryResourceNamePrefix "/service_request.dart",
- kLibraryResourceNamePrefix "/service_request_router.dart",
- kLibraryResourceNamePrefix "/vmservice_io.dart",
- NULL
-};
#define kClientResourceNamePrefix "/client/web/out"
@@ -110,7 +101,7 @@
}
// Set up the library tag handler for this isolate.
- Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler);
+ Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler);
SHUTDOWN_ON_ERROR(result);
// Load the specified application script into the newly created isolate.
@@ -129,10 +120,8 @@
{
// Load source into service isolate.
- Dart_Handle library = LoadScript(kLibraryScriptResourceName);
+ Dart_Handle library = LoadScript(kVMServiceIOLibraryScriptResourceName);
SHUTDOWN_ON_ERROR(library);
- result = LoadSources(library, kLibrarySourceResourceNames);
- SHUTDOWN_ON_ERROR(result);
}
// Make the isolate runnable so that it is ready to handle messages.
@@ -154,9 +143,6 @@
Dart_Handle library = Dart_RootLibrary();
// Set requested port.
DartUtils::SetIntegerField(library, "_port", server_port);
- // Install native resolver.
- result = Dart_SetNativeResolver(library, VmServiceNativeResolver);
- SHUTDOWN_ON_ERROR(result);
result = Dart_Invoke(library, DartUtils::NewString("main"), 0, NULL);
SHUTDOWN_ON_ERROR(result);
@@ -194,25 +180,24 @@
}
-Dart_Handle VmService::LoadScript(const char* name) {
- Dart_Handle url = Dart_NewStringFromCString(name);
+Dart_Handle VmService::GetSource(const char* name) {
const char* vmservice_source = NULL;
int r = Resources::ResourceLookup(name, &vmservice_source);
ASSERT(r != Resources::kNoSuchInstance);
- Dart_Handle source = Dart_NewStringFromCString(vmservice_source);
+ return Dart_NewStringFromCString(vmservice_source);
+}
+
+
+Dart_Handle VmService::LoadScript(const char* name) {
+ Dart_Handle url = Dart_NewStringFromCString(name);
+ Dart_Handle source = GetSource(name);
return Dart_LoadScript(url, source, 0, 0);
}
Dart_Handle VmService::LoadSource(Dart_Handle library, const char* name) {
Dart_Handle url = Dart_NewStringFromCString(name);
- const char* vmservice_source = NULL;
- int r = Resources::ResourceLookup(name, &vmservice_source);
- if (r == Resources::kNoSuchInstance) {
- printf("Can't find %s\n", name);
- }
- ASSERT(r != Resources::kNoSuchInstance);
- Dart_Handle source = Dart_NewStringFromCString(vmservice_source);
+ Dart_Handle source = GetSource(name);
return Dart_LoadSource(library, url, source);
}
@@ -285,6 +270,85 @@
}
+static bool IsVMServiceURL(const char* url) {
+ static const intptr_t kLibraryResourceNamePrefixLen =
+ strlen(kLibraryResourceNamePrefix);
+ return 0 == strncmp(kLibraryResourceNamePrefix, url,
+ kLibraryResourceNamePrefixLen);
+}
+
+
+static bool IsVMServiceLibrary(const char* url) {
+ return 0 == strcmp(kVMServiceLibraryName, url);
+}
+
+
+Dart_Handle VmService::LibraryTagHandler(Dart_LibraryTag tag,
+ Dart_Handle library,
+ Dart_Handle url) {
+ if (!Dart_IsLibrary(library)) {
+ return Dart_Error("not a library");
+ }
+ if (!Dart_IsString(url)) {
+ return Dart_Error("url is not a string");
+ }
+ const char* url_string = NULL;
+ Dart_Handle result = Dart_StringToCString(url, &url_string);
+ if (Dart_IsError(result)) {
+ return result;
+ }
+ Dart_Handle library_url = Dart_LibraryUrl(library);
+ const char* library_url_string = NULL;
+ result = Dart_StringToCString(library_url, &library_url_string);
+ if (Dart_IsError(result)) {
+ return result;
+ }
+ bool is_vm_service_url = IsVMServiceURL(url_string);
+ if (!is_vm_service_url) {
+ // Pass to DartUtils.
+ return DartUtils::LibraryTagHandler(tag, library, url);
+ }
+ switch (tag) {
+ case Dart_kCanonicalizeUrl:
+ // The URL is already canonicalized.
+ return url;
+ break;
+ case Dart_kImportTag: {
+ Dart_Handle source = GetSource(url_string);
+ if (Dart_IsError(source)) {
+ return source;
+ }
+ Dart_Handle lib = Dart_LoadLibrary(url, source);
+ if (Dart_IsError(lib)) {
+ return lib;
+ }
+ if (IsVMServiceLibrary(url_string)) {
+ // Install native resolver for this library.
+ result = Dart_SetNativeResolver(lib, VmServiceNativeResolver);
+ if (Dart_IsError(result)) {
+ return result;
+ }
+ }
+ return lib;
+ }
+ break;
+ case Dart_kSourceTag: {
+ Dart_Handle source = GetSource(url_string);
+ if (Dart_IsError(source)) {
+ return source;
+ }
+ return Dart_LoadSource(library, url, source);
+ }
+ break;
+ default:
+ UNIMPLEMENTED();
+ break;
+ }
+ UNREACHABLE();
+ return result;
+}
+
+
void VmService::ThreadMain(uword parameters) {
ASSERT(Dart_CurrentIsolate() == NULL);
ASSERT(isolate_ == NULL);
@@ -323,26 +387,34 @@
}
-static Dart_Handle MakeServiceControlMessage(Dart_Port port) {
- Dart_Handle list = Dart_NewList(2);
+static Dart_Handle MakeServiceControlMessage(Dart_Port port, intptr_t code) {
+ Dart_Handle result;
+ Dart_Handle list = Dart_NewList(3);
ASSERT(!Dart_IsError(list));
+ Dart_Handle codeHandle = Dart_NewInteger(code);
+ ASSERT(!Dart_IsError(codeHandle));
+ result = Dart_ListSetAt(list, 0, codeHandle);
+ ASSERT(!Dart_IsError(result));
Dart_Handle sendPort = Dart_NewSendPort(port);
ASSERT(!Dart_IsError(sendPort));
- Dart_ListSetAt(list, 1, sendPort);
+ result = Dart_ListSetAt(list, 1, sendPort);
+ ASSERT(!Dart_IsError(result));
return list;
}
-bool VmService::SendIsolateStartupMessage(Dart_Port port) {
+bool VmService::SendIsolateStartupMessage(Dart_Port port, Dart_Handle name) {
if (!IsRunning()) {
return false;
}
Dart_Isolate isolate = Dart_CurrentIsolate();
ASSERT(isolate != NULL);
ASSERT(Dart_GetMainPortId() == port);
- Dart_Handle list = MakeServiceControlMessage(port);
- Dart_ListSetAt(list, 0,
- Dart_NewInteger(VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID));
+ Dart_Handle list =
+ MakeServiceControlMessage(port, VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID);
+ ASSERT(!Dart_IsError(list));
+ Dart_Handle result = Dart_ListSetAt(list, 2, name);
+ ASSERT(!Dart_IsError(result));
return Dart_Post(port_, list);
}
@@ -354,9 +426,9 @@
Dart_Isolate isolate = Dart_CurrentIsolate();
ASSERT(isolate != NULL);
ASSERT(Dart_GetMainPortId() == port);
- Dart_Handle list = MakeServiceControlMessage(port);
- Dart_ListSetAt(list, 0,
- Dart_NewInteger(VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID));
+ Dart_Handle list =
+ MakeServiceControlMessage(port, VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID);
+ ASSERT(!Dart_IsError(list));
return Dart_Post(port_, list);
}
diff --git a/runtime/bin/vmservice_impl.h b/runtime/bin/vmservice_impl.h
index 7d6b08d..6a64560 100644
--- a/runtime/bin/vmservice_impl.h
+++ b/runtime/bin/vmservice_impl.h
@@ -23,7 +23,7 @@
static bool IsRunning();
- static bool SendIsolateStartupMessage(Dart_Port port);
+ static bool SendIsolateStartupMessage(Dart_Port port, Dart_Handle name);
static bool SendIsolateShutdownMessage(Dart_Port port);
static void VmServiceShutdownCallback(void* callback_data);
@@ -31,6 +31,7 @@
private:
static bool _Start(intptr_t server_port);
static void _Stop();
+ static Dart_Handle GetSource(const char* name);
static Dart_Handle LoadScript(const char* name);
static Dart_Handle LoadSources(Dart_Handle library, const char** names);
static Dart_Handle LoadSource(Dart_Handle library, const char* name);
@@ -38,6 +39,9 @@
static Dart_Handle LoadResource(Dart_Handle library, const char* name,
const char* prefix);
+ static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, Dart_Handle library,
+ Dart_Handle url);
+
static void ThreadMain(uword parameters);
static Dart_Isolate isolate_;
diff --git a/runtime/dart-runtime.gyp b/runtime/dart-runtime.gyp
index 17f9bb3..7c4f4c4 100644
--- a/runtime/dart-runtime.gyp
+++ b/runtime/dart-runtime.gyp
@@ -79,8 +79,7 @@
'inputs': [
'../tools/make_version.py',
'../tools/utils.py',
- '../tools/version.dart',
- '../tools/release/version.dart',
+ '../tools/print_version.py',
'../tools/VERSION',
'<(version_in_cc_file)',
# Depend on libdart_dependency_helper to track the libraries it
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index b47b40c..255c704 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -1976,6 +1976,12 @@
intptr_t* value);
/**
+ * Gets the native field of the receiver.
+ */
+DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args,
+ intptr_t* value);
+
+/**
* Sets the return value for a native function.
*/
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args,
diff --git a/runtime/include/dart_mirrors_api.h b/runtime/include/dart_mirrors_api.h
index 60e499a..7805449 100644
--- a/runtime/include/dart_mirrors_api.h
+++ b/runtime/include/dart_mirrors_api.h
@@ -9,11 +9,6 @@
#include "include/dart_api.h"
-/*
- * =================================
- * Classes and Interfaces Reflection
- * =================================
- */
/**
* Returns the class name for the provided class or interface.
@@ -21,71 +16,6 @@
DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle clazz);
/**
- * Returns the library for the provided class or interface.
- */
-DART_EXPORT Dart_Handle Dart_ClassGetLibrary(Dart_Handle clazz);
-
-/**
- * Returns the number of interfaces directly implemented by some class
- * or interface.
- *
- * TODO(turnidge): Finish documentation.
- */
-DART_EXPORT Dart_Handle Dart_ClassGetInterfaceCount(Dart_Handle clazz,
- intptr_t* count);
-
-/**
- * Returns the interface at some index in the list of interfaces some
- * class or inteface.
- *
- * TODO(turnidge): Finish documentation.
- */
-DART_EXPORT Dart_Handle Dart_ClassGetInterfaceAt(Dart_Handle clazz,
- intptr_t index);
-
-/**
- * Is this class defined by a typedef?
- *
- * Typedef definitions from the main program are represented as a
- * special kind of class handle. See Dart_ClassGetTypedefReferent.
- *
- * TODO(turnidge): Finish documentation.
- */
-DART_EXPORT bool Dart_ClassIsTypedef(Dart_Handle clazz);
-
-/**
- * Returns a handle to the type to which a typedef refers.
- *
- * It is an error to call this function on a handle for which
- * Dart_ClassIsTypedef is not true.
- *
- * TODO(turnidge): Finish documentation.
- */
-DART_EXPORT Dart_Handle Dart_ClassGetTypedefReferent(Dart_Handle clazz);
-
-/**
- * Does this class represent the type of a function?
- */
-DART_EXPORT bool Dart_ClassIsFunctionType(Dart_Handle clazz);
-
-/**
- * Returns a function handle representing the signature associated
- * with a function type.
- *
- * The return value is a function handle (See Dart_IsFunction, etc.).
- *
- * TODO(turnidge): Finish documentation.
- */
-DART_EXPORT Dart_Handle Dart_ClassGetFunctionTypeSignature(Dart_Handle clazz);
-
-
-/*
- * =================================
- * Function and Variables Reflection
- * =================================
- */
-
-/**
* Returns a list of the names of all functions or methods declared in
* a library or class.
*
@@ -133,17 +63,6 @@
DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function);
/**
- * Determines whether a function handle refers to an abstract method.
- *
- * \param function A handle to a function or method declaration.
- * \param is_static Returns whether the handle refers to an abstract method.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionIsAbstract(Dart_Handle function,
- bool* is_abstract);
-
-/**
* Determines whether a function handle referes to a static function
* of method.
*
@@ -193,157 +112,6 @@
bool* is_setter);
/**
- * Returns the return type of a function.
- *
- * \return A valid handle to a type or an error handle if the argument
- * is not valid.
- */
-DART_EXPORT Dart_Handle Dart_FunctionReturnType(Dart_Handle function);
-
-/**
- * Determines the number of required and optional parameters.
- *
- * \param function A handle to a function or method declaration.
- * \param fixed_param_count Returns the number of required parameters.
- * \param opt_param_count Returns the number of optional parameters.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_FunctionParameterCounts(
- Dart_Handle function,
- int64_t* fixed_param_count,
- int64_t* opt_param_count);
-
-/**
- * Returns a handle to the type of a function parameter.
- *
- * \return A valid handle to a type or an error handle if the argument
- * is not valid.
- */
-DART_EXPORT Dart_Handle Dart_FunctionParameterType(Dart_Handle function,
- int parameter_index);
-
-/**
- * Returns a list of the names of all variables declared in a library
- * or class.
- *
- * \param target A library or class.
- *
- * \return If no error occurs, a list of strings is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_GetVariableNames(Dart_Handle target);
-
-/**
- * Looks up a variable declaration by name from a library or class.
- *
- * \param target The library or class containing the variable.
- * \param variable_name The name of the variable.
- *
- * \return If an error is encountered, returns an error handle.
- * Otherwise returns a variable handle if the variable is found or
- * Dart_Null() if the variable is not found.
- */
-DART_EXPORT Dart_Handle Dart_LookupVariable(Dart_Handle target,
- Dart_Handle variable_name);
-
-/**
- * Returns the name for the provided variable.
- */
-DART_EXPORT Dart_Handle Dart_VariableName(Dart_Handle variable);
-
-/**
- * Determines whether a variable is declared static.
- *
- * For the purposes of the embedding API, a top-level variable is
- * implicitly declared static.
- *
- * \param variable A handle to a variable declaration.
- * \param is_static Returns whether the variable is declared static.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_VariableIsStatic(Dart_Handle variable,
- bool* is_static);
-
-/**
- * Determines whether a variable is declared final.
- *
- * \param variable A handle to a variable declaration.
- * \param is_final Returns whether the variable is declared final.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_VariableIsFinal(Dart_Handle variable,
- bool* is_final);
-
-/**
- * Returns the type of a variable.
- *
- * \return A valid handle to a type of or an error handle if the
- * argument is not valid.
- */
-DART_EXPORT Dart_Handle Dart_VariableType(Dart_Handle function);
-
-/**
- * Returns a list of the names of all type variables declared in a class.
- *
- * The type variables list preserves the original declaration order.
- *
- * \param clazz A class.
- *
- * \return If no error occurs, a list of strings is returned.
- * Otherwise an error handle is returned.
- */
-DART_EXPORT Dart_Handle Dart_GetTypeVariableNames(Dart_Handle clazz);
-
-/**
- * Looks up a type variable declaration by name from a class.
- *
- * \param clazz The class containing the type variable.
- * \param variable_name The name of the type variable.
- *
- * \return If an error is encountered, returns an error handle.
- * Otherwise returns a type variable handle if the type variable is
- * found or Dart_Null() if the type variable is not found.
- */
-DART_EXPORT Dart_Handle Dart_LookupTypeVariable(Dart_Handle clazz,
- Dart_Handle type_variable_name);
-
-/**
- * Returns the name for the provided type variable.
- */
-DART_EXPORT Dart_Handle Dart_TypeVariableName(Dart_Handle type_variable);
-
-/**
- * Returns the owner of a function.
- *
- * The owner of a type variable is its defining class.
- *
- * \return A valid handle to the owner of the type variable, or an error
- * handle if the argument is not a valid handle to a type variable.
- */
-DART_EXPORT Dart_Handle Dart_TypeVariableOwner(Dart_Handle type_variable);
-
-/**
- * Returns the upper bound of a type variable.
- *
- * The upper bound of a type variable is ...
- *
- * \return A valid handle to a type, or an error handle if the
- * argument is not a valid handle.
- */
-DART_EXPORT Dart_Handle Dart_TypeVariableUpperBound(Dart_Handle type_variable);
-/* TODO(turnidge): Finish documentation. */
-
-
-/*
- * ====================
- * Libraries Reflection
- * ====================
- */
-
-/**
* Returns the name of a library as declared in the #library directive.
*/
DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library);
@@ -357,13 +125,6 @@
*/
DART_EXPORT Dart_Handle Dart_LibraryGetClassNames(Dart_Handle library);
-
-/*
- * ===================
- * Closures Reflection
- * ===================
- */
-
/**
* Retrieves the function of a closure.
*
@@ -372,22 +133,5 @@
*/
DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure);
-/*
- * ===================
- * Metadata Reflection
- * ===================
- */
-
-/**
- * Get metadata associated with an object.
- *
- * \param obj Object for which the metadata is retrieved.
- *
- * \return If no error occurs, returns an array of metadata values.
- * Returns an empty array if there is no metadata for the object.
- * Returns an error if the evaluation of the metadata expressions fails.
- *
- */
-DART_EXPORT Dart_Handle Dart_GetMetadata(Dart_Handle obj);
#endif /* INCLUDE_DART_MIRRORS_API_H_ */ /* NOLINT */
diff --git a/runtime/lib/collection_patch.dart b/runtime/lib/collection_patch.dart
index 415982c..66efd3a 100644
--- a/runtime/lib/collection_patch.dart
+++ b/runtime/lib/collection_patch.dart
@@ -94,7 +94,7 @@
for (int offset = 0; offset < table.length; offset += entrySize) {
Object entry = table[offset];
if (!_hashTable._isFree(entry)) {
- K key = entry;
+ K key = identical(entry, _NULL) ? null : entry;
V value = _hashTable._value(offset);
action(key, value);
_hashTable._checkModification(modificationCount);
diff --git a/runtime/lib/corelib_sources.gypi b/runtime/lib/corelib_sources.gypi
index d3efd48..ec3c6c1 100644
--- a/runtime/lib/corelib_sources.gypi
+++ b/runtime/lib/corelib_sources.gypi
@@ -17,10 +17,8 @@
'double.cc',
'double.dart',
'double_patch.dart',
- 'error.cc',
- 'error.dart',
+ 'errors.cc',
'errors_patch.dart',
- 'error.h',
'expando_patch.dart',
'function.cc',
'function_patch.dart',
@@ -51,6 +49,8 @@
'string_patch.dart',
'string_buffer_patch.dart',
'type_patch.dart',
+ 'uri.cc',
+ 'uri_patch.dart',
'weak_property.dart',
'weak_property.cc',
],
diff --git a/runtime/lib/error.dart b/runtime/lib/error.dart
deleted file mode 100644
index dc50c4c..0000000
--- a/runtime/lib/error.dart
+++ /dev/null
@@ -1,119 +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.
-// Errors are created and thrown by DartVM only.
-// Changes here should also be reflected in corelib/error.dart as well
-
-class _AssertionErrorImplementation extends AssertionError {
- _AssertionErrorImplementation(
- this.failedAssertion, this.url, this.line, this.column);
-
- static _throwNew(int assertionStart, int assertionEnd)
- native "AssertionError_throwNew";
-
- String toString() {
- return "'$url': Failed assertion: line $line pos $column: "
- "'$failedAssertion' is not true.";
- }
- final String failedAssertion;
- final String url;
- final int line;
- final int column;
-}
-
-class _TypeErrorImplementation
- extends _AssertionErrorImplementation
- implements TypeError {
-
- _TypeErrorImplementation(
- String failedAssertion, String url, int line, int column,
- this.srcType, this.dstType, this.dstName, this._malformedError)
- : super(failedAssertion, url, line, column);
-
- static _throwNew(int location,
- Object src_value,
- String dst_type_name,
- String dst_name,
- String malformed_error)
- native "TypeError_throwNew";
-
- String toString() {
- String str = (_malformedError != null) ? _malformedError : "";
- if ((dstName != null) && (dstName.length > 0)) {
- str = "${str}type '$srcType' is not a subtype of "
- "type '$dstType' of '$dstName'.";
- } else {
- str = "${str}malformed type used.";
- }
- return str;
- }
-
- final String srcType;
- final String dstType;
- final String dstName;
- final String _malformedError;
-}
-
-class _CastErrorImplementation
- extends _TypeErrorImplementation
- implements CastError {
-
- _CastErrorImplementation(
- String failedAssertion, String url, int line, int column,
- String srcType, String dstType, String dstName, String malformedError)
- : super(failedAssertion, url, line, column,
- srcType, dstType, dstName, malformedError);
-
- // A CastError is allocated by TypeError._throwNew() when dst_name equals
- // Exceptions::kCastErrorDstName.
- String toString() {
- String str = (_malformedError != null) ? _malformedError : "";
- if ((dstName != null) && (dstName.length > 0)) {
- str = "${str}type '$srcType' is not a subtype of "
- "type '$dstType' in type cast.";
- } else {
- str = "${str}malformed type used in type cast.";
- }
- return str;
- }
-}
-
-class _FallThroughErrorImplementation extends FallThroughError {
-
- _FallThroughErrorImplementation(this._url, this._line);
-
- static _throwNew(int case_clause_pos) native "FallThroughError_throwNew";
-
- String toString() {
- return "'$_url': Switch case fall-through at line $_line.";
- }
-
- final String _url;
- final int _line;
-}
-
-class _InternalError {
- const _InternalError(this._msg);
- String toString() => "InternalError: '${_msg}'";
- final String _msg;
-}
-
-
-class _AbstractClassInstantiationErrorImplementation
- extends AbstractClassInstantiationError {
-
- _AbstractClassInstantiationErrorImplementation(
- String className, this._url, this._line)
- : super(className);
-
- static _throwNew(int case_clause_pos, String className)
- native "AbstractClassInstantiationError_throwNew";
-
- String toString() {
- return "Cannot instantiate abstract class $_className: "
- "_url '$_url' line $_line";
- }
-
- final String _url;
- final int _line;
-}
diff --git a/runtime/lib/error.h b/runtime/lib/error.h
deleted file mode 100644
index 598f78b..0000000
--- a/runtime/lib/error.h
+++ /dev/null
@@ -1,19 +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.
-
-#ifndef LIB_ERROR_H_
-#define LIB_ERROR_H_
-
-#include "vm/runtime_entry.h"
-
-namespace dart {
-
-DECLARE_RUNTIME_ENTRY(ConditionTypeError);
-DECLARE_RUNTIME_ENTRY(MalformedTypeError);
-DECLARE_RUNTIME_ENTRY(TypeCheck);
-
-} // namespace dart
-
-#endif // LIB_ERROR_H_
-
diff --git a/runtime/lib/error.cc b/runtime/lib/errors.cc
similarity index 98%
rename from runtime/lib/error.cc
rename to runtime/lib/errors.cc
index 95bead2..4912747 100644
--- a/runtime/lib/error.cc
+++ b/runtime/lib/errors.cc
@@ -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.
-#include "lib/error.h"
-
#include "vm/bootstrap_natives.h"
#include "vm/exceptions.h"
#include "vm/object_store.h"
@@ -51,7 +49,7 @@
}
-// Allocate and throw a new TypeError.
+// Allocate and throw a new TypeError or CastError.
// Arg0: index of the token of the failed type check.
// Arg1: src value.
// Arg2: dst type name.
diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart
index c68ea47..f841240 100644
--- a/runtime/lib/errors_patch.dart
+++ b/runtime/lib/errors_patch.dart
@@ -12,6 +12,118 @@
StackTrace _stackTrace;
}
+patch class AssertionError extends Error {
+ AssertionError._create(
+ this._failedAssertion, this._url, this._line, this._column);
+
+ static _throwNew(int assertionStart, int assertionEnd)
+ native "AssertionError_throwNew";
+
+ String toString() {
+ return "'$_url': Failed assertion: line $_line pos $_column: "
+ "'$_failedAssertion' is not true.";
+ }
+ final String _failedAssertion;
+ final String _url;
+ final int _line;
+ final int _column;
+}
+
+patch class TypeError extends AssertionError {
+ TypeError._create(String url, int line, int column,
+ this._srcType, this._dstType, this._dstName,
+ this._malformedError)
+ : super._create("is assignable", url, line, column);
+
+ static _throwNew(int location,
+ Object src_value,
+ String dst_type_name,
+ String dst_name,
+ String malformed_error)
+ native "TypeError_throwNew";
+
+ String toString() {
+ String str = (_malformedError != null) ? _malformedError : "";
+ if ((_dstName != null) && (_dstName.length > 0)) {
+ str = "${str}type '$_srcType' is not a subtype of "
+ "type '$_dstType' of '$_dstName'.";
+ } else {
+ str = "${str}malformed type used.";
+ }
+ return str;
+ }
+
+ final String _srcType;
+ final String _dstType;
+ final String _dstName;
+ final String _malformedError;
+}
+
+patch class CastError extends Error {
+ CastError._create(this._url, this._line, this._column,
+ this._srcType, this._dstType, this._dstName,
+ this._malformedError);
+
+ // A CastError is allocated by TypeError._throwNew() when dst_name equals
+ // Exceptions::kCastErrorDstName.
+
+ String toString() {
+ String str = (_malformedError != null) ? _malformedError : "";
+ str = "${str}type '$_srcType' is not a subtype of "
+ "type '$_dstType' in type cast.";
+ return str;
+ }
+
+ // Fields _url, _line, and _column are only used for debugging purposes.
+ final String _url;
+ final int _line;
+ final int _column;
+ final String _srcType;
+ final String _dstType;
+ final String _dstName;
+ final String _malformedError;
+}
+
+patch class FallThroughError {
+ FallThroughError._create(this._url, this._line);
+
+ static _throwNew(int case_clause_pos) native "FallThroughError_throwNew";
+
+ /* patch */ String toString() {
+ return "'$_url': Switch case fall-through at line $_line.";
+ }
+
+ // These new fields cannot be declared final, because a constructor exists
+ // in the original version of this patched class.
+ String _url;
+ int _line;
+}
+
+class _InternalError {
+ const _InternalError(this._msg);
+ String toString() => "InternalError: '${_msg}'";
+ final String _msg;
+}
+
+
+patch class AbstractClassInstantiationError {
+ AbstractClassInstantiationError._create(
+ this._className, this._url, this._line);
+
+ static _throwNew(int case_clause_pos, String className)
+ native "AbstractClassInstantiationError_throwNew";
+
+ /* patch */ String toString() {
+ return "Cannot instantiate abstract class $_className: "
+ "_url '$_url' line $_line";
+ }
+
+ // These new fields cannot be declared final, because a constructor exists
+ // in the original version of this patched class.
+ String _url;
+ int _line;
+}
+
patch class NoSuchMethodError {
// The compiler emits a call to _throwNew when it cannot resolve a static
// method at compile time. The receiver is actually the literal class of the
diff --git a/runtime/lib/math.cc b/runtime/lib/math.cc
index 1116dd36..317045d 100644
--- a/runtime/lib/math.cc
+++ b/runtime/lib/math.cc
@@ -66,4 +66,63 @@
return Double::New(log(operand.value()));
}
+
+// Returns the typed-data array store in '_Random._state' field.
+static RawTypedData* GetRandomStateArray(const Instance& receiver) {
+ const Class& random_class = Class::Handle(receiver.clazz());
+ const Field& state_field =
+ Field::Handle(random_class.LookupField(Symbols::_state()));
+ ASSERT(!state_field.IsNull());
+ const Instance& state_field_value =
+ Instance::Cast(Object::Handle(receiver.GetField(state_field)));
+ ASSERT(!state_field_value.IsNull());
+ ASSERT(state_field_value.IsTypedData());
+ const TypedData& array = TypedData::Cast(state_field_value);
+ ASSERT(array.Length() == 2);
+ ASSERT(array.ElementType() == kUint32ArrayElement);
+ return array.raw();
+}
+
+
+// Implements:
+// var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64;
+// _state[kSTATE_LO] = state & _MASK_32;
+// _state[kSTATE_HI] = state >> 32;
+DEFINE_NATIVE_ENTRY(Random_nextState, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(Instance, receiver, arguments->NativeArgAt(0));
+ const TypedData& array = TypedData::Handle(GetRandomStateArray(receiver));
+ const uint64_t state_lo = array.GetUint32(0);
+ const uint64_t state_hi = array.GetUint32(array.ElementSizeInBytes());
+ const uint64_t A = 0xffffda61;
+ uint64_t state = (A * state_lo) + state_hi;
+ array.SetUint32(0, static_cast<uint32_t>(state));
+ array.SetUint32(array.ElementSizeInBytes(),
+ static_cast<uint32_t>(state >> 32));
+ return Object::null();
+}
+
+
+// Implements:
+// do {
+// seed = (seed + 0x5A17) & _Random._MASK_64;
+// } while (seed == 0);
+// _state[kSTATE_LO] = seed & _MASK_32;
+// _state[kSTATE_HI] = seed >> 32;
+DEFINE_NATIVE_ENTRY(Random_setupSeed, 2) {
+ GET_NON_NULL_NATIVE_ARGUMENT(Instance, receiver, arguments->NativeArgAt(0));
+ GET_NON_NULL_NATIVE_ARGUMENT(Integer, seed_int, arguments->NativeArgAt(1));
+ const TypedData& array = TypedData::Handle(GetRandomStateArray(receiver));
+ ASSERT(!seed_int.IsNull());
+ ASSERT(!array.IsNull());
+ // TODO(srdjan): Reduce Bigint to 64 bit value.
+ int64_t seed = seed_int.IsBigint() ? 0 : seed_int.AsInt64Value();
+ do {
+ seed = seed + 0x5A17;
+ } while (seed == 0);
+ array.SetUint32(0, static_cast<uint32_t>(seed));
+ array.SetUint32(array.ElementSizeInBytes(),
+ static_cast<uint32_t>(seed >> 32));
+ return Object::null();
+}
+
} // namespace dart
diff --git a/runtime/lib/math_patch.dart b/runtime/lib/math_patch.dart
index d5110da..1bf701d 100644
--- a/runtime/lib/math_patch.dart
+++ b/runtime/lib/math_patch.dart
@@ -46,14 +46,12 @@
if (seed == null) {
seed = _Random._nextSeed();
}
- do {
- seed = (seed + 0x5A17) & _Random._MASK_64;
- } while (seed == 0);
// Crank a couple of times to distribute the seed bits a bit further.
- return new _Random._internal(seed).._nextState()
- .._nextState()
- .._nextState()
- .._nextState();
+ return new _Random().._setupSeed(seed)
+ .._nextState()
+ .._nextState()
+ .._nextState()
+ .._nextState();
}
}
@@ -64,19 +62,27 @@
static const kSTATE_LO = 0;
static const kSTATE_HI = 1;
- _Random._internal(state) {
- _state[kSTATE_LO] = state & _MASK_32;
- _state[kSTATE_HI] = state >> 32;
- }
+ // Implements:
+ // do {
+ // seed = (seed + 0x5A17) & _Random._MASK_64;
+ // } while (seed == 0);
+ // _state[kSTATE_LO] = seed & _MASK_32;
+ // _state[kSTATE_HI] = seed >> 32;
+ // This is a native to prevent 64-bit operations in Dart, which
+ // fail with --throw_on_javascript_int_overflow.
+ void _setupSeed(int seed) native "Random_setupSeed";
// The algorithm used here is Multiply with Carry (MWC) with a Base b = 2^32.
// http://en.wikipedia.org/wiki/Multiply-with-carry
// The constant A is selected from "Numerical Recipes 3rd Edition" p.348 B1.
- void _nextState() {
- var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64;
- _state[kSTATE_LO] = state & _MASK_32;
- _state[kSTATE_HI] = state >> 32;
- }
+
+ // Implements:
+ // var state = ((_A * (_state[kSTATE_LO])) + _state[kSTATE_HI]) & _MASK_64;
+ // _state[kSTATE_LO] = state & _MASK_32;
+ // _state[kSTATE_HI] = state >> 32;
+ // This is a native to prevent 64-bit operations in Dart, which
+ // fail with --throw_on_javascript_int_overflow.
+ void _nextState() native "Random_nextState";
int nextInt(int max) {
// TODO(srdjan): Remove the 'limit' check once optimizing comparison of
@@ -103,7 +109,7 @@
}
double nextDouble() {
- return ((nextInt(1 << 26) << 27) + nextInt(1 << 27)) / _POW2_53_D;
+ return ((nextInt(1 << 26) * _POW2_27_D) + nextInt(1 << 27)) / _POW2_53_D;
}
bool nextBool() {
@@ -115,6 +121,7 @@
static const _MASK_64 = (1 << 64) - 1;
static const _POW2_32 = 1 << 32;
static const _POW2_53_D = 1.0 * (1 << 53);
+ static const _POW2_27_D = 1.0 * (1 << 27);
static const _A = 0xffffda61;
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 874915f..d0e4524 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -4,6 +4,7 @@
#include "lib/invocation_mirror.h"
#include "vm/bootstrap_natives.h"
+#include "vm/class_finalizer.h"
#include "vm/dart_entry.h"
#include "vm/exceptions.h"
#include "vm/object_store.h"
@@ -108,9 +109,11 @@
}
-static RawInstance* CreateFunctionTypeMirror(const Class& cls) {
- const Array& args = Array::Handle(Array::New(1));
+static RawInstance* CreateFunctionTypeMirror(const Class& cls,
+ const AbstractType& type) {
+ const Array& args = Array::Handle(Array::New(2));
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
+ args.SetAt(1, type);
return CreateMirror(Symbols::_LocalFunctionTypeMirrorImpl(), args);
}
@@ -153,26 +156,57 @@
return CreateMirror(Symbols::_LocalVariableMirrorImpl(), args);
}
+static RawFunction* CallMethod(const Class& cls) {
+ if (cls.IsSignatureClass()) {
+ return cls.signature_function();
+ }
+
+ Class& lookup_cls = Class::Handle(cls.raw());
+ Function& call_function = Function::Handle();
+ do {
+ call_function = lookup_cls.LookupDynamicFunction(Symbols::Call());
+ if (!call_function.IsNull()) {
+ return call_function.raw();
+ }
+ lookup_cls = lookup_cls.SuperClass();
+ } while (!lookup_cls.IsNull());
+ return Function::null();
+}
static RawInstance* CreateClassMirror(const Class& cls,
+ const AbstractType& type,
const Instance& owner_mirror) {
if (cls.IsSignatureClass()) {
if (cls.IsCanonicalSignatureClass()) {
// We represent function types as canonical signature classes.
- return CreateFunctionTypeMirror(cls);
+ return CreateFunctionTypeMirror(cls, type);
} else {
// We represent typedefs as non-canonical signature classes.
return CreateTypedefMirror(cls, owner_mirror);
}
}
- const Array& args = Array::Handle(Array::New(2));
+ const Bool& is_generic =
+ (cls.NumTypeParameters() == 0) ? Bool::False() : Bool::True();
+
+ const Array& args = Array::Handle(Array::New(4));
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
- args.SetAt(1, String::Handle(cls.UserVisibleName()));
+ args.SetAt(1, type);
+ args.SetAt(2, String::Handle(cls.UserVisibleName()));
+ args.SetAt(3, is_generic);
return CreateMirror(Symbols::_LocalClassMirrorImpl(), args);
}
+// Note a "raw type" is not the same as a RawType.
+static RawAbstractType* RawTypeOfClass(const Class& cls) {
+ Type& type = Type::Handle(Type::New(cls,
+ Object::null_abstract_type_arguments(),
+ Scanner::kDummyTokenIndex));
+ return ClassFinalizer::FinalizeType(cls, type, ClassFinalizer::kCanonicalize);
+}
+
+
static RawInstance* CreateLibraryMirror(const Library& lib) {
const Array& args = Array::Handle(Array::New(3));
args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib)));
@@ -201,7 +235,7 @@
// TODO(mlippautz): Create once in the VM isolate and retrieve from there.
return CreateMirror(Symbols::_SpecialTypeMirrorImpl(), args);
}
- return CreateClassMirror(cls, Object::null_instance());
+ return CreateClassMirror(cls, type, Object::null_instance());
} else if (type.IsTypeParameter()) {
return CreateTypeVariableMirror(TypeParameter::Cast(type),
Object::null_instance());
@@ -259,7 +293,16 @@
DEFINE_NATIVE_ENTRY(Mirrors_makeLocalClassMirror, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0));
const Class& cls = Class::Handle(type.type_class());
- return CreateClassMirror(cls, Object::null_instance());
+ ASSERT(!cls.IsNull());
+ return CreateClassMirror(cls,
+ AbstractType::Handle(),
+ Instance::null_instance());
+}
+
+
+DEFINE_NATIVE_ENTRY(Mirrors_makeLocalTypeMirror, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
+ return CreateTypeMirror(type);
}
@@ -323,10 +366,23 @@
}
+DEFINE_NATIVE_ENTRY(FunctionTypeMirror_call_method, 2) {
+ GET_NON_NULL_NATIVE_ARGUMENT(Instance,
+ owner_mirror,
+ arguments->NativeArgAt(0));
+ GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
+ const Class& cls = Class::Handle(ref.GetClassReferent());
+ const Function& func = Function::Handle(CallMethod(cls));
+ ASSERT(!func.IsNull());
+ return CreateMethodMirror(func, owner_mirror);
+}
+
+
DEFINE_NATIVE_ENTRY(FunctionTypeMirror_parameters, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
const Class& cls = Class::Handle(ref.GetClassReferent());
- const Function& func = Function::Handle(cls.signature_function());
+ const Function& func = Function::Handle(CallMethod(cls));
+ ASSERT(!func.IsNull());
return CreateParameterMirrorList(func);
}
@@ -334,9 +390,9 @@
DEFINE_NATIVE_ENTRY(FunctionTypeMirror_return_type, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
const Class& cls = Class::Handle(ref.GetClassReferent());
- const Function& func = Function::Handle(cls.signature_function());
- const AbstractType& return_type = AbstractType::Handle(func.result_type());
- return CreateTypeMirror(return_type);
+ const Function& func = Function::Handle(CallMethod(cls));
+ ASSERT(!func.IsNull());
+ return func.result_type();
}
@@ -499,7 +555,9 @@
// The various implementations of public classes don't always have the
// expected superinterfaces or other properties, so we filter them out.
if (!RawObject::IsImplementationClassId(klass.id())) {
- member_mirror = CreateClassMirror(klass, owner_mirror);
+ member_mirror = CreateClassMirror(klass,
+ AbstractType::Handle(),
+ owner_mirror);
member_mirrors.Add(member_mirror);
}
}
@@ -529,16 +587,42 @@
}
-DEFINE_NATIVE_ENTRY(LocalTypeVariableMirror_owner, 1) {
+DEFINE_NATIVE_ENTRY(ClassMirror_type_arguments, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
+
+ const AbstractTypeArguments& args =
+ AbstractTypeArguments::Handle(type.arguments());
+ if (args.IsNull()) {
+ return Object::empty_array().raw();
+ }
+
+ const Class& cls = Class::Handle(type.type_class());
+ const intptr_t num_params = cls.NumTypeParameters();
+ const intptr_t num_inherited_args = args.Length() - num_params;
+
+ const Array& result = Array::Handle(Array::New(num_params));
+ AbstractType& arg_type = AbstractType::Handle();
+ Instance& type_mirror = Instance::Handle();
+ for (intptr_t i = 0; i < num_params; i++) {
+ arg_type ^= args.TypeAt(i + num_inherited_args);
+ type_mirror = CreateTypeMirror(arg_type);
+ result.SetAt(i, type_mirror);
+ }
+ return result.raw();
+}
+
+
+DEFINE_NATIVE_ENTRY(TypeVariableMirror_owner, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0));
return CreateClassMirror(Class::Handle(param.parameterized_class()),
+ AbstractType::Handle(),
Instance::null_instance());
}
-DEFINE_NATIVE_ENTRY(LocalTypeVariableMirror_upper_bound, 1) {
+DEFINE_NATIVE_ENTRY(TypeVariableMirror_upper_bound, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0));
- return CreateTypeMirror(AbstractType::Handle(param.bound()));
+ return param.bound();
}
@@ -723,10 +807,13 @@
DEFINE_NATIVE_ENTRY(ClosureMirror_function, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
- ASSERT(closure.IsClosure());
+ ASSERT(!closure.IsNull());
- const Function& func = Function::Handle(Closure::function(closure));
- return CreateMethodMirror(func, Instance::null_instance());
+ Function& function = Function::Handle();
+ bool callable = closure.IsCallable(&function, NULL);
+ ASSERT(callable);
+
+ return CreateMethodMirror(function, Instance::null_instance());
}
@@ -763,11 +850,7 @@
const Function& function,
const InvocationMirror::Call call,
const InvocationMirror::Type type) {
- AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle();
- Type& pre_type = Type::Handle(
- Type::New(klass, type_arguments, Scanner::kDummyTokenIndex));
- pre_type.SetIsFinalized();
- AbstractType& runtime_type = AbstractType::Handle(pre_type.Canonicalize());
+ AbstractType& runtime_type = AbstractType::Handle(RawTypeOfClass(klass));
ThrowNoSuchMethod(runtime_type,
function_name,
@@ -1151,7 +1234,9 @@
if (owner.IsTopLevel()) {
return CreateLibraryMirror(Library::Handle(owner.library()));
}
- return CreateClassMirror(owner, Object::null_instance());
+ return CreateClassMirror(owner,
+ AbstractType::Handle(),
+ Object::null_instance());
}
@@ -1167,8 +1252,7 @@
const Function& func = Function::Handle(ref.GetFunctionReferent());
// We handle constructors in Dart code.
ASSERT(!func.IsConstructor());
- const AbstractType& return_type = AbstractType::Handle(func.result_type());
- return CreateTypeMirror(return_type);
+ return func.result_type();
}
@@ -1185,18 +1269,14 @@
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, pos, arguments->NativeArgAt(1));
const Function& func = Function::Handle(ref.GetFunctionReferent());
- const AbstractType& param_type = AbstractType::Handle(func.ParameterTypeAt(
- func.NumImplicitParameters() + pos.Value()));
- return CreateTypeMirror(param_type);
+ return func.ParameterTypeAt(func.NumImplicitParameters() + pos.Value());
}
DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
const Field& field = Field::Handle(ref.GetFieldReferent());
-
- const AbstractType& type = AbstractType::Handle(field.type());
- return CreateTypeMirror(type);
+ return field.type();
}
} // namespace dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 5fb76c7..7c7331f 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -251,7 +251,7 @@
if (_type == null) {
// Note it not safe to use reflectee.runtimeType because runtimeType may
// be overridden.
- _type = reflectClass(_computeType(reflectee));
+ _type = _Mirrors._reflectType(_computeType(reflectee));
}
return _type;
}
@@ -360,10 +360,15 @@
class _LocalClassMirrorImpl extends _LocalObjectMirrorImpl
implements ClassMirror {
_LocalClassMirrorImpl(reflectee,
- String simpleName)
+ this._reflectedType,
+ String simpleName,
+ this._isGeneric)
: this._simpleName = _s(simpleName),
super(reflectee);
+ final Type _reflectedType;
+ final bool _isGeneric;
+
Symbol _simpleName;
Symbol get simpleName {
// dynamic, void and the function types have their names set eagerly in the
@@ -501,19 +506,30 @@
return _typeVariables;
}
+ Map<Symbol, TypeMirror> _typeArguments = null;
Map<Symbol, TypeMirror> get typeArguments {
- throw new UnimplementedError(
- 'ClassMirror.typeArguments is not implemented');
+ if(_typeArguments == null) {
+ if(_reflectedType == null) {
+ _typeArguments = new LinkedHashMap<Symbol, TypeMirror>();
+ } else {
+ _typeArguments =
+ new LinkedHashMap<Symbol, TypeMirror>.fromIterables(typeVariables.keys,
+ _computeTypeArguments(_reflectedType));
+ }
+ }
+ return _typeArguments;
}
bool get isOriginalDeclaration {
- throw new UnimplementedError(
- 'ClassMirror.isOriginalDeclaration is not implemented');
+ return !_isGeneric || _reflectedType == null;
}
- ClassMirror get genericDeclaration {
- throw new UnimplementedError(
- 'ClassMirror.originalDeclaration is not implemented');
+ ClassMirror get originalDeclaration {
+ if (isOriginalDeclaration) {
+ return this;
+ } else {
+ return reflectClass(_reflectedType);
+ }
}
String toString() {
@@ -558,7 +574,9 @@
bool operator ==(other) {
return this.runtimeType == other.runtimeType &&
- this._reflectee == other._reflectee;
+ this._reflectee == other._reflectee &&
+ (isOriginalDeclaration ||
+ this._reflectedType == other._reflectedType);
}
int get hashCode => simpleName.hashCode;
@@ -595,11 +613,15 @@
static _ClassMirror_type_variables(reflectee)
native "ClassMirror_type_variables";
+
+ static _computeTypeArguments(reflectee)
+ native "ClassMirror_type_arguments";
}
class _LocalFunctionTypeMirrorImpl extends _LocalClassMirrorImpl
implements FunctionTypeMirror {
- _LocalFunctionTypeMirrorImpl(reflectee) : super(reflectee, null);
+ _LocalFunctionTypeMirrorImpl(reflectee, reflectedType)
+ : super(reflectee, reflectedType, null, false);
// FunctionTypeMirrors have a simpleName generated from their signature.
Symbol _simpleName = null;
@@ -610,10 +632,19 @@
return _simpleName;
}
+ MethodMirror _callMethod;
+ MethodMirror get callMethod {
+ if (_callMethod == null) {
+ _callMethod = this._FunctionTypeMirror_call_method(_reflectee);
+ }
+ return _callMethod;
+ }
+
TypeMirror _returnType = null;
TypeMirror get returnType {
if (_returnType == null) {
- _returnType = _FunctionTypeMirror_return_type(_reflectee);
+ _returnType =
+ _Mirrors._reflectType(_FunctionTypeMirror_return_type(_reflectee));
}
return _returnType;
}
@@ -632,7 +663,10 @@
String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
- static TypeMirror _FunctionTypeMirror_return_type(reflectee)
+ MethodMirror _FunctionTypeMirror_call_method(reflectee)
+ native "FunctionTypeMirror_call_method";
+
+ static Type _FunctionTypeMirror_return_type(reflectee)
native "FunctionTypeMirror_return_type";
static List<ParameterMirror> _FunctionTypeMirror_parameters(reflectee)
@@ -679,7 +713,7 @@
DeclarationMirror _owner;
DeclarationMirror get owner {
if (_owner == null) {
- _owner = _LocalTypeVariableMirror_owner(_reflectee);
+ _owner = _TypeVariableMirror_owner(_reflectee);
}
return _owner;
}
@@ -696,7 +730,8 @@
TypeMirror _upperBound = null;
TypeMirror get upperBound {
if (_upperBound == null) {
- _upperBound = _LocalTypeVariableMirror_upper_bound(_reflectee);
+ _upperBound =
+ _Mirrors._reflectType(_TypeVariableMirror_upper_bound(_reflectee));
}
return _upperBound;
}
@@ -706,13 +741,16 @@
'TypeVariableMirror.metadata is not implemented');
}
+ bool get isOriginalDeclaration => true;
+ ClassMirror get originalDeclaration => this;
+
String toString() => "TypeVariableMirror on '${_n(simpleName)}'";
- static DeclarationMirror _LocalTypeVariableMirror_owner(reflectee)
- native "LocalTypeVariableMirror_owner";
+ static DeclarationMirror _TypeVariableMirror_owner(reflectee)
+ native "TypeVariableMirror_owner";
- static TypeMirror _LocalTypeVariableMirror_upper_bound(reflectee)
- native "LocalTypeVariableMirror_upper_bound";
+ static Type _TypeVariableMirror_upper_bound(reflectee)
+ native "TypeVariableMirror_upper_bound";
}
@@ -723,6 +761,9 @@
this._owner)
: super(reflectee, _s(simpleName));
+ // TODO(12282): Deal with generic typedefs.
+ bool get _isGeneric => false;
+
DeclarationMirror _owner;
DeclarationMirror get owner {
if (_owner == null) {
@@ -743,8 +784,9 @@
TypeMirror _referent = null;
TypeMirror get referent {
if (_referent == null) {
+ // TODO(12282): Deal with generic typedef.
return new _LocalFunctionTypeMirrorImpl(
- _TypedefMirror_referent(_reflectee));
+ _TypedefMirror_referent(_reflectee), null);
}
return _referent;
}
@@ -912,7 +954,8 @@
if (isConstructor) {
_returnType = owner;
} else {
- _returnType = _MethodMirror_return_type(_reflectee);
+ _returnType =
+ _Mirrors._reflectType(_MethodMirror_return_type(_reflectee));
}
}
return _returnType;
@@ -1006,7 +1049,7 @@
TypeMirror _type;
TypeMirror get type {
if (_type == null) {
- _type = _VariableMirror_type(_reflectee);
+ _type = _Mirrors._reflectType(_VariableMirror_type(_reflectee));
}
return _type;
}
@@ -1050,12 +1093,13 @@
TypeMirror _type = null;
TypeMirror get type {
if (_type == null) {
- _type = _ParameterMirror_type(_reflectee, _position);
+ _type =
+ _Mirrors._reflectType(_ParameterMirror_type(_reflectee, _position));
}
return _type;
}
- static TypeMirror _ParameterMirror_type(_reflectee, _position)
+ static Type _ParameterMirror_type(_reflectee, _position)
native "ParameterMirror_type";
}
@@ -1135,17 +1179,35 @@
: new _LocalInstanceMirrorImpl(reflectee);
}
- // Creates a new local ClassMirror.
static ClassMirror makeLocalClassMirror(Type key)
native "Mirrors_makeLocalClassMirror";
+ static TypeMirror makeLocalTypeMirror(Type key)
+ native "Mirrors_makeLocalTypeMirror";
- static Expando<ClassMirror> _classMirrorCache = new Expando("ClassMirror");
+ static Expando<ClassMirror> _declarationCache = new Expando("ClassMirror");
+ static Expando<ClassMirror> _instanitationCache = new Expando("TypeMirror");
+
static ClassMirror reflectClass(Type key) {
- var classMirror = _classMirrorCache[key];
+ var classMirror = _declarationCache[key];
if (classMirror == null) {
classMirror = makeLocalClassMirror(key);
- _classMirrorCache[key] = classMirror;
+ _declarationCache[key] = classMirror;
+ if (!classMirror._isGeneric) {
+ _instanitationCache[key] = classMirror;
+ }
}
return classMirror;
}
+
+ static TypeMirror _reflectType(Type key) {
+ var typeMirror = _instanitationCache[key];
+ if (typeMirror == null) {
+ typeMirror = makeLocalTypeMirror(key);
+ _instanitationCache[key] = typeMirror;
+ if (typeMirror is ClassMirror && !typeMirror._isGeneric) {
+ _declarationCache[key] = typeMirror;
+ }
+ }
+ return typeMirror;
+ }
}
diff --git a/runtime/lib/stacktrace.cc b/runtime/lib/stacktrace.cc
index 085d9dc..2a8f96e 100644
--- a/runtime/lib/stacktrace.cc
+++ b/runtime/lib/stacktrace.cc
@@ -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.
-#include "lib/error.h"
-
#include "vm/bootstrap_natives.h"
#include "vm/exceptions.h"
#include "vm/object_store.h"
@@ -51,7 +49,7 @@
Code& code = Code::Handle();
Smi& offset = Smi::Handle();
bool catch_frame_skipped = false; // Tracks if catch frame has been skipped.
- while (!frame->IsEntryFrame()) {
+ while (frame != NULL) {
if (frame->IsDartFrame()) {
code = frame->LookupDartCode();
if (code.is_optimized()) {
@@ -90,7 +88,6 @@
}
}
frame = frames.NextFrame();
- ASSERT(frame != NULL);
}
const Array& func_array = Array::Handle(Array::MakeArray(func_list));
const Array& code_array = Array::Handle(Array::MakeArray(code_list));
diff --git a/runtime/lib/uri.cc b/runtime/lib/uri.cc
new file mode 100644
index 0000000..f75d2ec
--- /dev/null
+++ b/runtime/lib/uri.cc
@@ -0,0 +1,19 @@
+// 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.
+
+#include "vm/bootstrap_natives.h"
+#include "vm/native_entry.h"
+#include "vm/object.h"
+
+namespace dart {
+
+DEFINE_NATIVE_ENTRY(Uri_isWindowsPlatform, 0) {
+#if defined(_WIN32)
+ return Bool::True().raw();
+#else
+ return Bool::False().raw();
+#endif
+}
+
+} // namespace dart
diff --git a/runtime/lib/uri_patch.dart b/runtime/lib/uri_patch.dart
new file mode 100644
index 0000000..b07946d
--- /dev/null
+++ b/runtime/lib/uri_patch.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.
+
+// VM implementation of Uri.
+patch class Uri {
+ static final bool _isWindowsCached = _isWindowsPlatform;
+
+ static bool get _isWindowsPlatform native "Uri_isWindowsPlatform";
+
+ /* patch */ static bool get _isWindows => _isWindowsCached;
+}
diff --git a/runtime/platform/json.cc b/runtime/platform/json.cc
index 899b62c..0823d0a 100644
--- a/runtime/platform/json.cc
+++ b/runtime/platform/json.cc
@@ -234,7 +234,7 @@
if ((*s == '\n') || (*s == '\t')) {
OS::Print("Un-escaped character in JSON string: '%s'\n",
ValueChars());
- ASSERT(!"illegal character in JSON string value");
+ FATAL("illegal character in JSON string value");
}
s++;
remaining--;
@@ -251,7 +251,7 @@
default:
OS::Print("Malformed JSON: expected a value but got '%s'\n",
scanner_.TokenChars());
- ASSERT(!"illegal JSON value found");
+ FATAL("illegal JSON value found");
}
}
diff --git a/runtime/platform/thread_android.cc b/runtime/platform/thread_android.cc
index e789c01..20e0e9e 100644
--- a/runtime/platform/thread_android.cc
+++ b/runtime/platform/thread_android.cc
@@ -16,15 +16,21 @@
#define VALIDATE_PTHREAD_RESULT(result) \
if (result != 0) { \
- FATAL2("pthread error: %d (%s)", result, strerror(result)); \
+ const int kBufferSize = 1024; \
+ char error_message[kBufferSize]; \
+ strerror_r(result, error_message, kBufferSize); \
+ FATAL2("pthread error: %d (%s)", result, error_message); \
}
#ifdef DEBUG
#define RETURN_ON_PTHREAD_FAILURE(result) \
if (result != 0) { \
+ const int kBufferSize = 1024; \
+ char error_message[kBufferSize]; \
+ strerror_r(result, error_message, kBufferSize); \
fprintf(stderr, "%s:%d: pthread error: %d (%s)\n", \
- __FILE__, __LINE__, result, strerror(result)); \
+ __FILE__, __LINE__, result, error_message); \
return result; \
}
#else
diff --git a/runtime/platform/thread_linux.cc b/runtime/platform/thread_linux.cc
index dd02a38..acb78c7 100644
--- a/runtime/platform/thread_linux.cc
+++ b/runtime/platform/thread_linux.cc
@@ -16,15 +16,21 @@
#define VALIDATE_PTHREAD_RESULT(result) \
if (result != 0) { \
- FATAL2("pthread error: %d (%s)", result, strerror(result)); \
+ const int kBufferSize = 1024; \
+ char error_buf[kBufferSize]; \
+ FATAL2("pthread error: %d (%s)", result, \
+ strerror_r(result, error_buf, kBufferSize)); \
}
#ifdef DEBUG
#define RETURN_ON_PTHREAD_FAILURE(result) \
if (result != 0) { \
+ const int kBufferSize = 1024; \
+ char error_buf[kBufferSize]; \
fprintf(stderr, "%s:%d: pthread error: %d (%s)\n", \
- __FILE__, __LINE__, result, strerror(result)); \
+ __FILE__, __LINE__, result, \
+ strerror_r(result, error_buf, kBufferSize)); \
return result; \
}
#else
diff --git a/runtime/platform/thread_macos.cc b/runtime/platform/thread_macos.cc
index 29059fe..e9c6dfc 100644
--- a/runtime/platform/thread_macos.cc
+++ b/runtime/platform/thread_macos.cc
@@ -15,15 +15,21 @@
#define VALIDATE_PTHREAD_RESULT(result) \
if (result != 0) { \
- FATAL2("pthread error: %d (%s)", result, strerror(result)); \
+ const int kBufferSize = 1024; \
+ char error_message[kBufferSize]; \
+ strerror_r(result, error_message, kBufferSize); \
+ FATAL2("pthread error: %d (%s)", result, error_message); \
}
#ifdef DEBUG
#define RETURN_ON_PTHREAD_FAILURE(result) \
if (result != 0) { \
+ const int kBufferSize = 1024; \
+ char error_message[kBufferSize]; \
+ strerror_r(result, error_message, kBufferSize); \
fprintf(stderr, "%s:%d: pthread error: %d (%s)\n", \
- __FILE__, __LINE__, result, strerror(result)); \
+ __FILE__, __LINE__, result, error_message); \
return result; \
}
#else
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index 9f1b610..0af0f3e 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -1517,11 +1517,13 @@
NativeBodyNode(intptr_t token_pos,
const Function& function,
const String& native_c_function_name,
- NativeFunction native_c_function)
+ NativeFunction native_c_function,
+ bool is_bootstrap_native)
: AstNode(token_pos),
function_(function),
native_c_function_name_(native_c_function_name),
- native_c_function_(native_c_function) {
+ native_c_function_(native_c_function),
+ is_bootstrap_native_(is_bootstrap_native) {
ASSERT(function_.IsZoneHandle());
ASSERT(native_c_function_ != NULL);
ASSERT(native_c_function_name_.IsZoneHandle());
@@ -1533,6 +1535,7 @@
return native_c_function_name_;
}
NativeFunction native_c_function() const { return native_c_function_; }
+ bool is_bootstrap_native() const { return is_bootstrap_native_; }
virtual void VisitChildren(AstNodeVisitor* visitor) const { }
@@ -1542,6 +1545,7 @@
const Function& function_; // Native Dart function.
const String& native_c_function_name_;
NativeFunction native_c_function_; // Actual non-Dart implementation.
+ const bool is_bootstrap_native_; // Is a bootstrap native method.
DISALLOW_IMPLICIT_CONSTRUCTORS(NativeBodyNode);
};
@@ -1556,13 +1560,15 @@
const Array& handler_types,
const LocalVariable* context_var,
const LocalVariable* exception_var,
- const LocalVariable* stacktrace_var)
+ const LocalVariable* stacktrace_var,
+ intptr_t catch_handler_index)
: AstNode(token_pos),
catch_block_(catch_block),
handler_types_(handler_types),
context_var_(*context_var),
exception_var_(*exception_var),
- stacktrace_var_(*stacktrace_var) {
+ stacktrace_var_(*stacktrace_var),
+ catch_handler_index_(catch_handler_index) {
ASSERT(catch_block_ != NULL);
ASSERT(handler_types.IsZoneHandle());
ASSERT(context_var != NULL);
@@ -1574,6 +1580,7 @@
const LocalVariable& context_var() const { return context_var_; }
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_; }
virtual void VisitChildren(AstNodeVisitor* visitor) const {
catch_block_->Visit(visitor);
@@ -1587,6 +1594,7 @@
const LocalVariable& context_var_;
const LocalVariable& exception_var_;
const LocalVariable& stacktrace_var_;
+ const intptr_t catch_handler_index_;
DISALLOW_COPY_AND_ASSIGN(CatchClauseNode);
};
@@ -1599,13 +1607,15 @@
SourceLabel* end_catch_label,
const LocalVariable* context_var,
CatchClauseNode* catch_block,
- SequenceNode* finally_block)
+ SequenceNode* finally_block,
+ intptr_t try_index)
: AstNode(token_pos),
try_block_(try_block),
end_catch_label_(end_catch_label),
context_var_(*context_var),
catch_block_(catch_block),
- finally_block_(finally_block) {
+ finally_block_(finally_block),
+ try_index_(try_index) {
ASSERT(try_block_ != NULL);
ASSERT(context_var != NULL);
ASSERT(catch_block_ != NULL || finally_block_ != NULL);
@@ -1617,6 +1627,7 @@
CatchClauseNode* catch_block() const { return catch_block_; }
SequenceNode* finally_block() const { return finally_block_; }
const LocalVariable& context_var() const { return context_var_; }
+ intptr_t try_index() const { return try_index_; }
virtual void VisitChildren(AstNodeVisitor* visitor) const {
try_block_->Visit(visitor);
@@ -1636,6 +1647,7 @@
const LocalVariable& context_var_;
CatchClauseNode* catch_block_;
SequenceNode* finally_block_;
+ const intptr_t try_index_;
DISALLOW_COPY_AND_ASSIGN(TryCatchNode);
};
@@ -1672,16 +1684,19 @@
public:
InlinedFinallyNode(intptr_t token_pos,
AstNode* finally_block,
- const LocalVariable* context_var)
+ const LocalVariable* context_var,
+ intptr_t try_index)
: AstNode(token_pos),
finally_block_(finally_block),
- context_var_(*context_var) {
+ context_var_(*context_var),
+ try_index_(try_index) {
ASSERT(finally_block_ != NULL);
ASSERT(context_var != NULL);
}
AstNode* finally_block() const { return finally_block_; }
const LocalVariable& context_var() const { return context_var_; }
+ intptr_t try_index() const { return try_index_; }
virtual void VisitChildren(AstNodeVisitor* visitor) const {
finally_block()->Visit(visitor);
@@ -1692,6 +1707,7 @@
private:
AstNode* finally_block_;
const LocalVariable& context_var_;
+ const intptr_t try_index_;
DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
};
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index 888efb4..2ca11fe 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -106,20 +106,21 @@
// The specific api functions called here are a bit arbitrary. We are
// trying to get a sense of the overhead for using the dart api.
static void UseDartApi(Dart_NativeArguments args) {
- Dart_EnterScope();
int count = Dart_GetNativeArgumentCount(args);
EXPECT_EQ(3, count);
- // Get the receiver.
- Dart_Handle recv = Dart_GetNativeArgument(args, 0);
- EXPECT_VALID(recv);
+ // Get native field from receiver.
+ intptr_t receiver_value;
+ Dart_Handle result = Dart_GetNativeReceiver(args, &receiver_value);
+ EXPECT_VALID(result);
+ EXPECT_EQ(7, receiver_value);
// Get param1.
Dart_Handle param1 = Dart_GetNativeArgument(args, 1);
EXPECT_VALID(param1);
EXPECT(Dart_IsInteger(param1));
bool fits = false;
- Dart_Handle result = Dart_IntegerFitsIntoInt64(param1, &fits);
+ result = Dart_IntegerFitsIntoInt64(param1, &fits);
EXPECT_VALID(result);
EXPECT(fits);
int64_t value1;
@@ -128,15 +129,8 @@
EXPECT_LE(0, value1);
EXPECT_LE(value1, 1000000);
- // Get native field from receiver.
- intptr_t value2;
- result = Dart_GetNativeInstanceField(recv, 0, &value2);
- EXPECT_VALID(result);
- EXPECT_EQ(7, value2);
-
// Return param + receiver.field.
- Dart_SetReturnValue(args, Dart_NewInteger(value1 * value2));
- Dart_ExitScope();
+ Dart_SetReturnValue(args, Dart_NewInteger(value1 * receiver_value));
}
@@ -310,7 +304,6 @@
//
static void StackFrame_accessFrame(Dart_NativeArguments args) {
const int kNumIterations = 100;
- Dart_EnterScope();
Code& code = Code::Handle();
Timer timer(true, "LookupDartCode benchmark");
timer.Start();
@@ -331,7 +324,6 @@
timer.Stop();
int64_t elapsed_time = timer.TotalElapsedTime();
Dart_SetReturnValue(args, Dart_NewInteger(elapsed_time));
- Dart_ExitScope();
}
diff --git a/runtime/vm/bootstrap.h b/runtime/vm/bootstrap.h
index 66d7608..8d77617 100644
--- a/runtime/vm/bootstrap.h
+++ b/runtime/vm/bootstrap.h
@@ -5,6 +5,7 @@
#ifndef VM_BOOTSTRAP_H_
#define VM_BOOTSTRAP_H_
+#include "include/dart_api.h"
#include "vm/allocation.h"
namespace dart {
@@ -16,6 +17,7 @@
public:
static RawError* LoadandCompileScripts();
static void SetupNativeResolver();
+ static bool IsBootstapResolver(Dart_NativeEntryResolver resolver);
// Source path mapping for library URI and 'parts'.
static const char* async_source_paths_[];
diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc
index 2bede6c..a072563 100644
--- a/runtime/vm/bootstrap_natives.cc
+++ b/runtime/vm/bootstrap_natives.cc
@@ -81,4 +81,10 @@
library.set_native_entry_resolver(resolver);
}
+
+bool Bootstrap::IsBootstapResolver(Dart_NativeEntryResolver resolver) {
+ return (resolver ==
+ reinterpret_cast<Dart_NativeEntryResolver>(BootstrapNatives::Lookup));
+}
+
} // namespace dart
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index d890bf4..0cf705f 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -107,6 +107,8 @@
V(Math_atan2, 2) \
V(Math_exp, 1) \
V(Math_log, 1) \
+ V(Random_nextState, 1) \
+ V(Random_setupSeed, 2) \
V(DateNatives_currentTimeMillis, 0) \
V(DateNatives_timeZoneName, 1) \
V(DateNatives_timeZoneOffsetInSeconds, 1) \
@@ -241,6 +243,7 @@
V(isolate_spawnUri, 1) \
V(Mirrors_isLocalPort, 1) \
V(Mirrors_makeLocalClassMirror, 1) \
+ V(Mirrors_makeLocalTypeMirror, 1) \
V(Mirrors_makeLocalMirrorSystem, 0) \
V(MirrorReference_equals, 2) \
V(InstanceMirror_invoke, 4) \
@@ -260,12 +263,14 @@
V(ClassMirror_invokeSetter, 4) \
V(ClassMirror_invokeConstructor, 3) \
V(ClassMirror_type_variables, 1) \
+ V(ClassMirror_type_arguments, 1) \
V(LibraryMirror_invoke, 4) \
V(LibraryMirror_invokeGetter, 3) \
V(LibraryMirror_invokeSetter, 4) \
- V(LocalTypeVariableMirror_owner, 1) \
- V(LocalTypeVariableMirror_upper_bound, 1) \
+ V(TypeVariableMirror_owner, 1) \
+ V(TypeVariableMirror_upper_bound, 1) \
V(DeclarationMirror_metadata, 1) \
+ V(FunctionTypeMirror_call_method, 2) \
V(FunctionTypeMirror_parameters, 1) \
V(FunctionTypeMirror_return_type, 1) \
V(MethodMirror_owner, 1) \
@@ -285,6 +290,7 @@
V(WeakProperty_getKey, 1) \
V(WeakProperty_getValue, 1) \
V(WeakProperty_setValue, 2) \
+ V(Uri_isWindowsPlatform, 0) \
class BootstrapNatives : public AllStatic {
public:
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 91410fa..25fb423 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -1376,9 +1376,9 @@
Function::New(clone_name,
func.kind(),
func.is_static(),
- func.is_const(),
- func.is_abstract(),
- func.is_external(),
+ false, // Not const.
+ false, // Not abstract.
+ false, // Not external.
mixin_app,
mixin_app.token_pos()));
diff --git a/runtime/vm/code_descriptors_test.cc b/runtime/vm/code_descriptors_test.cc
index a3d8fb9..f1c41db 100644
--- a/runtime/vm/code_descriptors_test.cc
+++ b/runtime/vm/code_descriptors_test.cc
@@ -182,7 +182,6 @@
static void NativeFunc(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle i = Dart_GetNativeArgument(args, 0);
Dart_Handle k = Dart_GetNativeArgument(args, 1);
int64_t value = -1;
@@ -191,7 +190,6 @@
EXPECT_VALID(Dart_IntegerToInt64(k, &value));
EXPECT_EQ(20, value);
Isolate::Current()->heap()->CollectAllGarbage();
- Dart_ExitScope();
}
@@ -283,4 +281,3 @@
}
} // namespace dart
-
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index c818976..7aaf5bc 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -653,36 +653,6 @@
}
-// Test whether a formal parameter was defined by a passed-in argument.
-// Arg0: formal parameter index as Smi.
-// Arg1: formal parameter name as Symbol.
-// Arg2: arguments descriptor array.
-// Return value: true or false.
-DEFINE_RUNTIME_ENTRY(ArgumentDefinitionTest, 3) {
- ASSERT(arguments.ArgCount() ==
- kArgumentDefinitionTestRuntimeEntry.argument_count());
- const Smi& param_index = Smi::CheckedHandle(arguments.ArgAt(0));
- const String& param_name = String::CheckedHandle(arguments.ArgAt(1));
- ASSERT(param_name.IsSymbol());
- const Array& arg_desc_array = Array::CheckedHandle(arguments.ArgAt(2));
- ArgumentsDescriptor arg_desc(arg_desc_array);
- const intptr_t num_pos_args = arg_desc.PositionalCount();
- // Check if the formal parameter is defined by a positional argument.
- bool is_defined = num_pos_args > param_index.Value();
- if (!is_defined) {
- // Check if the formal parameter is defined by a named argument.
- const intptr_t num_named_args = arg_desc.NamedCount();
- for (intptr_t i = 0; i < num_named_args; i++) {
- if (arg_desc.MatchesNameAt(i, param_name)) {
- is_defined = true;
- break;
- }
- }
- }
- arguments.SetReturn(is_defined ? Bool::True() : Bool::False());
-}
-
-
// Report that the type of the given object is not bool in conditional context.
// Arg0: bad object.
// Return value: none, throws a TypeError.
diff --git a/runtime/vm/code_generator.h b/runtime/vm/code_generator.h
index 511676c..60a3cd7 100644
--- a/runtime/vm/code_generator.h
+++ b/runtime/vm/code_generator.h
@@ -22,7 +22,6 @@
DECLARE_RUNTIME_ENTRY(AllocateContext);
DECLARE_RUNTIME_ENTRY(AllocateObject);
DECLARE_RUNTIME_ENTRY(AllocateObjectWithBoundsCheck);
-DECLARE_RUNTIME_ENTRY(ArgumentDefinitionTest);
DECLARE_RUNTIME_ENTRY(BreakpointRuntimeHandler);
DECLARE_RUNTIME_ENTRY(BreakpointStaticHandler);
DECLARE_RUNTIME_ENTRY(BreakpointReturnHandler);
@@ -37,6 +36,9 @@
DECLARE_RUNTIME_ENTRY(StaticCallMissHandlerTwoArgs);
DECLARE_RUNTIME_ENTRY(InstanceFunctionLookup);
DECLARE_RUNTIME_ENTRY(Instanceof);
+DECLARE_RUNTIME_ENTRY(TypeCheck);
+DECLARE_RUNTIME_ENTRY(MalformedTypeError);
+DECLARE_RUNTIME_ENTRY(ConditionTypeError);
DECLARE_RUNTIME_ENTRY(InstantiateType);
DECLARE_RUNTIME_ENTRY(InstantiateTypeArguments);
DECLARE_RUNTIME_ENTRY(InvokeNoSuchMethodFunction);
@@ -54,7 +56,6 @@
DECLARE_RUNTIME_ENTRY(UpdateICDataTwoArgs);
DECLARE_RUNTIME_ENTRY(UpdateFieldCid);
-
#define DEOPT_REASONS(V) \
V(Unknown) \
V(InstanceGetter) \
diff --git a/runtime/vm/code_generator_test.cc b/runtime/vm/code_generator_test.cc
index 5470f0d..6dceb4c 100644
--- a/runtime/vm/code_generator_test.cc
+++ b/runtime/vm/code_generator_test.cc
@@ -218,11 +218,13 @@
String::ZoneHandle(Symbols::New("TestSmiSub"));
NativeFunction native_function =
reinterpret_cast<NativeFunction>(TestSmiSub);
- node_seq->Add(new ReturnNode(kPos,
- new NativeBodyNode(kPos,
- function,
- native_name,
- native_function)));
+ node_seq->Add(
+ new ReturnNode(kPos,
+ new NativeBodyNode(kPos,
+ function,
+ native_name,
+ native_function,
+ false /* not bootstrap native */)));
}
@@ -398,11 +400,13 @@
String::ZoneHandle(Symbols::New("TestSmiSum"));
NativeFunction native_function =
reinterpret_cast<NativeFunction>(TestSmiSum);
- node_seq->Add(new ReturnNode(kPos,
- new NativeBodyNode(kPos,
- function,
- native_name,
- native_function)));
+ node_seq->Add(
+ new ReturnNode(kPos,
+ new NativeBodyNode(kPos,
+ function,
+ native_name,
+ native_function,
+ false /* Not bootstrap native */)));
}
@@ -485,11 +489,13 @@
String::ZoneHandle(Symbols::New("TestNonNullSmiSum"));
NativeFunction native_function =
reinterpret_cast<NativeFunction>(TestNonNullSmiSum);
- node_seq->Add(new ReturnNode(kPos,
- new NativeBodyNode(kPos,
- function,
- native_name,
- native_function)));
+ node_seq->Add(
+ new ReturnNode(kPos,
+ new NativeBodyNode(kPos,
+ function,
+ native_name,
+ native_function,
+ false /* Not bootstrap native */)));
}
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 5f14950..8adb292 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -260,8 +260,8 @@
// while loop, done is set to true. use_far_branches is always false on ia32
// and x64.
bool done = false;
- // static to evade gcc's longjmp variable smashing checks.
- static bool use_far_branches = false;
+ // volatile because the variable may be clobbered by a longjmp.
+ volatile bool use_far_branches = false;
while (!done) {
const intptr_t prev_deopt_id = isolate->deopt_id();
isolate->set_deopt_id(0);
@@ -576,7 +576,6 @@
isolate->set_long_jump_base(old_base);
isolate->set_deopt_id(prev_deopt_id);
}
- use_far_branches = false;
return is_compiled;
}
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index cc20314..3299340 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -826,7 +826,7 @@
DART_EXPORT Dart_Handle Dart_DebugName() {
Isolate* isolate = Isolate::Current();
- CHECK_ISOLATE(isolate);
+ DARTSCOPE(isolate);
return Api::NewHandle(isolate, String::New(isolate->name()));
}
@@ -3623,6 +3623,30 @@
return Api::Success();
}
+DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args,
+ intptr_t* value) {
+ NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
+ Isolate* isolate = arguments->isolate();
+ DARTSCOPE(isolate);
+ const Object& obj = Object::Handle(isolate, arguments->NativeArgAt(0));
+ intptr_t cid = obj.GetClassId();
+ if (cid <= kNumPredefinedCids) {
+ if (cid == kNullCid) {
+ return Api::NewError("%s expects receiver argument to be non-null.",
+ CURRENT_FUNC);
+ }
+ return Api::NewError("%s expects receiver argument to be of"
+ " type Instance.", CURRENT_FUNC);
+ }
+ const Instance& instance = Instance::Cast(obj);
+ ASSERT(instance.IsValidNativeIndex(0));
+ if (value == NULL) {
+ RETURN_NULL_ERROR(value);
+ }
+ *value = instance.GetNativeField(isolate, 0);
+ return Api::Success();
+}
+
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args,
Dart_Handle retval) {
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index f84b492..8be7d0a 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -2727,54 +2727,6 @@
}
-TEST_CASE(ClassTypedefsEtc) {
- const char* kScriptChars =
- "class SomeClass {\n"
- "}\n"
- "typedef void SomeHandler(String a);\n";
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- EXPECT_VALID(lib);
- Dart_Handle normal_cls = Dart_GetClass(lib, NewString("SomeClass"));
- EXPECT_VALID(normal_cls);
- Dart_Handle typedef_cls = Dart_GetClass(lib, NewString("SomeHandler"));
- EXPECT_VALID(typedef_cls);
-
- EXPECT(Dart_IsClass(normal_cls));
- EXPECT(!Dart_ClassIsTypedef(normal_cls));
- EXPECT(!Dart_ClassIsFunctionType(normal_cls));
-
- EXPECT(Dart_IsClass(typedef_cls));
- EXPECT(Dart_ClassIsTypedef(typedef_cls));
- EXPECT(!Dart_ClassIsFunctionType(typedef_cls));
-
- // Exercise the typedef class api.
- Dart_Handle functype_cls = Dart_ClassGetTypedefReferent(typedef_cls);
- EXPECT_VALID(functype_cls);
-
- // Pass the wrong class kind to Dart_ClassGetTypedefReferent
- EXPECT_ERROR(Dart_ClassGetTypedefReferent(normal_cls),
- "class 'SomeClass' is not a typedef class.");
-
- EXPECT(Dart_IsClass(functype_cls));
- EXPECT(!Dart_ClassIsTypedef(functype_cls));
- EXPECT(Dart_ClassIsFunctionType(functype_cls));
-
- // Exercise the function type class.
- Dart_Handle sig_func = Dart_ClassGetFunctionTypeSignature(functype_cls);
- EXPECT_VALID(sig_func);
- EXPECT(Dart_IsFunction(sig_func));
- int64_t fixed_params = -1;
- int64_t opt_params = -1;
- EXPECT_VALID(
- Dart_FunctionParameterCounts(sig_func, &fixed_params, &opt_params));
- EXPECT_EQ(1, fixed_params);
- EXPECT_EQ(0, opt_params);
-
- // Pass the wrong class kind to Dart_ClassGetFunctionTypeSignature
- EXPECT_ERROR(Dart_ClassGetFunctionTypeSignature(normal_cls),
- "class 'SomeClass' is not a function-type class.");
-}
-
#define CHECK_CLASS(handle, name) \
{ \
Dart_Handle tmp = (handle); \
@@ -2788,73 +2740,6 @@
}
-TEST_CASE(ClassGetInterfaces) {
- const char* kScriptChars =
- "class MyClass0 {\n"
- "}\n"
- "\n"
- "class MyClass1 implements MyInterface1 {\n"
- "}\n"
- "\n"
- "class MyClass2 implements MyInterface0, MyInterface1 {\n"
- "}\n"
- "\n"
- "abstract class MyInterface0 {\n"
- "}\n"
- "\n"
- "abstract class MyInterface1 implements MyInterface0 {\n"
- "}\n";
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
-
- Dart_Handle cls0 = Dart_GetClass(lib, NewString("MyClass0"));
- Dart_Handle cls1 = Dart_GetClass(lib, NewString("MyClass1"));
- Dart_Handle cls2 = Dart_GetClass(lib, NewString("MyClass2"));
- Dart_Handle intf0 = Dart_GetClass(lib, NewString("MyInterface0"));
- Dart_Handle intf1 = Dart_GetClass(lib, NewString("MyInterface1"));
-
- intptr_t len = -1;
- EXPECT_VALID(Dart_ClassGetInterfaceCount(cls0, &len));
- EXPECT_EQ(0, len);
-
- EXPECT_ERROR(Dart_ClassGetInterfaceAt(cls0, 0),
- "Dart_ClassGetInterfaceAt: argument 'index' out of bounds");
-
- len = -1;
- EXPECT_VALID(Dart_ClassGetInterfaceCount(cls1, &len));
- EXPECT_EQ(1, len);
- CHECK_CLASS(Dart_ClassGetInterfaceAt(cls1, 0), "MyInterface1");
-
- EXPECT_ERROR(Dart_ClassGetInterfaceAt(cls1, -1),
- "Dart_ClassGetInterfaceAt: argument 'index' out of bounds");
- EXPECT_ERROR(Dart_ClassGetInterfaceAt(cls1, 1),
- "Dart_ClassGetInterfaceAt: argument 'index' out of bounds");
-
- len = -1;
- EXPECT_VALID(Dart_ClassGetInterfaceCount(cls2, &len));
- EXPECT_EQ(2, len);
-
- // TODO(turnidge): The test relies on the ordering here. Sort this.
- CHECK_CLASS(Dart_ClassGetInterfaceAt(cls2, 0), "MyInterface0");
- CHECK_CLASS(Dart_ClassGetInterfaceAt(cls2, 1), "MyInterface1");
-
- len = -1;
- EXPECT_VALID(Dart_ClassGetInterfaceCount(intf0, &len));
- EXPECT_EQ(0, len);
-
- len = -1;
- EXPECT_VALID(Dart_ClassGetInterfaceCount(intf1, &len));
- EXPECT_EQ(1, len);
- CHECK_CLASS(Dart_ClassGetInterfaceAt(intf1, 0), "MyInterface0");
-
- // Error cases.
- EXPECT_ERROR(Dart_ClassGetInterfaceCount(Dart_True(), &len),
- "Dart_ClassGetInterfaceCount expects argument 'object' to be of "
- "type Class/Type.");
- EXPECT_ERROR(Dart_ClassGetInterfaceCount(Dart_NewApiError("MyError"), &len),
- "MyError");
-}
-
-
TEST_CASE(TypeGetNonParamtericTypes) {
const char* kScriptChars =
"class MyClass0 {\n"
@@ -4429,186 +4314,6 @@
"did not find top-level function '_imported'");
}
-TEST_CASE(ClosureFunction) {
- const char* kScriptChars =
- "Function getClosure() {\n"
- " return (x, y, [z]) => x + y + z;\n"
- "}\n"
- "class Foo {\n"
- " getInstanceClosure() {\n"
- " return () { return this; };\n"
- " }\n"
- " getInstanceClosureWithArgs() {\n"
- " return (x, y, [z]) { return this; };\n"
- " }\n"
- " static getStaticClosure() {\n"
- " return () { return 42; };\n"
- " }\n"
- " static getStaticClosureWithArgs() {\n"
- " return (x, y, [z]) { return 42; };\n"
- " }\n"
- "}\n"
- "Function getInstanceClosure() {\n"
- " return new Foo().getInstanceClosure();\n"
- "}\n"
- "Function getInstanceClosureWithArgs() {\n"
- " return new Foo().getInstanceClosureWithArgs();\n"
- "}\n"
- "Function getStaticClosure() {\n"
- " return Foo.getStaticClosure();\n"
- "}\n"
- "Function getStaticClosureWithArgs() {\n"
- " return Foo.getStaticClosureWithArgs();\n"
- "}\n";
- Dart_Handle result;
- Dart_Handle owner;
- Dart_Handle defining_function;
- DARTSCOPE(Isolate::Current());
-
- // Create a test library and Load up a test script in it.
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- EXPECT_VALID(lib);
- Dart_Handle type = Dart_GetType(lib, NewString("Foo"), 0, NULL);
- EXPECT_VALID(type);
-
- // Invoke a function which returns a closure.
- Dart_Handle retobj = Dart_Invoke(lib, NewString("getClosure"), 0, NULL);
- EXPECT_VALID(retobj);
-
- EXPECT(Dart_IsClosure(retobj));
- EXPECT(!Dart_IsClosure(Dart_NewInteger(101)));
-
- // Retrieve the closure's function
- result = Dart_ClosureFunction(retobj);
- EXPECT_VALID(result);
- EXPECT(Dart_IsFunction(result));
- owner = Dart_FunctionOwner(result);
- EXPECT_VALID(owner);
- defining_function = Dart_LookupFunction(lib, NewString("getClosure"));
- EXPECT(Dart_IdentityEquals(owner, defining_function));
- int64_t fixed_param_count = -999;
- int64_t opt_param_count = -999;
- result = Dart_FunctionParameterCounts(result,
- &fixed_param_count,
- &opt_param_count);
- EXPECT_VALID(result);
- EXPECT_EQ(2, fixed_param_count);
- EXPECT_EQ(1, opt_param_count);
-
- // Try to retrieve function from a non-closure object
- result = Dart_ClosureFunction(Dart_NewInteger(1));
- EXPECT(Dart_IsError(result));
-
- // Invoke a function which returns an "instance" closure.
- retobj = Dart_Invoke(lib, NewString("getInstanceClosure"), 0, NULL);
- EXPECT_VALID(retobj);
- EXPECT(Dart_IsClosure(retobj));
-
- // Retrieve the closure's function
- result = Dart_ClosureFunction(retobj);
- EXPECT_VALID(result);
- EXPECT(Dart_IsFunction(result));
- owner = Dart_FunctionOwner(result);
- EXPECT_VALID(owner);
- Isolate* isolate = Isolate::Current();
- Dart_Handle cls = Api::NewHandle(
- isolate, Api::UnwrapTypeHandle(isolate, type).type_class());
- defining_function = Dart_LookupFunction(cls,
- NewString("getInstanceClosure"));
- EXPECT(Dart_IdentityEquals(owner, defining_function));
- // -999: We want to distinguish between a non-answer and a wrong answer, and
- // -1 has been a previous wrong answer
- fixed_param_count = -999;
- opt_param_count = -999;
- result = Dart_FunctionParameterCounts(result,
- &fixed_param_count,
- &opt_param_count);
- EXPECT_VALID(result);
- EXPECT_EQ(0, fixed_param_count);
- EXPECT_EQ(0, opt_param_count);
-
- // Invoke a function which returns an "instance" closure with arguments.
- retobj = Dart_Invoke(lib,
- NewString("getInstanceClosureWithArgs"),
- 0,
- NULL);
- EXPECT_VALID(retobj);
- EXPECT(Dart_IsClosure(retobj));
-
- // Retrieve the closure's function
- result = Dart_ClosureFunction(retobj);
- EXPECT_VALID(result);
- EXPECT(Dart_IsFunction(result));
- owner = Dart_FunctionOwner(result);
- EXPECT_VALID(owner);
- defining_function =
- Dart_LookupFunction(cls, NewString("getInstanceClosureWithArgs"));
- EXPECT(Dart_IdentityEquals(owner, defining_function));
- // -999: We want to distinguish between a non-answer and a wrong answer, and
- // -1 has been a previous wrong answer
- fixed_param_count = -999;
- opt_param_count = -999;
- result = Dart_FunctionParameterCounts(result,
- &fixed_param_count,
- &opt_param_count);
- EXPECT_VALID(result);
- EXPECT_EQ(2, fixed_param_count);
- EXPECT_EQ(1, opt_param_count);
-
- // Invoke a function which returns a "static" closure.
- retobj = Dart_Invoke(lib, NewString("getStaticClosure"), 0, NULL);
- EXPECT_VALID(retobj);
- EXPECT(Dart_IsClosure(retobj));
-
- // Retrieve the closure's function
- result = Dart_ClosureFunction(retobj);
- EXPECT_VALID(result);
- EXPECT(Dart_IsFunction(result));
- owner = Dart_FunctionOwner(result);
- EXPECT_VALID(owner);
- defining_function = Dart_LookupFunction(cls,
- NewString("getStaticClosure"));
- EXPECT(Dart_IdentityEquals(owner, defining_function));
- // -999: We want to distinguish between a non-answer and a wrong answer, and
- // -1 has been a previous wrong answer
- fixed_param_count = -999;
- opt_param_count = -999;
- result = Dart_FunctionParameterCounts(result,
- &fixed_param_count,
- &opt_param_count);
- EXPECT_VALID(result);
- EXPECT_EQ(0, fixed_param_count);
- EXPECT_EQ(0, opt_param_count);
-
-
- // Invoke a function which returns a "static" closure with arguments.
- retobj = Dart_Invoke(lib,
- NewString("getStaticClosureWithArgs"),
- 0,
- NULL);
- EXPECT_VALID(retobj);
- EXPECT(Dart_IsClosure(retobj));
-
- // Retrieve the closure's function
- result = Dart_ClosureFunction(retobj);
- EXPECT_VALID(result);
- EXPECT(Dart_IsFunction(result));
- owner = Dart_FunctionOwner(result);
- EXPECT_VALID(owner);
- defining_function =
- Dart_LookupFunction(cls, NewString("getStaticClosureWithArgs"));
- EXPECT(Dart_IdentityEquals(owner, defining_function));
- // -999: We want to distinguish between a non-answer and a wrong answer, and
- // -1 has been a previous wrong answer
- fixed_param_count = -999;
- opt_param_count = -999;
- result = Dart_FunctionParameterCounts(result,
- &fixed_param_count,
- &opt_param_count);
- EXPECT_VALID(result);
- EXPECT_EQ(2, fixed_param_count);
- EXPECT_EQ(1, opt_param_count);
-}
TEST_CASE(InvokeClosure) {
const char* kScriptChars =
@@ -4805,684 +4510,6 @@
}
-static void BuildFunctionDescription(TextBuffer* buffer, Dart_Handle func) {
- buffer->Clear();
- if (Dart_IsNull(func)) {
- WARN("Function not found");
- return;
- }
- Dart_Handle name = Dart_FunctionName(func);
- EXPECT_VALID(name);
- const char* name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(name, &name_cstr));
- bool is_abstract = false;
- bool is_static = false;
- bool is_getter = false;
- bool is_setter = false;
- bool is_constructor = false;
- int64_t fixed_param_count = -1;
- int64_t opt_param_count = -1;
- EXPECT_VALID(Dart_FunctionIsAbstract(func, &is_abstract));
- EXPECT_VALID(Dart_FunctionIsStatic(func, &is_static));
- EXPECT_VALID(Dart_FunctionIsGetter(func, &is_getter));
- EXPECT_VALID(Dart_FunctionIsSetter(func, &is_setter));
- EXPECT_VALID(Dart_FunctionIsConstructor(func, &is_constructor));
- EXPECT_VALID(Dart_FunctionParameterCounts(func,
- &fixed_param_count, &opt_param_count));
-
- buffer->Printf("%s %"Pd64" %"Pd64"",
- name_cstr,
- fixed_param_count,
- opt_param_count);
- if (is_abstract) {
- buffer->Printf(" abstract");
- }
- if (is_static) {
- buffer->Printf(" static");
- }
- if (is_getter) {
- buffer->Printf(" getter");
- }
- if (is_setter) {
- buffer->Printf(" setter");
- }
- if (is_constructor) {
- buffer->Printf(" constructor");
- }
-}
-
-
-TEST_CASE(FunctionReflection) {
- const char* kScriptChars =
- "a() => 'a';\n"
- "_b() => '_b';\n"
- "get c => 'bar';\n"
- "set d(x) {}\n"
- "get _e => 'bar';\n"
- "set _f(x) {}\n"
- "class MyClass {\n"
- " MyClass() {}\n"
- " MyClass.named() {}\n"
- " a() => 'a';\n"
- " _b() => '_b';\n"
- " get c => 'bar';\n"
- " set d(x) {}\n"
- " get _e => 'bar';\n"
- " set _f(x) {}\n"
- " static g() => 'g';\n"
- " static _h() => '_h';\n"
- " static get i => 'i';\n"
- " static set j(x) {}\n"
- " static get _k => 'k';\n"
- " static set _l(x) {}\n"
- " m();\n"
- " _n();\n"
- " get o;\n"
- " set p(x);\n"
- " get _q;\n"
- " set _r(x);\n"
- " s(x, [y, z]) {}\n"
- " t([x, y, z]) {}\n"
- " operator ==(x) {}\n"
- "}\n"
- "class _PrivateClass {\n"
- " _PrivateClass() {}\n"
- " _PrivateClass.named() {}\n"
- "}\n";
-
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- EXPECT_VALID(lib);
- Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
- EXPECT_VALID(cls);
- Dart_Handle private_cls = Dart_GetClass(lib, NewString("_PrivateClass"));
- EXPECT_VALID(private_cls);
- TextBuffer buffer(128);
-
- // Lookup a top-level function.
- Dart_Handle func = Dart_LookupFunction(lib, NewString("a"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("a 0 0 static", buffer.buf());
- EXPECT(Dart_IsLibrary(Dart_FunctionOwner(func)));
- Dart_Handle owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, lib));
-
- // Lookup a private top-level function.
- func = Dart_LookupFunction(lib, NewString("_b"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_b 0 0 static", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, lib));
-
- // Lookup a top-level getter.
- func = Dart_LookupFunction(lib, NewString("c"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("c 0 0 static getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, lib));
-
- // Lookup a top-level setter.
- func = Dart_LookupFunction(lib, NewString("d="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("d= 1 0 static setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, lib));
-
- // Lookup a private top-level getter.
- func = Dart_LookupFunction(lib, NewString("_e"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_e 0 0 static getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, lib));
-
- // Lookup a private top-level setter.
- func = Dart_LookupFunction(lib, NewString("_f="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_f= 1 0 static setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, lib));
-
- // Lookup an unnamed constructor
- func = Dart_LookupFunction(cls, NewString("MyClass"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("MyClass 0 0 constructor", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a named constructor
- func = Dart_LookupFunction(cls, NewString("MyClass.named"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("MyClass.named 0 0 constructor", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup an private unnamed constructor
- func = Dart_LookupFunction(private_cls, NewString("_PrivateClass"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_PrivateClass 0 0 constructor", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, private_cls));
-
- // Lookup a private named constructor
- func = Dart_LookupFunction(private_cls,
- NewString("_PrivateClass.named"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_PrivateClass.named 0 0 constructor", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, private_cls));
-
- // Lookup a method.
- func = Dart_LookupFunction(cls, NewString("a"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("a 0 0", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private method.
- func = Dart_LookupFunction(cls, NewString("_b"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_b 0 0", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a instance getter.
- func = Dart_LookupFunction(cls, NewString("c"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("c 0 0 getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a instance setter.
- func = Dart_LookupFunction(cls, NewString("d="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("d= 1 0 setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private instance getter.
- func = Dart_LookupFunction(cls, NewString("_e"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_e 0 0 getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private instance setter.
- func = Dart_LookupFunction(cls, NewString("_f="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_f= 1 0 setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a static method.
- func = Dart_LookupFunction(cls, NewString("g"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("g 0 0 static", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private static method.
- func = Dart_LookupFunction(cls, NewString("_h"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_h 0 0 static", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a static getter.
- func = Dart_LookupFunction(cls, NewString("i"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("i 0 0 static getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a static setter.
- func = Dart_LookupFunction(cls, NewString("j="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("j= 1 0 static setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private static getter.
- func = Dart_LookupFunction(cls, NewString("_k"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_k 0 0 static getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private static setter.
- func = Dart_LookupFunction(cls, NewString("_l="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_l= 1 0 static setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup an abstract method.
- func = Dart_LookupFunction(cls, NewString("m"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("m 0 0 abstract", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private abstract method.
- func = Dart_LookupFunction(cls, NewString("_n"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_n 0 0 abstract", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a abstract getter.
- func = Dart_LookupFunction(cls, NewString("o"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("o 0 0 abstract getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a abstract setter.
- func = Dart_LookupFunction(cls, NewString("p="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("p= 1 0 abstract setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private abstract getter.
- func = Dart_LookupFunction(cls, NewString("_q"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_q 0 0 abstract getter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a private abstract setter.
- func = Dart_LookupFunction(cls, NewString("_r="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("_r= 1 0 abstract setter", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a method with fixed and optional parameters.
- func = Dart_LookupFunction(cls, NewString("s"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("s 1 2", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a method with only optional parameters.
- func = Dart_LookupFunction(cls, NewString("t"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("t 0 3", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup an operator
- func = Dart_LookupFunction(cls, NewString("=="));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
- BuildFunctionDescription(&buffer, func);
- EXPECT_STREQ("== 1 0", buffer.buf());
- owner = Dart_FunctionOwner(func);
- EXPECT_VALID(owner);
- EXPECT(Dart_IdentityEquals(owner, cls));
-
- // Lookup a function that does not exist from a library.
- func = Dart_LookupFunction(lib, NewString("DoesNotExist"));
- EXPECT(Dart_IsNull(func));
-
- // Lookup a function that does not exist from a class.
- func = Dart_LookupFunction(cls, NewString("DoesNotExist"));
- EXPECT(Dart_IsNull(func));
-
- // Lookup a class using an error class name. The error propagates.
- func = Dart_LookupFunction(cls, Api::NewError("myerror"));
- EXPECT_ERROR(func, "myerror");
-
- // Lookup a class from an error library. The error propagates.
- func = Dart_LookupFunction(Api::NewError("myerror"), NewString("foo"));
- EXPECT_ERROR(func, "myerror");
-}
-
-
-TEST_CASE(TypeReflection) {
- const char* kScriptChars =
- "void func(String a, int b) {}\n"
- "int variable;\n";
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- EXPECT_VALID(lib);
-
- Dart_Handle func = Dart_LookupFunction(lib, NewString("func"));
- EXPECT_VALID(func);
- EXPECT(Dart_IsFunction(func));
-
- // Make sure parameter counts are right.
- int64_t fixed_params = -1;
- int64_t opt_params = -1;
- EXPECT_VALID(Dart_FunctionParameterCounts(func, &fixed_params, &opt_params));
- EXPECT_EQ(2, fixed_params);
- EXPECT_EQ(0, opt_params);
-
- // Check the return type.
- Dart_Handle type = Dart_FunctionReturnType(func);
- EXPECT_VALID(type);
- Dart_Handle cls_name = Dart_ClassName(type);
- EXPECT_VALID(cls_name);
- const char* cls_name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr));
- EXPECT_STREQ("void", cls_name_cstr);
-
- // Check a parameter type.
- type = Dart_FunctionParameterType(func, 0);
- EXPECT_VALID(type);
- cls_name = Dart_ClassName(type);
- EXPECT_VALID(cls_name);
- cls_name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr));
- EXPECT_STREQ("String", cls_name_cstr);
-
- Dart_Handle var = Dart_LookupVariable(lib, NewString("variable"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
-
- // Check the variable type.
- type = Dart_VariableType(var);
- EXPECT_VALID(type);
- cls_name = Dart_ClassName(type);
- EXPECT_VALID(cls_name);
- cls_name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr));
- if (FLAG_enable_type_checks) {
- EXPECT_STREQ("int", cls_name_cstr);
- } else {
- EXPECT_STREQ("dynamic", cls_name_cstr);
- }
-}
-
-
-static void BuildVariableDescription(TextBuffer* buffer, Dart_Handle var) {
- buffer->Clear();
- Dart_Handle name = Dart_VariableName(var);
- EXPECT_VALID(name);
- const char* name_cstr = "";
- EXPECT_VALID(Dart_StringToCString(name, &name_cstr));
- bool is_static = false;
- bool is_final = false;
- EXPECT_VALID(Dart_VariableIsStatic(var, &is_static));
- EXPECT_VALID(Dart_VariableIsFinal(var, &is_final));
- buffer->Printf("%s", name_cstr);
- if (is_static) {
- buffer->Printf(" static");
- }
- if (is_final) {
- buffer->Printf(" final");
- }
-}
-
-
-TEST_CASE(VariableReflection) {
- const char* kScriptChars =
- "var a = 'a';\n"
- "var _b = '_b';\n"
- "final c = 'c';\n"
- "final _d = '_d';\n"
- "class MyClass {\n"
- " var a = 'a';\n"
- " var _b = '_b';\n"
- " final c = 'c';\n"
- " final _d = '_d';\n"
- " static var e = 'e';\n"
- " static var _f = '_f';\n"
- " static const g = 'g';\n"
- " static const _h = '_h';\n"
- "}\n";
-
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- EXPECT_VALID(lib);
- Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
- EXPECT_VALID(cls);
- TextBuffer buffer(128);
-
- // Lookup a top-level variable.
- Dart_Handle var = Dart_LookupVariable(lib, NewString("a"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("a static", buffer.buf());
-
- // Lookup a private top-level variable.
- var = Dart_LookupVariable(lib, NewString("_b"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("_b static", buffer.buf());
-
- // Lookup a const top-level variable.
- var = Dart_LookupVariable(lib, NewString("c"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("c static final", buffer.buf());
-
- // Lookup a private const top-level variable.
- var = Dart_LookupVariable(lib, NewString("_d"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("_d static final", buffer.buf());
-
- // Lookup a instance variable.
- var = Dart_LookupVariable(cls, NewString("a"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("a", buffer.buf());
-
- // Lookup a private instance variable.
- var = Dart_LookupVariable(cls, NewString("_b"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("_b", buffer.buf());
-
- // Lookup a final instance variable.
- var = Dart_LookupVariable(cls, NewString("c"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("c final", buffer.buf());
-
- // Lookup a private final instance variable.
- var = Dart_LookupVariable(cls, NewString("_d"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("_d final", buffer.buf());
-
- // Lookup a static variable.
- var = Dart_LookupVariable(cls, NewString("e"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("e static", buffer.buf());
-
- // Lookup a private static variable.
- var = Dart_LookupVariable(cls, NewString("_f"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("_f static", buffer.buf());
-
- // Lookup a const static variable.
- var = Dart_LookupVariable(cls, NewString("g"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("g static final", buffer.buf());
-
- // Lookup a private const static variable.
- var = Dart_LookupVariable(cls, NewString("_h"));
- EXPECT_VALID(var);
- EXPECT(Dart_IsVariable(var));
- BuildVariableDescription(&buffer, var);
- EXPECT_STREQ("_h static final", buffer.buf());
-
- // Lookup a variable that does not exist from a library.
- var = Dart_LookupVariable(lib, NewString("DoesNotExist"));
- EXPECT(Dart_IsNull(var));
-
- // Lookup a variable that does not exist from a class.
- var = Dart_LookupVariable(cls, NewString("DoesNotExist"));
- EXPECT(Dart_IsNull(var));
-
- // Lookup a class from an error library. The error propagates.
- var = Dart_LookupVariable(Api::NewError("myerror"), NewString("foo"));
- EXPECT_ERROR(var, "myerror");
-
- // Lookup a class using an error class name. The error propagates.
- var = Dart_LookupVariable(lib, Api::NewError("myerror"));
- EXPECT_ERROR(var, "myerror");
-}
-
-
-TEST_CASE(TypeVariableReflection) {
- const char* kScriptChars =
- "abstract class UpperBound {}\n"
- "class GenericClass<U, T extends UpperBound> {\n"
- " T func1() { return null; }\n"
- " U func2() { return null; }\n"
- "}\n";
-
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- Dart_Handle cls = Dart_GetClass(lib, NewString("GenericClass"));
- EXPECT_VALID(cls);
-
- // Test Dart_GetTypeVariableNames.
- Dart_Handle names = Dart_GetTypeVariableNames(cls);
- EXPECT_VALID(names);
- Dart_Handle names_str = Dart_ToString(names);
- EXPECT_VALID(names_str);
- const char* cstr = "";
- EXPECT_VALID(Dart_StringToCString(names_str, &cstr));
- EXPECT_STREQ("[U, T]", cstr);
-
- // Test variable U.
- Dart_Handle type_var = Dart_LookupTypeVariable(cls, NewString("U"));
- EXPECT_VALID(type_var);
- EXPECT(Dart_IsTypeVariable(type_var));
- Dart_Handle type_var_name = Dart_TypeVariableName(type_var);
- EXPECT_VALID(type_var_name);
- EXPECT_VALID(Dart_StringToCString(type_var_name, &cstr));
- EXPECT_STREQ("U", cstr);
- Dart_Handle type_var_owner = Dart_TypeVariableOwner(type_var);
- EXPECT_VALID(type_var_owner);
- EXPECT(Dart_IdentityEquals(cls, type_var_owner));
- Dart_Handle type_var_bound = Dart_TypeVariableUpperBound(type_var);
- Dart_Handle bound_name = Dart_ClassName(type_var_bound);
- EXPECT_VALID(Dart_StringToCString(bound_name, &cstr));
- EXPECT_STREQ("Object", cstr);
-
- // Test variable T.
- type_var = Dart_LookupTypeVariable(cls, NewString("T"));
- EXPECT_VALID(type_var);
- EXPECT(Dart_IsTypeVariable(type_var));
- type_var_name = Dart_TypeVariableName(type_var);
- EXPECT_VALID(type_var_name);
- EXPECT_VALID(Dart_StringToCString(type_var_name, &cstr));
- EXPECT_STREQ("T", cstr);
- type_var_owner = Dart_TypeVariableOwner(type_var);
- EXPECT_VALID(type_var_owner);
- EXPECT(Dart_IdentityEquals(cls, type_var_owner));
- type_var_bound = Dart_TypeVariableUpperBound(type_var);
- bound_name = Dart_ClassName(type_var_bound);
- EXPECT_VALID(Dart_StringToCString(bound_name, &cstr));
- EXPECT_STREQ("UpperBound", cstr);
-}
-
-
TEST_CASE(InstanceOf) {
const char* kScriptChars =
"class OtherClass {\n"
@@ -5920,71 +4947,6 @@
}
-TEST_CASE(GetVariableNames) {
- const char* kLibraryChars =
- "library library_name;\n"
- "\n"
- "var A;\n"
- "get B => 12;\n"
- "set C(x) { }\n"
- "D(x) => (x + 1);\n"
- "var _A;\n"
- "get _B => 12;\n"
- "set _C(x) { }\n"
- "_D(x) => (x + 1);\n"
- "\n"
- "class MyClass {\n"
- " var A2;\n"
- " var _A2;\n"
- "}\n"
- "\n"
- "_compare(String a, String b) => a.compareTo(b);\n"
- "sort(list) => list.sort(_compare);\n";
-
- // Get the variables from a library.
- Dart_Handle url = NewString("library_url");
- Dart_Handle source = NewString(kLibraryChars);
- Dart_Handle lib = Dart_LoadLibrary(url, source);
- EXPECT_VALID(lib);
-
- Dart_Handle list = Dart_GetVariableNames(lib);
- EXPECT_VALID(list);
- EXPECT(Dart_IsList(list));
-
- // Sort the list.
- const int kNumArgs = 1;
- Dart_Handle args[1];
- args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
-
- // Check list contents.
- Dart_Handle list_string = Dart_ToString(list);
- EXPECT_VALID(list_string);
- const char* list_cstr = "";
- EXPECT_VALID(Dart_StringToCString(list_string, &list_cstr));
- EXPECT_STREQ("[A, _A]", list_cstr);
-
- // Get the variables from a class.
- Dart_Handle cls = Dart_GetClass(lib, NewString("MyClass"));
- EXPECT_VALID(cls);
-
- list = Dart_GetVariableNames(cls);
- EXPECT_VALID(list);
- EXPECT(Dart_IsList(list));
-
- // Sort the list.
- args[0] = list;
- EXPECT_VALID(Dart_Invoke(lib, NewString("sort"), kNumArgs, args));
-
- // Check list contents.
- list_string = Dart_ToString(list);
- EXPECT_VALID(list_string);
- list_cstr = "";
- EXPECT_VALID(Dart_StringToCString(list_string, &list_cstr));
- EXPECT_STREQ("[A2, _A2]", list_cstr);
-}
-
-
TEST_CASE(LibraryImportLibrary) {
const char* kLibrary1Chars =
"library library1_name;";
@@ -8154,6 +7116,47 @@
}
+// Do not use guarding mechanism on externalizable classes, since their class
+// can change on the fly,
+TEST_CASE(GuardExternalizedString) {
+ const char* kScriptChars =
+ "main() {\n"
+ " var a = new A('hello');\n"
+ " var res = runOne(a);\n"
+ " if (res != 10640000) return -1;\n"
+ " change_str(a.f);\n"
+ " res = runOne(a);\n"
+ " return res;\n"
+ "}\n"
+ "runOne(a) {\n"
+ " var sum = 0;\n"
+ " for (int i = 0; i < 20000; i++) {\n"
+ " for (int j = 0; j < a.f.length; j++) {\n"
+ " sum += a.f.codeUnitAt(j);\n"
+ " }\n"
+ " }\n"
+ " return sum;\n"
+ "}\n"
+ "class A {\n"
+ " var f;\n"
+ " A(this.f);\n"
+ "}\n"
+ "change_str(String s) native 'A_change_str';\n"
+ "";
+ Dart_Handle lib =
+ TestCase::LoadTestScript(kScriptChars,
+ &ExternalStringDeoptimize_native_lookup);
+ Dart_Handle result = Dart_Invoke(lib,
+ NewString("main"),
+ 0,
+ NULL);
+ int64_t value = 0;
+ result = Dart_IntegerToInt64(result, &value);
+ EXPECT_VALID(result);
+ EXPECT_EQ(10640000, value);
+}
+
+
TEST_CASE(ExternalStringDeoptimize) {
const char* kScriptChars =
"String str = 'A';\n"
@@ -8246,57 +7249,4 @@
EXPECT_EQ(8, value);
}
-
-TEST_CASE(AmbiguousReference) {
- const char* kImportedScript1Chars =
- "library library1.dart;\n"
- "var foo;\n"
- "var foo1;\n"
- "bar() => 'library1.dart bar()';\n"
- "bar1() => 'library1.dart bar1()';\n"
- "baz() => 'library1.dart baz()';\n"
- "var bay;\n"
- "typedef int bax(int a, int b);\n"
- "class baw {}\n";
- const char* kImportedScript2Chars =
- "library library2.dart;\n"
- "var foo;\n"
- "var foo2;\n"
- "bar() => 'library2.dart bar()';\n"
- "bar2() => 'library2.dart bar2()';\n"
- "var baz;\n"
- "bay() => 'library2.dart bay()';\n"
- "typedef double bax(int a, int b);\n"
- "var baw;\n";
- const char* kScriptChars =
- "import 'library1.dart';\n"
- "import 'library2.dart';\n";
-
- // Load imported libs.
- Dart_Handle url1 = NewString("library1.dart");
- Dart_Handle source1 = NewString(kImportedScript1Chars);
- Dart_Handle imported_lib1 = Dart_LoadLibrary(url1, source1);
- EXPECT_VALID(imported_lib1);
- Dart_Handle url2 = NewString("library2.dart");
- Dart_Handle source2 = NewString(kImportedScript2Chars);
- Dart_Handle imported_lib2 = Dart_LoadLibrary(url2, source2);
- EXPECT_VALID(imported_lib2);
- // Load main script.
- Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
- EXPECT_VALID(lib);
- // Expect an error for ambiguous references.
- EXPECT(Dart_IsError(Dart_LookupVariable(lib, NewString("foo"))));
- EXPECT(Dart_IsError(Dart_LookupFunction(lib, NewString("bar"))));
- EXPECT(Dart_IsError(Dart_LookupFunction(lib, NewString("baz"))));
- EXPECT(Dart_IsError(Dart_LookupVariable(lib, NewString("bay"))));
- EXPECT(Dart_IsError(Dart_GetClass(lib, NewString("bax"))));
- EXPECT(Dart_IsError(Dart_GetClass(lib, NewString("baw"))));
- // Variables foo1 and foo2 are unambiguous.
- EXPECT(!Dart_IsError(Dart_LookupVariable(lib, NewString("foo1"))));
- EXPECT(!Dart_IsError(Dart_LookupVariable(lib, NewString("foo2"))));
- // Functions bar1 and bar2 are unambiguous.
- EXPECT(!Dart_IsError(Dart_LookupFunction(lib, NewString("bar1"))));
- EXPECT(!Dart_IsError(Dart_LookupFunction(lib, NewString("bar2"))));
-}
-
} // namespace dart
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index b956c8d..b6ba0726 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -57,8 +57,6 @@
const Code& code = Code::Handle(function.CurrentCode());
ASSERT(!code.IsNull());
ASSERT(Isolate::Current()->no_callback_scope_depth() == 0);
- IsolateRunStateManager run_state_manager;
- run_state_manager.SetRunState(Isolate::kIsolateRunning);
#if defined(USING_SIMULATOR)
return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call(
reinterpret_cast<int32_t>(entrypoint),
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index c67d3e8..bdecf76 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -1064,11 +1064,13 @@
ASSERT(stack_trace_ == NULL);
stack_trace_ = stack_trace;
ASSERT(obj_cache_ == NULL);
+ in_event_notification_ = true;
obj_cache_ = new RemoteObjectCache(64);
DebuggerEvent event;
event.type = kExceptionThrown;
event.exception = &exc;
(*event_handler_)(&event);
+ in_event_notification_ = false;
stack_trace_ = NULL;
obj_cache_ = NULL; // Remote object cache is zone allocated.
}
diff --git a/runtime/vm/debugger_api_impl_test.cc b/runtime/vm/debugger_api_impl_test.cc
index 7890195..070cf3f 100644
--- a/runtime/vm/debugger_api_impl_test.cc
+++ b/runtime/vm/debugger_api_impl_test.cc
@@ -1463,6 +1463,7 @@
"class Test5<A, B, C> extends Test4<A, B> {\n"
"}\n"
"var s = new Set();\n"
+ "var l = new List();\n"
"int main() {\n"
"}\n";
@@ -1482,6 +1483,7 @@
Dart_Handle int_name = Dart_NewStringFromCString("int");
Dart_Handle set_name = Dart_NewStringFromCString("Set");
Dart_Handle iterable_name = Dart_NewStringFromCString("IterableBase");
+ Dart_Handle list_name = Dart_NewStringFromCString("List");
Dart_Handle object_type = Dart_GetType(core_lib, object_name, 0, NULL);
Dart_Handle int_type = Dart_GetType(core_lib, int_name, 0, NULL);
@@ -1546,6 +1548,49 @@
const Type& actual_type = Api::UnwrapTypeHandle(isolate, super_type);
EXPECT(expected_type.raw() == actual_type.raw());
}
+ {
+ Dart_Handle list_type = Dart_GetType(core_lib, list_name, 0, NULL);
+ Dart_Handle super_type = Dart_GetSupertype(list_type);
+ EXPECT(!Dart_IsError(super_type));
+ super_type = Dart_GetSupertype(super_type);
+ EXPECT(!Dart_IsError(super_type));
+ EXPECT(super_type == Dart_Null());
+ }
+}
+
+
+TEST_CASE(Debug_ListSuperType) {
+ const char* kScriptChars =
+ "List testMain() {"
+ " List a = new List();"
+ " a.add(10);"
+ " a.add(20);"
+ " a.add(30);"
+ " return a;"
+ "}"
+ ""
+ "List immutable() {"
+ " return const [0, 1, 2];"
+ "}";
+ Dart_Handle result;
+
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+
+ // Invoke a function which returns an object of type List.
+ result = Dart_Invoke(lib, NewString("testMain"), 0, NULL);
+ EXPECT_VALID(result);
+
+ // First ensure that the returned object is a list.
+ Dart_Handle list_access_test_obj = result;
+ EXPECT(Dart_IsList(list_access_test_obj));
+
+ Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj);
+ Dart_Handle super_type = Dart_GetSupertype(list_type);
+ EXPECT(!Dart_IsError(super_type));
+ super_type = Dart_GetSupertype(super_type);
+ EXPECT(!Dart_IsError(super_type));
+ EXPECT(super_type == Dart_Null());
}
} // namespace dart
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 2712f6f..109bb84 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -496,40 +496,31 @@
}
-// Allocate, initialize, and throw a TypeError.
+// Allocate, initialize, and throw a TypeError or CastError.
void Exceptions::CreateAndThrowTypeError(intptr_t location,
const String& src_type_name,
const String& dst_type_name,
const String& dst_name,
const String& malformed_error) {
- const Array& args = Array::Handle(Array::New(8));
+ const Array& args = Array::Handle(Array::New(7));
ExceptionType exception_type =
dst_name.Equals(kCastErrorDstName) ? kCast : kType;
- // Initialize argument 'failedAssertion'.
- // Printing the src_obj value would be possible, but ToString() is expensive
- // and not meaningful for all classes, so we just print '$expr instanceof...'.
- // Users should look at TypeError.ToString(), which contains more useful
- // information than AssertionError.failedAssertion.
- String& failed_assertion = String::Handle(String::New("$expr instanceof "));
- failed_assertion = String::Concat(failed_assertion, dst_type_name);
- args.SetAt(0, failed_assertion);
-
- // Initialize 'url', 'line', and 'column' arguments.
DartFrameIterator iterator;
const Script& script = Script::Handle(GetCallerScript(&iterator));
intptr_t line, column;
script.GetTokenLocation(location, &line, &column);
- args.SetAt(1, String::Handle(script.url()));
- args.SetAt(2, Smi::Handle(Smi::New(line)));
- args.SetAt(3, Smi::Handle(Smi::New(column)));
+ // Initialize '_url', '_line', and '_column' arguments.
+ args.SetAt(0, String::Handle(script.url()));
+ args.SetAt(1, Smi::Handle(Smi::New(line)));
+ args.SetAt(2, Smi::Handle(Smi::New(column)));
- // Initialize argument 'srcType'.
- args.SetAt(4, src_type_name);
- args.SetAt(5, dst_type_name);
- args.SetAt(6, dst_name);
- args.SetAt(7, malformed_error);
+ // Initialize '_srcType', '_dstType', '_dstName', and '_malformedError'.
+ args.SetAt(3, src_type_name);
+ args.SetAt(4, dst_type_name);
+ args.SetAt(5, dst_name);
+ args.SetAt(6, malformed_error);
// Type errors in the core library may be difficult to diagnose.
// Print type error information before throwing the error when debugging.
@@ -550,7 +541,7 @@
OS::Print("malformed type used.\n");
}
}
- // Throw TypeError instance.
+ // Throw TypeError or CastError instance.
Exceptions::ThrowByType(exception_type, args);
UNREACHABLE();
}
@@ -645,7 +636,7 @@
case kNoSuchMethod:
library = Library::CoreLibrary();
class_name = &Symbols::NoSuchMethodError();
- constructor_name = &String::Handle(Symbols::New("._withType"));
+ constructor_name = &Symbols::DotWithType();
break;
case kFormat:
library = Library::CoreLibrary();
@@ -678,22 +669,27 @@
case kAssertion:
library = Library::CoreLibrary();
class_name = &Symbols::AssertionError();
+ constructor_name = &Symbols::DotCreate();
break;
case kCast:
library = Library::CoreLibrary();
class_name = &Symbols::CastError();
+ constructor_name = &Symbols::DotCreate();
break;
case kType:
library = Library::CoreLibrary();
class_name = &Symbols::TypeError();
+ constructor_name = &Symbols::DotCreate();
break;
case kFallThrough:
library = Library::CoreLibrary();
class_name = &Symbols::FallThroughError();
+ constructor_name = &Symbols::DotCreate();
break;
case kAbstractClassInstantiation:
library = Library::CoreLibrary();
class_name = &Symbols::AbstractClassInstantiationError();
+ constructor_name = &Symbols::DotCreate();
break;
case kMirroredUncaughtExceptionError:
library = Library::MirrorsLibrary();
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
index c63b362..5548c43 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -60,12 +60,6 @@
}
-static intptr_t NextInstructionPos(intptr_t pos) {
- ASSERT(IsInstructionStartPosition(pos));
- return pos + 2;
-}
-
-
FlowGraphAllocator::FlowGraphAllocator(const FlowGraph& flow_graph)
: flow_graph_(flow_graph),
reaching_defs_(flow_graph),
@@ -264,13 +258,17 @@
// If the first use interval and the use interval we are adding
// touch then we can just extend the first interval to cover their
// union.
- if (start >= first_use_interval()->start()) {
+ if (start > first_use_interval()->start()) {
// The only case when we can add intervals with start greater than
// start of an already created interval is BlockLocation.
- ASSERT((start == first_use_interval()->start()) ||
- (vreg() == kNoVirtualRegister));
+ ASSERT(vreg() == kNoVirtualRegister);
ASSERT(end <= first_use_interval()->end());
return;
+ } else if (start == first_use_interval()->start()) {
+ // Grow first interval if necessary.
+ if (end <= first_use_interval()->end()) return;
+ first_use_interval_->end_ = end;
+ return;
} else if (end == first_use_interval()->start()) {
first_use_interval()->start_ = start;
return;
@@ -518,16 +516,16 @@
range->DefineAt(catch_entry->start_pos()); // Defined at block entry.
ProcessInitialDefinition(defn, range, catch_entry);
}
- // Block the two registers used by CatchEntryInstr from the block start to
- // until the end of the instruction so that they are preserved.
- ASSERT(catch_entry->next()->IsCatchEntry());
+ // Block the two fixed registers used by CatchBlockEntryInstr from the
+ // block start to until the end of the instruction so that they are
+ // preserved.
intptr_t start = catch_entry->start_pos();
BlockLocation(Location::RegisterLocation(kExceptionObjectReg),
start,
- ToInstructionEnd(NextInstructionPos(start)));
+ ToInstructionEnd(start));
BlockLocation(Location::RegisterLocation(kStackTraceObjectReg),
start,
- ToInstructionEnd(NextInstructionPos(start)));
+ ToInstructionEnd(start));
}
}
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 900e7ff..f9c395c 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -57,7 +57,6 @@
exit_collector_(exit_collector),
last_used_block_id_(0), // 0 is used for the graph entry.
context_level_(0),
- last_used_try_index_(CatchClauseNode::kInvalidTryIndex),
try_index_(CatchClauseNode::kInvalidTryIndex),
loop_depth_(0),
graph_entry_(NULL),
@@ -3299,11 +3298,7 @@
void EffectGraphVisitor::VisitCatchClauseNode(CatchClauseNode* node) {
InlineBailout("EffectGraphVisitor::VisitCatchClauseNode (exception)");
- // NOTE: The implicit variables ':saved_context', ':exception_var'
- // and ':stacktrace_var' can never be captured variables.
// Restores CTX from local variable ':saved_context'.
- AddInstruction(
- new CatchEntryInstr(node->exception_var(), node->stacktrace_var()));
BuildRestoreContext(node->context_var());
EffectGraphVisitor for_catch(owner(), temp_index());
@@ -3315,7 +3310,8 @@
void EffectGraphVisitor::VisitTryCatchNode(TryCatchNode* node) {
InlineBailout("EffectGraphVisitor::VisitTryCatchNode (exception)");
intptr_t original_handler_index = owner()->try_index();
- intptr_t try_handler_index = owner()->AllocateTryIndex();
+ intptr_t try_handler_index = node->try_index();
+ ASSERT(try_handler_index != original_handler_index);
owner()->set_try_index(try_handler_index);
// Preserve CTX into local variable '%saved_context'.
@@ -3343,65 +3339,72 @@
CatchClauseNode* catch_block = node->catch_block();
SequenceNode* finally_block = node->finally_block();
- if (catch_block != NULL) {
- // If there is a finally block, it is the handler for code in the catch
- // block.
- intptr_t catch_handler_index = (finally_block == NULL)
- ? original_handler_index
- : owner()->AllocateTryIndex();
- owner()->set_try_index(catch_handler_index);
- EffectGraphVisitor for_catch(owner(), temp_index());
- catch_block->Visit(&for_catch);
- CatchBlockEntryInstr* catch_entry =
+
+ // If there is a finally block, it is the handler for code in the catch
+ // block.
+ const intptr_t catch_handler_index = (finally_block == NULL)
+ ? original_handler_index
+ : catch_block->catch_handler_index();
+
+ owner()->set_try_index(catch_handler_index);
+ EffectGraphVisitor for_catch(owner(), temp_index());
+ catch_block->Visit(&for_catch);
+
+ // NOTE: The implicit variables ':saved_context', ':exception_var'
+ // and ':stacktrace_var' can never be captured variables.
+ ASSERT(!catch_block->exception_var().is_captured());
+ ASSERT(!catch_block->stacktrace_var().is_captured());
+
+ CatchBlockEntryInstr* catch_entry =
+ new CatchBlockEntryInstr(owner()->AllocateBlockId(),
+ catch_handler_index,
+ catch_block->handler_types(),
+ try_handler_index,
+ catch_block->exception_var(),
+ catch_block->stacktrace_var());
+ owner()->AddCatchEntry(catch_entry);
+ ASSERT(!for_catch.is_open());
+ AppendFragment(catch_entry, for_catch);
+ if (node->end_catch_label() != NULL) {
+ JoinEntryInstr* join = node->end_catch_label()->join_for_continue();
+ if (join != NULL) {
+ if (is_open()) Goto(join);
+ exit_ = join;
+ }
+ }
+
+ if (finally_block != NULL) {
+ // Create a handler for the code in the catch block, containing the
+ // code in the finally block.
+ owner()->set_try_index(original_handler_index);
+ EffectGraphVisitor for_finally(owner(), temp_index());
+ for_finally.BuildRestoreContext(catch_block->context_var());
+
+ finally_block->Visit(&for_finally);
+ if (for_finally.is_open()) {
+ // Rethrow the exception. Manually build the graph for rethrow.
+ Value* exception = for_finally.Bind(
+ for_finally.BuildLoadLocal(catch_block->exception_var()));
+ for_finally.PushArgument(exception);
+ 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.CloseFragment();
+ }
+ ASSERT(!for_finally.is_open());
+
+ const Array& types = Array::ZoneHandle(Array::New(1, Heap::kOld));
+ types.SetAt(0, Type::Handle(Type::DynamicType()));
+ CatchBlockEntryInstr* finally_entry =
new CatchBlockEntryInstr(owner()->AllocateBlockId(),
+ original_handler_index,
+ types,
catch_handler_index,
- catch_block->handler_types(),
- try_handler_index);
- owner()->AddCatchEntry(catch_entry);
- ASSERT(!for_catch.is_open());
- AppendFragment(catch_entry, for_catch);
- if (node->end_catch_label() != NULL) {
- JoinEntryInstr* join = node->end_catch_label()->join_for_continue();
- if (join != NULL) {
- if (is_open()) Goto(join);
- exit_ = join;
- }
- }
-
- if (finally_block != NULL) {
- // Create a handler for the code in the catch block, containing the
- // code in the finally block.
- owner()->set_try_index(original_handler_index);
- EffectGraphVisitor for_finally(owner(), temp_index());
- for_finally.AddInstruction(
- new CatchEntryInstr(catch_block->exception_var(),
- catch_block->stacktrace_var()));
- for_finally.BuildRestoreContext(catch_block->context_var());
-
- finally_block->Visit(&for_finally);
- if (for_finally.is_open()) {
- // Rethrow the exception. Manually build the graph for rethrow.
- Value* exception = for_finally.Bind(
- for_finally.BuildLoadLocal(catch_block->exception_var()));
- for_finally.PushArgument(exception);
- 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.CloseFragment();
- }
- ASSERT(!for_finally.is_open());
-
- const Array& types = Array::ZoneHandle(Array::New(1, Heap::kOld));
- types.SetAt(0, Type::Handle(Type::DynamicType()));
- CatchBlockEntryInstr* finally_entry =
- new CatchBlockEntryInstr(owner()->AllocateBlockId(),
- original_handler_index,
- types,
- catch_handler_index);
- owner()->AddCatchEntry(finally_entry);
- AppendFragment(finally_entry, for_finally);
- }
+ catch_block->exception_var(),
+ catch_block->stacktrace_var());
+ owner()->AddCatchEntry(finally_entry);
+ AppendFragment(finally_entry, for_finally);
}
// Generate code for the finally block if one exists.
@@ -3544,7 +3547,8 @@
// We are about to generate code for an inlined finally block. Exceptions
// thrown in this block of code should be treated as though they are
// thrown not from the current try block but the outer try block if any.
- owner()->set_try_index((try_index - 1));
+ intptr_t outer_try_index = node->try_index();
+ owner()->set_try_index(outer_try_index);
}
BuildRestoreContext(node->context_var());
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index 4674a2a..9c6f259 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -124,9 +124,6 @@
void DecrementLoopDepth() { --loop_depth_; }
intptr_t loop_depth() const { return loop_depth_; }
- // Each try in this function gets its own try index.
- intptr_t AllocateTryIndex() { return ++last_used_try_index_; }
-
// Manage the currently active try index.
void set_try_index(intptr_t value) { try_index_ = value; }
intptr_t try_index() const { return try_index_; }
@@ -171,7 +168,6 @@
intptr_t last_used_block_id_;
intptr_t context_level_;
- intptr_t last_used_try_index_;
intptr_t try_index_;
intptr_t loop_depth_;
GraphEntryInstr* graph_entry_;
diff --git a/runtime/vm/flow_graph_compiler.h b/runtime/vm/flow_graph_compiler.h
index 8ee48ca..e9b2b37 100644
--- a/runtime/vm/flow_graph_compiler.h
+++ b/runtime/vm/flow_graph_compiler.h
@@ -241,6 +241,7 @@
~FlowGraphCompiler();
static bool SupportsUnboxedMints();
+ static bool SupportsInlinedTrigonometrics();
// Accessors.
Assembler* assembler() const { return assembler_; }
diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc
index 28497ca..2dc5f64 100644
--- a/runtime/vm/flow_graph_compiler_arm.cc
+++ b/runtime/vm/flow_graph_compiler_arm.cc
@@ -7,7 +7,6 @@
#include "vm/flow_graph_compiler.h"
-#include "lib/error.h"
#include "vm/ast_printer.h"
#include "vm/dart_entry.h"
#include "vm/deopt_instructions.h"
@@ -44,6 +43,12 @@
}
+// TODO(srdjan): Enable by calling C-functions.
+bool FlowGraphCompiler::SupportsInlinedTrigonometrics() {
+ return false;
+}
+
+
RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder) {
if (deopt_env_ == NULL) return DeoptInfo::null();
@@ -785,10 +790,9 @@
}
// Process locals. Skip exception_var and stacktrace_var.
- CatchEntryInstr* catch_entry = catch_block->next()->AsCatchEntry();
intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params;
- intptr_t ex_idx = local_base - catch_entry->exception_var().index();
- intptr_t st_idx = local_base - catch_entry->stacktrace_var().index();
+ intptr_t ex_idx = local_base - catch_block->exception_var().index();
+ intptr_t st_idx = local_base - catch_block->stacktrace_var().index();
for (; i < flow_graph().variable_count(); ++i) {
if (i == ex_idx || i == st_idx) continue;
if ((*idefs)[i]->IsConstant()) continue;
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index 6857292..e2a7bc8 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -7,7 +7,6 @@
#include "vm/flow_graph_compiler.h"
-#include "lib/error.h"
#include "vm/ast_printer.h"
#include "vm/dart_entry.h"
#include "vm/deopt_instructions.h"
@@ -48,6 +47,11 @@
}
+bool FlowGraphCompiler::SupportsInlinedTrigonometrics() {
+ return true;
+}
+
+
RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder) {
if (deopt_env_ == NULL) return DeoptInfo::null();
@@ -806,10 +810,9 @@
}
// Process locals. Skip exception_var and stacktrace_var.
- CatchEntryInstr* catch_entry = catch_block->next()->AsCatchEntry();
intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params;
- intptr_t ex_idx = local_base - catch_entry->exception_var().index();
- intptr_t st_idx = local_base - catch_entry->stacktrace_var().index();
+ intptr_t ex_idx = local_base - catch_block->exception_var().index();
+ intptr_t st_idx = local_base - catch_block->stacktrace_var().index();
for (; i < flow_graph().variable_count(); ++i) {
if (i == ex_idx || i == st_idx) continue;
if ((*idefs)[i]->IsConstant()) continue;
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc
index ea29621..98527cf 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -7,7 +7,6 @@
#include "vm/flow_graph_compiler.h"
-#include "lib/error.h"
#include "vm/ast_printer.h"
#include "vm/dart_entry.h"
#include "vm/deopt_instructions.h"
@@ -44,6 +43,12 @@
}
+// TODO(srdjan): Enable by calling C-functions.
+bool FlowGraphCompiler::SupportsInlinedTrigonometrics() {
+ return false;
+}
+
+
RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder) {
if (deopt_env_ == NULL) return DeoptInfo::null();
@@ -812,10 +817,9 @@
}
// Process locals. Skip exception_var and stacktrace_var.
- CatchEntryInstr* catch_entry = catch_block->next()->AsCatchEntry();
intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params;
- intptr_t ex_idx = local_base - catch_entry->exception_var().index();
- intptr_t st_idx = local_base - catch_entry->stacktrace_var().index();
+ intptr_t ex_idx = local_base - catch_block->exception_var().index();
+ intptr_t st_idx = local_base - catch_block->stacktrace_var().index();
for (; i < flow_graph().variable_count(); ++i) {
if (i == ex_idx || i == st_idx) continue;
if ((*idefs)[i]->IsConstant()) continue;
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 00784c9..f07d491 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -7,7 +7,6 @@
#include "vm/flow_graph_compiler.h"
-#include "lib/error.h"
#include "vm/ast_printer.h"
#include "vm/dart_entry.h"
#include "vm/deopt_instructions.h"
@@ -45,6 +44,11 @@
}
+bool FlowGraphCompiler::SupportsInlinedTrigonometrics() {
+ return true;
+}
+
+
RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
DeoptInfoBuilder* builder) {
if (deopt_env_ == NULL) return DeoptInfo::null();
@@ -799,10 +803,9 @@
}
// Process locals. Skip exception_var and stacktrace_var.
- CatchEntryInstr* catch_entry = catch_block->next()->AsCatchEntry();
intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params;
- intptr_t ex_idx = local_base - catch_entry->exception_var().index();
- intptr_t st_idx = local_base - catch_entry->stacktrace_var().index();
+ intptr_t ex_idx = local_base - catch_block->exception_var().index();
+ intptr_t st_idx = local_base - catch_block->stacktrace_var().index();
for (; i < flow_graph().variable_count(); ++i) {
if (i == ex_idx || i == st_idx) continue;
if ((*idefs)[i]->IsConstant()) continue;
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index fce131c..d1a8555 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -2627,14 +2627,20 @@
}
}
-
void FlowGraphOptimizer::VisitStaticCall(StaticCallInstr* call) {
MethodRecognizer::Kind recognized_kind =
MethodRecognizer::RecognizeKind(call->function());
- if (recognized_kind == MethodRecognizer::kMathSqrt) {
- MathSqrtInstr* sqrt =
- new MathSqrtInstr(new Value(call->ArgumentAt(0)), call->deopt_id());
- ReplaceCall(call, sqrt);
+ if ((recognized_kind == MethodRecognizer::kMathSqrt) ||
+ (recognized_kind == MethodRecognizer::kMathSin) ||
+ (recognized_kind == MethodRecognizer::kMathCos)) {
+ if ((recognized_kind == MethodRecognizer::kMathSqrt) ||
+ FlowGraphCompiler::SupportsInlinedTrigonometrics()) {
+ MathUnaryInstr* math_unary =
+ new MathUnaryInstr(recognized_kind,
+ new Value(call->ArgumentAt(0)),
+ call->deopt_id());
+ ReplaceCall(call, math_unary);
+ }
} else if ((recognized_kind == MethodRecognizer::kFloat32x4Zero) ||
(recognized_kind == MethodRecognizer::kFloat32x4Splat) ||
(recognized_kind == MethodRecognizer::kFloat32x4Constructor)) {
@@ -2874,6 +2880,8 @@
strict_kind,
compare->left()->CopyWithType(),
compare->right()->CopyWithType());
+ // Numbers override equality and are therefore not part of this conversion.
+ strict_comp->set_needs_number_check(false);
current_instruction->ReplaceWith(strict_comp, current_iterator());
return true;
}
@@ -3623,15 +3631,14 @@
for (intptr_t catch_idx = 0;
catch_idx < catch_entries.length();
++catch_idx) {
- CatchBlockEntryInstr* cb = catch_entries[catch_idx];
- CatchEntryInstr* catch_entry = cb->next()->AsCatchEntry();
+ CatchBlockEntryInstr* catch_entry = catch_entries[catch_idx];
// Initialize cdefs with the original initial definitions (ParameterInstr).
// The following representation is used:
// ParameterInstr => unknown
// ConstantInstr => known constant
// NULL => non-constant
- GrowableArray<Definition*>* idefs = cb->initial_definitions();
+ GrowableArray<Definition*>* idefs = catch_entry->initial_definitions();
GrowableArray<Definition*> cdefs(idefs->length());
cdefs.AddArray(*idefs);
@@ -3644,7 +3651,7 @@
!block_it.Done();
block_it.Advance()) {
BlockEntryInstr* block = block_it.Current();
- if (block->try_index() == cb->catch_try_index()) {
+ if (block->try_index() == catch_entry->catch_try_index()) {
for (ForwardInstructionIterator instr_it(block);
!instr_it.Done();
instr_it.Advance()) {
@@ -5718,9 +5725,6 @@
void ConstantPropagator::VisitStoreContext(StoreContextInstr* instr) { }
-void ConstantPropagator::VisitCatchEntry(CatchEntryInstr* instr) { }
-
-
void ConstantPropagator::VisitCheckStackOverflow(
CheckStackOverflowInstr* instr) { }
@@ -6469,12 +6473,12 @@
}
-void ConstantPropagator::VisitMathSqrt(MathSqrtInstr* instr) {
+void ConstantPropagator::VisitMathUnary(MathUnaryInstr* instr) {
const Object& value = instr->value()->definition()->constant_value();
if (IsNonConstant(value)) {
SetValue(instr, non_constant_);
} else if (IsConstant(value)) {
- // TODO(kmillikin): Handle sqrt.
+ // TODO(kmillikin): Handle Math's unary operations (sqrt, cos, sin).
SetValue(instr, non_constant_);
}
}
diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc
index e20774b..bbd7cd3 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -945,14 +945,23 @@
}
if (FLAG_enable_type_checks) {
+ ASSERT(!type().HasResolvedTypeClass() ||
+ !Field::IsExternalizableCid(Class::Handle(
+ type().type_class()).id()));
return CompileType::FromAbstractType(type());
}
- if (field_ != NULL && (field_->guarded_cid() != kIllegalCid)) {
- return CompileType::CreateNullable(field_->is_nullable(),
- field_->guarded_cid());
+ if ((field_ != NULL) && (field_->guarded_cid() != kIllegalCid)) {
+ intptr_t field_cid = field_->guarded_cid();
+ if (Field::IsExternalizableCid(field_cid)) {
+ // We cannot assume that the type of the value in the field has not
+ // changed on the fly.
+ field_cid = kDynamicCid;
+ }
+ return CompileType::CreateNullable(field_->is_nullable(), field_cid);
}
+ ASSERT(!Field::IsExternalizableCid(result_cid_));
return CompileType::FromCid(result_cid_);
}
@@ -1122,7 +1131,7 @@
}
-CompileType MathSqrtInstr::ComputeType() const {
+CompileType MathUnaryInstr::ComputeType() const {
return CompileType::FromCid(kDoubleCid);
}
diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc
index e396518..02880071 100644
--- a/runtime/vm/il_printer.cc
+++ b/runtime/vm/il_printer.cc
@@ -578,13 +578,6 @@
}
-void CatchEntryInstr::PrintOperandsTo(BufferFormatter* f) const {
- f->Print("%s, %s",
- exception_var().name().ToCString(),
- stacktrace_var().name().ToCString());
-}
-
-
void BinarySmiOpInstr::PrintTo(BufferFormatter* f) const {
Definition::PrintTo(f);
f->Print(" %co", overflow_ ? '+' : '-');
@@ -793,7 +786,7 @@
void CheckClassInstr::PrintOperandsTo(BufferFormatter* f) const {
value()->PrintTo(f);
PrintICData(f, unary_checks());
- if (null_check()) {
+ if (IsNullCheck()) {
f->Print(" nullcheck");
}
}
@@ -821,7 +814,12 @@
void JoinEntryInstr::PrintTo(BufferFormatter* f) const {
- f->Print("B%"Pd"[join]:%"Pd" pred(", block_id(), GetDeoptId());
+ if (try_index() != CatchClauseNode::kInvalidTryIndex) {
+ f->Print("B%"Pd"[join try_idx %"Pd"]:%"Pd" pred(",
+ block_id(), try_index(), GetDeoptId());
+ } else {
+ f->Print("B%"Pd"[join]:%"Pd" pred(", block_id(), GetDeoptId());
+ }
for (intptr_t i = 0; i < predecessors_.length(); ++i) {
if (i > 0) f->Print(", ");
f->Print("B%"Pd, predecessors_[i]->block_id());
@@ -877,7 +875,12 @@
void TargetEntryInstr::PrintTo(BufferFormatter* f) const {
- f->Print("B%"Pd"[target]:%"Pd, block_id(), GetDeoptId());
+ if (try_index() != CatchClauseNode::kInvalidTryIndex) {
+ f->Print("B%"Pd"[target try_idx %"Pd"]:%"Pd,
+ block_id(), try_index(), GetDeoptId());
+ } else {
+ f->Print("B%"Pd"[target]:%"Pd, block_id(), GetDeoptId());
+ }
if (HasParallelMove()) {
f->Print(" ");
parallel_move()->PrintTo(f);
@@ -886,9 +889,10 @@
void CatchBlockEntryInstr::PrintTo(BufferFormatter* f) const {
- f->Print("B%"Pd"[target catch %"Pd"]", block_id(), catch_try_index());
+ f->Print("B%"Pd"[target catch try_idx %"Pd" catch_try_idx %"Pd"]",
+ block_id(), try_index(), catch_try_index());
if (HasParallelMove()) {
- f->Print(" ");
+ f->Print("\n");
parallel_move()->PrintTo(f);
}
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 7db5a64..2fdb792 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -86,8 +86,7 @@
CheckClassInstr::CheckClassInstr(Value* value,
intptr_t deopt_id,
const ICData& unary_checks)
- : unary_checks_(unary_checks),
- null_check_(false) {
+ : unary_checks_(unary_checks) {
ASSERT(unary_checks.IsZoneHandle());
// Expected useful check data.
ASSERT(!unary_checks_.IsNull());
@@ -128,6 +127,18 @@
}
+bool CheckClassInstr::IsNullCheck() const {
+ if (unary_checks().NumberOfChecks() != 1) {
+ return false;
+ }
+ CompileType* in_type = value()->Type();
+ const intptr_t cid = unary_checks().GetCidAt(0);
+ // Performance check: use CheckSmiInstr instead.
+ ASSERT(cid != kSmiCid);
+ return in_type->is_nullable() && (in_type->ToNullableCid() == cid);
+}
+
+
bool GuardFieldInstr::AttributesEqual(Instruction* other) const {
return field().raw() == other->AsGuardField()->field().raw();
}
@@ -1592,24 +1603,6 @@
}
-LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
- UNREACHABLE();
- return NULL;
-}
-
-
-void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ Bind(compiler->GetJumpLabel(this));
- compiler->AddExceptionHandler(catch_try_index(),
- try_index(),
- compiler->assembler()->CodeSize(),
- catch_handler_types_);
- if (HasParallelMove()) {
- compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
- }
-}
-
-
LocationSummary* PhiInstr::MakeLocationSummary() const {
UNREACHABLE();
return NULL;
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index df369bf..b2325aff 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -80,6 +80,8 @@
V(_Double, pow, DoublePow, 102305574) \
V(_Double, _modulo, DoubleMod, 663439671) \
V(::, sqrt, MathSqrt, 1662640002) \
+ V(::, sin, MathSin, 1273932041) \
+ V(::, cos, MathCos, 1749547468) \
V(::, min, MathMin, 269896129) \
V(::, max, MathMax, 1286442186) \
V(Float32x4, Float32x4., Float32x4Constructor, 1492157358) \
@@ -575,7 +577,6 @@
M(ExtractConstructorInstantiator) \
M(AllocateContext) \
M(CloneContext) \
- M(CatchEntry) \
M(BinarySmiOp) \
M(UnarySmiOp) \
M(CheckStackOverflow) \
@@ -588,7 +589,7 @@
M(Constant) \
M(CheckEitherNonSmi) \
M(BinaryDoubleOp) \
- M(MathSqrt) \
+ M(MathUnary) \
M(MathMinMax) \
M(UnboxDouble) \
M(BoxDouble) \
@@ -919,7 +920,7 @@
friend class UnarySmiOpInstr;
friend class ShiftMintOpInstr;
friend class UnaryMintOpInstr;
- friend class MathSqrtInstr;
+ friend class MathUnaryInstr;
friend class MathMinMaxInstr;
friend class CheckClassInstr;
friend class GuardFieldInstr;
@@ -1487,11 +1488,15 @@
CatchBlockEntryInstr(intptr_t block_id,
intptr_t try_index,
const Array& handler_types,
- intptr_t catch_try_index)
+ intptr_t catch_try_index,
+ const LocalVariable& exception_var,
+ const LocalVariable& stacktrace_var)
: BlockEntryInstr(block_id, try_index),
predecessor_(NULL),
catch_handler_types_(Array::ZoneHandle(handler_types.raw())),
- catch_try_index_(catch_try_index) { }
+ catch_try_index_(catch_try_index),
+ exception_var_(exception_var),
+ stacktrace_var_(stacktrace_var) { }
DECLARE_INSTRUCTION(CatchBlockEntry)
@@ -1503,6 +1508,9 @@
return predecessor_;
}
+ const LocalVariable& exception_var() const { return exception_var_; }
+ const LocalVariable& stacktrace_var() const { return stacktrace_var_; }
+
// Returns try index for the try block to which this catch handler
// corresponds.
intptr_t catch_try_index() const {
@@ -1527,6 +1535,8 @@
const Array& catch_handler_types_;
const intptr_t catch_try_index_;
GrowableArray<Definition*> initial_definitions_;
+ const LocalVariable& exception_var_;
+ const LocalVariable& stacktrace_var_;
DISALLOW_COPY_AND_ASSIGN(CatchBlockEntryInstr);
};
@@ -3278,6 +3288,10 @@
return ast_node_.native_c_function();
}
+ bool is_bootstrap_native() const {
+ return ast_node_.is_bootstrap_native();
+ }
+
virtual void PrintOperandsTo(BufferFormatter* f) const;
virtual bool CanDeoptimize() const { return false; }
@@ -4289,35 +4303,6 @@
};
-class CatchEntryInstr : public TemplateInstruction<0> {
- public:
- CatchEntryInstr(const LocalVariable& exception_var,
- const LocalVariable& stacktrace_var)
- : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {}
-
- const LocalVariable& exception_var() const { return exception_var_; }
- const LocalVariable& stacktrace_var() const { return stacktrace_var_; }
-
- DECLARE_INSTRUCTION(CatchEntry)
-
- virtual intptr_t ArgumentCount() const { return 0; }
-
- virtual void PrintOperandsTo(BufferFormatter* f) const;
-
- virtual bool CanDeoptimize() const { return false; }
-
- virtual EffectSet Effects() const { return EffectSet::All(); }
-
- virtual bool MayThrow() const { return false; }
-
- private:
- const LocalVariable& exception_var_;
- const LocalVariable& stacktrace_var_;
-
- DISALLOW_COPY_AND_ASSIGN(CatchEntryInstr);
-};
-
-
class CheckEitherNonSmiInstr : public TemplateInstruction<2> {
public:
CheckEitherNonSmiInstr(Value* left,
@@ -4607,15 +4592,18 @@
};
-class MathSqrtInstr : public TemplateDefinition<1> {
+class MathUnaryInstr : public TemplateDefinition<1> {
public:
- MathSqrtInstr(Value* value, intptr_t deopt_id) {
+ MathUnaryInstr(MethodRecognizer::Kind kind, Value* value, intptr_t deopt_id)
+ : kind_(kind) {
SetInputAt(0, value);
deopt_id_ = deopt_id;
}
Value* value() const { return inputs_[0]; }
+ MethodRecognizer::Kind kind() const { return kind_; }
+
virtual bool CanDeoptimize() const { return false; }
virtual Representation representation() const {
@@ -4633,7 +4621,7 @@
return deopt_id_;
}
- DECLARE_INSTRUCTION(MathSqrt)
+ DECLARE_INSTRUCTION(MathUnary)
virtual CompileType ComputeType() const;
virtual bool AllowsCSE() const { return true; }
@@ -4644,7 +4632,9 @@
virtual bool MayThrow() const { return false; }
private:
- DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr);
+ const MethodRecognizer::Kind kind_;
+
+ DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr);
};
@@ -6319,9 +6309,7 @@
virtual void PrintOperandsTo(BufferFormatter* f) const;
- void set_null_check(bool flag) { null_check_ = flag; }
-
- bool null_check() const { return null_check_; }
+ bool IsNullCheck() const;
virtual bool AllowsCSE() const { return true; }
virtual EffectSet Effects() const { return EffectSet::None(); }
@@ -6333,8 +6321,6 @@
private:
const ICData& unary_checks_;
- bool null_check_;
-
DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
};
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index dd22a39..ffa5755 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -7,7 +7,6 @@
#include "vm/intermediate_language.h"
-#include "lib/error.h"
#include "vm/dart_entry.h"
#include "vm/flow_graph_compiler.h"
#include "vm/locations.h"
@@ -1000,15 +999,23 @@
// this is a redirection address that forces the simulator to call
// into the runtime system.
uword entry = reinterpret_cast<uword>(native_c_function());
+ const ExternalLabel* stub_entry;
+ if (is_bootstrap_native()) {
+ stub_entry = &StubCode::CallBootstrapCFunctionLabel();
#if defined(USING_SIMULATOR)
- entry = Simulator::RedirectExternalReference(entry,
- Simulator::kNativeCall,
- function().NumParameters());
+ entry = Simulator::RedirectExternalReference(
+ entry, Simulator::kBootstrapNativeCall, function().NumParameters());
#endif
+ } else {
+ // In the case of non bootstrap native methods the CallNativeCFunction
+ // stub generates the redirection address when running under the simulator
+ // and hence we do not change 'entry' here.
+ stub_entry = &StubCode::CallNativeCFunctionLabel();
+ }
__ LoadImmediate(R5, entry);
__ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function()));
compiler->GenerateCall(token_pos(),
- &StubCode::CallNativeCFunctionLabel(),
+ stub_entry,
PcDescriptors::kOther,
locs());
__ Pop(result);
@@ -2036,16 +2043,26 @@
}
-LocationSummary* CatchEntryInstr::MakeLocationSummary() const {
- return LocationSummary::Make(0,
- Location::NoLocation(),
- LocationSummary::kNoCall);
+LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
+ UNREACHABLE();
+ return NULL;
}
-// Restore stack and initialize the two exception variables:
-// exception and stack trace variables.
-void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ Bind(compiler->GetJumpLabel(this));
+ compiler->AddExceptionHandler(catch_try_index(),
+ try_index(),
+ compiler->assembler()->CodeSize(),
+ catch_handler_types_);
+
+ // Restore the pool pointer.
+ __ LoadPoolPointer();
+
+ if (HasParallelMove()) {
+ compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
+ }
+
// Restore SP from FP as we are coming from a throw and the code for
// popping arguments has not been run.
const intptr_t fp_sp_dist =
@@ -2053,15 +2070,12 @@
ASSERT(fp_sp_dist <= 0);
__ AddImmediate(SP, FP, fp_sp_dist);
- ASSERT(!exception_var().is_captured());
- ASSERT(!stacktrace_var().is_captured());
+ // Restore stack and initialize the two exception variables:
+ // exception and stack trace variables.
__ StoreToOffset(kWord, kExceptionObjectReg,
FP, exception_var().index() * kWordSize);
__ StoreToOffset(kWord, kStackTraceObjectReg,
FP, stacktrace_var().index() * kWordSize);
-
- // Restore the pool pointer.
- __ LoadPoolPointer();
}
@@ -3623,7 +3637,7 @@
}
-LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
+LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
@@ -3634,10 +3648,14 @@
}
-void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg());
- DRegister result = EvenDRegisterOf(locs()->out().fpu_reg());
- __ vsqrtd(result, val);
+void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ if (kind() == MethodRecognizer::kMathSqrt) {
+ DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg());
+ DRegister result = EvenDRegisterOf(locs()->out().fpu_reg());
+ __ vsqrtd(result, val);
+ } else {
+ UNIMPLEMENTED();
+ }
}
@@ -3997,7 +4015,7 @@
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
- if (!null_check()) {
+ if (!IsNullCheck()) {
summary->AddTemp(Location::RequiresRegister());
}
return summary;
@@ -4005,7 +4023,7 @@
void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- if (null_check()) {
+ if (IsNullCheck()) {
Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptCheckClass);
__ CompareImmediate(locs()->in(0).reg(),
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index c196ff5..6a90823 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -7,7 +7,6 @@
#include "vm/intermediate_language.h"
-#include "lib/error.h"
#include "vm/dart_entry.h"
#include "vm/flow_graph_compiler.h"
#include "vm/locations.h"
@@ -1071,8 +1070,11 @@
}
__ movl(ECX, Immediate(reinterpret_cast<uword>(native_c_function())));
__ movl(EDX, Immediate(NativeArguments::ComputeArgcTag(function())));
+ const ExternalLabel* stub_entry =
+ (is_bootstrap_native()) ? &StubCode::CallBootstrapCFunctionLabel() :
+ &StubCode::CallNativeCFunctionLabel();
compiler->GenerateCall(token_pos(),
- &StubCode::CallNativeCFunctionLabel(),
+ stub_entry,
PcDescriptors::kOther,
locs());
__ popl(result);
@@ -2100,16 +2102,22 @@
}
-LocationSummary* CatchEntryInstr::MakeLocationSummary() const {
- return LocationSummary::Make(0,
- Location::NoLocation(),
- LocationSummary::kNoCall);
+LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
+ UNREACHABLE();
+ return NULL;
}
-// Restore stack and initialize the two exception variables:
-// exception and stack trace variables.
-void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ Bind(compiler->GetJumpLabel(this));
+ compiler->AddExceptionHandler(catch_try_index(),
+ try_index(),
+ compiler->assembler()->CodeSize(),
+ catch_handler_types_);
+ if (HasParallelMove()) {
+ compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
+ }
+
// Restore ESP from EBP as we are coming from a throw and the code for
// popping arguments has not been run.
const intptr_t fp_sp_dist =
@@ -2117,8 +2125,8 @@
ASSERT(fp_sp_dist <= 0);
__ leal(ESP, Address(EBP, fp_sp_dist));
- ASSERT(!exception_var().is_captured());
- ASSERT(!stacktrace_var().is_captured());
+ // Restore stack and initialize the two exception variables:
+ // exception and stack trace variables.
__ movl(Address(EBP, exception_var().index() * kWordSize),
kExceptionObjectReg);
__ movl(Address(EBP, stacktrace_var().index() * kWordSize),
@@ -3684,7 +3692,7 @@
}
-LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
+LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
@@ -3695,8 +3703,27 @@
}
-void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ if (kind() == MethodRecognizer::kMathSqrt) {
+ __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+ } else if ((kind() == MethodRecognizer::kMathCos) ||
+ (kind() == MethodRecognizer::kMathSin)) {
+ __ pushl(EAX);
+ __ pushl(EAX);
+ __ movsd(Address(ESP, 0), locs()->in(0).fpu_reg());
+ __ fldl(Address(ESP, 0));
+ if (kind() == MethodRecognizer::kMathSin) {
+ __ fsin();
+ } else {
+ ASSERT(kind() == MethodRecognizer::kMathCos);
+ __ fcos();
+ }
+ __ fstpl(Address(ESP, 0));
+ __ movsd(locs()->out().fpu_reg(), Address(ESP, 0));
+ __ addl(ESP, Immediate(2 * kWordSize));
+ } else {
+ UNREACHABLE();
+ }
}
@@ -4032,7 +4059,7 @@
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
- if (!null_check()) {
+ if (!IsNullCheck()) {
summary->AddTemp(Location::RequiresRegister());
}
return summary;
@@ -4040,7 +4067,7 @@
void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- if (null_check()) {
+ if (IsNullCheck()) {
Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptCheckClass);
const Immediate& raw_null =
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index 7051056..6740dbb 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -7,7 +7,6 @@
#include "vm/intermediate_language.h"
-#include "lib/error.h"
#include "vm/dart_entry.h"
#include "vm/flow_graph_compiler.h"
#include "vm/locations.h"
@@ -1056,15 +1055,23 @@
// this is a redirection address that forces the simulator to call
// into the runtime system.
uword entry = reinterpret_cast<uword>(native_c_function());
+ const ExternalLabel* stub_entry;
+ if (is_bootstrap_native()) {
+ stub_entry = &StubCode::CallBootstrapCFunctionLabel();
#if defined(USING_SIMULATOR)
- entry = Simulator::RedirectExternalReference(entry,
- Simulator::kNativeCall,
- function().NumParameters());
+ entry = Simulator::RedirectExternalReference(
+ entry, Simulator::kBootstrapNativeCall, function().NumParameters());
#endif
+ } else {
+ // In the case of non bootstrap native methods the CallNativeCFunction
+ // stub generates the redirection address when running under the simulator
+ // and hence we do not change 'entry' here.
+ stub_entry = &StubCode::CallNativeCFunctionLabel();
+ }
__ LoadImmediate(T5, entry);
__ LoadImmediate(A1, NativeArguments::ComputeArgcTag(function()));
compiler->GenerateCall(token_pos(),
- &StubCode::CallNativeCFunctionLabel(),
+ stub_entry,
PcDescriptors::kOther,
locs());
__ Pop(result);
@@ -2119,16 +2126,29 @@
}
-LocationSummary* CatchEntryInstr::MakeLocationSummary() const {
- return LocationSummary::Make(0,
- Location::NoLocation(),
- LocationSummary::kNoCall);
+LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
+ UNREACHABLE();
+ return NULL;
}
-// Restore stack and initialize the two exception variables:
-// exception and stack trace variables.
-void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ Bind(compiler->GetJumpLabel(this));
+ compiler->AddExceptionHandler(catch_try_index(),
+ try_index(),
+ compiler->assembler()->CodeSize(),
+ catch_handler_types_);
+ // Restore pool pointer.
+ __ GetNextPC(CMPRES, TMP);
+ const intptr_t object_pool_pc_dist =
+ Instructions::HeaderSize() - Instructions::object_pool_offset() +
+ compiler->assembler()->CodeSize() - 1 * Instr::kInstrSize;
+ __ LoadFromOffset(PP, CMPRES, -object_pool_pc_dist);
+
+ if (HasParallelMove()) {
+ compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
+ }
+
// Restore SP from FP as we are coming from a throw and the code for
// popping arguments has not been run.
const intptr_t fp_sp_dist =
@@ -2136,22 +2156,12 @@
ASSERT(fp_sp_dist <= 0);
__ AddImmediate(SP, FP, fp_sp_dist);
- ASSERT(!exception_var().is_captured());
- ASSERT(!stacktrace_var().is_captured());
-
+ // Restore stack and initialize the two exception variables:
+ // exception and stack trace variables.
__ sw(kExceptionObjectReg,
Address(FP, exception_var().index() * kWordSize));
__ sw(kStackTraceObjectReg,
Address(FP, stacktrace_var().index() * kWordSize));
-
- __ GetNextPC(CMPRES, TMP);
-
- // Calculate offset of pool pointer from the PC.
- const intptr_t object_pool_pc_dist =
- Instructions::HeaderSize() - Instructions::object_pool_offset() +
- compiler->assembler()->CodeSize() - 1 * Instr::kInstrSize;
-
- __ LoadFromOffset(PP, CMPRES, -object_pool_pc_dist);
}
@@ -3075,7 +3085,7 @@
}
-LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
+LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
@@ -3086,8 +3096,12 @@
}
-void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ sqrtd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ if (kind() == MethodRecognizer::kMathSqrt) {
+ __ sqrtd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+ } else {
+ UNIMPLEMENTED();
+ }
}
@@ -3412,7 +3426,7 @@
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
- if (!null_check()) {
+ if (!IsNullCheck()) {
summary->AddTemp(Location::RequiresRegister());
}
return summary;
@@ -3420,7 +3434,7 @@
void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- if (null_check()) {
+ if (IsNullCheck()) {
Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptCheckClass);
__ BranchEqual(locs()->in(0).reg(),
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index f839f76..a7303de 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -7,7 +7,6 @@
#include "vm/intermediate_language.h"
-#include "lib/error.h"
#include "vm/dart_entry.h"
#include "vm/flow_graph_compiler.h"
#include "vm/locations.h"
@@ -1069,8 +1068,11 @@
}
__ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function())));
__ movq(R10, Immediate(NativeArguments::ComputeArgcTag(function())));
+ const ExternalLabel* stub_entry =
+ (is_bootstrap_native()) ? &StubCode::CallBootstrapCFunctionLabel() :
+ &StubCode::CallNativeCFunctionLabel();
compiler->GenerateCall(token_pos(),
- &StubCode::CallNativeCFunctionLabel(),
+ stub_entry,
PcDescriptors::kOther,
locs());
__ popq(result);
@@ -2055,16 +2057,22 @@
}
-LocationSummary* CatchEntryInstr::MakeLocationSummary() const {
- return LocationSummary::Make(0,
- Location::NoLocation(),
- LocationSummary::kNoCall);
+LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
+ UNREACHABLE();
+ return NULL;
}
-// Restore stack and initialize the two exception variables:
-// exception and stack trace variables.
-void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ Bind(compiler->GetJumpLabel(this));
+ compiler->AddExceptionHandler(catch_try_index(),
+ try_index(),
+ compiler->assembler()->CodeSize(),
+ catch_handler_types_);
+ if (HasParallelMove()) {
+ compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
+ }
+
// Restore RSP from RBP as we are coming from a throw and the code for
// popping arguments has not been run.
const intptr_t fp_sp_dist =
@@ -2072,8 +2080,8 @@
ASSERT(fp_sp_dist <= 0);
__ leaq(RSP, Address(RBP, fp_sp_dist));
- ASSERT(!exception_var().is_captured());
- ASSERT(!stacktrace_var().is_captured());
+ // Restore stack and initialize the two exception variables:
+ // exception and stack trace variables.
__ movq(Address(RBP, exception_var().index() * kWordSize),
kExceptionObjectReg);
__ movq(Address(RBP, stacktrace_var().index() * kWordSize),
@@ -3725,7 +3733,7 @@
}
-LocationSummary* MathSqrtInstr::MakeLocationSummary() const {
+LocationSummary* MathUnaryInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = 0;
LocationSummary* summary =
@@ -3736,8 +3744,27 @@
}
-void MathSqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ if (kind() == MethodRecognizer::kMathSqrt) {
+ __ sqrtsd(locs()->out().fpu_reg(), locs()->in(0).fpu_reg());
+ } else if ((kind() == MethodRecognizer::kMathCos) ||
+ (kind() == MethodRecognizer::kMathSin)) {
+ __ pushq(RAX);
+ __ movsd(Address(RSP, 0), locs()->in(0).fpu_reg());
+ __ fldl(Address(RSP, 0));
+ if (kind() == MethodRecognizer::kMathSin) {
+ __ fsin();
+ } else {
+ ASSERT(kind() == MethodRecognizer::kMathCos);
+ __ fcos();
+ }
+ __ fstpl(Address(RSP, 0));
+ __ movsd(locs()->out().fpu_reg(), Address(RSP, 0));
+ __ addq(RSP, Immediate(kWordSize));
+ return;
+ } else {
+ UNREACHABLE();
+ }
}
@@ -4098,7 +4125,7 @@
LocationSummary* summary =
new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
- if (!null_check()) {
+ if (!IsNullCheck()) {
summary->AddTemp(Location::RequiresRegister());
}
return summary;
@@ -4106,7 +4133,7 @@
void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- if (null_check()) {
+ if (IsNullCheck()) {
Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptCheckClass);
const Immediate& raw_null =
diff --git a/runtime/vm/intrinsifier.cc b/runtime/vm/intrinsifier.cc
index c2b4bfe..337b377 100644
--- a/runtime/vm/intrinsifier.cc
+++ b/runtime/vm/intrinsifier.cc
@@ -124,8 +124,8 @@
CORE_LIB_INTRINSIC_LIST(SETUP_FUNCTION);
// Integer intrinsics are in the core library, but we don't want to intrinsify
- // if we are looking for javascript integer overflow.
- if (!FLAG_throw_on_javascript_int_overflow) {
+ // when Smi > 32 bits if we are looking for javascript integer overflow.
+ if (!FLAG_throw_on_javascript_int_overflow || (Smi::kBits < 32)) {
CORE_INTEGER_LIB_INTRINSIC_LIST(SETUP_FUNCTION);
}
@@ -159,7 +159,7 @@
if (lib.raw() == Library::CoreLibrary()) {
CORE_LIB_INTRINSIC_LIST(FIND_INTRINSICS);
- if (!FLAG_throw_on_javascript_int_overflow) {
+ if (!FLAG_throw_on_javascript_int_overflow || (Smi::kBits < 32)) {
CORE_INTEGER_LIB_INTRINSIC_LIST(FIND_INTRINSICS);
}
} else if (lib.raw() == Library::TypedDataLibrary()) {
diff --git a/runtime/vm/intrinsifier.h b/runtime/vm/intrinsifier.h
index 9682004..fd16073 100644
--- a/runtime/vm/intrinsifier.h
+++ b/runtime/vm/intrinsifier.h
@@ -98,7 +98,7 @@
V(::, sqrt, Math_sqrt, 1662640002) \
V(::, sin, Math_sin, 1273932041) \
V(::, cos, Math_cos, 1749547468) \
- V(_Random, _nextState, Random_nextState, 287494804) \
+ V(_Random, _nextState, Random_nextState, 776416255) \
#define TYPED_DATA_LIB_INTRINSIC_LIST(V) \
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index e7b375d..e79e89e 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -403,7 +403,6 @@
message_handler_(NULL),
spawn_data_(0),
is_runnable_(false),
- running_state_(kIsolateWaiting),
gc_prologue_callbacks_(),
gc_epilogue_callbacks_(),
defer_finalization_count_(0),
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index b8eb6c2..2fc17d1 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -379,11 +379,6 @@
kVmStatusInterrupt,
};
- enum IsolateRunState {
- kIsolateWaiting = 0, // The isolate is waiting for code to execute.
- kIsolateRunning, // The isolate is executing code.
- };
-
void ScheduleInterrupts(uword interrupt_bits);
uword GetAndClearInterrupts();
@@ -396,9 +391,6 @@
bool is_runnable() const { return is_runnable_; }
void set_is_runnable(bool value) { is_runnable_ = value; }
- IsolateRunState running_state() const { return running_state_; }
- void set_running_state(IsolateRunState value) { running_state_ = value; }
-
uword spawn_data() const { return spawn_data_; }
void set_spawn_data(uword value) { spawn_data_ = value; }
@@ -673,7 +665,6 @@
MessageHandler* message_handler_;
uword spawn_data_;
bool is_runnable_;
- IsolateRunState running_state_;
GcPrologueCallbacks gc_prologue_callbacks_;
GcEpilogueCallbacks gc_epilogue_callbacks_;
intptr_t defer_finalization_count_;
@@ -883,29 +874,6 @@
char* exception_callback_name_;
};
-
-class IsolateRunStateManager : public StackResource {
- public:
- explicit IsolateRunStateManager()
- : StackResource(Isolate::Current()),
- saved_state_(Isolate::kIsolateWaiting) {
- saved_state_ = reinterpret_cast<Isolate*>(isolate())->running_state();
- }
-
- virtual ~IsolateRunStateManager() {
- reinterpret_cast<Isolate*>(isolate())->set_running_state(saved_state_);
- }
-
- void SetRunState(Isolate::IsolateRunState run_state) {
- reinterpret_cast<Isolate*>(isolate())->set_running_state(run_state);
- }
-
- private:
- Isolate::IsolateRunState saved_state_;
-
- DISALLOW_COPY_AND_ASSIGN(IsolateRunStateManager);
-};
-
} // namespace dart
#endif // VM_ISOLATE_H_
diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
index 045fced..1aec0bc 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -13,6 +13,11 @@
ASSERT(buffer != NULL);
buffer_ = buffer;
open_objects_ = 0;
+ arguments_ = NULL;
+ num_arguments_ = 0;
+ option_keys_ = NULL;
+ option_values_ = NULL;
+ num_options_ = 0;
}
@@ -80,7 +85,9 @@
void JSONStream::PrintValue(const char* s) {
PrintCommaIfNeeded();
- buffer_->Printf("\"%s\"", s);
+ buffer_->AddChar('"');
+ buffer_->AddEscapedString(s);
+ buffer_->AddChar('"');
}
@@ -96,7 +103,9 @@
intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
va_end(args);
ASSERT(len == len2);
- buffer_->Printf("\"%s\"", p);
+ buffer_->AddChar('"');
+ buffer_->AddEscapedString(p);
+ buffer_->AddChar('"');
free(p);
}
@@ -142,11 +151,28 @@
intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
va_end(args);
ASSERT(len == len2);
- buffer_->Printf("\"%s\"", p);
+ buffer_->AddChar('"');
+ buffer_->AddEscapedString(p);
+ buffer_->AddChar('"');
free(p);
}
+void JSONStream::SetArguments(const char** arguments, intptr_t num_arguments) {
+ arguments_ = arguments;
+ num_arguments_ = num_arguments;
+}
+
+
+void JSONStream::SetOptions(const char** option_keys,
+ const char** option_values,
+ intptr_t num_options) {
+ option_keys_ = option_keys;
+ option_values_ = option_values;
+ num_options_ = num_options;
+}
+
+
void JSONStream::PrintProperty(const char* name, const Object& o, bool ref) {
PrintPropertyName(name);
PrintValue(o, ref);
@@ -156,7 +182,10 @@
void JSONStream::PrintPropertyName(const char* name) {
ASSERT(name != NULL);
PrintCommaIfNeeded();
- buffer_->Printf("\"%s\":", name);
+ buffer_->AddChar('"');
+ buffer_->AddEscapedString(name);
+ buffer_->AddChar('"');
+ buffer_->AddChar(':');
}
diff --git a/runtime/vm/json_stream.h b/runtime/vm/json_stream.h
index 8afea7a..79b1c69 100644
--- a/runtime/vm/json_stream.h
+++ b/runtime/vm/json_stream.h
@@ -39,12 +39,33 @@
PRINTF_ATTRIBUTE(3, 4);
void PrintProperty(const char* name, const Object& o, bool ref = true);
+ void SetArguments(const char** arguments, intptr_t num_arguments);
+ void SetOptions(const char** option_keys, const char** option_values,
+ intptr_t num_options);
+
+ intptr_t num_arguments() const { return num_arguments_; }
+ const char* GetArgument(intptr_t i) const {
+ return arguments_[i];
+ }
+ intptr_t num_options() const { return num_options_; }
+ const char* GetOptionKey(intptr_t i) const {
+ return option_keys_[i];
+ }
+ const char* GetOptionValue(intptr_t i) const {
+ return option_values_[i];
+ }
+
private:
void PrintPropertyName(const char* name);
void PrintCommaIfNeeded();
bool NeedComma();
intptr_t open_objects_;
TextBuffer* buffer_;
+ const char** arguments_;
+ intptr_t num_arguments_;
+ const char** option_keys_;
+ const char** option_values_;
+ intptr_t num_options_;
};
} // namespace dart
diff --git a/runtime/vm/json_test.cc b/runtime/vm/json_test.cc
index 39a8eee..bdbfc26 100644
--- a/runtime/vm/json_test.cc
+++ b/runtime/vm/json_test.cc
@@ -251,5 +251,12 @@
tb.buf());
}
+TEST_CASE(JSON_JSONStream_EscapedString) {
+ TextBuffer tb(256);
+ JSONStream js(&tb);
+ js.PrintValue("Hel\"\"lo\r\n\t");
+ EXPECT_STREQ("\"Hel\\\"\\\"lo\\r\\n\\t\"", tb.buf());
+}
+
} // namespace dart
diff --git a/runtime/vm/mirrors_api_impl.cc b/runtime/vm/mirrors_api_impl.cc
index 21c690f..e463b20 100644
--- a/runtime/vm/mirrors_api_impl.cc
+++ b/runtime/vm/mirrors_api_impl.cc
@@ -19,32 +19,6 @@
namespace dart {
-// When we want to return a handle to a type to the user, we handle
-// class-types differently than some other types.
-static Dart_Handle TypeToHandle(Isolate* isolate,
- const char* function_name,
- const AbstractType& type) {
- if (type.IsMalformed()) {
- const Error& error = Error::Handle(type.malformed_error());
- return Api::NewError("%s: malformed type encountered: %s.",
- function_name, error.ToErrorCString());
- } else if (type.HasResolvedTypeClass()) {
- const Class& cls = Class::Handle(isolate, type.type_class());
-#if defined(DEBUG)
- const Library& lib = Library::Handle(cls.library());
- if (lib.IsNull()) {
- ASSERT(cls.IsDynamicClass() || cls.IsVoidClass());
- }
-#endif
- return Api::NewHandle(isolate, cls.raw());
- } else if (type.IsTypeParameter()) {
- return Api::NewHandle(isolate, type.raw());
- } else {
- return Api::NewError("%s: unexpected type '%s' encountered.",
- function_name, type.ToCString());
- }
-}
-
// --- Classes and Interfaces Reflection ---
@@ -61,159 +35,6 @@
}
}
-
-DART_EXPORT Dart_Handle Dart_ClassGetLibrary(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
-
-#if defined(DEBUG)
- const Library& lib = Library::Handle(cls.library());
- if (lib.IsNull()) {
- // ASSERT(cls.IsDynamicClass() || cls.IsVoidClass());
- if (!cls.IsDynamicClass() && !cls.IsVoidClass()) {
- fprintf(stderr, "NO LIBRARY: %s\n", cls.ToCString());
- }
- }
-#endif
-
- return Api::NewHandle(isolate, cls.library());
-}
-
-
-DART_EXPORT Dart_Handle Dart_ClassGetInterfaceCount(Dart_Handle object,
- intptr_t* count) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- const Array& interface_types = Array::Handle(isolate, cls.interfaces());
- if (interface_types.IsNull()) {
- *count = 0;
- } else {
- *count = interface_types.Length();
- }
- return Api::Success();
-}
-
-
-DART_EXPORT Dart_Handle Dart_ClassGetInterfaceAt(Dart_Handle object,
- intptr_t index) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
-
- // Finalize all classes.
- Dart_Handle state = Api::CheckIsolateState(isolate);
- if (::Dart_IsError(state)) {
- return state;
- }
-
- const Array& interface_types = Array::Handle(isolate, cls.interfaces());
- if (index < 0 || index >= interface_types.Length()) {
- return Api::NewError("%s: argument 'index' out of bounds.", CURRENT_FUNC);
- }
- Type& interface_type = Type::Handle(isolate);
- interface_type ^= interface_types.At(index);
- if (interface_type.HasResolvedTypeClass()) {
- return Api::NewHandle(isolate, interface_type.type_class());
- }
- const String& type_name =
- String::Handle(isolate, interface_type.TypeClassName());
- return Api::NewError("%s: internal error: found unresolved type class '%s'.",
- CURRENT_FUNC, type_name.ToCString());
-}
-
-
-DART_EXPORT bool Dart_ClassIsTypedef(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- // For now we represent typedefs as non-canonical signature classes.
- // I anticipate this may change if we make typedefs more general.
- return cls.IsSignatureClass() && !cls.IsCanonicalSignatureClass();
-}
-
-
-DART_EXPORT Dart_Handle Dart_ClassGetTypedefReferent(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- if (!cls.IsSignatureClass() && !cls.IsCanonicalSignatureClass()) {
- const String& cls_name = String::Handle(cls.UserVisibleName());
- return Api::NewError("%s: class '%s' is not a typedef class. "
- "See Dart_ClassIsTypedef.",
- CURRENT_FUNC, cls_name.ToCString());
- }
-
- const Function& func = Function::Handle(isolate, cls.signature_function());
- return Api::NewHandle(isolate, func.signature_class());
-}
-
-
-DART_EXPORT bool Dart_ClassIsFunctionType(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- // Ensure all classes are finalized.
- Dart_Handle state = Api::CheckIsolateState(isolate);
- if (::Dart_IsError(state)) {
- return state;
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- // A class represents a function type when it is a canonical
- // signature class.
- return cls.IsCanonicalSignatureClass();
-}
-
-
-DART_EXPORT Dart_Handle Dart_ClassGetFunctionTypeSignature(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- if (!cls.IsCanonicalSignatureClass()) {
- const String& cls_name = String::Handle(cls.UserVisibleName());
- return Api::NewError("%s: class '%s' is not a function-type class. "
- "See Dart_ClassIsFunctionType.",
- CURRENT_FUNC, cls_name.ToCString());
- }
- return Api::NewHandle(isolate, cls.signature_function());
-}
-
-
// --- Function and Variable Reflection ---
// Outside of the vm, we expose setter names with a trailing '='.
@@ -423,22 +244,6 @@
}
-DART_EXPORT Dart_Handle Dart_FunctionIsAbstract(Dart_Handle function,
- bool* is_abstract) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- if (is_abstract == NULL) {
- RETURN_NULL_ERROR(is_abstract);
- }
- const Function& func = Api::UnwrapFunctionHandle(isolate, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(isolate, function, Function);
- }
- *is_abstract = func.is_abstract();
- return Api::Success();
-}
-
-
DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function,
bool* is_static) {
Isolate* isolate = Isolate::Current();
@@ -503,352 +308,6 @@
}
-DART_EXPORT Dart_Handle Dart_FunctionReturnType(Dart_Handle function) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Function& func = Api::UnwrapFunctionHandle(isolate, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(isolate, function, Function);
- }
- // Ensure all classes are finalized.
- Dart_Handle state = Api::CheckIsolateState(isolate);
- if (::Dart_IsError(state)) {
- return state;
- }
- if (func.kind() == RawFunction::kConstructor) {
- // Special case the return type for constructors. Inside the vm
- // we mark them as returning dynamic, but for the purposes of
- // reflection, they return the type of the class being
- // constructed.
- return Api::NewHandle(isolate, func.Owner());
- } else {
- const AbstractType& return_type =
- AbstractType::Handle(isolate, func.result_type());
- return TypeToHandle(isolate, "Dart_FunctionReturnType", return_type);
- }
-}
-
-
-DART_EXPORT Dart_Handle Dart_FunctionParameterCounts(
- Dart_Handle function,
- int64_t* fixed_param_count,
- int64_t* opt_param_count) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- if (fixed_param_count == NULL) {
- RETURN_NULL_ERROR(fixed_param_count);
- }
- if (opt_param_count == NULL) {
- RETURN_NULL_ERROR(opt_param_count);
- }
- const Function& func = Api::UnwrapFunctionHandle(isolate, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(isolate, function, Function);
- }
-
- // We hide implicit parameters, such as a method's receiver. This is
- // consistent with Invoke or New, which don't expect their callers to
- // provide them in the argument lists they are handed.
- *fixed_param_count = func.num_fixed_parameters() -
- func.NumImplicitParameters();
- // TODO(regis): Separately report named and positional optional param counts.
- *opt_param_count = func.NumOptionalParameters();
-
- ASSERT(*fixed_param_count >= 0);
- ASSERT(*opt_param_count >= 0);
-
- return Api::Success();
-}
-
-
-DART_EXPORT Dart_Handle Dart_FunctionParameterType(Dart_Handle function,
- int parameter_index) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Function& func = Api::UnwrapFunctionHandle(isolate, function);
- if (func.IsNull()) {
- RETURN_TYPE_ERROR(isolate, function, Function);
- }
- // Ensure all classes are finalized.
- Dart_Handle state = Api::CheckIsolateState(isolate);
- if (::Dart_IsError(state)) {
- return state;
- }
- const intptr_t num_implicit_params = func.NumImplicitParameters();
- const intptr_t num_params = func.NumParameters() - num_implicit_params;
- if (parameter_index < 0 || parameter_index >= num_params) {
- return Api::NewError(
- "%s: argument 'parameter_index' out of range. "
- "Expected 0..%"Pd" but saw %d.",
- CURRENT_FUNC, num_params, parameter_index);
- }
- const AbstractType& param_type =
- AbstractType::Handle(isolate, func.ParameterTypeAt(
- num_implicit_params + parameter_index));
- return TypeToHandle(isolate, "Dart_FunctionParameterType", param_type);
-}
-
-
-DART_EXPORT Dart_Handle Dart_GetVariableNames(Dart_Handle target) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target));
- if (obj.IsError()) {
- return target;
- }
-
- const GrowableObjectArray& names =
- GrowableObjectArray::Handle(isolate, GrowableObjectArray::New());
- Field& field = Field::Handle(isolate);
- String& name = String::Handle(isolate);
-
- if (obj.IsType() || obj.IsClass()) {
- // For backwards compatibility we allow class objects to be passed in
- // for now. This needs to be removed once all code that uses class
- // objects to invoke Dart_Invoke is removed.
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate));
- if (!error.IsNull()) {
- return Api::NewHandle(isolate, error.raw());
- }
- const Array& field_array = Array::Handle(cls.fields());
-
- // Some special types like 'dynamic' have a null fields list.
- //
- // TODO(turnidge): Fix 'dynamic' so that it does not have a null
- // fields list. This will have to wait until the empty array is
- // allocated in the vm isolate.
- if (!field_array.IsNull()) {
- for (intptr_t i = 0; i < field_array.Length(); ++i) {
- field ^= field_array.At(i);
- name = field.UserVisibleName();
- names.Add(name);
- }
- }
- } else if (obj.IsLibrary()) {
- const Library& lib = Library::Cast(obj);
- DictionaryIterator it(lib);
- Object& obj = Object::Handle(isolate);
- while (it.HasNext()) {
- obj = it.GetNext();
- if (obj.IsField()) {
- field ^= obj.raw();
- name = field.UserVisibleName();
- names.Add(name);
- }
- }
- } else {
- return Api::NewError(
- "%s expects argument 'target' to be a class or library.",
- CURRENT_FUNC);
- }
- return Api::NewHandle(isolate, Array::MakeArray(names));
-}
-
-
-DART_EXPORT Dart_Handle Dart_LookupVariable(Dart_Handle target,
- Dart_Handle variable_name) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(target));
- if (obj.IsError()) {
- return target;
- }
- const String& var_name = Api::UnwrapStringHandle(isolate, variable_name);
- if (var_name.IsNull()) {
- RETURN_TYPE_ERROR(isolate, variable_name, String);
- }
- if (obj.IsType() || obj.IsClass()) {
- // For backwards compatibility we allow class objects to be passed in
- // for now. This needs to be removed once all code that uses class
- // objects to invoke Dart_Invoke is removed.
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- return Api::NewHandle(isolate, cls.LookupField(var_name));
- }
- if (obj.IsLibrary()) {
- const Library& lib = Library::Cast(obj);
- String& ambiguity_error_msg = String::Handle(isolate);
- const Field& variable = Field::Handle(
- lib.LookupFieldAllowPrivate(var_name, &ambiguity_error_msg));
- if (!ambiguity_error_msg.IsNull()) {
- return Api::NewError("%s.", ambiguity_error_msg.ToCString());
- }
- return Api::NewHandle(isolate, variable.raw());
- }
- return Api::NewError(
- "%s expects argument 'target' to be a class or library.",
- CURRENT_FUNC);
-}
-
-
-DART_EXPORT Dart_Handle Dart_VariableName(Dart_Handle variable) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Field& var = Api::UnwrapFieldHandle(isolate, variable);
- if (var.IsNull()) {
- RETURN_TYPE_ERROR(isolate, variable, Field);
- }
- return Api::NewHandle(isolate, var.UserVisibleName());
-}
-
-
-DART_EXPORT Dart_Handle Dart_VariableIsStatic(Dart_Handle variable,
- bool* is_static) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- if (is_static == NULL) {
- RETURN_NULL_ERROR(is_static);
- }
- const Field& var = Api::UnwrapFieldHandle(isolate, variable);
- if (var.IsNull()) {
- RETURN_TYPE_ERROR(isolate, variable, Field);
- }
- *is_static = var.is_static();
- return Api::Success();
-}
-
-
-DART_EXPORT Dart_Handle Dart_VariableIsFinal(Dart_Handle variable,
- bool* is_final) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- if (is_final == NULL) {
- RETURN_NULL_ERROR(is_final);
- }
- const Field& var = Api::UnwrapFieldHandle(isolate, variable);
- if (var.IsNull()) {
- RETURN_TYPE_ERROR(isolate, variable, Field);
- }
- *is_final = var.is_final();
- return Api::Success();
-}
-
-
-DART_EXPORT Dart_Handle Dart_VariableType(Dart_Handle variable) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Field& var = Api::UnwrapFieldHandle(isolate, variable);
- if (var.IsNull()) {
- RETURN_TYPE_ERROR(isolate, variable, Field);
- }
- // Ensure all classes are finalized.
- Dart_Handle state = Api::CheckIsolateState(isolate);
- if (::Dart_IsError(state)) {
- return state;
- }
- const AbstractType& type = AbstractType::Handle(isolate, var.type());
- return TypeToHandle(isolate, "Dart_VariableType", type);
-}
-
-
-DART_EXPORT Dart_Handle Dart_GetTypeVariableNames(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- // Ensure all classes are finalized.
- Dart_Handle state = Api::CheckIsolateState(isolate);
- if (::Dart_IsError(state)) {
- return state;
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- const intptr_t num_type_params = cls.NumTypeParameters();
- const TypeArguments& type_params =
- TypeArguments::Handle(cls.type_parameters());
-
- const GrowableObjectArray& names =
- GrowableObjectArray::Handle(isolate, GrowableObjectArray::New());
- TypeParameter& type_param = TypeParameter::Handle(isolate);
- String& name = String::Handle(isolate);
- for (intptr_t i = 0; i < num_type_params; i++) {
- type_param ^= type_params.TypeAt(i);
- name = type_param.name();
- names.Add(name);
- }
- return Api::NewHandle(isolate, Array::MakeArray(names));
-}
-
-
-DART_EXPORT Dart_Handle Dart_LookupTypeVariable(
- Dart_Handle object,
- Dart_Handle type_variable_name) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- if (!obj.IsType() && !obj.IsClass()) {
- RETURN_TYPE_ERROR(isolate, object, Class/Type);
- }
- const Class& cls = (obj.IsType()) ?
- Class::Handle(Type::Cast(obj).type_class()) : Class::Cast(obj);
- const String& var_name = Api::UnwrapStringHandle(isolate, type_variable_name);
- if (var_name.IsNull()) {
- RETURN_TYPE_ERROR(isolate, type_variable_name, String);
- }
-
- const intptr_t num_type_params = cls.NumTypeParameters();
- const TypeArguments& type_params =
- TypeArguments::Handle(cls.type_parameters());
-
- TypeParameter& type_param = TypeParameter::Handle(isolate);
- String& name = String::Handle(isolate);
- for (intptr_t i = 0; i < num_type_params; i++) {
- type_param ^= type_params.TypeAt(i);
- name = type_param.name();
- if (name.Equals(var_name)) {
- return Api::NewHandle(isolate, type_param.raw());
- }
- }
- const String& cls_name = String::Handle(cls.UserVisibleName());
- return Api::NewError(
- "%s: Could not find type variable named '%s' for class %s.\n",
- CURRENT_FUNC, var_name.ToCString(), cls_name.ToCString());
-}
-
-
-DART_EXPORT Dart_Handle Dart_TypeVariableName(Dart_Handle type_variable) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const TypeParameter& type_var =
- Api::UnwrapTypeParameterHandle(isolate, type_variable);
- if (type_var.IsNull()) {
- RETURN_TYPE_ERROR(isolate, type_variable, TypeParameter);
- }
- return Api::NewHandle(isolate, type_var.name());
-}
-
-
-DART_EXPORT Dart_Handle Dart_TypeVariableOwner(Dart_Handle type_variable) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const TypeParameter& type_var =
- Api::UnwrapTypeParameterHandle(isolate, type_variable);
- if (type_var.IsNull()) {
- RETURN_TYPE_ERROR(isolate, type_variable, TypeParameter);
- }
- const Class& owner = Class::Handle(type_var.parameterized_class());
- ASSERT(!owner.IsNull() && owner.IsClass());
- return Api::NewHandle(isolate, owner.raw());
-}
-
-
-DART_EXPORT Dart_Handle Dart_TypeVariableUpperBound(Dart_Handle type_variable) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const TypeParameter& type_var =
- Api::UnwrapTypeParameterHandle(isolate, type_variable);
- if (type_var.IsNull()) {
- RETURN_TYPE_ERROR(isolate, type_variable, TypeParameter);
- }
- const AbstractType& bound = AbstractType::Handle(type_var.bound());
- return TypeToHandle(isolate, "Dart_TypeVariableUpperBound", bound);
-}
-
-
// --- Libraries Reflection ---
DART_EXPORT Dart_Handle Dart_LibraryName(Dart_Handle library) {
@@ -912,26 +371,4 @@
return Api::NewHandle(isolate, rf);
}
-
-// --- Metadata Reflection ----
-
-DART_EXPORT Dart_Handle Dart_GetMetadata(Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- CHECK_ISOLATE(isolate);
- DARTSCOPE(isolate);
- const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(object));
- Class& cls = Class::Handle(isolate);
- if (obj.IsClass()) {
- cls ^= obj.raw();
- } else if (obj.IsFunction()) {
- cls = Function::Cast(obj).origin();
- } else if (obj.IsField()) {
- cls = Field::Cast(obj).origin();
- } else {
- return Api::NewHandle(isolate, Object::empty_array().raw());
- }
- const Library& lib = Library::Handle(cls.library());
- return Api::NewHandle(isolate, lib.GetMetadata(obj));
-}
-
} // namespace dart
diff --git a/runtime/vm/native_arguments.cc b/runtime/vm/native_arguments.cc
deleted file mode 100644
index 1175064..0000000
--- a/runtime/vm/native_arguments.cc
+++ /dev/null
@@ -1,20 +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.
-
-#include "vm/native_arguments.h"
-
-#include "platform/assert.h"
-#include "vm/object.h"
-
-namespace dart {
-
-void NativeArguments::SetReturn(const Object& value) const {
- *retval_ = value.raw();
-}
-
-void NativeArguments::SetReturnUnsafe(RawObject* value) const {
- *retval_ = value;
-}
-
-} // namespace dart
diff --git a/runtime/vm/native_arguments.h b/runtime/vm/native_arguments.h
index 9be5e0e..281e224 100644
--- a/runtime/vm/native_arguments.h
+++ b/runtime/vm/native_arguments.h
@@ -7,11 +7,16 @@
#include "platform/assert.h"
#include "vm/globals.h"
+#include "vm/handles_impl.h"
#include "vm/simulator.h"
#include "vm/stub_code.h"
namespace dart {
+DECLARE_FLAG(bool, deoptimize_alot);
+DECLARE_FLAG(bool, trace_natives);
+DECLARE_FLAG(bool, verify_on_transition);
+
// Forward declarations.
class BootstrapNatives;
class Isolate;
@@ -19,7 +24,6 @@
class RawObject;
class Simulator;
-
#if defined(TESTING) || defined(DEBUG)
#if defined(USING_SIMULATOR)
@@ -41,9 +45,26 @@
}
#endif
+#define VERIFY_ON_TRANSITION \
+ if (FLAG_verify_on_transition) { \
+ VerifyPointersVisitor::VerifyPointers(); \
+ Isolate::Current()->heap()->Verify(); \
+ }
+#define TRACE_NATIVES(name) \
+ if (FLAG_trace_natives) { \
+ OS::Print("Calling native: %s\n", name); \
+ }
+#define DEOPTIMIZE_ALOT \
+ if (FLAG_deoptimize_alot) { \
+ DeoptimizeAll(); \
+ }
+
#else
#define CHECK_STACK_ALIGNMENT { }
+#define VERIFY_ON_TRANSITION { }
+#define TRACE_NATIVES(name) { }
+#define DEOPTIMIZE_ALOT { }
#endif
@@ -110,7 +131,9 @@
}
}
- void SetReturn(const Object& value) const;
+ void SetReturn(const Object& value) const {
+ *retval_ = value.raw();
+ }
static intptr_t isolate_offset() {
return OFFSET_OF(NativeArguments, isolate_);
@@ -164,7 +187,9 @@
// exceedingly careful when we use it. If there are any other side
// effects in the statement that may cause GC, it could lead to
// bugs.
- void SetReturnUnsafe(RawObject* value) const;
+ void SetReturnUnsafe(RawObject* value) const {
+ *retval_ = value;
+ }
Isolate* isolate_; // Current isolate pointer.
int argc_tag_; // Encodes argument count and invoked native call type.
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index f53bad6..25b0697 100644
--- a/runtime/vm/native_entry.cc
+++ b/runtime/vm/native_entry.cc
@@ -7,16 +7,22 @@
#include "include/dart_api.h"
#include "vm/dart_api_impl.h"
+#include "vm/dart_api_state.h"
namespace dart {
DEFINE_FLAG(bool, trace_natives, false, "Trace invocation of natives");
-NativeFunction NativeEntry::ResolveNative(const Class& cls,
+
+static ExternalLabel native_call_label(
+ "native_function_call",
+ reinterpret_cast<uword>(&NativeEntry::NativeCallWrapper));
+
+
+NativeFunction NativeEntry::ResolveNative(const Library& library,
const String& function_name,
int number_of_arguments) {
// Now resolve the native function to the corresponding native entrypoint.
- const Library& library = Library::Handle(cls.library());
if (library.native_entry_resolver() == 0) {
// Native methods are not allowed in the library to which this
// class belongs in.
@@ -31,4 +37,47 @@
return reinterpret_cast<NativeFunction>(native_function);
}
+
+const ExternalLabel& NativeEntry::NativeCallWrapperLabel() {
+ return native_call_label;
+}
+
+
+void NativeEntry::NativeCallWrapper(Dart_NativeArguments args,
+ Dart_NativeFunction func) {
+ CHECK_STACK_ALIGNMENT;
+ VERIFY_ON_TRANSITION;
+ NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
+ Isolate* isolate = arguments->isolate();
+ ApiState* state = isolate->api_state();
+ ASSERT(state != NULL);
+ ApiLocalScope* current_top_scope = state->top_scope();
+ ApiLocalScope* scope = state->reusable_scope();
+ if (scope == NULL) {
+ scope = new ApiLocalScope(current_top_scope,
+ isolate->top_exit_frame_info());
+ ASSERT(scope != NULL);
+ } else {
+ scope->Reinit(isolate,
+ current_top_scope,
+ isolate->top_exit_frame_info());
+ state->set_reusable_scope(NULL);
+ }
+ state->set_top_scope(scope); // New scope is now the top scope.
+
+ func(args);
+
+ ASSERT(current_top_scope == scope->previous());
+ state->set_top_scope(current_top_scope); // Reset top scope to previous.
+ if (state->reusable_scope() == NULL) {
+ scope->Reset(isolate); // Reset the old scope which we just exited.
+ state->set_reusable_scope(scope);
+ } else {
+ ASSERT(state->reusable_scope() != scope);
+ delete scope;
+ }
+ DEOPTIMIZE_ALOT;
+ VERIFY_ON_TRANSITION;
+}
+
} // namespace dart
diff --git a/runtime/vm/native_entry.h b/runtime/vm/native_entry.h
index 09b5f7f..e6d6c8c 100644
--- a/runtime/vm/native_entry.h
+++ b/runtime/vm/native_entry.h
@@ -16,9 +16,6 @@
namespace dart {
-DECLARE_FLAG(bool, deoptimize_alot);
-DECLARE_FLAG(bool, trace_natives);
-
// Forward declarations.
class Class;
class String;
@@ -46,13 +43,12 @@
VERIFY_ON_TRANSITION; \
NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \
ASSERT(arguments->NativeArgCount() == argument_count); \
- if (FLAG_trace_natives) OS::Print("Calling native: %s\n", ""#name); \
+ TRACE_NATIVES(""#name); \
{ \
StackZone zone(arguments->isolate()); \
- HANDLESCOPE(arguments->isolate()); \
SET_NATIVE_RETVAL(arguments, \
DN_Helper##name(arguments->isolate(), arguments)); \
- if (FLAG_deoptimize_alot) DeoptimizeAll(); \
+ DEOPTIMIZE_ALOT; \
} \
VERIFY_ON_TRANSITION; \
} \
@@ -92,10 +88,15 @@
// Helper class for resolving and handling native functions.
class NativeEntry : public AllStatic {
public:
+ static const intptr_t kNumCallWrapperArguments = 2;
+
// Resolve specified dart native function to the actual native entrypoint.
- static NativeFunction ResolveNative(const Class& cls,
+ static NativeFunction ResolveNative(const Library& library,
const String& function_name,
int number_of_arguments);
+ static void NativeCallWrapper(Dart_NativeArguments args,
+ Dart_NativeFunction func);
+ static const ExternalLabel& NativeCallWrapperLabel();
};
} // namespace dart
diff --git a/runtime/vm/native_entry_test.cc b/runtime/vm/native_entry_test.cc
index c8276f1..875bb30 100644
--- a/runtime/vm/native_entry_test.cc
+++ b/runtime/vm/native_entry_test.cc
@@ -21,7 +21,6 @@
// Arg1: a smi.
// Result: a smi representing arg0 - arg1.
void TestSmiSub(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle left = Dart_GetNativeArgument(args, 0);
Dart_Handle right = Dart_GetNativeArgument(args, 1);
int64_t left_value = -1;
@@ -32,7 +31,6 @@
// Ignoring overflow in the calculation below.
int64_t result = left_value - right_value;
Dart_SetReturnValue(args, Dart_NewInteger(result));
- Dart_ExitScope();
}
@@ -40,7 +38,6 @@
// Arg0-4: 5 smis.
// Result: a smi representing the sum of all arguments.
void TestSmiSum(Dart_NativeArguments args) {
- Dart_EnterScope();
int64_t result = 0;
int arg_count = Dart_GetNativeArgumentCount(args);
for (int i = 0; i < arg_count; i++) {
@@ -52,7 +49,6 @@
result += arg_value;
}
Dart_SetReturnValue(args, Dart_NewInteger(result));
- Dart_ExitScope();
}
@@ -60,7 +56,6 @@
// Arg0-4: 5 smis or null.
// Result: a smi representing the sum of all non-null arguments.
void TestNonNullSmiSum(Dart_NativeArguments args) {
- Dart_EnterScope();
Isolate* isolate = Isolate::Current();
int64_t result = 0;
int arg_count = Dart_GetNativeArgumentCount(args);
@@ -84,7 +79,6 @@
}
}
Dart_SetReturnValue(args, Dart_NewInteger(result));
- Dart_ExitScope();
}
} // namespace dart
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 0223cb1..29c3262 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -146,10 +146,10 @@
V(CoreLibrary, Object, _as) \
V(CoreLibrary, Object, _instanceOf) \
V(CoreLibrary, _ObjectArray, _ObjectArray.) \
- V(CoreLibrary, _AssertionErrorImplementation, _throwNew) \
- V(CoreLibrary, _TypeErrorImplementation, _throwNew) \
- V(CoreLibrary, _FallThroughErrorImplementation, _throwNew) \
- V(CoreLibrary, _AbstractClassInstantiationErrorImplementation, _throwNew) \
+ V(CoreLibrary, AssertionError, _throwNew) \
+ V(CoreLibrary, TypeError, _throwNew) \
+ V(CoreLibrary, FallThroughError, _throwNew) \
+ V(CoreLibrary, AbstractClassInstantiationError, _throwNew) \
V(CoreLibrary, NoSuchMethodError, _throwNew) \
V(CoreLibrary, int, _throwFormatException) \
V(CoreLibrary, int, _parse) \
@@ -1925,6 +1925,15 @@
// new private methods.
Function& func = Function::Handle();
Function& orig_func = Function::Handle();
+ // Lookup the original implicit constructor, if any.
+ member_name = Name();
+ member_name = String::Concat(member_name, Symbols::Dot());
+ Function& orig_implicit_ctor = Function::Handle(LookupFunction(member_name));
+ if (!orig_implicit_ctor.IsNull() &&
+ !orig_implicit_ctor.IsImplicitConstructor()) {
+ // Not an implicit constructor, but a user declared one.
+ orig_implicit_ctor = Function::null();
+ }
const GrowableObjectArray& new_functions = GrowableObjectArray::Handle(
GrowableObjectArray::New(orig_len));
for (intptr_t i = 0; i < orig_len; i++) {
@@ -1934,7 +1943,11 @@
if (func.IsNull()) {
// Non-patched function is preserved, all patched functions are added in
// the loop below.
- new_functions.Add(orig_func);
+ // However, an implicitly created constructor should not be preserved if
+ // the patch provides a constructor or a factory. Wait for now.
+ if (orig_func.raw() != orig_implicit_ctor.raw()) {
+ new_functions.Add(orig_func);
+ }
} else if (!func.HasCompatibleParametersWith(orig_func) &&
!(func.IsFactory() && orig_func.IsConstructor() &&
(func.num_fixed_parameters() + 1 ==
@@ -1944,9 +1957,17 @@
}
for (intptr_t i = 0; i < patch_len; i++) {
func ^= patch_list.At(i);
+ if (func.IsConstructor() || func.IsFactory()) {
+ // Do not preserve the original implicit constructor, if any.
+ orig_implicit_ctor = Function::null();
+ }
func.set_owner(patch_class);
new_functions.Add(func);
}
+ if (!orig_implicit_ctor.IsNull()) {
+ // Preserve the original implicit constructor.
+ new_functions.Add(orig_implicit_ctor);
+ }
Array& new_list = Array::Handle(Array::MakeArray(new_functions));
SetFunctions(new_list);
@@ -9231,12 +9252,20 @@
ASSERT(target != NULL);
ASSERT(num_args_tested() == 1);
const Array& data = Array::Handle(ic_data());
- intptr_t data_pos = index * TestEntryLength();
+ const intptr_t data_pos = index * TestEntryLength();
*class_id = Smi::Value(Smi::RawCast(data.At(data_pos)));
*target ^= data.At(data_pos + 1);
}
+intptr_t ICData::GetCidAt(intptr_t index) const {
+ ASSERT(num_args_tested() == 1);
+ const Array& data = Array::Handle(ic_data());
+ const intptr_t data_pos = index * TestEntryLength();
+ return Smi::Value(Smi::RawCast(data.At(data_pos)));
+}
+
+
intptr_t ICData::GetClassIdAt(intptr_t index, intptr_t arg_nr) const {
GrowableArray<intptr_t> class_ids;
Function& target = Function::Handle();
@@ -14490,6 +14519,11 @@
stream->CloseObject();
}
+RawAbstractType* MirrorReference::GetAbstractTypeReferent() const {
+ ASSERT(Object::Handle(referent()).IsAbstractType());
+ return AbstractType::Cast(Object::Handle(referent())).raw();
+}
+
RawClass* MirrorReference::GetClassReferent() const {
ASSERT(Object::Handle(referent()).IsClass());
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 39142ab..a1455845 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1962,6 +1962,7 @@
// to have or kDynamicCid if such class id is not known.
// Stores to this field must update this information hence the name.
intptr_t guarded_cid() const { return raw_ptr()->guarded_cid_; }
+
void set_guarded_cid(intptr_t cid) const {
raw_ptr()->guarded_cid_ = cid;
}
@@ -1969,6 +1970,10 @@
return OFFSET_OF(RawField, guarded_cid_);
}
+ static bool IsExternalizableCid(intptr_t cid) {
+ return (cid == kOneByteStringCid) || (cid == kTwoByteStringCid);
+ }
+
// Returns false if any value read from this field is guaranteed to be
// not null.
// Internally we is_nullable_ field contains either kNullCid (nullable) or
@@ -3327,6 +3332,9 @@
void GetOneClassCheckAt(intptr_t index,
intptr_t* class_id,
Function* target) const;
+ // Only for 'num_args_checked == 1'.
+ intptr_t GetCidAt(intptr_t index) const;
+
intptr_t GetReceiverClassIdAt(intptr_t index) const;
intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const;
@@ -5349,7 +5357,7 @@
}
- TypeDataElementType ElementType() const {
+ TypedDataElementType ElementType() const {
intptr_t cid = raw()->GetClassId();
return ElementType(cid);
}
@@ -5383,6 +5391,8 @@
TYPED_GETTER_SETTER(Float64, double)
TYPED_GETTER_SETTER(Float32x4, simd128_value_t)
+#undef TYPED_GETTER_SETTER
+
static intptr_t length_offset() {
return OFFSET_OF(RawTypedData, length_);
}
@@ -5406,9 +5416,9 @@
return element_size[ElementType(class_id)];
}
- static TypeDataElementType ElementType(intptr_t class_id) {
+ static TypedDataElementType ElementType(intptr_t class_id) {
ASSERT(RawObject::IsTypedDataClassId(class_id));
- return static_cast<TypeDataElementType>(
+ return static_cast<TypedDataElementType>(
class_id - kTypedDataInt8ArrayCid);
}
@@ -5475,7 +5485,7 @@
return ElementSizeInBytes(cid);
}
- TypeDataElementType ElementType() const {
+ TypedDataElementType ElementType() const {
intptr_t cid = raw()->GetClassId();
return ElementType(cid);
}
@@ -5513,6 +5523,8 @@
TYPED_GETTER_SETTER(Float64, double)
TYPED_GETTER_SETTER(Float32x4, simd128_value_t);
+#undef TYPED_GETTER_SETTER
+
FinalizablePersistentHandle* AddFinalizer(
void* peer, Dart_WeakPersistentHandleFinalizer callback) const;
@@ -5533,9 +5545,9 @@
return TypedData::element_size[ElementType(class_id)];
}
- static TypeDataElementType ElementType(intptr_t class_id) {
+ static TypedDataElementType ElementType(intptr_t class_id) {
ASSERT(RawObject::IsExternalTypedDataClassId(class_id));
- return static_cast<TypeDataElementType>(
+ return static_cast<TypedDataElementType>(
class_id - kExternalTypedDataInt8ArrayCid);
}
@@ -5893,6 +5905,8 @@
StorePointer(&raw_ptr()->referent_, referent.raw());
}
+ RawAbstractType* GetAbstractTypeReferent() const;
+
RawClass* GetClassReferent() const;
RawField* GetFieldReferent() const;
@@ -5984,9 +5998,7 @@
if (native_fields == TypedData::null()) {
return 0;
}
- intptr_t byte_offset = index * sizeof(intptr_t);
- return *reinterpret_cast<intptr_t*>(native_fields->ptr()->data_ +
- byte_offset);
+ return reinterpret_cast<intptr_t*>(native_fields->ptr()->data_)[index];
}
diff --git a/runtime/vm/object_id_ring.cc b/runtime/vm/object_id_ring.cc
index f7199bd..434463b 100644
--- a/runtime/vm/object_id_ring.cc
+++ b/runtime/vm/object_id_ring.cc
@@ -129,6 +129,9 @@
if (id == kInvalidId) {
return false;
}
+ if (id < 0) {
+ return false;
+ }
if (id >= max_serial_) {
return false;
}
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index fd433b9..25e7fcb 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -1613,7 +1613,7 @@
uint16_t monkey_utf16[] = { 0xd83d, 0xdc35 }; // Unicode Monkey Face.
String& monkey = String::Handle(Symbols::FromUTF16(monkey_utf16, 2));
EXPECT(monkey.IsSymbol());
- const char monkey_utf8[] = {0xf0, 0x9f, 0x90, 0xb5, 0};
+ const char monkey_utf8[] = {'\xf0', '\x9f', '\x90', '\xb5', 0};
EXPECT_EQ(monkey.raw(), Symbols::New(monkey_utf8));
int32_t kMonkeyFace = 0x1f435;
@@ -2514,6 +2514,7 @@
o1.GetOneClassCheckAt(0, &test_class_id, &test_target);
EXPECT_EQ(kSmiCid, test_class_id);
EXPECT_EQ(target1.raw(), test_target.raw());
+ EXPECT_EQ(kSmiCid, o1.GetCidAt(0));
GrowableArray<intptr_t> test_class_ids;
o1.GetCheckAt(0, &test_class_ids, &test_target);
EXPECT_EQ(1, test_class_ids.length());
@@ -2526,6 +2527,7 @@
o1.GetOneClassCheckAt(1, &test_class_id, &test_target);
EXPECT_EQ(kDoubleCid, test_class_id);
EXPECT_EQ(target2.raw(), test_target.raw());
+ EXPECT_EQ(kDoubleCid, o1.GetCidAt(1));
ICData& o2 = ICData::Handle();
o2 = ICData::New(function, target_name, args_descriptor, 57, 2);
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index d5a8dde..1060121 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -6,6 +6,7 @@
#include "lib/invocation_mirror.h"
#include "vm/bigint_operations.h"
+#include "vm/bootstrap.h"
#include "vm/class_finalizer.h"
#include "vm/compiler.h"
#include "vm/compiler_stats.h"
@@ -204,13 +205,15 @@
// block using 'return', 'break' or 'continue'.
class Parser::TryBlocks : public ZoneAllocated {
public:
- TryBlocks(Block* try_block, TryBlocks* outer_try_block)
+ TryBlocks(Block* try_block, TryBlocks* outer_try_block, intptr_t try_index)
: try_block_(try_block),
inlined_finally_nodes_(),
- outer_try_block_(outer_try_block) { }
+ outer_try_block_(outer_try_block),
+ try_index_(try_index) { }
TryBlocks* outer_try_block() const { return outer_try_block_; }
Block* try_block() const { return try_block_; }
+ intptr_t try_index() const { return try_index_; }
void AddNodeForFinallyInlining(AstNode* node);
AstNode* GetNodeToInlineFinally(int index) {
@@ -224,6 +227,7 @@
Block* try_block_;
GrowableArray<AstNode*> inlined_finally_nodes_;
TryBlocks* outer_try_block_;
+ const intptr_t try_index_;
DISALLOW_COPY_AND_ASSIGN(TryBlocks);
};
@@ -250,7 +254,8 @@
literal_token_(LiteralToken::Handle(isolate_)),
current_class_(Class::Handle(isolate_)),
library_(Library::Handle(isolate_, library.raw())),
- try_blocks_list_(NULL) {
+ try_blocks_list_(NULL),
+ last_used_try_index_(CatchClauseNode::kInvalidTryIndex) {
ASSERT(tokens_iterator_.IsValid());
ASSERT(!library.IsNull());
}
@@ -278,7 +283,8 @@
library_(Library::Handle(Class::Handle(
isolate_,
parsed_function->function().origin()).library())),
- try_blocks_list_(NULL) {
+ try_blocks_list_(NULL),
+ last_used_try_index_(CatchClauseNode::kInvalidTryIndex) {
ASSERT(tokens_iterator_.IsValid());
ASSERT(!current_function().IsNull());
if (FLAG_enable_type_checks) {
@@ -4737,8 +4743,8 @@
// declaration that follows the library definitions. Therefore, we
// need to remember the position of the last token that was
// successfully consumed.
- intptr_t metadata_pos = TokenPos();
- SkipMetadata();
+ intptr_t rewind_pos = TokenPos();
+ intptr_t metadata_pos = SkipMetadata();
if (CurrentToken() == Token::kLIBRARY) {
if (is_patch_source()) {
ErrorMsg("patch cannot override library name");
@@ -4747,14 +4753,14 @@
if (metadata_pos >= 0) {
library_.AddLibraryMetadata(current_class(), metadata_pos);
}
- metadata_pos = TokenPos();
- SkipMetadata();
+ rewind_pos = TokenPos();
+ metadata_pos = SkipMetadata();
}
while ((CurrentToken() == Token::kIMPORT) ||
(CurrentToken() == Token::kEXPORT)) {
ParseLibraryImportExport();
- metadata_pos = TokenPos();
- SkipMetadata();
+ rewind_pos = TokenPos();
+ metadata_pos = SkipMetadata();
}
// Core lib has not been explicitly imported, so we implicitly
// import it here.
@@ -4767,10 +4773,10 @@
}
while (CurrentToken() == Token::kPART) {
ParseLibraryPart();
- metadata_pos = TokenPos();
- SkipMetadata();
+ rewind_pos = TokenPos();
+ metadata_pos = SkipMetadata();
}
- SetPosition(metadata_pos);
+ SetPosition(rewind_pos);
}
@@ -5004,6 +5010,7 @@
func.set_is_native(true);
TRACE_PARSER("ParseNativeFunctionBlock");
const Class& cls = Class::Handle(func.Owner());
+ const Library& library = Library::Handle(cls.library());
ASSERT(func.NumParameters() == params->parameters->length());
// Parse the function name out.
@@ -5013,19 +5020,22 @@
// Now resolve the native function to the corresponding native entrypoint.
const int num_params = NativeArguments::ParameterCountForResolution(func);
NativeFunction native_function = NativeEntry::ResolveNative(
- cls, native_name, num_params);
+ library, native_name, num_params);
if (native_function == NULL) {
ErrorMsg(native_pos, "native function '%s' cannot be found",
native_name.ToCString());
}
// Now add the NativeBodyNode and return statement.
+ Dart_NativeEntryResolver resolver = library.native_entry_resolver();
+ bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
current_block_->statements->Add(
new ReturnNode(TokenPos(),
new NativeBodyNode(TokenPos(),
Function::ZoneHandle(func.raw()),
native_name,
- native_function)));
+ native_function,
+ is_bootstrap_native)));
}
@@ -5052,16 +5062,14 @@
void Parser::CaptureInstantiator() {
ASSERT(current_block_->scope->function_level() > 0);
- const bool kTestOnly = false;
- // Side effect of lookup captures the instantiator variable.
- LocalVariable* instantiator = NULL;
+ bool found = false;
if (current_function().IsInFactoryScope()) {
- instantiator = LookupTypeArgumentsParameter(current_block_->scope,
- kTestOnly);
+ found = current_block_->scope->CaptureVariable(
+ Symbols::TypeArgumentsParameter());
} else {
- instantiator = LookupReceiver(current_block_->scope, kTestOnly);
+ found = current_block_->scope->CaptureVariable(Symbols::This());
}
- ASSERT(instantiator != NULL);
+ ASSERT(found);
}
@@ -5130,8 +5138,17 @@
// Add variable to scope after parsing the initalizer expression.
// The expression must not be able to refer to the variable.
if (!current_block_->scope->AddVariable(variable)) {
- ErrorMsg(ident_pos, "identifier '%s' already defined",
- variable->name().ToCString());
+ LocalVariable* existing_var =
+ current_block_->scope->LookupVariable(variable->name(), true);
+ ASSERT(existing_var != NULL);
+ if (existing_var->owner() == current_block_->scope) {
+ ErrorMsg(ident_pos, "identifier '%s' already defined",
+ variable->name().ToCString());
+ } else {
+ ErrorMsg(ident_pos,
+ "'%s' from outer scope has already been used, cannot redefine",
+ variable->name().ToCString());
+ }
}
if (is_final || is_const) {
variable->set_is_final();
@@ -5290,8 +5307,18 @@
ASSERT(current_block_ != NULL);
ASSERT(current_block_->scope != NULL);
if (!current_block_->scope->AddVariable(function_variable)) {
- ErrorMsg(ident_pos, "identifier '%s' already defined",
- function_variable->name().ToCString());
+ LocalVariable* existing_var =
+ current_block_->scope->LookupVariable(function_variable->name(),
+ true);
+ ASSERT(existing_var != NULL);
+ if (existing_var->owner() == current_block_->scope) {
+ ErrorMsg(ident_pos, "identifier '%s' already defined",
+ function_variable->name().ToCString());
+ } else {
+ ErrorMsg(ident_pos,
+ "'%s' from outer scope has already been used, cannot redefine",
+ function_variable->name().ToCString());
+ }
}
}
@@ -6298,7 +6325,8 @@
void Parser::PushTryBlock(Block* try_block) {
- TryBlocks* block = new TryBlocks(try_block, try_blocks_list_);
+ intptr_t try_index = AllocateTryIndex();
+ TryBlocks* block = new TryBlocks(try_block, try_blocks_list_, try_index);
try_blocks_list_ = block;
}
@@ -6550,6 +6578,11 @@
}
catch_handler_list = CloseBlock();
TryBlocks* inner_try_block = PopTryBlock();
+ 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)
+ ? outer_try_block->try_index()
+ : CatchClauseNode::kInvalidTryIndex;
// Finally parse the 'finally' block.
SequenceNode* finally_block = NULL;
@@ -6565,7 +6598,8 @@
finally_block = ParseFinallyBlock();
InlinedFinallyNode* node = new InlinedFinallyNode(finally_pos,
finally_block,
- context_var);
+ context_var,
+ outer_try_index);
AddFinallyBlockToNode(node_to_inline, node);
node_index += 1;
node_to_inline = inner_try_block->GetNodeToInlineFinally(node_index);
@@ -6592,14 +6626,17 @@
Array::ZoneHandle(Array::MakeArray(handler_types)),
context_var,
catch_excp_var,
- catch_trace_var);
+ catch_trace_var,
+ (finally_block != NULL)
+ ? AllocateTryIndex()
+ : CatchClauseNode::kInvalidTryIndex);
// 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
// and attach the label to it.
AstNode* try_catch_node =
new TryCatchNode(try_pos, try_block, end_catch_label,
- context_var, catch_block, finally_block);
+ context_var, catch_block, finally_block, try_index);
if (try_label != NULL) {
current_block_->statements->Add(try_catch_node);
@@ -8564,7 +8601,6 @@
// be found.
AstNode* receiver = NULL;
const bool kTestOnly = true;
- ASSERT(!current_function().IsInFactoryScope());
if (!current_function().is_static() &&
(LookupReceiver(current_block_->scope, kTestOnly) != NULL)) {
receiver = LoadReceiver(ident_pos);
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index be417ae..92c30cb 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -686,6 +686,10 @@
// done using 'return', 'break' or 'continue' statements.
TryBlocks* try_blocks_list_;
+ // Each try in this function gets its own try index.
+ intptr_t AllocateTryIndex() { return ++last_used_try_index_; }
+ intptr_t last_used_try_index_;
+
DISALLOW_COPY_AND_ASSIGN(Parser);
};
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 80e1404..08a6516 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -176,7 +176,7 @@
kSmiTagShift = 1,
};
-enum TypeDataElementType {
+enum TypedDataElementType {
#define V(name) k##name##Element,
CLASS_LIST_TYPED_DATA(V)
#undef V
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
index dd084ff..e721cd7 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -309,7 +309,7 @@
for (intptr_t i = 0; i < variables_.length(); i++) {
LocalVariable* var = variables_[i];
ASSERT(var->name().IsSymbol());
- if ((var->name().raw() == name.raw()) && !var->is_invisible_) {
+ if (var->name().raw() == name.raw()) {
return var;
}
}
@@ -321,7 +321,7 @@
LocalScope* current_scope = this;
while (current_scope != NULL) {
LocalVariable* var = current_scope->LocalLookupVariable(name);
- if (var != NULL) {
+ if ((var != NULL) && !var->is_invisible_) {
if (!test_only) {
if (var->owner()->function_level() != function_level()) {
var->set_is_captured();
@@ -342,6 +342,30 @@
}
+bool LocalScope::CaptureVariable(const String& name) {
+ ASSERT(name.IsSymbol());
+ LocalScope* current_scope = this;
+ while (current_scope != NULL) {
+ LocalVariable* var = current_scope->LocalLookupVariable(name);
+ if (var != NULL) {
+ if (var->owner()->function_level() != function_level()) {
+ var->set_is_captured();
+ }
+ // Insert aliases of the variable in intermediate scopes.
+ LocalScope* intermediate_scope = this;
+ while (intermediate_scope != current_scope) {
+ intermediate_scope->variables_.Add(var);
+ ASSERT(var->owner() != intermediate_scope); // Item is an alias.
+ intermediate_scope = intermediate_scope->parent();
+ }
+ return true;
+ }
+ current_scope = current_scope->parent();
+ }
+ return false;
+}
+
+
SourceLabel* LocalScope::LookupLabel(const String& name) {
LocalScope* current_scope = this;
while (current_scope != NULL) {
diff --git a/runtime/vm/scopes.h b/runtime/vm/scopes.h
index fa95e9d..edf6749 100644
--- a/runtime/vm/scopes.h
+++ b/runtime/vm/scopes.h
@@ -283,6 +283,11 @@
// Returns NULL if this scope is not embedded in a switch.
LocalScope* LookupSwitchScope();
+ // Looks up variable in this scope and mark as captured if applicable.
+ // Finds the variable even if it is marked invisible. Returns true if
+ // the variable was found, false if it was not found.
+ bool CaptureVariable(const String& name);
+
// Look for unresolved forward references to labels in this scope.
// If there are any, propagate the forward reference to the next
// outer scope of a switch statement. If there is no outer switch
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index ffb08c0f..d19dbe1 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -7,12 +7,14 @@
#include "vm/isolate.h"
#include "vm/message.h"
#include "vm/object.h"
+#include "vm/object_id_ring.h"
+#include "vm/object_store.h"
#include "vm/port.h"
#include "vm/service.h"
namespace dart {
-typedef RawString* (*ServiceMessageHandler)(Isolate* isolate);
+typedef void (*ServiceMessageHandler)(Isolate* isolate, JSONStream* stream);
struct ServiceMessageHandlerEntry {
const char* command;
@@ -73,33 +75,94 @@
ServiceMessageHandler handler =
FindServiceMessageHandler(pathSegment.ToCString());
- String& reply = String::Handle();
- reply ^= handler(isolate);
- ASSERT(!reply.IsNull());
- PostReply(reply, reply_port);
+ ASSERT(handler != NULL);
+ {
+ TextBuffer buffer(256);
+ JSONStream js(&buffer);
+
+ // Setup JSONStream arguments and options. The arguments and options
+ // are zone allocated and will be freed immediately after handling the
+ // message.
+ Zone* zoneAllocator = zone.GetZone();
+ const char** arguments = zoneAllocator->Alloc<const char*>(path.Length());
+ String& string_iterator = String::Handle();
+ for (intptr_t i = 0; i < path.Length(); i++) {
+ string_iterator ^= path.At(i);
+ arguments[i] =
+ zoneAllocator->MakeCopyOfString(string_iterator.ToCString());
+ }
+ js.SetArguments(arguments, path.Length());
+ if (option_keys.Length() > 0) {
+ const char** option_keys_native =
+ zoneAllocator->Alloc<const char*>(option_keys.Length());
+ const char** option_values_native =
+ zoneAllocator->Alloc<const char*>(option_keys.Length());
+ for (intptr_t i = 0; i < option_keys.Length(); i++) {
+ string_iterator ^= option_keys.At(i);
+ option_keys_native[i] =
+ zoneAllocator->MakeCopyOfString(string_iterator.ToCString());
+ string_iterator ^= option_values.At(i);
+ option_values_native[i] =
+ zoneAllocator->MakeCopyOfString(string_iterator.ToCString());
+ }
+ js.SetOptions(option_keys_native, option_values_native,
+ option_keys.Length());
+ }
+
+ handler(isolate, &js);
+ const String& reply = String::Handle(String::New(buffer.buf()));
+ ASSERT(!reply.IsNull());
+ PostReply(reply, reply_port);
+ }
}
}
-static RawString* HandleName(Isolate* isolate) {
- TextBuffer buffer(256);
- JSONStream js(&buffer);
- js.OpenObject();
- js.PrintProperty("type", "IsolateName");
- js.PrintProperty("id", static_cast<intptr_t>(isolate->main_port()));
- js.PrintProperty("name", isolate->name());
- js.CloseObject();
- return String::New(buffer.buf());
+static void PrintArgumentsAndOptions(JSONStream* js) {
+ js->OpenObject("message");
+ js->OpenArray("arguments");
+ for (intptr_t i = 0; i < js->num_arguments(); i++) {
+ js->PrintValue(js->GetArgument(i));
+ }
+ js->CloseArray();
+ js->OpenArray("option_keys");
+ for (intptr_t i = 0; i < js->num_options(); i++) {
+ js->PrintValue(js->GetOptionKey(i));
+ }
+ js->CloseArray();
+ js->OpenArray("option_values");
+ for (intptr_t i = 0; i < js->num_options(); i++) {
+ js->PrintValue(js->GetOptionValue(i));
+ }
+ js->CloseArray();
+ js->CloseObject();
}
-RawString* HandleStackTrace(Isolate* isolate) {
- TextBuffer buffer(256);
- JSONStream js(&buffer);
+static void PrintCollectionErrorResponse(const char* collection_name,
+ JSONStream* js) {
+ js->OpenObject();
+ js->PrintProperty("type", "error");
+ js->PrintfProperty("text", "Must specify collection object id: /%s/id",
+ collection_name);
+ js->CloseObject();
+}
+
+
+static void HandleName(Isolate* isolate, JSONStream* js) {
+ js->OpenObject();
+ js->PrintProperty("type", "IsolateName");
+ js->PrintProperty("id", static_cast<intptr_t>(isolate->main_port()));
+ js->PrintProperty("name", isolate->name());
+ js->CloseObject();
+}
+
+
+static void HandleStackTrace(Isolate* isolate, JSONStream* js) {
DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
- js.OpenObject();
- js.PrintProperty("type", "StackTrace");
- js.OpenArray("members");
+ js->OpenObject();
+ js->PrintProperty("type", "StackTrace");
+ js->OpenArray("members");
intptr_t n_frames = stack->Length();
String& url = String::Handle();
String& function = String::Handle();
@@ -107,33 +170,84 @@
ActivationFrame* frame = stack->ActivationFrameAt(i);
url ^= frame->SourceUrl();
function ^= frame->function().UserVisibleName();
- js.OpenObject();
- js.PrintProperty("name", function.ToCString());
- js.PrintProperty("url", url.ToCString());
- js.PrintProperty("line", frame->LineNumber());
- js.PrintProperty("function", frame->function());
- js.PrintProperty("code", frame->code());
- js.CloseObject();
+ js->OpenObject();
+ js->PrintProperty("name", function.ToCString());
+ js->PrintProperty("url", url.ToCString());
+ js->PrintProperty("line", frame->LineNumber());
+ js->PrintProperty("function", frame->function());
+ js->PrintProperty("code", frame->code());
+ js->CloseObject();
}
- js.CloseArray();
- js.CloseObject();
- return String::New(buffer.buf());
+ js->CloseArray();
+ js->CloseObject();
}
-RawString* HandleObjectHistogram(Isolate* isolate) {
- TextBuffer buffer(256);
- JSONStream js(&buffer);
+static void HandleObjectHistogram(Isolate* isolate, JSONStream* js) {
ObjectHistogram* histogram = Isolate::Current()->object_histogram();
if (histogram == NULL) {
- js.OpenObject();
- js.PrintProperty("type", "ObjectHistogram");
- js.PrintProperty("error", "Run with --print_object_histogram");
- js.CloseObject();
- return String::New(buffer.buf());
+ js->OpenObject();
+ js->PrintProperty("type", "error");
+ js->PrintProperty("text", "Run with --print_object_histogram");
+ js->CloseObject();
+ return;
}
- histogram->PrintToJSONStream(&js);
- return String::New(buffer.buf());
+ histogram->PrintToJSONStream(js);
+}
+
+
+static void HandleEcho(Isolate* isolate, JSONStream* js) {
+ js->OpenObject();
+ js->PrintProperty("type", "message");
+ PrintArgumentsAndOptions(js);
+ js->CloseObject();
+}
+
+// Print an error message if there is no ID argument.
+#define REQUIRE_COLLECTION_ID(collection) \
+ if (js->num_arguments() == 1) { \
+ PrintCollectionErrorResponse(collection, js); \
+ return; \
+ }
+
+// Print a Dart object to the stream if found in ring. Otherwise print null.
+#define PRINT_RING_OBJ(type) \
+ ASSERT(js->num_arguments() >= 2); \
+ ObjectIdRing* ring = isolate->object_id_ring(); \
+ ASSERT(ring != NULL); \
+ intptr_t id = atoi(js->GetArgument(1)); \
+ Object& obj = Object::Handle(ring->GetObjectForId(id)); \
+ if (!obj.Is##type()) { \
+ /* Object is not type, replace with null. */ \
+ obj = Object::null(); \
+ } \
+ js->PrintValue(obj, false)
+
+
+static void HandleLibraries(Isolate* isolate, JSONStream* js) {
+ if (js->num_arguments() == 1) {
+ js->PrintValue(Library::Handle(isolate->object_store()->root_library()));
+ return;
+ }
+ PRINT_RING_OBJ(Library);
+}
+
+
+static void HandleFunctions(Isolate* isolate, JSONStream* js) {
+ REQUIRE_COLLECTION_ID("functions");
+ PRINT_RING_OBJ(Function);
+}
+
+
+static void HandleClasses(Isolate* isolate, JSONStream* js) {
+ REQUIRE_COLLECTION_ID("classes");
+ PRINT_RING_OBJ(Class);
+}
+
+
+static void HandleCodes(Isolate* isolate, JSONStream* js) {
+ REQUIRE_COLLECTION_ID("codes");
+ PRINT_RING_OBJ(Code);
}
@@ -141,17 +255,20 @@
{ "name", HandleName },
{ "stacktrace", HandleStackTrace },
{ "objecthistogram", HandleObjectHistogram},
+ { "libraries", HandleLibraries },
+ { "functions", HandleFunctions },
+ { "classes", HandleClasses },
+ { "codes", HandleCodes },
+ { "_echo", HandleEcho },
};
-static RawString* HandleFallthrough(Isolate* isolate) {
- TextBuffer buffer(256);
- JSONStream js(&buffer);
- js.OpenObject();
- js.PrintProperty("type", "error");
- js.PrintProperty("text", "request not supported.");
- js.CloseObject();
- return String::New(buffer.buf());
+static void HandleFallthrough(Isolate* isolate, JSONStream* js) {
+ js->OpenObject();
+ js->PrintProperty("type", "error");
+ js->PrintProperty("text", "request not understood.");
+ PrintArgumentsAndOptions(js);
+ js->CloseObject();
}
diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc
index 3469ab7..7826a37 100644
--- a/runtime/vm/simulator_arm.cc
+++ b/runtime/vm/simulator_arm.cc
@@ -1491,7 +1491,8 @@
typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1);
// Calls to native Dart functions are based on this interface.
-typedef void (*SimulatorNativeCall)(NativeArguments* arguments);
+typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments);
+typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target);
void Simulator::SupervisorCall(Instr* instr) {
@@ -1509,6 +1510,7 @@
}
if ((redirection->call_kind() == kRuntimeCall) ||
+ (redirection->call_kind() == kBootstrapNativeCall) ||
(redirection->call_kind() == kNativeCall)) {
// Set the top_exit_frame_info of this simulator to the native stack.
set_top_exit_frame_info(reinterpret_cast<uword>(&buffer));
@@ -1548,13 +1550,21 @@
double d1 = get_dregister(D1);
d0 = target(d0, d1);
set_dregister(D0, d0);
+ } else if (redirection->call_kind() == kBootstrapNativeCall) {
+ NativeArguments* arguments;
+ arguments = reinterpret_cast<NativeArguments*>(get_register(R0));
+ SimulatorBootstrapNativeCall target =
+ reinterpret_cast<SimulatorBootstrapNativeCall>(external);
+ target(arguments);
+ set_register(R0, icount_); // Zap result register from void function.
} else {
ASSERT(redirection->call_kind() == kNativeCall);
NativeArguments* arguments;
arguments = reinterpret_cast<NativeArguments*>(get_register(R0));
+ uword target_func = get_register(R1);
SimulatorNativeCall target =
reinterpret_cast<SimulatorNativeCall>(external);
- target(arguments);
+ target(arguments, target_func);
set_register(R0, icount_); // Zap result register from void function.
}
set_top_exit_frame_info(0);
diff --git a/runtime/vm/simulator_arm.h b/runtime/vm/simulator_arm.h
index 09c7667..0b488a4 100644
--- a/runtime/vm/simulator_arm.h
+++ b/runtime/vm/simulator_arm.h
@@ -105,6 +105,7 @@
kRuntimeCall,
kLeafRuntimeCall,
kLeafFloatRuntimeCall,
+ kBootstrapNativeCall,
kNativeCall
};
static uword RedirectExternalReference(uword function,
diff --git a/runtime/vm/simulator_mips.cc b/runtime/vm/simulator_mips.cc
index 9d33b46..fa8dbb8 100644
--- a/runtime/vm/simulator_mips.cc
+++ b/runtime/vm/simulator_mips.cc
@@ -973,7 +973,8 @@
typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1);
// Calls to native Dart functions are based on this interface.
-typedef void (*SimulatorNativeCall)(NativeArguments* arguments);
+typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments);
+typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target);
void Simulator::DoBreak(Instr *instr) {
@@ -1008,6 +1009,7 @@
}
if ((redirection->call_kind() == kRuntimeCall) ||
+ (redirection->call_kind() == kBootstrapNativeCall) ||
(redirection->call_kind() == kNativeCall)) {
// Set the top_exit_frame_info of this simulator to the native stack.
set_top_exit_frame_info(reinterpret_cast<uword>(&buffer));
@@ -1045,13 +1047,22 @@
double d7 = get_fregister_double(F14);
d0 = target(d6, d7);
set_fregister_double(F0, d0);
+ } else if (redirection->call_kind() == kBootstrapNativeCall) {
+ NativeArguments* arguments;
+ arguments = reinterpret_cast<NativeArguments*>(get_register(A0));
+ SimulatorBootstrapNativeCall target =
+ reinterpret_cast<SimulatorBootstrapNativeCall>(external);
+ target(arguments);
+ set_register(V0, icount_); // Zap result register from void function.
+ set_register(V1, icount_);
} else {
ASSERT(redirection->call_kind() == kNativeCall);
NativeArguments* arguments;
arguments = reinterpret_cast<NativeArguments*>(get_register(A0));
+ uword target_func = get_register(A1);
SimulatorNativeCall target =
reinterpret_cast<SimulatorNativeCall>(external);
- target(arguments);
+ target(arguments, target_func);
set_register(V0, icount_); // Zap result register from void function.
set_register(V1, icount_);
}
diff --git a/runtime/vm/simulator_mips.h b/runtime/vm/simulator_mips.h
index db95370..b6fded0 100644
--- a/runtime/vm/simulator_mips.h
+++ b/runtime/vm/simulator_mips.h
@@ -115,6 +115,7 @@
kRuntimeCall,
kLeafRuntimeCall,
kLeafFloatRuntimeCall,
+ kBootstrapNativeCall,
kNativeCall
};
static uword RedirectExternalReference(uword function,
diff --git a/runtime/vm/stack_frame_test.cc b/runtime/vm/stack_frame_test.cc
index b0ae1e5..fc5e269 100644
--- a/runtime/vm/stack_frame_test.cc
+++ b/runtime/vm/stack_frame_test.cc
@@ -75,7 +75,6 @@
void FUNCTION_NAME(StackFrame_validateFrame)(Dart_NativeArguments args) {
- Dart_EnterScope();
Dart_Handle index = Dart_GetNativeArgument(args, 0);
Dart_Handle name = Dart_GetNativeArgument(args, 1);
const Smi& frame_index_smi = Smi::CheckedHandle(Api::UnwrapHandle(index));
@@ -108,7 +107,6 @@
if (strcmp(full_name, name) != 0) {
FATAL("StackFrame_validateFrame fails, incorrect frame.\n");
}
- Dart_ExitScope();
return;
}
count += 1; // Count the dart frames.
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index 9d7a08e..e4f18a2 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -22,6 +22,7 @@
#define VM_STUB_CODE_LIST(V) \
V(CallToRuntime) \
V(PrintStopMessage) \
+ V(CallBootstrapCFunction) \
V(CallNativeCFunction) \
V(AllocateArray) \
V(CallNoSuchMethodFunction) \
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index bf9b5e4..b101db7 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -173,6 +173,92 @@
// For now, space is reserved on the stack and we pass a pointer to it.
__ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3));
__ mov(R0, ShifterOperand(SP)); // Pass the pointer to the NativeArguments.
+ __ mov(R1, ShifterOperand(R5)); // Pass the function entrypoint to call.
+
+ // Call native function invocation wrapper or redirection via simulator.
+#if defined(USING_SIMULATOR)
+ uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper);
+ entry = Simulator::RedirectExternalReference(
+ entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments);
+ __ LoadImmediate(R2, entry);
+ __ blx(R2);
+#else
+ __ BranchLink(&NativeEntry::NativeCallWrapperLabel());
+#endif
+
+ // Reset exit frame information in Isolate structure.
+ __ LoadImmediate(R2, 0);
+ __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset());
+
+ // Load Context pointer from Isolate structure into R2.
+ __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset());
+
+ // Reset Context pointer in Isolate structure.
+ __ LoadImmediate(R3, reinterpret_cast<intptr_t>(Object::null()));
+ __ StoreToOffset(kWord, R3, CTX, Isolate::top_context_offset());
+
+ // Cache Context pointer into CTX while executing Dart code.
+ __ mov(CTX, ShifterOperand(R2));
+
+ __ LeaveFrame((1 << FP) | (1 << LR));
+ __ Ret();
+}
+
+
+// Input parameters:
+// LR : return address.
+// SP : address of return value.
+// R5 : address of the native function to call.
+// R2 : address of first argument in argument array.
+// R1 : argc_tag including number of arguments and function kind.
+void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
+ const intptr_t isolate_offset = NativeArguments::isolate_offset();
+ const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
+ const intptr_t argv_offset = NativeArguments::argv_offset();
+ const intptr_t retval_offset = NativeArguments::retval_offset();
+
+ __ EnterFrame((1 << FP) | (1 << LR), 0);
+
+ // Load current Isolate pointer from Context structure into R0.
+ __ ldr(R0, FieldAddress(CTX, Context::isolate_offset()));
+
+ // Save exit frame information to enable stack walking as we are about
+ // to transition to native code.
+ __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset());
+
+ // Save current Context pointer into Isolate structure.
+ __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset());
+
+ // Cache Isolate pointer into CTX while executing native code.
+ __ mov(CTX, ShifterOperand(R0));
+
+ // Reserve space for the native arguments structure passed on the stack (the
+ // outgoing pointer parameter to the native arguments structure is passed in
+ // R0) and align frame before entering the C++ world.
+ __ ReserveAlignedFrameSpace(sizeof(NativeArguments));
+
+ // Initialize NativeArguments structure and call native function.
+ // Registers R0, R1, R2, and R3 are used.
+
+ ASSERT(isolate_offset == 0 * kWordSize);
+ // Set isolate in NativeArgs: R0 already contains CTX.
+
+ // There are no native calls to closures, so we do not need to set the tag
+ // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
+ ASSERT(argc_tag_offset == 1 * kWordSize);
+ // Set argc in NativeArguments: R1 already contains argc.
+
+ ASSERT(argv_offset == 2 * kWordSize);
+ // Set argv in NativeArguments: R2 already contains argv.
+
+ ASSERT(retval_offset == 3 * kWordSize);
+ __ add(R3, FP, ShifterOperand(2 * kWordSize)); // Set retval in NativeArgs.
+
+ // TODO(regis): Should we pass the structure by value as in runtime calls?
+ // It would require changing Dart API for native functions.
+ // For now, space is reserved on the stack and we pass a pointer to it.
+ __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3));
+ __ mov(R0, ShifterOperand(SP)); // Pass the pointer to the NativeArguments.
// Call native function or redirection via simulator.
__ blx(R5);
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 6dd0a85..f5e4ed1 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -121,6 +121,78 @@
// EDX : argc_tag including number of arguments and function kind.
// Uses EDI.
void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) {
+ const intptr_t native_args_struct_offset =
+ NativeEntry::kNumCallWrapperArguments * kWordSize;
+ const intptr_t isolate_offset =
+ NativeArguments::isolate_offset() + native_args_struct_offset;
+ const intptr_t argc_tag_offset =
+ NativeArguments::argc_tag_offset() + native_args_struct_offset;
+ const intptr_t argv_offset =
+ NativeArguments::argv_offset() + native_args_struct_offset;
+ const intptr_t retval_offset =
+ NativeArguments::retval_offset() + native_args_struct_offset;
+
+ __ EnterFrame(0);
+
+ // Load current Isolate pointer from Context structure into EDI.
+ __ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
+
+ // Save exit frame information to enable stack walking as we are about
+ // to transition to dart VM code.
+ __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP);
+
+ // Save current Context pointer into Isolate structure.
+ __ movl(Address(EDI, Isolate::top_context_offset()), CTX);
+
+ // Cache Isolate pointer into CTX while executing native code.
+ __ movl(CTX, EDI);
+
+ // Reserve space for the native arguments structure, the outgoing parameters
+ // (pointer to the native arguments structure, the C function entry point)
+ // and align frame before entering the C++ world.
+ __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments) - (2 * kWordSize)));
+ if (OS::ActivationFrameAlignment() > 0) {
+ __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
+ }
+
+ // Pass NativeArguments structure by value and call native function.
+ __ movl(Address(ESP, isolate_offset), CTX); // Set isolate in NativeArgs.
+ __ movl(Address(ESP, argc_tag_offset), EDX); // Set argc in NativeArguments.
+ __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments.
+ __ leal(EAX, Address(EBP, 2 * kWordSize)); // Compute return value addr.
+ __ movl(Address(ESP, retval_offset), EAX); // Set retval in NativeArguments.
+ __ leal(EAX, Address(ESP, 2 * kWordSize)); // Pointer to the NativeArguments.
+ __ movl(Address(ESP, 0), EAX); // Pass the pointer to the NativeArguments.
+ __ movl(Address(ESP, kWordSize), ECX); // Function to call.
+ __ call(&NativeEntry::NativeCallWrapperLabel());
+
+ // Reset exit frame information in Isolate structure.
+ __ movl(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0));
+
+ // Load Context pointer from Isolate structure into EDI.
+ __ movl(EDI, Address(CTX, Isolate::top_context_offset()));
+
+ // Reset Context pointer in Isolate structure.
+ const Immediate& raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ __ movl(Address(CTX, Isolate::top_context_offset()), raw_null);
+
+ // Cache Context pointer into CTX while executing Dart code.
+ __ movl(CTX, EDI);
+
+ __ LeaveFrame();
+ __ ret();
+}
+
+
+// Input parameters:
+// ESP : points to return address.
+// ESP + 4 : address of return value.
+// EAX : address of first argument in argument array.
+// ECX : address of the native function to call.
+// EDX : argc_tag including number of arguments and function kind.
+// Uses EDI.
+void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
const intptr_t native_args_struct_offset = kWordSize;
const intptr_t isolate_offset =
NativeArguments::isolate_offset() + native_args_struct_offset;
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index 115bd84..bdb2981 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -189,6 +189,103 @@
__ sw(A1, Address(SP, 1 * kWordSize));
__ sw(A0, Address(SP, 0 * kWordSize));
__ mov(A0, SP); // Pass the pointer to the NativeArguments.
+ __ mov(A1, T5); // Pass the function entrypoint.
+
+ __ ReserveAlignedFrameSpace(2 * kWordSize); // Just passing A0, A1.
+
+ // Call native wrapper function or redirection via simulator.
+#if defined(USING_SIMULATOR)
+ uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper);
+ entry = Simulator::RedirectExternalReference(
+ entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments);
+ __ LoadImmediate(T5, entry);
+ __ jalr(T5);
+#else
+ __ BranchLink(&NativeEntry::NativeCallWrapperLabel());
+#endif
+ __ TraceSimMsg("CallNativeCFunctionStub return");
+
+ // Reset exit frame information in Isolate structure.
+ __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset()));
+
+ // Load Context pointer from Isolate structure into A2.
+ __ lw(A2, Address(CTX, Isolate::top_context_offset()));
+
+ // Load null.
+ __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
+
+ // Reset Context pointer in Isolate structure.
+ __ sw(TMP, Address(CTX, Isolate::top_context_offset()));
+
+ // Cache Context pointer into CTX while executing Dart code.
+ __ mov(CTX, A2);
+
+ __ mov(SP, FP);
+ __ lw(RA, Address(SP, 1 * kWordSize));
+ __ lw(FP, Address(SP, 0 * kWordSize));
+ __ Ret();
+ __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize));
+}
+
+
+// Input parameters:
+// RA : return address.
+// SP : address of return value.
+// T5 : address of the native function to call.
+// A2 : address of first argument in argument array.
+// A1 : argc_tag including number of arguments and function kind.
+void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
+ const intptr_t isolate_offset = NativeArguments::isolate_offset();
+ const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
+ const intptr_t argv_offset = NativeArguments::argv_offset();
+ const intptr_t retval_offset = NativeArguments::retval_offset();
+
+ __ SetPrologueOffset();
+ __ TraceSimMsg("CallNativeCFunctionStub");
+ __ addiu(SP, SP, Immediate(-2 * kWordSize));
+ __ sw(RA, Address(SP, 1 * kWordSize));
+ __ sw(FP, Address(SP, 0 * kWordSize));
+ __ mov(FP, SP);
+
+ // Load current Isolate pointer from Context structure into A0.
+ __ lw(A0, FieldAddress(CTX, Context::isolate_offset()));
+
+ // Save exit frame information to enable stack walking as we are about
+ // to transition to native code.
+ __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset()));
+
+ // Save current Context pointer into Isolate structure.
+ __ sw(CTX, Address(A0, Isolate::top_context_offset()));
+
+ // Cache Isolate pointer into CTX while executing native code.
+ __ mov(CTX, A0);
+
+ // Initialize NativeArguments structure and call native function.
+ // Registers A0, A1, A2, and A3 are used.
+
+ ASSERT(isolate_offset == 0 * kWordSize);
+ // Set isolate in NativeArgs: A0 already contains CTX.
+
+ // There are no native calls to closures, so we do not need to set the tag
+ // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
+ ASSERT(argc_tag_offset == 1 * kWordSize);
+ // Set argc in NativeArguments: A1 already contains argc.
+
+ ASSERT(argv_offset == 2 * kWordSize);
+ // Set argv in NativeArguments: A2 already contains argv.
+
+ ASSERT(retval_offset == 3 * kWordSize);
+ __ addiu(A3, FP, Immediate(2 * kWordSize)); // Set retval in NativeArgs.
+
+ // TODO(regis): Should we pass the structure by value as in runtime calls?
+ // It would require changing Dart API for native functions.
+ // For now, space is reserved on the stack and we pass a pointer to it.
+ __ addiu(SP, SP, Immediate(-4 * kWordSize));
+ __ sw(A3, Address(SP, 3 * kWordSize));
+ __ sw(A2, Address(SP, 2 * kWordSize));
+ __ sw(A1, Address(SP, 1 * kWordSize));
+ __ sw(A0, Address(SP, 0 * kWordSize));
+ __ mov(A0, SP); // Pass the pointer to the NativeArguments.
__ ReserveAlignedFrameSpace(kWordSize); // Just passing A0.
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index c12b959..a0da196 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -28,6 +28,7 @@
DECLARE_FLAG(int, optimization_counter_threshold);
DECLARE_FLAG(bool, trace_optimized_ic_calls);
+
// Input parameters:
// RSP : points to return address.
// RSP + 8 : address of last argument in argument array.
@@ -161,6 +162,75 @@
__ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr.
__ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments.
__ movq(RDI, RSP); // Pass the pointer to the NativeArguments.
+ __ movq(RSI, RBX); // Pass pointer to function entrypoint.
+ __ call(&NativeEntry::NativeCallWrapperLabel());
+
+ // Reset exit frame information in Isolate structure.
+ __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), Immediate(0));
+
+ // Load Context pointer from Isolate structure into R8.
+ __ movq(R8, Address(CTX, Isolate::top_context_offset()));
+
+ // Reset Context pointer in Isolate structure.
+ const Immediate& raw_null =
+ Immediate(reinterpret_cast<intptr_t>(Object::null()));
+ __ movq(Address(CTX, Isolate::top_context_offset()), raw_null);
+
+ // Cache Context pointer into CTX while executing Dart code.
+ __ movq(CTX, R8);
+
+ __ LeaveFrame();
+ __ ret();
+}
+
+
+// Input parameters:
+// RSP : points to return address.
+// RSP + 8 : address of return value.
+// RAX : address of first argument in argument array.
+// RBX : address of the native function to call.
+// R10 : argc_tag including number of arguments and function kind.
+void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
+ const intptr_t native_args_struct_offset = 0;
+ const intptr_t isolate_offset =
+ NativeArguments::isolate_offset() + native_args_struct_offset;
+ const intptr_t argc_tag_offset =
+ NativeArguments::argc_tag_offset() + native_args_struct_offset;
+ const intptr_t argv_offset =
+ NativeArguments::argv_offset() + native_args_struct_offset;
+ const intptr_t retval_offset =
+ NativeArguments::retval_offset() + native_args_struct_offset;
+
+ __ EnterFrame(0);
+
+ // Load current Isolate pointer from Context structure into R8.
+ __ movq(R8, FieldAddress(CTX, Context::isolate_offset()));
+
+ // Save exit frame information to enable stack walking as we are about
+ // to transition to native code.
+ __ movq(Address(R8, Isolate::top_exit_frame_info_offset()), RSP);
+
+ // Save current Context pointer into Isolate structure.
+ __ movq(Address(R8, Isolate::top_context_offset()), CTX);
+
+ // Cache Isolate pointer into CTX while executing native code.
+ __ movq(CTX, R8);
+
+ // Reserve space for the native arguments structure passed on the stack (the
+ // outgoing pointer parameter to the native arguments structure is passed in
+ // RDI) and align frame before entering the C++ world.
+ __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments)));
+ if (OS::ActivationFrameAlignment() > 0) {
+ __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
+ }
+
+ // Pass NativeArguments structure by value and call native function.
+ __ movq(Address(RSP, isolate_offset), CTX); // Set isolate in NativeArgs.
+ __ movq(Address(RSP, argc_tag_offset), R10); // Set argc in NativeArguments.
+ __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments.
+ __ leaq(RAX, Address(RBP, 2 * kWordSize)); // Compute return value addr.
+ __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments.
+ __ movq(RDI, RSP); // Pass the pointer to the NativeArguments.
__ call(RBX);
// Reset exit frame information in Isolate structure.
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 9edb6bf..35f7d79 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -34,12 +34,11 @@
V(ClosureParameter, ":closure") \
V(PhaseParameter, ":phase") \
V(TypeArgumentsParameter, ":type_arguments") \
- V(AssertionError, "_AssertionErrorImplementation") \
- V(CastError, "_CastErrorImplementation") \
- V(TypeError, "_TypeErrorImplementation") \
- V(FallThroughError, "_FallThroughErrorImplementation") \
- V(AbstractClassInstantiationError, \
- "_AbstractClassInstantiationErrorImplementation") \
+ V(AssertionError, "AssertionError") \
+ V(CastError, "CastError") \
+ V(TypeError, "TypeError") \
+ V(FallThroughError, "FallThroughError") \
+ V(AbstractClassInstantiationError, "AbstractClassInstantiationError") \
V(NoSuchMethodError, "NoSuchMethodError") \
V(ThrowNew, "_throwNew") \
V(List, "List") \
@@ -218,6 +217,8 @@
V(_handleMessage, "_handleMessage") \
V(_SendPortImpl, "_SendPortImpl") \
V(_create, "_create") \
+ V(DotCreate, "._create") \
+ V(DotWithType, "._withType") \
V(_id, "_id") \
V(_get_or_create, "_get_or_create") \
V(RangeError, "RangeError") \
diff --git a/runtime/vm/verifier.h b/runtime/vm/verifier.h
index ae96f02..a622955 100644
--- a/runtime/vm/verifier.h
+++ b/runtime/vm/verifier.h
@@ -12,15 +12,6 @@
namespace dart {
-DECLARE_FLAG(bool, verify_on_transition);
-
-#define VERIFY_ON_TRANSITION \
- if (FLAG_verify_on_transition) { \
- VerifyPointersVisitor::VerifyPointers(); \
- Isolate::Current()->heap()->Verify(); \
- } \
-
-
// Forward declarations.
class Isolate;
class ObjectSet;
diff --git a/runtime/vm/vm_sources.gypi b/runtime/vm/vm_sources.gypi
index 801bf15..cea087a 100644
--- a/runtime/vm/vm_sources.gypi
+++ b/runtime/vm/vm_sources.gypi
@@ -226,7 +226,6 @@
'message_handler.h',
'message_handler_test.cc',
'message_test.cc',
- 'native_arguments.cc',
'native_arguments.h',
'native_entry.cc',
'native_entry.h',
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc
index 4638695..5b43216 100644
--- a/runtime/vm/zone.cc
+++ b/runtime/vm/zone.cc
@@ -75,32 +75,6 @@
}
-Zone::Zone()
- : initial_buffer_(buffer_, kInitialChunkSize),
- position_(initial_buffer_.start()),
- limit_(initial_buffer_.end()),
- head_(NULL),
- large_segments_(NULL),
- handles_(),
- previous_(NULL) {
-#ifdef DEBUG
- // Zap the entire initial buffer.
- memset(initial_buffer_.pointer(), kZapUninitializedByte,
- initial_buffer_.size());
-#endif
-}
-
-
-Zone::~Zone() {
-#if defined(DEBUG)
- if (FLAG_trace_zones) {
- DumpZoneSizes();
- }
-#endif
- DeleteAll();
-}
-
-
void Zone::DeleteAll() {
// Traverse the chained list of segments, zapping (in debug mode)
// and freeing every zone segment.
@@ -212,34 +186,6 @@
#endif
-StackZone::StackZone(BaseIsolate* isolate)
- : StackResource(isolate),
- zone_() {
-#ifdef DEBUG
- if (FLAG_trace_zones) {
- OS::PrintErr("*** Starting a new Stack zone 0x%"Px"(0x%"Px")\n",
- reinterpret_cast<intptr_t>(this),
- reinterpret_cast<intptr_t>(&zone_));
- }
-#endif
- zone_.Link(isolate->current_zone());
- isolate->set_current_zone(&zone_);
-}
-
-
-StackZone::~StackZone() {
- ASSERT(isolate()->current_zone() == &zone_);
- isolate()->set_current_zone(zone_.previous_);
-#ifdef DEBUG
- if (FLAG_trace_zones) {
- OS::PrintErr("*** Deleting Stack zone 0x%"Px"(0x%"Px")\n",
- reinterpret_cast<intptr_t>(this),
- reinterpret_cast<intptr_t>(&zone_));
- }
-#endif
-}
-
-
void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) {
Zone* zone = this;
while (zone != NULL) {
diff --git a/runtime/vm/zone.h b/runtime/vm/zone.h
index f8a2d23..f932db9 100644
--- a/runtime/vm/zone.h
+++ b/runtime/vm/zone.h
@@ -12,6 +12,8 @@
namespace dart {
+DECLARE_DEBUG_FLAG(bool, trace_zones);
+
// Zones support very fast allocation of small chunks of memory. The
// chunks cannot be deallocated individually, but instead zones
// support deallocating all chunks in one fast operation.
@@ -57,8 +59,29 @@
void VisitObjectPointers(ObjectPointerVisitor* visitor);
private:
- Zone();
- ~Zone(); // Delete all memory associated with the zone.
+ Zone()
+ : initial_buffer_(buffer_, kInitialChunkSize),
+ position_(initial_buffer_.start()),
+ limit_(initial_buffer_.end()),
+ head_(NULL),
+ large_segments_(NULL),
+ handles_(),
+ previous_(NULL) {
+#ifdef DEBUG
+ // Zap the entire initial buffer.
+ memset(initial_buffer_.pointer(), kZapUninitializedByte,
+ initial_buffer_.size());
+#endif
+ }
+
+ ~Zone() { // Delete all memory associated with the zone.
+#if defined(DEBUG)
+ if (FLAG_trace_zones) {
+ DumpZoneSizes();
+ }
+#endif
+ DeleteAll();
+ }
// All pointers returned from AllocateUnsafe() and New() have this alignment.
static const intptr_t kAlignment = kWordSize;
@@ -134,10 +157,32 @@
class StackZone : public StackResource {
public:
// Create an empty zone and set is at the current zone for the Isolate.
- explicit StackZone(BaseIsolate* isolate);
+ explicit StackZone(BaseIsolate* isolate)
+ : StackResource(isolate),
+ zone_() {
+#ifdef DEBUG
+ if (FLAG_trace_zones) {
+ OS::PrintErr("*** Starting a new Stack zone 0x%"Px"(0x%"Px")\n",
+ reinterpret_cast<intptr_t>(this),
+ reinterpret_cast<intptr_t>(&zone_));
+ }
+#endif
+ zone_.Link(isolate->current_zone());
+ isolate->set_current_zone(&zone_);
+ }
// Delete all memory associated with the zone.
- ~StackZone();
+ ~StackZone() {
+ ASSERT(isolate()->current_zone() == &zone_);
+ isolate()->set_current_zone(zone_.previous_);
+#ifdef DEBUG
+ if (FLAG_trace_zones) {
+ OS::PrintErr("*** Deleting Stack zone 0x%"Px"(0x%"Px")\n",
+ reinterpret_cast<intptr_t>(this),
+ reinterpret_cast<intptr_t>(&zone_));
+ }
+#endif
+ }
// Compute the total size of this zone. This includes wasted space that is
// due to internal fragmentation in the segments.
diff --git a/sdk/bin/dartanalyzer b/sdk/bin/dartanalyzer
index cc33e5c..4ea86af 100755
--- a/sdk/bin/dartanalyzer
+++ b/sdk/bin/dartanalyzer
@@ -28,7 +28,7 @@
done
DART_SDK=""
-if [ $FOUND_SDK = 0 ] ; then
+if [ $FOUND_SDK -eq 0 ] ; then
if [ -f "$DART_ANALYZER_HOME/lib/core/core.dart" ] ; then
DART_SDK=(--dart-sdk "$DART_ANALYZER_HOME")
else
@@ -70,7 +70,7 @@
# On other architectures
# -batch invocations will do better with a server vm
# invocations for analyzing a single file do better with a client vm
- if [ $FOUND_BATCH = 0 ] ; then
+ if [ $FOUND_BATCH -eq 0 ] ; then
EXTRA_JVMARGS+=" -client "
fi
fi
diff --git a/sdk/bin/dartanalyzer_developer b/sdk/bin/dartanalyzer_developer
index 9cf163d..1e95873 100755
--- a/sdk/bin/dartanalyzer_developer
+++ b/sdk/bin/dartanalyzer_developer
@@ -16,6 +16,18 @@
echo "$1"
}
+FOUND_BATCH=0
+for ARG in "$@"
+do
+ case $ARG in
+ -batch|--batch)
+ FOUND_BATCH=1
+ ;;
+ *)
+ ;;
+ esac
+done
+
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
PROG_NAME="$(follow_links "$BASH_SOURCE")"
@@ -29,12 +41,12 @@
DART_CONFIGURATION="ReleaseIA32"
fi
-if [[ `uname` == 'Darwin' ]];
+if [ `uname` == 'Darwin' ];
then
JAR_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION/dartanalyzer
else
JAR_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION/dartanalyzer
-fi
+fi
JAR_FILE="$JAR_DIR/dartanalyzer.jar"
@@ -47,7 +59,7 @@
# On other architectures
# -batch invocations will do better with a server vm
# invocations for analyzing a single file do better with a client vm
- if [ $FOUND_BATCH = 0 ] ; then
+ if [ $FOUND_BATCH -eq 0 ] ; then
EXTRA_JVMARGS+=" -client "
fi
fi
diff --git a/sdk/lib/_internal/compiler/compiler.dart b/sdk/lib/_internal/compiler/compiler.dart
index 8e5f77f..abeb36c 100644
--- a/sdk/lib/_internal/compiler/compiler.dart
+++ b/sdk/lib/_internal/compiler/compiler.dart
@@ -140,7 +140,12 @@
static const Diagnostic HINT = const Diagnostic(4, 'hint');
/**
- * Informational messages.
+ * Additional information about the preceding non-info diagnostic from the
+ * compiler.
+ *
+ * For example, consider a duplicated definition. The compiler first emits a
+ * message about the duplicated definition, then emits an info message about
+ * the location of the existing definition.
*/
static const Diagnostic INFO = const Diagnostic(8, 'info');
diff --git a/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
index 9f24fc6..7923de79 100644
--- a/sdk/lib/_internal/compiler/implementation/apiimpl.dart
+++ b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
@@ -48,11 +48,6 @@
analyzeOnly: hasOption(options, '--analyze-only'),
analyzeSignaturesOnly:
hasOption(options, '--analyze-signatures-only'),
- rejectDeprecatedFeatures:
- hasOption(options, '--reject-deprecated-language-features'),
- checkDeprecationInSdk:
- hasOption(options,
- '--report-sdk-use-of-deprecated-language-features'),
strips: extractCsvOption(options, '--force-strip='),
enableConcreteTypeInference:
hasOption(options, '--enable-concrete-type-inference'),
@@ -63,6 +58,7 @@
sourceMapUri: extractSourceMapUri(options),
globalJsName: extractStringOption(
options, '--global-js-name=', r'$'),
+ terseDiagnostics: hasOption(options, '--terse'),
buildId: extractStringOption(
options, '--build-id=',
"build number could not be determined")) {
diff --git a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
index baaef0b..89e783b 100644
--- a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
@@ -744,7 +744,9 @@
error(Node node) {
// Just fail without reporting it anywhere.
- throw new CompileTimeConstantError(MessageKind.NOT_A_COMPILE_TIME_CONSTANT);
+ throw new CompileTimeConstantError(
+ MessageKind.NOT_A_COMPILE_TIME_CONSTANT, const {},
+ compiler.terseDiagnostics);
}
}
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 1aa47b7..88d35c5 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -306,8 +306,6 @@
*/
final bool analyzeSignaturesOnly;
final bool enableNativeLiveTypeAnalysis;
- final bool rejectDeprecatedFeatures;
- final bool checkDeprecationInSdk;
/**
* If [:true:], comment tokens are collected in [commentMap] during scanning.
@@ -331,6 +329,9 @@
*/
final String globalJsName;
+ /// Emit terse diagnostics without howToFix.
+ final bool terseDiagnostics;
+
final api.CompilerOutputProvider outputProvider;
bool disableInlining = false;
@@ -387,6 +388,9 @@
// Initialized when symbolImplementationClass has been resolved.
FunctionElement symbolValidatedConstructor;
+ // Initialized when mirrorsUsedClass has been resolved.
+ FunctionElement mirrorsUsedConstructor;
+
// Initialized when dart:mirrors is loaded.
ClassElement deferredLibraryClass;
@@ -518,13 +522,12 @@
this.analyzeAllFlag: false,
bool analyzeOnly: false,
bool analyzeSignaturesOnly: false,
- this.rejectDeprecatedFeatures: false,
- this.checkDeprecationInSdk: false,
this.preserveComments: false,
this.verbose: false,
this.sourceMapUri: null,
this.buildId: UNDETERMINED_BUILD_ID,
this.globalJsName: r'$',
+ this.terseDiagnostics: false,
outputProvider,
List<String> strips: const []})
: this.analyzeOnly = analyzeOnly || analyzeSignaturesOnly,
@@ -746,6 +749,8 @@
} else if (symbolImplementationClass == cls) {
symbolValidatedConstructor = symbolImplementationClass.lookupConstructor(
symbolValidatedConstructorSelector);
+ } else if (mirrorsUsedClass == cls) {
+ mirrorsUsedConstructor = cls.constructors.head;
}
}
@@ -801,7 +806,9 @@
'$missingHelperClasses');
}
- types = new Types(this, dynamicClass);
+ if (types == null) {
+ types = new Types(this, dynamicClass);
+ }
backend.initializeHelperClasses();
dynamicClass.ensureResolved(this);
@@ -1171,7 +1178,7 @@
MessageKind errorCode,
[Map arguments = const {}]) {
reportMessage(spanFromSpannable(node),
- errorCode.error(arguments),
+ errorCode.error(arguments, terseDiagnostics),
api.Diagnostic.ERROR);
}
@@ -1187,21 +1194,21 @@
void reportWarningCode(Spannable node, MessageKind errorCode,
[Map arguments = const {}]) {
reportMessage(spanFromSpannable(node),
- errorCode.error(arguments),
+ errorCode.error(arguments, terseDiagnostics),
api.Diagnostic.WARNING);
}
void reportInfo(Spannable node, MessageKind errorCode,
[Map arguments = const {}]) {
reportMessage(spanFromSpannable(node),
- errorCode.error(arguments),
+ errorCode.error(arguments, terseDiagnostics),
api.Diagnostic.INFO);
}
void reportHint(Spannable node, MessageKind errorCode,
[Map arguments = const {}]) {
reportMessage(spanFromSpannable(node),
- errorCode.error(arguments),
+ errorCode.error(arguments, terseDiagnostics),
api.Diagnostic.HINT);
}
@@ -1221,24 +1228,6 @@
reportDiagnostic(span, "$message", kind);
}
- /// Returns true if a diagnostic was emitted.
- bool onDeprecatedFeature(Spannable span, String feature) {
- if (currentElement == null)
- throw new SpannableAssertionFailure(span, feature);
- if (!checkDeprecationInSdk &&
- currentElement.getLibrary().isPlatformLibrary) {
- return false;
- }
- var kind = rejectDeprecatedFeatures
- ? api.Diagnostic.ERROR : api.Diagnostic.WARNING;
- var message = rejectDeprecatedFeatures
- ? MessageKind.DEPRECATED_FEATURE_ERROR.error({'featureName': feature})
- : MessageKind.DEPRECATED_FEATURE_WARNING.error(
- {'featureName': feature});
- reportMessage(spanFromSpannable(span), message, kind);
- return true;
- }
-
void reportDiagnostic(SourceSpan span, String message, api.Diagnostic kind);
SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) {
diff --git a/sdk/lib/_internal/compiler/implementation/dart2js.dart b/sdk/lib/_internal/compiler/implementation/dart2js.dart
index 55812c0..6b24057 100644
--- a/sdk/lib/_internal/compiler/implementation/dart2js.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart2js.dart
@@ -256,12 +256,10 @@
new OptionHandler('--analyze-only', setAnalyzeOnly),
new OptionHandler('--analyze-signatures-only', passThrough),
new OptionHandler('--disable-native-live-type-analysis', passThrough),
- new OptionHandler('--reject-deprecated-language-features', passThrough),
- new OptionHandler('--report-sdk-use-of-deprecated-language-features',
- passThrough),
new OptionHandler('--categories=.*', setCategories),
new OptionHandler('--global-js-name=.*', checkGlobalName),
new OptionHandler('--disable-type-inference', passThrough),
+ new OptionHandler('--terse', passThrough),
// The following two options must come last.
new OptionHandler('-.*', (String argument) {
@@ -503,6 +501,10 @@
--enable-diagnostic-colors
Add colors to diagnostic messages.
+ --terse
+ Emit diagnostics without suggestions for how to get rid of the diagnosed
+ problems.
+
The following options are only used for compiler development and may
be removed in a future version:
@@ -526,19 +528,6 @@
Disable the optimization that removes unused native types from dart:html
and related libraries.
- --reject-deprecated-language-features
- Reject deprecated language features. Without this option, the
- compiler will accept language features that are no longer valid
- according to The Dart Programming Language Specification, version
- 0.12, M1.
-
- --report-sdk-use-of-deprecated-language-features
- Report use of deprecated features in Dart platform libraries.
- Without this option, the compiler will silently accept use of
- deprecated language features from these libraries. The option
- --reject-deprecated-language-features controls if these usages are
- reported as errors or warnings.
-
--categories=<categories>
A comma separated list of allowed library categories. The default
is "Client". Possible categories can be seen by providing an
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
index 4c29888..9f4c816 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
@@ -122,6 +122,12 @@
final bool stripAsserts;
// TODO(antonm): make available from command-line options.
final bool outputAst = false;
+ final Map<Node, String> renames;
+ final Map<LibraryElement, String> imports;
+ final Map<ClassNode, List<Node>> memberNodes;
+ // TODO(zarah) Maybe change this to a command-line option.
+ // Right now, it is set by the tests.
+ bool useMirrorHelperLibrary = false;
Map<Element, TreeElements> get resolvedElements =>
compiler.enqueuer.resolution.resolvedElements;
@@ -171,6 +177,9 @@
DartBackend(Compiler compiler, List<String> strips)
: tasks = <CompilerTask>[],
+ renames = new Map<Node, String>(),
+ imports = new Map<LibraryElement, String>(),
+ memberNodes = new Map<ClassNode, List<Node>>(),
forceStripTypes = strips.indexOf('types') != -1,
stripAsserts = strips.indexOf('asserts') != -1,
super(compiler);
@@ -357,7 +366,7 @@
var classNode = classElement.parseNode(compiler);
SynthesizedConstructorElementX constructor =
new SynthesizedConstructorElementX(
- classElement.name, null, classElement);
+ classElement.name, null, classElement, false);
constructor.type = new FunctionType(
constructor,
compiler.types.voidType,
@@ -395,8 +404,6 @@
}
topLevelElements.forEach(makePlaceholders);
// Create renames.
- Map<Node, String> renames = new Map<Node, String>();
- Map<LibraryElement, String> imports = new Map<LibraryElement, String>();
bool shouldCutDeclarationTypes = forceStripTypes
|| (compiler.enableMinification
&& isSafeToRemoveTypeDeclarations(classMembers));
@@ -431,7 +438,6 @@
}
final topLevelNodes = <Node>[];
- final memberNodes = new Map<ClassNode, List<Node>>();
for (final element in sortedTopLevels) {
topLevelNodes.add(elementAsts[element].ast);
if (element.isClass() && !element.isMixinApplication) {
@@ -443,6 +449,10 @@
}
}
+ if (useMirrorHelperLibrary && compiler.mirrorsLibrary != null) {
+ MirrorRenamer.addMirrorHelperImport(imports);
+ }
+
final unparser = new EmitterUnparser(renames);
emitCode(unparser, imports, topLevelNodes, memberNodes);
compiler.assembledCode = unparser.result;
@@ -468,6 +478,12 @@
}
log(String message) => compiler.log('[DartBackend] $message');
+
+ void registerStaticSend(Element element, Node node) {
+ if (useMirrorHelperLibrary && compiler.mirrorsLibrary != null) {
+ MirrorRenamer.handleStaticSend(renames, element, node, compiler);
+ }
+ }
}
class EmitterUnparser extends Unparser {
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart
index 8a8abe4..82bfe58 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart
@@ -10,6 +10,7 @@
import '../dart_types.dart';
import '../tree/tree.dart';
import '../util/util.dart';
+import '../mirror_renamer/mirror_renamer.dart' show MirrorRenamer;
import '../scanner/scannerlib.dart' show StringToken,
Keyword,
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
index c7c7ec2..db7b9ee 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -45,6 +45,7 @@
final PlaceholderCollector collector;
get compiler => collector.compiler;
+ DartBackend get backend => compiler.backend;
SendVisitor(this.collector, TreeElements elements) : super(elements);
@@ -106,6 +107,8 @@
visitStaticSend(Send node) {
final element = elements[node];
+ backend.registerStaticSend(element, node);
+
if (Elements.isUnresolved(element)
|| identical(element, compiler.assertMethod)) {
return;
diff --git a/sdk/lib/_internal/compiler/implementation/deferred_load.dart b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
index 53eca97..4ecf03f 100644
--- a/sdk/lib/_internal/compiler/implementation/deferred_load.dart
+++ b/sdk/lib/_internal/compiler/implementation/deferred_load.dart
@@ -83,21 +83,23 @@
new LinkedHashMap<LibraryElement, Set<Element>>();
Set<Element> eagerElements = new LinkedHashSet<Element>();
- // Iterate through the local members of the main script. Create
+ // Iterate through live local members of the main script. Create
// a root-set of elements that must be loaded eagerly
// (everything that is directly referred to from the main
// script, but not imported from a deferred library), as well as
// root-sets for deferred libraries.
mainApp.forEachLocalMember((Element e) {
- for (Element dependency in allElementsResolvedFrom(e)) {
- if (isExplicitlyDeferred(dependency)) {
- Set<Element> deferredElementsFromLibrary =
- deferredElements.putIfAbsent(
- dependency.getLibrary(),
- () => new LinkedHashSet<Element>());
- deferredElementsFromLibrary.add(dependency);
- } else if (dependency.getLibrary() != mainApp) {
- eagerElements.add(dependency.implementation);
+ if (compiler.enqueuer.resolution.isLive(e)) {
+ for (Element dependency in allElementsResolvedFrom(e)) {
+ if (isExplicitlyDeferred(dependency)) {
+ Set<Element> deferredElementsFromLibrary =
+ deferredElements.putIfAbsent(
+ dependency.getLibrary(),
+ () => new LinkedHashSet<Element>());
+ deferredElementsFromLibrary.add(dependency);
+ } else if (dependency.getLibrary() != mainApp) {
+ eagerElements.add(dependency.implementation);
+ }
}
}
});
diff --git a/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart b/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart
index 67d3792..ca73463 100644
--- a/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart
+++ b/sdk/lib/_internal/compiler/implementation/diagnostic_listener.dart
@@ -23,9 +23,6 @@
void reportInfo(Spannable node, MessageKind errorCode, [Map arguments]);
- /// Returns true if a diagnostic was emitted.
- bool onDeprecatedFeature(Spannable span, String feature);
-
// TODO(ahe): We should not expose this here. Perhaps a
// [SourceSpan] should implement [Spannable], and we should have a
// way to construct a [SourceSpan] from a [Spannable] and an
diff --git a/sdk/lib/_internal/compiler/implementation/elements/elements.dart b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
index 30825c7..21d5920 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/elements.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/elements.dart
@@ -585,7 +585,7 @@
// TODO(kasperl): This probably shouldn't be called an element. It's
// just an interface shared by classes and libraries.
-abstract class ScopeContainerElement {
+abstract class ScopeContainerElement implements Element {
Element localLookup(SourceString elementName);
void forEachLocalMember(f(Element element));
@@ -819,6 +819,7 @@
SourceString get nativeTagInfo;
bool get isMixinApplication;
+ bool get isUnnamedMixinApplication;
bool get hasBackendMembers;
bool get hasLocalScopeMembers;
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index 6c8bdd1..3bdbe46 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -1398,17 +1398,19 @@
*/
class SynthesizedConstructorElementX extends FunctionElementX {
final FunctionElement superMember;
+ final bool isDefaultConstructor;
SynthesizedConstructorElementX(SourceString name,
this.superMember,
- Element enclosing)
+ Element enclosing,
+ this.isDefaultConstructor)
: super(name,
ElementKind.GENERATIVE_CONSTRUCTOR,
Modifiers.EMPTY,
enclosing);
SynthesizedConstructorElementX.forDefault(superMember, Element enclosing)
- : this(const SourceString(''), superMember, enclosing);
+ : this(const SourceString(''), superMember, enclosing, true);
Token position() => enclosingElement.position();
@@ -1417,6 +1419,11 @@
FunctionElement get targetConstructor => superMember;
FunctionSignature computeSignature(compiler) {
+ if (isDefaultConstructor) {
+ return new FunctionSignatureX(
+ const Link<Element>(), const Link<Element>(), 0, 0, false,
+ getEnclosingClass().thisType);
+ }
if (superMember.isErroneous()) {
return compiler.objectClass.localLookup(
const SourceString('')).computeSignature(compiler);
@@ -1525,6 +1532,8 @@
bool get hasBackendMembers => !backendMembers.isEmpty;
+ bool get isUnnamedMixinApplication => false;
+
InterfaceType computeType(Compiler compiler) {
if (thisType == null) {
if (origin == null) {
@@ -1987,6 +1996,7 @@
: super(name, enclosing, id, STATE_NOT_STARTED);
bool get isMixinApplication => true;
+ bool get isUnnamedMixinApplication => node is! NamedMixinApplication;
bool get hasConstructor => !constructors.isEmpty;
bool get hasLocalScopeMembers => !constructors.isEmpty;
diff --git a/sdk/lib/_internal/compiler/implementation/enqueue.dart b/sdk/lib/_internal/compiler/implementation/enqueue.dart
index 288065d..f750960 100644
--- a/sdk/lib/_internal/compiler/implementation/enqueue.dart
+++ b/sdk/lib/_internal/compiler/implementation/enqueue.dart
@@ -572,6 +572,13 @@
bool isProcessed(Element member) => resolvedElements.containsKey(member);
+ /// Returns [:true:] if [element] has actually been used.
+ bool isLive(Element element) {
+ if (seenClasses.contains(element)) return true;
+ if (getCachedElements(element) != null) return true;
+ return false;
+ }
+
TreeElements getCachedElements(Element element) {
// TODO(ngeoffray): Get rid of this check.
if (element.enclosingElement.isClosure()) {
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index cc7b0fb..970af53 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -308,6 +308,9 @@
/// True if a call to disableTreeShaking has been seen.
bool isTreeShakingDisabled = false;
+ /// True if there isn't sufficient @MirrorsUsed data.
+ bool hasInsufficientMirrorsUsed = false;
+
/// List of instantiated types from metadata. If metadata must be preserved,
/// these types must registered.
final List<Dependency> metadataInstantiatedTypes = <Dependency>[];
@@ -1359,10 +1362,9 @@
void registerStaticUse(Element element, Enqueuer enqueuer) {
if (element == disableTreeShakingMarker) {
- enqueuer.enqueueEverything();
- if (isTreeShakingDisabled) return;
compiler.disableTypeInferenceForMirrors = true;
isTreeShakingDisabled = true;
+ enqueuer.enqueueEverything();
} else if (element == preserveNamesMarker) {
if (mustPreserveNames) return;
mustPreserveNames = true;
@@ -1395,17 +1397,25 @@
/// Called when [:const Symbol(name):] is seen.
void registerConstSymbol(String name, TreeElements elements) {
+ symbolsUsed.add(name);
}
/// Called when [:new Symbol(...):] is seen.
void registerNewSymbol(TreeElements elements) {
}
- bool retainGetter(Element element) => isTreeShakingDisabled;
+ /// Should [element] (a getter) be retained for reflection?
+ bool shouldRetainGetter(Element element) => isNeededForReflection(element);
- bool retainSetter(Element element) => isTreeShakingDisabled;
+ /// Should [element] (a setter) be retained for reflection?
+ bool shouldRetainSetter(Element element) => isNeededForReflection(element);
- bool retainName(SourceString name) => mustPreserveNames;
+ /// Should [name] be retained for reflection?
+ bool shouldRetainName(SourceString name) {
+ if (hasInsufficientMirrorsUsed) return mustPreserveNames;
+ if (name == const SourceString('')) return false;
+ return symbolsUsed.contains(name.slowToString());
+ }
bool get rememberLazies => isTreeShakingDisabled;
@@ -1460,20 +1470,49 @@
void registerMirrorUsage(Set<String> symbols,
Set<Element> targets,
Set<Element> metaTargets) {
+ if (symbols == null && targets == null && metaTargets == null) {
+ // The user didn't specify anything, or there are imports of
+ // 'dart:mirrors' without @MirrorsUsed.
+ hasInsufficientMirrorsUsed = true;
+ return;
+ }
if (symbols != null) symbolsUsed.addAll(symbols);
if (targets != null) {
- for (Element element in targets) {
- // TODO(ahe): Implement finer granularity.
- targetsUsed.add(element.getLibrary());
+ for (Element target in targets) {
+ if (target.isAbstractField()) {
+ AbstractFieldElement field = target;
+ targetsUsed.add(field.getter);
+ targetsUsed.add(field.setter);
+ } else {
+ targetsUsed.add(target);
+ }
}
}
if (metaTargets != null) metaTargetsUsed.addAll(metaTargets);
}
bool isNeededForReflection(Element element) {
- // TODO(ahe): Implement this.
- if (!metaTargetsUsed.isEmpty) return true;
- if (targetsUsed.contains(element.getLibrary())) return true;
+ if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled;
+ /// Record the name of [element] in [symbolsUsed]. Return true for
+ /// convenience.
+ bool registerNameOf(Element element) {
+ symbolsUsed.add(element.name.slowToString());
+ if (element.isConstructor()) {
+ symbolsUsed.add(element.getEnclosingClass().name.slowToString());
+ }
+ return true;
+ }
+
+ if (!metaTargetsUsed.isEmpty) {
+ // TODO(ahe): Implement this.
+ return registerNameOf(element);
+ }
+
+ if (!targetsUsed.isEmpty) {
+ for (Element e = element; e != null; e = e.enclosingElement) {
+ if (targetsUsed.contains(e)) return registerNameOf(element);
+ }
+ }
return false;
}
}
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 2302aec..21e7b5c 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -1220,7 +1220,7 @@
bool fieldNeedsGetter(VariableElement field) {
assert(field.isField());
if (fieldAccessNeverThrows(field)) return false;
- return backend.retainGetter(field)
+ return backend.shouldRetainGetter(field)
|| compiler.codegenWorld.hasInvokedGetter(field, compiler);
}
@@ -1228,7 +1228,7 @@
assert(field.isField());
if (fieldAccessNeverThrows(field)) return false;
return (!field.modifiers.isFinalOrConst())
- && (backend.retainSetter(field)
+ && (backend.shouldRetainSetter(field)
|| compiler.codegenWorld.hasInvokedSetter(field, compiler));
}
@@ -1288,8 +1288,25 @@
emitExtraAccessors(member, builder);
}
+ /// Returns the "reflection name" of an [Element] or [Selector].
+ /// The reflection name of a getter 'foo' is 'foo'.
+ /// The reflection name of a setter 'foo' is 'foo='.
+ /// The reflection name of a method 'foo' is 'foo:N:M:O', where N is the
+ /// number of required arguments, M is the number of optional arguments, and
+ /// O is the named arguments.
+ /// The reflection name of a constructor is similar to a regular method but
+ /// starts with 'new '.
+ /// This is used by js_mirrors.dart.
String getReflectionName(elementOrSelector, String mangledName) {
- if (!backend.retainName(elementOrSelector.name)) return null;
+ SourceString name = elementOrSelector.name;
+ if (!backend.shouldRetainName(name)) {
+ if (name == const SourceString('') && elementOrSelector is Element) {
+ // Make sure to retain names of unnamed constructors.
+ if (!backend.isNeededForReflection(elementOrSelector)) return null;
+ } else {
+ return null;
+ }
+ }
// TODO(ahe): Enable the next line when I can tell the difference between
// an instance method and a global. They may have the same mangled name.
// if (recordedMangledNames.contains(mangledName)) return null;
@@ -1701,7 +1718,7 @@
void recordMangledField(Element member,
String accessorName,
String memberName) {
- if (!backend.retainGetter(member)) return;
+ if (!backend.shouldRetainGetter(member)) return;
String previousName;
if (member.isInstanceMember()) {
previousName = mangledFieldNames.putIfAbsent(
@@ -1959,8 +1976,9 @@
}
buffer.write('$className:$_');
buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler));
- if (backend.retainName(classElement.name)) {
+ if (backend.shouldRetainName(classElement.name)) {
buffer.write(',$n$n"+${classElement.name.slowToString()}": 0');
+ recordedMangledNames.add(className);
}
}
@@ -2029,6 +2047,9 @@
bool haveSameTypeVariables(ClassElement a, ClassElement b) {
if (a.isClosure()) return true;
+ if (b.isUnnamedMixinApplication) {
+ return false;
+ }
return a.typeVariables == b.typeVariables;
}
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart b/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
index 4c72122..29e1ecb 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart
@@ -463,15 +463,13 @@
{ bool alwaysGenerateFunction: false }) {
if (isTrivialSubstitution(cls, check)) return null;
+ // Unnamed mixin application classes do not need substitutions, because they
+ // are never instantiated and their checks are overwritten by the class that
+ // they are mixed into.
+ if (cls.isUnnamedMixinApplication) return null;
InterfaceType type = cls.computeType(compiler);
InterfaceType target = type.asInstanceOf(check);
- Link<DartType> typeVariables;
- if (cls.isMixinApplication) {
- MixinApplicationElement mixinApplication = cls;
- typeVariables = mixinApplication.mixin.typeVariables;
- } else {
- typeVariables = cls.typeVariables;
- }
+ Link<DartType> typeVariables = cls.typeVariables;
if (typeVariables.isEmpty && !alwaysGenerateFunction) {
return new Substitution.list(target.typeArguments);
} else {
diff --git a/sdk/lib/_internal/compiler/implementation/library_loader.dart b/sdk/lib/_internal/compiler/implementation/library_loader.dart
index 0bcd1a5..8f4f224 100644
--- a/sdk/lib/_internal/compiler/implementation/library_loader.dart
+++ b/sdk/lib/_internal/compiler/implementation/library_loader.dart
@@ -368,17 +368,7 @@
compiler.withCurrentElement(unit, () {
compiler.scanner.scan(unit);
if (unit.partTag == null) {
- bool wasDiagnosticEmitted = false;
- compiler.withCurrentElement(library, () {
- wasDiagnosticEmitted =
- compiler.onDeprecatedFeature(part, 'missing part-of tag');
- });
- if (wasDiagnosticEmitted) {
- compiler.reportMessage(
- compiler.spanFromElement(unit),
- MessageKind.MISSING_PART_OF_TAG.error(),
- api.Diagnostic.INFO);
- }
+ compiler.reportError(unit, MessageKind.MISSING_PART_OF_TAG);
}
});
}
diff --git a/sdk/lib/_internal/compiler/implementation/mirror_renamer/mirror_renamer.dart b/sdk/lib/_internal/compiler/implementation/mirror_renamer/mirror_renamer.dart
new file mode 100644
index 0000000..3ed8b5d
--- /dev/null
+++ b/sdk/lib/_internal/compiler/implementation/mirror_renamer/mirror_renamer.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.
+
+library mirror_renamer;
+
+// TODO(zarah): Remove this hack! LibraryElementX should not be created outside
+// the library loader!
+import '../elements/modelx.dart' show LibraryElementX;
+import '../dart2jslib.dart' show Script, Compiler;
+import '../tree/tree.dart';
+import '../elements/elements.dart';
+
+part 'renamer.dart';
\ No newline at end of file
diff --git a/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart b/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.dart
new file mode 100644
index 0000000..003dda4
--- /dev/null
+++ b/sdk/lib/_internal/compiler/implementation/mirror_renamer/renamer.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.
+
+part of mirror_renamer;
+
+class MirrorRenamer {
+ static const String MIRROR_HELPER_CLASS = 'MirrorHelper';
+ static const String MIRROR_HELPER_GET_NAME_FUNCTION = 'getName';
+ static const String MIRROR_HELPER_LIBRARY_NAME = 'mirror_helper.dart';
+ static const String MIRROR_HELPER_LIBRARY_PREFIX = 'm';
+ static const String MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME =
+ '$MIRROR_HELPER_LIBRARY_PREFIX.$MIRROR_HELPER_CLASS';
+
+ static void handleStaticSend(Map<Node, String> renames, Element element,
+ Send node, Compiler compiler) {
+ if (element == compiler.mirrorSystemGetNameFunction) {
+ renames[node.selector] = MIRROR_HELPER_GET_NAME_FUNCTION;
+ renames[node.receiver] = MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME;
+ }
+ }
+
+ static void addMirrorHelperImport(Map<LibraryElement, String> imports) {
+ Uri mirrorHelperUri = new Uri(path: MIRROR_HELPER_LIBRARY_NAME);
+ // TODO(zarah): Remove this hack! LibraryElementX should not be created
+ // outside the library loader. When actual mirror helper library
+ // is created, change to load that.
+ LibraryElement mirrorHelperLib = new LibraryElementX(
+ new Script(mirrorHelperUri, null));
+ imports.putIfAbsent(mirrorHelperLib, () => MIRROR_HELPER_LIBRARY_PREFIX);
+ }
+}
\ No newline at end of file
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
index 7b795a2..9c8df9c 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors_used.dart
@@ -13,23 +13,36 @@
MessageKind,
SourceString,
StringConstant,
- TypeConstant;
+ TreeElements,
+ TypeConstant,
+ invariant;
import 'elements/elements.dart' show
+ ClassElement,
Element,
LibraryElement,
MetadataAnnotation,
+ ScopeContainerElement,
VariableElement;
import 'util/util.dart' show
- Link;
+ Link,
+ Spannable;
import 'dart_types.dart' show
- DartType;
+ DartType,
+ InterfaceType,
+ TypeKind;
import 'tree/tree.dart' show
Import,
- LibraryTag;
+ LibraryTag,
+ NamedArgument,
+ NewExpression,
+ Node;
+
+import 'resolution/resolution.dart' show
+ ConstantMapper;
/**
* Compiler task that analyzes MirrorsUsed annotations.
@@ -81,13 +94,17 @@
*/
class MirrorUsageAnalyzerTask extends CompilerTask {
Set<LibraryElement> librariesWithUsage;
+ MirrorUsageAnalyzer analyzer;
MirrorUsageAnalyzerTask(Compiler compiler)
- : super(compiler);
+ : super(compiler) {
+ analyzer = new MirrorUsageAnalyzer(compiler, this);
+ }
+ /// Collect @MirrorsUsed annotations in all libraries. Called by the
+ /// compiler after all libraries are loaded, but before resolution.
void analyzeUsage(LibraryElement mainApp) {
if (compiler.mirrorsLibrary == null) return;
- MirrorUsageAnalyzer analyzer = new MirrorUsageAnalyzer(compiler, this);
measure(analyzer.run);
List<String> symbols = analyzer.mergedMirrorUsage.symbols;
List<Element> targets = analyzer.mergedMirrorUsage.targets;
@@ -99,44 +116,90 @@
librariesWithUsage = analyzer.librariesWithUsage;
}
+ /// Is there a @MirrorsUsed annotation in the library of [element]? Used by
+ /// the resolver to suppress hints about using new Symbol or
+ /// MirrorSystem.getName.
bool hasMirrorUsage(Element element) {
return librariesWithUsage != null
&& librariesWithUsage.contains(element.getLibrary());
}
+
+ /// Call-back from the resolver to analyze MirorsUsed annotations. The result
+ /// is stored in [analyzer] and later used to compute
+ /// [:analyzer.mergedMirrorUsage:].
+ void validate(NewExpression node, TreeElements mapping) {
+ for (Node argument in node.send.arguments) {
+ NamedArgument named = argument.asNamedArgument();
+ if (named == null) continue;
+ Constant value = compiler.metadataHandler.compileNodeWithDefinitions(
+ named.expression, mapping, isConst: true);
+
+ ConstantMapper mapper =
+ new ConstantMapper(compiler.metadataHandler, mapping, compiler);
+ named.expression.accept(mapper);
+
+ MirrorUsageBuilder builder =
+ new MirrorUsageBuilder(
+ analyzer, mapping.currentElement.getLibrary(), named.expression,
+ value, mapper.constantToNodeMap);
+
+ if (named.name.source == const SourceString('symbols')) {
+ analyzer.cachedValues[value] =
+ builder.convertToListOfStrings(
+ builder.convertConstantToUsageList(value, onlyStrings: true));
+ } else if (named.name.source == const SourceString('targets')) {
+ analyzer.cachedValues[value] =
+ builder.resolveUsageList(builder.convertConstantToUsageList(value));
+ } else if (named.name.source == const SourceString('metaTargets')) {
+ analyzer.cachedValues[value] =
+ builder.resolveUsageList(builder.convertConstantToUsageList(value));
+ } else if (named.name.source == const SourceString('override')) {
+ analyzer.cachedValues[value] =
+ builder.resolveUsageList(builder.convertConstantToUsageList(value));
+ }
+ }
+ }
}
class MirrorUsageAnalyzer {
final Compiler compiler;
final MirrorUsageAnalyzerTask task;
- final List<LibraryElement> wildcard;
+ List<LibraryElement> wildcard;
final Set<LibraryElement> librariesWithUsage;
- final Set<LibraryElement> librariesWithoutUsage;
+ final Map<Constant, List> cachedValues;
MirrorUsage mergedMirrorUsage;
MirrorUsageAnalyzer(Compiler compiler, this.task)
: compiler = compiler,
- wildcard = compiler.libraries.values.toList(),
librariesWithUsage = new Set<LibraryElement>(),
- librariesWithoutUsage = new Set<LibraryElement>();
+ cachedValues = new Map<Constant, List>();
+ /// Collect and merge all @MirrorsUsed annotations. As a side-effect, also
+ /// compute which libraries have the annotation (which is used by
+ /// [MirrorUsageAnalyzerTask.hasMirrorUsage]).
void run() {
+ wildcard = compiler.libraries.values.toList();
Map<LibraryElement, List<MirrorUsage>> usageMap =
collectMirrorsUsedAnnotation();
propagateOverrides(usageMap);
- librariesWithoutUsage.removeAll(usageMap.keys);
+ Set<LibraryElement> librariesWithoutUsage = new Set<LibraryElement>();
+ usageMap.forEach((LibraryElement library, List<MirrorUsage> usage) {
+ if (usage.isEmpty) librariesWithoutUsage.add(library);
+ });
if (librariesWithoutUsage.isEmpty) {
mergedMirrorUsage = mergeUsages(usageMap);
} else {
- mergedMirrorUsage = new MirrorUsage(null, wildcard, null, null);
+ mergedMirrorUsage = new MirrorUsage(null, null, null, null);
}
}
+ /// Collect all @MirrorsUsed from all libraries and represent them as
+ /// [MirrorUsage].
Map<LibraryElement, List<MirrorUsage>> collectMirrorsUsedAnnotation() {
Map<LibraryElement, List<MirrorUsage>> result =
new Map<LibraryElement, List<MirrorUsage>>();
for (LibraryElement library in compiler.libraries.values) {
if (library.isInternalLibrary) continue;
- librariesWithoutUsage.add(library);
for (LibraryTag tag in library.tags) {
Import importTag = tag.asImport();
if (importTag == null) continue;
@@ -157,6 +220,7 @@
return result;
}
+ /// Apply [MirrorUsage] with 'override' to libraries they override.
void propagateOverrides(Map<LibraryElement, List<MirrorUsage>> usageMap) {
Map<LibraryElement, List<MirrorUsage>> propagatedOverrides =
new Map<LibraryElement, List<MirrorUsage>>();
@@ -189,6 +253,8 @@
});
}
+ /// Find @MirrorsUsed annotations on the given import [tag] in [library]. The
+ /// annotations are represented as [MirrorUsage].
List<MirrorUsage> mirrorsUsedOnLibraryTag(LibraryElement library,
Import tag) {
LibraryElement importedLibrary = library.getLibraryFromTag(tag);
@@ -200,19 +266,13 @@
metadata.ensureResolved(compiler);
Element element = metadata.value.computeType(compiler).element;
if (element == compiler.mirrorsUsedClass) {
- try {
- MirrorUsage usage =
- new MirrorUsageBuilder(this, library).build(metadata.value);
- result.add(usage);
- } on BadMirrorsUsedAnnotation catch (e) {
- compiler.reportError(
- metadata, MessageKind.GENERIC, {'text': e.message});
- }
+ result.add(buildUsage(metadata.value));
}
}
return result;
}
+ /// Merge all [MirrorUsage] instances accross all libraries.
MirrorUsage mergeUsages(Map<LibraryElement, List<MirrorUsage>> usageMap) {
Set<MirrorUsage> usagesToMerge = new Set<MirrorUsage>();
usageMap.forEach((LibraryElement library, List<MirrorUsage> usages) {
@@ -230,7 +290,11 @@
}
}
+ /// Merge [a] with [b]. The resulting [MirrorUsage] simply has the symbols,
+ /// targets, and metaTargets of [a] and [b] concatenated. 'override' is
+ /// ignored.
MirrorUsage merge(MirrorUsage a, MirrorUsage b) {
+ // TOOO(ahe): Should be an instance method on MirrorUsage.
if (a.symbols == null && a.targets == null && a.metaTargets == null) {
return b;
} else if (
@@ -258,8 +322,30 @@
}
return new MirrorUsage(symbols, targets, metaTargets, null);
}
+
+ /// Convert a [constant] to an instance of [MirrorUsage] using information
+ /// that was resolved during [MirrorUsageAnalyzerTask.validate].
+ MirrorUsage buildUsage(ConstructedConstant constant) {
+ Map<Element, Constant> fields = constant.fieldElements;
+ VariableElement symbolsField = compiler.mirrorsUsedClass.lookupLocalMember(
+ const SourceString('symbols'));
+ VariableElement targetsField = compiler.mirrorsUsedClass.lookupLocalMember(
+ const SourceString('targets'));
+ VariableElement metaTargetsField =
+ compiler.mirrorsUsedClass.lookupLocalMember(
+ const SourceString('metaTargets'));
+ VariableElement overrideField = compiler.mirrorsUsedClass.lookupLocalMember(
+ const SourceString('override'));
+
+ return new MirrorUsage(
+ cachedValues[fields[symbolsField]],
+ cachedValues[fields[targetsField]],
+ cachedValues[fields[metaTargetsField]],
+ cachedValues[fields[overrideField]]);
+ }
}
+/// Used to represent a resolved MirrorsUsed constant.
class MirrorUsage {
final List<String> symbols;
final List<Element> targets;
@@ -281,38 +367,28 @@
}
class MirrorUsageBuilder {
- MirrorUsageAnalyzer analyzer;
- LibraryElement enclosingLibrary;
+ final MirrorUsageAnalyzer analyzer;
+ final LibraryElement enclosingLibrary;
+ final Spannable spannable;
+ final Constant constant;
+ final Map<Constant, Node> constantToNodeMap;
- MirrorUsageBuilder(this.analyzer, this.enclosingLibrary);
+ MirrorUsageBuilder(
+ this.analyzer,
+ this.enclosingLibrary,
+ this.spannable,
+ this.constant,
+ this.constantToNodeMap);
Compiler get compiler => analyzer.compiler;
- MirrorUsage build(ConstructedConstant constant) {
- Map<Element, Constant> fields = constant.fieldElements;
- VariableElement symbolsField = compiler.mirrorsUsedClass.lookupLocalMember(
- const SourceString('symbols'));
- VariableElement targetsField = compiler.mirrorsUsedClass.lookupLocalMember(
- const SourceString('targets'));
- VariableElement metaTargetsField =
- compiler.mirrorsUsedClass.lookupLocalMember(
- const SourceString('metaTargets'));
- VariableElement overrideField = compiler.mirrorsUsedClass.lookupLocalMember(
- const SourceString('override'));
- List<String> symbols =
- convertToListOfStrings(
- convertConstantToUsageList(fields[symbolsField]));
- List<Element> targets =
- resolveUsageList(convertConstantToUsageList(fields[targetsField]));
-
- List<Element> metaTargets =
- resolveUsageList(convertConstantToUsageList(fields[metaTargetsField]));
- List<Element> override =
- resolveUsageList(convertConstantToUsageList(fields[overrideField]));
- return new MirrorUsage(symbols, targets, metaTargets, override);
- }
-
- List convertConstantToUsageList(Constant constant) {
+ /// Convert a constant to a list of [String] and [Type] values. If the
+ /// constant is a single [String], it is assumed to be a comma-separated list
+ /// of qualified names. If the constant is a [Type] t, the result is [:[t]:].
+ /// Otherwise, the constant is assumed to represent a list of strings (each a
+ /// qualified name) and types, and such a list is constructed.
+ List convertConstantToUsageList(
+ Constant constant, { bool onlyStrings: false }) {
if (constant.isNull()) {
return null;
} else if (constant.isList()) {
@@ -322,16 +398,21 @@
if (entry.isString()) {
StringConstant string = entry;
result.add(string.value.slowToString());
- } else if (entry.isType()) {
+ } else if (!onlyStrings && entry.isType()) {
TypeConstant type = entry;
result.add(type.representedType);
} else {
- throw new BadMirrorsUsedAnnotation(
- 'Expected a string or type, but got "$entry".');
+ Spannable node = positionOf(entry);
+ MessageKind kind = onlyStrings
+ ? MessageKind.MIRRORS_EXPECTED_STRING
+ : MessageKind.MIRRORS_EXPECTED_STRING_OR_TYPE;
+ compiler.reportHint(
+ node,
+ kind, {'name': node, 'type': apiTypeOf(entry)});
}
}
return result;
- } else if (constant.isType()) {
+ } else if (!onlyStrings && constant.isType()) {
TypeConstant type = constant;
return [type.representedType];
} else if (constant.isString()) {
@@ -339,25 +420,53 @@
return
string.value.slowToString().split(',').map((e) => e.trim()).toList();
} else {
- throw new BadMirrorsUsedAnnotation(
- 'Expected a string or a list of string, but got "$constant".');
+ Spannable node = positionOf(constant);
+ MessageKind kind = onlyStrings
+ ? MessageKind.MIRRORS_EXPECTED_STRING_OR_LIST
+ : MessageKind.MIRRORS_EXPECTED_STRING_TYPE_OR_LIST;
+ compiler.reportHint(
+ node,
+ kind, {'name': node, 'type': apiTypeOf(constant)});
+ return null;
}
}
+ /// Find the first non-implementation interface of constant.
+ DartType apiTypeOf(Constant constant) {
+ DartType type = constant.computeType(compiler);
+ LibraryElement library = type.element.getLibrary();
+ if (type.kind == TypeKind.INTERFACE && library.isInternalLibrary) {
+ InterfaceType interface = type;
+ ClassElement cls = type.element;
+ for (DartType supertype in cls.ensureResolved(compiler).allSupertypes) {
+ if (supertype.kind == TypeKind.INTERFACE
+ && !supertype.element.getLibrary().isInternalLibrary) {
+ return interface.asInstanceOf(supertype.element);
+ }
+ }
+ }
+ return type;
+ }
+
+ /// Ensure a list contains only strings.
List<String> convertToListOfStrings(List list) {
if (list == null) return null;
List<String> result = new List<String>(list.length);
int count = 0;
for (var entry in list) {
- if (entry is! String) {
- throw new BadMirrorsUsedAnnotation(
- 'Expected a string, but got "$entry"');
- }
+ assert(invariant(spannable, entry is String));
result[count++] = entry;
}
return result;
}
+ /// Convert a list of strings and types to a list of elements. Types are
+ /// converted to their corresponding element, and strings are resolved as
+ /// follows:
+ ///
+ /// First find the longest library name that is a prefix of the string, if
+ /// there are none, resolve using [resolveExpression]. Otherwise, resolve the
+ /// rest of the string using [resolveLocalExpression].
List<Element> resolveUsageList(List list) {
if (list == null) return null;
if (list.length == 1 && list[0] == '*') {
@@ -370,22 +479,114 @@
result.add(type.element);
} else {
String string = entry;
+ LibraryElement libraryCandiate;
+ String libraryNameCandiate;
for (LibraryElement l in compiler.libraries.values) {
if (l.hasLibraryName()) {
String libraryName = l.getLibraryOrScriptName();
- if (string == libraryName || string.startsWith('$libraryName.')) {
- result.add(l);
+ if (string == libraryName) {
+ // Found an exact match.
+ libraryCandiate = l;
+ libraryNameCandiate = libraryName;
break;
+ } else if (string.startsWith('$libraryName.')) {
+ if (libraryNameCandiate == null
+ || libraryNameCandiate.length < libraryName.length) {
+ // Found a better candiate
+ libraryCandiate = l;
+ libraryNameCandiate = libraryName;
+ }
}
}
}
+ Element e;
+ if (libraryNameCandiate == string) {
+ e = libraryCandiate;
+ } else if (libraryNameCandiate != null) {
+ e = resolveLocalExpression(
+ libraryCandiate,
+ string.substring(libraryNameCandiate.length + 1).split('.'));
+ } else {
+ e = resolveExpression(string);
+ }
+ if (e != null) result.add(e);
}
}
return result;
}
-}
-class BadMirrorsUsedAnnotation {
- final String message;
- BadMirrorsUsedAnnotation(this.message);
+ /// Resolve [expression] in [enclosingLibrary]'s import scope.
+ Element resolveExpression(String expression) {
+ List<String> identifiers = expression.split('.');
+ Element element = enclosingLibrary.find(new SourceString(identifiers[0]));
+ if (element == null) {
+ compiler.reportHint(
+ spannable, MessageKind.MIRRORS_CANNOT_RESOLVE_IN_CURRENT_LIBRARY,
+ {'name': expression});
+ return null;
+ } else {
+ if (identifiers.length == 1) return element;
+ return resolveLocalExpression(element, identifiers.sublist(1));
+ }
+ }
+
+ /// Resolve [identifiers] in [element]'s local members.
+ Element resolveLocalExpression(Element element, List<String> identifiers) {
+ Element current = element;
+ for (String identifier in identifiers) {
+ Element e = findLocalMemberIn(current, new SourceString(identifier));
+ if (e == null) {
+ if (current.isLibrary()) {
+ LibraryElement library = current;
+ compiler.reportHint(
+ spannable, MessageKind.MIRRORS_CANNOT_RESOLVE_IN_LIBRARY,
+ {'name': identifiers[0],
+ 'library': library.getLibraryOrScriptName()});
+ } else {
+ compiler.reportHint(
+ spannable, MessageKind.MIRRORS_CANNOT_FIND_IN_ELEMENT,
+ {'name': identifier, 'element': current.name});
+ }
+ return current;
+ }
+ current = e;
+ }
+ return current;
+ }
+
+ /// Helper method to lookup members in a [ScopeContainerElement]. If
+ /// [element] is not a ScopeContainerElement, return null.
+ Element findLocalMemberIn(Element element, SourceString name) {
+ if (element is ScopeContainerElement) {
+ ScopeContainerElement scope = element;
+ return scope.localLookup(name);
+ }
+ return null;
+ }
+
+ /// Attempt to find a [Spannable] corresponding to constant.
+ Spannable positionOf(Constant constant) {
+ Node node = constantToNodeMap[constant];
+ if (node == null) {
+ // TODO(ahe): Returning [spannable] here leads to confusing error
+ // messages. For example, consider:
+ // @MirrorsUsed(targets: fisk)
+ // import 'dart:mirrors';
+ //
+ // const fisk = const [main];
+ //
+ // main() {}
+ //
+ // The message is:
+ // example.dart:1:23: Hint: Can't use 'fisk' here because ...
+ // Did you forget to add quotes?
+ // @MirrorsUsed(targets: fisk)
+ // ^^^^
+ //
+ // Instead of saying 'fisk' should pretty print the problematic constant
+ // value.
+ return spannable;
+ }
+ return node;
+ }
}
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 607bc6e..f6f8cc9 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -974,6 +974,23 @@
}
}
+class ConstantMapper extends Visitor {
+ final Map<Constant, Node> constantToNodeMap = new Map<Constant, Node>();
+ final CompileTimeConstantEvaluator evaluator;
+
+ ConstantMapper(ConstantHandler handler,
+ TreeElements elements,
+ Compiler compiler)
+ : evaluator = new CompileTimeConstantEvaluator(
+ handler, elements, compiler, isConst: false);
+
+ visitNode(Node node) {
+ Constant constant = evaluator.evaluate(node);
+ if (constant != null) constantToNodeMap[constant] = node;
+ node.visitChildren(this);
+ }
+}
+
class InitializerResolver {
final ResolverVisitor visitor;
final Map<Element, Node> initialized;
@@ -1274,7 +1291,8 @@
}
void warning(Node node, MessageKind kind, [Map arguments = const {}]) {
- ResolutionWarning message = new ResolutionWarning(kind, arguments);
+ ResolutionWarning message =
+ new ResolutionWarning(kind, arguments, compiler.terseDiagnostics);
compiler.reportWarning(node, message);
}
@@ -1515,7 +1533,7 @@
visitor, node, typdef.typeVariables, arguments);
if (hasTypeArgumentMismatch) {
type = new BadTypedefType(typdef,
- new TypedefType.forUserProvidedBadType(typdef,
+ new TypedefType.forUserProvidedBadType(typdef,
arguments.toLink()));
} else {
if (arguments.isEmpty) {
@@ -1750,7 +1768,8 @@
SourceString name,
DualKind kind,
[Map arguments = const {}]) {
- ResolutionWarning warning = new ResolutionWarning(kind.warning, arguments);
+ ResolutionWarning warning = new ResolutionWarning(
+ kind.warning, arguments, compiler.terseDiagnostics);
compiler.reportWarning(node, warning);
return new ErroneousElementX(kind.error, arguments, name, enclosingElement);
}
@@ -2131,17 +2150,22 @@
if (identical(string, '!') ||
identical(string, '&&') || identical(string, '||') ||
identical(string, 'is') || identical(string, 'as') ||
- identical(string, '===') || identical(string, '!==') ||
identical(string, '?') ||
identical(string, '>>>')) {
return null;
}
+ SourceString op = source;
if (!isUserDefinableOperator(source.stringValue)) {
- source = Elements.mapToUserOperator(source);
+ op = Elements.mapToUserOperatorOrNull(source);
+ }
+ if (op == null) {
+ // Unsupported operator. An error has been reported during parsing.
+ return new Selector.call(
+ source, library, node.argumentsNode.slowLength(), []);
}
return node.arguments.isEmpty
- ? new Selector.unaryOperator(source)
- : new Selector.binaryOperator(source);
+ ? new Selector.unaryOperator(op)
+ : new Selector.binaryOperator(op);
}
Identifier identifier = node.selector.asIdentifier();
@@ -2593,6 +2617,8 @@
Node selector = node.send.selector;
FunctionElement constructor = resolveConstructor(node);
final bool isSymbolConstructor = constructor == compiler.symbolConstructor;
+ final bool isMirrorsUsedConstant =
+ node.isConst() && (constructor == compiler.mirrorsUsedConstructor);
resolveSelector(node.send, constructor);
resolveArguments(node.send.argumentsNode);
useElement(node.send, constructor);
@@ -2645,6 +2671,8 @@
}
world.registerNewSymbol(mapping);
}
+ } else if (isMirrorsUsedConstant) {
+ compiler.mirrorUsageAnalyzerTask.validate(node, mapping);
}
return null;
@@ -3337,9 +3365,8 @@
FunctionElement createForwardingConstructor(FunctionElement target,
ClassElement enclosing) {
- return new SynthesizedConstructorElementX(target.name,
- target,
- enclosing);
+ return new SynthesizedConstructorElementX(
+ target.name, target, enclosing, false);
}
void doApplyMixinTo(MixinApplicationElement mixinApplication,
@@ -3854,14 +3881,8 @@
if (!identical(formalParameters.getEndToken().next.stringValue,
// TODO(ahe): Remove the check for native keyword.
'native')) {
- if (compiler.rejectDeprecatedFeatures &&
- // TODO(ahe): Remove isPlatformLibrary check.
- !element.getLibrary().isPlatformLibrary) {
- compiler.reportError(formalParameters,
- MessageKind.EXTRA_FORMALS);
- } else {
- compiler.onDeprecatedFeature(formalParameters, 'getter parameters');
- }
+ compiler.reportError(formalParameters,
+ MessageKind.EXTRA_FORMALS);
}
}
LinkBuilder<Element> parametersBuilder =
@@ -3890,10 +3911,6 @@
MessageKind.ILLEGAL_SETTER_FORMALS);
}
}
- if (element.isGetter() && (requiredParameterCount != 0
- || visitor.optionalParameterCount != 0)) {
- compiler.reportError(formalParameters, MessageKind.EXTRA_FORMALS);
- }
return new FunctionSignatureX(parameters,
visitor.optionalParameters,
requiredParameterCount,
@@ -3939,7 +3956,8 @@
error(diagnosticNode, kind.error, arguments);
} else {
ResolutionWarning warning =
- new ResolutionWarning(kind.warning, arguments);
+ new ResolutionWarning(
+ kind.warning, arguments, compiler.terseDiagnostics);
compiler.reportWarning(diagnosticNode, warning);
return new ErroneousElementX(
kind.error, arguments, targetName, enclosing);
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/listener.dart b/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
index 65f35e2..7d3cf1c 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/listener.dart
@@ -1346,8 +1346,13 @@
NodeList arguments = new NodeList.singleton(argument);
pushNode(new Send(receiver, new Operator(token), arguments));
}
- if (identical(tokenString, '===') || identical(tokenString, '!==')) {
- listener.onDeprecatedFeature(token, tokenString);
+ if (identical(tokenString, '===')) {
+ listener.reportError(token, MessageKind.UNSUPPORTED_EQ_EQ_EQ,
+ {'lhs': receiver, 'rhs': argument});
+ }
+ if (identical(tokenString, '!==')) {
+ listener.reportError(token, MessageKind.UNSUPPORTED_BANG_EQ_EQ,
+ {'lhs': receiver, 'rhs': argument});
}
}
@@ -1497,7 +1502,8 @@
void endRethrowStatement(Token throwToken, Token endToken) {
pushNode(new Rethrow(throwToken, endToken));
if (identical(throwToken.stringValue, 'throw')) {
- listener.onDeprecatedFeature(throwToken, 'throw without an expression');
+ listener.reportError(throwToken,
+ MessageKind.UNSUPPORTED_THROW_WITHOUT_EXP);
}
}
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 12be2f6..7266529 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -4432,15 +4432,6 @@
MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS);
failure = true;
}
- } else {
- DartType constantType =
- constant.computeType(compiler);
- if (constantType != firstConstantType) {
- compiler.reportFatalError(
- match.expression,
- MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL);
- failure = true;
- }
}
constants[labelOrCase] = constant;
}
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index d9f7c5bc..4b31459 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -189,7 +189,8 @@
LibraryElement get currentLibrary => elements.currentElement.getLibrary();
reportTypeWarning(Node node, MessageKind kind, [Map arguments = const {}]) {
- compiler.reportWarning(node, new TypeWarning(kind, arguments));
+ compiler.reportWarning(
+ node, new TypeWarning(kind, arguments, compiler.terseDiagnostics));
}
reportTypeInfo(Spannable node, MessageKind kind, [Map arguments = const {}]) {
@@ -1187,18 +1188,50 @@
visitSwitchStatement(SwitchStatement node) {
// TODO(johnniwinther): Handle reachability based on reachability of
// switch cases.
- // TODO(johnniwinther): Check assignability to constants.
DartType expressionType = analyze(node.expression);
+ Map<CaseMatch, DartType> caseTypeMap =
+ new LinkedHashMap<CaseMatch, DartType>();
for (SwitchCase switchCase in node.cases) {
for (Node labelOrCase in switchCase.labelsAndCases) {
CaseMatch caseMatch = labelOrCase.asCaseMatch();
if (caseMatch == null) continue;
DartType caseType = analyze(caseMatch.expression);
+ caseTypeMap[caseMatch] = caseType;
checkAssignable(caseMatch, expressionType, caseType);
}
+
analyze(switchCase);
}
+
+ CaseMatch firstCase = null;
+ DartType firstCaseType = null;
+ bool hasReportedProblem = false;
+ caseTypeMap.forEach((CaseMatch caseMatch, DartType caseType) {
+ if (firstCaseType == null) {
+ firstCase = caseMatch;
+ firstCaseType = caseType;
+ } else {
+ if (caseType != firstCaseType) {
+ if (!hasReportedProblem) {
+ compiler.reportError(
+ node,
+ MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL,
+ {'type': firstCaseType});
+ compiler.reportInfo(
+ firstCase.expression,
+ MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+ {'type': firstCaseType});
+ hasReportedProblem = true;
+ }
+ compiler.reportInfo(
+ caseMatch.expression,
+ MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+ {'type': caseType});
+ }
+ }
+ });
+
return StatementType.NOT_RETURNING;
}
diff --git a/sdk/lib/_internal/compiler/implementation/warnings.dart b/sdk/lib/_internal/compiler/implementation/warnings.dart
index 7950a31..803d5a9 100644
--- a/sdk/lib/_internal/compiler/implementation/warnings.dart
+++ b/sdk/lib/_internal/compiler/implementation/warnings.dart
@@ -9,34 +9,33 @@
*
* 1. The message should start with exactly one of "Error", "Internal error",
* "Warning", "Info", or "Hint" followed by a colon. It is crucial to users to
- * be able to locate errors in the midst of warnings, but we are operating
- * under the assumption that these messages will eventually be translated to
- * other languages than English, and that it is therefor not possible to
- * automatically apply these prefixes.
+ * be able to locate errors in the midst of warnings.
+ * TODO(ahe): Remove these prefixes from the error message.
*
* 2. After the colon, one space and a complete sentence starting with an
* uppercase letter, and ending with a period.
*
- * 3. Reserved words and embedded identifiers should be in quotes (double
- * quotes), so prefer single quotes for the complete message. For example,
- * 'Error: The class "#{className}" cannot use "super".' Notice that the word
- * "class" in the preceding message is not quoted as it refers to the concept
- * "class", not the reserved word. On the other hand, "super" refers to the
- * reserved word. Do not quote "null" and numeric literals.
+ * 3. Reserved words and embedded identifiers should be in single quotes, so
+ * prefer double quotes for the complete message. For example, "Error: The
+ * class '#{className}' can't use 'super'." Notice that the word 'class' in the
+ * preceding message is not quoted as it refers to the concept 'class', not the
+ * reserved word. On the other hand, 'super' refers to the reserved word. Do
+ * not quote 'null' and numeric literals.
*
* 4. Do not try to compose messages, as it can make translating them hard.
*
* 5. Try to keep the error messages short, but informative.
*
- * 6. Use simple words and terminology, assume the reader of the message does
- * not have an advanced degree in math, and that English is not the reader's
- * native language. Do not assume any formal computer science training. For
- * example, do not use Latin abbreviations (prefer "that is" over "i.e.", and
- * "for example" over "e.g."). Also avoid phrases such as "if and only if" and
- * "iff", that level of precision is unnecessary.
+ * 6. Use simple words and terminology, assume the reader of the message
+ * doesn't have an advanced degree in math, and that English is not the
+ * reader's native language. Do not assume any formal computer science
+ * training. For example, do not use Latin abbreviations (prefer "that is" over
+ * "i.e.", and "for example" over "e.g."). Also avoid phrases such as "if and
+ * only if" and "iff", that level of precision is unnecessary.
*
- * 7. Do not use contractions, for example, prefer "cannot" over "can't". This
- * is again to benefit readers to whom English is not their first language.
+ * 7. Prefer contractions when they are in common use, for example, prefer
+ * "can't" over "cannot". Using "cannot", "must not", "shall not", etc. is
+ * off-putting to people new to programming.
*
* 8. Use common terminology, preferably from the Dart Language
* Specification. This increases the user's chance of finding a good
@@ -47,13 +46,38 @@
* not want to use this product to begin with with.
*
* 10. Do not lie, that is, do not write error messages containing phrases like
- * "cannot happen". If the user ever saw this message, it would be a
- * lie. Prefer messages like: 'Internal error: This function should not be
- * called when "x" is null.'.
+ * "can't happen". If the user ever saw this message, it would be a
+ * lie. Prefer messages like: "Internal error: This function should not be
+ * called when 'x' is null.".
+ *
+ * 11. Prefer to not use imperative tone. That is, the message should not sound
+ * accusing or like it is ordering the user around. The computer should
+ * describe the problem, not criticize for violating the specification.
+ *
+ * Other things to keep in mind:
+ *
+ * An INFO message should always be preceded by a non-INFO message, and the
+ * INFO messages are additional details about the preceding non-INFO
+ * message. For example, consider duplicated elements. First report a WARNING
+ * or ERROR about the duplicated element, and then report an INFO about the
+ * location of the existing element.
+ *
+ * Generally, we want to provide messages that consists of three sentences:
+ * 1. what is wrong, 2. why is it wrong, 3. how do I fix it. However, we
+ * combine the first two in [template] and the last in [howToFix].
*/
class MessageKind {
+ /// Should describe what is wrong and why.
final String template;
- const MessageKind(this.template);
+
+ /// Should describe how to fix the problem. Elided when using --terse option.
+ final String howToFix;
+
+ /// Examples will be checked by
+ /// tests/compiler/dart2js/message_kind_test.dart.
+ final List<String> examples;
+
+ const MessageKind(this.template, {this.howToFix, this.examples});
/// Do not use this. It is here for legacy and debugging. It violates item 4
/// above.
@@ -326,7 +350,10 @@
'Error: "default" only allowed on last case of a switch.');
static const MessageKind SWITCH_CASE_TYPES_NOT_EQUAL = const MessageKind(
- 'Error: "case" expressions do not all have the same type.');
+ 'Error: "case" expressions do not all have type "#{type}".');
+
+ static const MessageKind SWITCH_CASE_TYPES_NOT_EQUAL_CASE = const MessageKind(
+ 'Info: "case" expression of type "#{type}".');
static const MessageKind SWITCH_CASE_VALUE_OVERRIDES_EQUALS =
const MessageKind(
@@ -468,18 +495,6 @@
static const MessageKind OPERATOR_NAMED_PARAMETERS = const MessageKind(
'Error: Operator "#{operatorName}" cannot have named parameters.');
- // TODO(ahe): This message is hard to localize. This is acceptable,
- // as it will be removed when we ship Dart version 1.0.
- static const MessageKind DEPRECATED_FEATURE_WARNING = const MessageKind(
- 'Warning: Deprecated language feature, #{featureName}, '
- 'will be removed in a future Dart milestone.');
-
- // TODO(ahe): This message is hard to localize. This is acceptable,
- // as it will be removed when we ship Dart version 1.0.
- static const MessageKind DEPRECATED_FEATURE_ERROR = const MessageKind(
- 'Error: #{featureName} are not legal '
- 'due to option --reject-deprecated-language-features.');
-
static const MessageKind CONSTRUCTOR_WITH_RETURN_TYPE = const MessageKind(
'Error: Cannot have return type for constructor.');
@@ -534,7 +549,7 @@
'Warning: Expected part of library name "#{libraryName}".');
static const MessageKind MISSING_PART_OF_TAG = const MessageKind(
- 'Note: This file has no part-of tag, but it is being used as a part.');
+ 'Error: This file has no part-of tag, but it is being used as a part.');
static const MessageKind DUPLICATED_PART_OF = const MessageKind(
'Error: Duplicated part-of directive.');
@@ -616,6 +631,117 @@
static const MessageKind PACKAGE_ROOT_NOT_SET = const MessageKind(
'Error: Cannot resolve "#{uri}". Package root has not been set.');
+ static const MessageKind UNSUPPORTED_EQ_EQ_EQ = const MessageKind(
+ 'Error: "===" is not an operator. '
+ 'Did you mean "#{lhs} == #{rhs}" or "identical(#{lhs}, #{rhs})"?');
+
+ static const MessageKind UNSUPPORTED_BANG_EQ_EQ = const MessageKind(
+ 'Error: "!==" is not an operator. '
+ 'Did you mean "#{lhs} != #{rhs}" or "!identical(#{lhs}, #{rhs})"?');
+
+ static const MessageKind UNSUPPORTED_THROW_WITHOUT_EXP = const MessageKind(
+ 'Error: No expression after "throw". '
+ 'Did you mean "rethrow"?');
+
+ static const MessageKind MIRRORS_EXPECTED_STRING = const MessageKind(
+ "Hint: Can't use '#{name}' here because it's an instance of '#{type}' "
+ "and a 'String' value is expected.",
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
+// 'main' is a method, not a class.
+@MirrorsUsed(symbols: const [Foo])
+import 'dart:mirrors';
+
+class Foo {}
+
+main() {}
+"""]);
+
+ static const MessageKind MIRRORS_EXPECTED_STRING_OR_TYPE = const MessageKind(
+ "Hint: Can't use '#{name}' here because it's an instance of '#{type}' "
+ "and a 'String' or 'Type' value is expected.",
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
+// 'main' is a method, not a class.
+@MirrorsUsed(targets: const [main])
+import 'dart:mirrors';
+
+main() {}
+"""]);
+
+ static const MessageKind MIRRORS_EXPECTED_STRING_OR_LIST = const MessageKind(
+ "Hint: Can't use '#{name}' here because it's an instance of '#{type}' "
+ "and a 'String' or 'List' value is expected.",
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
+// 'Foo' is not a string.
+@MirrorsUsed(symbols: Foo)
+import 'dart:mirrors';
+
+class Foo {}
+
+main() {}
+"""]);
+
+ static const MessageKind MIRRORS_EXPECTED_STRING_TYPE_OR_LIST =
+ const MessageKind(
+ "Hint: Can't use '#{name}' here because it's an instance of '#{type}' "
+ "but a 'String', 'Type', or 'List' value is expected.",
+ howToFix: "Did you forget to add quotes?",
+ examples: const [
+ """
+// '1' is not a string.
+@MirrorsUsed(targets: 1)
+import 'dart:mirrors';
+
+main() {}
+"""]);
+
+ static const MessageKind MIRRORS_CANNOT_RESOLVE_IN_CURRENT_LIBRARY =
+ const MessageKind(
+ "Hint: Can't find '#{name}' in the current library.",
+ // TODO(ahe): The closest identifiers in edit distance would be nice.
+ howToFix: "Did you forget to add an import?",
+ examples: const [
+ """
+// 'window' is not in scope because dart:html isn't imported.
+@MirrorsUsed(targets: 'window')
+import 'dart:mirrors';
+
+main() {}
+"""]);
+
+ static const MessageKind MIRRORS_CANNOT_RESOLVE_IN_LIBRARY =
+ const MessageKind(
+ "Hint: Can't find '#{name}' in the library '#{library}'.",
+ // TODO(ahe): The closest identifiers in edit distance would be nice.
+ howToFix: "Is '#{name}' spelled right?",
+ examples: const [
+ """
+// 'List' is misspelled.
+@MirrorsUsed(targets: 'dart.core.Lsit')
+import 'dart:mirrors';
+
+main() {}
+"""]);
+
+ static const MessageKind MIRRORS_CANNOT_FIND_IN_ELEMENT =
+ const MessageKind(
+ "Hint: Can't find '#{name}' in '#{element}'.",
+ // TODO(ahe): The closest identifiers in edit distance would be nice.
+ howToFix: "Is '#{name}' spelled right?",
+ examples: const [
+ """
+// 'addAll' is misspelled.
+@MirrorsUsed(targets: 'dart.core.List.addAl')
+import 'dart:mirrors';
+
+main() {}
+"""]);
+
static const MessageKind COMPILER_CRASHED = const MessageKind(
'Error: The compiler crashed when compiling this element.');
@@ -733,12 +859,12 @@
toString() => template;
- Message message([Map arguments = const {}]) {
- return new Message(this, arguments);
+ Message message([Map arguments = const {}, bool terse = false]) {
+ return new Message(this, arguments, terse);
}
- CompilationError error([Map arguments = const {}]) {
- return new CompilationError(this, arguments);
+ CompilationError error([Map arguments = const {}, bool terse = false]) {
+ return new CompilationError(this, arguments, terse);
}
}
@@ -750,11 +876,12 @@
}
class Message {
- final kind;
+ final MessageKind kind;
final Map arguments;
+ final bool terse;
String message;
- Message(this.kind, this.arguments) {
+ Message(this.kind, this.arguments, this.terse) {
assert(() { computeMessage(); return true; });
}
@@ -769,6 +896,14 @@
CURRENT_ELEMENT_SPANNABLE,
!message.contains(new RegExp(r'#\{.+\}')),
message: 'Missing arguments in error message: "$message"'));
+ if (!terse && kind.howToFix != null) {
+ String howToFix = kind.howToFix;
+ arguments.forEach((key, value) {
+ String string = slowToString(value);
+ howToFix = howToFix.replaceAll('#{${key}}', string);
+ });
+ message = '$message\n$howToFix';
+ }
}
return message;
}
@@ -795,27 +930,27 @@
class Diagnostic {
final Message message;
- Diagnostic(MessageKind kind, [Map arguments = const {}])
- : message = new Message(kind, arguments);
+ Diagnostic(MessageKind kind, Map arguments, bool terse)
+ : message = new Message(kind, arguments, terse);
String toString() => message.toString();
}
class TypeWarning extends Diagnostic {
- TypeWarning(MessageKind kind, [Map arguments = const {}])
- : super(kind, arguments);
+ TypeWarning(MessageKind kind, Map arguments, bool terse)
+ : super(kind, arguments, terse);
}
class ResolutionWarning extends Diagnostic {
- ResolutionWarning(MessageKind kind, [Map arguments = const {}])
- : super(kind, arguments);
+ ResolutionWarning(MessageKind kind, Map arguments, bool terse)
+ : super(kind, arguments, terse);
}
class CompileTimeConstantError extends Diagnostic {
- CompileTimeConstantError(MessageKind kind, [Map arguments = const {}])
- : super(kind, arguments);
+ CompileTimeConstantError(MessageKind kind, Map arguments, bool terse)
+ : super(kind, arguments, terse);
}
class CompilationError extends Diagnostic {
- CompilationError(MessageKind kind, [Map arguments = const {}])
- : super(kind, arguments);
+ CompilationError(MessageKind kind, Map arguments, bool terse)
+ : super(kind, arguments, terse);
}
diff --git a/sdk/lib/_internal/lib/core_patch.dart b/sdk/lib/_internal/lib/core_patch.dart
index 9d44abf..b256d0f 100644
--- a/sdk/lib/_internal/lib/core_patch.dart
+++ b/sdk/lib/_internal/lib/core_patch.dart
@@ -310,3 +310,7 @@
}
}
}
+
+patch class Uri {
+ patch static bool get _isWindows => false;
+}
diff --git a/sdk/lib/_internal/lib/io_patch.dart b/sdk/lib/_internal/lib/io_patch.dart
index d5e55c6..5725d1e 100644
--- a/sdk/lib/_internal/lib/io_patch.dart
+++ b/sdk/lib/_internal/lib/io_patch.dart
@@ -162,6 +162,9 @@
patch static _localHostname() {
throw new UnsupportedError("Platform._localHostname");
}
+ patch static _executable() {
+ throw new UnsupportedError("Platform_Executable");
+ }
patch static _environment() {
throw new UnsupportedError("Platform._environment");
}
diff --git a/sdk/lib/_internal/pub/lib/src/dart.dart b/sdk/lib/_internal/pub/lib/src/dart.dart
index c912fab..ce4d59d 100644
--- a/sdk/lib/_internal/pub/lib/src/dart.dart
+++ b/sdk/lib/_internal/pub/lib/src/dart.dart
@@ -66,6 +66,6 @@
// but it parts in another file that does.
return dart.declarations.any((node) {
return node is FunctionDeclaration && node.name.name == "main" &&
- node.functionExpression.parameters.elements.isEmpty;
+ node.functionExpression.parameters.parameters.isEmpty;
});
}
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index 70888bc..b382b44 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -270,10 +270,15 @@
return git.isInstalled.then((gitInstalled) {
if (dirExists(path.join(root.dir, '.git')) && gitInstalled) {
+ // Later versions of git do not allow a path for ls-files that appears
+ // to be outside of the repo, so make sure we give it a relative path.
+ var relativeBeneath = path.relative(beneath, from: root.dir);
+
// List all files that aren't gitignored, including those not checked
// in to Git.
return git.run(
- ["ls-files", "--cached", "--others", "--exclude-standard", beneath],
+ ["ls-files", "--cached", "--others", "--exclude-standard",
+ relativeBeneath],
workingDir: root.dir).then((files) {
// Git always prints files relative to the project root, but we want
// them relative to the working directory. It also prints forward
diff --git a/sdk/lib/convert/convert.dart b/sdk/lib/convert/convert.dart
index 6c76db0..4003684 100644
--- a/sdk/lib/convert/convert.dart
+++ b/sdk/lib/convert/convert.dart
@@ -13,5 +13,6 @@
part 'converter.dart';
part 'encoding.dart';
part 'json.dart';
+part 'line_splitter.dart';
part 'string_conversion.dart';
part 'utf.dart';
diff --git a/sdk/lib/convert/convert_sources.gypi b/sdk/lib/convert/convert_sources.gypi
index 295451f..eaf9952 100644
--- a/sdk/lib/convert/convert_sources.gypi
+++ b/sdk/lib/convert/convert_sources.gypi
@@ -13,6 +13,7 @@
'converter.dart',
'encoding.dart',
'json.dart',
+ 'line_splitter.dart',
'string_conversion.dart',
'utf.dart',
],
diff --git a/sdk/lib/convert/line_splitter.dart b/sdk/lib/convert/line_splitter.dart
new file mode 100644
index 0000000..cc9ad94
--- /dev/null
+++ b/sdk/lib/convert/line_splitter.dart
@@ -0,0 +1,90 @@
+// 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 dart.convert;
+
+/**
+ * This class splits [String] values into individual lines.
+ */
+class LineSplitter extends Converter<String, List<String>> {
+ List<String> convert(String data) {
+ var lines = new List<String>();
+
+ _LineSplitterSink._addSlice(data, 0, data.length, true, lines.add);
+
+ return lines;
+ }
+
+ StringConversionSink startChunkedConversion(
+ ChunkedConversionSink<String> sink) {
+
+ if (sink is! StringConversionSink) {
+ sink = new StringConversionSink.from(sink);
+ }
+ return new _LineSplitterSink(sink);
+ }
+}
+
+// TODO(floitsch): deal with utf8.
+class _LineSplitterSink extends StringConversionSinkBase {
+ static const int _LF = 10;
+ static const int _CR = 13;
+
+ final StringConversionSink _sink;
+
+ String _carry;
+
+ _LineSplitterSink(this._sink);
+
+ void addSlice(String chunk, int start, int end, bool isLast) {
+ if(_carry != null) {
+ chunk = _carry + chunk.substring(start, end);
+ start = 0;
+ end = chunk.length;
+ _carry = null;
+ }
+ _carry = _addSlice(chunk, start, end, isLast, _sink.add);
+ if(isLast) _sink.close();
+ }
+
+ void close() {
+ addSlice('', 0, 0, true);
+ }
+
+ static String _addSlice(String chunk, int start, int end, bool isLast, void adder(String val)) {
+ int pos = start;
+ while (pos < end) {
+ int skip = 0;
+ int char = chunk.codeUnitAt(pos);
+ if (char == _LF) {
+ skip = 1;
+ } else if (char == _CR) {
+ skip = 1;
+ if (pos + 1 < end) {
+ if (chunk.codeUnitAt(pos + 1) == _LF) {
+ skip = 2;
+ }
+ } else if (!isLast) {
+ return chunk.substring(start, end);
+ }
+ }
+ if (skip > 0) {
+ adder(chunk.substring(start, pos));
+ start = pos = pos + skip;
+ } else {
+ pos++;
+ }
+ }
+ if (pos != start) {
+ var carry = chunk.substring(start, pos);
+ if(isLast) {
+ // Add remaining
+ adder(carry);
+ } else {
+ return carry;
+ }
+ }
+ return null;
+ }
+}
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index 73ce45b..02573c2 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -263,6 +263,175 @@
}
/**
+ * Creates a new file URI from an absolute or relative file path.
+ *
+ * The file path is passed in [path].
+ *
+ * This path is interpreted using either Windows or non-Windows
+ * semantics.
+ *
+ * With non-Windows semantics the slash ("/") is used to separate
+ * path segments.
+ *
+ * With Windows semantics, backslash ("\") and forward-slash ("/")
+ * are used to separate path segments, except if the path starts
+ * with "\\?\" in which case, only backslash ("\") separates path
+ * segments.
+ *
+ * If the path starts with a path separator an absolute URI is
+ * created. Otherwise a relative URI is created. One exception from
+ * this rule is that when Windows semantics is used and the path
+ * starts with a drive letter followed by a colon (":") and a
+ * path separator then an absolute URI is created.
+ *
+ * The default for whether to use Windows or non-Windows semantics
+ * determined from the platform Dart is running on. When running in
+ * the standalone VM this is detected by the VM based on the
+ * operating system. When running in a browser non-Windows semantics
+ * is always used.
+ *
+ * To override the automatic detection of which semantics to use pass
+ * a value for [windows]. Passing `true` will use Windows
+ * semantics and passing `false` will use non-Windows semantics.
+ *
+ * Examples using non-Windows semantics (resulting URI in comment):
+ *
+ * new Uri.file("xxx/yyy"); // xxx/yyy
+ * new Uri.file("xxx/yyy/"); // xxx/yyy/
+ * new Uri.file("/xxx/yyy"); // file:///xxx/yyy
+ * new Uri.file("/xxx/yyy/"); // file:///xxx/yyy/
+ * new Uri.file("C:"); // C:
+ *
+ * Examples using Windows semantics (resulting URI in comment):
+ *
+ * new Uri.file(r"xxx\yyy"); // xxx/yyy
+ * new Uri.file(r"xxx\yyy\"); // xxx/yyy/
+ * new Uri.file(r"\xxx\yyy"); // file:///xxx/yyy
+ * new Uri.file(r"\xxx\yyy/"); // file:///xxx/yyy/
+ * new Uri.file(r"C:\xxx\yyy"); // file:///C:/xxx/yyy
+ * new Uri.file(r"C:xxx\yyy"); // Throws as path with drive letter
+ * // is not absolute.
+ * new Uri.file(r"\\server\share\file"); // file://server/share/file
+ * new Uri.file(r"C:"); // Throws as path with drive letter
+ * // is not absolute.
+ *
+ * If the path passed is not a legal file path [ArgumentError] is thrown.
+ */
+ factory Uri.file(String path, {bool windows}) {
+ windows = windows == null ? Uri._isWindows : windows;
+ return windows ? _makeWindowsFileUrl(path) : _makeFileUri(path);
+ }
+
+ external static bool get _isWindows;
+
+ static _checkNonWindowsPathReservedCharacters(List<String> segments,
+ bool argumentError) {
+ segments.forEach((segment) {
+ if (segment.contains("/")) {
+ if (argumentError) {
+ throw new ArgumentError("Illegal path character $segment");
+ } else {
+ throw new UnsupportedError("Illegal path character $segment");
+ }
+ }
+ });
+ }
+
+ static _checkWindowsPathReservedCharacters(List<String> segments,
+ bool argumentError,
+ [int firstSegment = 0]) {
+ segments.skip(firstSegment).forEach((segment) {
+ if (segment.contains(new RegExp(r'["*/:<>?\\|]'))) {
+ if (argumentError) {
+ throw new ArgumentError("Illegal character in path}");
+ } else {
+ throw new UnsupportedError("Illegal character in path}");
+ }
+ }
+ });
+ }
+
+ static _checkWindowsDriveLetter(int charCode, bool argumentError) {
+ if ((_UPPER_CASE_A <= charCode && charCode <= _UPPER_CASE_Z) ||
+ (_LOWER_CASE_A <= charCode && charCode <= _LOWER_CASE_Z)) {
+ return;
+ }
+ if (argumentError) {
+ throw new ArgumentError("Illegal drive letter " +
+ new String.fromCharCode(charCode));
+ } else {
+ throw new UnsupportedError("Illegal drive letter " +
+ new String.fromCharCode(charCode));
+ }
+ }
+
+ static _makeFileUri(String path) {
+ String sep = "/";
+ if (path.length > 0 && path[0] == sep) {
+ // Absolute file:// URI.
+ return new Uri(scheme: "file", pathSegments: path.split(sep));
+ } else {
+ // Relative URI.
+ return new Uri(pathSegments: path.split(sep));
+ }
+ }
+
+ static _makeWindowsFileUrl(String path) {
+ if (path.startsWith("\\\\?\\")) {
+ if (path.startsWith("\\\\?\\UNC\\")) {
+ path = "\\${path.substring(7)}";
+ } else {
+ path = path.substring(4);
+ if (path.length < 3 ||
+ path.codeUnitAt(1) != _COLON ||
+ path.codeUnitAt(2) != _BACKSLASH) {
+ throw new ArgumentError(
+ "Windows paths with \\\\?\\ prefix must be absolute");
+ }
+ }
+ } else {
+ path = path.replaceAll("/", "\\");
+ }
+ String sep = "\\";
+ if (path.length > 1 && path[1] == ":") {
+ _checkWindowsDriveLetter(path.codeUnitAt(0), true);
+ if (path.length == 2 || path.codeUnitAt(2) != _BACKSLASH) {
+ throw new ArgumentError(
+ "Windows paths with drive letter must be absolute");
+ }
+ // Absolute file://C:/ URI.
+ var pathSegments = path.split(sep);
+ _checkWindowsPathReservedCharacters(pathSegments, true, 1);
+ return new Uri(scheme: "file", pathSegments: pathSegments);
+ }
+
+ if (path.length > 0 && path[0] == sep) {
+ if (path.length > 1 && path[1] == sep) {
+ // Absolute file:// URI with host.
+ int pathStart = path.indexOf("\\", 2);
+ String hostPart =
+ pathStart == -1 ? path.substring(2) : path.substring(2, pathStart);
+ String pathPart =
+ pathStart == -1 ? "" : path.substring(pathStart + 1);
+ var pathSegments = pathPart.split(sep);
+ _checkWindowsPathReservedCharacters(pathSegments, true);
+ return new Uri(
+ scheme: "file", host: hostPart, pathSegments: pathSegments);
+ } else {
+ // Absolute file:// URI.
+ var pathSegments = path.split(sep);
+ _checkWindowsPathReservedCharacters(pathSegments, true);
+ return new Uri(scheme: "file", pathSegments: pathSegments);
+ }
+ } else {
+ // Relative URI.
+ var pathSegments = path.split(sep);
+ _checkWindowsPathReservedCharacters(pathSegments, true);
+ return new Uri(pathSegments: pathSegments);
+ }
+ }
+
+ /**
* Returns the URI path split into its segments. Each of the
* segments in the returned list have been decoded. If the path is
* empty the empty list will be returned. A leading slash `/` does
@@ -651,6 +820,127 @@
return "$scheme://$host:$port";
}
+ /**
+ * Returns the file path from a file URI.
+ *
+ * The returned path has either Windows or non-Windows
+ * semantics.
+ *
+ * For non-Windows semantics the slash ("/") is used to separate
+ * path segments.
+ *
+ * For Windows semantics the backslash ("\") separator is used to
+ * separate path segments.
+ *
+ * If the URI is absolute the path starts with a path separator
+ * unless Windows semantics is used and the first path segment is a
+ * drive letter. When Windows semantics is used a host component in
+ * the uri in interpreted as a file server and a UNC path is
+ * returned.
+ *
+ * The default for whether to use Windows or non-Windows semantics
+ * determined from the platform Dart is running on. When running in
+ * the standalone VM this is detected by the VM based on the
+ * operating system. When running in a browser non-Windows semantics
+ * is always used.
+ *
+ * To override the automatic detection of which semantics to use pass
+ * a value for [windows]. Passing `true` will use Windows
+ * semantics and passing `false` will use non-Windows semantics.
+ *
+ * If the URI ends with a slash (i.e. the last path component is
+ * empty) the returned file path will also end with a slash.
+ *
+ * With Windows semantics URIs starting with a drive letter cannot
+ * be relative to the current drive on the designated drive. That is
+ * for the URI `file:///c:abc` calling `toFilePath` will throw as a
+ * path segment cannot contain colon on Windows.
+ *
+ * Examples using non-Windows semantics (resulting of calling
+ * toFilePath in comment):
+ *
+ * Uri.parse("xxx/yyy"); // xxx/yyy
+ * Uri.parse("xxx/yyy/"); // xxx/yyy/
+ * Uri.parse("file:///xxx/yyy"); // /xxx/yyy
+ * Uri.parse("file:///xxx/yyy/"); // /xxx/yyy/
+ * Uri.parse("file:///C:"); // /C:
+ * Uri.parse("file:///C:a"); // /C:a
+ *
+ * Examples using Windows semantics (resulting URI in comment):
+ *
+ * Uri.parse("xxx/yyy"); // xxx\yyy
+ * Uri.parse("xxx/yyy/"); // xxx\yyy\
+ * Uri.parse("file:///xxx/yyy"); // \xxx\yyy
+ * Uri.parse("file:///xxx/yyy/"); // \xxx\yyy/
+ * Uri.parse("file:///C:/xxx/yyy"); // C:\xxx\yyy
+ * Uri.parse("file:C:xxx/yyy"); // Throws as a path segment
+ * // cannot contain colon on Windows.
+ * Uri.parse("file://server/share/file"); // \\server\share\file
+ *
+ * If the URI is not a file URI calling this throws
+ * [UnsupportedError].
+ *
+ * If the URI cannot be converted to a file path calling this throws
+ * [UnsupportedError].
+ */
+ String toFilePath({bool windows}) {
+ if (scheme != "" && scheme != "file") {
+ throw new UnsupportedError(
+ "Cannot extract a file path from a $scheme URI");
+ }
+ if (scheme != "" && scheme != "file") {
+ throw new UnsupportedError(
+ "Cannot extract a file path from a $scheme URI");
+ }
+ if (query != "") {
+ throw new UnsupportedError(
+ "Cannot extract a file path from a URI with a query component");
+ }
+ if (fragment != "") {
+ throw new UnsupportedError(
+ "Cannot extract a file path from a URI with a fragment component");
+ }
+ if (windows == null) windows = _isWindows;
+ return windows ? _toWindowsFilePath() : _toFilePath();
+ }
+
+ String _toFilePath() {
+ if (host != "") {
+ throw new UnsupportedError(
+ "Cannot extract a non-Windows file path from a file URI "
+ "with an authority");
+ }
+ _checkNonWindowsPathReservedCharacters(pathSegments, false);
+ var result = new StringBuffer();
+ if (isAbsolute) result.write("/");
+ result.writeAll(pathSegments, "/");
+ return result.toString();
+ }
+
+ String _toWindowsFilePath() {
+ bool hasDriveLetter = false;
+ var segments = pathSegments;
+ if (segments.length > 0 &&
+ segments[0].length == 2 &&
+ segments[0].codeUnitAt(1) == _COLON) {
+ _checkWindowsDriveLetter(segments[0].codeUnitAt(0), false);
+ _checkWindowsPathReservedCharacters(segments, false, 1);
+ hasDriveLetter = true;
+ } else {
+ _checkWindowsPathReservedCharacters(segments, false);
+ }
+ var result = new StringBuffer();
+ if (isAbsolute && !hasDriveLetter) result.write("\\");
+ if (host != "") {
+ result.write("\\");
+ result.write(host);
+ result.write("\\");
+ }
+ result.writeAll(segments, "\\");
+ if (hasDriveLetter && segments.length == 1) result.write("\\");
+ return result.toString();
+ }
+
void _writeAuthority(StringSink ss) {
_addIfNonEmpty(ss, userInfo, userInfo, "@");
ss.write(host == null ? "null" :
@@ -840,17 +1130,26 @@
}
// Frequently used character codes.
+ static const int _DOUBLE_QUOTE = 0x22;
static const int _PERCENT = 0x25;
+ static const int _ASTERISK = 0x2A;
static const int _PLUS = 0x2B;
static const int _SLASH = 0x2F;
static const int _ZERO = 0x30;
static const int _NINE = 0x39;
static const int _COLON = 0x3A;
+ static const int _LESS = 0x3C;
+ static const int _GREATER = 0x3E;
+ static const int _QUESTION = 0x3F;
static const int _AT_SIGN = 0x40;
static const int _UPPER_CASE_A = 0x41;
static const int _UPPER_CASE_F = 0x46;
+ static const int _UPPER_CASE_Z = 0x5A;
+ static const int _BACKSLASH = 0x5C;
static const int _LOWER_CASE_A = 0x61;
static const int _LOWER_CASE_F = 0x66;
+ static const int _LOWER_CASE_Z = 0x7A;
+ static const int _BAR = 0x7C;
/**
* This is the internal implementation of JavaScript's encodeURI function.
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 76a9830..dfaa5ed 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -81,16 +81,14 @@
Future<SendPort> spawnDomFunction(Function f) =>
new Future.value(IsolateNatives.spawnDomFunction(f));
-// 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.
@DocsEditable()
@DomName('AbstractWorker')
-class AbstractWorker extends EventTarget native "AbstractWorker" {
- // To suppress missing implicit constructor warnings.
- factory AbstractWorker._() { throw new UnsupportedError("Not supported"); }
+class AbstractWorker extends Interceptor implements EventTarget native "AbstractWorker" {
@DomName('AbstractWorker.errorEvent')
@DocsEditable()
@@ -106,6 +104,55 @@
@DocsEditable()
+@DomName('AesCbcParams')
+@Experimental() // untriaged
+class AesCbcParams extends Algorithm native "AesCbcParams" {
+ // To suppress missing implicit constructor warnings.
+ factory AesCbcParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('AesCbcParams.iv')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final Uint8List iv;
+}
+// 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('AesKeyGenParams')
+@Experimental() // untriaged
+class AesKeyGenParams extends Algorithm native "AesKeyGenParams" {
+ // To suppress missing implicit constructor warnings.
+ factory AesKeyGenParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('AesKeyGenParams.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('Algorithm')
+@Experimental() // untriaged
+class Algorithm extends Interceptor native "Algorithm" {
+
+ @DomName('Algorithm.name')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final String name;
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+
+@DocsEditable()
@DomName('HTMLAnchorElement')
class AnchorElement extends _HTMLElement native "HTMLAnchorElement" {
// To suppress missing implicit constructor warnings.
@@ -299,20 +346,6 @@
@DocsEditable()
void abort() native;
- @JSName('addEventListener')
- @DomName('DOMApplicationCache.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('DOMApplicationCache.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @JSName('removeEventListener')
- @DomName('DOMApplicationCache.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('DOMApplicationCache.swapCache')
@DocsEditable()
void swapCache() native;
@@ -321,6 +354,22 @@
@DocsEditable()
void update() native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('DOMApplicationCache.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('DOMApplicationCache.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('DOMApplicationCache.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('DOMApplicationCache.oncached')
@DocsEditable()
Stream<Event> get onCached => cachedEvent.forTarget(this);
@@ -645,51 +694,51 @@
@DomName('HTMLBodyElement.onblur')
@DocsEditable()
- Stream<Event> get onBlur => blurEvent.forTarget(this);
+ ElementStream<Event> get onBlur => blurEvent.forElement(this);
@DomName('HTMLBodyElement.onerror')
@DocsEditable()
- Stream<Event> get onError => errorEvent.forTarget(this);
+ ElementStream<Event> get onError => errorEvent.forElement(this);
@DomName('HTMLBodyElement.onfocus')
@DocsEditable()
- Stream<Event> get onFocus => focusEvent.forTarget(this);
+ ElementStream<Event> get onFocus => focusEvent.forElement(this);
@DomName('HTMLBodyElement.onhashchange')
@DocsEditable()
- Stream<Event> get onHashChange => hashChangeEvent.forTarget(this);
+ ElementStream<Event> get onHashChange => hashChangeEvent.forElement(this);
@DomName('HTMLBodyElement.onload')
@DocsEditable()
- Stream<Event> get onLoad => loadEvent.forTarget(this);
+ ElementStream<Event> get onLoad => loadEvent.forElement(this);
@DomName('HTMLBodyElement.onmessage')
@DocsEditable()
- Stream<MessageEvent> get onMessage => messageEvent.forTarget(this);
+ ElementStream<MessageEvent> get onMessage => messageEvent.forElement(this);
@DomName('HTMLBodyElement.onoffline')
@DocsEditable()
- Stream<Event> get onOffline => offlineEvent.forTarget(this);
+ ElementStream<Event> get onOffline => offlineEvent.forElement(this);
@DomName('HTMLBodyElement.ononline')
@DocsEditable()
- Stream<Event> get onOnline => onlineEvent.forTarget(this);
+ ElementStream<Event> get onOnline => onlineEvent.forElement(this);
@DomName('HTMLBodyElement.onpopstate')
@DocsEditable()
- Stream<PopStateEvent> get onPopState => popStateEvent.forTarget(this);
+ ElementStream<PopStateEvent> get onPopState => popStateEvent.forElement(this);
@DomName('HTMLBodyElement.onresize')
@DocsEditable()
- Stream<Event> get onResize => resizeEvent.forTarget(this);
+ ElementStream<Event> get onResize => resizeEvent.forElement(this);
@DomName('HTMLBodyElement.onstorage')
@DocsEditable()
- Stream<StorageEvent> get onStorage => storageEvent.forTarget(this);
+ ElementStream<StorageEvent> get onStorage => storageEvent.forElement(this);
@DomName('HTMLBodyElement.onunload')
@DocsEditable()
- Stream<Event> get onUnload => unloadEvent.forTarget(this);
+ ElementStream<Event> get onUnload => unloadEvent.forElement(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
@@ -907,11 +956,11 @@
@DomName('HTMLCanvasElement.onwebglcontextlost')
@DocsEditable()
- Stream<gl.ContextEvent> get onWebGlContextLost => webGlContextLostEvent.forTarget(this);
+ ElementStream<gl.ContextEvent> get onWebGlContextLost => webGlContextLostEvent.forElement(this);
@DomName('HTMLCanvasElement.onwebglcontextrestored')
@DocsEditable()
- Stream<gl.ContextEvent> get onWebGlContextRestored => webGlContextRestoredEvent.forTarget(this);
+ ElementStream<gl.ContextEvent> get onWebGlContextRestored => webGlContextRestoredEvent.forElement(this);
/** An API for drawing on this canvas. */
CanvasRenderingContext2D get context2D =>
@@ -1734,13 +1783,19 @@
@Experimental()
class Composition extends Interceptor native "Composition" {
- @DomName('Composition.caret')
+ @DomName('Composition.selectionEnd')
@DocsEditable()
- final Range caret;
+ @Experimental() // untriaged
+ final int selectionEnd;
+
+ @DomName('Composition.selectionStart')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final int selectionStart;
@DomName('Composition.text')
@DocsEditable()
- final Node text;
+ final String text;
}
// 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
@@ -1982,6 +2037,43 @@
@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
@@ -2654,6 +2746,12 @@
@DocsEditable()
final CssRule parentRule;
+ @JSName('var')
+ @DomName('CSSStyleDeclaration.var')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final CssVariablesMap _var;
+
@DomName('CSSStyleDeclaration.__setter__')
@DocsEditable()
void __setter__(String propertyName, String propertyValue) native;
@@ -6090,6 +6188,46 @@
@DocsEditable()
+@DomName('CSSVariablesMap')
+@Experimental() // untriaged
+class CssVariablesMap extends Interceptor native "CSSVariablesMap" {
+
+ @DomName('CSSVariablesMap.size')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final int size;
+
+ @DomName('CSSVariablesMap.clear')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void clear() native;
+
+ @DomName('CSSVariablesMap.delete')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool delete(String name) native;
+
+ @DomName('CSSVariablesMap.get')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get(String name) native;
+
+ @DomName('CSSVariablesMap.has')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool has(String name) native;
+
+ @DomName('CSSVariablesMap.set')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set(String name, String value) 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('CSSViewportRule')
@Experimental() // untriaged
class CssViewportRule extends CssRule native "CSSViewportRule" {
@@ -6340,6 +6478,33 @@
@DocsEditable()
+@DomName('DedicatedWorkerGlobalScope')
+@Experimental() // untriaged
+class DedicatedWorkerGlobalScope extends WorkerGlobalScope native "DedicatedWorkerGlobalScope" {
+ // To suppress missing implicit constructor warnings.
+ factory DedicatedWorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('DedicatedWorkerGlobalScope.messageEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MessageEvent> messageEvent = const EventStreamProvider<MessageEvent>('message');
+
+ @DomName('DedicatedWorkerGlobalScope.postMessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void postMessage(Object message, [List messagePorts]) native;
+
+ @DomName('DedicatedWorkerGlobalScope.onmessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MessageEvent> get onMessage => messageEvent.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('HTMLDetailsElement')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@@ -6493,9 +6658,14 @@
@DocsEditable()
bool open;
+ @DomName('HTMLDialogElement.returnValue')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String returnValue;
+
@DomName('HTMLDialogElement.close')
@DocsEditable()
- void close() native;
+ void close(String returnValue) native;
@DomName('HTMLDialogElement.show')
@DocsEditable()
@@ -7293,6 +7463,16 @@
@DocsEditable()
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);
+ @DomName('Document.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseEnter => Element.mouseEnterEvent.forTarget(this);
+
+ @DomName('Document.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseLeave => Element.mouseLeaveEvent.forTarget(this);
+
@DomName('Document.onmousemove')
@DocsEditable()
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);
@@ -8053,6 +8233,234 @@
*/
@Experimental()
CssRect get marginEdge;
+
+ @DomName('Element.onabort')
+ @DocsEditable()
+ ElementStream<Event> get onAbort;
+
+ @DomName('Element.onbeforecopy')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCopy;
+
+ @DomName('Element.onbeforecut')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCut;
+
+ @DomName('Element.onbeforepaste')
+ @DocsEditable()
+ ElementStream<Event> get onBeforePaste;
+
+ @DomName('Element.onblur')
+ @DocsEditable()
+ ElementStream<Event> get onBlur;
+
+ @DomName('Element.onchange')
+ @DocsEditable()
+ ElementStream<Event> get onChange;
+
+ @DomName('Element.onclick')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onClick;
+
+ @DomName('Element.oncontextmenu')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onContextMenu;
+
+ @DomName('Element.oncopy')
+ @DocsEditable()
+ ElementStream<Event> get onCopy;
+
+ @DomName('Element.oncut')
+ @DocsEditable()
+ ElementStream<Event> get onCut;
+
+ @DomName('Element.ondblclick')
+ @DocsEditable()
+ ElementStream<Event> get onDoubleClick;
+
+ @DomName('Element.ondrag')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrag;
+
+ @DomName('Element.ondragend')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnd;
+
+ @DomName('Element.ondragenter')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnter;
+
+ @DomName('Element.ondragleave')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragLeave;
+
+ @DomName('Element.ondragover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragOver;
+
+ @DomName('Element.ondragstart')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragStart;
+
+ @DomName('Element.ondrop')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrop;
+
+ @DomName('Element.onerror')
+ @DocsEditable()
+ ElementStream<Event> get onError;
+
+ @DomName('Element.onfocus')
+ @DocsEditable()
+ ElementStream<Event> get onFocus;
+
+ @DomName('Element.oninput')
+ @DocsEditable()
+ ElementStream<Event> get onInput;
+
+ @DomName('Element.oninvalid')
+ @DocsEditable()
+ ElementStream<Event> get onInvalid;
+
+ @DomName('Element.onkeydown')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyDown;
+
+ @DomName('Element.onkeypress')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyPress;
+
+ @DomName('Element.onkeyup')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyUp;
+
+ @DomName('Element.onload')
+ @DocsEditable()
+ ElementStream<Event> get onLoad;
+
+ @DomName('Element.onmousedown')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseDown;
+
+ @DomName('Element.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseEnter;
+
+ @DomName('Element.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseLeave;
+
+ @DomName('Element.onmousemove')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseMove;
+
+ @DomName('Element.onmouseout')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOut;
+
+ @DomName('Element.onmouseover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOver;
+
+ @DomName('Element.onmouseup')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseUp;
+
+ @DomName('Element.onmousewheel')
+ @DocsEditable()
+ // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
+ @Experimental() // non-standard
+ ElementStream<WheelEvent> get onMouseWheel;
+
+ @DomName('Element.onpaste')
+ @DocsEditable()
+ ElementStream<Event> get onPaste;
+
+ @DomName('Element.onreset')
+ @DocsEditable()
+ ElementStream<Event> get onReset;
+
+ @DomName('Element.onscroll')
+ @DocsEditable()
+ ElementStream<Event> get onScroll;
+
+ @DomName('Element.onsearch')
+ @DocsEditable()
+ // http://www.w3.org/TR/html-markup/input.search.html
+ @Experimental()
+ ElementStream<Event> get onSearch;
+
+ @DomName('Element.onselect')
+ @DocsEditable()
+ ElementStream<Event> get onSelect;
+
+ @DomName('Element.onselectstart')
+ @DocsEditable()
+ @Experimental() // nonstandard
+ ElementStream<Event> get onSelectStart;
+
+ @DomName('Element.onsubmit')
+ @DocsEditable()
+ ElementStream<Event> get onSubmit;
+
+ @DomName('Element.ontouchcancel')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchCancel;
+
+ @DomName('Element.ontouchend')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnd;
+
+ @DomName('Element.ontouchenter')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnter;
+
+ @DomName('Element.ontouchleave')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchLeave;
+
+ @DomName('Element.ontouchmove')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchMove;
+
+ @DomName('Element.ontouchstart')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchStart;
+
+ @DomName('Element.ontransitionend')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
+ @SupportedBrowser(SupportedBrowser.IE, '10')
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ ElementStream<TransitionEvent> get onTransitionEnd;
+
+ @DomName('Element.onwebkitfullscreenchange')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenChange;
+
+ @DomName('Element.onwebkitfullscreenerror')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenError;
+
}
// TODO(jacobr): this is an inefficient implementation but it is hard to see
@@ -8106,6 +8514,234 @@
CssRect get borderEdge => _elementList.first.borderEdge;
CssRect get marginEdge => _elementList.first.marginEdge;
+
+ @DomName('Element.onabort')
+ @DocsEditable()
+ ElementStream<Event> get onAbort => Element.abortEvent._forElementList(this);
+
+ @DomName('Element.onbeforecopy')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCopy => Element.beforeCopyEvent._forElementList(this);
+
+ @DomName('Element.onbeforecut')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCut => Element.beforeCutEvent._forElementList(this);
+
+ @DomName('Element.onbeforepaste')
+ @DocsEditable()
+ ElementStream<Event> get onBeforePaste => Element.beforePasteEvent._forElementList(this);
+
+ @DomName('Element.onblur')
+ @DocsEditable()
+ ElementStream<Event> get onBlur => Element.blurEvent._forElementList(this);
+
+ @DomName('Element.onchange')
+ @DocsEditable()
+ ElementStream<Event> get onChange => Element.changeEvent._forElementList(this);
+
+ @DomName('Element.onclick')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onClick => Element.clickEvent._forElementList(this);
+
+ @DomName('Element.oncontextmenu')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onContextMenu => Element.contextMenuEvent._forElementList(this);
+
+ @DomName('Element.oncopy')
+ @DocsEditable()
+ ElementStream<Event> get onCopy => Element.copyEvent._forElementList(this);
+
+ @DomName('Element.oncut')
+ @DocsEditable()
+ ElementStream<Event> get onCut => Element.cutEvent._forElementList(this);
+
+ @DomName('Element.ondblclick')
+ @DocsEditable()
+ ElementStream<Event> get onDoubleClick => Element.doubleClickEvent._forElementList(this);
+
+ @DomName('Element.ondrag')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrag => Element.dragEvent._forElementList(this);
+
+ @DomName('Element.ondragend')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnd => Element.dragEndEvent._forElementList(this);
+
+ @DomName('Element.ondragenter')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnter => Element.dragEnterEvent._forElementList(this);
+
+ @DomName('Element.ondragleave')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragLeave => Element.dragLeaveEvent._forElementList(this);
+
+ @DomName('Element.ondragover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragOver => Element.dragOverEvent._forElementList(this);
+
+ @DomName('Element.ondragstart')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragStart => Element.dragStartEvent._forElementList(this);
+
+ @DomName('Element.ondrop')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrop => Element.dropEvent._forElementList(this);
+
+ @DomName('Element.onerror')
+ @DocsEditable()
+ ElementStream<Event> get onError => Element.errorEvent._forElementList(this);
+
+ @DomName('Element.onfocus')
+ @DocsEditable()
+ ElementStream<Event> get onFocus => Element.focusEvent._forElementList(this);
+
+ @DomName('Element.oninput')
+ @DocsEditable()
+ ElementStream<Event> get onInput => Element.inputEvent._forElementList(this);
+
+ @DomName('Element.oninvalid')
+ @DocsEditable()
+ ElementStream<Event> get onInvalid => Element.invalidEvent._forElementList(this);
+
+ @DomName('Element.onkeydown')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyDown => Element.keyDownEvent._forElementList(this);
+
+ @DomName('Element.onkeypress')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyPress => Element.keyPressEvent._forElementList(this);
+
+ @DomName('Element.onkeyup')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyUp => Element.keyUpEvent._forElementList(this);
+
+ @DomName('Element.onload')
+ @DocsEditable()
+ ElementStream<Event> get onLoad => Element.loadEvent._forElementList(this);
+
+ @DomName('Element.onmousedown')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseDown => Element.mouseDownEvent._forElementList(this);
+
+ @DomName('Element.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseEnter => Element.mouseEnterEvent._forElementList(this);
+
+ @DomName('Element.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseLeave => Element.mouseLeaveEvent._forElementList(this);
+
+ @DomName('Element.onmousemove')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseMove => Element.mouseMoveEvent._forElementList(this);
+
+ @DomName('Element.onmouseout')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOut => Element.mouseOutEvent._forElementList(this);
+
+ @DomName('Element.onmouseover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOver => Element.mouseOverEvent._forElementList(this);
+
+ @DomName('Element.onmouseup')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseUp => Element.mouseUpEvent._forElementList(this);
+
+ @DomName('Element.onmousewheel')
+ @DocsEditable()
+ // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
+ @Experimental() // non-standard
+ ElementStream<WheelEvent> get onMouseWheel => Element.mouseWheelEvent._forElementList(this);
+
+ @DomName('Element.onpaste')
+ @DocsEditable()
+ ElementStream<Event> get onPaste => Element.pasteEvent._forElementList(this);
+
+ @DomName('Element.onreset')
+ @DocsEditable()
+ ElementStream<Event> get onReset => Element.resetEvent._forElementList(this);
+
+ @DomName('Element.onscroll')
+ @DocsEditable()
+ ElementStream<Event> get onScroll => Element.scrollEvent._forElementList(this);
+
+ @DomName('Element.onsearch')
+ @DocsEditable()
+ // http://www.w3.org/TR/html-markup/input.search.html
+ @Experimental()
+ ElementStream<Event> get onSearch => Element.searchEvent._forElementList(this);
+
+ @DomName('Element.onselect')
+ @DocsEditable()
+ ElementStream<Event> get onSelect => Element.selectEvent._forElementList(this);
+
+ @DomName('Element.onselectstart')
+ @DocsEditable()
+ @Experimental() // nonstandard
+ ElementStream<Event> get onSelectStart => Element.selectStartEvent._forElementList(this);
+
+ @DomName('Element.onsubmit')
+ @DocsEditable()
+ ElementStream<Event> get onSubmit => Element.submitEvent._forElementList(this);
+
+ @DomName('Element.ontouchcancel')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchCancel => Element.touchCancelEvent._forElementList(this);
+
+ @DomName('Element.ontouchend')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnd => Element.touchEndEvent._forElementList(this);
+
+ @DomName('Element.ontouchenter')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnter => Element.touchEnterEvent._forElementList(this);
+
+ @DomName('Element.ontouchleave')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchLeave => Element.touchLeaveEvent._forElementList(this);
+
+ @DomName('Element.ontouchmove')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchMove => Element.touchMoveEvent._forElementList(this);
+
+ @DomName('Element.ontouchstart')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchStart => Element.touchStartEvent._forElementList(this);
+
+ @DomName('Element.ontransitionend')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
+ @SupportedBrowser(SupportedBrowser.IE, '10')
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ ElementStream<TransitionEvent> get onTransitionEnd => Element.transitionEndEvent._forElementList(this);
+
+ @DomName('Element.onwebkitfullscreenchange')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenChange => Element.fullscreenChangeEvent._forElementList(this);
+
+ @DomName('Element.onwebkitfullscreenerror')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenError => Element.fullscreenErrorEvent._forElementList(this);
+
}
/**
@@ -8680,19 +9316,31 @@
/**
* Checks if this element matches the CSS selectors.
+ *
+ * If `includeAncestors` is true, we examine all of this element's parent
+ * elements and also return true if any of its parent elements matches
+ * `selectors`.
*/
@Experimental()
- bool matches(String selectors) {
- if (JS('bool', '!!#.matches', this)) {
- return JS('bool', '#.matches(#)', this, selectors);
- } else if (JS('bool', '!!#.webkitMatchesSelector', this)) {
- return JS('bool', '#.webkitMatchesSelector(#)', this, selectors);
- } else if (JS('bool', '!!#.mozMatchesSelector', this)) {
- return JS('bool', '#.mozMatchesSelector(#)', this, selectors);
- } else if (JS('bool', '!!#.msMatchesSelector', this)) {
- return JS('bool', '#.msMatchesSelector(#)', this, selectors);
- }
- throw new UnsupportedError("Not supported on this platform");
+ bool matches(String selectors, [includeAncestors = false]) {
+ var elem = this;
+ do {
+ bool matches = false;
+ if (JS('bool', '!!#.matches', elem)) {
+ matches = JS('bool', '#.matches(#)', elem, selectors);
+ } else if (JS('bool', '!!#.webkitMatchesSelector', elem)) {
+ matches = JS('bool', '#.webkitMatchesSelector(#)', elem, selectors);
+ } else if (JS('bool', '!!#.mozMatchesSelector', elem)) {
+ matches = JS('bool', '#.mozMatchesSelector(#)', elem, selectors);
+ } else if (JS('bool', '!!#.msMatchesSelector', elem)) {
+ matches = JS('bool', '#.msMatchesSelector(#)', elem, selectors);
+ } else {
+ throw new UnsupportedError("Not supported on this platform");
+ }
+ if (matches) return true;
+ elem = elem.parent;
+ } while(includeAncestors && elem != null);
+ return false;
}
@Creates('Null') // Set from Dart code; does not instantiate a native type.
@@ -8704,6 +9352,15 @@
bool _templateIsDecorated;
+ @DomName('Element.createShadowRoot')
+ @SupportedBrowser(SupportedBrowser.CHROME, '25')
+ @Experimental()
+ ShadowRoot createShadowRoot() {
+ return JS('ShadowRoot',
+ '(#.createShadowRoot || #.webkitCreateShadowRoot).call(#)',
+ this, this, this);
+ }
+
/**
* Gets the template this node refers to.
@@ -9055,6 +9712,16 @@
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseDownEvent = const EventStreamProvider<MouseEvent>('mousedown');
+ @DomName('Element.mouseenterEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseEnterEvent = const EventStreamProvider<MouseEvent>('mouseenter');
+
+ @DomName('Element.mouseleaveEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseLeaveEvent = const EventStreamProvider<MouseEvent>('mouseleave');
+
@DomName('Element.mousemoveEvent')
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseMoveEvent = const EventStreamProvider<MouseEvent>('mousemove');
@@ -9282,6 +9949,11 @@
@DocsEditable()
final int offsetWidth;
+ @DomName('Element.pseudo')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String pseudo;
+
@DomName('Element.scrollHeight')
@DocsEditable()
final int scrollHeight;
@@ -9298,6 +9970,12 @@
@DocsEditable()
final int scrollWidth;
+ @DomName('Element.shadowRoot')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
+ @Experimental()
+ final ShadowRoot shadowRoot;
+
@DomName('Element.style')
@DocsEditable()
final CssStyleDeclaration style;
@@ -9306,15 +9984,6 @@
@DocsEditable()
final String tagName;
- @JSName('webkitPseudo')
- @DomName('Element.webkitPseudo')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental()
- @Experimental() // nonstandard
- String pseudo;
-
@JSName('webkitRegionOverset')
@DomName('Element.webkitRegionOverset')
@DocsEditable()
@@ -9324,15 +9993,6 @@
// http://dev.w3.org/csswg/css-regions/#dom-region-regionoverset
final String regionOverset;
- @JSName('webkitShadowRoot')
- @DomName('Element.webkitShadowRoot')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental()
- // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
- final ShadowRoot shadowRoot;
-
@DomName('Element.blur')
@DocsEditable()
void blur() native;
@@ -9453,14 +10113,6 @@
@DocsEditable()
void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String value) native;
- @JSName('webkitCreateShadowRoot')
- @DomName('Element.webkitCreateShadowRoot')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME, '25')
- @Experimental()
- // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
- ShadowRoot createShadowRoot() native;
-
@JSName('webkitGetRegionFlowRanges')
@DomName('Element.webkitGetRegionFlowRanges')
@DocsEditable()
@@ -9532,200 +10184,210 @@
@DomName('Element.onabort')
@DocsEditable()
- Stream<Event> get onAbort => abortEvent.forTarget(this);
+ ElementStream<Event> get onAbort => abortEvent.forElement(this);
@DomName('Element.onbeforecopy')
@DocsEditable()
- Stream<Event> get onBeforeCopy => beforeCopyEvent.forTarget(this);
+ ElementStream<Event> get onBeforeCopy => beforeCopyEvent.forElement(this);
@DomName('Element.onbeforecut')
@DocsEditable()
- Stream<Event> get onBeforeCut => beforeCutEvent.forTarget(this);
+ ElementStream<Event> get onBeforeCut => beforeCutEvent.forElement(this);
@DomName('Element.onbeforepaste')
@DocsEditable()
- Stream<Event> get onBeforePaste => beforePasteEvent.forTarget(this);
+ ElementStream<Event> get onBeforePaste => beforePasteEvent.forElement(this);
@DomName('Element.onblur')
@DocsEditable()
- Stream<Event> get onBlur => blurEvent.forTarget(this);
+ ElementStream<Event> get onBlur => blurEvent.forElement(this);
@DomName('Element.onchange')
@DocsEditable()
- Stream<Event> get onChange => changeEvent.forTarget(this);
+ ElementStream<Event> get onChange => changeEvent.forElement(this);
@DomName('Element.onclick')
@DocsEditable()
- Stream<MouseEvent> get onClick => clickEvent.forTarget(this);
+ ElementStream<MouseEvent> get onClick => clickEvent.forElement(this);
@DomName('Element.oncontextmenu')
@DocsEditable()
- Stream<MouseEvent> get onContextMenu => contextMenuEvent.forTarget(this);
+ ElementStream<MouseEvent> get onContextMenu => contextMenuEvent.forElement(this);
@DomName('Element.oncopy')
@DocsEditable()
- Stream<Event> get onCopy => copyEvent.forTarget(this);
+ ElementStream<Event> get onCopy => copyEvent.forElement(this);
@DomName('Element.oncut')
@DocsEditable()
- Stream<Event> get onCut => cutEvent.forTarget(this);
+ ElementStream<Event> get onCut => cutEvent.forElement(this);
@DomName('Element.ondblclick')
@DocsEditable()
- Stream<Event> get onDoubleClick => doubleClickEvent.forTarget(this);
+ ElementStream<Event> get onDoubleClick => doubleClickEvent.forElement(this);
@DomName('Element.ondrag')
@DocsEditable()
- Stream<MouseEvent> get onDrag => dragEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDrag => dragEvent.forElement(this);
@DomName('Element.ondragend')
@DocsEditable()
- Stream<MouseEvent> get onDragEnd => dragEndEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragEnd => dragEndEvent.forElement(this);
@DomName('Element.ondragenter')
@DocsEditable()
- Stream<MouseEvent> get onDragEnter => dragEnterEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragEnter => dragEnterEvent.forElement(this);
@DomName('Element.ondragleave')
@DocsEditable()
- Stream<MouseEvent> get onDragLeave => dragLeaveEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragLeave => dragLeaveEvent.forElement(this);
@DomName('Element.ondragover')
@DocsEditable()
- Stream<MouseEvent> get onDragOver => dragOverEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragOver => dragOverEvent.forElement(this);
@DomName('Element.ondragstart')
@DocsEditable()
- Stream<MouseEvent> get onDragStart => dragStartEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragStart => dragStartEvent.forElement(this);
@DomName('Element.ondrop')
@DocsEditable()
- Stream<MouseEvent> get onDrop => dropEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDrop => dropEvent.forElement(this);
@DomName('Element.onerror')
@DocsEditable()
- Stream<Event> get onError => errorEvent.forTarget(this);
+ ElementStream<Event> get onError => errorEvent.forElement(this);
@DomName('Element.onfocus')
@DocsEditable()
- Stream<Event> get onFocus => focusEvent.forTarget(this);
+ ElementStream<Event> get onFocus => focusEvent.forElement(this);
@DomName('Element.oninput')
@DocsEditable()
- Stream<Event> get onInput => inputEvent.forTarget(this);
+ ElementStream<Event> get onInput => inputEvent.forElement(this);
@DomName('Element.oninvalid')
@DocsEditable()
- Stream<Event> get onInvalid => invalidEvent.forTarget(this);
+ ElementStream<Event> get onInvalid => invalidEvent.forElement(this);
@DomName('Element.onkeydown')
@DocsEditable()
- Stream<KeyboardEvent> get onKeyDown => keyDownEvent.forTarget(this);
+ ElementStream<KeyboardEvent> get onKeyDown => keyDownEvent.forElement(this);
@DomName('Element.onkeypress')
@DocsEditable()
- Stream<KeyboardEvent> get onKeyPress => keyPressEvent.forTarget(this);
+ ElementStream<KeyboardEvent> get onKeyPress => keyPressEvent.forElement(this);
@DomName('Element.onkeyup')
@DocsEditable()
- Stream<KeyboardEvent> get onKeyUp => keyUpEvent.forTarget(this);
+ ElementStream<KeyboardEvent> get onKeyUp => keyUpEvent.forElement(this);
@DomName('Element.onload')
@DocsEditable()
- Stream<Event> get onLoad => loadEvent.forTarget(this);
+ ElementStream<Event> get onLoad => loadEvent.forElement(this);
@DomName('Element.onmousedown')
@DocsEditable()
- Stream<MouseEvent> get onMouseDown => mouseDownEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseDown => mouseDownEvent.forElement(this);
+
+ @DomName('Element.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseEnter => mouseEnterEvent.forElement(this);
+
+ @DomName('Element.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseLeave => mouseLeaveEvent.forElement(this);
@DomName('Element.onmousemove')
@DocsEditable()
- Stream<MouseEvent> get onMouseMove => mouseMoveEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseMove => mouseMoveEvent.forElement(this);
@DomName('Element.onmouseout')
@DocsEditable()
- Stream<MouseEvent> get onMouseOut => mouseOutEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseOut => mouseOutEvent.forElement(this);
@DomName('Element.onmouseover')
@DocsEditable()
- Stream<MouseEvent> get onMouseOver => mouseOverEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseOver => mouseOverEvent.forElement(this);
@DomName('Element.onmouseup')
@DocsEditable()
- Stream<MouseEvent> get onMouseUp => mouseUpEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseUp => mouseUpEvent.forElement(this);
@DomName('Element.onmousewheel')
@DocsEditable()
// http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
@Experimental() // non-standard
- Stream<WheelEvent> get onMouseWheel => mouseWheelEvent.forTarget(this);
+ ElementStream<WheelEvent> get onMouseWheel => mouseWheelEvent.forElement(this);
@DomName('Element.onpaste')
@DocsEditable()
- Stream<Event> get onPaste => pasteEvent.forTarget(this);
+ ElementStream<Event> get onPaste => pasteEvent.forElement(this);
@DomName('Element.onreset')
@DocsEditable()
- Stream<Event> get onReset => resetEvent.forTarget(this);
+ ElementStream<Event> get onReset => resetEvent.forElement(this);
@DomName('Element.onscroll')
@DocsEditable()
- Stream<Event> get onScroll => scrollEvent.forTarget(this);
+ ElementStream<Event> get onScroll => scrollEvent.forElement(this);
@DomName('Element.onsearch')
@DocsEditable()
// http://www.w3.org/TR/html-markup/input.search.html
@Experimental()
- Stream<Event> get onSearch => searchEvent.forTarget(this);
+ ElementStream<Event> get onSearch => searchEvent.forElement(this);
@DomName('Element.onselect')
@DocsEditable()
- Stream<Event> get onSelect => selectEvent.forTarget(this);
+ ElementStream<Event> get onSelect => selectEvent.forElement(this);
@DomName('Element.onselectstart')
@DocsEditable()
@Experimental() // nonstandard
- Stream<Event> get onSelectStart => selectStartEvent.forTarget(this);
+ ElementStream<Event> get onSelectStart => selectStartEvent.forElement(this);
@DomName('Element.onsubmit')
@DocsEditable()
- Stream<Event> get onSubmit => submitEvent.forTarget(this);
+ ElementStream<Event> get onSubmit => submitEvent.forElement(this);
@DomName('Element.ontouchcancel')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchCancel => touchCancelEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchCancel => touchCancelEvent.forElement(this);
@DomName('Element.ontouchend')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchEnd => touchEndEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchEnd => touchEndEvent.forElement(this);
@DomName('Element.ontouchenter')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchEnter => touchEnterEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchEnter => touchEnterEvent.forElement(this);
@DomName('Element.ontouchleave')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchLeave => touchLeaveEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchLeave => touchLeaveEvent.forElement(this);
@DomName('Element.ontouchmove')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchMove => touchMoveEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchMove => touchMoveEvent.forElement(this);
@DomName('Element.ontouchstart')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchStart => touchStartEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchStart => touchStartEvent.forElement(this);
@DomName('Element.ontransitionend')
@DocsEditable()
@@ -9733,23 +10395,22 @@
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
- Stream<TransitionEvent> get onTransitionEnd => transitionEndEvent.forTarget(this);
+ ElementStream<TransitionEvent> get onTransitionEnd => transitionEndEvent.forElement(this);
@DomName('Element.onwebkitfullscreenchange')
@DocsEditable()
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
@Experimental()
- Stream<Event> get onFullscreenChange => fullscreenChangeEvent.forTarget(this);
+ ElementStream<Event> get onFullscreenChange => fullscreenChangeEvent.forElement(this);
@DomName('Element.onwebkitfullscreenerror')
@DocsEditable()
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
@Experimental()
- Stream<Event> get onFullscreenError => fullscreenErrorEvent.forTarget(this);
+ ElementStream<Event> get onFullscreenError => fullscreenErrorEvent.forElement(this);
}
-
final _START_TAG_REGEXP = new RegExp('<(\\w+)');
class _ElementFactoryProvider {
static const _CUSTOM_PARENT_TAG_MAP = const {
@@ -9894,24 +10555,6 @@
@DocsEditable()
-@DomName('ElementTimeControl')
-@Unstable()
-abstract class ElementTimeControl extends Interceptor {
-
- void beginElement();
-
- void beginElementAt(num offset);
-
- void endElement();
-
- void endElementAt(num offset);
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-@DocsEditable()
@DomName('HTMLEmbedElement')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.IE)
@@ -10431,18 +11074,20 @@
@DocsEditable()
final bool withCredentials;
+ @DomName('EventSource.close')
+ @DocsEditable()
+ void close() native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('EventSource.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
- @DomName('EventSource.close')
- @DocsEditable()
- void close() native;
-
@DomName('EventSource.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('EventSource.removeEventListener')
@@ -10757,81 +11402,6 @@
@DocsEditable()
-@DomName('FileException')
-// http://dev.w3.org/2009/dap/file-system/pub/FileSystem/
-@Experimental()
-class FileException extends Interceptor native "FileException" {
-
- @DomName('FileException.ABORT_ERR')
- @DocsEditable()
- static const int ABORT_ERR = 3;
-
- @DomName('FileException.ENCODING_ERR')
- @DocsEditable()
- static const int ENCODING_ERR = 5;
-
- @DomName('FileException.INVALID_MODIFICATION_ERR')
- @DocsEditable()
- static const int INVALID_MODIFICATION_ERR = 9;
-
- @DomName('FileException.INVALID_STATE_ERR')
- @DocsEditable()
- static const int INVALID_STATE_ERR = 7;
-
- @DomName('FileException.NOT_FOUND_ERR')
- @DocsEditable()
- static const int NOT_FOUND_ERR = 1;
-
- @DomName('FileException.NOT_READABLE_ERR')
- @DocsEditable()
- static const int NOT_READABLE_ERR = 4;
-
- @DomName('FileException.NO_MODIFICATION_ALLOWED_ERR')
- @DocsEditable()
- static const int NO_MODIFICATION_ALLOWED_ERR = 6;
-
- @DomName('FileException.PATH_EXISTS_ERR')
- @DocsEditable()
- static const int PATH_EXISTS_ERR = 12;
-
- @DomName('FileException.QUOTA_EXCEEDED_ERR')
- @DocsEditable()
- static const int QUOTA_EXCEEDED_ERR = 10;
-
- @DomName('FileException.SECURITY_ERR')
- @DocsEditable()
- static const int SECURITY_ERR = 2;
-
- @DomName('FileException.SYNTAX_ERR')
- @DocsEditable()
- static const int SYNTAX_ERR = 8;
-
- @DomName('FileException.TYPE_MISMATCH_ERR')
- @DocsEditable()
- static const int TYPE_MISMATCH_ERR = 11;
-
- @DomName('FileException.code')
- @DocsEditable()
- final int code;
-
- @DomName('FileException.message')
- @DocsEditable()
- final String message;
-
- @DomName('FileException.name')
- @DocsEditable()
- final String name;
-
- @DomName('FileException.toString')
- @DocsEditable()
- String toString() 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('FileList')
class FileList extends Interceptor with ListMixin<File>, ImmutableListMixin<File> implements JavaScriptIndexingBehavior, List<File> native "FileList" {
@@ -10958,15 +11528,6 @@
@DocsEditable()
void abort() native;
- @JSName('addEventListener')
- @DomName('FileReader.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('FileReader.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
@DomName('FileReader.readAsArrayBuffer')
@DocsEditable()
void readAsArrayBuffer(Blob blob) native;
@@ -10986,6 +11547,17 @@
@DocsEditable()
void readAsText(Blob blob, [String encoding]) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('FileReader.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('FileReader.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
@JSName('removeEventListener')
@DomName('FileReader.removeEventListener')
@DocsEditable()
@@ -11133,20 +11705,6 @@
@DocsEditable()
void abort() native;
- @JSName('addEventListener')
- @DomName('FileWriter.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('FileWriter.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @JSName('removeEventListener')
- @DomName('FileWriter.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('FileWriter.seek')
@DocsEditable()
void seek(int position) native;
@@ -11159,6 +11717,22 @@
@DocsEditable()
void write(Blob data) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('FileWriter.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('FileWriter.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('FileWriter.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('FileWriter.onabort')
@DocsEditable()
Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
@@ -11249,19 +11823,10 @@
@DocsEditable()
final bool loading;
- @JSName('addEventListener')
- @DomName('FontLoader.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('FontLoader.checkFont')
@DocsEditable()
bool checkFont(String font, String text) native;
- @DomName('FontLoader.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
@DomName('FontLoader.loadFont')
@DocsEditable()
void loadFont(Map params) {
@@ -11278,6 +11843,17 @@
@DocsEditable()
void notifyWhenFontsReady(VoidCallback callback) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('FontLoader.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('FontLoader.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
@JSName('removeEventListener')
@DomName('FontLoader.removeEventListener')
@DocsEditable()
@@ -11434,13 +12010,13 @@
@DocsEditable()
// http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#autofilling-form-controls:-the-autocomplete-attribute
@Experimental()
- Stream<Event> get onAutocomplete => autocompleteEvent.forTarget(this);
+ ElementStream<Event> get onAutocomplete => autocompleteEvent.forElement(this);
@DomName('HTMLFormElement.onautocompleteerror')
@DocsEditable()
// http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#autofilling-form-controls:-the-autocomplete-attribute
@Experimental()
- Stream<AutocompleteErrorEvent> get onAutocompleteError => autocompleteErrorEvent.forTarget(this);
+ ElementStream<AutocompleteErrorEvent> get onAutocompleteError => autocompleteErrorEvent.forElement(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
@@ -11782,6 +12358,23 @@
@DocsEditable()
+@DomName('HmacParams')
+@Experimental() // untriaged
+class HmacParams extends Algorithm native "HmacParams" {
+ // To suppress missing implicit constructor warnings.
+ factory HmacParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('HmacParams.hash')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final Algorithm hash;
+}
+// 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('HTMLAllCollection')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#dom-document-all
@deprecated // deprecated
@@ -12186,6 +12779,40 @@
}
/**
+ * Makes a server POST request with the specified data encoded as form data.
+ *
+ * This is similar to sending a FormData object with broader browser
+ * support but limited to string values.
+ *
+ * See also:
+ *
+ * * [request]
+ */
+ static Future<HttpRequest> postFormData(String url, Map<String, String> data,
+ {bool withCredentials, String responseType,
+ Map<String, String> requestHeaders,
+ void onProgress(ProgressEvent e)}) {
+
+ var parts = [];
+ data.forEach((key, value) {
+ parts.add('${Uri.encodeQueryComponent(key)}='
+ '${Uri.encodeQueryComponent(value)}');
+ });
+ var formData = parts.join('&');
+
+ if (requestHeaders == null) {
+ requestHeaders = <String, String>{};
+ }
+ requestHeaders.putIfAbsent('Content-Type',
+ () => 'application/x-www-form-urlencoded; charset=UTF-8');
+
+ return request(url, method: 'POST', withCredentials: withCredentials,
+ responseType: responseType,
+ requestHeaders: requestHeaders, sendData: formData,
+ onProgress: onProgress);
+ }
+
+ /**
* Creates a URL request for the specified [url].
*
* By default this will do an HTTP GET request, this can be overridden with
@@ -12343,7 +12970,7 @@
*
* var request = new HttpRequest();
* request.open('GET', 'http://dartlang.org')
- * request.onLoad.add((event) => print('Request complete'));
+ * request.onLoad.listen((event) => print('Request complete'));
*
* is the (more verbose) equivalent of
*
@@ -12513,15 +13140,6 @@
@DocsEditable()
void abort() native;
- @JSName('addEventListener')
- @DomName('XMLHttpRequest.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('XMLHttpRequest.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
/**
* Retrieve all the response headers from a request.
*
@@ -12576,11 +13194,6 @@
@SupportedBrowser(SupportedBrowser.SAFARI)
void overrideMimeType(String override) native;
- @JSName('removeEventListener')
- @DomName('XMLHttpRequest.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
/**
* Send the request with any given `data`.
*
@@ -12597,6 +13210,22 @@
@DocsEditable()
void setRequestHeader(String header, String value) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('XMLHttpRequest.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('XMLHttpRequest.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('XMLHttpRequest.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
/**
* Event listeners to be notified when request has been aborted,
* generally due to calling `httpRequest.abort()`.
@@ -12728,6 +13357,8 @@
@DocsEditable()
static const EventStreamProvider<ProgressEvent> progressEvent = const EventStreamProvider<ProgressEvent>('progress');
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('XMLHttpRequestUpload.addEventListener')
@DocsEditable()
@@ -12735,7 +13366,7 @@
@DomName('XMLHttpRequestUpload.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('XMLHttpRequestUpload.removeEventListener')
@@ -12817,6 +13448,36 @@
@DocsEditable()
String 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
+// BSD-style license that can be found in the LICENSE file.
+
+
+@DocsEditable()
+@DomName('ImageBitmap')
+@Experimental() // untriaged
+class ImageBitmap extends Interceptor native "ImageBitmap" {
+
+ @DomName('ImageBitmap.height')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final int height;
+
+ @DomName('ImageBitmap.width')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final int 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
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
+
+@DomName('ImageBitmapCallback')
+@Experimental() // untriaged
+typedef void ImageBitmapCallback(ImageBitmap bitmap);
// 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.
@@ -13051,6 +13712,11 @@
@DocsEditable()
bool indeterminate;
+ @DomName('HTMLInputElement.inputMode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String inputMode;
+
@DomName('HTMLInputElement.labels')
@DocsEditable()
@Returns('NodeList')
@@ -13241,7 +13907,7 @@
@DocsEditable()
// http://lists.w3.org/Archives/Public/public-xg-htmlspeech/2011Feb/att-0020/api-draft.html#extending_html_elements
@Experimental()
- Stream<Event> get onSpeechChange => speechChangeEvent.forTarget(this);
+ ElementStream<Event> get onSpeechChange => speechChangeEvent.forElement(this);
}
@@ -13815,22 +14481,19 @@
@DocsEditable()
final Composition composition;
- @DomName('InputMethodContext.enabled')
- @DocsEditable()
- bool enabled;
-
@DomName('InputMethodContext.locale')
@DocsEditable()
final String locale;
+ @DomName('InputMethodContext.target')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final Element target;
+
@DomName('InputMethodContext.confirmComposition')
@DocsEditable()
void confirmComposition() native;
- @DomName('InputMethodContext.open')
- @DocsEditable()
- bool open() native;
-
@DomName('InputMethodContext.setCaretRectangle')
@DocsEditable()
void setCaretRectangle(Node anchor, int x, int y, int w, int h) native;
@@ -13844,6 +14507,36 @@
// BSD-style license that can be found in the LICENSE file.
+@DocsEditable()
+@DomName('Key')
+@Experimental() // untriaged
+class Key extends Interceptor native "Key" {
+
+ @DomName('Key.algorithm')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final Algorithm algorithm;
+
+ @DomName('Key.extractable')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final bool extractable;
+
+ @DomName('Key.type')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final String type;
+
+ @DomName('Key.usages')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final List<String> usages;
+}
+// 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.
+
+
/**
* An event that describes user interaction with the keyboard.
*
@@ -14225,7 +14918,7 @@
@DomName('MIDISuccessCallback')
@Experimental() // untriaged
-typedef void MidiSuccessCallback(MidiAccess access, bool sysexEnabled);
+typedef void MidiSuccessCallback(MidiAccess access, bool sysex);
// 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.
@@ -14313,15 +15006,6 @@
@DocsEditable()
num volume;
- @JSName('addEventListener')
- @DomName('MediaController.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('MediaController.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
@DomName('MediaController.pause')
@DocsEditable()
void pause() native;
@@ -14330,14 +15014,25 @@
@DocsEditable()
void play() native;
+ @DomName('MediaController.unpause')
+ @DocsEditable()
+ void unpause() native;
+
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('MediaController.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('MediaController.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
@JSName('removeEventListener')
@DomName('MediaController.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('MediaController.unpause')
- @DocsEditable()
- void unpause() 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
@@ -14721,113 +15416,113 @@
@DomName('HTMLMediaElement.oncanplay')
@DocsEditable()
- Stream<Event> get onCanPlay => canPlayEvent.forTarget(this);
+ ElementStream<Event> get onCanPlay => canPlayEvent.forElement(this);
@DomName('HTMLMediaElement.oncanplaythrough')
@DocsEditable()
- Stream<Event> get onCanPlayThrough => canPlayThroughEvent.forTarget(this);
+ ElementStream<Event> get onCanPlayThrough => canPlayThroughEvent.forElement(this);
@DomName('HTMLMediaElement.ondurationchange')
@DocsEditable()
- Stream<Event> get onDurationChange => durationChangeEvent.forTarget(this);
+ ElementStream<Event> get onDurationChange => durationChangeEvent.forElement(this);
@DomName('HTMLMediaElement.onemptied')
@DocsEditable()
- Stream<Event> get onEmptied => emptiedEvent.forTarget(this);
+ ElementStream<Event> get onEmptied => emptiedEvent.forElement(this);
@DomName('HTMLMediaElement.onended')
@DocsEditable()
- Stream<Event> get onEnded => endedEvent.forTarget(this);
+ ElementStream<Event> get onEnded => endedEvent.forElement(this);
@DomName('HTMLMediaElement.onloadeddata')
@DocsEditable()
- Stream<Event> get onLoadedData => loadedDataEvent.forTarget(this);
+ ElementStream<Event> get onLoadedData => loadedDataEvent.forElement(this);
@DomName('HTMLMediaElement.onloadedmetadata')
@DocsEditable()
- Stream<Event> get onLoadedMetadata => loadedMetadataEvent.forTarget(this);
+ ElementStream<Event> get onLoadedMetadata => loadedMetadataEvent.forElement(this);
@DomName('HTMLMediaElement.onloadstart')
@DocsEditable()
- Stream<Event> get onLoadStart => loadStartEvent.forTarget(this);
+ ElementStream<Event> get onLoadStart => loadStartEvent.forElement(this);
@DomName('HTMLMediaElement.onpause')
@DocsEditable()
- Stream<Event> get onPause => pauseEvent.forTarget(this);
+ ElementStream<Event> get onPause => pauseEvent.forElement(this);
@DomName('HTMLMediaElement.onplay')
@DocsEditable()
- Stream<Event> get onPlay => playEvent.forTarget(this);
+ ElementStream<Event> get onPlay => playEvent.forElement(this);
@DomName('HTMLMediaElement.onplaying')
@DocsEditable()
- Stream<Event> get onPlaying => playingEvent.forTarget(this);
+ ElementStream<Event> get onPlaying => playingEvent.forElement(this);
@DomName('HTMLMediaElement.onprogress')
@DocsEditable()
- Stream<Event> get onProgress => progressEvent.forTarget(this);
+ ElementStream<Event> get onProgress => progressEvent.forElement(this);
@DomName('HTMLMediaElement.onratechange')
@DocsEditable()
- Stream<Event> get onRateChange => rateChangeEvent.forTarget(this);
+ ElementStream<Event> get onRateChange => rateChangeEvent.forElement(this);
@DomName('HTMLMediaElement.onseeked')
@DocsEditable()
- Stream<Event> get onSeeked => seekedEvent.forTarget(this);
+ ElementStream<Event> get onSeeked => seekedEvent.forElement(this);
@DomName('HTMLMediaElement.onseeking')
@DocsEditable()
- Stream<Event> get onSeeking => seekingEvent.forTarget(this);
+ ElementStream<Event> get onSeeking => seekingEvent.forElement(this);
@DomName('HTMLMediaElement.onshow')
@DocsEditable()
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#event-media-loadstart
@Experimental()
- Stream<Event> get onShow => showEvent.forTarget(this);
+ ElementStream<Event> get onShow => showEvent.forElement(this);
@DomName('HTMLMediaElement.onstalled')
@DocsEditable()
- Stream<Event> get onStalled => stalledEvent.forTarget(this);
+ ElementStream<Event> get onStalled => stalledEvent.forElement(this);
@DomName('HTMLMediaElement.onsuspend')
@DocsEditable()
- Stream<Event> get onSuspend => suspendEvent.forTarget(this);
+ ElementStream<Event> get onSuspend => suspendEvent.forElement(this);
@DomName('HTMLMediaElement.ontimeupdate')
@DocsEditable()
- Stream<Event> get onTimeUpdate => timeUpdateEvent.forTarget(this);
+ ElementStream<Event> get onTimeUpdate => timeUpdateEvent.forElement(this);
@DomName('HTMLMediaElement.onvolumechange')
@DocsEditable()
- Stream<Event> get onVolumeChange => volumeChangeEvent.forTarget(this);
+ ElementStream<Event> get onVolumeChange => volumeChangeEvent.forElement(this);
@DomName('HTMLMediaElement.onwaiting')
@DocsEditable()
- Stream<Event> get onWaiting => waitingEvent.forTarget(this);
+ ElementStream<Event> get onWaiting => waitingEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitkeyadded')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitkeyerror')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onKeyError => keyErrorEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onKeyError => keyErrorEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitkeymessage')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onKeyMessage => keyMessageEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onKeyMessage => keyMessageEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitneedkey')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onNeedKey => needKeyEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onNeedKey => needKeyEvent.forElement(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
@@ -15036,28 +15731,30 @@
@DocsEditable()
final String sessionId;
+ @DomName('MediaKeySession.close')
+ @DocsEditable()
+ void close() native;
+
+ @DomName('MediaKeySession.update')
+ @DocsEditable()
+ void update(Uint8List key) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('MediaKeySession.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
- @DomName('MediaKeySession.close')
- @DocsEditable()
- void close() native;
-
@DomName('MediaKeySession.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('MediaKeySession.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
- @DomName('MediaKeySession.update')
- @DocsEditable()
- void update(Uint8List key) native;
-
@DomName('MediaKeySession.onwebkitkeyadded')
@DocsEditable()
Stream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forTarget(this);
@@ -15200,19 +15897,10 @@
@DocsEditable()
final SourceBufferList sourceBuffers;
- @JSName('addEventListener')
- @DomName('MediaSource.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('MediaSource.addSourceBuffer')
@DocsEditable()
SourceBuffer addSourceBuffer(String type) native;
- @DomName('MediaSource.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native;
-
@DomName('MediaSource.endOfStream')
@DocsEditable()
void endOfStream(String error) native;
@@ -15221,14 +15909,25 @@
@DocsEditable()
static bool isTypeSupported(String type) native;
+ @DomName('MediaSource.removeSourceBuffer')
+ @DocsEditable()
+ void removeSourceBuffer(SourceBuffer buffer) native;
+
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('MediaSource.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('MediaSource.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
@JSName('removeEventListener')
@DomName('MediaSource.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('MediaSource.removeSourceBuffer')
- @DocsEditable()
- void removeSourceBuffer(SourceBuffer buffer) native;
}
// 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
@@ -15286,19 +15985,10 @@
@Experimental() // non-standard
final String label;
- @JSName('addEventListener')
- @DomName('MediaStream.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('MediaStream.addTrack')
@DocsEditable()
void addTrack(MediaStreamTrack track) native;
- @DomName('MediaStream.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native;
-
@DomName('MediaStream.getAudioTracks')
@DocsEditable()
List<MediaStreamTrack> getAudioTracks() native;
@@ -15311,11 +16001,6 @@
@DocsEditable()
List<MediaStreamTrack> getVideoTracks() native;
- @JSName('removeEventListener')
- @DomName('MediaStream.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('MediaStream.removeTrack')
@DocsEditable()
void removeTrack(MediaStreamTrack track) native;
@@ -15324,6 +16009,22 @@
@DocsEditable()
void stop() native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('MediaStream.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('MediaStream.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('MediaStream.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('MediaStream.onaddtrack')
@DocsEditable()
Stream<Event> get onAddTrack => addTrackEvent.forTarget(this);
@@ -15419,6 +16120,13 @@
@DocsEditable()
final String readyState;
+ @DomName('MediaStreamTrack.getSources')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static void getSources(MediaStreamTrackSourcesCallback callback) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('MediaStreamTrack.addEventListener')
@DocsEditable()
@@ -15428,11 +16136,6 @@
@DocsEditable()
bool dispatchEvent(Event event) native;
- @DomName('MediaStreamTrack.getSources')
- @DocsEditable()
- @Experimental() // untriaged
- static void getSources(MediaStreamTrackSourcesCallback callback) native;
-
@JSName('removeEventListener')
@DomName('MediaStreamTrack.removeEventListener')
@DocsEditable()
@@ -15630,19 +16333,10 @@
@DocsEditable()
static const EventStreamProvider<MessageEvent> messageEvent = const EventStreamProvider<MessageEvent>('message');
- @JSName('addEventListener')
- @DomName('MessagePort.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('MessagePort.close')
@DocsEditable()
void close() native;
- @DomName('MessagePort.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
@DomName('MessagePort.postMessage')
@DocsEditable()
void postMessage(/*any*/ message, [List messagePorts]) {
@@ -15664,15 +16358,26 @@
@DocsEditable()
void _postMessage_2(message) native;
+ @DomName('MessagePort.start')
+ @DocsEditable()
+ void start() native;
+
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('MessagePort.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('MessagePort.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
@JSName('removeEventListener')
@DomName('MessagePort.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
- @DomName('MessagePort.start')
- @DocsEditable()
- void start() native;
-
@DomName('MessagePort.onmessage')
@DocsEditable()
Stream<MessageEvent> get onMessage => messageEvent.forTarget(this);
@@ -15811,6 +16516,16 @@
@DocsEditable()
static const EventStreamProvider<MidiConnectionEvent> disconnectEvent = const EventStreamProvider<MidiConnectionEvent>('disconnect');
+ @DomName('MIDIAccess.inputs')
+ @DocsEditable()
+ List<MidiInput> inputs() native;
+
+ @DomName('MIDIAccess.outputs')
+ @DocsEditable()
+ List<MidiOutput> outputs() native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('MIDIAccess.addEventListener')
@DocsEditable()
@@ -15820,14 +16535,6 @@
@DocsEditable()
bool dispatchEvent(Event event) native;
- @DomName('MIDIAccess.inputs')
- @DocsEditable()
- List<MidiInput> inputs() native;
-
- @DomName('MIDIAccess.outputs')
- @DocsEditable()
- List<MidiOutput> outputs() native;
-
@JSName('removeEventListener')
@DomName('MIDIAccess.removeEventListener')
@DocsEditable()
@@ -15882,7 +16589,7 @@
@DomName('MIDIInput')
// http://webaudio.github.io/web-midi-api/#idl-def-MIDIInput
@Experimental()
-class MidiInput extends MidiPort implements EventTarget native "MIDIInput" {
+class MidiInput extends MidiPort native "MIDIInput" {
// To suppress missing implicit constructor warnings.
factory MidiInput._() { throw new UnsupportedError("Not supported"); }
@@ -15969,6 +16676,8 @@
@DocsEditable()
final String version;
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('MIDIPort.addEventListener')
@DocsEditable()
@@ -16521,15 +17230,6 @@
@DocsEditable()
final bool overset;
- @JSName('addEventListener')
- @DomName('WebKitNamedFlow.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('WebKitNamedFlow.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native;
-
@DomName('WebKitNamedFlow.getContent')
@DocsEditable()
@Returns('NodeList')
@@ -16548,6 +17248,17 @@
@Creates('NodeList')
List<Node> getRegionsByContent(Node contentNode) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('WebKitNamedFlow.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('WebKitNamedFlow.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
@JSName('removeEventListener')
@DomName('WebKitNamedFlow.removeEventListener')
@DocsEditable()
@@ -17267,11 +17978,6 @@
@DocsEditable()
String text;
- @JSName('addEventListener')
- @DomName('Node.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@JSName('appendChild')
/**
* Adds a node to the end of the child [nodes] list of this node.
@@ -17295,10 +18001,6 @@
@DocsEditable()
bool contains(Node other) native;
- @DomName('Node.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native;
-
@DomName('Node.hasChildNodes')
@DocsEditable()
bool hasChildNodes() native;
@@ -17312,16 +18014,27 @@
@DocsEditable()
Node $dom_removeChild(Node oldChild) native;
- @JSName('removeEventListener')
- @DomName('Node.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@JSName('replaceChild')
@DomName('Node.replaceChild')
@DocsEditable()
Node $dom_replaceChild(Node newChild, Node oldChild) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('Node.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('Node.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('Node.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) 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
@@ -17602,11 +18315,6 @@
@Experimental() // nonstandard
String tag;
- @JSName('addEventListener')
- @DomName('Notification.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('Notification.cancel')
@DocsEditable()
@Experimental() // nonstandard
@@ -17616,15 +18324,6 @@
@DocsEditable()
void close() native;
- @DomName('Notification.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @JSName('removeEventListener')
- @DomName('Notification.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@JSName('requestPermission')
@DomName('Notification.requestPermission')
@DocsEditable()
@@ -17645,6 +18344,22 @@
@Experimental() // nonstandard
void show() native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('Notification.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('Notification.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('Notification.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('Notification.onclick')
@DocsEditable()
Stream<Event> get onClick => clickEvent.forTarget(this);
@@ -18172,17 +18887,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE)
-class Performance extends EventTarget native "Performance" {
- // To suppress missing implicit constructor warnings.
- factory Performance._() { throw new UnsupportedError("Not supported"); }
-
- @DomName('Performance.webkitresourcetimingbufferfullEvent')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental()
- // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
- static const EventStreamProvider<Event> resourceTimingBufferFullEvent = const EventStreamProvider<Event>('webkitresourcetimingbufferfull');
+class Performance extends Interceptor native "Performance" {
/// Checks if this type is supported on the current platform.
static bool get supported => JS('bool', '!!(window.performance)');
@@ -18263,12 +18968,6 @@
@Experimental()
// http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
void setResourceTimingBufferSize(int maxSize) native;
-
- @DomName('Performance.onwebkitresourcetimingbufferfull')
- @DocsEditable()
- // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
- @Experimental()
- Stream<Event> get onResourceTimingBufferFull => resourceTimingBufferFullEvent.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
@@ -18819,6 +19518,36 @@
@DomName('Promise')
@Experimental() // untriaged
class Promise extends Interceptor native "Promise" {
+
+ @DomName('Promise._any')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise _any(Object values) native;
+
+ @DomName('Promise.every')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise every(Object values) native;
+
+ @DomName('Promise.fulfill')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise fulfill(Object value) native;
+
+ @DomName('Promise.reject')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise reject(Object value) native;
+
+ @DomName('Promise.resolve')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise resolve(Object value) native;
+
+ @DomName('Promise.some')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise some(Object values) 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
@@ -18829,6 +19558,21 @@
@DomName('PromiseResolver')
@Experimental() // untriaged
class PromiseResolver extends Interceptor native "PromiseResolver" {
+
+ @DomName('PromiseResolver.fulfill')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void fulfill([Object value]) native;
+
+ @DomName('PromiseResolver.reject')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void reject([Object value]) native;
+
+ @DomName('PromiseResolver.resolve')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void resolve([Object value]) 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
@@ -19148,24 +19892,10 @@
@DocsEditable()
final bool reliable;
- @JSName('addEventListener')
- @DomName('RTCDataChannel.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('RTCDataChannel.close')
@DocsEditable()
void close() native;
- @DomName('RTCDataChannel.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native;
-
- @JSName('removeEventListener')
- @DomName('RTCDataChannel.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('RTCDataChannel.send')
@DocsEditable()
void send(data) native;
@@ -19190,6 +19920,22 @@
@DocsEditable()
void sendTypedData(TypedData data) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('RTCDataChannel.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('RTCDataChannel.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('RTCDataChannel.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('RTCDataChannel.onclose')
@DocsEditable()
Stream<Event> get onClose => closeEvent.forTarget(this);
@@ -19261,6 +20007,13 @@
@DocsEditable()
final MediaStreamTrack track;
+ @JSName('insertDTMF')
+ @DomName('RTCDTMFSender.insertDTMF')
+ @DocsEditable()
+ void insertDtmf(String tones, [int duration, int interToneGap]) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('RTCDTMFSender.addEventListener')
@DocsEditable()
@@ -19270,11 +20023,6 @@
@DocsEditable()
bool dispatchEvent(Event event) native;
- @JSName('insertDTMF')
- @DomName('RTCDTMFSender.insertDTMF')
- @DocsEditable()
- void insertDtmf(String tones, [int duration, int interToneGap]) native;
-
@JSName('removeEventListener')
@DomName('RTCDTMFSender.removeEventListener')
@DocsEditable()
@@ -19457,11 +20205,6 @@
@DocsEditable()
final String signalingState;
- @JSName('addEventListener')
- @DomName('RTCPeerConnection.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('RTCPeerConnection.addIceCandidate')
@DocsEditable()
void addIceCandidate(RtcIceCandidate candidate) native;
@@ -19553,10 +20296,6 @@
@DocsEditable()
void _createOffer_2(_RtcSessionDescriptionCallback successCallback, _RtcErrorCallback failureCallback) native;
- @DomName('RTCPeerConnection.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native;
-
@DomName('RTCPeerConnection.getLocalStreams')
@DocsEditable()
List<MediaStream> getLocalStreams() native;
@@ -19573,11 +20312,6 @@
@DocsEditable()
MediaStream getStreamById(String streamId) native;
- @JSName('removeEventListener')
- @DomName('RTCPeerConnection.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('RTCPeerConnection.removeStream')
@DocsEditable()
void removeStream(MediaStream stream) native;
@@ -19644,6 +20378,22 @@
@DocsEditable()
void _updateIce_3() native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('RTCPeerConnection.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('RTCPeerConnection.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('RTCPeerConnection.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('RTCPeerConnection.onaddstream')
@DocsEditable()
Stream<MediaStreamEvent> get onAddStream => addStreamEvent.forTarget(this);
@@ -20002,6 +20752,11 @@
@DocsEditable()
final String sourceFile;
+ @DomName('SecurityPolicyViolationEvent.statusCode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final int statusCode;
+
@DomName('SecurityPolicyViolationEvent.violatedDirective')
@DocsEditable()
final String violatedDirective;
@@ -20349,6 +21104,23 @@
@DocsEditable()
+@DomName('SharedWorkerGlobalScope')
+@Experimental() // untriaged
+class SharedWorkerGlobalScope extends WorkerGlobalScope native "SharedWorkerGlobalScope" {
+ // To suppress missing implicit constructor warnings.
+ factory SharedWorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('SharedWorkerGlobalScope.name')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final String name;
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+
+@DocsEditable()
@DomName('SourceBuffer')
// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer
@Experimental()
@@ -20373,17 +21145,25 @@
@DocsEditable()
void abort() native;
+ @DomName('SourceBuffer.appendBuffer')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void appendBuffer(ByteBuffer data) native;
+
+ @JSName('appendBuffer')
+ @DomName('SourceBuffer.appendBuffer')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void appendBufferView(TypedData data) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('SourceBuffer.addEventListener')
@DocsEditable()
@Experimental() // untriaged
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
- @DomName('SourceBuffer.appendBuffer')
- @DocsEditable()
- @Experimental() // untriaged
- void appendBuffer(data) native;
-
@DomName('SourceBuffer.dispatchEvent')
@DocsEditable()
@Experimental() // untriaged
@@ -20456,6 +21236,12 @@
SourceBuffer elementAt(int index) => this[index];
// -- end List<SourceBuffer> mixins.
+ @DomName('SourceBufferList.item')
+ @DocsEditable()
+ SourceBuffer item(int index) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('SourceBufferList.addEventListener')
@DocsEditable()
@@ -20465,10 +21251,6 @@
@DocsEditable()
bool dispatchEvent(Event event) native;
- @DomName('SourceBufferList.item')
- @DocsEditable()
- SourceBuffer item(int index) native;
-
@JSName('removeEventListener')
@DomName('SourceBufferList.removeEventListener')
@DocsEditable()
@@ -20772,20 +21554,6 @@
@DocsEditable()
void abort() native;
- @JSName('addEventListener')
- @DomName('SpeechRecognition.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- @DomName('SpeechRecognition.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @JSName('removeEventListener')
- @DomName('SpeechRecognition.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('SpeechRecognition.start')
@DocsEditable()
void start() native;
@@ -20794,6 +21562,22 @@
@DocsEditable()
void stop() native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('SpeechRecognition.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('SpeechRecognition.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('SpeechRecognition.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('SpeechRecognition.onaudioend')
@DocsEditable()
Stream<Event> get onAudioEnd => audioEndEvent.forTarget(this);
@@ -21085,6 +21869,25 @@
@DocsEditable()
num volume;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('SpeechSynthesisUtterance.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('SpeechSynthesisUtterance.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('SpeechSynthesisUtterance.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('SpeechSynthesisUtterance.onboundary')
@DocsEditable()
Stream<SpeechSynthesisEvent> get onBoundary => boundaryEvent.forTarget(this);
@@ -21283,7 +22086,7 @@
@DomName('StorageErrorCallback')
// http://www.w3.org/TR/quota-api/#storageerrorcallback-callback
@Experimental()
-typedef void StorageErrorCallback(DomException error);
+typedef void StorageErrorCallback(DomError error);
// 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.
@@ -21544,6 +22347,84 @@
@DomName('SubtleCrypto')
@Experimental() // untriaged
class SubtleCrypto extends Interceptor native "SubtleCrypto" {
+
+ @DomName('SubtleCrypto.decrypt')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation decrypt(Map algorithm) {
+ var algorithm_1 = convertDartToNative_Dictionary(algorithm);
+ return _decrypt_1(algorithm_1);
+ }
+ @JSName('decrypt')
+ @DomName('SubtleCrypto.decrypt')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation _decrypt_1(algorithm) native;
+
+ @DomName('SubtleCrypto.digest')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation digest(Map algorithm) {
+ var algorithm_1 = convertDartToNative_Dictionary(algorithm);
+ return _digest_1(algorithm_1);
+ }
+ @JSName('digest')
+ @DomName('SubtleCrypto.digest')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation _digest_1(algorithm) native;
+
+ @DomName('SubtleCrypto.encrypt')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation encrypt(Map algorithm) {
+ var algorithm_1 = convertDartToNative_Dictionary(algorithm);
+ return _encrypt_1(algorithm_1);
+ }
+ @JSName('encrypt')
+ @DomName('SubtleCrypto.encrypt')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation _encrypt_1(algorithm) native;
+
+ @DomName('SubtleCrypto.importKey')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Object importKey(String format, TypedData keyData, Map algorithm, bool extractable, List<String> keyUsages) {
+ var algorithm_1 = convertDartToNative_Dictionary(algorithm);
+ return _importKey_1(format, keyData, algorithm_1, extractable, keyUsages);
+ }
+ @JSName('importKey')
+ @DomName('SubtleCrypto.importKey')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Object _importKey_1(format, TypedData keyData, algorithm, extractable, List<String> keyUsages) native;
+
+ @DomName('SubtleCrypto.sign')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation sign(Map algorithm) {
+ var algorithm_1 = convertDartToNative_Dictionary(algorithm);
+ return _sign_1(algorithm_1);
+ }
+ @JSName('sign')
+ @DomName('SubtleCrypto.sign')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation _sign_1(algorithm) native;
+
+ @DomName('SubtleCrypto.verify')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation verify(Map algorithm) {
+ var algorithm_1 = convertDartToNative_Dictionary(algorithm);
+ return _verify_1(algorithm_1);
+ }
+ @JSName('verify')
+ @DomName('SubtleCrypto.verify')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation _verify_1(algorithm) 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
@@ -22182,6 +23063,11 @@
@DocsEditable()
final FormElement form;
+ @DomName('HTMLTextAreaElement.inputMode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String inputMode;
+
@DomName('HTMLTextAreaElement.labels')
@DocsEditable()
@Unstable()
@@ -22365,6 +23251,12 @@
@DocsEditable()
void addCue(TextTrackCue cue) native;
+ @DomName('TextTrack.removeCue')
+ @DocsEditable()
+ void removeCue(TextTrackCue cue) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('TextTrack.addEventListener')
@DocsEditable()
@@ -22372,11 +23264,7 @@
@DomName('TextTrack.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @DomName('TextTrack.removeCue')
- @DocsEditable()
- void removeCue(TextTrackCue cue) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('TextTrack.removeEventListener')
@@ -22470,6 +23358,14 @@
@Experimental() // nonstandard
String vertical;
+ @JSName('getCueAsHTML')
+ @DomName('TextTrackCue.getCueAsHTML')
+ @DocsEditable()
+ @Experimental() // nonstandard
+ DocumentFragment getCueAsHtml() native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('TextTrackCue.addEventListener')
@DocsEditable()
@@ -22477,13 +23373,7 @@
@DomName('TextTrackCue.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @JSName('getCueAsHTML')
- @DomName('TextTrackCue.getCueAsHTML')
- @DocsEditable()
- @Experimental() // nonstandard
- DocumentFragment getCueAsHtml() native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('TextTrackCue.removeEventListener')
@@ -22630,6 +23520,12 @@
TextTrack elementAt(int index) => this[index];
// -- end List<TextTrack> mixins.
+ @DomName('TextTrackList.item')
+ @DocsEditable()
+ TextTrack item(int index) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('TextTrackList.addEventListener')
@DocsEditable()
@@ -22637,11 +23533,7 @@
@DomName('TextTrackList.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @DomName('TextTrackList.item')
- @DocsEditable()
- TextTrack item(int index) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('TextTrackList.removeEventListener')
@@ -23582,24 +24474,10 @@
@DocsEditable()
final String url;
- @JSName('addEventListener')
- @DomName('WebSocket.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('WebSocket.close')
@DocsEditable()
void close([int code, String reason]) native;
- @DomName('WebSocket.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @JSName('removeEventListener')
- @DomName('WebSocket.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
/**
* Transmit data to the server over this connection.
*
@@ -23659,6 +24537,22 @@
@DocsEditable()
void sendTypedData(TypedData data) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('WebSocket.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('WebSocket.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('WebSocket.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('WebSocket.onclose')
@DocsEditable()
Stream<CloseEvent> get onClose => closeEvent.forTarget(this);
@@ -23922,7 +24816,7 @@
@DomName('Window')
-class Window extends EventTarget implements WindowBase, WindowTimers native "Window,DOMWindow" {
+class Window extends EventTarget implements WindowBase, WindowTimers, WindowBase64 native "Window,DOMWindow" {
/**
* Executes a [callback] after the immediate execution stack has completed.
@@ -24506,23 +25400,10 @@
@Returns('Window|=Object')
__getter___2(String name) native;
- @JSName('addEventListener')
- @DomName('Window.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('Window.alert')
@DocsEditable()
void alert(String message) native;
- @DomName('Window.atob')
- @DocsEditable()
- String atob(String string) native;
-
- @DomName('Window.btoa')
- @DocsEditable()
- String btoa(String string) native;
-
@DomName('Window.close')
@DocsEditable()
void close() native;
@@ -24531,9 +25412,122 @@
@DocsEditable()
bool confirm(String message) native;
- @DomName('Window.dispatchEvent')
+ @DomName('Window.createImageBitmap')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
+ @Experimental() // untriaged
+ void _createImageBitmap(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, ImageBitmapCallback callback, [int sx, int sy, int sw, int sh]) {
+ if ((bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_1(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if (sh != null && sw != null && sy != null && sx != null && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_2(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is VideoElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_3(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if (sh != null && sw != null && sy != null && sx != null && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is VideoElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_4(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasRenderingContext2D || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_5(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if (sh != null && sw != null && sy != null && sx != null && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasRenderingContext2D || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_6(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_7(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if (sh != null && sw != null && sy != null && sx != null && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_8(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageData || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ var data_1 = convertDartToNative_ImageData(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video);
+ _createImageBitmap_9(data_1, callback);
+ return;
+ }
+ if (sh != null && sw != null && sy != null && sx != null && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageData || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ var data_2 = convertDartToNative_ImageData(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video);
+ _createImageBitmap_10(data_2, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageBitmap || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_11(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if (sh != null && sw != null && sy != null && sx != null && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageBitmap || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_12(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ throw new ArgumentError("Incorrect number or type of arguments");
+ }
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_1(ImageElement image, ImageBitmapCallback callback) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_2(ImageElement image, ImageBitmapCallback callback, sx, sy, sw, sh) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_3(VideoElement video, ImageBitmapCallback callback) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_4(VideoElement video, ImageBitmapCallback callback, sx, sy, sw, sh) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_5(CanvasRenderingContext2D context, ImageBitmapCallback callback) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_6(CanvasRenderingContext2D context, ImageBitmapCallback callback, sx, sy, sw, sh) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_7(CanvasElement canvas, ImageBitmapCallback callback) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_8(CanvasElement canvas, ImageBitmapCallback callback, sx, sy, sw, sh) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_9(data, ImageBitmapCallback callback) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_10(data, ImageBitmapCallback callback, sx, sy, sw, sh) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_11(ImageBitmap bitmap, ImageBitmapCallback callback) native;
+ @JSName('createImageBitmap')
+ @DomName('Window.createImageBitmap')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _createImageBitmap_12(ImageBitmap bitmap, ImageBitmapCallback callback, sx, sy, sw, sh) native;
@DomName('Window.find')
@DocsEditable()
@@ -24605,11 +25599,6 @@
@DocsEditable()
void print() native;
- @JSName('removeEventListener')
- @DomName('Window.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('Window.resizeBy')
@DocsEditable()
void resizeBy(num x, num y) native;
@@ -24705,6 +25694,32 @@
return completer.future;
}
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('Window.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('Window.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('Window.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ // From WindowBase64
+
+ @DomName('Window.atob')
+ @DocsEditable()
+ String atob(String string) native;
+
+ @DomName('Window.btoa')
+ @DocsEditable()
+ String btoa(String string) native;
+
// From WindowTimers
@JSName('clearInterval')
@@ -24839,6 +25854,16 @@
@DocsEditable()
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);
+ @DomName('Window.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseEnter => Element.mouseEnterEvent.forTarget(this);
+
+ @DomName('Window.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseLeave => Element.mouseLeaveEvent.forTarget(this);
+
@DomName('Window.onmousemove')
@DocsEditable()
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);
@@ -25036,6 +26061,20 @@
@DocsEditable()
+@DomName('WindowBase64')
+@Experimental() // untriaged
+abstract class WindowBase64 extends Interceptor {
+
+ String atob(String string);
+
+ String btoa(String string);
+}
+// 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('WindowTimers')
@Experimental() // untriaged
abstract class WindowTimers extends Interceptor {
@@ -25092,6 +26131,25 @@
@DocsEditable()
void terminate() native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('Worker.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('Worker.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('Worker.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('Worker.onerror')
@DocsEditable()
@Experimental() // untriaged
@@ -25124,11 +26182,212 @@
@DocsEditable()
+@DomName('WorkerGlobalScope')
+@Experimental() // untriaged
+class WorkerGlobalScope extends EventTarget implements WindowTimers, WindowBase64 native "WorkerGlobalScope" {
+ // To suppress missing implicit constructor warnings.
+ factory WorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('WorkerGlobalScope.errorEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
+
+ @DomName('WorkerGlobalScope.PERSISTENT')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int PERSISTENT = 1;
+
+ @DomName('WorkerGlobalScope.TEMPORARY')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int TEMPORARY = 0;
+
+ @DomName('WorkerGlobalScope.crypto')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final WorkerCrypto crypto;
+
+ @DomName('WorkerGlobalScope.indexedDB')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final IdbFactory indexedDB;
+
+ @DomName('WorkerGlobalScope.location')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final _WorkerLocation location;
+
+ @DomName('WorkerGlobalScope.navigator')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final _WorkerNavigator navigator;
+
+ @DomName('WorkerGlobalScope.performance')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final WorkerPerformance performance;
+
+ @DomName('WorkerGlobalScope.self')
+ @DocsEditable()
+ @Experimental() // untriaged
+ final WorkerGlobalScope self;
+
+ @JSName('webkitNotifications')
+ @DomName('WorkerGlobalScope.webkitNotifications')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental()
+ @Experimental() // untriaged
+ final NotificationCenter notifications;
+
+ @DomName('WorkerGlobalScope.close')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void close() native;
+
+ @DomName('WorkerGlobalScope.importScripts')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void importScripts() native;
+
+ @DomName('WorkerGlobalScope.openDatabase')
+ @DocsEditable()
+ @Experimental() // untriaged
+ SqlDatabase openDatabase(String name, String version, String displayName, int estimatedSize, [DatabaseCallback creationCallback]) native;
+
+ @DomName('WorkerGlobalScope.openDatabaseSync')
+ @DocsEditable()
+ @Experimental() // untriaged
+ _DatabaseSync openDatabaseSync(String name, String version, String displayName, int estimatedSize, [DatabaseCallback creationCallback]) native;
+
+ @JSName('webkitRequestFileSystem')
+ @DomName('WorkerGlobalScope.webkitRequestFileSystem')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _webkitRequestFileSystem(int type, int size, [_FileSystemCallback successCallback, _ErrorCallback errorCallback]) native;
+
+ @JSName('webkitRequestFileSystem')
+ @DomName('WorkerGlobalScope.webkitRequestFileSystem')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Future<FileSystem> webkitRequestFileSystem(int type, int size) {
+ var completer = new Completer<FileSystem>();
+ _webkitRequestFileSystem(type, size,
+ (value) { completer.complete(value); },
+ (error) { completer.completeError(error); });
+ return completer.future;
+ }
+
+ @JSName('webkitRequestFileSystemSync')
+ @DomName('WorkerGlobalScope.webkitRequestFileSystemSync')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental()
+ @Experimental() // untriaged
+ _DOMFileSystemSync requestFileSystemSync(int type, int size) native;
+
+ @JSName('webkitResolveLocalFileSystemSyncURL')
+ @DomName('WorkerGlobalScope.webkitResolveLocalFileSystemSyncURL')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental()
+ @Experimental() // untriaged
+ _EntrySync resolveLocalFileSystemSyncUrl(String url) native;
+
+ @JSName('webkitResolveLocalFileSystemURL')
+ @DomName('WorkerGlobalScope.webkitResolveLocalFileSystemURL')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _webkitResolveLocalFileSystemUrl(String url, _EntryCallback successCallback, [_ErrorCallback errorCallback]) native;
+
+ @JSName('webkitResolveLocalFileSystemURL')
+ @DomName('WorkerGlobalScope.webkitResolveLocalFileSystemURL')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Future<Entry> webkitResolveLocalFileSystemUrl(String url) {
+ var completer = new Completer<Entry>();
+ _webkitResolveLocalFileSystemUrl(url,
+ (value) { completer.complete(value); },
+ (error) { completer.completeError(error); });
+ return completer.future;
+ }
+
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('WorkerGlobalScope.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('WorkerGlobalScope.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('WorkerGlobalScope.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ // From WindowBase64
+
+ @DomName('WorkerGlobalScope.atob')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String atob(String string) native;
+
+ @DomName('WorkerGlobalScope.btoa')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String btoa(String string) native;
+
+ // From WindowTimers
+
+ @DomName('WorkerGlobalScope.clearInterval')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void clearInterval(int handle) native;
+
+ @DomName('WorkerGlobalScope.clearTimeout')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void clearTimeout(int handle) native;
+
+ @DomName('WorkerGlobalScope.setInterval')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int setInterval(Object handler, int timeout) native;
+
+ @DomName('WorkerGlobalScope.setTimeout')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int setTimeout(Object handler, int timeout) native;
+
+ @DomName('WorkerGlobalScope.onerror')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<Event> get onError => errorEvent.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('WorkerPerformance')
@Experimental() // untriaged
-abstract class WorkerPerformance extends Interceptor {
+class WorkerPerformance extends Interceptor native "WorkerPerformance" {
- num now();
+ @DomName('WorkerPerformance.now')
+ @DocsEditable()
+ @Experimental() // untriaged
+ num 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
@@ -25770,19 +27029,6 @@
@DocsEditable()
-@DomName('DedicatedWorkerContext')
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html
-@Experimental()
-abstract class _DedicatedWorkerContext extends _WorkerContext native "DedicatedWorkerContext" {
- // To suppress missing implicit constructor warnings.
- factory _DedicatedWorkerContext._() { 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('DirectoryEntrySync')
// http://www.w3.org/TR/file-system-api/#the-directoryentrysync-interface
@Experimental()
@@ -26345,19 +27591,8 @@
}
static _SharedWorker _create_1(scriptURL, name) => JS('_SharedWorker', 'new SharedWorker(#,#)', scriptURL, name);
static _SharedWorker _create_2(scriptURL) => JS('_SharedWorker', 'new SharedWorker(#)', scriptURL);
-}
-// 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('SharedWorkerContext')
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#shared-workers-and-the-sharedworkerglobalscope-interface
-@Experimental() // nonstandard
-abstract class _SharedWorkerContext extends _WorkerContext native "SharedWorkerContext" {
- // To suppress missing implicit constructor warnings.
- factory _SharedWorkerContext._() { throw new UnsupportedError("Not supported"); }
+ // From EventTarget
}
// 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
@@ -26568,6 +27803,8 @@
return _WebKitMediaSource._create_1();
}
static _WebKitMediaSource _create_1() => JS('_WebKitMediaSource', 'new WebKitMediaSource()');
+
+ // From EventTarget
}
// 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
@@ -26596,19 +27833,8 @@
@DocsEditable()
@Experimental() // untriaged
_WebKitSourceBuffer _item(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
-// BSD-style license that can be found in the LICENSE file.
-
-@DocsEditable()
-@DomName('WorkerContext')
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#WorkerGlobalScope-partial
-@Experimental() // stable
-abstract class _WorkerContext extends Interceptor implements EventTarget, WindowTimers native "WorkerContext" {
-
- // From WindowTimers
+ // From EventTarget
}
// 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
@@ -27562,6 +28788,123 @@
}
}
+/** A specialized Stream available to [Element]s to enable event delegation. */
+abstract class ElementStream<T extends Event> implements Stream<T> {
+ /**
+ * Return a stream that only fires when the particular event fires for
+ * elements matching the specified CSS selector.
+ *
+ * This is the Dart equivalent to jQuery's
+ * [delegate](http://api.jquery.com/delegate/).
+ */
+ Stream<T> matches(String selector);
+}
+
+/**
+ * Adapter for exposing DOM Element events as streams, while also allowing
+ * event delegation.
+ */
+class _ElementEventStreamImpl<T extends Event> extends _EventStream<T>
+ implements ElementStream<T> {
+ _ElementEventStreamImpl(target, eventType, useCapture) :
+ super(target, eventType, useCapture);
+
+ Stream<T> matches(String selector) =>
+ this.where((event) => event.target.matches(selector, true));
+}
+
+/**
+ * Adapter for exposing events on a collection of DOM Elements as streams,
+ * while also allowing event delegation.
+ */
+class _ElementListEventStreamImpl<T extends Event> extends Stream<T>
+ implements ElementStream<T> {
+ final _StreamPool _pool;
+ Stream<T> _stream;
+
+ _ElementListEventStreamImpl(targetList, eventType, useCapture) :
+ _pool = new _StreamPool.broadcast() {
+ for (Element target in targetList) {
+ var stream = new _EventStream(target, eventType, useCapture);
+ _pool.add(stream);
+ }
+ _stream = _pool.stream;
+ }
+
+ Stream<T> matches(String selector) =>
+ this.where((event) => event.target.matches(selector, true));
+
+ // Delegate all regular Stream behavor to our wrapped Stream.
+ StreamSubscription<T> listen(void onData(T event),
+ { void onError(error),
+ void onDone(),
+ bool cancelOnError}) =>
+ _stream.listen(onData, onError: onError, onDone: onDone,
+ cancelOnError: cancelOnError);
+ Stream<T> asBroadcastStream({void onListen(StreamSubscription subscription),
+ void onCancel(StreamSubscription subscription)})
+ => _stream;
+ bool get isBroadcast => true;
+}
+
+/**
+ * A pool of streams whose events are unified and emitted through a central
+ * stream.
+ */
+// TODO (efortuna): Remove this when Issue 12218 is addressed.
+class _StreamPool<T> {
+ StreamController<T> _controller;
+
+ /// Subscriptions to the streams that make up the pool.
+ var _subscriptions = new Map<Stream<T>, StreamSubscription<T>>();
+
+ /**
+ * Creates a new stream pool where [stream] can be listened to more than
+ * once.
+ *
+ * Any events from buffered streams in the pool will be emitted immediately,
+ * regardless of whether [stream] has any subscribers.
+ */
+ _StreamPool.broadcast() {
+ _controller = new StreamController<T>.broadcast(sync: true,
+ onCancel: close);
+ }
+
+ /**
+ * The stream through which all events from streams in the pool are emitted.
+ */
+ Stream<T> get stream => _controller.stream;
+
+ /**
+ * Adds [stream] as a member of this pool.
+ *
+ * Any events from [stream] will be emitted through [this.stream]. If
+ * [stream] is sync, they'll be emitted synchronously; if [stream] is async,
+ * they'll be emitted asynchronously.
+ */
+ void add(Stream<T> stream) {
+ if (_subscriptions.containsKey(stream)) return;
+ _subscriptions[stream] = stream.listen(_controller.add,
+ onError: _controller.addError,
+ onDone: () => remove(stream));
+ }
+
+ /** Removes [stream] as a member of this pool. */
+ void remove(Stream<T> stream) {
+ var subscription = _subscriptions.remove(stream);
+ if (subscription != null) subscription.cancel();
+ }
+
+ /** Removes all streams from this pool and closes [stream]. */
+ void close() {
+ for (var subscription in _subscriptions.values) {
+ subscription.cancel();
+ }
+ _subscriptions.clear();
+ _controller.close();
+ }
+}
+
class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
int _pauseCount = 0;
EventTarget _target;
@@ -27639,7 +28982,6 @@
}
}
-
/**
* A factory to expose DOM events as Streams.
*/
@@ -27666,8 +29008,43 @@
*
* [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
*/
- Stream<T> forTarget(EventTarget e, {bool useCapture: false}) {
- return new _EventStream(e, _eventType, useCapture);
+ Stream<T> forTarget(EventTarget e, {bool useCapture: false}) =>
+ new _EventStream(e, _eventType, useCapture);
+
+ /**
+ * Gets an [ElementEventStream] for this event type, on the specified element.
+ *
+ * This will always return a broadcast stream so multiple listeners can be
+ * used simultaneously.
+ *
+ * This may be used to capture DOM events:
+ *
+ * Element.keyDownEvent.forElement(element, useCapture: true).listen(...);
+ *
+ * See also:
+ *
+ * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
+ */
+ ElementStream<T> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventType, useCapture);
+ }
+
+ /**
+ * Gets an [ElementEventStream] for this event type, on the list of elements.
+ *
+ * This will always return a broadcast stream so multiple listeners can be
+ * used simultaneously.
+ *
+ * This may be used to capture DOM events:
+ *
+ * Element.keyDownEvent._forElementList(element, useCapture: true).listen(...);
+ *
+ * See also:
+ *
+ * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
+ */
+ ElementStream<T> _forElementList(ElementList e, {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventType, useCapture);
}
/**
@@ -27696,6 +29073,15 @@
return new _EventStream(e, _eventTypeGetter(e), useCapture);
}
+ ElementStream<T> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventTypeGetter(e), useCapture);
+ }
+
+ ElementStream<T> _forElementList(ElementList e,
+ {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventTypeGetter(e), useCapture);
+ }
+
String getEventType(EventTarget target) {
return _eventTypeGetter(target);
}
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 3b3637e..1524bc9 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -91,18 +91,14 @@
_callPortLastResult = null;
return result;
}
-// 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.
-// WARNING: Do not edit - generated code.
-
@DocsEditable()
@DomName('AbstractWorker')
-class AbstractWorker extends EventTarget {
- // To suppress missing implicit constructor warnings.
- factory AbstractWorker._() { throw new UnsupportedError("Not supported"); }
+class AbstractWorker extends NativeFieldWrapperClass1 implements EventTarget {
@DomName('AbstractWorker.errorEvent')
@DocsEditable()
@@ -111,6 +107,63 @@
@DomName('AbstractWorker.onerror')
@DocsEditable()
Stream<ErrorEvent> get onError => errorEvent.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('AesCbcParams')
+@Experimental() // untriaged
+class AesCbcParams extends Algorithm {
+ // To suppress missing implicit constructor warnings.
+ factory AesCbcParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('AesCbcParams.iv')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Uint8List get iv native "AesCbcParams_iv_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('AesKeyGenParams')
+@Experimental() // untriaged
+class AesKeyGenParams extends Algorithm {
+ // To suppress missing implicit constructor warnings.
+ factory AesKeyGenParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('AesKeyGenParams.length')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int get length native "AesKeyGenParams_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('Algorithm')
+@Experimental() // untriaged
+class Algorithm extends NativeFieldWrapperClass1 {
+
+ @DomName('Algorithm.name')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get name native "Algorithm_name_Getter";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -384,18 +437,6 @@
@DocsEditable()
void abort() native "DOMApplicationCache_abort_Callback";
- @DomName('DOMApplicationCache.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "DOMApplicationCache_addEventListener_Callback";
-
- @DomName('DOMApplicationCache.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "DOMApplicationCache_dispatchEvent_Callback";
-
- @DomName('DOMApplicationCache.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "DOMApplicationCache_removeEventListener_Callback";
-
@DomName('DOMApplicationCache.swapCache')
@DocsEditable()
void swapCache() native "DOMApplicationCache_swapCache_Callback";
@@ -404,6 +445,18 @@
@DocsEditable()
void update() native "DOMApplicationCache_update_Callback";
+ @DomName('DOMApplicationCache.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "DOMApplicationCache_addEventListener_Callback";
+
+ @DomName('DOMApplicationCache.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "DOMApplicationCache_dispatchEvent_Callback";
+
+ @DomName('DOMApplicationCache.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "DOMApplicationCache_removeEventListener_Callback";
+
@DomName('DOMApplicationCache.oncached')
@DocsEditable()
Stream<Event> get onCached => cachedEvent.forTarget(this);
@@ -790,51 +843,51 @@
@DomName('HTMLBodyElement.onblur')
@DocsEditable()
- Stream<Event> get onBlur => blurEvent.forTarget(this);
+ ElementStream<Event> get onBlur => blurEvent.forElement(this);
@DomName('HTMLBodyElement.onerror')
@DocsEditable()
- Stream<Event> get onError => errorEvent.forTarget(this);
+ ElementStream<Event> get onError => errorEvent.forElement(this);
@DomName('HTMLBodyElement.onfocus')
@DocsEditable()
- Stream<Event> get onFocus => focusEvent.forTarget(this);
+ ElementStream<Event> get onFocus => focusEvent.forElement(this);
@DomName('HTMLBodyElement.onhashchange')
@DocsEditable()
- Stream<Event> get onHashChange => hashChangeEvent.forTarget(this);
+ ElementStream<Event> get onHashChange => hashChangeEvent.forElement(this);
@DomName('HTMLBodyElement.onload')
@DocsEditable()
- Stream<Event> get onLoad => loadEvent.forTarget(this);
+ ElementStream<Event> get onLoad => loadEvent.forElement(this);
@DomName('HTMLBodyElement.onmessage')
@DocsEditable()
- Stream<MessageEvent> get onMessage => messageEvent.forTarget(this);
+ ElementStream<MessageEvent> get onMessage => messageEvent.forElement(this);
@DomName('HTMLBodyElement.onoffline')
@DocsEditable()
- Stream<Event> get onOffline => offlineEvent.forTarget(this);
+ ElementStream<Event> get onOffline => offlineEvent.forElement(this);
@DomName('HTMLBodyElement.ononline')
@DocsEditable()
- Stream<Event> get onOnline => onlineEvent.forTarget(this);
+ ElementStream<Event> get onOnline => onlineEvent.forElement(this);
@DomName('HTMLBodyElement.onpopstate')
@DocsEditable()
- Stream<PopStateEvent> get onPopState => popStateEvent.forTarget(this);
+ ElementStream<PopStateEvent> get onPopState => popStateEvent.forElement(this);
@DomName('HTMLBodyElement.onresize')
@DocsEditable()
- Stream<Event> get onResize => resizeEvent.forTarget(this);
+ ElementStream<Event> get onResize => resizeEvent.forElement(this);
@DomName('HTMLBodyElement.onstorage')
@DocsEditable()
- Stream<StorageEvent> get onStorage => storageEvent.forTarget(this);
+ ElementStream<StorageEvent> get onStorage => storageEvent.forElement(this);
@DomName('HTMLBodyElement.onunload')
@DocsEditable()
- Stream<Event> get onUnload => unloadEvent.forTarget(this);
+ ElementStream<Event> get onUnload => unloadEvent.forElement(this);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -1099,11 +1152,11 @@
@DomName('HTMLCanvasElement.onwebglcontextlost')
@DocsEditable()
- Stream<gl.ContextEvent> get onWebGlContextLost => webGlContextLostEvent.forTarget(this);
+ ElementStream<gl.ContextEvent> get onWebGlContextLost => webGlContextLostEvent.forElement(this);
@DomName('HTMLCanvasElement.onwebglcontextrestored')
@DocsEditable()
- Stream<gl.ContextEvent> get onWebGlContextRestored => webGlContextRestoredEvent.forTarget(this);
+ ElementStream<gl.ContextEvent> get onWebGlContextRestored => webGlContextRestoredEvent.forElement(this);
/** An API for drawing on this canvas. */
CanvasRenderingContext2D get context2D => getContext('2d');
@@ -1483,63 +1536,81 @@
@DocsEditable()
CanvasGradient createRadialGradient(num x0, num y0, num r0, num x1, num y1, num r1) native "CanvasRenderingContext2D_createRadialGradient_Callback";
- void _drawImage(canvas_OR_image_OR_video, num sx_OR_x, num sy_OR_y, [num sw_OR_width, num height_OR_sh, num dx, num dy, num dw, num dh]) {
- if ((sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is ImageElement || canvas_OR_image_OR_video == null) && sw_OR_width == null && height_OR_sh == null && dx == null && dy == null && dw == null && dh == null) {
- _drawImage_1(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y);
+ void _drawImage(canvas_OR_image_OR_imageBitmap_OR_video, num sx_OR_x, num sy_OR_y, [num sw_OR_width, num height_OR_sh, num dx, num dy, num dw, num dh]) {
+ if ((sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is ImageElement || canvas_OR_image_OR_imageBitmap_OR_video == null) && sw_OR_width == null && height_OR_sh == null && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_1(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y);
return;
}
- if ((height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is ImageElement || canvas_OR_image_OR_video == null) && dx == null && dy == null && dw == null && dh == null) {
- _drawImage_2(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh);
+ if ((height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is ImageElement || canvas_OR_image_OR_imageBitmap_OR_video == null) && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_2(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh);
return;
}
- if ((dh is num || dh == null) && (dw is num || dw == null) && (dy is num || dy == null) && (dx is num || dx == null) && (height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is ImageElement || canvas_OR_image_OR_video == null)) {
- _drawImage_3(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh);
+ if ((dh is num || dh == null) && (dw is num || dw == null) && (dy is num || dy == null) && (dx is num || dx == null) && (height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is ImageElement || canvas_OR_image_OR_imageBitmap_OR_video == null)) {
+ _drawImage_3(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh);
return;
}
- if ((sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is CanvasElement || canvas_OR_image_OR_video == null) && sw_OR_width == null && height_OR_sh == null && dx == null && dy == null && dw == null && dh == null) {
- _drawImage_4(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y);
+ if ((sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is CanvasElement || canvas_OR_image_OR_imageBitmap_OR_video == null) && sw_OR_width == null && height_OR_sh == null && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_4(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y);
return;
}
- if ((height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is CanvasElement || canvas_OR_image_OR_video == null) && dx == null && dy == null && dw == null && dh == null) {
- _drawImage_5(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh);
+ if ((height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is CanvasElement || canvas_OR_image_OR_imageBitmap_OR_video == null) && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_5(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh);
return;
}
- if ((dh is num || dh == null) && (dw is num || dw == null) && (dy is num || dy == null) && (dx is num || dx == null) && (height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is CanvasElement || canvas_OR_image_OR_video == null)) {
- _drawImage_6(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh);
+ if ((dh is num || dh == null) && (dw is num || dw == null) && (dy is num || dy == null) && (dx is num || dx == null) && (height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is CanvasElement || canvas_OR_image_OR_imageBitmap_OR_video == null)) {
+ _drawImage_6(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh);
return;
}
- if ((sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is VideoElement || canvas_OR_image_OR_video == null) && sw_OR_width == null && height_OR_sh == null && dx == null && dy == null && dw == null && dh == null) {
- _drawImage_7(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y);
+ if ((sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is VideoElement || canvas_OR_image_OR_imageBitmap_OR_video == null) && sw_OR_width == null && height_OR_sh == null && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_7(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y);
return;
}
- if ((height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is VideoElement || canvas_OR_image_OR_video == null) && dx == null && dy == null && dw == null && dh == null) {
- _drawImage_8(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh);
+ if ((height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is VideoElement || canvas_OR_image_OR_imageBitmap_OR_video == null) && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_8(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh);
return;
}
- if ((dh is num || dh == null) && (dw is num || dw == null) && (dy is num || dy == null) && (dx is num || dx == null) && (height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_video is VideoElement || canvas_OR_image_OR_video == null)) {
- _drawImage_9(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh);
+ if ((dh is num || dh == null) && (dw is num || dw == null) && (dy is num || dy == null) && (dx is num || dx == null) && (height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is VideoElement || canvas_OR_image_OR_imageBitmap_OR_video == null)) {
+ _drawImage_9(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh);
+ return;
+ }
+ if ((sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is ImageBitmap || canvas_OR_image_OR_imageBitmap_OR_video == null) && sw_OR_width == null && height_OR_sh == null && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_10(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y);
+ return;
+ }
+ if ((height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is ImageBitmap || canvas_OR_image_OR_imageBitmap_OR_video == null) && dx == null && dy == null && dw == null && dh == null) {
+ _drawImage_11(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh);
+ return;
+ }
+ if ((dh is num || dh == null) && (dw is num || dw == null) && (dy is num || dy == null) && (dx is num || dx == null) && (height_OR_sh is num || height_OR_sh == null) && (sw_OR_width is num || sw_OR_width == null) && (sy_OR_y is num || sy_OR_y == null) && (sx_OR_x is num || sx_OR_x == null) && (canvas_OR_image_OR_imageBitmap_OR_video is ImageBitmap || canvas_OR_image_OR_imageBitmap_OR_video == null)) {
+ _drawImage_12(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}
- void _drawImage_1(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y) native "CanvasRenderingContext2D__drawImage_1_Callback";
+ void _drawImage_1(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y) native "CanvasRenderingContext2D__drawImage_1_Callback";
- void _drawImage_2(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh) native "CanvasRenderingContext2D__drawImage_2_Callback";
+ void _drawImage_2(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh) native "CanvasRenderingContext2D__drawImage_2_Callback";
- void _drawImage_3(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh) native "CanvasRenderingContext2D__drawImage_3_Callback";
+ void _drawImage_3(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh) native "CanvasRenderingContext2D__drawImage_3_Callback";
- void _drawImage_4(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y) native "CanvasRenderingContext2D__drawImage_4_Callback";
+ void _drawImage_4(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y) native "CanvasRenderingContext2D__drawImage_4_Callback";
- void _drawImage_5(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh) native "CanvasRenderingContext2D__drawImage_5_Callback";
+ void _drawImage_5(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh) native "CanvasRenderingContext2D__drawImage_5_Callback";
- void _drawImage_6(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh) native "CanvasRenderingContext2D__drawImage_6_Callback";
+ void _drawImage_6(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh) native "CanvasRenderingContext2D__drawImage_6_Callback";
- void _drawImage_7(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y) native "CanvasRenderingContext2D__drawImage_7_Callback";
+ void _drawImage_7(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y) native "CanvasRenderingContext2D__drawImage_7_Callback";
- void _drawImage_8(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh) native "CanvasRenderingContext2D__drawImage_8_Callback";
+ void _drawImage_8(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh) native "CanvasRenderingContext2D__drawImage_8_Callback";
- void _drawImage_9(canvas_OR_image_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh) native "CanvasRenderingContext2D__drawImage_9_Callback";
+ void _drawImage_9(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh) native "CanvasRenderingContext2D__drawImage_9_Callback";
+
+ void _drawImage_10(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y) native "CanvasRenderingContext2D__drawImage_10_Callback";
+
+ void _drawImage_11(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh) native "CanvasRenderingContext2D__drawImage_11_Callback";
+
+ void _drawImage_12(canvas_OR_image_OR_imageBitmap_OR_video, sx_OR_x, sy_OR_y, sw_OR_width, height_OR_sh, dx, dy, dw, dh) native "CanvasRenderingContext2D__drawImage_12_Callback";
void fill([String winding]) {
if (winding != null) {
@@ -2068,13 +2139,19 @@
@Experimental()
class Composition extends NativeFieldWrapperClass1 {
- @DomName('Composition.caret')
+ @DomName('Composition.selectionEnd')
@DocsEditable()
- Range get caret native "Composition_caret_Getter";
+ @Experimental() // untriaged
+ int get selectionEnd native "Composition_selectionEnd_Getter";
+
+ @DomName('Composition.selectionStart')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int get selectionStart native "Composition_selectionStart_Getter";
@DomName('Composition.text')
@DocsEditable()
- Node get text native "Composition_text_Getter";
+ String get text native "Composition_text_Getter";
}
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
@@ -2339,6 +2416,44 @@
@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
@@ -3139,6 +3254,11 @@
@DocsEditable()
CssRule get parentRule native "CSSStyleDeclaration_parentRule_Getter";
+ @DomName('CSSStyleDeclaration.var')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CssVariablesMap get _var native "CSSStyleDeclaration_var_Getter";
+
@DomName('CSSStyleDeclaration.__setter__')
@DocsEditable()
void __setter__(String propertyName, String propertyValue) native "CSSStyleDeclaration___setter___Callback";
@@ -6599,6 +6719,49 @@
@DocsEditable()
+@DomName('CSSVariablesMap')
+@Experimental() // untriaged
+class CssVariablesMap extends NativeFieldWrapperClass1 {
+
+ @DomName('CSSVariablesMap.size')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int get size native "CSSVariablesMap_size_Getter";
+
+ @DomName('CSSVariablesMap.clear')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void clear() native "CSSVariablesMap_clear_Callback";
+
+ @DomName('CSSVariablesMap.delete')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool delete(String name) native "CSSVariablesMap_delete_Callback";
+
+ @DomName('CSSVariablesMap.get')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get(String name) native "CSSVariablesMap_get_Callback";
+
+ @DomName('CSSVariablesMap.has')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool has(String name) native "CSSVariablesMap_has_Callback";
+
+ @DomName('CSSVariablesMap.set')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set(String name, String value) native "CSSVariablesMap_set_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('CSSViewportRule')
@Experimental() // untriaged
class CssViewportRule extends CssRule {
@@ -6873,6 +7036,36 @@
@DocsEditable()
+@DomName('DedicatedWorkerGlobalScope')
+@Experimental() // untriaged
+class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
+ // To suppress missing implicit constructor warnings.
+ factory DedicatedWorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('DedicatedWorkerGlobalScope.messageEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MessageEvent> messageEvent = const EventStreamProvider<MessageEvent>('message');
+
+ @DomName('DedicatedWorkerGlobalScope.postMessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void postMessage(Object message, [List messagePorts]) native "DedicatedWorkerGlobalScope_postMessage_Callback";
+
+ @DomName('DedicatedWorkerGlobalScope.onmessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MessageEvent> get onMessage => messageEvent.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('HTMLDetailsElement')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@@ -7045,9 +7238,19 @@
@DocsEditable()
void set open(bool value) native "HTMLDialogElement_open_Setter";
+ @DomName('HTMLDialogElement.returnValue')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get returnValue native "HTMLDialogElement_returnValue_Getter";
+
+ @DomName('HTMLDialogElement.returnValue')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set returnValue(String value) native "HTMLDialogElement_returnValue_Setter";
+
@DomName('HTMLDialogElement.close')
@DocsEditable()
- void close() native "HTMLDialogElement_close_Callback";
+ void close(String returnValue) native "HTMLDialogElement_close_Callback";
@DomName('HTMLDialogElement.show')
@DocsEditable()
@@ -7788,6 +7991,16 @@
@DocsEditable()
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);
+ @DomName('Document.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseEnter => Element.mouseEnterEvent.forTarget(this);
+
+ @DomName('Document.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseLeave => Element.mouseLeaveEvent.forTarget(this);
+
@DomName('Document.onmousemove')
@DocsEditable()
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);
@@ -8570,6 +8783,234 @@
*/
@Experimental()
CssRect get marginEdge;
+
+ @DomName('Element.onabort')
+ @DocsEditable()
+ ElementStream<Event> get onAbort;
+
+ @DomName('Element.onbeforecopy')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCopy;
+
+ @DomName('Element.onbeforecut')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCut;
+
+ @DomName('Element.onbeforepaste')
+ @DocsEditable()
+ ElementStream<Event> get onBeforePaste;
+
+ @DomName('Element.onblur')
+ @DocsEditable()
+ ElementStream<Event> get onBlur;
+
+ @DomName('Element.onchange')
+ @DocsEditable()
+ ElementStream<Event> get onChange;
+
+ @DomName('Element.onclick')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onClick;
+
+ @DomName('Element.oncontextmenu')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onContextMenu;
+
+ @DomName('Element.oncopy')
+ @DocsEditable()
+ ElementStream<Event> get onCopy;
+
+ @DomName('Element.oncut')
+ @DocsEditable()
+ ElementStream<Event> get onCut;
+
+ @DomName('Element.ondblclick')
+ @DocsEditable()
+ ElementStream<Event> get onDoubleClick;
+
+ @DomName('Element.ondrag')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrag;
+
+ @DomName('Element.ondragend')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnd;
+
+ @DomName('Element.ondragenter')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnter;
+
+ @DomName('Element.ondragleave')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragLeave;
+
+ @DomName('Element.ondragover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragOver;
+
+ @DomName('Element.ondragstart')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragStart;
+
+ @DomName('Element.ondrop')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrop;
+
+ @DomName('Element.onerror')
+ @DocsEditable()
+ ElementStream<Event> get onError;
+
+ @DomName('Element.onfocus')
+ @DocsEditable()
+ ElementStream<Event> get onFocus;
+
+ @DomName('Element.oninput')
+ @DocsEditable()
+ ElementStream<Event> get onInput;
+
+ @DomName('Element.oninvalid')
+ @DocsEditable()
+ ElementStream<Event> get onInvalid;
+
+ @DomName('Element.onkeydown')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyDown;
+
+ @DomName('Element.onkeypress')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyPress;
+
+ @DomName('Element.onkeyup')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyUp;
+
+ @DomName('Element.onload')
+ @DocsEditable()
+ ElementStream<Event> get onLoad;
+
+ @DomName('Element.onmousedown')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseDown;
+
+ @DomName('Element.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseEnter;
+
+ @DomName('Element.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseLeave;
+
+ @DomName('Element.onmousemove')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseMove;
+
+ @DomName('Element.onmouseout')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOut;
+
+ @DomName('Element.onmouseover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOver;
+
+ @DomName('Element.onmouseup')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseUp;
+
+ @DomName('Element.onmousewheel')
+ @DocsEditable()
+ // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
+ @Experimental() // non-standard
+ ElementStream<WheelEvent> get onMouseWheel;
+
+ @DomName('Element.onpaste')
+ @DocsEditable()
+ ElementStream<Event> get onPaste;
+
+ @DomName('Element.onreset')
+ @DocsEditable()
+ ElementStream<Event> get onReset;
+
+ @DomName('Element.onscroll')
+ @DocsEditable()
+ ElementStream<Event> get onScroll;
+
+ @DomName('Element.onsearch')
+ @DocsEditable()
+ // http://www.w3.org/TR/html-markup/input.search.html
+ @Experimental()
+ ElementStream<Event> get onSearch;
+
+ @DomName('Element.onselect')
+ @DocsEditable()
+ ElementStream<Event> get onSelect;
+
+ @DomName('Element.onselectstart')
+ @DocsEditable()
+ @Experimental() // nonstandard
+ ElementStream<Event> get onSelectStart;
+
+ @DomName('Element.onsubmit')
+ @DocsEditable()
+ ElementStream<Event> get onSubmit;
+
+ @DomName('Element.ontouchcancel')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchCancel;
+
+ @DomName('Element.ontouchend')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnd;
+
+ @DomName('Element.ontouchenter')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnter;
+
+ @DomName('Element.ontouchleave')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchLeave;
+
+ @DomName('Element.ontouchmove')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchMove;
+
+ @DomName('Element.ontouchstart')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchStart;
+
+ @DomName('Element.ontransitionend')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
+ @SupportedBrowser(SupportedBrowser.IE, '10')
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ ElementStream<TransitionEvent> get onTransitionEnd;
+
+ @DomName('Element.onwebkitfullscreenchange')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenChange;
+
+ @DomName('Element.onwebkitfullscreenerror')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenError;
+
}
// TODO(jacobr): this is an inefficient implementation but it is hard to see
@@ -8623,6 +9064,234 @@
CssRect get borderEdge => _elementList.first.borderEdge;
CssRect get marginEdge => _elementList.first.marginEdge;
+
+ @DomName('Element.onabort')
+ @DocsEditable()
+ ElementStream<Event> get onAbort => Element.abortEvent._forElementList(this);
+
+ @DomName('Element.onbeforecopy')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCopy => Element.beforeCopyEvent._forElementList(this);
+
+ @DomName('Element.onbeforecut')
+ @DocsEditable()
+ ElementStream<Event> get onBeforeCut => Element.beforeCutEvent._forElementList(this);
+
+ @DomName('Element.onbeforepaste')
+ @DocsEditable()
+ ElementStream<Event> get onBeforePaste => Element.beforePasteEvent._forElementList(this);
+
+ @DomName('Element.onblur')
+ @DocsEditable()
+ ElementStream<Event> get onBlur => Element.blurEvent._forElementList(this);
+
+ @DomName('Element.onchange')
+ @DocsEditable()
+ ElementStream<Event> get onChange => Element.changeEvent._forElementList(this);
+
+ @DomName('Element.onclick')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onClick => Element.clickEvent._forElementList(this);
+
+ @DomName('Element.oncontextmenu')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onContextMenu => Element.contextMenuEvent._forElementList(this);
+
+ @DomName('Element.oncopy')
+ @DocsEditable()
+ ElementStream<Event> get onCopy => Element.copyEvent._forElementList(this);
+
+ @DomName('Element.oncut')
+ @DocsEditable()
+ ElementStream<Event> get onCut => Element.cutEvent._forElementList(this);
+
+ @DomName('Element.ondblclick')
+ @DocsEditable()
+ ElementStream<Event> get onDoubleClick => Element.doubleClickEvent._forElementList(this);
+
+ @DomName('Element.ondrag')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrag => Element.dragEvent._forElementList(this);
+
+ @DomName('Element.ondragend')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnd => Element.dragEndEvent._forElementList(this);
+
+ @DomName('Element.ondragenter')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragEnter => Element.dragEnterEvent._forElementList(this);
+
+ @DomName('Element.ondragleave')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragLeave => Element.dragLeaveEvent._forElementList(this);
+
+ @DomName('Element.ondragover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragOver => Element.dragOverEvent._forElementList(this);
+
+ @DomName('Element.ondragstart')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDragStart => Element.dragStartEvent._forElementList(this);
+
+ @DomName('Element.ondrop')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onDrop => Element.dropEvent._forElementList(this);
+
+ @DomName('Element.onerror')
+ @DocsEditable()
+ ElementStream<Event> get onError => Element.errorEvent._forElementList(this);
+
+ @DomName('Element.onfocus')
+ @DocsEditable()
+ ElementStream<Event> get onFocus => Element.focusEvent._forElementList(this);
+
+ @DomName('Element.oninput')
+ @DocsEditable()
+ ElementStream<Event> get onInput => Element.inputEvent._forElementList(this);
+
+ @DomName('Element.oninvalid')
+ @DocsEditable()
+ ElementStream<Event> get onInvalid => Element.invalidEvent._forElementList(this);
+
+ @DomName('Element.onkeydown')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyDown => Element.keyDownEvent._forElementList(this);
+
+ @DomName('Element.onkeypress')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyPress => Element.keyPressEvent._forElementList(this);
+
+ @DomName('Element.onkeyup')
+ @DocsEditable()
+ ElementStream<KeyboardEvent> get onKeyUp => Element.keyUpEvent._forElementList(this);
+
+ @DomName('Element.onload')
+ @DocsEditable()
+ ElementStream<Event> get onLoad => Element.loadEvent._forElementList(this);
+
+ @DomName('Element.onmousedown')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseDown => Element.mouseDownEvent._forElementList(this);
+
+ @DomName('Element.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseEnter => Element.mouseEnterEvent._forElementList(this);
+
+ @DomName('Element.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseLeave => Element.mouseLeaveEvent._forElementList(this);
+
+ @DomName('Element.onmousemove')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseMove => Element.mouseMoveEvent._forElementList(this);
+
+ @DomName('Element.onmouseout')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOut => Element.mouseOutEvent._forElementList(this);
+
+ @DomName('Element.onmouseover')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseOver => Element.mouseOverEvent._forElementList(this);
+
+ @DomName('Element.onmouseup')
+ @DocsEditable()
+ ElementStream<MouseEvent> get onMouseUp => Element.mouseUpEvent._forElementList(this);
+
+ @DomName('Element.onmousewheel')
+ @DocsEditable()
+ // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
+ @Experimental() // non-standard
+ ElementStream<WheelEvent> get onMouseWheel => Element.mouseWheelEvent._forElementList(this);
+
+ @DomName('Element.onpaste')
+ @DocsEditable()
+ ElementStream<Event> get onPaste => Element.pasteEvent._forElementList(this);
+
+ @DomName('Element.onreset')
+ @DocsEditable()
+ ElementStream<Event> get onReset => Element.resetEvent._forElementList(this);
+
+ @DomName('Element.onscroll')
+ @DocsEditable()
+ ElementStream<Event> get onScroll => Element.scrollEvent._forElementList(this);
+
+ @DomName('Element.onsearch')
+ @DocsEditable()
+ // http://www.w3.org/TR/html-markup/input.search.html
+ @Experimental()
+ ElementStream<Event> get onSearch => Element.searchEvent._forElementList(this);
+
+ @DomName('Element.onselect')
+ @DocsEditable()
+ ElementStream<Event> get onSelect => Element.selectEvent._forElementList(this);
+
+ @DomName('Element.onselectstart')
+ @DocsEditable()
+ @Experimental() // nonstandard
+ ElementStream<Event> get onSelectStart => Element.selectStartEvent._forElementList(this);
+
+ @DomName('Element.onsubmit')
+ @DocsEditable()
+ ElementStream<Event> get onSubmit => Element.submitEvent._forElementList(this);
+
+ @DomName('Element.ontouchcancel')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchCancel => Element.touchCancelEvent._forElementList(this);
+
+ @DomName('Element.ontouchend')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnd => Element.touchEndEvent._forElementList(this);
+
+ @DomName('Element.ontouchenter')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchEnter => Element.touchEnterEvent._forElementList(this);
+
+ @DomName('Element.ontouchleave')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchLeave => Element.touchLeaveEvent._forElementList(this);
+
+ @DomName('Element.ontouchmove')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchMove => Element.touchMoveEvent._forElementList(this);
+
+ @DomName('Element.ontouchstart')
+ @DocsEditable()
+ // http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
+ @Experimental()
+ ElementStream<TouchEvent> get onTouchStart => Element.touchStartEvent._forElementList(this);
+
+ @DomName('Element.ontransitionend')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
+ @SupportedBrowser(SupportedBrowser.IE, '10')
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ ElementStream<TransitionEvent> get onTransitionEnd => Element.transitionEndEvent._forElementList(this);
+
+ @DomName('Element.onwebkitfullscreenchange')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenChange => Element.fullscreenChangeEvent._forElementList(this);
+
+ @DomName('Element.onwebkitfullscreenerror')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
+ @Experimental()
+ ElementStream<Event> get onFullscreenError => Element.fullscreenErrorEvent._forElementList(this);
+
}
/**
@@ -9073,6 +9742,7 @@
bool _templateIsDecorated;
+
/**
* Gets the template this node refers to.
* This is only supported if [isTemplate] is true.
@@ -9423,6 +10093,16 @@
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseDownEvent = const EventStreamProvider<MouseEvent>('mousedown');
+ @DomName('Element.mouseenterEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseEnterEvent = const EventStreamProvider<MouseEvent>('mouseenter');
+
+ @DomName('Element.mouseleaveEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseLeaveEvent = const EventStreamProvider<MouseEvent>('mouseleave');
+
@DomName('Element.mousemoveEvent')
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseMoveEvent = const EventStreamProvider<MouseEvent>('mousemove');
@@ -9624,6 +10304,16 @@
@DocsEditable()
int get offsetWidth native "Element_offsetWidth_Getter";
+ @DomName('Element.pseudo')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get pseudo native "Element_pseudo_Getter";
+
+ @DomName('Element.pseudo')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set pseudo(String value) native "Element_pseudo_Setter";
+
@DomName('Element.scrollHeight')
@DocsEditable()
int get scrollHeight native "Element_scrollHeight_Getter";
@@ -9648,6 +10338,12 @@
@DocsEditable()
int get scrollWidth native "Element_scrollWidth_Getter";
+ @DomName('Element.shadowRoot')
+ @DocsEditable()
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
+ @Experimental()
+ ShadowRoot get shadowRoot native "Element_shadowRoot_Getter";
+
@DomName('Element.style')
@DocsEditable()
CssStyleDeclaration get style native "Element_style_Getter";
@@ -9656,22 +10352,6 @@
@DocsEditable()
String get tagName native "Element_tagName_Getter";
- @DomName('Element.webkitPseudo')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental()
- @Experimental() // nonstandard
- String get pseudo native "Element_webkitPseudo_Getter";
-
- @DomName('Element.webkitPseudo')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental()
- @Experimental() // nonstandard
- void set pseudo(String value) native "Element_webkitPseudo_Setter";
-
@DomName('Element.webkitRegionOverset')
@DocsEditable()
@SupportedBrowser(SupportedBrowser.CHROME)
@@ -9680,18 +10360,17 @@
// http://dev.w3.org/csswg/css-regions/#dom-region-regionoverset
String get regionOverset native "Element_webkitRegionOverset_Getter";
- @DomName('Element.webkitShadowRoot')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental()
- // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
- ShadowRoot get shadowRoot native "Element_webkitShadowRoot_Getter";
-
@DomName('Element.blur')
@DocsEditable()
void blur() native "Element_blur_Callback";
+ @DomName('Element.createShadowRoot')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME, '25')
+ @Experimental()
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
+ ShadowRoot createShadowRoot() native "Element_createShadowRoot_Callback";
+
@DomName('Element.focus')
@DocsEditable()
void focus() native "Element_focus_Callback";
@@ -9803,13 +10482,6 @@
@DocsEditable()
void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String value) native "Element_setAttributeNS_Callback";
- @DomName('Element.webkitCreateShadowRoot')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME, '25')
- @Experimental()
- // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root
- ShadowRoot createShadowRoot() native "Element_webkitCreateShadowRoot_Callback";
-
@DomName('Element.webkitGetRegionFlowRanges')
@DocsEditable()
@SupportedBrowser(SupportedBrowser.CHROME)
@@ -9879,200 +10551,210 @@
@DomName('Element.onabort')
@DocsEditable()
- Stream<Event> get onAbort => abortEvent.forTarget(this);
+ ElementStream<Event> get onAbort => abortEvent.forElement(this);
@DomName('Element.onbeforecopy')
@DocsEditable()
- Stream<Event> get onBeforeCopy => beforeCopyEvent.forTarget(this);
+ ElementStream<Event> get onBeforeCopy => beforeCopyEvent.forElement(this);
@DomName('Element.onbeforecut')
@DocsEditable()
- Stream<Event> get onBeforeCut => beforeCutEvent.forTarget(this);
+ ElementStream<Event> get onBeforeCut => beforeCutEvent.forElement(this);
@DomName('Element.onbeforepaste')
@DocsEditable()
- Stream<Event> get onBeforePaste => beforePasteEvent.forTarget(this);
+ ElementStream<Event> get onBeforePaste => beforePasteEvent.forElement(this);
@DomName('Element.onblur')
@DocsEditable()
- Stream<Event> get onBlur => blurEvent.forTarget(this);
+ ElementStream<Event> get onBlur => blurEvent.forElement(this);
@DomName('Element.onchange')
@DocsEditable()
- Stream<Event> get onChange => changeEvent.forTarget(this);
+ ElementStream<Event> get onChange => changeEvent.forElement(this);
@DomName('Element.onclick')
@DocsEditable()
- Stream<MouseEvent> get onClick => clickEvent.forTarget(this);
+ ElementStream<MouseEvent> get onClick => clickEvent.forElement(this);
@DomName('Element.oncontextmenu')
@DocsEditable()
- Stream<MouseEvent> get onContextMenu => contextMenuEvent.forTarget(this);
+ ElementStream<MouseEvent> get onContextMenu => contextMenuEvent.forElement(this);
@DomName('Element.oncopy')
@DocsEditable()
- Stream<Event> get onCopy => copyEvent.forTarget(this);
+ ElementStream<Event> get onCopy => copyEvent.forElement(this);
@DomName('Element.oncut')
@DocsEditable()
- Stream<Event> get onCut => cutEvent.forTarget(this);
+ ElementStream<Event> get onCut => cutEvent.forElement(this);
@DomName('Element.ondblclick')
@DocsEditable()
- Stream<Event> get onDoubleClick => doubleClickEvent.forTarget(this);
+ ElementStream<Event> get onDoubleClick => doubleClickEvent.forElement(this);
@DomName('Element.ondrag')
@DocsEditable()
- Stream<MouseEvent> get onDrag => dragEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDrag => dragEvent.forElement(this);
@DomName('Element.ondragend')
@DocsEditable()
- Stream<MouseEvent> get onDragEnd => dragEndEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragEnd => dragEndEvent.forElement(this);
@DomName('Element.ondragenter')
@DocsEditable()
- Stream<MouseEvent> get onDragEnter => dragEnterEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragEnter => dragEnterEvent.forElement(this);
@DomName('Element.ondragleave')
@DocsEditable()
- Stream<MouseEvent> get onDragLeave => dragLeaveEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragLeave => dragLeaveEvent.forElement(this);
@DomName('Element.ondragover')
@DocsEditable()
- Stream<MouseEvent> get onDragOver => dragOverEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragOver => dragOverEvent.forElement(this);
@DomName('Element.ondragstart')
@DocsEditable()
- Stream<MouseEvent> get onDragStart => dragStartEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDragStart => dragStartEvent.forElement(this);
@DomName('Element.ondrop')
@DocsEditable()
- Stream<MouseEvent> get onDrop => dropEvent.forTarget(this);
+ ElementStream<MouseEvent> get onDrop => dropEvent.forElement(this);
@DomName('Element.onerror')
@DocsEditable()
- Stream<Event> get onError => errorEvent.forTarget(this);
+ ElementStream<Event> get onError => errorEvent.forElement(this);
@DomName('Element.onfocus')
@DocsEditable()
- Stream<Event> get onFocus => focusEvent.forTarget(this);
+ ElementStream<Event> get onFocus => focusEvent.forElement(this);
@DomName('Element.oninput')
@DocsEditable()
- Stream<Event> get onInput => inputEvent.forTarget(this);
+ ElementStream<Event> get onInput => inputEvent.forElement(this);
@DomName('Element.oninvalid')
@DocsEditable()
- Stream<Event> get onInvalid => invalidEvent.forTarget(this);
+ ElementStream<Event> get onInvalid => invalidEvent.forElement(this);
@DomName('Element.onkeydown')
@DocsEditable()
- Stream<KeyboardEvent> get onKeyDown => keyDownEvent.forTarget(this);
+ ElementStream<KeyboardEvent> get onKeyDown => keyDownEvent.forElement(this);
@DomName('Element.onkeypress')
@DocsEditable()
- Stream<KeyboardEvent> get onKeyPress => keyPressEvent.forTarget(this);
+ ElementStream<KeyboardEvent> get onKeyPress => keyPressEvent.forElement(this);
@DomName('Element.onkeyup')
@DocsEditable()
- Stream<KeyboardEvent> get onKeyUp => keyUpEvent.forTarget(this);
+ ElementStream<KeyboardEvent> get onKeyUp => keyUpEvent.forElement(this);
@DomName('Element.onload')
@DocsEditable()
- Stream<Event> get onLoad => loadEvent.forTarget(this);
+ ElementStream<Event> get onLoad => loadEvent.forElement(this);
@DomName('Element.onmousedown')
@DocsEditable()
- Stream<MouseEvent> get onMouseDown => mouseDownEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseDown => mouseDownEvent.forElement(this);
+
+ @DomName('Element.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseEnter => mouseEnterEvent.forElement(this);
+
+ @DomName('Element.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ ElementStream<MouseEvent> get onMouseLeave => mouseLeaveEvent.forElement(this);
@DomName('Element.onmousemove')
@DocsEditable()
- Stream<MouseEvent> get onMouseMove => mouseMoveEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseMove => mouseMoveEvent.forElement(this);
@DomName('Element.onmouseout')
@DocsEditable()
- Stream<MouseEvent> get onMouseOut => mouseOutEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseOut => mouseOutEvent.forElement(this);
@DomName('Element.onmouseover')
@DocsEditable()
- Stream<MouseEvent> get onMouseOver => mouseOverEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseOver => mouseOverEvent.forElement(this);
@DomName('Element.onmouseup')
@DocsEditable()
- Stream<MouseEvent> get onMouseUp => mouseUpEvent.forTarget(this);
+ ElementStream<MouseEvent> get onMouseUp => mouseUpEvent.forElement(this);
@DomName('Element.onmousewheel')
@DocsEditable()
// http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
@Experimental() // non-standard
- Stream<WheelEvent> get onMouseWheel => mouseWheelEvent.forTarget(this);
+ ElementStream<WheelEvent> get onMouseWheel => mouseWheelEvent.forElement(this);
@DomName('Element.onpaste')
@DocsEditable()
- Stream<Event> get onPaste => pasteEvent.forTarget(this);
+ ElementStream<Event> get onPaste => pasteEvent.forElement(this);
@DomName('Element.onreset')
@DocsEditable()
- Stream<Event> get onReset => resetEvent.forTarget(this);
+ ElementStream<Event> get onReset => resetEvent.forElement(this);
@DomName('Element.onscroll')
@DocsEditable()
- Stream<Event> get onScroll => scrollEvent.forTarget(this);
+ ElementStream<Event> get onScroll => scrollEvent.forElement(this);
@DomName('Element.onsearch')
@DocsEditable()
// http://www.w3.org/TR/html-markup/input.search.html
@Experimental()
- Stream<Event> get onSearch => searchEvent.forTarget(this);
+ ElementStream<Event> get onSearch => searchEvent.forElement(this);
@DomName('Element.onselect')
@DocsEditable()
- Stream<Event> get onSelect => selectEvent.forTarget(this);
+ ElementStream<Event> get onSelect => selectEvent.forElement(this);
@DomName('Element.onselectstart')
@DocsEditable()
@Experimental() // nonstandard
- Stream<Event> get onSelectStart => selectStartEvent.forTarget(this);
+ ElementStream<Event> get onSelectStart => selectStartEvent.forElement(this);
@DomName('Element.onsubmit')
@DocsEditable()
- Stream<Event> get onSubmit => submitEvent.forTarget(this);
+ ElementStream<Event> get onSubmit => submitEvent.forElement(this);
@DomName('Element.ontouchcancel')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchCancel => touchCancelEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchCancel => touchCancelEvent.forElement(this);
@DomName('Element.ontouchend')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchEnd => touchEndEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchEnd => touchEndEvent.forElement(this);
@DomName('Element.ontouchenter')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchEnter => touchEnterEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchEnter => touchEnterEvent.forElement(this);
@DomName('Element.ontouchleave')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchLeave => touchLeaveEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchLeave => touchLeaveEvent.forElement(this);
@DomName('Element.ontouchmove')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchMove => touchMoveEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchMove => touchMoveEvent.forElement(this);
@DomName('Element.ontouchstart')
@DocsEditable()
// http://www.w3.org/TR/touch-events/, http://www.chromestatus.com/features
@Experimental()
- Stream<TouchEvent> get onTouchStart => touchStartEvent.forTarget(this);
+ ElementStream<TouchEvent> get onTouchStart => touchStartEvent.forElement(this);
@DomName('Element.ontransitionend')
@DocsEditable()
@@ -10080,23 +10762,22 @@
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
- Stream<TransitionEvent> get onTransitionEnd => transitionEndEvent.forTarget(this);
+ ElementStream<TransitionEvent> get onTransitionEnd => transitionEndEvent.forElement(this);
@DomName('Element.onwebkitfullscreenchange')
@DocsEditable()
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
@Experimental()
- Stream<Event> get onFullscreenChange => fullscreenChangeEvent.forTarget(this);
+ ElementStream<Event> get onFullscreenChange => fullscreenChangeEvent.forElement(this);
@DomName('Element.onwebkitfullscreenerror')
@DocsEditable()
// https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html
@Experimental()
- Stream<Event> get onFullscreenError => fullscreenErrorEvent.forTarget(this);
+ ElementStream<Event> get onFullscreenError => fullscreenErrorEvent.forElement(this);
}
-
final _START_TAG_REGEXP = new RegExp('<(\\w+)');
class _ElementFactoryProvider {
static const _CUSTOM_PARENT_TAG_MAP = const {
@@ -10240,35 +10921,6 @@
@DocsEditable()
-@DomName('ElementTimeControl')
-@Unstable()
-abstract class ElementTimeControl extends NativeFieldWrapperClass1 {
-
- @DomName('ElementTimeControl.beginElement')
- @DocsEditable()
- void beginElement() native "ElementTimeControl_beginElement_Callback";
-
- @DomName('ElementTimeControl.beginElementAt')
- @DocsEditable()
- void beginElementAt(num offset) native "ElementTimeControl_beginElementAt_Callback";
-
- @DomName('ElementTimeControl.endElement')
- @DocsEditable()
- void endElement() native "ElementTimeControl_endElement_Callback";
-
- @DomName('ElementTimeControl.endElementAt')
- @DocsEditable()
- void endElementAt(num offset) native "ElementTimeControl_endElementAt_Callback";
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
-
-@DocsEditable()
@DomName('HTMLEmbedElement')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.IE)
@@ -10811,17 +11463,17 @@
@DocsEditable()
bool get withCredentials native "EventSource_withCredentials_Getter";
- @DomName('EventSource.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "EventSource_addEventListener_Callback";
-
@DomName('EventSource.close')
@DocsEditable()
void close() native "EventSource_close_Callback";
+ @DomName('EventSource.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "EventSource_addEventListener_Callback";
+
@DomName('EventSource.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "EventSource_dispatchEvent_Callback";
+ bool dispatchEvent(Event event) native "EventSource_dispatchEvent_Callback";
@DomName('EventSource.removeEventListener')
@DocsEditable()
@@ -11143,84 +11795,6 @@
@DocsEditable()
-@DomName('FileException')
-// http://dev.w3.org/2009/dap/file-system/pub/FileSystem/
-@Experimental()
-class FileException extends NativeFieldWrapperClass1 {
-
- @DomName('FileException.ABORT_ERR')
- @DocsEditable()
- static const int ABORT_ERR = 3;
-
- @DomName('FileException.ENCODING_ERR')
- @DocsEditable()
- static const int ENCODING_ERR = 5;
-
- @DomName('FileException.INVALID_MODIFICATION_ERR')
- @DocsEditable()
- static const int INVALID_MODIFICATION_ERR = 9;
-
- @DomName('FileException.INVALID_STATE_ERR')
- @DocsEditable()
- static const int INVALID_STATE_ERR = 7;
-
- @DomName('FileException.NOT_FOUND_ERR')
- @DocsEditable()
- static const int NOT_FOUND_ERR = 1;
-
- @DomName('FileException.NOT_READABLE_ERR')
- @DocsEditable()
- static const int NOT_READABLE_ERR = 4;
-
- @DomName('FileException.NO_MODIFICATION_ALLOWED_ERR')
- @DocsEditable()
- static const int NO_MODIFICATION_ALLOWED_ERR = 6;
-
- @DomName('FileException.PATH_EXISTS_ERR')
- @DocsEditable()
- static const int PATH_EXISTS_ERR = 12;
-
- @DomName('FileException.QUOTA_EXCEEDED_ERR')
- @DocsEditable()
- static const int QUOTA_EXCEEDED_ERR = 10;
-
- @DomName('FileException.SECURITY_ERR')
- @DocsEditable()
- static const int SECURITY_ERR = 2;
-
- @DomName('FileException.SYNTAX_ERR')
- @DocsEditable()
- static const int SYNTAX_ERR = 8;
-
- @DomName('FileException.TYPE_MISMATCH_ERR')
- @DocsEditable()
- static const int TYPE_MISMATCH_ERR = 11;
-
- @DomName('FileException.code')
- @DocsEditable()
- int get code native "FileException_code_Getter";
-
- @DomName('FileException.message')
- @DocsEditable()
- String get message native "FileException_message_Getter";
-
- @DomName('FileException.name')
- @DocsEditable()
- String get name native "FileException_name_Getter";
-
- @DomName('FileException.toString')
- @DocsEditable()
- String toString() native "FileException_toString_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('FileList')
class FileList extends NativeFieldWrapperClass1 with ListMixin<File>, ImmutableListMixin<File> implements List<File> {
@@ -11352,14 +11926,6 @@
@DocsEditable()
void abort() native "FileReader_abort_Callback";
- @DomName('FileReader.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "FileReader_addEventListener_Callback";
-
- @DomName('FileReader.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "FileReader_dispatchEvent_Callback";
-
@DomName('FileReader.readAsArrayBuffer')
@DocsEditable()
void readAsArrayBuffer(Blob blob) native "FileReader_readAsArrayBuffer_Callback";
@@ -11387,6 +11953,14 @@
void _readAsText_2(blob) native "FileReader__readAsText_2_Callback";
+ @DomName('FileReader.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "FileReader_addEventListener_Callback";
+
+ @DomName('FileReader.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "FileReader_dispatchEvent_Callback";
+
@DomName('FileReader.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "FileReader_removeEventListener_Callback";
@@ -11542,18 +12116,6 @@
@DocsEditable()
void abort() native "FileWriter_abort_Callback";
- @DomName('FileWriter.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "FileWriter_addEventListener_Callback";
-
- @DomName('FileWriter.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "FileWriter_dispatchEvent_Callback";
-
- @DomName('FileWriter.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "FileWriter_removeEventListener_Callback";
-
@DomName('FileWriter.seek')
@DocsEditable()
void seek(int position) native "FileWriter_seek_Callback";
@@ -11566,6 +12128,18 @@
@DocsEditable()
void write(Blob data) native "FileWriter_write_Callback";
+ @DomName('FileWriter.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "FileWriter_addEventListener_Callback";
+
+ @DomName('FileWriter.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "FileWriter_dispatchEvent_Callback";
+
+ @DomName('FileWriter.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "FileWriter_removeEventListener_Callback";
+
@DomName('FileWriter.onabort')
@DocsEditable()
Stream<ProgressEvent> get onAbort => abortEvent.forTarget(this);
@@ -11659,18 +12233,10 @@
@DocsEditable()
bool get loading native "FontLoader_loading_Getter";
- @DomName('FontLoader.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "FontLoader_addEventListener_Callback";
-
@DomName('FontLoader.checkFont')
@DocsEditable()
bool checkFont(String font, String text) native "FontLoader_checkFont_Callback";
- @DomName('FontLoader.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "FontLoader_dispatchEvent_Callback";
-
@DomName('FontLoader.loadFont')
@DocsEditable()
void loadFont(Map params) native "FontLoader_loadFont_Callback";
@@ -11679,6 +12245,14 @@
@DocsEditable()
void notifyWhenFontsReady(VoidCallback callback) native "FontLoader_notifyWhenFontsReady_Callback";
+ @DomName('FontLoader.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "FontLoader_addEventListener_Callback";
+
+ @DomName('FontLoader.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "FontLoader_dispatchEvent_Callback";
+
@DomName('FontLoader.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "FontLoader_removeEventListener_Callback";
@@ -11873,13 +12447,13 @@
@DocsEditable()
// http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#autofilling-form-controls:-the-autocomplete-attribute
@Experimental()
- Stream<Event> get onAutocomplete => autocompleteEvent.forTarget(this);
+ ElementStream<Event> get onAutocomplete => autocompleteEvent.forElement(this);
@DomName('HTMLFormElement.onautocompleteerror')
@DocsEditable()
// http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#autofilling-form-controls:-the-autocomplete-attribute
@Experimental()
- Stream<AutocompleteErrorEvent> get onAutocompleteError => autocompleteErrorEvent.forTarget(this);
+ ElementStream<AutocompleteErrorEvent> get onAutocompleteError => autocompleteErrorEvent.forElement(this);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -12211,6 +12785,26 @@
@DocsEditable()
+@DomName('HmacParams')
+@Experimental() // untriaged
+class HmacParams extends Algorithm {
+ // To suppress missing implicit constructor warnings.
+ factory HmacParams._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('HmacParams.hash')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Algorithm get hash native "HmacParams_hash_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('HTMLAllCollection')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#dom-document-all
@deprecated // deprecated
@@ -12631,6 +13225,40 @@
}
/**
+ * Makes a server POST request with the specified data encoded as form data.
+ *
+ * This is similar to sending a FormData object with broader browser
+ * support but limited to string values.
+ *
+ * See also:
+ *
+ * * [request]
+ */
+ static Future<HttpRequest> postFormData(String url, Map<String, String> data,
+ {bool withCredentials, String responseType,
+ Map<String, String> requestHeaders,
+ void onProgress(ProgressEvent e)}) {
+
+ var parts = [];
+ data.forEach((key, value) {
+ parts.add('${Uri.encodeQueryComponent(key)}='
+ '${Uri.encodeQueryComponent(value)}');
+ });
+ var formData = parts.join('&');
+
+ if (requestHeaders == null) {
+ requestHeaders = <String, String>{};
+ }
+ requestHeaders.putIfAbsent('Content-Type',
+ () => 'application/x-www-form-urlencoded; charset=UTF-8');
+
+ return request(url, method: 'POST', withCredentials: withCredentials,
+ responseType: responseType,
+ requestHeaders: requestHeaders, sendData: formData,
+ onProgress: onProgress);
+ }
+
+ /**
* Creates a URL request for the specified [url].
*
* By default this will do an HTTP GET request, this can be overridden with
@@ -12784,7 +13412,7 @@
*
* var request = new HttpRequest();
* request.open('GET', 'http://dartlang.org')
- * request.onLoad.add((event) => print('Request complete'));
+ * request.onLoad.listen((event) => print('Request complete'));
*
* is the (more verbose) equivalent of
*
@@ -12981,14 +13609,6 @@
@DocsEditable()
void abort() native "XMLHttpRequest_abort_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 evt) native "XMLHttpRequest_dispatchEvent_Callback";
-
/**
* Retrieve all the response headers from a request.
*
@@ -13043,10 +13663,6 @@
@SupportedBrowser(SupportedBrowser.SAFARI)
void overrideMimeType(String override) native "XMLHttpRequest_overrideMimeType_Callback";
- @DomName('XMLHttpRequest.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "XMLHttpRequest_removeEventListener_Callback";
-
/**
* Send the request with any given `data`.
*
@@ -13063,6 +13679,18 @@
@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()`.
@@ -13205,7 +13833,7 @@
@DomName('XMLHttpRequestUpload.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "XMLHttpRequestUpload_dispatchEvent_Callback";
+ bool dispatchEvent(Event event) native "XMLHttpRequestUpload_dispatchEvent_Callback";
@DomName('XMLHttpRequestUpload.removeEventListener')
@DocsEditable()
@@ -13314,6 +13942,39 @@
void set width(String value) native "HTMLIFrameElement_width_Setter";
}
+// 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('ImageBitmap')
+@Experimental() // untriaged
+class ImageBitmap extends NativeFieldWrapperClass1 {
+
+ @DomName('ImageBitmap.height')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int get height native "ImageBitmap_height_Getter";
+
+ @DomName('ImageBitmap.width')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int get width native "ImageBitmap_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
+// BSD-style license that can be found in the LICENSE file.
+
+// WARNING: Do not edit - generated code.
+
+
+@DomName('ImageBitmapCallback')
+@Experimental() // untriaged
+typedef void ImageBitmapCallback(ImageBitmap bitmap);
// 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.
@@ -13666,6 +14327,16 @@
@DocsEditable()
void set indeterminate(bool value) native "HTMLInputElement_indeterminate_Setter";
+ @DomName('HTMLInputElement.inputMode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get inputMode native "HTMLInputElement_inputMode_Getter";
+
+ @DomName('HTMLInputElement.inputMode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set inputMode(String value) native "HTMLInputElement_inputMode_Setter";
+
@DomName('HTMLInputElement.labels')
@DocsEditable()
List<Node> get labels native "HTMLInputElement_labels_Getter";
@@ -13985,7 +14656,7 @@
@DocsEditable()
// http://lists.w3.org/Archives/Public/public-xg-htmlspeech/2011Feb/att-0020/api-draft.html#extending_html_elements
@Experimental()
- Stream<Event> get onSpeechChange => speechChangeEvent.forTarget(this);
+ ElementStream<Event> get onSpeechChange => speechChangeEvent.forElement(this);
}
@@ -14561,26 +15232,19 @@
@DocsEditable()
Composition get composition native "InputMethodContext_composition_Getter";
- @DomName('InputMethodContext.enabled')
- @DocsEditable()
- bool get enabled native "InputMethodContext_enabled_Getter";
-
- @DomName('InputMethodContext.enabled')
- @DocsEditable()
- void set enabled(bool value) native "InputMethodContext_enabled_Setter";
-
@DomName('InputMethodContext.locale')
@DocsEditable()
String get locale native "InputMethodContext_locale_Getter";
+ @DomName('InputMethodContext.target')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Element get target native "InputMethodContext_target_Getter";
+
@DomName('InputMethodContext.confirmComposition')
@DocsEditable()
void confirmComposition() native "InputMethodContext_confirmComposition_Callback";
- @DomName('InputMethodContext.open')
- @DocsEditable()
- bool open() native "InputMethodContext_open_Callback";
-
@DomName('InputMethodContext.setCaretRectangle')
@DocsEditable()
void setCaretRectangle(Node anchor, int x, int y, int w, int h) native "InputMethodContext_setCaretRectangle_Callback";
@@ -14594,6 +15258,39 @@
// 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('Key')
+@Experimental() // untriaged
+class Key extends NativeFieldWrapperClass1 {
+
+ @DomName('Key.algorithm')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Algorithm get algorithm native "Key_algorithm_Getter";
+
+ @DomName('Key.extractable')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool get extractable native "Key_extractable_Getter";
+
+ @DomName('Key.type')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get type native "Key_type_Getter";
+
+ @DomName('Key.usages')
+ @DocsEditable()
+ @Experimental() // untriaged
+ List<String> get usages native "Key_usages_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.
+
@DomName('KeyboardEvent')
class KeyboardEvent extends UIEvent {
@@ -15054,7 +15751,7 @@
@DomName('MIDISuccessCallback')
@Experimental() // untriaged
-typedef void MidiSuccessCallback(MidiAccess access, bool sysexEnabled);
+typedef void MidiSuccessCallback(MidiAccess access, bool sysex);
// 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.
@@ -15173,14 +15870,6 @@
@DocsEditable()
void set volume(num value) native "MediaController_volume_Setter";
- @DomName('MediaController.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaController_addEventListener_Callback";
-
- @DomName('MediaController.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "MediaController_dispatchEvent_Callback";
-
@DomName('MediaController.pause')
@DocsEditable()
void pause() native "MediaController_pause_Callback";
@@ -15189,14 +15878,22 @@
@DocsEditable()
void play() native "MediaController_play_Callback";
- @DomName('MediaController.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaController_removeEventListener_Callback";
-
@DomName('MediaController.unpause')
@DocsEditable()
void unpause() native "MediaController_unpause_Callback";
+ @DomName('MediaController.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaController_addEventListener_Callback";
+
+ @DomName('MediaController.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "MediaController_dispatchEvent_Callback";
+
+ @DomName('MediaController.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaController_removeEventListener_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
@@ -15668,113 +16365,113 @@
@DomName('HTMLMediaElement.oncanplay')
@DocsEditable()
- Stream<Event> get onCanPlay => canPlayEvent.forTarget(this);
+ ElementStream<Event> get onCanPlay => canPlayEvent.forElement(this);
@DomName('HTMLMediaElement.oncanplaythrough')
@DocsEditable()
- Stream<Event> get onCanPlayThrough => canPlayThroughEvent.forTarget(this);
+ ElementStream<Event> get onCanPlayThrough => canPlayThroughEvent.forElement(this);
@DomName('HTMLMediaElement.ondurationchange')
@DocsEditable()
- Stream<Event> get onDurationChange => durationChangeEvent.forTarget(this);
+ ElementStream<Event> get onDurationChange => durationChangeEvent.forElement(this);
@DomName('HTMLMediaElement.onemptied')
@DocsEditable()
- Stream<Event> get onEmptied => emptiedEvent.forTarget(this);
+ ElementStream<Event> get onEmptied => emptiedEvent.forElement(this);
@DomName('HTMLMediaElement.onended')
@DocsEditable()
- Stream<Event> get onEnded => endedEvent.forTarget(this);
+ ElementStream<Event> get onEnded => endedEvent.forElement(this);
@DomName('HTMLMediaElement.onloadeddata')
@DocsEditable()
- Stream<Event> get onLoadedData => loadedDataEvent.forTarget(this);
+ ElementStream<Event> get onLoadedData => loadedDataEvent.forElement(this);
@DomName('HTMLMediaElement.onloadedmetadata')
@DocsEditable()
- Stream<Event> get onLoadedMetadata => loadedMetadataEvent.forTarget(this);
+ ElementStream<Event> get onLoadedMetadata => loadedMetadataEvent.forElement(this);
@DomName('HTMLMediaElement.onloadstart')
@DocsEditable()
- Stream<Event> get onLoadStart => loadStartEvent.forTarget(this);
+ ElementStream<Event> get onLoadStart => loadStartEvent.forElement(this);
@DomName('HTMLMediaElement.onpause')
@DocsEditable()
- Stream<Event> get onPause => pauseEvent.forTarget(this);
+ ElementStream<Event> get onPause => pauseEvent.forElement(this);
@DomName('HTMLMediaElement.onplay')
@DocsEditable()
- Stream<Event> get onPlay => playEvent.forTarget(this);
+ ElementStream<Event> get onPlay => playEvent.forElement(this);
@DomName('HTMLMediaElement.onplaying')
@DocsEditable()
- Stream<Event> get onPlaying => playingEvent.forTarget(this);
+ ElementStream<Event> get onPlaying => playingEvent.forElement(this);
@DomName('HTMLMediaElement.onprogress')
@DocsEditable()
- Stream<Event> get onProgress => progressEvent.forTarget(this);
+ ElementStream<Event> get onProgress => progressEvent.forElement(this);
@DomName('HTMLMediaElement.onratechange')
@DocsEditable()
- Stream<Event> get onRateChange => rateChangeEvent.forTarget(this);
+ ElementStream<Event> get onRateChange => rateChangeEvent.forElement(this);
@DomName('HTMLMediaElement.onseeked')
@DocsEditable()
- Stream<Event> get onSeeked => seekedEvent.forTarget(this);
+ ElementStream<Event> get onSeeked => seekedEvent.forElement(this);
@DomName('HTMLMediaElement.onseeking')
@DocsEditable()
- Stream<Event> get onSeeking => seekingEvent.forTarget(this);
+ ElementStream<Event> get onSeeking => seekingEvent.forElement(this);
@DomName('HTMLMediaElement.onshow')
@DocsEditable()
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#event-media-loadstart
@Experimental()
- Stream<Event> get onShow => showEvent.forTarget(this);
+ ElementStream<Event> get onShow => showEvent.forElement(this);
@DomName('HTMLMediaElement.onstalled')
@DocsEditable()
- Stream<Event> get onStalled => stalledEvent.forTarget(this);
+ ElementStream<Event> get onStalled => stalledEvent.forElement(this);
@DomName('HTMLMediaElement.onsuspend')
@DocsEditable()
- Stream<Event> get onSuspend => suspendEvent.forTarget(this);
+ ElementStream<Event> get onSuspend => suspendEvent.forElement(this);
@DomName('HTMLMediaElement.ontimeupdate')
@DocsEditable()
- Stream<Event> get onTimeUpdate => timeUpdateEvent.forTarget(this);
+ ElementStream<Event> get onTimeUpdate => timeUpdateEvent.forElement(this);
@DomName('HTMLMediaElement.onvolumechange')
@DocsEditable()
- Stream<Event> get onVolumeChange => volumeChangeEvent.forTarget(this);
+ ElementStream<Event> get onVolumeChange => volumeChangeEvent.forElement(this);
@DomName('HTMLMediaElement.onwaiting')
@DocsEditable()
- Stream<Event> get onWaiting => waitingEvent.forTarget(this);
+ ElementStream<Event> get onWaiting => waitingEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitkeyadded')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitkeyerror')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onKeyError => keyErrorEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onKeyError => keyErrorEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitkeymessage')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onKeyMessage => keyMessageEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onKeyMessage => keyMessageEvent.forElement(this);
@DomName('HTMLMediaElement.onwebkitneedkey')
@DocsEditable()
// https://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1/encrypted-media/encrypted-media.html#dom-keyadded
@Experimental()
- Stream<MediaKeyEvent> get onNeedKey => needKeyEvent.forTarget(this);
+ ElementStream<MediaKeyEvent> get onNeedKey => needKeyEvent.forElement(this);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -15999,26 +16696,26 @@
@DocsEditable()
String get sessionId native "MediaKeySession_sessionId_Getter";
- @DomName('MediaKeySession.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaKeySession_addEventListener_Callback";
-
@DomName('MediaKeySession.close')
@DocsEditable()
void close() native "MediaKeySession_close_Callback";
+ @DomName('MediaKeySession.update')
+ @DocsEditable()
+ void update(Uint8List key) native "MediaKeySession_update_Callback";
+
+ @DomName('MediaKeySession.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaKeySession_addEventListener_Callback";
+
@DomName('MediaKeySession.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "MediaKeySession_dispatchEvent_Callback";
+ bool dispatchEvent(Event event) native "MediaKeySession_dispatchEvent_Callback";
@DomName('MediaKeySession.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaKeySession_removeEventListener_Callback";
- @DomName('MediaKeySession.update')
- @DocsEditable()
- void update(Uint8List key) native "MediaKeySession_update_Callback";
-
@DomName('MediaKeySession.onwebkitkeyadded')
@DocsEditable()
Stream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forTarget(this);
@@ -16190,18 +16887,10 @@
@DocsEditable()
SourceBufferList get sourceBuffers native "MediaSource_sourceBuffers_Getter";
- @DomName('MediaSource.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaSource_addEventListener_Callback";
-
@DomName('MediaSource.addSourceBuffer')
@DocsEditable()
SourceBuffer addSourceBuffer(String type) native "MediaSource_addSourceBuffer_Callback";
- @DomName('MediaSource.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "MediaSource_dispatchEvent_Callback";
-
@DomName('MediaSource.endOfStream')
@DocsEditable()
void endOfStream(String error) native "MediaSource_endOfStream_Callback";
@@ -16210,14 +16899,22 @@
@DocsEditable()
static bool isTypeSupported(String type) native "MediaSource_isTypeSupported_Callback";
- @DomName('MediaSource.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaSource_removeEventListener_Callback";
-
@DomName('MediaSource.removeSourceBuffer')
@DocsEditable()
void removeSourceBuffer(SourceBuffer buffer) native "MediaSource_removeSourceBuffer_Callback";
+ @DomName('MediaSource.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaSource_addEventListener_Callback";
+
+ @DomName('MediaSource.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "MediaSource_dispatchEvent_Callback";
+
+ @DomName('MediaSource.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaSource_removeEventListener_Callback";
+
}
// 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
@@ -16281,18 +16978,10 @@
@Experimental() // non-standard
String get label native "MediaStream_label_Getter";
- @DomName('MediaStream.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaStream_addEventListener_Callback";
-
@DomName('MediaStream.addTrack')
@DocsEditable()
void addTrack(MediaStreamTrack track) native "MediaStream_addTrack_Callback";
- @DomName('MediaStream.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "MediaStream_dispatchEvent_Callback";
-
@DomName('MediaStream.getAudioTracks')
@DocsEditable()
List<MediaStreamTrack> getAudioTracks() native "MediaStream_getAudioTracks_Callback";
@@ -16305,10 +16994,6 @@
@DocsEditable()
List<MediaStreamTrack> getVideoTracks() native "MediaStream_getVideoTracks_Callback";
- @DomName('MediaStream.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaStream_removeEventListener_Callback";
-
@DomName('MediaStream.removeTrack')
@DocsEditable()
void removeTrack(MediaStreamTrack track) native "MediaStream_removeTrack_Callback";
@@ -16317,6 +17002,18 @@
@DocsEditable()
void stop() native "MediaStream_stop_Callback";
+ @DomName('MediaStream.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaStream_addEventListener_Callback";
+
+ @DomName('MediaStream.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "MediaStream_dispatchEvent_Callback";
+
+ @DomName('MediaStream.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaStream_removeEventListener_Callback";
+
@DomName('MediaStream.onaddtrack')
@DocsEditable()
Stream<Event> get onAddTrack => addTrackEvent.forTarget(this);
@@ -16415,6 +17112,11 @@
@DocsEditable()
String get readyState native "MediaStreamTrack_readyState_Getter";
+ @DomName('MediaStreamTrack.getSources')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static void getSources(MediaStreamTrackSourcesCallback callback) native "MediaStreamTrack_getSources_Callback";
+
@DomName('MediaStreamTrack.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MediaStreamTrack_addEventListener_Callback";
@@ -16423,11 +17125,6 @@
@DocsEditable()
bool dispatchEvent(Event event) native "MediaStreamTrack_dispatchEvent_Callback";
- @DomName('MediaStreamTrack.getSources')
- @DocsEditable()
- @Experimental() // untriaged
- static void getSources(MediaStreamTrackSourcesCallback callback) native "MediaStreamTrack_getSources_Callback";
-
@DomName('MediaStreamTrack.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MediaStreamTrack_removeEventListener_Callback";
@@ -16629,30 +17326,30 @@
@DocsEditable()
static const EventStreamProvider<MessageEvent> messageEvent = const EventStreamProvider<MessageEvent>('message');
- @DomName('MessagePort.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MessagePort_addEventListener_Callback";
-
@DomName('MessagePort.close')
@DocsEditable()
void close() native "MessagePort_close_Callback";
- @DomName('MessagePort.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "MessagePort_dispatchEvent_Callback";
-
@DomName('MessagePort.postMessage')
@DocsEditable()
void postMessage(Object message, [List messagePorts]) native "MessagePort_postMessage_Callback";
- @DomName('MessagePort.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MessagePort_removeEventListener_Callback";
-
@DomName('MessagePort.start')
@DocsEditable()
void start() native "MessagePort_start_Callback";
+ @DomName('MessagePort.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MessagePort_addEventListener_Callback";
+
+ @DomName('MessagePort.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "MessagePort_dispatchEvent_Callback";
+
+ @DomName('MessagePort.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MessagePort_removeEventListener_Callback";
+
@DomName('MessagePort.onmessage')
@DocsEditable()
Stream<MessageEvent> get onMessage => messageEvent.forTarget(this);
@@ -16834,14 +17531,6 @@
@DocsEditable()
static const EventStreamProvider<MidiConnectionEvent> disconnectEvent = const EventStreamProvider<MidiConnectionEvent>('disconnect');
- @DomName('MIDIAccess.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MIDIAccess_addEventListener_Callback";
-
- @DomName('MIDIAccess.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "MIDIAccess_dispatchEvent_Callback";
-
@DomName('MIDIAccess.inputs')
@DocsEditable()
List<MidiInput> inputs() native "MIDIAccess_inputs_Callback";
@@ -16850,6 +17539,14 @@
@DocsEditable()
List<MidiOutput> outputs() native "MIDIAccess_outputs_Callback";
+ @DomName('MIDIAccess.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MIDIAccess_addEventListener_Callback";
+
+ @DomName('MIDIAccess.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "MIDIAccess_dispatchEvent_Callback";
+
@DomName('MIDIAccess.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MIDIAccess_removeEventListener_Callback";
@@ -16912,7 +17609,7 @@
@DomName('MIDIInput')
// http://webaudio.github.io/web-midi-api/#idl-def-MIDIInput
@Experimental()
-class MidiInput extends MidiPort implements EventTarget {
+class MidiInput extends MidiPort {
// To suppress missing implicit constructor warnings.
factory MidiInput._() { throw new UnsupportedError("Not supported"); }
@@ -17554,14 +18251,6 @@
@DocsEditable()
bool get overset native "WebKitNamedFlow_overset_Getter";
- @DomName('WebKitNamedFlow.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "WebKitNamedFlow_addEventListener_Callback";
-
- @DomName('WebKitNamedFlow.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "WebKitNamedFlow_dispatchEvent_Callback";
-
@DomName('WebKitNamedFlow.getContent')
@DocsEditable()
List<Node> getContent() native "WebKitNamedFlow_getContent_Callback";
@@ -17574,6 +18263,14 @@
@DocsEditable()
List<Node> getRegionsByContent(Node contentNode) native "WebKitNamedFlow_getRegionsByContent_Callback";
+ @DomName('WebKitNamedFlow.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "WebKitNamedFlow_addEventListener_Callback";
+
+ @DomName('WebKitNamedFlow.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "WebKitNamedFlow_dispatchEvent_Callback";
+
@DomName('WebKitNamedFlow.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "WebKitNamedFlow_removeEventListener_Callback";
@@ -18267,10 +18964,6 @@
@DocsEditable()
void set text(String value) native "Node_textContent_Setter";
- @DomName('Node.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "Node_addEventListener_Callback";
-
/**
* Adds a node to the end of the child [nodes] list of this node.
*
@@ -18292,10 +18985,6 @@
@DocsEditable()
bool contains(Node other) native "Node_contains_Callback";
- @DomName('Node.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "Node_dispatchEvent_Callback";
-
@DomName('Node.hasChildNodes')
@DocsEditable()
bool hasChildNodes() native "Node_hasChildNodes_Callback";
@@ -18308,14 +18997,22 @@
@DocsEditable()
Node $dom_removeChild(Node oldChild) native "Node_removeChild_Callback";
- @DomName('Node.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Node_removeEventListener_Callback";
-
@DomName('Node.replaceChild')
@DocsEditable()
Node $dom_replaceChild(Node newChild, Node oldChild) native "Node_replaceChild_Callback";
+ @DomName('Node.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "Node_addEventListener_Callback";
+
+ @DomName('Node.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "Node_dispatchEvent_Callback";
+
+ @DomName('Node.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Node_removeEventListener_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
@@ -18618,10 +19315,6 @@
@Experimental() // nonstandard
void set tag(String value) native "Notification_tag_Setter";
- @DomName('Notification.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "Notification_addEventListener_Callback";
-
@DomName('Notification.cancel')
@DocsEditable()
@Experimental() // nonstandard
@@ -18631,14 +19324,6 @@
@DocsEditable()
void close() native "Notification_close_Callback";
- @DomName('Notification.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "Notification_dispatchEvent_Callback";
-
- @DomName('Notification.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Notification_removeEventListener_Callback";
-
@DomName('Notification.requestPermission')
@DocsEditable()
static void _requestPermission([_NotificationPermissionCallback callback]) native "Notification_requestPermission_Callback";
@@ -18655,6 +19340,18 @@
@Experimental() // nonstandard
void show() native "Notification_show_Callback";
+ @DomName('Notification.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "Notification_addEventListener_Callback";
+
+ @DomName('Notification.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "Notification_dispatchEvent_Callback";
+
+ @DomName('Notification.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Notification_removeEventListener_Callback";
+
@DomName('Notification.onclick')
@DocsEditable()
Stream<Event> get onClick => clickEvent.forTarget(this);
@@ -19307,17 +20004,7 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE)
-class Performance extends EventTarget {
- // To suppress missing implicit constructor warnings.
- factory Performance._() { throw new UnsupportedError("Not supported"); }
-
- @DomName('Performance.webkitresourcetimingbufferfullEvent')
- @DocsEditable()
- @SupportedBrowser(SupportedBrowser.CHROME)
- @SupportedBrowser(SupportedBrowser.SAFARI)
- @Experimental()
- // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
- static const EventStreamProvider<Event> resourceTimingBufferFullEvent = const EventStreamProvider<Event>('webkitresourcetimingbufferfull');
+class Performance extends NativeFieldWrapperClass1 {
/// Checks if this type is supported on the current platform.
static bool get supported => true;
@@ -19397,12 +20084,6 @@
// http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
void setResourceTimingBufferSize(int maxSize) native "Performance_webkitSetResourceTimingBufferSize_Callback";
- @DomName('Performance.onwebkitresourcetimingbufferfull')
- @DocsEditable()
- // http://www.w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming-methods
- @Experimental()
- Stream<Event> get onResourceTimingBufferFull => resourceTimingBufferFullEvent.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
@@ -20011,6 +20692,36 @@
@Experimental() // untriaged
class Promise extends NativeFieldWrapperClass1 {
+ @DomName('Promise._any')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise _any(Object values) native "Promise__any_Callback";
+
+ @DomName('Promise.every')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise every(Object values) native "Promise_every_Callback";
+
+ @DomName('Promise.fulfill')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise fulfill(Object value) native "Promise_fulfill_Callback";
+
+ @DomName('Promise.reject')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise reject(Object value) native "Promise_reject_Callback";
+
+ @DomName('Promise.resolve')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise resolve(Object value) native "Promise_resolve_Callback";
+
+ @DomName('Promise.some')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static Promise some(Object values) native "Promise_some_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
@@ -20024,6 +20735,21 @@
@Experimental() // untriaged
class PromiseResolver extends NativeFieldWrapperClass1 {
+ @DomName('PromiseResolver.fulfill')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void fulfill([Object value]) native "PromiseResolver_fulfill_Callback";
+
+ @DomName('PromiseResolver.reject')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void reject([Object value]) native "PromiseResolver_reject_Callback";
+
+ @DomName('PromiseResolver.resolve')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void resolve([Object value]) native "PromiseResolver_resolve_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
@@ -20356,22 +21082,10 @@
@DocsEditable()
bool get reliable native "RTCDataChannel_reliable_Getter";
- @DomName('RTCDataChannel.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "RTCDataChannel_addEventListener_Callback";
-
@DomName('RTCDataChannel.close')
@DocsEditable()
void close() native "RTCDataChannel_close_Callback";
- @DomName('RTCDataChannel.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "RTCDataChannel_dispatchEvent_Callback";
-
- @DomName('RTCDataChannel.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "RTCDataChannel_removeEventListener_Callback";
-
void send(data) {
if ((data is TypedData || data == null)) {
_send_1(data);
@@ -20416,6 +21130,18 @@
@DocsEditable()
void sendTypedData(TypedData data) native "RTCDataChannel_sendTypedData_Callback";
+ @DomName('RTCDataChannel.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "RTCDataChannel_addEventListener_Callback";
+
+ @DomName('RTCDataChannel.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "RTCDataChannel_dispatchEvent_Callback";
+
+ @DomName('RTCDataChannel.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "RTCDataChannel_removeEventListener_Callback";
+
@DomName('RTCDataChannel.onclose')
@DocsEditable()
Stream<Event> get onClose => closeEvent.forTarget(this);
@@ -20492,14 +21218,6 @@
@DocsEditable()
MediaStreamTrack get track native "RTCDTMFSender_track_Getter";
- @DomName('RTCDTMFSender.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "RTCDTMFSender_addEventListener_Callback";
-
- @DomName('RTCDTMFSender.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "RTCDTMFSender_dispatchEvent_Callback";
-
void insertDtmf(String tones, [int duration, int interToneGap]) {
if (interToneGap != null) {
_insertDTMF_1(tones, duration, interToneGap);
@@ -20519,6 +21237,14 @@
void _insertDTMF_3(tones) native "RTCDTMFSender__insertDTMF_3_Callback";
+ @DomName('RTCDTMFSender.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "RTCDTMFSender_addEventListener_Callback";
+
+ @DomName('RTCDTMFSender.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "RTCDTMFSender_dispatchEvent_Callback";
+
@DomName('RTCDTMFSender.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "RTCDTMFSender_removeEventListener_Callback";
@@ -20695,10 +21421,6 @@
@DocsEditable()
String get signalingState native "RTCPeerConnection_signalingState_Getter";
- @DomName('RTCPeerConnection.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "RTCPeerConnection_addEventListener_Callback";
-
@DomName('RTCPeerConnection.addIceCandidate')
@DocsEditable()
void addIceCandidate(RtcIceCandidate candidate) native "RTCPeerConnection_addIceCandidate_Callback";
@@ -20727,10 +21449,6 @@
@DocsEditable()
void _createOffer(_RtcSessionDescriptionCallback successCallback, [_RtcErrorCallback failureCallback, Map mediaConstraints]) native "RTCPeerConnection_createOffer_Callback";
- @DomName('RTCPeerConnection.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event event) native "RTCPeerConnection_dispatchEvent_Callback";
-
@DomName('RTCPeerConnection.getLocalStreams')
@DocsEditable()
List<MediaStream> getLocalStreams() native "RTCPeerConnection_getLocalStreams_Callback";
@@ -20747,10 +21465,6 @@
@DocsEditable()
MediaStream getStreamById(String streamId) native "RTCPeerConnection_getStreamById_Callback";
- @DomName('RTCPeerConnection.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "RTCPeerConnection_removeEventListener_Callback";
-
@DomName('RTCPeerConnection.removeStream')
@DocsEditable()
void removeStream(MediaStream stream) native "RTCPeerConnection_removeStream_Callback";
@@ -20783,6 +21497,18 @@
@DocsEditable()
void updateIce([Map configuration, Map mediaConstraints]) native "RTCPeerConnection_updateIce_Callback";
+ @DomName('RTCPeerConnection.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "RTCPeerConnection_addEventListener_Callback";
+
+ @DomName('RTCPeerConnection.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "RTCPeerConnection_dispatchEvent_Callback";
+
+ @DomName('RTCPeerConnection.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "RTCPeerConnection_removeEventListener_Callback";
+
@DomName('RTCPeerConnection.onaddstream')
@DocsEditable()
Stream<MediaStreamEvent> get onAddStream => addStreamEvent.forTarget(this);
@@ -21197,6 +21923,11 @@
@DocsEditable()
String get sourceFile native "SecurityPolicyViolationEvent_sourceFile_Getter";
+ @DomName('SecurityPolicyViolationEvent.statusCode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int get statusCode native "SecurityPolicyViolationEvent_statusCode_Getter";
+
@DomName('SecurityPolicyViolationEvent.violatedDirective')
@DocsEditable()
String get violatedDirective native "SecurityPolicyViolationEvent_violatedDirective_Getter";
@@ -21596,6 +22327,26 @@
@DocsEditable()
+@DomName('SharedWorkerGlobalScope')
+@Experimental() // untriaged
+class SharedWorkerGlobalScope extends WorkerGlobalScope {
+ // To suppress missing implicit constructor warnings.
+ factory SharedWorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('SharedWorkerGlobalScope.name')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get name native "SharedWorkerGlobalScope_name_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('SourceBuffer')
// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer
@Experimental()
@@ -21624,27 +22375,21 @@
@DocsEditable()
void abort() native "SourceBuffer_abort_Callback";
+ @DomName('SourceBuffer.appendBuffer')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void appendBuffer(ByteBuffer data) native "SourceBuffer_appendBuffer_Callback";
+
+ @DomName('SourceBuffer.appendBufferView')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void appendBufferView(TypedData data) native "SourceBuffer_appendBufferView_Callback";
+
@DomName('SourceBuffer.addEventListener')
@DocsEditable()
@Experimental() // untriaged
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "SourceBuffer_addEventListener_Callback";
- void appendBuffer(data) {
- if ((data is TypedData || data == null)) {
- _appendBuffer_1(data);
- return;
- }
- if ((data is ByteBuffer || data == null)) {
- _appendBuffer_2(data);
- return;
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
-
- void _appendBuffer_1(data) native "SourceBuffer__appendBuffer_1_Callback";
-
- void _appendBuffer_2(data) native "SourceBuffer__appendBuffer_2_Callback";
-
@DomName('SourceBuffer.dispatchEvent')
@DocsEditable()
@Experimental() // untriaged
@@ -21720,6 +22465,10 @@
SourceBuffer elementAt(int index) => this[index];
// -- end List<SourceBuffer> mixins.
+ @DomName('SourceBufferList.item')
+ @DocsEditable()
+ SourceBuffer item(int index) native "SourceBufferList_item_Callback";
+
@DomName('SourceBufferList.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "SourceBufferList_addEventListener_Callback";
@@ -21728,10 +22477,6 @@
@DocsEditable()
bool dispatchEvent(Event event) native "SourceBufferList_dispatchEvent_Callback";
- @DomName('SourceBufferList.item')
- @DocsEditable()
- SourceBuffer item(int index) native "SourceBufferList_item_Callback";
-
@DomName('SourceBufferList.removeEventListener')
@DocsEditable()
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "SourceBufferList_removeEventListener_Callback";
@@ -22129,18 +22874,6 @@
@DocsEditable()
void abort() native "SpeechRecognition_abort_Callback";
- @DomName('SpeechRecognition.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "SpeechRecognition_addEventListener_Callback";
-
- @DomName('SpeechRecognition.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "SpeechRecognition_dispatchEvent_Callback";
-
- @DomName('SpeechRecognition.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "SpeechRecognition_removeEventListener_Callback";
-
@DomName('SpeechRecognition.start')
@DocsEditable()
void start() native "SpeechRecognition_start_Callback";
@@ -22149,6 +22882,18 @@
@DocsEditable()
void stop() native "SpeechRecognition_stop_Callback";
+ @DomName('SpeechRecognition.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "SpeechRecognition_addEventListener_Callback";
+
+ @DomName('SpeechRecognition.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "SpeechRecognition_dispatchEvent_Callback";
+
+ @DomName('SpeechRecognition.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "SpeechRecognition_removeEventListener_Callback";
+
@DomName('SpeechRecognition.onaudioend')
@DocsEditable()
Stream<Event> get onAudioEnd => audioEndEvent.forTarget(this);
@@ -22476,6 +23221,21 @@
@DocsEditable()
void set volume(num value) native "SpeechSynthesisUtterance_volume_Setter";
+ @DomName('SpeechSynthesisUtterance.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "SpeechSynthesisUtterance_addEventListener_Callback";
+
+ @DomName('SpeechSynthesisUtterance.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native "SpeechSynthesisUtterance_dispatchEvent_Callback";
+
+ @DomName('SpeechSynthesisUtterance.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "SpeechSynthesisUtterance_removeEventListener_Callback";
+
@DomName('SpeechSynthesisUtterance.onboundary')
@DocsEditable()
Stream<SpeechSynthesisEvent> get onBoundary => boundaryEvent.forTarget(this);
@@ -22702,7 +23462,7 @@
@DomName('StorageErrorCallback')
// http://www.w3.org/TR/quota-api/#storageerrorcallback-callback
@Experimental()
-typedef void StorageErrorCallback(DomException error);
+typedef void StorageErrorCallback(DomError error);
// 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.
@@ -22992,6 +23752,36 @@
@Experimental() // untriaged
class SubtleCrypto extends NativeFieldWrapperClass1 {
+ @DomName('SubtleCrypto.decrypt')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation decrypt(Map algorithm) native "SubtleCrypto_decrypt_Callback";
+
+ @DomName('SubtleCrypto.digest')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation digest(Map algorithm) native "SubtleCrypto_digest_Callback";
+
+ @DomName('SubtleCrypto.encrypt')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation encrypt(Map algorithm) native "SubtleCrypto_encrypt_Callback";
+
+ @DomName('SubtleCrypto.importKey')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Object importKey(String format, TypedData keyData, Map algorithm, bool extractable, List<String> keyUsages) native "SubtleCrypto_importKey_Callback";
+
+ @DomName('SubtleCrypto.sign')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation sign(Map algorithm) native "SubtleCrypto_sign_Callback";
+
+ @DomName('SubtleCrypto.verify')
+ @DocsEditable()
+ @Experimental() // untriaged
+ CryptoOperation verify(Map algorithm) native "SubtleCrypto_verify_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
@@ -23679,6 +24469,16 @@
@DocsEditable()
FormElement get form native "HTMLTextAreaElement_form_Getter";
+ @DomName('HTMLTextAreaElement.inputMode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get inputMode native "HTMLTextAreaElement_inputMode_Getter";
+
+ @DomName('HTMLTextAreaElement.inputMode')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set inputMode(String value) native "HTMLTextAreaElement_inputMode_Setter";
+
@DomName('HTMLTextAreaElement.labels')
@DocsEditable()
@Unstable()
@@ -23932,17 +24732,17 @@
@DocsEditable()
void addCue(TextTrackCue cue) native "TextTrack_addCue_Callback";
+ @DomName('TextTrack.removeCue')
+ @DocsEditable()
+ void removeCue(TextTrackCue cue) native "TextTrack_removeCue_Callback";
+
@DomName('TextTrack.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "TextTrack_addEventListener_Callback";
@DomName('TextTrack.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "TextTrack_dispatchEvent_Callback";
-
- @DomName('TextTrack.removeCue')
- @DocsEditable()
- void removeCue(TextTrackCue cue) native "TextTrack_removeCue_Callback";
+ bool dispatchEvent(Event event) native "TextTrack_dispatchEvent_Callback";
@DomName('TextTrack.removeEventListener')
@DocsEditable()
@@ -24091,18 +24891,18 @@
@Experimental() // nonstandard
void set vertical(String value) native "TextTrackCue_vertical_Setter";
+ @DomName('TextTrackCue.getCueAsHTML')
+ @DocsEditable()
+ @Experimental() // nonstandard
+ DocumentFragment getCueAsHtml() native "TextTrackCue_getCueAsHTML_Callback";
+
@DomName('TextTrackCue.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "TextTrackCue_addEventListener_Callback";
@DomName('TextTrackCue.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "TextTrackCue_dispatchEvent_Callback";
-
- @DomName('TextTrackCue.getCueAsHTML')
- @DocsEditable()
- @Experimental() // nonstandard
- DocumentFragment getCueAsHtml() native "TextTrackCue_getCueAsHTML_Callback";
+ bool dispatchEvent(Event event) native "TextTrackCue_dispatchEvent_Callback";
@DomName('TextTrackCue.removeEventListener')
@DocsEditable()
@@ -24256,17 +25056,17 @@
TextTrack elementAt(int index) => this[index];
// -- end List<TextTrack> mixins.
+ @DomName('TextTrackList.item')
+ @DocsEditable()
+ TextTrack item(int index) native "TextTrackList_item_Callback";
+
@DomName('TextTrackList.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "TextTrackList_addEventListener_Callback";
@DomName('TextTrackList.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "TextTrackList_dispatchEvent_Callback";
-
- @DomName('TextTrackList.item')
- @DocsEditable()
- TextTrack item(int index) native "TextTrackList_item_Callback";
+ bool dispatchEvent(Event event) native "TextTrackList_dispatchEvent_Callback";
@DomName('TextTrackList.removeEventListener')
@DocsEditable()
@@ -24908,16 +25708,16 @@
static String _createObjectUrlFromWebKitSource(_WebKitMediaSource source) native "URL__createObjectUrlFromWebKitSource_Callback";
static String createObjectUrl(blob_OR_source_OR_stream) {
- if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
return _createObjectURL_1(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
return _createObjectURL_2(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) {
return _createObjectURL_3(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
return _createObjectURL_4(blob_OR_source_OR_stream);
}
throw new ArgumentError("Incorrect number or type of arguments");
@@ -25268,10 +26068,6 @@
@DocsEditable()
String get url native "WebSocket_url_Getter";
- @DomName('WebSocket.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "WebSocket_addEventListener_Callback";
-
void close([int code, String reason]) {
if (reason != null) {
_close_1(code, reason);
@@ -25291,14 +26087,6 @@
void _close_3() native "WebSocket__close_3_Callback";
- @DomName('WebSocket.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "WebSocket_dispatchEvent_Callback";
-
- @DomName('WebSocket.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "WebSocket_removeEventListener_Callback";
-
/**
* Transmit data to the server over this connection.
*
@@ -25326,6 +26114,18 @@
@DocsEditable()
void sendTypedData(TypedData data) native "WebSocket_sendTypedData_Callback";
+ @DomName('WebSocket.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "WebSocket_addEventListener_Callback";
+
+ @DomName('WebSocket.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "WebSocket_dispatchEvent_Callback";
+
+ @DomName('WebSocket.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "WebSocket_removeEventListener_Callback";
+
@DomName('WebSocket.onclose')
@DocsEditable()
Stream<CloseEvent> get onClose => closeEvent.forTarget(this);
@@ -25452,7 +26252,7 @@
@DomName('Window')
-class Window extends EventTarget implements WindowBase, WindowTimers {
+class Window extends EventTarget implements WindowBase, WindowTimers, WindowBase64 {
/**
* Executes a [callback] after the immediate execution stack has completed.
@@ -25904,22 +26704,10 @@
WindowBase ___getter___2(index_OR_name) native "Window____getter___2_Callback";
- @DomName('Window.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "Window_addEventListener_Callback";
-
@DomName('Window.alert')
@DocsEditable()
void alert(String message) native "Window_alert_Callback";
- @DomName('Window.atob')
- @DocsEditable()
- String atob(String string) native "Window_atob_Callback";
-
- @DomName('Window.btoa')
- @DocsEditable()
- String btoa(String string) native "Window_btoa_Callback";
-
@DomName('Window.cancelAnimationFrame')
@DocsEditable()
void cancelAnimationFrame(int id) native "Window_cancelAnimationFrame_Callback";
@@ -25932,9 +26720,81 @@
@DocsEditable()
bool confirm(String message) native "Window_confirm_Callback";
- @DomName('Window.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "Window_dispatchEvent_Callback";
+ void _createImageBitmap(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, ImageBitmapCallback callback, [int sx, int sy, int sw, int sh]) {
+ if ((callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_1(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_2(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is VideoElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_3(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is VideoElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_4(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasRenderingContext2D || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_5(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasRenderingContext2D || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_6(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_7(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is CanvasElement || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_8(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageData || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_9(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageData || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_10(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ if ((callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageBitmap || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null) && sx == null && sy == null && sw == null && sh == null) {
+ _createImageBitmap_11(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback);
+ return;
+ }
+ if ((sh is int || sh == null) && (sw is int || sw == null) && (sy is int || sy == null) && (sx is int || sx == null) && (callback is ImageBitmapCallback || callback == null) && (bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video is ImageBitmap || bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video == null)) {
+ _createImageBitmap_12(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh);
+ return;
+ }
+ throw new ArgumentError("Incorrect number or type of arguments");
+ }
+
+ void _createImageBitmap_1(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback) native "Window__createImageBitmap_1_Callback";
+
+ void _createImageBitmap_2(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh) native "Window__createImageBitmap_2_Callback";
+
+ void _createImageBitmap_3(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback) native "Window__createImageBitmap_3_Callback";
+
+ void _createImageBitmap_4(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh) native "Window__createImageBitmap_4_Callback";
+
+ void _createImageBitmap_5(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback) native "Window__createImageBitmap_5_Callback";
+
+ void _createImageBitmap_6(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh) native "Window__createImageBitmap_6_Callback";
+
+ void _createImageBitmap_7(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback) native "Window__createImageBitmap_7_Callback";
+
+ void _createImageBitmap_8(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh) native "Window__createImageBitmap_8_Callback";
+
+ void _createImageBitmap_9(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback) native "Window__createImageBitmap_9_Callback";
+
+ void _createImageBitmap_10(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh) native "Window__createImageBitmap_10_Callback";
+
+ void _createImageBitmap_11(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback) native "Window__createImageBitmap_11_Callback";
+
+ void _createImageBitmap_12(bitmap_OR_canvas_OR_context_OR_data_OR_image_OR_video, callback, sx, sy, sw, sh) native "Window__createImageBitmap_12_Callback";
@DomName('Window.find')
@DocsEditable()
@@ -25987,10 +26847,6 @@
@DocsEditable()
void print() native "Window_print_Callback";
- @DomName('Window.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Window_removeEventListener_Callback";
-
@DomName('Window.requestAnimationFrame')
@DocsEditable()
int requestAnimationFrame(RequestAnimationFrameCallback callback) native "Window_requestAnimationFrame_Callback";
@@ -26073,6 +26929,26 @@
return completer.future;
}
+ @DomName('Window.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "Window_addEventListener_Callback";
+
+ @DomName('Window.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "Window_dispatchEvent_Callback";
+
+ @DomName('Window.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Window_removeEventListener_Callback";
+
+ @DomName('Window.atob')
+ @DocsEditable()
+ String atob(String string) native "Window_atob_Callback";
+
+ @DomName('Window.btoa')
+ @DocsEditable()
+ String btoa(String string) native "Window_btoa_Callback";
+
@DomName('Window.clearInterval')
@DocsEditable()
void _clearInterval(int handle) native "Window_clearInterval_Callback";
@@ -26201,6 +27077,16 @@
@DocsEditable()
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);
+ @DomName('Window.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseEnter => Element.mouseEnterEvent.forTarget(this);
+
+ @DomName('Window.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseLeave => Element.mouseLeaveEvent.forTarget(this);
+
@DomName('Window.onmousemove')
@DocsEditable()
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);
@@ -26391,6 +27277,29 @@
@DocsEditable()
+@DomName('WindowBase64')
+@Experimental() // untriaged
+abstract class WindowBase64 extends NativeFieldWrapperClass1 {
+
+ @DomName('WindowBase64.atob')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String atob(String string) native "WindowBase64_atob_Callback";
+
+ @DomName('WindowBase64.btoa')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String btoa(String string) native "WindowBase64_btoa_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('WindowTimers')
@Experimental() // untriaged
abstract class WindowTimers extends NativeFieldWrapperClass1 {
@@ -26464,6 +27373,21 @@
@DocsEditable()
void terminate() native "Worker_terminate_Callback";
+ @DomName('Worker.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "Worker_addEventListener_Callback";
+
+ @DomName('Worker.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native "Worker_dispatchEvent_Callback";
+
+ @DomName('Worker.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "Worker_removeEventListener_Callback";
+
@DomName('Worker.onerror')
@DocsEditable()
@Experimental() // untriaged
@@ -26500,9 +27424,189 @@
@DocsEditable()
+@DomName('WorkerGlobalScope')
+@Experimental() // untriaged
+class WorkerGlobalScope extends EventTarget implements WindowTimers, WindowBase64 {
+ // To suppress missing implicit constructor warnings.
+ factory WorkerGlobalScope._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('WorkerGlobalScope.errorEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
+
+ @DomName('WorkerGlobalScope.PERSISTENT')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int PERSISTENT = 1;
+
+ @DomName('WorkerGlobalScope.TEMPORARY')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const int TEMPORARY = 0;
+
+ @DomName('WorkerGlobalScope.crypto')
+ @DocsEditable()
+ @Experimental() // untriaged
+ WorkerCrypto get crypto native "WorkerGlobalScope_crypto_Getter";
+
+ @DomName('WorkerGlobalScope.indexedDB')
+ @DocsEditable()
+ @Experimental() // untriaged
+ IdbFactory get indexedDB native "WorkerGlobalScope_indexedDB_Getter";
+
+ @DomName('WorkerGlobalScope.location')
+ @DocsEditable()
+ @Experimental() // untriaged
+ _WorkerLocation get location native "WorkerGlobalScope_location_Getter";
+
+ @DomName('WorkerGlobalScope.navigator')
+ @DocsEditable()
+ @Experimental() // untriaged
+ _WorkerNavigator get navigator native "WorkerGlobalScope_navigator_Getter";
+
+ @DomName('WorkerGlobalScope.performance')
+ @DocsEditable()
+ @Experimental() // untriaged
+ WorkerPerformance get performance native "WorkerGlobalScope_performance_Getter";
+
+ @DomName('WorkerGlobalScope.self')
+ @DocsEditable()
+ @Experimental() // untriaged
+ WorkerGlobalScope get self native "WorkerGlobalScope_self_Getter";
+
+ @DomName('WorkerGlobalScope.webkitNotifications')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental()
+ @Experimental() // untriaged
+ NotificationCenter get notifications native "WorkerGlobalScope_webkitNotifications_Getter";
+
+ @DomName('WorkerGlobalScope.close')
+ @DocsEditable()
+ @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
+ SqlDatabase openDatabase(String name, String version, String displayName, int estimatedSize, [DatabaseCallback creationCallback]) native "WorkerGlobalScope_openDatabase_Callback";
+
+ @DomName('WorkerGlobalScope.openDatabaseSync')
+ @DocsEditable()
+ @Experimental() // untriaged
+ _DatabaseSync openDatabaseSync(String name, String version, String displayName, int estimatedSize, [DatabaseCallback creationCallback]) native "WorkerGlobalScope_openDatabaseSync_Callback";
+
+ @DomName('WorkerGlobalScope.webkitRequestFileSystem')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _webkitRequestFileSystem(int type, int size, [_FileSystemCallback successCallback, _ErrorCallback errorCallback]) native "WorkerGlobalScope_webkitRequestFileSystem_Callback";
+
+ Future<FileSystem> webkitRequestFileSystem(int type, int size) {
+ var completer = new Completer<FileSystem>();
+ _webkitRequestFileSystem(type, size,
+ (value) { completer.complete(value); },
+ (error) { completer.completeError(error); });
+ return completer.future;
+ }
+
+ @DomName('WorkerGlobalScope.webkitRequestFileSystemSync')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental()
+ @Experimental() // untriaged
+ _DOMFileSystemSync requestFileSystemSync(int type, int size) native "WorkerGlobalScope_webkitRequestFileSystemSync_Callback";
+
+ @DomName('WorkerGlobalScope.webkitResolveLocalFileSystemSyncURL')
+ @DocsEditable()
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental()
+ @Experimental() // untriaged
+ _EntrySync resolveLocalFileSystemSyncUrl(String url) native "WorkerGlobalScope_webkitResolveLocalFileSystemSyncURL_Callback";
+
+ @DomName('WorkerGlobalScope.webkitResolveLocalFileSystemURL')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _webkitResolveLocalFileSystemUrl(String url, _EntryCallback successCallback, [_ErrorCallback errorCallback]) native "WorkerGlobalScope_webkitResolveLocalFileSystemURL_Callback";
+
+ Future<Entry> webkitResolveLocalFileSystemUrl(String url) {
+ var completer = new Completer<Entry>();
+ _webkitResolveLocalFileSystemUrl(url,
+ (value) { completer.complete(value); },
+ (error) { completer.completeError(error); });
+ return completer.future;
+ }
+
+ @DomName('WorkerGlobalScope.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "WorkerGlobalScope_addEventListener_Callback";
+
+ @DomName('WorkerGlobalScope.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native "WorkerGlobalScope_dispatchEvent_Callback";
+
+ @DomName('WorkerGlobalScope.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "WorkerGlobalScope_removeEventListener_Callback";
+
+ @DomName('WorkerGlobalScope.atob')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String atob(String string) native "WorkerGlobalScope_atob_Callback";
+
+ @DomName('WorkerGlobalScope.btoa')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String btoa(String string) native "WorkerGlobalScope_btoa_Callback";
+
+ @DomName('WorkerGlobalScope.clearInterval')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void clearInterval(int handle) native "WorkerGlobalScope_clearInterval_Callback";
+
+ @DomName('WorkerGlobalScope.clearTimeout')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void clearTimeout(int handle) native "WorkerGlobalScope_clearTimeout_Callback";
+
+ @DomName('WorkerGlobalScope.setInterval')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int setInterval(Object handler, int timeout) native "WorkerGlobalScope_setInterval_Callback";
+
+ @DomName('WorkerGlobalScope.setTimeout')
+ @DocsEditable()
+ @Experimental() // untriaged
+ int setTimeout(Object handler, int timeout) native "WorkerGlobalScope_setTimeout_Callback";
+
+ @DomName('WorkerGlobalScope.onerror')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<Event> get onError => errorEvent.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('WorkerPerformance')
@Experimental() // untriaged
-abstract class WorkerPerformance extends NativeFieldWrapperClass1 {
+class WorkerPerformance extends NativeFieldWrapperClass1 {
@DomName('WorkerPerformance.now')
@DocsEditable()
@@ -27209,22 +28313,6 @@
@DocsEditable()
-@DomName('DedicatedWorkerContext')
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html
-@Experimental()
-abstract class _DedicatedWorkerContext extends _WorkerContext {
- // To suppress missing implicit constructor warnings.
- factory _DedicatedWorkerContext._() { 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('DirectoryEntrySync')
// http://www.w3.org/TR/file-system-api/#the-directoryentrysync-interface
@Experimental()
@@ -28031,22 +29119,6 @@
@DocsEditable()
-@DomName('SharedWorkerContext')
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#shared-workers-and-the-sharedworkerglobalscope-interface
-@Experimental() // nonstandard
-abstract class _SharedWorkerContext extends _WorkerContext {
- // To suppress missing implicit constructor warnings.
- factory _SharedWorkerContext._() { 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('SpeechInputResultList')
// http://lists.w3.org/Archives/Public/public-xg-htmlspeech/2011Feb/att-0020/api-draft.html#speech_input_result_list_interface
@Experimental()
@@ -28307,20 +29379,6 @@
@DocsEditable()
-@DomName('WorkerContext')
-// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#WorkerGlobalScope-partial
-@Experimental() // stable
-abstract class _WorkerContext extends NativeFieldWrapperClass1 implements EventTarget, WindowTimers {
-
-}
-// 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('WorkerLocation')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#workerlocation
@Experimental()
@@ -29271,6 +30329,123 @@
}
}
+/** A specialized Stream available to [Element]s to enable event delegation. */
+abstract class ElementStream<T extends Event> implements Stream<T> {
+ /**
+ * Return a stream that only fires when the particular event fires for
+ * elements matching the specified CSS selector.
+ *
+ * This is the Dart equivalent to jQuery's
+ * [delegate](http://api.jquery.com/delegate/).
+ */
+ Stream<T> matches(String selector);
+}
+
+/**
+ * Adapter for exposing DOM Element events as streams, while also allowing
+ * event delegation.
+ */
+class _ElementEventStreamImpl<T extends Event> extends _EventStream<T>
+ implements ElementStream<T> {
+ _ElementEventStreamImpl(target, eventType, useCapture) :
+ super(target, eventType, useCapture);
+
+ Stream<T> matches(String selector) =>
+ this.where((event) => event.target.matches(selector, true));
+}
+
+/**
+ * Adapter for exposing events on a collection of DOM Elements as streams,
+ * while also allowing event delegation.
+ */
+class _ElementListEventStreamImpl<T extends Event> extends Stream<T>
+ implements ElementStream<T> {
+ final _StreamPool _pool;
+ Stream<T> _stream;
+
+ _ElementListEventStreamImpl(targetList, eventType, useCapture) :
+ _pool = new _StreamPool.broadcast() {
+ for (Element target in targetList) {
+ var stream = new _EventStream(target, eventType, useCapture);
+ _pool.add(stream);
+ }
+ _stream = _pool.stream;
+ }
+
+ Stream<T> matches(String selector) =>
+ this.where((event) => event.target.matches(selector, true));
+
+ // Delegate all regular Stream behavor to our wrapped Stream.
+ StreamSubscription<T> listen(void onData(T event),
+ { void onError(error),
+ void onDone(),
+ bool cancelOnError}) =>
+ _stream.listen(onData, onError: onError, onDone: onDone,
+ cancelOnError: cancelOnError);
+ Stream<T> asBroadcastStream({void onListen(StreamSubscription subscription),
+ void onCancel(StreamSubscription subscription)})
+ => _stream;
+ bool get isBroadcast => true;
+}
+
+/**
+ * A pool of streams whose events are unified and emitted through a central
+ * stream.
+ */
+// TODO (efortuna): Remove this when Issue 12218 is addressed.
+class _StreamPool<T> {
+ StreamController<T> _controller;
+
+ /// Subscriptions to the streams that make up the pool.
+ var _subscriptions = new Map<Stream<T>, StreamSubscription<T>>();
+
+ /**
+ * Creates a new stream pool where [stream] can be listened to more than
+ * once.
+ *
+ * Any events from buffered streams in the pool will be emitted immediately,
+ * regardless of whether [stream] has any subscribers.
+ */
+ _StreamPool.broadcast() {
+ _controller = new StreamController<T>.broadcast(sync: true,
+ onCancel: close);
+ }
+
+ /**
+ * The stream through which all events from streams in the pool are emitted.
+ */
+ Stream<T> get stream => _controller.stream;
+
+ /**
+ * Adds [stream] as a member of this pool.
+ *
+ * Any events from [stream] will be emitted through [this.stream]. If
+ * [stream] is sync, they'll be emitted synchronously; if [stream] is async,
+ * they'll be emitted asynchronously.
+ */
+ void add(Stream<T> stream) {
+ if (_subscriptions.containsKey(stream)) return;
+ _subscriptions[stream] = stream.listen(_controller.add,
+ onError: _controller.addError,
+ onDone: () => remove(stream));
+ }
+
+ /** Removes [stream] as a member of this pool. */
+ void remove(Stream<T> stream) {
+ var subscription = _subscriptions.remove(stream);
+ if (subscription != null) subscription.cancel();
+ }
+
+ /** Removes all streams from this pool and closes [stream]. */
+ void close() {
+ for (var subscription in _subscriptions.values) {
+ subscription.cancel();
+ }
+ _subscriptions.clear();
+ _controller.close();
+ }
+}
+
class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
int _pauseCount = 0;
EventTarget _target;
@@ -29348,7 +30523,6 @@
}
}
-
/**
* A factory to expose DOM events as Streams.
*/
@@ -29375,8 +30549,43 @@
*
* [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
*/
- Stream<T> forTarget(EventTarget e, {bool useCapture: false}) {
- return new _EventStream(e, _eventType, useCapture);
+ Stream<T> forTarget(EventTarget e, {bool useCapture: false}) =>
+ new _EventStream(e, _eventType, useCapture);
+
+ /**
+ * Gets an [ElementEventStream] for this event type, on the specified element.
+ *
+ * This will always return a broadcast stream so multiple listeners can be
+ * used simultaneously.
+ *
+ * This may be used to capture DOM events:
+ *
+ * Element.keyDownEvent.forElement(element, useCapture: true).listen(...);
+ *
+ * See also:
+ *
+ * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
+ */
+ ElementStream<T> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventType, useCapture);
+ }
+
+ /**
+ * Gets an [ElementEventStream] for this event type, on the list of elements.
+ *
+ * This will always return a broadcast stream so multiple listeners can be
+ * used simultaneously.
+ *
+ * This may be used to capture DOM events:
+ *
+ * Element.keyDownEvent._forElementList(element, useCapture: true).listen(...);
+ *
+ * See also:
+ *
+ * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
+ */
+ ElementStream<T> _forElementList(ElementList e, {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventType, useCapture);
}
/**
@@ -29405,6 +30614,15 @@
return new _EventStream(e, _eventTypeGetter(e), useCapture);
}
+ ElementStream<T> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventTypeGetter(e), useCapture);
+ }
+
+ ElementStream<T> _forElementList(ElementList e,
+ {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventTypeGetter(e), useCapture);
+ }
+
String getEventType(EventTarget target) {
return _eventTypeGetter(target);
}
@@ -32034,11 +33252,11 @@
static String addTrailingDot(String str) => '${str}.';
+ static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError;
+
// TODO(jacobr): we need a failsafe way to determine that a Node is really a
// DOM node rather than just a class that extends Node.
static bool isNode(obj) => obj is Node;
-
- static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError;
}
class _NPObject extends NativeFieldWrapperClass1 {
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 41ec3f4..9304548 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -305,6 +305,12 @@
@DocsEditable()
static const EventStreamProvider<Event> abortEvent = const EventStreamProvider<Event>('abort');
+ @DomName('IDBDatabase.closeEvent')
+ @DocsEditable()
+ // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540
+ @Experimental()
+ static const EventStreamProvider<Event> closeEvent = const EventStreamProvider<Event>('close');
+
@DomName('IDBDatabase.errorEvent')
@DocsEditable()
static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
@@ -329,11 +335,6 @@
@Returns('int|String|Null')
final dynamic version;
- @JSName('addEventListener')
- @DomName('IDBDatabase.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@DomName('IDBDatabase.close')
@DocsEditable()
void close() native;
@@ -360,9 +361,16 @@
@DocsEditable()
void deleteObjectStore(String name) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('IDBDatabase.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('IDBDatabase.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('IDBDatabase.removeEventListener')
@@ -373,6 +381,12 @@
@DocsEditable()
Stream<Event> get onAbort => abortEvent.forTarget(this);
+ @DomName('IDBDatabase.onclose')
+ @DocsEditable()
+ // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540
+ @Experimental()
+ Stream<Event> get onClose => closeEvent.forTarget(this);
+
@DomName('IDBDatabase.onerror')
@DocsEditable()
Stream<Event> get onError => errorEvent.forTarget(this);
@@ -1085,7 +1099,7 @@
@DocsEditable()
@DomName('IDBOpenDBRequest')
@Unstable()
-class OpenDBRequest extends Request implements EventTarget native "IDBOpenDBRequest,IDBVersionChangeRequest" {
+class OpenDBRequest extends Request native "IDBOpenDBRequest,IDBVersionChangeRequest" {
// To suppress missing implicit constructor warnings.
factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); }
@@ -1149,6 +1163,8 @@
@DocsEditable()
final Transaction transaction;
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('IDBRequest.addEventListener')
@DocsEditable()
@@ -1156,7 +1172,7 @@
@DomName('IDBRequest.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('IDBRequest.removeEventListener')
@@ -1236,6 +1252,12 @@
@DocsEditable()
void abort() native;
+ @DomName('IDBTransaction.objectStore')
+ @DocsEditable()
+ ObjectStore objectStore(String name) native;
+
+ // From EventTarget
+
@JSName('addEventListener')
@DomName('IDBTransaction.addEventListener')
@DocsEditable()
@@ -1243,11 +1265,7 @@
@DomName('IDBTransaction.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native;
-
- @DomName('IDBTransaction.objectStore')
- @DocsEditable()
- ObjectStore objectStore(String name) native;
+ bool dispatchEvent(Event event) native;
@JSName('removeEventListener')
@DomName('IDBTransaction.removeEventListener')
diff --git a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
index 015c8ee..dc31713 100644
--- a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
+++ b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
@@ -149,6 +149,12 @@
@DocsEditable()
static const EventStreamProvider<Event> abortEvent = const EventStreamProvider<Event>('abort');
+ @DomName('IDBDatabase.closeEvent')
+ @DocsEditable()
+ // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540
+ @Experimental()
+ static const EventStreamProvider<Event> closeEvent = const EventStreamProvider<Event>('close');
+
@DomName('IDBDatabase.errorEvent')
@DocsEditable()
static const EventStreamProvider<Event> errorEvent = const EventStreamProvider<Event>('error');
@@ -169,10 +175,6 @@
@DocsEditable()
dynamic get version native "IDBDatabase_version_Getter";
- @DomName('IDBDatabase.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "IDBDatabase_addEventListener_Callback";
-
@DomName('IDBDatabase.close')
@DocsEditable()
void close() native "IDBDatabase_close_Callback";
@@ -185,14 +187,6 @@
@DocsEditable()
void deleteObjectStore(String name) native "IDBDatabase_deleteObjectStore_Callback";
- @DomName('IDBDatabase.dispatchEvent')
- @DocsEditable()
- bool dispatchEvent(Event evt) native "IDBDatabase_dispatchEvent_Callback";
-
- @DomName('IDBDatabase.removeEventListener')
- @DocsEditable()
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "IDBDatabase_removeEventListener_Callback";
-
Transaction transaction(storeName_OR_storeNames, String mode) {
if ((mode is String || mode == null) && (storeName_OR_storeNames is List<String> || storeName_OR_storeNames == null)) {
return _transaction_1(storeName_OR_storeNames, mode);
@@ -224,10 +218,28 @@
@DocsEditable()
Transaction transactionStores(List<String> storeNames, String mode) native "IDBDatabase_transactionStores_Callback";
+ @DomName('IDBDatabase.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "IDBDatabase_addEventListener_Callback";
+
+ @DomName('IDBDatabase.dispatchEvent')
+ @DocsEditable()
+ bool dispatchEvent(Event event) native "IDBDatabase_dispatchEvent_Callback";
+
+ @DomName('IDBDatabase.removeEventListener')
+ @DocsEditable()
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "IDBDatabase_removeEventListener_Callback";
+
@DomName('IDBDatabase.onabort')
@DocsEditable()
Stream<Event> get onAbort => abortEvent.forTarget(this);
+ @DomName('IDBDatabase.onclose')
+ @DocsEditable()
+ // https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540
+ @Experimental()
+ Stream<Event> get onClose => closeEvent.forTarget(this);
+
@DomName('IDBDatabase.onerror')
@DocsEditable()
Stream<Event> get onError => errorEvent.forTarget(this);
@@ -917,7 +929,7 @@
@DocsEditable()
@DomName('IDBOpenDBRequest')
@Unstable()
-class OpenDBRequest extends Request implements EventTarget {
+class OpenDBRequest extends Request {
// To suppress missing implicit constructor warnings.
factory OpenDBRequest._() { throw new UnsupportedError("Not supported"); }
@@ -986,7 +998,7 @@
@DomName('IDBRequest.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "IDBRequest_dispatchEvent_Callback";
+ bool dispatchEvent(Event event) native "IDBRequest_dispatchEvent_Callback";
@DomName('IDBRequest.removeEventListener')
@DocsEditable()
@@ -1066,17 +1078,17 @@
@DocsEditable()
void abort() native "IDBTransaction_abort_Callback";
+ @DomName('IDBTransaction.objectStore')
+ @DocsEditable()
+ ObjectStore objectStore(String name) native "IDBTransaction_objectStore_Callback";
+
@DomName('IDBTransaction.addEventListener')
@DocsEditable()
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "IDBTransaction_addEventListener_Callback";
@DomName('IDBTransaction.dispatchEvent')
@DocsEditable()
- bool dispatchEvent(Event evt) native "IDBTransaction_dispatchEvent_Callback";
-
- @DomName('IDBTransaction.objectStore')
- @DocsEditable()
- ObjectStore objectStore(String name) native "IDBTransaction_objectStore_Callback";
+ bool dispatchEvent(Event event) native "IDBTransaction_dispatchEvent_Callback";
@DomName('IDBTransaction.removeEventListener')
@DocsEditable()
diff --git a/sdk/lib/io/io.dart b/sdk/lib/io/io.dart
index 0b41e3b..4f61b2b 100644
--- a/sdk/lib/io/io.dart
+++ b/sdk/lib/io/io.dart
@@ -17,6 +17,7 @@
import 'dart:collection' show LinkedHashSet,
LinkedList,
LinkedListEntry;
+import 'dart:convert';
import 'dart:isolate';
import 'dart:json' as JSON;
import 'dart:math';
diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart
index 90fe65a..16b3595 100644
--- a/sdk/lib/io/platform.dart
+++ b/sdk/lib/io/platform.dart
@@ -15,9 +15,6 @@
static final _localHostname = _Platform.localHostname;
static final _version = _Platform.version;
- // This executable singleton is written to by the embedder if applicable.
- static String _nativeExecutable = '';
-
// This script singleton is written to by the embedder if applicable.
static String _nativeScript = '';
@@ -80,10 +77,12 @@
* If the execution environment does not support [executable] an empty
* string is returned.
*/
- static String get executable => _nativeExecutable;
+ static String get executable => _Platform.executable;
/**
- * Returns the path of the script being run in this isolate.
+ * Returns the URI (in String form) of the script being run in this
+ * isolate. If the URI is relative it is relative to the file URI of
+ * the working directory of the VM when it was started.
*
* If the executable environment does not support [script] an empty
* string is returned.
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart
index b9bae78..94d67b6 100644
--- a/sdk/lib/io/platform_impl.dart
+++ b/sdk/lib/io/platform_impl.dart
@@ -9,6 +9,7 @@
external static String _pathSeparator();
external static String _operatingSystem();
external static _localHostname();
+ external static _executable();
external static _environment();
external static String _version();
@@ -25,6 +26,8 @@
}
}
+ static String executable = _executable();
+
static Map<String, String> get environment {
var env = _environment();
if (env is OSError) {
diff --git a/sdk/lib/io/string_transformer.dart b/sdk/lib/io/string_transformer.dart
index 4f18b99..56e322c 100644
--- a/sdk/lib/io/string_transformer.dart
+++ b/sdk/lib/io/string_transformer.dart
@@ -259,63 +259,19 @@
return bytes;
}
+// TODO(floitsch) Remove usage of LineTransformer
+// TODO(kevmoo) Remove usage of LineTransformer
+/**
+ * Use [LineSplitter] from `dart:convert` instead.
+ *
+ * [LineTransformer] will be removed the 28 August 2013.
+ */
+ @deprecated
+ class LineTransformer implements StreamTransformer<String, String> {
+ final _decoder = new LineSplitter();
-class LineTransformer extends StreamEventTransformer<String, String> {
- static const int _LF = 10;
- static const int _CR = 13;
-
- StringBuffer _buffer = new StringBuffer();
- String _carry;
-
- void _handle(String data, EventSink<String> sink, bool isClosing) {
- if (_carry != null) {
- data = _carry + data;
- _carry = null;
- }
- int startPos = 0;
- int pos = 0;
- while (pos < data.length) {
- int skip = 0;
- int char = data.codeUnitAt(pos);
- if (char == _LF) {
- skip = 1;
- } else if (char == _CR) {
- skip = 1;
- if (pos + 1 < data.length) {
- if (data.codeUnitAt(pos + 1) == _LF) {
- skip = 2;
- }
- } else if (!isClosing) {
- _carry = data.substring(startPos);
- return;
- }
- }
- if (skip > 0) {
- _buffer.write(data.substring(startPos, pos));
- sink.add(_buffer.toString());
- _buffer = new StringBuffer();
- startPos = pos = pos + skip;
- } else {
- pos++;
- }
- }
- if (pos != startPos) {
- // Add remaining
- _buffer.write(data.substring(startPos, pos));
- }
- if (isClosing && !_buffer.isEmpty) {
- sink.add(_buffer.toString());
- _buffer = new StringBuffer();
- }
- }
-
- void handleData(String data, EventSink<String> sink) {
- _handle(data, sink, false);
- }
-
- void handleDone(EventSink<String> sink) {
- _handle("", sink, true);
- sink.close();
+ Stream<String> bind(Stream<String> stream) {
+ return _decoder.bind(stream);
}
}
diff --git a/sdk/lib/mirrors/mirrors.dart b/sdk/lib/mirrors/mirrors.dart
index f189dc0..c41c6c2 100644
--- a/sdk/lib/mirrors/mirrors.dart
+++ b/sdk/lib/mirrors/mirrors.dart
@@ -118,17 +118,28 @@
external Future<MirrorSystem> mirrorSystemOf(SendPort port);
/**
- * Returns an [InstanceMirror] for some Dart language object.
+ * Returns an [InstanceMirror] reflecting [reflectee].
+ * If [reflectee] is function or an instance of a class
+ * that has a [:call:] method, the returned instance mirror
+ * will be a [ClosureMirror].
*
- * This only works with objects local to the current isolate.
+ * Note that since one cannot obtain an object from
+ * another isolate, this function can only be used to
+ * obtain mirrors on objects of the current isolate.
*/
external InstanceMirror reflect(Object reflectee);
/**
- * Returns a [ClassMirror] for the class represented by a Dart
- * Type object.
+ * Let *C* be the original class declaration of the class
+ * represented by [key].
+ * This function returns a [ClassMirror] reflecting *C*.
*
- * This only works with objects local to the current isolate.
+ * If [key] is not an instance of [Type] then this function
+ * throws an [ArgumentError].
+ *
+ * Note that since one cannot obtain a [Type] object from
+ * another isolate, this function can only be used to
+ * obtain class mirrors on classes of the current isolate.
*/
external ClassMirror reflectClass(Type key);
@@ -149,22 +160,27 @@
*/
abstract class IsolateMirror implements Mirror {
/**
- * A unique name used to refer to an isolate in debugging messages.
+ * Returns a unique name used to refer to an isolate
+ * in debugging messages.
*/
String get debugName;
/**
- * Does this mirror reflect the currently running isolate?
+ * Returns [:true:] if and only if this mirror reflects
+ * the currently running isolate. Otherwise returns
+ * [:false:].
*/
bool get isCurrent;
/**
- * A mirror on the root library for this isolate.
+ * Returns a [LibraryMirror] on the root library for this
+ * isolate.
*/
LibraryMirror get rootLibrary;
/**
- * Returns true if this mirror is equal to [other].
+ * Returns [:true:] if this mirror is equal to [other].
+ * Otherwise returns [:false:].
* The equality holds if and only if
* (1) [other] is a mirror of the same kind
* and
@@ -210,20 +226,28 @@
* immediately surrounding the reflectee.
*
* For a library, the owner is [:null:].
- * For a class, typedef or top level function or variable, the owner is
- * the enclosing library. For a method, instance variable or
- * a static variable, the owner is the immediately enclosing class.
+ * For a class declaration, typedef or top level function
+ * or variable, the owner is the enclosing library.
+ * For a mixin application *S with M*, the owner is the owner
+ * of *M*.
+ * For class Null, the owner is the dart:core library.
+ * For a constructor, the owner is the immediately enclosing class.
+ * For a method, instance variable or
+ * a static variable, the owner is the immediately enclosing class,
+ * unless the class is a mixin application *S with M*, in which case
+ * the owner is *M*. Note that *M* may be an invocation of a generic.
* For a parameter, local variable or local function the owner is the
* immediately enclosing function.
*/
DeclarationMirror get owner;
/**
- * Is this declaration private?
- *
- * A declaration is private if and only if it is considered private
+ * Returns [:true:] if this declaration is considered private
* according to the Dart language specification.
- * Note that for libraries, this will be [:false:].
+ * Always returns [: false :] if this declaration
+ * is a library.
+ * Otherwise return [:false:].
+ *
*/
bool get isPrivate;
@@ -452,7 +476,7 @@
* mirror reflects a simple value.
*
* A value is simple if one of the following holds:
- * - the value is null
+ * - the value is [:null:]
* - the value is of type [num]
* - the value is of type [bool]
* - the value is of type [String]
@@ -632,7 +656,8 @@
Map<Symbol, VariableMirror> get variables;
/**
- * Returns true if this mirror is equal to [other].
+ * Returns [:true:] if this mirror is equal to [other].
+ * Otherwise returns [:false:].
*
* The equality holds if and only if
* (1) [other] is a mirror of the same kind
@@ -715,6 +740,11 @@
/**
* An immutable map from names to mirrors for all type variables for
* this type.
+ * If this type is a generic declaration or an invocation of
+ * a generic declaration, the returned map has the names of the formal
+ * type parameters of the original declaration as its keys, and
+ * each such key maps to a TypeVariableMirror on the corresponding
+ * type variable. Otherwise, the returned map is empty.
*
* This map preserves the order of declaration of the type variables.
*/
@@ -722,8 +752,15 @@
/**
* An immutable map from names to mirrors for all type arguments for
- * this type.
- *
+ * this type. The keys of the map are the names of the
+ * corresponding type variables.
+ *
+ * If the the reflectee is an invocation of a generic class,
+ * the type arguments are the bindings of its type parameters.
+ * If the reflectee is the original declaration of a generic,
+ * it has no type arguments and this method returns an empty map.
+ * If the reflectee is a not generic, then
+ * it has no type arguments and this method returns an empty map.
* This map preserves the order of declaration of the type variables.
*/
Map<Symbol, TypeMirror> get typeArguments;
@@ -821,28 +858,17 @@
[Map<Symbol, dynamic> namedArguments]);
/**
- * Does this mirror represent a class?
- *
- * TODO(turnidge): This functions goes away after the
- * class/interface changes.
- */
- bool get isClass;
-
- /**
- * A mirror on the default factory class or null if there is none.
- *
- * TODO(turnidge): This functions goes away after the
- * class/interface changes.
- */
- ClassMirror get defaultFactory;
-
- /**
- * Returns true if this mirror is equal to [other].
+ * Returns [:true:] if this mirror is equal to [other].
+ * Otherwise returns [:false:].
*
* The equality holds if and only if
* (1) [other] is a mirror of the same kind
* and
* (2) This mirror and [other] reflect the same class.
+ *
+ * Note that if the reflected class is an invocation of
+ * a generic class,(2) implies that the reflected class
+ * and [other] have equal type arguments.
*/
bool operator == (other);
}
@@ -853,19 +879,17 @@
*/
abstract class FunctionTypeMirror implements ClassMirror {
/**
- * The return type of the reflectee.
+ * Returns the return type of the reflectee.
*/
TypeMirror get returnType;
/**
- * A list of the parameter types of the reflectee.
+ * Returns a list of the parameter types of the reflectee.
*/
List<ParameterMirror> get parameters;
/**
* A mirror on the [:call:] method for the reflectee.
- *
- * TODO(turnidge): What is this and what is it for?
*/
MethodMirror get callMethod;
}
@@ -881,7 +905,8 @@
TypeMirror get upperBound;
/**
- * Returns true if this mirror is equal to [other].
+ * Returns [:true:] if this mirror is equal to [other].
+ * Otherwise returns [:false:].
*
* The equality holds if and only if
* (1) [other] is a mirror of the same kind
@@ -1009,12 +1034,13 @@
*/
abstract class VariableMirror implements DeclarationMirror {
/**
- * A mirror on the type of the reflectee.
+ * Returns a mirror on the type of the reflectee.
*/
TypeMirror get type;
/**
- * Is the reflectee a static variable?
+ * Returns [:true:] if the reflectee is a static variable.
+ * Otherwise returns [:false:].
*
* For the purposes of the mirror library, top-level variables are
* implicitly declared static.
@@ -1022,7 +1048,8 @@
bool get isStatic;
/**
- * Is the reflectee a final variable?
+ * Returns [:true:] if the reflectee is a final variable.
+ * Otherwise returns [:false:].
*/
bool get isFinal;
@@ -1048,17 +1075,20 @@
TypeMirror get type;
/**
- * Is this parameter optional?
+ * Returns [:true:] if the reflectee is an optional parameter.
+ * Otherwise returns [:false:].
*/
bool get isOptional;
/**
- * Is this parameter named?
+ * Returns [:true:] if the reflectee is a named parameter.
+ * Otherwise returns [:false:].
*/
bool get isNamed;
/**
- * Does this parameter have a default value?
+ * Returns [:true:] if the reflectee has a default value.
+ * Otherwise returns [:false:].
*/
bool get hasDefaultValue;
diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart
index ba93b3a..359a71c 100644
--- a/sdk/lib/svg/dart2js/svg_dart2js.dart
+++ b/sdk/lib/svg/dart2js/svg_dart2js.dart
@@ -64,7 +64,7 @@
@DocsEditable()
@DomName('SVGAElement')
@Unstable()
-class AElement extends StyledElement implements Transformable, ExternalResourcesRequired, UriReference, Tests, LangSpace native "SVGAElement" {
+class AElement extends GraphicsElement implements UriReference, ExternalResourcesRequired native "SVGAElement" {
// To suppress missing implicit constructor warnings.
factory AElement._() { throw new UnsupportedError("Not supported"); }
@@ -82,68 +82,6 @@
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
- // From SVGLangSpace
-
- @DomName('SVGAElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGAElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGAElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGAElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGAElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGAElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGAElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGAElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGAElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGAElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGAElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGAElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGAElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
-
// From SVGURIReference
@DomName('SVGAElement.href')
@@ -530,7 +468,7 @@
@DocsEditable()
@DomName('SVGAnimationElement')
@Unstable()
-class AnimationElement extends SvgElement implements ExternalResourcesRequired, ElementTimeControl, Tests native "SVGAnimationElement" {
+class AnimationElement extends SvgElement implements ExternalResourcesRequired, Tests native "SVGAnimationElement" {
// To suppress missing implicit constructor warnings.
factory AnimationElement._() { throw new UnsupportedError("Not supported"); }
@@ -542,20 +480,6 @@
@DocsEditable()
final SvgElement targetElement;
- @DomName('SVGAnimationElement.getCurrentTime')
- @DocsEditable()
- num getCurrentTime() native;
-
- @DomName('SVGAnimationElement.getSimpleDuration')
- @DocsEditable()
- num getSimpleDuration() native;
-
- @DomName('SVGAnimationElement.getStartTime')
- @DocsEditable()
- num getStartTime() native;
-
- // From ElementTimeControl
-
@DomName('SVGAnimationElement.beginElement')
@DocsEditable()
void beginElement() native;
@@ -572,6 +496,18 @@
@DocsEditable()
void endElementAt(num offset) native;
+ @DomName('SVGAnimationElement.getCurrentTime')
+ @DocsEditable()
+ num getCurrentTime() native;
+
+ @DomName('SVGAnimationElement.getSimpleDuration')
+ @DocsEditable()
+ num getSimpleDuration() native;
+
+ @DomName('SVGAnimationElement.getStartTime')
+ @DocsEditable()
+ num getStartTime() native;
+
// From SVGExternalResourcesRequired
@DomName('SVGAnimationElement.externalResourcesRequired')
@@ -604,7 +540,7 @@
@DocsEditable()
@DomName('SVGCircleElement')
@Unstable()
-class CircleElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGCircleElement" {
+class CircleElement extends GraphicsElement implements ExternalResourcesRequired native "SVGCircleElement" {
// To suppress missing implicit constructor warnings.
factory CircleElement._() { throw new UnsupportedError("Not supported"); }
@@ -629,68 +565,6 @@
@DomName('SVGCircleElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGCircleElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGCircleElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGCircleElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGCircleElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGCircleElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGCircleElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGCircleElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGCircleElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGCircleElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGCircleElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGCircleElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGCircleElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGCircleElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -700,7 +574,7 @@
@DocsEditable()
@DomName('SVGClipPathElement')
@Unstable()
-class ClipPathElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGClipPathElement" {
+class ClipPathElement extends GraphicsElement implements ExternalResourcesRequired native "SVGClipPathElement" {
// To suppress missing implicit constructor warnings.
factory ClipPathElement._() { throw new UnsupportedError("Not supported"); }
@@ -717,68 +591,6 @@
@DomName('SVGClipPathElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGClipPathElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGClipPathElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGClipPathElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGClipPathElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGClipPathElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGClipPathElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGClipPathElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGClipPathElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGClipPathElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGClipPathElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGClipPathElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGClipPathElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGClipPathElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -788,7 +600,7 @@
@DocsEditable()
@DomName('SVGDefsElement')
@Unstable()
-class DefsElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGDefsElement" {
+class DefsElement extends GraphicsElement implements ExternalResourcesRequired native "SVGDefsElement" {
// To suppress missing implicit constructor warnings.
factory DefsElement._() { throw new UnsupportedError("Not supported"); }
@@ -801,68 +613,6 @@
@DomName('SVGDefsElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGDefsElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGDefsElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGDefsElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGDefsElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGDefsElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGDefsElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGDefsElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGDefsElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGDefsElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGDefsElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGDefsElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGDefsElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGDefsElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -872,23 +622,13 @@
@DocsEditable()
@DomName('SVGDescElement')
@Unstable()
-class DescElement extends StyledElement implements LangSpace native "SVGDescElement" {
+class DescElement extends StyledElement native "SVGDescElement" {
// To suppress missing implicit constructor warnings.
factory DescElement._() { throw new UnsupportedError("Not supported"); }
@DomName('SVGDescElement.SVGDescElement')
@DocsEditable()
factory DescElement() => _SvgElementFactoryProvider.createSvgElement_tag("desc");
-
- // From SVGLangSpace
-
- @DomName('SVGDescElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGDescElement.xmlspace')
- @DocsEditable()
- String xmlspace;
}
// 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
@@ -1006,6 +746,16 @@
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseDownEvent = const EventStreamProvider<MouseEvent>('mousedown');
+ @DomName('SVGElementInstance.mouseenterEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseEnterEvent = const EventStreamProvider<MouseEvent>('mouseenter');
+
+ @DomName('SVGElementInstance.mouseleaveEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseLeaveEvent = const EventStreamProvider<MouseEvent>('mouseleave');
+
@DomName('SVGElementInstance.mousemoveEvent')
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseMoveEvent = const EventStreamProvider<MouseEvent>('mousemove');
@@ -1098,6 +848,25 @@
@DocsEditable()
final ElementInstance previousSibling;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('SVGElementInstance.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('SVGElementInstance.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('SVGElementInstance.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('SVGElementInstance.onabort')
@DocsEditable()
Stream<Event> get onAbort => abortEvent.forTarget(this);
@@ -1202,6 +971,16 @@
@DocsEditable()
Stream<MouseEvent> get onMouseDown => mouseDownEvent.forTarget(this);
+ @DomName('SVGElementInstance.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseEnter => mouseEnterEvent.forTarget(this);
+
+ @DomName('SVGElementInstance.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseLeave => mouseLeaveEvent.forTarget(this);
+
@DomName('SVGElementInstance.onmousemove')
@DocsEditable()
Stream<MouseEvent> get onMouseMove => mouseMoveEvent.forTarget(this);
@@ -1268,7 +1047,7 @@
@DocsEditable()
@DomName('SVGEllipseElement')
@Unstable()
-class EllipseElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGEllipseElement" {
+class EllipseElement extends GraphicsElement implements ExternalResourcesRequired native "SVGEllipseElement" {
// To suppress missing implicit constructor warnings.
factory EllipseElement._() { throw new UnsupportedError("Not supported"); }
@@ -1297,68 +1076,6 @@
@DomName('SVGEllipseElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGEllipseElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGEllipseElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGEllipseElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGEllipseElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGEllipseElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGEllipseElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGEllipseElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGEllipseElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGEllipseElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGEllipseElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGEllipseElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGEllipseElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGEllipseElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -2172,7 +1889,7 @@
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
@Unstable()
-class FEImageElement extends StyledElement implements FilterPrimitiveStandardAttributes, UriReference, ExternalResourcesRequired, LangSpace native "SVGFEImageElement" {
+class FEImageElement extends StyledElement implements FilterPrimitiveStandardAttributes, UriReference, ExternalResourcesRequired native "SVGFEImageElement" {
// To suppress missing implicit constructor warnings.
factory FEImageElement._() { throw new UnsupportedError("Not supported"); }
@@ -2215,16 +1932,6 @@
@DocsEditable()
final AnimatedLength y;
- // From SVGLangSpace
-
- @DomName('SVGFEImageElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGFEImageElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
// From SVGURIReference
@DomName('SVGFEImageElement.href')
@@ -2735,7 +2442,7 @@
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
@Unstable()
-class FilterElement extends StyledElement implements UriReference, ExternalResourcesRequired, LangSpace native "SVGFilterElement" {
+class FilterElement extends StyledElement implements UriReference, ExternalResourcesRequired native "SVGFilterElement" {
// To suppress missing implicit constructor warnings.
factory FilterElement._() { throw new UnsupportedError("Not supported"); }
@@ -2788,16 +2495,6 @@
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
- // From SVGLangSpace
-
- @DomName('SVGFilterElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGFilterElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
// From SVGURIReference
@DomName('SVGFilterElement.href')
@@ -2849,7 +2546,7 @@
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Unstable()
-class ForeignObjectElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGForeignObjectElement" {
+class ForeignObjectElement extends GraphicsElement implements ExternalResourcesRequired native "SVGForeignObjectElement" {
// To suppress missing implicit constructor warnings.
factory ForeignObjectElement._() { throw new UnsupportedError("Not supported"); }
@@ -2881,68 +2578,6 @@
@DomName('SVGForeignObjectElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGForeignObjectElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGForeignObjectElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGForeignObjectElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGForeignObjectElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGForeignObjectElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGForeignObjectElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGForeignObjectElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGForeignObjectElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGForeignObjectElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGForeignObjectElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGForeignObjectElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGForeignObjectElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGForeignObjectElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -2952,7 +2587,7 @@
@DocsEditable()
@DomName('SVGGElement')
@Unstable()
-class GElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGGElement" {
+class GElement extends GraphicsElement implements ExternalResourcesRequired native "SVGGElement" {
// To suppress missing implicit constructor warnings.
factory GElement._() { throw new UnsupportedError("Not supported"); }
@@ -2965,68 +2600,77 @@
@DomName('SVGGElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
+}
+// 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.
- // From SVGLangSpace
- @DomName('SVGGElement.xmllang')
+@DocsEditable()
+@DomName('SVGGraphicsElement')
+@Experimental() // untriaged
+class GraphicsElement extends StyledElement implements Tests native "SVGGraphicsElement" {
+ // To suppress missing implicit constructor warnings.
+ factory GraphicsElement._() { throw new UnsupportedError("Not supported"); }
+
+ @DomName('SVGGraphicsElement.farthestViewportElement')
@DocsEditable()
- String xmllang;
-
- @DomName('SVGGElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGGElement.farthestViewportElement')
- @DocsEditable()
+ @Experimental() // untriaged
final SvgElement farthestViewportElement;
- @DomName('SVGGElement.nearestViewportElement')
+ @DomName('SVGGraphicsElement.nearestViewportElement')
@DocsEditable()
+ @Experimental() // untriaged
final SvgElement nearestViewportElement;
- @DomName('SVGGElement.getBBox')
+ @DomName('SVGGraphicsElement.transform')
@DocsEditable()
+ @Experimental() // untriaged
+ final AnimatedTransformList transform;
+
+ @DomName('SVGGraphicsElement.getBBox')
+ @DocsEditable()
+ @Experimental() // untriaged
Rect getBBox() native;
@JSName('getCTM')
- @DomName('SVGGElement.getCTM')
+ @DomName('SVGGraphicsElement.getCTM')
@DocsEditable()
+ @Experimental() // untriaged
Matrix getCtm() native;
@JSName('getScreenCTM')
- @DomName('SVGGElement.getScreenCTM')
+ @DomName('SVGGraphicsElement.getScreenCTM')
@DocsEditable()
+ @Experimental() // untriaged
Matrix getScreenCtm() native;
- @DomName('SVGGElement.getTransformToElement')
+ @DomName('SVGGraphicsElement.getTransformToElement')
@DocsEditable()
+ @Experimental() // untriaged
Matrix getTransformToElement(SvgElement element) native;
// From SVGTests
- @DomName('SVGGElement.requiredExtensions')
+ @DomName('SVGGraphicsElement.requiredExtensions')
@DocsEditable()
+ @Experimental() // untriaged
final StringList requiredExtensions;
- @DomName('SVGGElement.requiredFeatures')
+ @DomName('SVGGraphicsElement.requiredFeatures')
@DocsEditable()
+ @Experimental() // untriaged
final StringList requiredFeatures;
- @DomName('SVGGElement.systemLanguage')
+ @DomName('SVGGraphicsElement.systemLanguage')
@DocsEditable()
+ @Experimental() // untriaged
final StringList systemLanguage;
- @DomName('SVGGElement.hasExtension')
+ @DomName('SVGGraphicsElement.hasExtension')
@DocsEditable()
+ @Experimental() // untriaged
bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGGElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -3036,7 +2680,7 @@
@DocsEditable()
@DomName('SVGImageElement')
@Unstable()
-class ImageElement extends StyledElement implements Transformable, ExternalResourcesRequired, UriReference, Tests, LangSpace native "SVGImageElement" {
+class ImageElement extends GraphicsElement implements UriReference, ExternalResourcesRequired native "SVGImageElement" {
// To suppress missing implicit constructor warnings.
factory ImageElement._() { throw new UnsupportedError("Not supported"); }
@@ -3070,68 +2714,6 @@
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
- // From SVGLangSpace
-
- @DomName('SVGImageElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGImageElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGImageElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGImageElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGImageElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGImageElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGImageElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGImageElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGImageElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGImageElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGImageElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGImageElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGImageElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
-
// From SVGURIReference
@DomName('SVGImageElement.href')
@@ -3144,23 +2726,6 @@
@DocsEditable()
-@DomName('SVGLangSpace')
-@Unstable()
-abstract class LangSpace extends Interceptor {
-
- /// Checks if this type is supported on the current platform.
- static bool supported(SvgElement element) => JS('bool', '#.xmlspace !== undefined && #.xmllang !== undefined', element, element);
-
- String xmllang;
-
- String xmlspace;
-}
-// 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('SVGLength')
@Unstable()
class Length extends Interceptor native "SVGLength" {
@@ -3329,7 +2894,7 @@
@DocsEditable()
@DomName('SVGLineElement')
@Unstable()
-class LineElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGLineElement" {
+class LineElement extends GraphicsElement implements ExternalResourcesRequired native "SVGLineElement" {
// To suppress missing implicit constructor warnings.
factory LineElement._() { throw new UnsupportedError("Not supported"); }
@@ -3358,68 +2923,6 @@
@DomName('SVGLineElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGLineElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGLineElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGLineElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGLineElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGLineElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGLineElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGLineElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGLineElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGLineElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGLineElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGLineElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGLineElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGLineElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -3459,31 +2962,9 @@
@DocsEditable()
-@DomName('SVGLocatable')
-@Unstable()
-abstract class Locatable extends Interceptor {
-
- SvgElement farthestViewportElement;
-
- SvgElement nearestViewportElement;
-
- Rect getBBox();
-
- Matrix getCTM();
-
- Matrix getScreenCTM();
-
- Matrix getTransformToElement(SvgElement element);
-}
-// 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('SVGMarkerElement')
@Unstable()
-class MarkerElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired, LangSpace native "SVGMarkerElement" {
+class MarkerElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired native "SVGMarkerElement" {
// To suppress missing implicit constructor warnings.
factory MarkerElement._() { throw new UnsupportedError("Not supported"); }
@@ -3566,16 +3047,6 @@
@DomName('SVGMarkerElement.viewBox')
@DocsEditable()
final AnimatedRect viewBox;
-
- // From SVGLangSpace
-
- @DomName('SVGMarkerElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGMarkerElement.xmlspace')
- @DocsEditable()
- String xmlspace;
}
// 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
@@ -3585,7 +3056,7 @@
@DocsEditable()
@DomName('SVGMaskElement')
@Unstable()
-class MaskElement extends StyledElement implements ExternalResourcesRequired, Tests, LangSpace native "SVGMaskElement" {
+class MaskElement extends StyledElement implements ExternalResourcesRequired, Tests native "SVGMaskElement" {
// To suppress missing implicit constructor warnings.
factory MaskElement._() { throw new UnsupportedError("Not supported"); }
@@ -3623,16 +3094,6 @@
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
- // From SVGLangSpace
-
- @DomName('SVGMaskElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGMaskElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
// From SVGTests
@DomName('SVGMaskElement.requiredExtensions')
@@ -3851,7 +3312,7 @@
@DocsEditable()
@DomName('SVGPathElement')
@Unstable()
-class PathElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGPathElement" {
+class PathElement extends GraphicsElement implements ExternalResourcesRequired native "SVGPathElement" {
// To suppress missing implicit constructor warnings.
factory PathElement._() { throw new UnsupportedError("Not supported"); }
@@ -3991,68 +3452,6 @@
@DomName('SVGPathElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGPathElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGPathElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGPathElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGPathElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGPathElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGPathElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGPathElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGPathElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGPathElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGPathElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGPathElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGPathElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGPathElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -4708,7 +4107,7 @@
@DocsEditable()
@DomName('SVGPatternElement')
@Unstable()
-class PatternElement extends StyledElement implements FitToViewBox, UriReference, ExternalResourcesRequired, Tests, LangSpace native "SVGPatternElement" {
+class PatternElement extends StyledElement implements FitToViewBox, UriReference, ExternalResourcesRequired, Tests native "SVGPatternElement" {
// To suppress missing implicit constructor warnings.
factory PatternElement._() { throw new UnsupportedError("Not supported"); }
@@ -4760,16 +4159,6 @@
@DocsEditable()
final AnimatedRect viewBox;
- // From SVGLangSpace
-
- @DomName('SVGPatternElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGPatternElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
// From SVGTests
@DomName('SVGPatternElement.requiredExtensions')
@@ -4866,7 +4255,7 @@
@DocsEditable()
@DomName('SVGPolygonElement')
@Unstable()
-class PolygonElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGPolygonElement" {
+class PolygonElement extends GraphicsElement implements ExternalResourcesRequired native "SVGPolygonElement" {
// To suppress missing implicit constructor warnings.
factory PolygonElement._() { throw new UnsupportedError("Not supported"); }
@@ -4887,68 +4276,6 @@
@DomName('SVGPolygonElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGPolygonElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGPolygonElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGPolygonElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGPolygonElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGPolygonElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGPolygonElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGPolygonElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGPolygonElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGPolygonElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGPolygonElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGPolygonElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGPolygonElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGPolygonElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -4958,7 +4285,7 @@
@DocsEditable()
@DomName('SVGPolylineElement')
@Unstable()
-class PolylineElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGPolylineElement" {
+class PolylineElement extends GraphicsElement implements ExternalResourcesRequired native "SVGPolylineElement" {
// To suppress missing implicit constructor warnings.
factory PolylineElement._() { throw new UnsupportedError("Not supported"); }
@@ -4979,68 +4306,6 @@
@DomName('SVGPolylineElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGPolylineElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGPolylineElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGPolylineElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGPolylineElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGPolylineElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGPolylineElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGPolylineElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGPolylineElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGPolylineElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGPolylineElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGPolylineElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGPolylineElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGPolylineElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -5190,7 +4455,7 @@
@DocsEditable()
@DomName('SVGRectElement')
@Unstable()
-class RectElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGRectElement" {
+class RectElement extends GraphicsElement implements ExternalResourcesRequired native "SVGRectElement" {
// To suppress missing implicit constructor warnings.
factory RectElement._() { throw new UnsupportedError("Not supported"); }
@@ -5227,68 +4492,6 @@
@DomName('SVGRectElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGRectElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGRectElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGRectElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGRectElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGRectElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGRectElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGRectElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGRectElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGRectElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGRectElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGRectElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGRectElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGRectElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -5496,7 +4699,7 @@
@DomName('SVGStyleElement')
// http://www.w3.org/TR/SVG/types.html#InterfaceSVGStylable
@Experimental() // nonstandard
-class StyleElement extends SvgElement implements LangSpace native "SVGStyleElement" {
+class StyleElement extends SvgElement native "SVGStyleElement" {
// To suppress missing implicit constructor warnings.
factory StyleElement._() { throw new UnsupportedError("Not supported"); }
@@ -5522,16 +4725,6 @@
@DomName('SVGStyleElement.type')
@DocsEditable()
String type;
-
- // From SVGLangSpace
-
- @DomName('SVGStyleElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGStyleElement.xmlspace')
- @DocsEditable()
- String xmlspace;
}
// 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
@@ -5707,6 +4900,16 @@
@DocsEditable()
String xmlbase;
+ @DomName('SVGElement.xmllang')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String xmllang;
+
+ @DomName('SVGElement.xmlspace')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String xmlspace;
+
}
// 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
@@ -5715,7 +4918,7 @@
@DomName('SVGSVGElement')
@Unstable()
-class SvgSvgElement extends StyledElement implements FitToViewBox, Transformable, Tests, ExternalResourcesRequired, ZoomAndPan, LangSpace native "SVGSVGElement" {
+class SvgSvgElement extends GraphicsElement implements FitToViewBox, ExternalResourcesRequired, ZoomAndPan native "SVGSVGElement" {
factory SvgSvgElement() => _SvgSvgElementFactoryProvider.createSvgSvgElement();
// To suppress missing implicit constructor warnings.
@@ -5901,68 +5104,6 @@
@DocsEditable()
final AnimatedRect viewBox;
- // From SVGLangSpace
-
- @DomName('SVGSVGElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGSVGElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGSVGElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGSVGElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGSVGElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGSVGElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGSVGElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGSVGElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGSVGElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGSVGElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGSVGElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGSVGElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGSVGElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
-
// From SVGZoomAndPan
@DomName('SVGSVGElement.zoomAndPan')
@@ -5978,7 +5119,7 @@
@DocsEditable()
@DomName('SVGSwitchElement')
@Unstable()
-class SwitchElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace native "SVGSwitchElement" {
+class SwitchElement extends GraphicsElement implements ExternalResourcesRequired native "SVGSwitchElement" {
// To suppress missing implicit constructor warnings.
factory SwitchElement._() { throw new UnsupportedError("Not supported"); }
@@ -5991,68 +5132,6 @@
@DomName('SVGSwitchElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGSwitchElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGSwitchElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGSwitchElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGSwitchElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGSwitchElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGSwitchElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGSwitchElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGSwitchElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTests
-
- @DomName('SVGSwitchElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGSwitchElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGSwitchElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGSwitchElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native;
-
- // From SVGTransformable
-
- @DomName('SVGSwitchElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -6062,7 +5141,7 @@
@DocsEditable()
@DomName('SVGSymbolElement')
@Unstable()
-class SymbolElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired, LangSpace native "SVGSymbolElement" {
+class SymbolElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired native "SVGSymbolElement" {
// To suppress missing implicit constructor warnings.
factory SymbolElement._() { throw new UnsupportedError("Not supported"); }
@@ -6085,16 +5164,6 @@
@DomName('SVGSymbolElement.viewBox')
@DocsEditable()
final AnimatedRect viewBox;
-
- // From SVGLangSpace
-
- @DomName('SVGSymbolElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGSymbolElement.xmlspace')
- @DocsEditable()
- String xmlspace;
}
// 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
@@ -6138,7 +5207,7 @@
@DocsEditable()
@DomName('SVGTextContentElement')
@Unstable()
-class TextContentElement extends StyledElement implements ExternalResourcesRequired, Tests, LangSpace native "SVGTextContentElement" {
+class TextContentElement extends GraphicsElement implements ExternalResourcesRequired native "SVGTextContentElement" {
// To suppress missing implicit constructor warnings.
factory TextContentElement._() { throw new UnsupportedError("Not supported"); }
@@ -6203,34 +5272,6 @@
@DomName('SVGTextContentElement.externalResourcesRequired')
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
-
- // From SVGLangSpace
-
- @DomName('SVGTextContentElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGTextContentElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGTests
-
- @DomName('SVGTextContentElement.requiredExtensions')
- @DocsEditable()
- final StringList requiredExtensions;
-
- @DomName('SVGTextContentElement.requiredFeatures')
- @DocsEditable()
- final StringList requiredFeatures;
-
- @DomName('SVGTextContentElement.systemLanguage')
- @DocsEditable()
- final StringList systemLanguage;
-
- @DomName('SVGTextContentElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) 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
@@ -6240,47 +5281,13 @@
@DocsEditable()
@DomName('SVGTextElement')
@Unstable()
-class TextElement extends TextPositioningElement implements Transformable native "SVGTextElement" {
+class TextElement extends TextPositioningElement native "SVGTextElement" {
// To suppress missing implicit constructor warnings.
factory TextElement._() { throw new UnsupportedError("Not supported"); }
@DomName('SVGTextElement.SVGTextElement')
@DocsEditable()
factory TextElement() => _SvgElementFactoryProvider.createSvgElement_tag("text");
-
- // From SVGLocatable
-
- @DomName('SVGTextElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGTextElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGTextElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGTextElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGTextElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGTextElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
- // From SVGTransformable
-
- @DomName('SVGTextElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
}
// 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
@@ -6376,23 +5383,13 @@
@DocsEditable()
@DomName('SVGTitleElement')
@Unstable()
-class TitleElement extends StyledElement implements LangSpace native "SVGTitleElement" {
+class TitleElement extends StyledElement native "SVGTitleElement" {
// To suppress missing implicit constructor warnings.
factory TitleElement._() { throw new UnsupportedError("Not supported"); }
@DomName('SVGTitleElement.SVGTitleElement')
@DocsEditable()
factory TitleElement() => _SvgElementFactoryProvider.createSvgElement_tag("title");
-
- // From SVGLangSpace
-
- @DomName('SVGTitleElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGTitleElement.xmlspace')
- @DocsEditable()
- String xmlspace;
}
// 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
@@ -6571,32 +5568,6 @@
@DocsEditable()
-@DomName('SVGTransformable')
-@Unstable()
-abstract class Transformable extends Interceptor implements Locatable {
-
- AnimatedTransformList transform;
-
- // From SVGLocatable
-
- SvgElement farthestViewportElement;
-
- SvgElement nearestViewportElement;
-
- Rect getBBox();
-
- Matrix getCTM();
-
- Matrix getScreenCTM();
-
- Matrix getTransformToElement(SvgElement element);
-}
-// 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('SVGUnitTypes')
@Unstable()
class UnitTypes extends Interceptor native "SVGUnitTypes" {
@@ -6633,7 +5604,7 @@
@DocsEditable()
@DomName('SVGUseElement')
@Unstable()
-class UseElement extends StyledElement implements Transformable, ExternalResourcesRequired, UriReference, Tests, LangSpace native "SVGUseElement" {
+class UseElement extends GraphicsElement implements UriReference, ExternalResourcesRequired, Tests native "SVGUseElement" {
// To suppress missing implicit constructor warnings.
factory UseElement._() { throw new UnsupportedError("Not supported"); }
@@ -6671,44 +5642,6 @@
@DocsEditable()
final AnimatedBoolean externalResourcesRequired;
- // From SVGLangSpace
-
- @DomName('SVGUseElement.xmllang')
- @DocsEditable()
- String xmllang;
-
- @DomName('SVGUseElement.xmlspace')
- @DocsEditable()
- String xmlspace;
-
- // From SVGLocatable
-
- @DomName('SVGUseElement.farthestViewportElement')
- @DocsEditable()
- final SvgElement farthestViewportElement;
-
- @DomName('SVGUseElement.nearestViewportElement')
- @DocsEditable()
- final SvgElement nearestViewportElement;
-
- @DomName('SVGUseElement.getBBox')
- @DocsEditable()
- Rect getBBox() native;
-
- @JSName('getCTM')
- @DomName('SVGUseElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native;
-
- @JSName('getScreenCTM')
- @DomName('SVGUseElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native;
-
- @DomName('SVGUseElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native;
-
// From SVGTests
@DomName('SVGUseElement.requiredExtensions')
@@ -6727,12 +5660,6 @@
@DocsEditable()
bool hasExtension(String extension) native;
- // From SVGTransformable
-
- @DomName('SVGUseElement.transform')
- @DocsEditable()
- final AnimatedTransformList transform;
-
// From SVGURIReference
@DomName('SVGUseElement.href')
diff --git a/sdk/lib/svg/dartium/svg_dartium.dart b/sdk/lib/svg/dartium/svg_dartium.dart
index a4bea12..69dc8ab 100644
--- a/sdk/lib/svg/dartium/svg_dartium.dart
+++ b/sdk/lib/svg/dartium/svg_dartium.dart
@@ -63,7 +63,7 @@
@DocsEditable()
@DomName('SVGAElement')
@Unstable()
-class AElement extends StyledElement implements Transformable, ExternalResourcesRequired, UriReference, Tests, LangSpace {
+class AElement extends GraphicsElement implements UriReference, ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory AElement._() { throw new UnsupportedError("Not supported"); }
@@ -79,66 +79,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGAElement_externalResourcesRequired_Getter";
- @DomName('SVGAElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGAElement_xmllang_Getter";
-
- @DomName('SVGAElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGAElement_xmllang_Setter";
-
- @DomName('SVGAElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGAElement_xmlspace_Getter";
-
- @DomName('SVGAElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGAElement_xmlspace_Setter";
-
- @DomName('SVGAElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGAElement_farthestViewportElement_Getter";
-
- @DomName('SVGAElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGAElement_nearestViewportElement_Getter";
-
- @DomName('SVGAElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGAElement_getBBox_Callback";
-
- @DomName('SVGAElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGAElement_getCTM_Callback";
-
- @DomName('SVGAElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGAElement_getScreenCTM_Callback";
-
- @DomName('SVGAElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGAElement_getTransformToElement_Callback";
-
- @DomName('SVGAElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGAElement_requiredExtensions_Getter";
-
- @DomName('SVGAElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGAElement_requiredFeatures_Getter";
-
- @DomName('SVGAElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGAElement_systemLanguage_Getter";
-
- @DomName('SVGAElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGAElement_hasExtension_Callback";
-
- @DomName('SVGAElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGAElement_transform_Getter";
-
@DomName('SVGAElement.href')
@DocsEditable()
AnimatedString get href native "SVGAElement_href_Getter";
@@ -615,7 +555,7 @@
@DocsEditable()
@DomName('SVGAnimationElement')
@Unstable()
-class AnimationElement extends SvgElement implements ExternalResourcesRequired, ElementTimeControl, Tests {
+class AnimationElement extends SvgElement implements ExternalResourcesRequired, Tests {
// To suppress missing implicit constructor warnings.
factory AnimationElement._() { throw new UnsupportedError("Not supported"); }
@@ -627,18 +567,6 @@
@DocsEditable()
SvgElement get targetElement native "SVGAnimationElement_targetElement_Getter";
- @DomName('SVGAnimationElement.getCurrentTime')
- @DocsEditable()
- num getCurrentTime() native "SVGAnimationElement_getCurrentTime_Callback";
-
- @DomName('SVGAnimationElement.getSimpleDuration')
- @DocsEditable()
- num getSimpleDuration() native "SVGAnimationElement_getSimpleDuration_Callback";
-
- @DomName('SVGAnimationElement.getStartTime')
- @DocsEditable()
- num getStartTime() native "SVGAnimationElement_getStartTime_Callback";
-
@DomName('SVGAnimationElement.beginElement')
@DocsEditable()
void beginElement() native "SVGAnimationElement_beginElement_Callback";
@@ -655,6 +583,18 @@
@DocsEditable()
void endElementAt(num offset) native "SVGAnimationElement_endElementAt_Callback";
+ @DomName('SVGAnimationElement.getCurrentTime')
+ @DocsEditable()
+ num getCurrentTime() native "SVGAnimationElement_getCurrentTime_Callback";
+
+ @DomName('SVGAnimationElement.getSimpleDuration')
+ @DocsEditable()
+ num getSimpleDuration() native "SVGAnimationElement_getSimpleDuration_Callback";
+
+ @DomName('SVGAnimationElement.getStartTime')
+ @DocsEditable()
+ num getStartTime() native "SVGAnimationElement_getStartTime_Callback";
+
@DomName('SVGAnimationElement.externalResourcesRequired')
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGAnimationElement_externalResourcesRequired_Getter";
@@ -686,7 +626,7 @@
@DocsEditable()
@DomName('SVGCircleElement')
@Unstable()
-class CircleElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class CircleElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory CircleElement._() { throw new UnsupportedError("Not supported"); }
@@ -710,66 +650,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGCircleElement_externalResourcesRequired_Getter";
- @DomName('SVGCircleElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGCircleElement_xmllang_Getter";
-
- @DomName('SVGCircleElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGCircleElement_xmllang_Setter";
-
- @DomName('SVGCircleElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGCircleElement_xmlspace_Getter";
-
- @DomName('SVGCircleElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGCircleElement_xmlspace_Setter";
-
- @DomName('SVGCircleElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGCircleElement_farthestViewportElement_Getter";
-
- @DomName('SVGCircleElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGCircleElement_nearestViewportElement_Getter";
-
- @DomName('SVGCircleElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGCircleElement_getBBox_Callback";
-
- @DomName('SVGCircleElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGCircleElement_getCTM_Callback";
-
- @DomName('SVGCircleElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGCircleElement_getScreenCTM_Callback";
-
- @DomName('SVGCircleElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGCircleElement_getTransformToElement_Callback";
-
- @DomName('SVGCircleElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGCircleElement_requiredExtensions_Getter";
-
- @DomName('SVGCircleElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGCircleElement_requiredFeatures_Getter";
-
- @DomName('SVGCircleElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGCircleElement_systemLanguage_Getter";
-
- @DomName('SVGCircleElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGCircleElement_hasExtension_Callback";
-
- @DomName('SVGCircleElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGCircleElement_transform_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
@@ -781,7 +661,7 @@
@DocsEditable()
@DomName('SVGClipPathElement')
@Unstable()
-class ClipPathElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class ClipPathElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory ClipPathElement._() { throw new UnsupportedError("Not supported"); }
@@ -797,66 +677,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGClipPathElement_externalResourcesRequired_Getter";
- @DomName('SVGClipPathElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGClipPathElement_xmllang_Getter";
-
- @DomName('SVGClipPathElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGClipPathElement_xmllang_Setter";
-
- @DomName('SVGClipPathElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGClipPathElement_xmlspace_Getter";
-
- @DomName('SVGClipPathElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGClipPathElement_xmlspace_Setter";
-
- @DomName('SVGClipPathElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGClipPathElement_farthestViewportElement_Getter";
-
- @DomName('SVGClipPathElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGClipPathElement_nearestViewportElement_Getter";
-
- @DomName('SVGClipPathElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGClipPathElement_getBBox_Callback";
-
- @DomName('SVGClipPathElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGClipPathElement_getCTM_Callback";
-
- @DomName('SVGClipPathElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGClipPathElement_getScreenCTM_Callback";
-
- @DomName('SVGClipPathElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGClipPathElement_getTransformToElement_Callback";
-
- @DomName('SVGClipPathElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGClipPathElement_requiredExtensions_Getter";
-
- @DomName('SVGClipPathElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGClipPathElement_requiredFeatures_Getter";
-
- @DomName('SVGClipPathElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGClipPathElement_systemLanguage_Getter";
-
- @DomName('SVGClipPathElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGClipPathElement_hasExtension_Callback";
-
- @DomName('SVGClipPathElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGClipPathElement_transform_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
@@ -868,7 +688,7 @@
@DocsEditable()
@DomName('SVGDefsElement')
@Unstable()
-class DefsElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class DefsElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory DefsElement._() { throw new UnsupportedError("Not supported"); }
@@ -880,66 +700,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGDefsElement_externalResourcesRequired_Getter";
- @DomName('SVGDefsElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGDefsElement_xmllang_Getter";
-
- @DomName('SVGDefsElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGDefsElement_xmllang_Setter";
-
- @DomName('SVGDefsElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGDefsElement_xmlspace_Getter";
-
- @DomName('SVGDefsElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGDefsElement_xmlspace_Setter";
-
- @DomName('SVGDefsElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGDefsElement_farthestViewportElement_Getter";
-
- @DomName('SVGDefsElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGDefsElement_nearestViewportElement_Getter";
-
- @DomName('SVGDefsElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGDefsElement_getBBox_Callback";
-
- @DomName('SVGDefsElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGDefsElement_getCTM_Callback";
-
- @DomName('SVGDefsElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGDefsElement_getScreenCTM_Callback";
-
- @DomName('SVGDefsElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGDefsElement_getTransformToElement_Callback";
-
- @DomName('SVGDefsElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGDefsElement_requiredExtensions_Getter";
-
- @DomName('SVGDefsElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGDefsElement_requiredFeatures_Getter";
-
- @DomName('SVGDefsElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGDefsElement_systemLanguage_Getter";
-
- @DomName('SVGDefsElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGDefsElement_hasExtension_Callback";
-
- @DomName('SVGDefsElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGDefsElement_transform_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
@@ -951,7 +711,7 @@
@DocsEditable()
@DomName('SVGDescElement')
@Unstable()
-class DescElement extends StyledElement implements LangSpace {
+class DescElement extends StyledElement {
// To suppress missing implicit constructor warnings.
factory DescElement._() { throw new UnsupportedError("Not supported"); }
@@ -959,22 +719,6 @@
@DocsEditable()
factory DescElement() => _SvgElementFactoryProvider.createSvgElement_tag("desc");
- @DomName('SVGDescElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGDescElement_xmllang_Getter";
-
- @DomName('SVGDescElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGDescElement_xmllang_Setter";
-
- @DomName('SVGDescElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGDescElement_xmlspace_Getter";
-
- @DomName('SVGDescElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGDescElement_xmlspace_Setter";
-
}
// 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
@@ -1094,6 +838,16 @@
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseDownEvent = const EventStreamProvider<MouseEvent>('mousedown');
+ @DomName('SVGElementInstance.mouseenterEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseEnterEvent = const EventStreamProvider<MouseEvent>('mouseenter');
+
+ @DomName('SVGElementInstance.mouseleaveEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<MouseEvent> mouseLeaveEvent = const EventStreamProvider<MouseEvent>('mouseleave');
+
@DomName('SVGElementInstance.mousemoveEvent')
@DocsEditable()
static const EventStreamProvider<MouseEvent> mouseMoveEvent = const EventStreamProvider<MouseEvent>('mousemove');
@@ -1184,6 +938,21 @@
@DocsEditable()
ElementInstance get previousSibling native "SVGElementInstance_previousSibling_Getter";
+ @DomName('SVGElementInstance.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "SVGElementInstance_addEventListener_Callback";
+
+ @DomName('SVGElementInstance.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native "SVGElementInstance_dispatchEvent_Callback";
+
+ @DomName('SVGElementInstance.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "SVGElementInstance_removeEventListener_Callback";
+
@DomName('SVGElementInstance.onabort')
@DocsEditable()
Stream<Event> get onAbort => abortEvent.forTarget(this);
@@ -1288,6 +1057,16 @@
@DocsEditable()
Stream<MouseEvent> get onMouseDown => mouseDownEvent.forTarget(this);
+ @DomName('SVGElementInstance.onmouseenter')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseEnter => mouseEnterEvent.forTarget(this);
+
+ @DomName('SVGElementInstance.onmouseleave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<MouseEvent> get onMouseLeave => mouseLeaveEvent.forTarget(this);
+
@DomName('SVGElementInstance.onmousemove')
@DocsEditable()
Stream<MouseEvent> get onMouseMove => mouseMoveEvent.forTarget(this);
@@ -1357,7 +1136,7 @@
@DocsEditable()
@DomName('SVGEllipseElement')
@Unstable()
-class EllipseElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class EllipseElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory EllipseElement._() { throw new UnsupportedError("Not supported"); }
@@ -1385,66 +1164,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGEllipseElement_externalResourcesRequired_Getter";
- @DomName('SVGEllipseElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGEllipseElement_xmllang_Getter";
-
- @DomName('SVGEllipseElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGEllipseElement_xmllang_Setter";
-
- @DomName('SVGEllipseElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGEllipseElement_xmlspace_Getter";
-
- @DomName('SVGEllipseElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGEllipseElement_xmlspace_Setter";
-
- @DomName('SVGEllipseElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGEllipseElement_farthestViewportElement_Getter";
-
- @DomName('SVGEllipseElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGEllipseElement_nearestViewportElement_Getter";
-
- @DomName('SVGEllipseElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGEllipseElement_getBBox_Callback";
-
- @DomName('SVGEllipseElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGEllipseElement_getCTM_Callback";
-
- @DomName('SVGEllipseElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGEllipseElement_getScreenCTM_Callback";
-
- @DomName('SVGEllipseElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGEllipseElement_getTransformToElement_Callback";
-
- @DomName('SVGEllipseElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGEllipseElement_requiredExtensions_Getter";
-
- @DomName('SVGEllipseElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGEllipseElement_requiredFeatures_Getter";
-
- @DomName('SVGEllipseElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGEllipseElement_systemLanguage_Getter";
-
- @DomName('SVGEllipseElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGEllipseElement_hasExtension_Callback";
-
- @DomName('SVGEllipseElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGEllipseElement_transform_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
@@ -2289,7 +2008,7 @@
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
@Unstable()
-class FEImageElement extends StyledElement implements FilterPrimitiveStandardAttributes, UriReference, ExternalResourcesRequired, LangSpace {
+class FEImageElement extends StyledElement implements FilterPrimitiveStandardAttributes, UriReference, ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory FEImageElement._() { throw new UnsupportedError("Not supported"); }
@@ -2328,22 +2047,6 @@
@DocsEditable()
AnimatedLength get y native "SVGFEImageElement_y_Getter";
- @DomName('SVGFEImageElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGFEImageElement_xmllang_Getter";
-
- @DomName('SVGFEImageElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGFEImageElement_xmllang_Setter";
-
- @DomName('SVGFEImageElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGFEImageElement_xmlspace_Getter";
-
- @DomName('SVGFEImageElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGFEImageElement_xmlspace_Setter";
-
@DomName('SVGFEImageElement.href')
@DocsEditable()
AnimatedString get href native "SVGFEImageElement_href_Getter";
@@ -2870,7 +2573,7 @@
@SupportedBrowser(SupportedBrowser.IE, '10')
@SupportedBrowser(SupportedBrowser.SAFARI)
@Unstable()
-class FilterElement extends StyledElement implements UriReference, ExternalResourcesRequired, LangSpace {
+class FilterElement extends StyledElement implements UriReference, ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory FilterElement._() { throw new UnsupportedError("Not supported"); }
@@ -2921,22 +2624,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGFilterElement_externalResourcesRequired_Getter";
- @DomName('SVGFilterElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGFilterElement_xmllang_Getter";
-
- @DomName('SVGFilterElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGFilterElement_xmllang_Setter";
-
- @DomName('SVGFilterElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGFilterElement_xmlspace_Getter";
-
- @DomName('SVGFilterElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGFilterElement_xmlspace_Setter";
-
@DomName('SVGFilterElement.href')
@DocsEditable()
AnimatedString get href native "SVGFilterElement_href_Getter";
@@ -3009,7 +2696,7 @@
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Unstable()
-class ForeignObjectElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class ForeignObjectElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory ForeignObjectElement._() { throw new UnsupportedError("Not supported"); }
@@ -3040,66 +2727,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGForeignObjectElement_externalResourcesRequired_Getter";
- @DomName('SVGForeignObjectElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGForeignObjectElement_xmllang_Getter";
-
- @DomName('SVGForeignObjectElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGForeignObjectElement_xmllang_Setter";
-
- @DomName('SVGForeignObjectElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGForeignObjectElement_xmlspace_Getter";
-
- @DomName('SVGForeignObjectElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGForeignObjectElement_xmlspace_Setter";
-
- @DomName('SVGForeignObjectElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGForeignObjectElement_farthestViewportElement_Getter";
-
- @DomName('SVGForeignObjectElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGForeignObjectElement_nearestViewportElement_Getter";
-
- @DomName('SVGForeignObjectElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGForeignObjectElement_getBBox_Callback";
-
- @DomName('SVGForeignObjectElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGForeignObjectElement_getCTM_Callback";
-
- @DomName('SVGForeignObjectElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGForeignObjectElement_getScreenCTM_Callback";
-
- @DomName('SVGForeignObjectElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGForeignObjectElement_getTransformToElement_Callback";
-
- @DomName('SVGForeignObjectElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGForeignObjectElement_requiredExtensions_Getter";
-
- @DomName('SVGForeignObjectElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGForeignObjectElement_requiredFeatures_Getter";
-
- @DomName('SVGForeignObjectElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGForeignObjectElement_systemLanguage_Getter";
-
- @DomName('SVGForeignObjectElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGForeignObjectElement_hasExtension_Callback";
-
- @DomName('SVGForeignObjectElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGForeignObjectElement_transform_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
@@ -3111,7 +2738,7 @@
@DocsEditable()
@DomName('SVGGElement')
@Unstable()
-class GElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class GElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory GElement._() { throw new UnsupportedError("Not supported"); }
@@ -3123,65 +2750,75 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGGElement_externalResourcesRequired_Getter";
- @DomName('SVGGElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGGElement_xmllang_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.
- @DomName('SVGGElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGGElement_xmllang_Setter";
+// WARNING: Do not edit - generated code.
- @DomName('SVGGElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGGElement_xmlspace_Getter";
- @DomName('SVGGElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGGElement_xmlspace_Setter";
+@DocsEditable()
+@DomName('SVGGraphicsElement')
+@Experimental() // untriaged
+class GraphicsElement extends StyledElement implements Tests {
+ // To suppress missing implicit constructor warnings.
+ factory GraphicsElement._() { throw new UnsupportedError("Not supported"); }
- @DomName('SVGGElement.farthestViewportElement')
+ @DomName('SVGGraphicsElement.farthestViewportElement')
@DocsEditable()
- SvgElement get farthestViewportElement native "SVGGElement_farthestViewportElement_Getter";
+ @Experimental() // untriaged
+ SvgElement get farthestViewportElement native "SVGGraphicsElement_farthestViewportElement_Getter";
- @DomName('SVGGElement.nearestViewportElement')
+ @DomName('SVGGraphicsElement.nearestViewportElement')
@DocsEditable()
- SvgElement get nearestViewportElement native "SVGGElement_nearestViewportElement_Getter";
+ @Experimental() // untriaged
+ SvgElement get nearestViewportElement native "SVGGraphicsElement_nearestViewportElement_Getter";
- @DomName('SVGGElement.getBBox')
+ @DomName('SVGGraphicsElement.transform')
@DocsEditable()
- Rect getBBox() native "SVGGElement_getBBox_Callback";
+ @Experimental() // untriaged
+ AnimatedTransformList get transform native "SVGGraphicsElement_transform_Getter";
- @DomName('SVGGElement.getCTM')
+ @DomName('SVGGraphicsElement.getBBox')
@DocsEditable()
- Matrix getCtm() native "SVGGElement_getCTM_Callback";
+ @Experimental() // untriaged
+ Rect getBBox() native "SVGGraphicsElement_getBBox_Callback";
- @DomName('SVGGElement.getScreenCTM')
+ @DomName('SVGGraphicsElement.getCTM')
@DocsEditable()
- Matrix getScreenCtm() native "SVGGElement_getScreenCTM_Callback";
+ @Experimental() // untriaged
+ Matrix getCtm() native "SVGGraphicsElement_getCTM_Callback";
- @DomName('SVGGElement.getTransformToElement')
+ @DomName('SVGGraphicsElement.getScreenCTM')
@DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGGElement_getTransformToElement_Callback";
+ @Experimental() // untriaged
+ Matrix getScreenCtm() native "SVGGraphicsElement_getScreenCTM_Callback";
- @DomName('SVGGElement.requiredExtensions')
+ @DomName('SVGGraphicsElement.getTransformToElement')
@DocsEditable()
- StringList get requiredExtensions native "SVGGElement_requiredExtensions_Getter";
+ @Experimental() // untriaged
+ Matrix getTransformToElement(SvgElement element) native "SVGGraphicsElement_getTransformToElement_Callback";
- @DomName('SVGGElement.requiredFeatures')
+ @DomName('SVGGraphicsElement.requiredExtensions')
@DocsEditable()
- StringList get requiredFeatures native "SVGGElement_requiredFeatures_Getter";
+ @Experimental() // untriaged
+ StringList get requiredExtensions native "SVGGraphicsElement_requiredExtensions_Getter";
- @DomName('SVGGElement.systemLanguage')
+ @DomName('SVGGraphicsElement.requiredFeatures')
@DocsEditable()
- StringList get systemLanguage native "SVGGElement_systemLanguage_Getter";
+ @Experimental() // untriaged
+ StringList get requiredFeatures native "SVGGraphicsElement_requiredFeatures_Getter";
- @DomName('SVGGElement.hasExtension')
+ @DomName('SVGGraphicsElement.systemLanguage')
@DocsEditable()
- bool hasExtension(String extension) native "SVGGElement_hasExtension_Callback";
+ @Experimental() // untriaged
+ StringList get systemLanguage native "SVGGraphicsElement_systemLanguage_Getter";
- @DomName('SVGGElement.transform')
+ @DomName('SVGGraphicsElement.hasExtension')
@DocsEditable()
- AnimatedTransformList get transform native "SVGGElement_transform_Getter";
+ @Experimental() // untriaged
+ bool hasExtension(String extension) native "SVGGraphicsElement_hasExtension_Callback";
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -3194,7 +2831,7 @@
@DocsEditable()
@DomName('SVGImageElement')
@Unstable()
-class ImageElement extends StyledElement implements Transformable, ExternalResourcesRequired, UriReference, Tests, LangSpace {
+class ImageElement extends GraphicsElement implements UriReference, ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory ImageElement._() { throw new UnsupportedError("Not supported"); }
@@ -3226,66 +2863,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGImageElement_externalResourcesRequired_Getter";
- @DomName('SVGImageElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGImageElement_xmllang_Getter";
-
- @DomName('SVGImageElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGImageElement_xmllang_Setter";
-
- @DomName('SVGImageElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGImageElement_xmlspace_Getter";
-
- @DomName('SVGImageElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGImageElement_xmlspace_Setter";
-
- @DomName('SVGImageElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGImageElement_farthestViewportElement_Getter";
-
- @DomName('SVGImageElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGImageElement_nearestViewportElement_Getter";
-
- @DomName('SVGImageElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGImageElement_getBBox_Callback";
-
- @DomName('SVGImageElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGImageElement_getCTM_Callback";
-
- @DomName('SVGImageElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGImageElement_getScreenCTM_Callback";
-
- @DomName('SVGImageElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGImageElement_getTransformToElement_Callback";
-
- @DomName('SVGImageElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGImageElement_requiredExtensions_Getter";
-
- @DomName('SVGImageElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGImageElement_requiredFeatures_Getter";
-
- @DomName('SVGImageElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGImageElement_systemLanguage_Getter";
-
- @DomName('SVGImageElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGImageElement_hasExtension_Callback";
-
- @DomName('SVGImageElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGImageElement_transform_Getter";
-
@DomName('SVGImageElement.href')
@DocsEditable()
AnimatedString get href native "SVGImageElement_href_Getter";
@@ -3299,38 +2876,6 @@
@DocsEditable()
-@DomName('SVGLangSpace')
-@Unstable()
-abstract class LangSpace extends NativeFieldWrapperClass1 {
-
- /// Checks if this type is supported on the current platform.
- static bool supported(SvgElement element) => true;
-
- @DomName('SVGLangSpace.xmllang')
- @DocsEditable()
- String get xmllang native "SVGLangSpace_xmllang_Getter";
-
- @DomName('SVGLangSpace.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGLangSpace_xmllang_Setter";
-
- @DomName('SVGLangSpace.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGLangSpace_xmlspace_Getter";
-
- @DomName('SVGLangSpace.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGLangSpace_xmlspace_Setter";
-
-}
-// 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('SVGLength')
@Unstable()
class Length extends NativeFieldWrapperClass1 {
@@ -3517,7 +3062,7 @@
@DocsEditable()
@DomName('SVGLineElement')
@Unstable()
-class LineElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class LineElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory LineElement._() { throw new UnsupportedError("Not supported"); }
@@ -3545,66 +3090,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGLineElement_externalResourcesRequired_Getter";
- @DomName('SVGLineElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGLineElement_xmllang_Getter";
-
- @DomName('SVGLineElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGLineElement_xmllang_Setter";
-
- @DomName('SVGLineElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGLineElement_xmlspace_Getter";
-
- @DomName('SVGLineElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGLineElement_xmlspace_Setter";
-
- @DomName('SVGLineElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGLineElement_farthestViewportElement_Getter";
-
- @DomName('SVGLineElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGLineElement_nearestViewportElement_Getter";
-
- @DomName('SVGLineElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGLineElement_getBBox_Callback";
-
- @DomName('SVGLineElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGLineElement_getCTM_Callback";
-
- @DomName('SVGLineElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGLineElement_getScreenCTM_Callback";
-
- @DomName('SVGLineElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGLineElement_getTransformToElement_Callback";
-
- @DomName('SVGLineElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGLineElement_requiredExtensions_Getter";
-
- @DomName('SVGLineElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGLineElement_requiredFeatures_Getter";
-
- @DomName('SVGLineElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGLineElement_systemLanguage_Getter";
-
- @DomName('SVGLineElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGLineElement_hasExtension_Callback";
-
- @DomName('SVGLineElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGLineElement_transform_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
@@ -3649,46 +3134,9 @@
@DocsEditable()
-@DomName('SVGLocatable')
-@Unstable()
-abstract class Locatable extends NativeFieldWrapperClass1 {
-
- @DomName('SVGLocatable.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGLocatable_farthestViewportElement_Getter";
-
- @DomName('SVGLocatable.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGLocatable_nearestViewportElement_Getter";
-
- @DomName('SVGLocatable.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGLocatable_getBBox_Callback";
-
- @DomName('SVGLocatable.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGLocatable_getCTM_Callback";
-
- @DomName('SVGLocatable.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGLocatable_getScreenCTM_Callback";
-
- @DomName('SVGLocatable.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGLocatable_getTransformToElement_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('SVGMarkerElement')
@Unstable()
-class MarkerElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired, LangSpace {
+class MarkerElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory MarkerElement._() { throw new UnsupportedError("Not supported"); }
@@ -3768,22 +3216,6 @@
@DocsEditable()
AnimatedRect get viewBox native "SVGMarkerElement_viewBox_Getter";
- @DomName('SVGMarkerElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGMarkerElement_xmllang_Getter";
-
- @DomName('SVGMarkerElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGMarkerElement_xmllang_Setter";
-
- @DomName('SVGMarkerElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGMarkerElement_xmlspace_Getter";
-
- @DomName('SVGMarkerElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGMarkerElement_xmlspace_Setter";
-
}
// 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
@@ -3795,7 +3227,7 @@
@DocsEditable()
@DomName('SVGMaskElement')
@Unstable()
-class MaskElement extends StyledElement implements ExternalResourcesRequired, Tests, LangSpace {
+class MaskElement extends StyledElement implements ExternalResourcesRequired, Tests {
// To suppress missing implicit constructor warnings.
factory MaskElement._() { throw new UnsupportedError("Not supported"); }
@@ -3831,22 +3263,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGMaskElement_externalResourcesRequired_Getter";
- @DomName('SVGMaskElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGMaskElement_xmllang_Getter";
-
- @DomName('SVGMaskElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGMaskElement_xmllang_Setter";
-
- @DomName('SVGMaskElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGMaskElement_xmlspace_Getter";
-
- @DomName('SVGMaskElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGMaskElement_xmlspace_Setter";
-
@DomName('SVGMaskElement.requiredExtensions')
@DocsEditable()
StringList get requiredExtensions native "SVGMaskElement_requiredExtensions_Getter";
@@ -4106,7 +3522,7 @@
@DocsEditable()
@DomName('SVGPathElement')
@Unstable()
-class PathElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class PathElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory PathElement._() { throw new UnsupportedError("Not supported"); }
@@ -4226,66 +3642,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGPathElement_externalResourcesRequired_Getter";
- @DomName('SVGPathElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGPathElement_xmllang_Getter";
-
- @DomName('SVGPathElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGPathElement_xmllang_Setter";
-
- @DomName('SVGPathElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGPathElement_xmlspace_Getter";
-
- @DomName('SVGPathElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGPathElement_xmlspace_Setter";
-
- @DomName('SVGPathElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGPathElement_farthestViewportElement_Getter";
-
- @DomName('SVGPathElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGPathElement_nearestViewportElement_Getter";
-
- @DomName('SVGPathElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGPathElement_getBBox_Callback";
-
- @DomName('SVGPathElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGPathElement_getCTM_Callback";
-
- @DomName('SVGPathElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGPathElement_getScreenCTM_Callback";
-
- @DomName('SVGPathElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGPathElement_getTransformToElement_Callback";
-
- @DomName('SVGPathElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGPathElement_requiredExtensions_Getter";
-
- @DomName('SVGPathElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGPathElement_requiredFeatures_Getter";
-
- @DomName('SVGPathElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGPathElement_systemLanguage_Getter";
-
- @DomName('SVGPathElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGPathElement_hasExtension_Callback";
-
- @DomName('SVGPathElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGPathElement_transform_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
@@ -5238,7 +4594,7 @@
@DocsEditable()
@DomName('SVGPatternElement')
@Unstable()
-class PatternElement extends StyledElement implements FitToViewBox, UriReference, ExternalResourcesRequired, Tests, LangSpace {
+class PatternElement extends StyledElement implements FitToViewBox, UriReference, ExternalResourcesRequired, Tests {
// To suppress missing implicit constructor warnings.
factory PatternElement._() { throw new UnsupportedError("Not supported"); }
@@ -5286,22 +4642,6 @@
@DocsEditable()
AnimatedRect get viewBox native "SVGPatternElement_viewBox_Getter";
- @DomName('SVGPatternElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGPatternElement_xmllang_Getter";
-
- @DomName('SVGPatternElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGPatternElement_xmllang_Setter";
-
- @DomName('SVGPatternElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGPatternElement_xmlspace_Getter";
-
- @DomName('SVGPatternElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGPatternElement_xmlspace_Setter";
-
@DomName('SVGPatternElement.requiredExtensions')
@DocsEditable()
StringList get requiredExtensions native "SVGPatternElement_requiredExtensions_Getter";
@@ -5411,7 +4751,7 @@
@DocsEditable()
@DomName('SVGPolygonElement')
@Unstable()
-class PolygonElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class PolygonElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory PolygonElement._() { throw new UnsupportedError("Not supported"); }
@@ -5431,66 +4771,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGPolygonElement_externalResourcesRequired_Getter";
- @DomName('SVGPolygonElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGPolygonElement_xmllang_Getter";
-
- @DomName('SVGPolygonElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGPolygonElement_xmllang_Setter";
-
- @DomName('SVGPolygonElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGPolygonElement_xmlspace_Getter";
-
- @DomName('SVGPolygonElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGPolygonElement_xmlspace_Setter";
-
- @DomName('SVGPolygonElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGPolygonElement_farthestViewportElement_Getter";
-
- @DomName('SVGPolygonElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGPolygonElement_nearestViewportElement_Getter";
-
- @DomName('SVGPolygonElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGPolygonElement_getBBox_Callback";
-
- @DomName('SVGPolygonElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGPolygonElement_getCTM_Callback";
-
- @DomName('SVGPolygonElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGPolygonElement_getScreenCTM_Callback";
-
- @DomName('SVGPolygonElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGPolygonElement_getTransformToElement_Callback";
-
- @DomName('SVGPolygonElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGPolygonElement_requiredExtensions_Getter";
-
- @DomName('SVGPolygonElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGPolygonElement_requiredFeatures_Getter";
-
- @DomName('SVGPolygonElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGPolygonElement_systemLanguage_Getter";
-
- @DomName('SVGPolygonElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGPolygonElement_hasExtension_Callback";
-
- @DomName('SVGPolygonElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGPolygonElement_transform_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
@@ -5502,7 +4782,7 @@
@DocsEditable()
@DomName('SVGPolylineElement')
@Unstable()
-class PolylineElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class PolylineElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory PolylineElement._() { throw new UnsupportedError("Not supported"); }
@@ -5522,66 +4802,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGPolylineElement_externalResourcesRequired_Getter";
- @DomName('SVGPolylineElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGPolylineElement_xmllang_Getter";
-
- @DomName('SVGPolylineElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGPolylineElement_xmllang_Setter";
-
- @DomName('SVGPolylineElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGPolylineElement_xmlspace_Getter";
-
- @DomName('SVGPolylineElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGPolylineElement_xmlspace_Setter";
-
- @DomName('SVGPolylineElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGPolylineElement_farthestViewportElement_Getter";
-
- @DomName('SVGPolylineElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGPolylineElement_nearestViewportElement_Getter";
-
- @DomName('SVGPolylineElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGPolylineElement_getBBox_Callback";
-
- @DomName('SVGPolylineElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGPolylineElement_getCTM_Callback";
-
- @DomName('SVGPolylineElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGPolylineElement_getScreenCTM_Callback";
-
- @DomName('SVGPolylineElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGPolylineElement_getTransformToElement_Callback";
-
- @DomName('SVGPolylineElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGPolylineElement_requiredExtensions_Getter";
-
- @DomName('SVGPolylineElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGPolylineElement_requiredFeatures_Getter";
-
- @DomName('SVGPolylineElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGPolylineElement_systemLanguage_Getter";
-
- @DomName('SVGPolylineElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGPolylineElement_hasExtension_Callback";
-
- @DomName('SVGPolylineElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGPolylineElement_transform_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
@@ -5766,7 +4986,7 @@
@DocsEditable()
@DomName('SVGRectElement')
@Unstable()
-class RectElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class RectElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory RectElement._() { throw new UnsupportedError("Not supported"); }
@@ -5802,66 +5022,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGRectElement_externalResourcesRequired_Getter";
- @DomName('SVGRectElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGRectElement_xmllang_Getter";
-
- @DomName('SVGRectElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGRectElement_xmllang_Setter";
-
- @DomName('SVGRectElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGRectElement_xmlspace_Getter";
-
- @DomName('SVGRectElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGRectElement_xmlspace_Setter";
-
- @DomName('SVGRectElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGRectElement_farthestViewportElement_Getter";
-
- @DomName('SVGRectElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGRectElement_nearestViewportElement_Getter";
-
- @DomName('SVGRectElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGRectElement_getBBox_Callback";
-
- @DomName('SVGRectElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGRectElement_getCTM_Callback";
-
- @DomName('SVGRectElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGRectElement_getScreenCTM_Callback";
-
- @DomName('SVGRectElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGRectElement_getTransformToElement_Callback";
-
- @DomName('SVGRectElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGRectElement_requiredExtensions_Getter";
-
- @DomName('SVGRectElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGRectElement_requiredFeatures_Getter";
-
- @DomName('SVGRectElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGRectElement_systemLanguage_Getter";
-
- @DomName('SVGRectElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGRectElement_hasExtension_Callback";
-
- @DomName('SVGRectElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGRectElement_transform_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
@@ -6085,7 +5245,7 @@
@DomName('SVGStyleElement')
// http://www.w3.org/TR/SVG/types.html#InterfaceSVGStylable
@Experimental() // nonstandard
-class StyleElement extends SvgElement implements LangSpace {
+class StyleElement extends SvgElement {
// To suppress missing implicit constructor warnings.
factory StyleElement._() { throw new UnsupportedError("Not supported"); }
@@ -6125,22 +5285,6 @@
@DocsEditable()
void set type(String value) native "SVGStyleElement_type_Setter";
- @DomName('SVGStyleElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGStyleElement_xmllang_Getter";
-
- @DomName('SVGStyleElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGStyleElement_xmllang_Setter";
-
- @DomName('SVGStyleElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGStyleElement_xmlspace_Getter";
-
- @DomName('SVGStyleElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGStyleElement_xmlspace_Setter";
-
}
// 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
@@ -6327,6 +5471,26 @@
@DocsEditable()
void set xmlbase(String value) native "SVGElement_xmlbase_Setter";
+ @DomName('SVGElement.xmllang')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get xmllang native "SVGElement_xmllang_Getter";
+
+ @DomName('SVGElement.xmllang')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set xmllang(String value) native "SVGElement_xmllang_Setter";
+
+ @DomName('SVGElement.xmlspace')
+ @DocsEditable()
+ @Experimental() // untriaged
+ String get xmlspace native "SVGElement_xmlspace_Getter";
+
+ @DomName('SVGElement.xmlspace')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void set xmlspace(String value) native "SVGElement_xmlspace_Setter";
+
}
// 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
@@ -6335,7 +5499,7 @@
@DomName('SVGSVGElement')
@Unstable()
-class SvgSvgElement extends StyledElement implements FitToViewBox, Transformable, Tests, ExternalResourcesRequired, ZoomAndPan, LangSpace {
+class SvgSvgElement extends GraphicsElement implements FitToViewBox, ExternalResourcesRequired, ZoomAndPan {
factory SvgSvgElement() => _SvgSvgElementFactoryProvider.createSvgSvgElement();
// To suppress missing implicit constructor warnings.
@@ -6517,66 +5681,6 @@
@DocsEditable()
AnimatedRect get viewBox native "SVGSVGElement_viewBox_Getter";
- @DomName('SVGSVGElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGSVGElement_xmllang_Getter";
-
- @DomName('SVGSVGElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGSVGElement_xmllang_Setter";
-
- @DomName('SVGSVGElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGSVGElement_xmlspace_Getter";
-
- @DomName('SVGSVGElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGSVGElement_xmlspace_Setter";
-
- @DomName('SVGSVGElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGSVGElement_farthestViewportElement_Getter";
-
- @DomName('SVGSVGElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGSVGElement_nearestViewportElement_Getter";
-
- @DomName('SVGSVGElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGSVGElement_getBBox_Callback";
-
- @DomName('SVGSVGElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGSVGElement_getCTM_Callback";
-
- @DomName('SVGSVGElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGSVGElement_getScreenCTM_Callback";
-
- @DomName('SVGSVGElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGSVGElement_getTransformToElement_Callback";
-
- @DomName('SVGSVGElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGSVGElement_requiredExtensions_Getter";
-
- @DomName('SVGSVGElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGSVGElement_requiredFeatures_Getter";
-
- @DomName('SVGSVGElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGSVGElement_systemLanguage_Getter";
-
- @DomName('SVGSVGElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGSVGElement_hasExtension_Callback";
-
- @DomName('SVGSVGElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGSVGElement_transform_Getter";
-
@DomName('SVGSVGElement.zoomAndPan')
@DocsEditable()
int get zoomAndPan native "SVGSVGElement_zoomAndPan_Getter";
@@ -6596,7 +5700,7 @@
@DocsEditable()
@DomName('SVGSwitchElement')
@Unstable()
-class SwitchElement extends StyledElement implements Transformable, ExternalResourcesRequired, Tests, LangSpace {
+class SwitchElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory SwitchElement._() { throw new UnsupportedError("Not supported"); }
@@ -6608,66 +5712,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGSwitchElement_externalResourcesRequired_Getter";
- @DomName('SVGSwitchElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGSwitchElement_xmllang_Getter";
-
- @DomName('SVGSwitchElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGSwitchElement_xmllang_Setter";
-
- @DomName('SVGSwitchElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGSwitchElement_xmlspace_Getter";
-
- @DomName('SVGSwitchElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGSwitchElement_xmlspace_Setter";
-
- @DomName('SVGSwitchElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGSwitchElement_farthestViewportElement_Getter";
-
- @DomName('SVGSwitchElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGSwitchElement_nearestViewportElement_Getter";
-
- @DomName('SVGSwitchElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGSwitchElement_getBBox_Callback";
-
- @DomName('SVGSwitchElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGSwitchElement_getCTM_Callback";
-
- @DomName('SVGSwitchElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGSwitchElement_getScreenCTM_Callback";
-
- @DomName('SVGSwitchElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGSwitchElement_getTransformToElement_Callback";
-
- @DomName('SVGSwitchElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGSwitchElement_requiredExtensions_Getter";
-
- @DomName('SVGSwitchElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGSwitchElement_requiredFeatures_Getter";
-
- @DomName('SVGSwitchElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGSwitchElement_systemLanguage_Getter";
-
- @DomName('SVGSwitchElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGSwitchElement_hasExtension_Callback";
-
- @DomName('SVGSwitchElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGSwitchElement_transform_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
@@ -6679,7 +5723,7 @@
@DocsEditable()
@DomName('SVGSymbolElement')
@Unstable()
-class SymbolElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired, LangSpace {
+class SymbolElement extends StyledElement implements FitToViewBox, ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory SymbolElement._() { throw new UnsupportedError("Not supported"); }
@@ -6699,22 +5743,6 @@
@DocsEditable()
AnimatedRect get viewBox native "SVGSymbolElement_viewBox_Getter";
- @DomName('SVGSymbolElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGSymbolElement_xmllang_Getter";
-
- @DomName('SVGSymbolElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGSymbolElement_xmllang_Setter";
-
- @DomName('SVGSymbolElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGSymbolElement_xmlspace_Getter";
-
- @DomName('SVGSymbolElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGSymbolElement_xmlspace_Setter";
-
}
// 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
@@ -6774,7 +5802,7 @@
@DocsEditable()
@DomName('SVGTextContentElement')
@Unstable()
-class TextContentElement extends StyledElement implements ExternalResourcesRequired, Tests, LangSpace {
+class TextContentElement extends GraphicsElement implements ExternalResourcesRequired {
// To suppress missing implicit constructor warnings.
factory TextContentElement._() { throw new UnsupportedError("Not supported"); }
@@ -6838,38 +5866,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGTextContentElement_externalResourcesRequired_Getter";
- @DomName('SVGTextContentElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGTextContentElement_xmllang_Getter";
-
- @DomName('SVGTextContentElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGTextContentElement_xmllang_Setter";
-
- @DomName('SVGTextContentElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGTextContentElement_xmlspace_Getter";
-
- @DomName('SVGTextContentElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGTextContentElement_xmlspace_Setter";
-
- @DomName('SVGTextContentElement.requiredExtensions')
- @DocsEditable()
- StringList get requiredExtensions native "SVGTextContentElement_requiredExtensions_Getter";
-
- @DomName('SVGTextContentElement.requiredFeatures')
- @DocsEditable()
- StringList get requiredFeatures native "SVGTextContentElement_requiredFeatures_Getter";
-
- @DomName('SVGTextContentElement.systemLanguage')
- @DocsEditable()
- StringList get systemLanguage native "SVGTextContentElement_systemLanguage_Getter";
-
- @DomName('SVGTextContentElement.hasExtension')
- @DocsEditable()
- bool hasExtension(String extension) native "SVGTextContentElement_hasExtension_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
@@ -6881,7 +5877,7 @@
@DocsEditable()
@DomName('SVGTextElement')
@Unstable()
-class TextElement extends TextPositioningElement implements Transformable {
+class TextElement extends TextPositioningElement {
// To suppress missing implicit constructor warnings.
factory TextElement._() { throw new UnsupportedError("Not supported"); }
@@ -6889,34 +5885,6 @@
@DocsEditable()
factory TextElement() => _SvgElementFactoryProvider.createSvgElement_tag("text");
- @DomName('SVGTextElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGTextElement_farthestViewportElement_Getter";
-
- @DomName('SVGTextElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGTextElement_nearestViewportElement_Getter";
-
- @DomName('SVGTextElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGTextElement_getBBox_Callback";
-
- @DomName('SVGTextElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGTextElement_getCTM_Callback";
-
- @DomName('SVGTextElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGTextElement_getScreenCTM_Callback";
-
- @DomName('SVGTextElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGTextElement_getTransformToElement_Callback";
-
- @DomName('SVGTextElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGTextElement_transform_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
@@ -7018,7 +5986,7 @@
@DocsEditable()
@DomName('SVGTitleElement')
@Unstable()
-class TitleElement extends StyledElement implements LangSpace {
+class TitleElement extends StyledElement {
// To suppress missing implicit constructor warnings.
factory TitleElement._() { throw new UnsupportedError("Not supported"); }
@@ -7026,22 +5994,6 @@
@DocsEditable()
factory TitleElement() => _SvgElementFactoryProvider.createSvgElement_tag("title");
- @DomName('SVGTitleElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGTitleElement_xmllang_Getter";
-
- @DomName('SVGTitleElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGTitleElement_xmllang_Setter";
-
- @DomName('SVGTitleElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGTitleElement_xmlspace_Getter";
-
- @DomName('SVGTitleElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGTitleElement_xmlspace_Setter";
-
}
// 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
@@ -7227,47 +6179,6 @@
@DocsEditable()
-@DomName('SVGTransformable')
-@Unstable()
-abstract class Transformable extends NativeFieldWrapperClass1 implements Locatable {
-
- @DomName('SVGTransformable.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGTransformable_transform_Getter";
-
- @DomName('SVGTransformable.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGTransformable_farthestViewportElement_Getter";
-
- @DomName('SVGTransformable.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGTransformable_nearestViewportElement_Getter";
-
- @DomName('SVGTransformable.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGTransformable_getBBox_Callback";
-
- @DomName('SVGTransformable.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGTransformable_getCTM_Callback";
-
- @DomName('SVGTransformable.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGTransformable_getScreenCTM_Callback";
-
- @DomName('SVGTransformable.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGTransformable_getTransformToElement_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('SVGUnitTypes')
@Unstable()
class UnitTypes extends NativeFieldWrapperClass1 {
@@ -7312,7 +6223,7 @@
@DocsEditable()
@DomName('SVGUseElement')
@Unstable()
-class UseElement extends StyledElement implements Transformable, ExternalResourcesRequired, UriReference, Tests, LangSpace {
+class UseElement extends GraphicsElement implements UriReference, ExternalResourcesRequired, Tests {
// To suppress missing implicit constructor warnings.
factory UseElement._() { throw new UnsupportedError("Not supported"); }
@@ -7348,46 +6259,6 @@
@DocsEditable()
AnimatedBoolean get externalResourcesRequired native "SVGUseElement_externalResourcesRequired_Getter";
- @DomName('SVGUseElement.xmllang')
- @DocsEditable()
- String get xmllang native "SVGUseElement_xmllang_Getter";
-
- @DomName('SVGUseElement.xmllang')
- @DocsEditable()
- void set xmllang(String value) native "SVGUseElement_xmllang_Setter";
-
- @DomName('SVGUseElement.xmlspace')
- @DocsEditable()
- String get xmlspace native "SVGUseElement_xmlspace_Getter";
-
- @DomName('SVGUseElement.xmlspace')
- @DocsEditable()
- void set xmlspace(String value) native "SVGUseElement_xmlspace_Setter";
-
- @DomName('SVGUseElement.farthestViewportElement')
- @DocsEditable()
- SvgElement get farthestViewportElement native "SVGUseElement_farthestViewportElement_Getter";
-
- @DomName('SVGUseElement.nearestViewportElement')
- @DocsEditable()
- SvgElement get nearestViewportElement native "SVGUseElement_nearestViewportElement_Getter";
-
- @DomName('SVGUseElement.getBBox')
- @DocsEditable()
- Rect getBBox() native "SVGUseElement_getBBox_Callback";
-
- @DomName('SVGUseElement.getCTM')
- @DocsEditable()
- Matrix getCtm() native "SVGUseElement_getCTM_Callback";
-
- @DomName('SVGUseElement.getScreenCTM')
- @DocsEditable()
- Matrix getScreenCtm() native "SVGUseElement_getScreenCTM_Callback";
-
- @DomName('SVGUseElement.getTransformToElement')
- @DocsEditable()
- Matrix getTransformToElement(SvgElement element) native "SVGUseElement_getTransformToElement_Callback";
-
@DomName('SVGUseElement.requiredExtensions')
@DocsEditable()
StringList get requiredExtensions native "SVGUseElement_requiredExtensions_Getter";
@@ -7404,10 +6275,6 @@
@DocsEditable()
bool hasExtension(String extension) native "SVGUseElement_hasExtension_Callback";
- @DomName('SVGUseElement.transform')
- @DocsEditable()
- AnimatedTransformList get transform native "SVGUseElement_transform_Getter";
-
@DomName('SVGUseElement.href')
@DocsEditable()
AnimatedString get href native "SVGUseElement_href_Getter";
diff --git a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
index e065196..b3355ed 100644
--- a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
+++ b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
@@ -149,6 +149,11 @@
// To suppress missing implicit constructor warnings.
factory AudioBufferSourceNode._() { throw new UnsupportedError("Not supported"); }
+ @DomName('AudioBufferSourceNode.endedEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<Event> endedEvent = const EventStreamProvider<Event>('ended');
+
@DomName('AudioBufferSourceNode.FINISHED_STATE')
@DocsEditable()
static const int FINISHED_STATE = 3;
@@ -205,6 +210,11 @@
@DocsEditable()
void noteOn(num when) native;
+ @DomName('AudioBufferSourceNode.onended')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<Event> get onEnded => endedEvent.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
@@ -318,14 +328,15 @@
@DocsEditable()
PannerNode createPanner() native;
+ @DomName('AudioContext.createPeriodicWave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ PeriodicWave createPeriodicWave(Float32List real, Float32List imag) native;
+
@DomName('AudioContext.createWaveShaper')
@DocsEditable()
WaveShaperNode createWaveShaper() native;
- @DomName('AudioContext.createWaveTable')
- @DocsEditable()
- WaveTable createWaveTable(Float32List real, Float32List imag) native;
-
@JSName('decodeAudioData')
@DomName('AudioContext.decodeAudioData')
@DocsEditable()
@@ -346,6 +357,25 @@
@DocsEditable()
void startRendering() native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('AudioContext.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('AudioContext.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native;
+
+ @JSName('removeEventListener')
+ @DomName('AudioContext.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('AudioContext.oncomplete')
@DocsEditable()
Stream<Event> get onComplete => completeEvent.forTarget(this);
@@ -461,11 +491,6 @@
@DocsEditable()
final int numberOfOutputs;
- @JSName('addEventListener')
- @DomName('AudioNode.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
@JSName('connect')
@DomName('AudioNode.connect')
@DocsEditable()
@@ -475,6 +500,13 @@
@DocsEditable()
void disconnect(int output) native;
+ // From EventTarget
+
+ @JSName('addEventListener')
+ @DomName('AudioNode.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
+
@DomName('AudioNode.dispatchEvent')
@DocsEditable()
bool dispatchEvent(Event event) native;
@@ -803,7 +835,7 @@
@DomName('MediaStreamAudioDestinationNode')
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#MediaStreamAudioDestinationNode
@Experimental()
-class MediaStreamAudioDestinationNode extends AudioSourceNode native "MediaStreamAudioDestinationNode" {
+class MediaStreamAudioDestinationNode extends AudioNode native "MediaStreamAudioDestinationNode" {
// To suppress missing implicit constructor warnings.
factory MediaStreamAudioDestinationNode._() { throw new UnsupportedError("Not supported"); }
@@ -854,7 +886,7 @@
@DomName('OfflineAudioContext')
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#OfflineAudioContext-section
@Experimental()
-class OfflineAudioContext extends AudioContext implements EventTarget native "OfflineAudioContext" {
+class OfflineAudioContext extends AudioContext native "OfflineAudioContext" {
// To suppress missing implicit constructor warnings.
factory OfflineAudioContext._() { throw new UnsupportedError("Not supported"); }
@@ -878,6 +910,11 @@
// To suppress missing implicit constructor warnings.
factory OscillatorNode._() { throw new UnsupportedError("Not supported"); }
+ @DomName('OscillatorNode.endedEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<Event> endedEvent = const EventStreamProvider<Event>('ended');
+
@DomName('OscillatorNode.CUSTOM')
@DocsEditable()
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
@@ -948,9 +985,10 @@
@DocsEditable()
void noteOn(num when) native;
- @DomName('OscillatorNode.setWaveTable')
+ @DomName('OscillatorNode.setPeriodicWave')
@DocsEditable()
- void setWaveTable(WaveTable waveTable) native;
+ @Experimental() // untriaged
+ void setPeriodicWave(PeriodicWave periodicWave) native;
@DomName('OscillatorNode.start')
@DocsEditable()
@@ -959,6 +997,11 @@
@DomName('OscillatorNode.stop')
@DocsEditable()
void stop(num when) native;
+
+ @DomName('OscillatorNode.onended')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<Event> get onEnded => endedEvent.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
@@ -1053,6 +1096,16 @@
@DocsEditable()
void setVelocity(num x, num y, num z) 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('PeriodicWave')
+@Experimental() // untriaged
+class PeriodicWave extends Interceptor native "PeriodicWave" {
+}
// 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.
@@ -1123,14 +1176,3 @@
@DocsEditable()
String oversample;
}
-// 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('WaveTable')
-// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#WaveTable-section
-@Experimental()
-class WaveTable extends Interceptor native "WaveTable" {
-}
diff --git a/sdk/lib/web_audio/dartium/web_audio_dartium.dart b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
index 8fb7c34..64d95f9 100644
--- a/sdk/lib/web_audio/dartium/web_audio_dartium.dart
+++ b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
@@ -145,6 +145,11 @@
// To suppress missing implicit constructor warnings.
factory AudioBufferSourceNode._() { throw new UnsupportedError("Not supported"); }
+ @DomName('AudioBufferSourceNode.endedEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<Event> endedEvent = const EventStreamProvider<Event>('ended');
+
@DomName('AudioBufferSourceNode.FINISHED_STATE')
@DocsEditable()
static const int FINISHED_STATE = 3;
@@ -243,6 +248,11 @@
@DocsEditable()
void stop(num when) native "AudioBufferSourceNode_stop_Callback";
+ @DomName('AudioBufferSourceNode.onended')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<Event> get onEnded => endedEvent.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
@@ -406,6 +416,11 @@
@DocsEditable()
PannerNode createPanner() native "AudioContext_createPanner_Callback";
+ @DomName('AudioContext.createPeriodicWave')
+ @DocsEditable()
+ @Experimental() // untriaged
+ PeriodicWave createPeriodicWave(Float32List real, Float32List imag) native "AudioContext_createPeriodicWave_Callback";
+
ScriptProcessorNode createScriptProcessor(int bufferSize, [int numberOfInputChannels, int numberOfOutputChannels]) {
if (numberOfOutputChannels != null) {
return _createScriptProcessor_1(bufferSize, numberOfInputChannels, numberOfOutputChannels);
@@ -426,10 +441,6 @@
@DocsEditable()
WaveShaperNode createWaveShaper() native "AudioContext_createWaveShaper_Callback";
- @DomName('AudioContext.createWaveTable')
- @DocsEditable()
- WaveTable createWaveTable(Float32List real, Float32List imag) native "AudioContext_createWaveTable_Callback";
-
@DomName('AudioContext.decodeAudioData')
@DocsEditable()
void _decodeAudioData(ByteBuffer audioData, AudioBufferCallback successCallback, [AudioBufferCallback errorCallback]) native "AudioContext_decodeAudioData_Callback";
@@ -446,6 +457,21 @@
@DocsEditable()
void startRendering() native "AudioContext_startRendering_Callback";
+ @DomName('AudioContext.addEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "AudioContext_addEventListener_Callback";
+
+ @DomName('AudioContext.dispatchEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ bool dispatchEvent(Event event) native "AudioContext_dispatchEvent_Callback";
+
+ @DomName('AudioContext.removeEventListener')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "AudioContext_removeEventListener_Callback";
+
@DomName('AudioContext.oncomplete')
@DocsEditable()
Stream<Event> get onComplete => completeEvent.forTarget(this);
@@ -561,10 +587,6 @@
@DocsEditable()
int get numberOfOutputs native "AudioNode_numberOfOutputs_Getter";
- @DomName('AudioNode.addEventListener')
- @DocsEditable()
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "AudioNode_addEventListener_Callback";
-
void $dom_connect(destination, int output, [int input]) {
if ((input is int || input == null) && (output is int || output == null) && (destination is AudioNode || destination == null)) {
_connect_1(destination, output, input);
@@ -585,6 +607,10 @@
@DocsEditable()
void disconnect(int output) native "AudioNode_disconnect_Callback";
+ @DomName('AudioNode.addEventListener')
+ @DocsEditable()
+ void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "AudioNode_addEventListener_Callback";
+
@DomName('AudioNode.dispatchEvent')
@DocsEditable()
bool dispatchEvent(Event event) native "AudioNode_dispatchEvent_Callback";
@@ -963,7 +989,7 @@
@DomName('MediaStreamAudioDestinationNode')
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#MediaStreamAudioDestinationNode
@Experimental()
-class MediaStreamAudioDestinationNode extends AudioSourceNode {
+class MediaStreamAudioDestinationNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory MediaStreamAudioDestinationNode._() { throw new UnsupportedError("Not supported"); }
@@ -1023,7 +1049,7 @@
@DomName('OfflineAudioContext')
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#OfflineAudioContext-section
@Experimental()
-class OfflineAudioContext extends AudioContext implements EventTarget {
+class OfflineAudioContext extends AudioContext {
// To suppress missing implicit constructor warnings.
factory OfflineAudioContext._() { throw new UnsupportedError("Not supported"); }
@@ -1052,6 +1078,11 @@
// To suppress missing implicit constructor warnings.
factory OscillatorNode._() { throw new UnsupportedError("Not supported"); }
+ @DomName('OscillatorNode.endedEvent')
+ @DocsEditable()
+ @Experimental() // untriaged
+ static const EventStreamProvider<Event> endedEvent = const EventStreamProvider<Event>('ended');
+
@DomName('OscillatorNode.CUSTOM')
@DocsEditable()
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
@@ -1126,9 +1157,10 @@
@DocsEditable()
void noteOn(num when) native "OscillatorNode_noteOn_Callback";
- @DomName('OscillatorNode.setWaveTable')
+ @DomName('OscillatorNode.setPeriodicWave')
@DocsEditable()
- void setWaveTable(WaveTable waveTable) native "OscillatorNode_setWaveTable_Callback";
+ @Experimental() // untriaged
+ void setPeriodicWave(PeriodicWave periodicWave) native "OscillatorNode_setPeriodicWave_Callback";
@DomName('OscillatorNode.start')
@DocsEditable()
@@ -1138,6 +1170,11 @@
@DocsEditable()
void stop(num when) native "OscillatorNode_stop_Callback";
+ @DomName('OscillatorNode.onended')
+ @DocsEditable()
+ @Experimental() // untriaged
+ Stream<Event> get onEnded => endedEvent.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
@@ -1267,6 +1304,19 @@
void setVelocity(num x, num y, num z) native "PannerNode_setVelocity_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('PeriodicWave')
+@Experimental() // untriaged
+class PeriodicWave extends NativeFieldWrapperClass1 {
+
+}
// 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.
@@ -1349,17 +1399,3 @@
void set oversample(String value) native "WaveShaperNode_oversample_Setter";
}
-// 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('WaveTable')
-// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#WaveTable-section
-@Experimental()
-class WaveTable extends NativeFieldWrapperClass1 {
-
-}
diff --git a/sdk/lib/web_gl/dartium/web_gl_dartium.dart b/sdk/lib/web_gl/dartium/web_gl_dartium.dart
index 411dd69..8387961 100644
--- a/sdk/lib/web_gl/dartium/web_gl_dartium.dart
+++ b/sdk/lib/web_gl/dartium/web_gl_dartium.dart
@@ -2793,8 +2793,19 @@
@DomName('WebGLRenderingContext.texImage2D')
void texImage2D(int targetTexture, int levelOfDetail, int internalFormat,
int format, int type, data) {
- _texImage2D(targetTexture, levelOfDetail, internalFormat,
- format, type, data);
+ if (data is ImageElement) {
+ texImage2DImage(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ } else if (data is ImageData) {
+ texImage2DImageData(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ } else if (data is CanvasElement) {
+ texImage2DCanvas(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ } else {
+ texImage2DVideo(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ }
}
/**
diff --git a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
index 3608d4c..57a3f17 100644
--- a/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
+++ b/sdk/lib/web_sql/dart2js/web_sql_dart2js.dart
@@ -171,57 +171,6 @@
@DocsEditable()
-@DomName('SQLException')
-// http://www.w3.org/TR/webdatabase/#sqlexception
-@Experimental() // deprecated
-class SqlException extends Interceptor native "SQLException" {
-
- @DomName('SQLException.CONSTRAINT_ERR')
- @DocsEditable()
- static const int CONSTRAINT_ERR = 6;
-
- @DomName('SQLException.DATABASE_ERR')
- @DocsEditable()
- static const int DATABASE_ERR = 1;
-
- @DomName('SQLException.QUOTA_ERR')
- @DocsEditable()
- static const int QUOTA_ERR = 4;
-
- @DomName('SQLException.SYNTAX_ERR')
- @DocsEditable()
- static const int SYNTAX_ERR = 5;
-
- @DomName('SQLException.TIMEOUT_ERR')
- @DocsEditable()
- static const int TIMEOUT_ERR = 7;
-
- @DomName('SQLException.TOO_LARGE_ERR')
- @DocsEditable()
- static const int TOO_LARGE_ERR = 3;
-
- @DomName('SQLException.UNKNOWN_ERR')
- @DocsEditable()
- static const int UNKNOWN_ERR = 0;
-
- @DomName('SQLException.VERSION_ERR')
- @DocsEditable()
- static const int VERSION_ERR = 2;
-
- @DomName('SQLException.code')
- @DocsEditable()
- final int code;
-
- @DomName('SQLException.message')
- @DocsEditable()
- final String message;
-}
-// 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('SQLResultSet')
// http://www.w3.org/TR/webdatabase/#sqlresultset
@Experimental() // deprecated
diff --git a/sdk/lib/web_sql/dartium/web_sql_dartium.dart b/sdk/lib/web_sql/dartium/web_sql_dartium.dart
index 33f5260..828bcf8 100644
--- a/sdk/lib/web_sql/dartium/web_sql_dartium.dart
+++ b/sdk/lib/web_sql/dartium/web_sql_dartium.dart
@@ -177,60 +177,6 @@
@DocsEditable()
-@DomName('SQLException')
-// http://www.w3.org/TR/webdatabase/#sqlexception
-@Experimental() // deprecated
-class SqlException extends NativeFieldWrapperClass1 {
-
- @DomName('SQLException.CONSTRAINT_ERR')
- @DocsEditable()
- static const int CONSTRAINT_ERR = 6;
-
- @DomName('SQLException.DATABASE_ERR')
- @DocsEditable()
- static const int DATABASE_ERR = 1;
-
- @DomName('SQLException.QUOTA_ERR')
- @DocsEditable()
- static const int QUOTA_ERR = 4;
-
- @DomName('SQLException.SYNTAX_ERR')
- @DocsEditable()
- static const int SYNTAX_ERR = 5;
-
- @DomName('SQLException.TIMEOUT_ERR')
- @DocsEditable()
- static const int TIMEOUT_ERR = 7;
-
- @DomName('SQLException.TOO_LARGE_ERR')
- @DocsEditable()
- static const int TOO_LARGE_ERR = 3;
-
- @DomName('SQLException.UNKNOWN_ERR')
- @DocsEditable()
- static const int UNKNOWN_ERR = 0;
-
- @DomName('SQLException.VERSION_ERR')
- @DocsEditable()
- static const int VERSION_ERR = 2;
-
- @DomName('SQLException.code')
- @DocsEditable()
- int get code native "SQLException_code_Getter";
-
- @DomName('SQLException.message')
- @DocsEditable()
- String get message native "SQLException_message_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('SQLResultSet')
// http://www.w3.org/TR/webdatabase/#sqlresultset
@Experimental() // deprecated
diff --git a/tests/co19/co19-analyzer2.status b/tests/co19/co19-analyzer2.status
index 81a6b85..116302e 100644
--- a/tests/co19/co19-analyzer2.status
+++ b/tests/co19/co19-analyzer2.status
@@ -89,11 +89,6 @@
Language/03_Overview/1_Scoping_A02_t07: fail, OK
Language/12_Statements/04_Local_Function_Declaration_A01_t01: fail, OK
-# co19 issue #417, 'if', 'while' and 'do-while' don't create scope
-Language/03_Overview/1_Scoping_A02_t11: fail, OK
-Language/03_Overview/1_Scoping_A02_t12: fail, OK
-Language/03_Overview/1_Scoping_A02_t16: fail, OK
-
# co19 issue #420, 'throw' without exception; deprecated; rethrow should be used
Language/11_Expressions/08_Throw_A05_t01: fail, OK
Language/11_Expressions/08_Throw_A05_t02: fail, OK
@@ -435,3 +430,25 @@
Language/11_Expressions/11_Instance_Creation_A03_t01: fail, OK
Language/11_Expressions/11_Instance_Creation_A04_t01: fail, OK
Language/11_Expressions/11_Instance_Creation_A04_t02: fail, OK
+
+# co19 issue #481
+Language/13_Libraries_and_Scripts/1_Imports_A03_t02: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t05: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t08: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t09: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t10: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t22: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t25: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t29: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t28: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t30: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t42: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t45: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t48: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t49: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t50: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t62: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t65: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t68: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t69: fail, OK
+Language/13_Libraries_and_Scripts/1_Imports_A03_t70: fail, OK
diff --git a/tests/co19/co19-dart2dart.status b/tests/co19/co19-dart2dart.status
index 687842a..2e5df38 100644
--- a/tests/co19/co19-dart2dart.status
+++ b/tests/co19/co19-dart2dart.status
@@ -4,6 +4,10 @@
[ $compiler == dart2dart ]
+Language/11_Expressions/08_Throw_A05_t01: Fail # co19 issue 420
+Language/11_Expressions/08_Throw_A05_t02: Fail # co19 issue 420
+Language/11_Expressions/08_Throw_A05_t03: Fail # co19 issue 420
+
LibTest/math/max_A01_t03: Fail # co19 issue 467
LibTest/math/min_A01_t03: Fail # co19 issue 467
@@ -153,8 +157,6 @@
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/2_Getters_A01_t03: Fail # inherited from VM
-Language/07_Classes/2_Getters_A01_t05: Fail # inherited from VM
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
@@ -278,10 +280,6 @@
Language/12_Statements/04_Local_Function_Declaration_A02_t02: Fail # Inherited from dart2js
Language/12_Statements/06_For_A01_t11: Fail # Inherited from dart2js
Language/12_Statements/09_Switch_A01_t02: Fail # Inherited from VM (switch case with several labels).
-Language/12_Statements/09_Switch_A02_t01: Fail # Inherited from dart2js
-Language/12_Statements/09_Switch_A02_t02: Fail # Inherited from dart2js
-Language/12_Statements/09_Switch_A03_t01: Fail # Inherited from dart2js
-Language/12_Statements/09_Switch_A03_t02: Fail # Inherited from dart2js
Language/12_Statements/09_Switch_A06_t02: Fail # Inherited from VM (does not throw NSME).
Language/12_Statements/10_Try_A06_t01: Fail, Pass # Passes in conservative renaming mode. Test depends on function names.
Language/12_Statements/10_Try_A07_t03: Fail # Test depends on out file name.
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index f4d828f..335f686 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.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.
+[ $compiler == dart2js && ($runtime == d8 || $runtime == drt) ]
+LibTest/core/List/sort_A01_t02: Pass, Fail # v8 bug: Issue 12293
+LibTest/core/List/sort_A01_t03: Pass, Fail # v8 bug: Issue 12293
+LibTest/core/Map/Map_class_A01_t04: Pass, Fail # v8 bug: Issue 12293
+
[ $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.
@@ -69,7 +74,6 @@
Language/12_Statements/03_Variable_Declaration_A04_t08: Fail # TODO(ahe): Please triage this failure.
Language/12_Statements/04_Local_Function_Declaration_A01_t01: Fail # TODO(ahe): Please triage this failure.
Language/12_Statements/04_Local_Function_Declaration_A02_t02: Fail # TODO(ahe): Please triage this failure.
-Language/12_Statements/09_Switch_A02_t02: Fail # TODO(ahe): Please triage this failure.
Language/12_Statements/09_Switch_A06_t02: Fail # co19 issue 413
Language/12_Statements/10_Try_A06_t01: Fail # Issue 11850: dart2js inlining results in stack traces not as accurate
Language/12_Statements/10_Try_A07_t03: Fail # TODO(ahe): Please triage this failure.
@@ -529,6 +533,10 @@
LibTest/core/Match/pattern_A01_t01: Fail # co19 Issue 400, 422
LibTest/core/RegExp/allMatches_A01_t01: Fail # co19 Issue 400, 422
+Language/11_Expressions/08_Throw_A05_t01: Fail # co19 issue 420
+Language/11_Expressions/08_Throw_A05_t02: Fail # co19 issue 420
+Language/11_Expressions/08_Throw_A05_t03: Fail # co19 issue 420
+
LibTest/core/String/indexOf_A01_t02: Fail # Issue 427
LibTest/core/String/lastIndexOf_A01_t02: Fail # Issue 427
@@ -567,6 +575,8 @@
Language/13_Libraries_and_Scripts/1_Imports_A03_t62: Fail # 481
Language/13_Libraries_and_Scripts/1_Imports_A03_t65: Fail # 481
+Language/14_Types/2_Dynamic_Type_System_A02_t01: Fail # co19 issue 481
+
[ $compiler == dart2js && $checked ]
Language/03_Overview/1_Scoping_A02_t30: Fail # co19 issue 463
@@ -707,8 +717,6 @@
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/2_Getters_A01_t03: Fail # Checks that a compile-time error is produced if empty formal parameter list is present.
-Language/07_Classes/2_Getters_A01_t05: Fail # Checks that a compile-time error is produced if an static getter has empty formal parameter list.
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.
@@ -732,8 +740,6 @@
# Unexpected compile-time errors.
#
[ $compiler == dart2js ]
-Language/14_Types/2_Dynamic_Type_System_A02_t01: Fail # http://dartbug.com/5029
-
Language/07_Classes/3_Setters_A04_t01: Fail # http://dartbug.com/5023
Language/07_Classes/3_Setters_A04_t02: Fail # http://dartbug.com/5023
Language/07_Classes/3_Setters_A04_t03: Fail # http://dartbug.com/5023
diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status
index 822b076..4e93a27 100644
--- a/tests/co19/co19-runtime.status
+++ b/tests/co19/co19-runtime.status
@@ -448,9 +448,19 @@
Language/13_Libraries_and_Scripts/1_Imports_A03_t31: Fail # co19 issue 463
Language/14_Types/8_Parameterized_Types_A02_t01: Fail # co19 issue 463
-LibTest/core/AssertionError/line_A01_t02: Fail # co19 issue 479
LibTest/core/Set/intersection_A03_t01: Fail # co19 issue 480
+
+LibTest/core/AssertionError/column_A01_t02: Fail # co19 issue 479
+LibTest/core/AssertionError/failedAssertion_A01_t01: Fail # co19 issue 479
+LibTest/core/AssertionError/line_A01_t02: Fail # co19 issue 479
+LibTest/core/AssertionError/url_A01_t01: Fail # co19 issue 479
+LibTest/core/TypeError/column_A01_t01: Fail # co19 issue 479
+LibTest/core/TypeError/dstName_A01_t01: Fail # co19 issue 479
+LibTest/core/TypeError/dstType_A01_t01: Fail # co19 issue 479
+LibTest/core/TypeError/failedAssertion_A01_t01: Fail # co19 issue 479
LibTest/core/TypeError/line_A01_t01: Fail # co19 issue 479
+LibTest/core/TypeError/srcType_A01_t01: Fail # co19 issue 479
+LibTest/core/TypeError/url_A01_t01: Fail # co19 issue 479
LibTest/core/Strings/concatAll_A04_t01: Fail, OK # checks for ArgumentError. TypeError is ok too. co19 issue 366
LibTest/core/Strings/join_A04_t01: Fail, OK # checks for ArgumentError. TypeError is ok too. co19 issue 366
@@ -474,9 +484,12 @@
Language/11_Expressions/15_Method_Invocation/4_Super_Invocation_A04_t04: Pass # co19 issues 405 and 463
Language/11_Expressions/15_Method_Invocation/1_Ordinary_Invocation_A05_t06: Pass # co19 issues 405 and 463
Language/11_Expressions/17_Getter_Invocation_A02_t02: Pass # co19 issues 405 and 463
-Language/11_Expressions/32_Type_Cast_A05_t01: Fail # co19 issue 463 and issue 5280
-Language/11_Expressions/32_Type_Cast_A05_t02: Pass # co19 issue 463 and issue 5280
-Language/11_Expressions/32_Type_Cast_A05_t04: Pass # co19 issue 463 and issue 5280
+
+Language/11_Expressions/32_Type_Cast_A05_t01: Fail # co19 issue 463
+Language/11_Expressions/32_Type_Cast_A05_t02: Fail # co19 issue 463
+Language/11_Expressions/32_Type_Cast_A05_t03: Fail # co19 issue 463
+Language/11_Expressions/32_Type_Cast_A05_t04: Fail # co19 issue 463
+Language/11_Expressions/32_Type_Cast_A05_t05: Fail # co19 issue 463
Language/12_Statements/09_Switch_A05_t01: Fail # co19 issue 442
@@ -512,7 +525,7 @@
LibTest/math/exp_A01_t01: Fail
[ $compiler == none && $runtime == vm && $system != windows && $arch != x64 && $arch != arm ]
-LibTest/math/tan_A01_t01: Fail
+LibTest/math/tan_A01_t01: Pass, Fail
[ $compiler == none && $runtime == vm && $arch != x64 ]
LibTest/core/int/operator_left_shift_A01_t02: Fail # co19 issue 129
diff --git a/tests/compiler/dart2js/deprecated_features_test.dart b/tests/compiler/dart2js/deprecated_features_test.dart
deleted file mode 100644
index 58d8f07..0000000
--- a/tests/compiler/dart2js/deprecated_features_test.dart
+++ /dev/null
@@ -1,86 +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.
-
-// Test that deprecated language features are diagnosed correctly.
-
-import "package:expect/expect.dart";
-import 'dart:async';
-
-import '../../../sdk/lib/_internal/compiler/compiler.dart';
-import '../../utils/dummy_compiler_test.dart' as dummy;
-
-main() {
- StringBuffer messages = new StringBuffer();
- void handler(Uri uri, int begin, int end, String message, Diagnostic kind) {
- if (kind == Diagnostic.VERBOSE_INFO) return;
- if (identical(kind.name, 'source map')) return;
- if (uri == null) {
- messages.write('$kind: $message\n');
- } else {
- Expect.equals('main:${uri.path}', '$uri');
- String source = TEST_SOURCE[uri.path];
- Expect.isNotNull(source);
- messages.write('$begin<${source.substring(begin, end)}>:${uri.path}:'
- '$kind: $message\n');
- }
- }
-
- Future<String> provider(Uri uri) {
- if (uri.scheme != "main") return dummy.provider(uri);
- String source = TEST_SOURCE[uri.path];
- Expect.isNotNull(source);
- return new Future<String>.value(source);
- }
-
- String code = deprecatedFutureValue(
- compile(new Uri(scheme: 'main'),
- new Uri(scheme: 'lib', path: '/'),
- new Uri(scheme: 'package', path: '/'),
- provider, handler));
- if (code == null) {
- throw 'Compilation failed: ${messages}';
- }
- Expect.stringEquals(
- // This string is composed of lines of the following format:
- //
- // offset<source>:path:kind: message
- //
- // "offset" is the character offset from the beginning of TEST_SOURCE.
- // "source" is the substring of TEST_SOURCE that the compiler is
- // indicating as erroneous.
- // "path" is the URI path.
- // "kind" is the result of calling toString on a [Diagnostic] object.
- // "message" is the expected message as a [String]. This is a
- // short-term solution and should eventually changed to include
- // a symbolic reference to a MessageKind.
- "15<part 'part.dart';>::${deprecatedMessage('missing part-of tag')}\n"
- "0<>:/part.dart:info: Note: This file has no part-of tag, but it is being"
- " used as a part.\n"
- "53<()>::${deprecatedMessage('getter parameters')}\n",
- messages.toString());
-}
-
-deprecatedMessage(feature) {
- return
- "warning: Warning: Deprecated language feature, $feature"
- ", will be removed in a future Dart milestone.";
-}
-
-const Map<String, String> TEST_SOURCE =
- const <String, String>{ '': """
-library test;
-
-part 'part.dart';
-
-class Foo {
- get x() => null;
-}
-
-main() {
- var a = new Foo();
-}
-""",
- // TODO(ahe): Why isn't this 'part.dart'? Why the leading slash?
- '/part.dart': '',
- };
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index a45e1ca..5418963 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -20,7 +20,8 @@
Compiler compilerFor(Map<String,String> memorySourceFiles,
{DiagnosticHandler diagnosticHandler,
- List<String> options: const []}) {
+ List<String> options: const [],
+ Compiler cachedCompiler}) {
Uri script = currentDirectory.resolve(nativeToUriPath(Platform.script));
Uri libraryRoot = script.resolve('../../../sdk/');
Uri packageRoot = script.resolve('./packages/');
@@ -42,6 +43,37 @@
libraryRoot,
packageRoot,
options);
+ if (cachedCompiler != null) {
+ compiler.coreLibrary = cachedCompiler.libraries['dart:core'];
+ compiler.types = cachedCompiler.types;
+ cachedCompiler.libraries.forEach((String uri, library) {
+ if (library.isPlatformLibrary) {
+ compiler.libraries[uri] = library;
+ compiler.onLibraryScanned(library, library.canonicalUri);
+ }
+ });
+
+ compiler.symbolConstructor = cachedCompiler.symbolConstructor;
+ compiler.mirrorSystemClass = cachedCompiler.mirrorSystemClass;
+ compiler.mirrorsUsedClass = cachedCompiler.mirrorsUsedClass;
+ compiler.mirrorSystemGetNameFunction =
+ cachedCompiler.mirrorSystemGetNameFunction;
+ compiler.symbolImplementationClass =
+ cachedCompiler.symbolImplementationClass;
+ compiler.symbolValidatedConstructor =
+ cachedCompiler.symbolValidatedConstructor;
+ compiler.mirrorsUsedConstructor = cachedCompiler.mirrorsUsedConstructor;
+ compiler.deferredLibraryClass = cachedCompiler.deferredLibraryClass;
+
+ Map cachedTreeElements =
+ cachedCompiler.enqueuer.resolution.resolvedElements;
+ cachedTreeElements.forEach((element, treeElements) {
+ if (element.getLibrary().isPlatformLibrary) {
+ compiler.enqueuer.resolution.resolvedElements[element] =
+ treeElements;
+ }
+ });
+ }
return compiler;
}
diff --git a/tests/compiler/dart2js/message_kind_helper.dart b/tests/compiler/dart2js/message_kind_helper.dart
new file mode 100644
index 0000000..f972a96
--- /dev/null
+++ b/tests/compiler/dart2js/message_kind_helper.dart
@@ -0,0 +1,50 @@
+// 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 dart2js.test.message_kind_helper;
+
+import 'package:expect/expect.dart';
+
+import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show
+ Compiler,
+ MessageKind;
+
+import 'memory_compiler.dart';
+
+const String ESCAPE_REGEXP = r'[[\]{}()*+?.\\^$|]';
+
+Compiler check(MessageKind kind, Compiler cachedCompiler) {
+ Expect.isNotNull(kind.howToFix);
+ Expect.isFalse(kind.examples.isEmpty);
+
+ for (String example in kind.examples) {
+ List<String> messages = <String>[];
+ void collect(Uri uri, int begin, int end, String message, kind) {
+ if (kind.name == 'verbose info') {
+ return;
+ }
+ messages.add(message);
+ }
+
+ Compiler compiler = compilerFor(
+ {'main.dart': example},
+ diagnosticHandler: collect,
+ options: ['--analyze-only'],
+ cachedCompiler: cachedCompiler);
+
+ compiler.run(Uri.parse('memory:main.dart'));
+
+ Expect.isFalse(messages.isEmpty, 'No messages in """$example"""');
+
+ String pattern = '${kind.template}\n${kind.howToFix}'.replaceAllMapped(
+ new RegExp(ESCAPE_REGEXP), (m) => '\\${m[0]}');
+ pattern = pattern.replaceAll(new RegExp(r'#\\\{[^}]*\\\}'), '.*');
+
+ for (String message in messages) {
+ Expect.isTrue(new RegExp('^$pattern\$').hasMatch(message),
+ '"$pattern" does not match "$message"');
+ }
+ return compiler;
+ }
+}
diff --git a/tests/compiler/dart2js/message_kind_test.dart b/tests/compiler/dart2js/message_kind_test.dart
new file mode 100644
index 0000000..55f9bed
--- /dev/null
+++ b/tests/compiler/dart2js/message_kind_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' show
+ DualKind,
+ MessageKind;
+
+import 'message_kind_helper.dart';
+
+import 'dart:mirrors';
+
+main() {
+ ClassMirror cls = reflectClass(MessageKind);
+ Map<String, MessageKind> kinds = <String, MessageKind>{};
+ cls.variables.forEach((Symbol name, VariableMirror variable) {
+ if (variable.isStatic) {
+ var value = cls.getField(name).reflectee;
+ if (value is MessageKind) {
+ kinds[MirrorSystem.getName(name)] = value;
+ } else if (value is DualKind) {
+ kinds['${MirrorSystem.getName(name)}.error'] = value.error;
+ kinds['${MirrorSystem.getName(name)}.warning'] = value.warning;
+ } else {
+ Expect.fail("Weird static field: '${MirrorSystem.getName(name)}'.");
+ }
+ }
+ });
+ List<String> names = kinds.keys.toList()..sort();
+ List<String> examples = <String>[];
+ for (String name in names) {
+ MessageKind kind = kinds[name];
+ if (name == 'GENERIC' // Shouldn't be used.
+ // We can't provoke a crash.
+ || name == 'COMPILER_CRASHED'
+ || name == 'PLEASE_REPORT_THE_CRASH'
+ // We cannot provide examples for patch errors.
+ || name.startsWith('PATCH_')) continue;
+ if (kind.examples != null) {
+ examples.add(name);
+ } else {
+ print("No example in '$name'");
+ }
+ };
+ var cachedCompiler;
+ for (String name in examples) {
+ Stopwatch sw = new Stopwatch()..start();
+ cachedCompiler = check(kinds[name], cachedCompiler);
+ sw.stop();
+ print("Checked '$name' in ${sw.elapsedMilliseconds}ms.");
+ }
+}
diff --git a/tests/compiler/dart2js/mirror_helper_test.dart b/tests/compiler/dart2js/mirror_helper_test.dart
new file mode 100644
index 0000000..01e69ed
--- /dev/null
+++ b/tests/compiler/dart2js/mirror_helper_test.dart
@@ -0,0 +1,134 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import 'memory_compiler.dart' show compilerFor;
+import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart' show
+ Compiler;
+import
+ '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dart'
+show
+ Element, LibraryElement, ClassElement;
+import
+ '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'
+show
+ Node;
+import
+ '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_backend.dart'
+show
+ DartBackend, ElementAst;
+import
+ '../../../sdk/lib/_internal/compiler/implementation/mirror_renamer/mirror_renamer.dart'
+show
+ MirrorRenamer;
+import
+ '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.dart'
+show
+ SourceString;
+
+
+main() {
+ testWithMirrorRenaming();
+ testWithoutMirrorRenaming();
+ testWithMirrorRenamingMinify();
+ testWithoutMirrorRenamingMinify();
+}
+
+Compiler runCompiler({useMirrorHelperLibrary: false, minify: false}) {
+ List<String> options = ['--output-type=dart'];
+ if (minify) {
+ options.add('--minify');
+ }
+ Compiler compiler = compilerFor(MEMORY_SOURCE_FILES, options: options);
+ DartBackend backend = compiler.backend;
+ backend.useMirrorHelperLibrary = useMirrorHelperLibrary;
+ compiler.runCompiler(Uri.parse('memory:main.dart'));
+ return compiler;
+}
+
+void testWithMirrorRenaming() {
+ Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: false);
+
+ DartBackend backend = compiler.backend;
+ Map<Node, String> renames = backend.renames;
+ Map<LibraryElement, String> imports = backend.imports;
+
+ Node getNameFunctionNode =
+ backend.memberNodes.values.first.first.body.statements.nodes.head;
+
+ Expect.equals(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION,
+ renames[getNameFunctionNode.expression.selector]);
+ Expect.equals(MirrorRenamer.MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME,
+ renames[getNameFunctionNode.expression.receiver]);
+ Expect.equals(2, imports.keys.length);
+ Expect.isTrue(imports.keys.any((library) =>
+ library.canonicalUri ==
+ new Uri(path: MirrorRenamer.MIRROR_HELPER_LIBRARY_NAME)));
+}
+
+void testWithMirrorRenamingMinify() {
+ Compiler compiler = runCompiler(useMirrorHelperLibrary: true, minify: true);
+
+ DartBackend backend = compiler.backend;
+ Map<Node, String> renames = backend.renames;
+ Map<LibraryElement, String> imports = backend.imports;
+
+ Node getNameFunctionNode =
+ backend.memberNodes.values.first.first.body.statements.nodes.head;
+
+ Expect.equals(MirrorRenamer.MIRROR_HELPER_GET_NAME_FUNCTION,
+ renames[getNameFunctionNode.expression.selector]);
+ Expect.equals(MirrorRenamer.MIRROR_HELPER_CLASS_FULLY_QUALIFIED_NAME,
+ renames[getNameFunctionNode.expression.receiver]);
+ Expect.equals(2, imports.keys.length);
+ Expect.isTrue(imports.keys.any((library) =>
+ library.canonicalUri ==
+ new Uri(path: MirrorRenamer.MIRROR_HELPER_LIBRARY_NAME)));
+}
+
+void testWithoutMirrorRenaming() {
+ Compiler compiler = runCompiler(useMirrorHelperLibrary: false, minify: false);
+
+ DartBackend backend = compiler.backend;
+ Map<Node, String> renames = backend.renames;
+ Map<LibraryElement, String> imports = backend.imports;
+
+ Node getNameFunctionNode =
+ backend.memberNodes.values.first.first.body.statements.nodes.head;
+
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector));
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver));
+ Expect.equals(1, imports.keys.length);
+}
+
+void testWithoutMirrorRenamingMinify() {
+ Compiler compiler = runCompiler(useMirrorHelperLibrary: false, minify: true);
+
+ DartBackend backend = compiler.backend;
+ Map<Node, String> renames = backend.renames;
+ Map<LibraryElement, String> imports = backend.imports;
+
+ Node getNameFunctionNode =
+ backend.memberNodes.values.first.first.body.statements.nodes.head;
+
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.selector));
+ Expect.isFalse(renames.containsKey(getNameFunctionNode.expression.receiver));
+ Expect.equals(1, imports.keys.length);
+}
+
+const MEMORY_SOURCE_FILES = const <String, String> {
+ 'main.dart': """
+import 'dart:mirrors';
+
+
+class Foo {
+ noSuchMethod(Invocation invocation) {
+ MirrorSystem.getName(invocation.memberName);
+ }
+}
+
+void main() {
+ new Foo().fisk();
+}
+"""};
diff --git a/tests/compiler/dart2js/mirrors_used_test.dart b/tests/compiler/dart2js/mirrors_used_test.dart
index 09fdd29..75623b9 100644
--- a/tests/compiler/dart2js/mirrors_used_test.dart
+++ b/tests/compiler/dart2js/mirrors_used_test.dart
@@ -48,19 +48,36 @@
// 2. Some code was refactored, and there are more methods.
// Either situation could be problematic, but in situation 2, it is often
// acceptable to increase [expectedMethodCount] a little.
- int expectedMethodCount = 315;
+ int expectedMethodCount = 317;
Expect.isTrue(
generatedCode.length <= expectedMethodCount,
'Too many compiled methods: '
'${generatedCode.length} > $expectedMethodCount');
+ // The following names should be retained:
+ List expectedNames = [
+ 'Foo', // The name of class Foo.
+ r'Foo$', // The name of class Foo's constructor.
+ 'Foo_staticMethod', // The name of Foo.staticMethod.
+ r'get$field', // The (getter) name of Foo.field.
+ r'instanceMethod$0']; // The name of Foo.instanceMethod.
+ Set recordedNames = new Set()
+ ..addAll(compiler.backend.emitter.recordedMangledNames)
+ ..addAll(compiler.backend.emitter.mangledFieldNames.keys)
+ ..addAll(compiler.backend.emitter.mangledGlobalFieldNames.keys);
+ Expect.setEquals(new Set.from(expectedNames), recordedNames);
+
for (var library in compiler.libraries.values) {
library.forEachLocalMember((member) {
- if (library == compiler.mainApp) {
- // TODO(ahe): We currently retain the entire library. Update this test
- // to test that only Foo is retained.
+ if (library == compiler.mainApp
+ && member.name == const SourceString('Foo')) {
Expect.isTrue(
compiler.backend.isNeededForReflection(member), '$member');
+ member.forEachLocalMember((classMember) {
+ Expect.isTrue(
+ compiler.backend.isNeededForReflection(classMember),
+ '$classMember');
+ });
} else {
Expect.isFalse(
compiler.backend.isNeededForReflection(member), '$member');
@@ -76,7 +93,14 @@
import 'library.dart';
-class Foo {}
+class Foo {
+ int field;
+ instanceMethod() {}
+ static staticMethod() {}
+}
+
+unusedFunction() {
+}
main() {
useReflect(Foo);
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 950a7e5..ec113a8 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -340,7 +340,7 @@
errors = [];
}
- TreeElementMapping resolveStatement(String text) {
+ CollectingTreeElements resolveStatement(String text) {
parsedTree = parseStatement(text);
return resolveNodeStatement(parsedTree, mainApp);
}
@@ -380,10 +380,6 @@
// Do nothing. The mock core library is already handled in the constructor.
}
- void importCoreLibrary(LibraryElement library) {
- scanner.importLibrary(library, coreLibrary, null);
- }
-
Uri translateResolvedUri(LibraryElement importingLibrary,
Uri resolvedUri, Node node) => resolvedUri;
@@ -427,7 +423,7 @@
}
}
-void importLibrary(LibraryElement target, LibraryElement imported,
+void importLibrary(LibraryElement target, LibraryElementX imported,
Compiler compiler) {
for (var element in imported.localMembers) {
compiler.withCurrentElement(element, () {
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 5398829..112ba50 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -252,7 +252,7 @@
MockCompiler compiler = testLocals([["foo", false], ["foo", false]]);
Expect.equals(1, compiler.errors.length);
Expect.equals(
- new Message(MessageKind.DUPLICATE_DEFINITION, {'name': 'foo'}),
+ new Message(MessageKind.DUPLICATE_DEFINITION, {'name': 'foo'}, false),
compiler.errors[0].message);
}
@@ -435,7 +435,7 @@
Expect.equals(
new Message(
- MessageKind.CANNOT_RESOLVE_TYPE.warning, {'typeName': 'Foo'}),
+ MessageKind.CANNOT_RESOLVE_TYPE.warning, {'typeName': 'Foo'}, false),
compiler.warnings[0].message);
VariableDefinitions definition = compiler.parsedTree;
Expect.equals(warningNode, definition.type);
@@ -462,7 +462,7 @@
// should only the get the error once.
Expect.equals(2, compiler.errors.length);
var cannotResolveBar = new Message(MessageKind.CANNOT_RESOLVE_TYPE.error,
- {'typeName': 'Bar'});
+ {'typeName': 'Bar'}, false);
Expect.equals(cannotResolveBar, compiler.errors[0].message);
Expect.equals(cannotResolveBar, compiler.errors[1].message);
compiler.clearErrors();
@@ -487,7 +487,8 @@
compiler.resolveStatement("Foo bar;");
Expect.equals(1, compiler.errors.length);
Expect.equals(
- new Message(MessageKind.CANNOT_RESOLVE_TYPE.warning, {'typeName': 'var'}),
+ new Message(
+ MessageKind.CANNOT_RESOLVE_TYPE.warning, {'typeName': 'var'}, false),
compiler.errors[0].message);
compiler.clearErrors();
}
@@ -498,7 +499,8 @@
compiler.resolveStatement("Foo bar;");
Expect.equals(1, compiler.errors.length);
Expect.equals(
- new Message(MessageKind.CANNOT_RESOLVE_TYPE.warning, {'typeName': 'bar'}),
+ new Message(
+ MessageKind.CANNOT_RESOLVE_TYPE.warning, {'typeName': 'bar'}, false),
compiler.errors[0].message);
compiler.clearErrors();
@@ -811,7 +813,7 @@
}
map(ResolverVisitor visitor) {
- TreeElementMapping elements = visitor.mapping;
+ CollectingTreeElements elements = visitor.mapping;
return elements.map;
}
@@ -832,8 +834,8 @@
}
checkMemberResolved(compiler, className, memberName) {
- Element memberElement = findElement(compiler, className)
- .lookupLocalMember(memberName);
+ ClassElement cls = findElement(compiler, className);
+ Element memberElement = cls.lookupLocalMember(memberName);
Expect.isNotNull(memberElement);
Expect.isNotNull(
compiler.enqueuer.resolution.getCachedElements(memberElement));
diff --git a/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart b/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
index e346b11..6ae3174 100644
--- a/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
@@ -28,7 +28,7 @@
}
class B extends A {
- get foo() => 42;
+ get foo => 42;
operator[](index) => 42;
returnString1() => super.foo--;
diff --git a/tests/compiler/dart2js/source_mapping_test.dart b/tests/compiler/dart2js/source_mapping_test.dart
index 3cccbbd..e204f2b 100644
--- a/tests/compiler/dart2js/source_mapping_test.dart
+++ b/tests/compiler/dart2js/source_mapping_test.dart
@@ -61,7 +61,7 @@
String UNARY_TEST = 'void main() { ((x, y) { print(@-x + @~y); })(1,2); }';
-String BINARY_TEST = 'void main() { ((x, y) { if (x @!== y) print(x @* y); })(1,2); }';
+String BINARY_TEST = 'void main() { ((x, y) { if (x @!= y) print(x @* y); })(1,2); }';
String SEND_TEST = '''
void main() {
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index f0f61fd..e543480 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -140,10 +140,19 @@
analyze("switch (0) { case 1: break; case 2: break; }");
analyze("switch (0) { case 1: int i = ''; break; case 2: break; }",
NOT_ASSIGNABLE);
- analyze("switch (0) { case '': break; case 2: break; }",
+ analyze("switch (0) { case '': break; }",
NOT_ASSIGNABLE);
analyze("switch ('') { case 1: break; case 2: break; }",
[NOT_ASSIGNABLE, NOT_ASSIGNABLE]);
+
+ analyze("switch (0.5) { case 0.5: break; case 1.5: break; }",
+ [], []);
+ analyze("switch (1.0) { case 1.0: break; case 1.5: break; }",
+ [], []);
+ analyze("switch (null) { case 1.0: break; case 2: break; }",
+ [MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
+ MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE],
+ [MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL]);
}
testOperators() {
@@ -1543,9 +1552,11 @@
};
}
-analyze(String text, [expectedWarnings]) {
+analyze(String text, [expectedWarnings, expectedErrors]) {
if (expectedWarnings == null) expectedWarnings = [];
if (expectedWarnings is !List) expectedWarnings = [expectedWarnings];
+ if (expectedErrors == null) expectedErrors = [];
+ if (expectedErrors is !List) expectedErrors = [expectedErrors];
compiler.diagnosticHandler = createHandler(text);
@@ -1562,8 +1573,10 @@
TypeCheckerVisitor checker = new TypeCheckerVisitor(compiler, elements,
types);
compiler.clearWarnings();
+ compiler.clearErrors();
checker.analyze(node);
compareWarningKinds(text, expectedWarnings, compiler.warnings);
+ compareWarningKinds(text, expectedErrors, compiler.errors);
compiler.diagnosticHandler = null;
}
diff --git a/tests/compiler/dart2js_extra/deferred/deferred_unused_classes_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_unused_classes_test.dart
new file mode 100644
index 0000000..db4389e
--- /dev/null
+++ b/tests/compiler/dart2js_extra/deferred/deferred_unused_classes_test.dart
@@ -0,0 +1,19 @@
+// 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 deferred loader analyzer doesn't trip over unused classes.
+
+import "package:expect/expect.dart";
+import 'dart:async';
+
+@lazy import 'deferred_class_library.dart';
+
+const lazy = const DeferredLibrary('deferred_class_library');
+
+class Base {}
+
+class DerivedNotUsed extends Base {}
+
+main() {
+}
diff --git a/tests/compiler/dart2js_extra/inline_position_crash_source.dart b/tests/compiler/dart2js_extra/inline_position_crash_source.dart
index 64d03ce..67194b8 100644
--- a/tests/compiler/dart2js_extra/inline_position_crash_source.dart
+++ b/tests/compiler/dart2js_extra/inline_position_crash_source.dart
@@ -2,6 +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.
+part of inline_position_crash_test;
+
/*******************************************************************************
* Long comment to make positions in this file exceed those in
* 'inline_position_crash_source.dart'.
diff --git a/tests/compiler/dart2js_extra/inline_position_crash_test.dart b/tests/compiler/dart2js_extra/inline_position_crash_test.dart
index 07039ddd..54f58b2 100644
--- a/tests/compiler/dart2js_extra/inline_position_crash_test.dart
+++ b/tests/compiler/dart2js_extra/inline_position_crash_test.dart
@@ -2,6 +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.
+library inline_position_crash_test;
+
part 'inline_position_crash_source.dart';
class Sub extends Super {
diff --git a/tests/compiler/dart2js_extra/source_mapping_crash_source.dart b/tests/compiler/dart2js_extra/source_mapping_crash_source.dart
index 825360f..78f15e3 100644
--- a/tests/compiler/dart2js_extra/source_mapping_crash_source.dart
+++ b/tests/compiler/dart2js_extra/source_mapping_crash_source.dart
@@ -2,6 +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.
+part of source_mapping_crash_test;
+
/*******************************************************************************
* Long comment to make positions in this file exceed those in
* 'source_mapping_crash_test.dart'.
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 5b87bf8..e67a374 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -4,6 +4,11 @@
reg_exp_unicode_2_test: Fail # Bug 6592
+[ $compiler == dart2js && ($runtime == d8 || $runtime == drt) ]
+hash_set_test: Pass, Fail # v8 bug: Issue 12293
+list_test: Pass, Fail # v8 bug: Issue 12293
+
+
[ $compiler == none ]
unicode_test: Fail # Bug 6706
*dartc_test: Skip
diff --git a/tests/corelib/uri_file_test.dart b/tests/corelib/uri_file_test.dart
new file mode 100644
index 0000000..d0e30a7
--- /dev/null
+++ b/tests/corelib/uri_file_test.dart
@@ -0,0 +1,273 @@
+// 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:expect/expect.dart";
+
+testFileUri() {
+ final unsupported = new UnsupportedError("");
+
+ var tests = [
+ ["", "", ""],
+ ["relative", "relative", "relative"],
+ ["relative/", "relative/", "relative\\"],
+ ["a%20b", "a b", "a b"],
+ ["a%20b/", "a b/", "a b\\"],
+ ["a/b", "a/b", "a\\b"],
+ ["a/b/", "a/b/", "a\\b\\"],
+ ["a%20b/c%20d", "a b/c d", "a b\\c d"],
+ ["a%20b/c%20d/", "a b/c d/", "a b\\c d\\"],
+
+ ["file:///absolute", "/absolute", "\\absolute"],
+ ["file:///absolute", "/absolute", "\\absolute"],
+ ["file:///a/b", "/a/b", "\\a\\b"],
+ ["file:///a/b", "/a/b", "\\a\\b"],
+
+ ["file://server/a/b", unsupported, "\\\\server\\a\\b"],
+ ["file://server/a/b/", unsupported, "\\\\server\\a\\b\\"],
+
+ ["file:///C:/", "/C:/", "C:\\"],
+ ["file:///C:/a/b", "/C:/a/b", "C:\\a\\b"],
+ ["file:///C:/a/b/", "/C:/a/b/", "C:\\a\\b\\"],
+
+ ["http:/a/b", unsupported, unsupported],
+ ["https:/a/b", unsupported, unsupported],
+ ["urn:a:b", unsupported, unsupported],
+ ];
+
+ void check(String s, filePath, bool windows) {
+ Uri uri = Uri.parse(s);
+ if (filePath is Error) {
+ if (filePath is UnsupportedError) {
+ Expect.throws(() => uri.toFilePath(windows: windows),
+ (e) => e is UnsupportedError);
+ } else {
+ Expect.throws(() => uri.toFilePath(windows: windows));
+ }
+ } else {
+ Expect.equals(filePath, uri.toFilePath(windows: windows));
+ Expect.equals(
+ s, new Uri.file(filePath, windows: windows).toString());
+ }
+ }
+
+ for (var test in tests) {
+ check(test[0], test[1], false);
+ check(test[0], test[2], true);
+ }
+
+ Uri uri;
+ uri = Uri.parse("file:a");
+ Expect.equals("/a", uri.toFilePath(windows: false));
+ Expect.equals("\\a", uri.toFilePath(windows: true));
+ uri = Uri.parse("file:a/");
+ Expect.equals("/a/", uri.toFilePath(windows: false));
+ Expect.equals("\\a\\", uri.toFilePath(windows: true));
+}
+
+testFileUriWindowsSlash() {
+ var tests = [
+ ["", "", ""],
+ ["relative", "relative", "relative"],
+ ["relative/", "relative/", "relative\\"],
+ ["a%20b", "a b", "a b"],
+ ["a%20b/", "a b/", "a b\\"],
+ ["a/b", "a/b", "a\\b"],
+ ["a/b/", "a/b/", "a\\b\\"],
+ ["a%20b/c%20d", "a b/c d", "a b\\c d"],
+ ["a%20b/c%20d/", "a b/c d/", "a b\\c d\\"],
+
+ ["file:///absolute", "/absolute", "\\absolute"],
+ ["file:///absolute", "/absolute", "\\absolute"],
+ ["file:///a/b", "/a/b", "\\a\\b"],
+ ["file:///a/b", "/a/b", "\\a\\b"],
+
+ ["file://server/a/b", "//server/a/b", "\\\\server\\a\\b"],
+ ["file://server/a/b/", "//server/a/b/", "\\\\server\\a\\b\\"],
+
+ ["file:///C:/", "C:/", "C:\\"],
+ ["file:///C:/a/b", "C:/a/b", "C:\\a\\b"],
+ ["file:///C:/a/b/", "C:/a/b/", "C:\\a\\b\\"],
+ ];
+
+ for (var test in tests) {
+ Uri uri;
+ uri = new Uri.file(test[1], windows: true);
+ Expect.equals(test[0], uri.toString());
+ Expect.equals(test[2], uri.toFilePath(windows: true));
+ }
+}
+
+testFileUriWindowsWin32Namespace() {
+ var tests = [
+ ["\\\\?\\C:\\", "file:///C:/", "C:\\"],
+ ["\\\\?\\C:\\", "file:///C:/", "C:\\"],
+ ["\\\\?\\UNC\\server\\share\\file",
+ "file://server/share/file",
+ "\\\\server\\share\\file"],
+ ];
+
+ for (var test in tests) {
+ Uri uri = new Uri.file(test[0], windows: true);
+ Expect.equals(test[1], uri.toString());
+ Expect.equals(test[2], uri.toFilePath(windows: true));
+ }
+
+ Expect.throws(
+ () => new Uri.file("\\\\?\\file", windows: true),
+ (e) => e is ArgumentError);
+ Expect.throws(
+ () => new Uri.file("\\\\?\\UNX\\server\\share\\file", windows: true),
+ (e) => e is ArgumentError);
+}
+
+testFileUriDriveLetter() {
+ check(String s, String nonWindows, String windows) {
+ Uri uri;
+ uri = Uri.parse(s);
+ Expect.equals(nonWindows, uri.toFilePath(windows: false));
+ if (windows != null) {
+ Expect.equals(windows, uri.toFilePath(windows: true));
+ } else {
+ Expect.throws(() => uri.toFilePath(windows: true),
+ (e) => e is UnsupportedError);
+ }
+ }
+
+ check("file:///C:", "/C:", "C:\\");
+ check("file:///C:/", "/C:/", "C:\\");
+ check("file:///C:a", "/C:a", null);
+ check("file:///C:a/", "/C:a/", null);
+
+ Expect.throws(() => new Uri.file("C:", windows: true),
+ (e) => e is ArgumentError);
+ Expect.throws(() => new Uri.file("C:a", windows: true),
+ (e) => e is ArgumentError);
+ Expect.throws(() => new Uri.file("C:a\b", windows: true),
+ (e) => e is ArgumentError);
+}
+
+testFileUriResolve() {
+ var tests = [
+ ["file:///a", "/a", "", "\\a", ""],
+ ["file:///a/", "/a/", "", "\\a\\", ""],
+ ["file:///b", "/a", "b", "\\a", "b"],
+ ["file:///b/", "/a", "b/", "\\a", "b\\"],
+ ["file:///a/b", "/a/", "b", "\\a\\", "b"],
+ ["file:///a/b/", "/a/", "b/", "\\a\\", "b\\"],
+ ["file:///a/c/d", "/a/b", "c/d", "\\a\\b", "c\\d"],
+ ["file:///a/c/d/", "/a/b", "c/d/", "\\a\\b", "c\\d\\"],
+ ["file:///a/b/c/d", "/a/b/", "c/d", "\\a\\b\\", "c\\d"],
+ ["file:///a/b/c/d/", "/a/b/", "c/d/", "\\a\\b\\", "c\\d\\"],
+ ];
+
+ check(String s, String absolute, String relative, bool windows) {
+ Uri absoluteUri = new Uri.file(absolute, windows: windows);
+ Uri relativeUri = new Uri.file(relative, windows: windows);
+ String relativeString =
+ windows ? relative.replaceAll("\\", "/") : relative;
+ Expect.equals(s, absoluteUri.resolve(relativeString).toString());
+ Expect.equals(s, absoluteUri.resolveUri(relativeUri).toString());
+ }
+
+ for (var test in tests) {
+ check(test[0], test[1], test[2], false);
+ check(test[0], test[1], test[2], true);
+ check(test[0], test[1], test[4], true);
+ check(test[0], test[3], test[2], true);
+ check(test[0], test[3], test[4], true);
+ }
+}
+
+testFileUriIllegalCharacters() {
+ // Slash is an invalid character in file names on both non-Windows
+ // and Windows.
+ Uri uri = Uri.parse("file:///a%2Fb");
+ Expect.throws(() => uri.toFilePath(windows: false),
+ (e) => e is UnsupportedError);
+ Expect.throws(() => uri.toFilePath(windows: true),
+ (e) => e is UnsupportedError);
+
+ // Illegal characters in windows file names.
+ var illegalWindowsPaths =
+ ["a<b", "a>b", "a:b", "a\"b", "a|b", "a?b", "a*b", "\\\\?\\c:\\a/b"];
+
+ for (var test in illegalWindowsPaths) {
+ Expect.throws(() => new Uri.file(test, windows: true),
+ (e) => e is ArgumentError);
+ Expect.throws(() => new Uri.file("\\$test", windows: true),
+ (e) => e is ArgumentError);
+
+ // It is possible to create non-Windows URIs, but not Windows URIs.
+ Uri uri = new Uri.file(test, windows: false);
+ Uri absoluteUri = new Uri.file("/$test", windows: false);
+ Expect.throws(() => new Uri.file(test, windows: true));
+ Expect.throws(() => new Uri.file("\\$test", windows: true));
+
+ // It is possible to extract non-Windows file path, but not
+ // Windows file path.
+ Expect.equals(test, uri.toFilePath(windows: false));
+ Expect.equals("/$test", absoluteUri.toFilePath(windows: false));
+ Expect.throws(() => uri.toFilePath(windows: true));
+ Expect.throws(() => absoluteUri.toFilePath(windows: true));
+ }
+
+ // Backslash
+ illegalWindowsPaths = ["a\\b", "a\\b\\"];
+ for (var test in illegalWindowsPaths) {
+ // It is possible to create both non-Windows URIs, and Windows URIs.
+ Uri uri = new Uri.file(test, windows: false);
+ Uri absoluteUri = new Uri.file("/$test", windows: false);
+ new Uri.file(test, windows: true);
+ new Uri.file("\\$test", windows: true);
+
+ // It is possible to extract non-Windows file path, but not
+ // Windows file path from the non-Windows URI (it has a backslash
+ // in a path segment).
+ Expect.equals(test, uri.toFilePath(windows: false));
+ Expect.equals("/$test", absoluteUri.toFilePath(windows: false));
+ Expect.throws(() => uri.toFilePath(windows: true),
+ (e) => e is UnsupportedError);
+ Expect.throws(() => absoluteUri.toFilePath(windows: true));
+ }
+}
+
+testFileUriIllegalDriveLetter() {
+ Expect.throws(() => new Uri.file("1:\\", windows: true),
+ (e) => e is ArgumentError);
+ Uri uri = new Uri.file("1:\\", windows: false);
+ Expect.equals("1:\\", uri.toFilePath(windows: false));
+ Expect.throws(() => uri.toFilePath(windows: true),
+ (e) => e is UnsupportedError);
+}
+
+testAdditionalComponents() {
+ check(String s, {bool windowsOk: false}) {
+ Uri uri = Uri.parse(s);
+ Expect.throws(() => uri.toFilePath(windows: false),
+ (e) => e is UnsupportedError);
+ if (windowsOk) {
+ Expect.isTrue(uri.toFilePath(windows: true) is String);
+ } else {
+ Expect.throws(() => uri.toFilePath(windows: true),
+ (e) => e is UnsupportedError);
+ }
+ }
+
+ check("file:///path?query");
+ check("file:///path#fragment");
+ check("file:///path?query#fragment");
+ check("file://host/path", windowsOk: true);
+ check("file://user@password:host/path");
+}
+
+main() {
+ testFileUri();
+ testFileUriWindowsSlash();
+ testFileUriDriveLetter();
+ testFileUriWindowsWin32Namespace();
+ testFileUriResolve();
+ testFileUriIllegalCharacters();
+ testFileUriIllegalDriveLetter();
+ testAdditionalComponents();
+}
diff --git a/tests/html/element_test.dart b/tests/html/element_test.dart
index 7e13741..71dd4ea 100644
--- a/tests/html/element_test.dart
+++ b/tests/html/element_test.dart
@@ -285,6 +285,17 @@
expect(firedEvent, false);
e.click();
expect(firedEvent, true);
+
+ var e2 = new DivElement();
+ var firedEvent2 = false;
+ e2.onClick.matches('.foo').listen((event) {
+ firedEvent2 = true;
+ });
+ e2.click();
+ expect(firedEvent2, false);
+ e2.classes.add('foo');
+ e2.click();
+ expect(firedEvent2, true);
});
});
@@ -728,4 +739,85 @@
expect(range[1], isInputElement);
});
});
+
+ group('eventDelegation', () {
+ test('matches', () {
+ Element elem = new Element.div()..classes.addAll(['a', 'b']);
+ Element img = new Element.img()
+ ..classes.addAll(['b', 'a', 'd'])
+ ..id = 'cookie';
+ Element input = new InputElement()..classes.addAll(['c', 'd']);
+ var div = new Element.div()
+ ..classes.add('a')
+ ..id = 'wat';
+ document.body.append(elem);
+ document.body.append(img);
+ document.body.append(input);
+ document.body.append(div);
+
+ Element elem4 = new Element.div()..classes.addAll(['i', 'j']);
+ Element elem5 = new Element.div()
+ ..classes.addAll(['g', 'h'])
+ ..children.add(elem4);
+ Element elem6 = new Element.div()
+ ..classes.addAll(['e', 'f'])
+ ..children.add(elem5);
+ document.body.append(elem6);
+
+ var firedEvent = false;
+ var elems = queryAll('.a');
+ queryAll('.a').onClick.listen((event) {
+ firedEvent = true;
+ });
+ expect(firedEvent, false);
+ query('.c').click();
+ expect(firedEvent, false);
+ query('#wat').click();
+ expect(firedEvent, true);
+
+ var firedEvent4 = false;
+ queryAll('.a').onClick.matches('.d').listen((event) {
+ firedEvent4 = true;
+ });
+ expect(firedEvent4, false);
+ query('.c').click();
+ expect(firedEvent4, false);
+ query('#wat').click();
+ expect(firedEvent4, false);
+ query('#cookie').click();
+ expect(firedEvent4, true);
+
+ var firedEvent2 = false;
+ queryAll('.a').onClick.listen((event) {
+ firedEvent2 = true;
+ });
+ Element elem2 = new Element.html('<div class="a"><br/>');
+ document.body.append(elem2);
+ elem2.click();
+ expect(firedEvent2, false);
+ elem2.classes.add('a');
+ elem2.click();
+ expect(firedEvent2, false);
+
+ var firedEvent3 = false;
+ queryAll(':root').onClick.matches('.a').listen((event) {
+ firedEvent3 = true;
+ });
+ Element elem3 = new Element.html('<div class="d"><br/>');
+ document.body.append(elem3);
+ elem3.click();
+ expect(firedEvent3, false);
+ elem3.classes.add('a');
+ elem3.click();
+ expect(firedEvent3, true);
+
+ var firedEvent5 = false;
+ queryAll(':root').onClick.matches('.e').listen((event) {
+ firedEvent5 = true;
+ });
+ expect(firedEvent5, false);
+ query('.i').click();
+ expect(firedEvent5, true);
+ });
+ });
}
diff --git a/tests/html/html.status b/tests/html/html.status
index 03be635..1000c5c 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -14,7 +14,7 @@
# Document.register is unimplemented.
custom_elements_test: Skip
-[ $compiler == dartanalyzer ]
+[ $compiler == dartanalyzer || $compiler == dart2analyzer ]
# Document.register is unimplemented.
custom_elements_test: Skip
@@ -71,6 +71,8 @@
[ $compiler == none && ($runtime == drt || $runtime == dartium) ]
request_animation_frame_test: Skip # drt hangs; requestAnimationFrame not implemented
worker_api_test: Fail # http://dartbug.com/10223
+element_test/click: Fail #TODO(efortuna)
+element_test/eventDelegation: Fail #TODO(efortuna)
[ $compiler == none && ($runtime == drt || $runtime == dartium) && $system == windows]
websql_test: Skip # Issue 4941: stderr contains a backtrace.
diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart
index 7c2f863..d47707f 100644
--- a/tests/html/xhr_test.dart
+++ b/tests/html/xhr_test.dart
@@ -208,6 +208,24 @@
});
});
}
+
+ test('xhr postFormData', () {
+ var data = { 'name': 'John', 'time': '2 pm' };
+
+ var parts = [];
+ for (var key in data.keys) {
+ parts.add('${Uri.encodeQueryComponent(key)}='
+ '${Uri.encodeQueryComponent(data[key])}');
+ }
+ var encodedData = parts.join('&');
+
+ return HttpRequest.postFormData(
+ '${window.location.protocol}//${window.location.host}/echo', data)
+ .then((xhr) {
+ expect(xhr.responseText, encodedData);
+ });
+ });
+
});
group('xhr_requestBlob', () {
diff --git a/tests/isolate/global_error_handler_stream_test.dart b/tests/isolate/global_error_handler_stream_test.dart
index c792fc5..c1d8ce8 100644
--- a/tests/isolate/global_error_handler_stream_test.dart
+++ b/tests/isolate/global_error_handler_stream_test.dart
@@ -15,7 +15,7 @@
firstFunction();
} catch (e) {
new Timer(Duration.ZERO, finishFunction);
- throw;
+ rethrow;
}
}
diff --git a/tests/isolate/global_error_handler_test.dart b/tests/isolate/global_error_handler_test.dart
index e3b5de0..aa5ba92 100644
--- a/tests/isolate/global_error_handler_test.dart
+++ b/tests/isolate/global_error_handler_test.dart
@@ -15,7 +15,7 @@
firstFunction();
} catch (e) {
new Timer(Duration.ZERO, finishFunction);
- throw;
+ rethrow;
}
}
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index c260b67..1d3e6f5 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -29,10 +29,6 @@
spawn_uri_vm_negative_test: fail
unresolved_ports_negative_test: fail
-# test issue 10888
-global_error_handler_stream_test: fail
-global_error_handler_test: fail
-
[ $compiler == dart2analyzer ]
isolate2_negative_test: fail
isolate_import_negative_test: fail
@@ -42,10 +38,6 @@
spawn_uri_vm_negative_test: fail
unresolved_ports_negative_test: fail
-# test issue 10888
-global_error_handler_stream_test: fail
-global_error_handler_test: fail
-
[ $compiler == dart2js && ($runtime == d8 || $jscl) ]
illegal_msg_stream_test: Fail # Issue 6750
typed_data_message_test: Fail, OK # DataView only supported in browsers.
@@ -56,6 +48,10 @@
[ $compiler == dart2js && $runtime == drt ]
unresolved_ports_negative_test: Pass, Crash # Issue 10613
+[ $compiler == dart2js && $runtime == chrome ]
+spawn_uri_negative_test: Pass, Fail, Timeout # Issue: 12239
+spawn_uri_test: Pass, Fail, Timeout # Issue: 12239
+
[ $compiler == dart2js ]
serialization_test: Fail # Tries to access class TestingOnly declared in isolate_patch.dart
illegal_msg_test: Fail # Issue 6750
diff --git a/tests/language/crash_12118_test.dart b/tests/language/crash_12118_test.dart
new file mode 100644
index 0000000..fea6996
--- /dev/null
+++ b/tests/language/crash_12118_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.
+
+// Regression test for issue 12118 which caused a crash in dart2js.
+
+const X = 42;
+
+class A {
+ final x;
+ A({this.x: X});
+}
+
+class B extends A {}
+
+void main() {
+ if (new B().x != 42) {
+ throw 'Test failed';
+ }
+}
diff --git a/tests/language/execute_finally10_test.dart b/tests/language/execute_finally10_test.dart
index 4591908..74beb5a 100644
--- a/tests/language/execute_finally10_test.dart
+++ b/tests/language/execute_finally10_test.dart
@@ -6,7 +6,7 @@
// block as a successor of a catch block that throws.
import "package:expect/expect.dart";
-
+
class A {
var field;
start() {}
@@ -26,7 +26,7 @@
// variable.
runCompiler.toString();
runCompiler.toString();
- throw;
+ rethrow;
} finally {
totalCompileTime.stop();
}
diff --git a/tests/language/execute_finally11_test.dart b/tests/language/execute_finally11_test.dart
index 093d7dc..9ab66aa 100644
--- a/tests/language/execute_finally11_test.dart
+++ b/tests/language/execute_finally11_test.dart
@@ -6,7 +6,7 @@
// block as a successor of a nested try block.
import "package:expect/expect.dart";
-
+
class A {
var field;
start() {}
@@ -29,7 +29,7 @@
runCompiler.toString();
} catch (exception) {
}
- throw;
+ rethrow;
} finally {
totalCompileTime.stop();
}
diff --git a/tests/language/final_used_in_try_test.dart b/tests/language/final_used_in_try_test.dart
index 3fbfddf..259ba8d 100644
--- a/tests/language/final_used_in_try_test.dart
+++ b/tests/language/final_used_in_try_test.dart
@@ -10,7 +10,7 @@
try {
Expect.equals('f', a);
} catch (e) {
- throw;
+ rethrow;
}
break;
}
diff --git a/tests/language/full_stacktrace2_test.dart b/tests/language/full_stacktrace2_test.dart
index a98f5a6..5de34e0 100644
--- a/tests/language/full_stacktrace2_test.dart
+++ b/tests/language/full_stacktrace2_test.dart
@@ -24,7 +24,7 @@
Expect.isTrue(fullTrace.contains("func7"));
Expect.isTrue(fullTrace.contains("main"));
- throw; // This is a rethrow.
+ rethrow; // This is a rethrow.
}
}
int func4() {
diff --git a/tests/language/generic_test.dart b/tests/language/generic_test.dart
index 7e7c56c..918162c 100644
--- a/tests/language/generic_test.dart
+++ b/tests/language/generic_test.dart
@@ -56,14 +56,11 @@
E e = new E(); // Throws a type error, if type checks are enabled.
} on TypeError catch (error) {
result = 1;
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("generic_test.dart", subs);
- Expect.equals(31, error.line); // new B<T>(t); AX does not extend A.
- Expect.equals(21, error.column);
+ // Location of malformed error: T extends A, but AX does not extend A.
+ Expect.isTrue(error.toString().contains("line 20 pos 9"));
+ // Location of failed type check: new B<T>(t)/
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "generic_test.dart:31:21"));
}
return result;
}
diff --git a/tests/language/getter_parameters_test.dart b/tests/language/getter_parameters_test.dart
new file mode 100644
index 0000000..491a82b
--- /dev/null
+++ b/tests/language/getter_parameters_test.dart
@@ -0,0 +1,28 @@
+// 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 a getter has no parameters.
+
+get f1 => null;
+get f2
+() /// 01: compile-time error
+=> null;
+get f3
+(arg) /// 02: compile-time error
+=> null;
+get f4
+([arg]) /// 03: compile-time error
+=> null;
+get f5
+({arg}) /// 04: compile-time error
+=> null;
+
+main() {
+ f1;
+ f2;
+ f3;
+ f4;
+ f5;
+}
+
diff --git a/tests/language/hash_map_null_key_foreach_test.dart b/tests/language/hash_map_null_key_foreach_test.dart
new file mode 100644
index 0000000..4e566fb
--- /dev/null
+++ b/tests/language/hash_map_null_key_foreach_test.dart
@@ -0,0 +1,19 @@
+// 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";
+
+// Regression test for using `null` as a key with `forEach`.
+
+main() {
+ var x = new Map<int, int>();
+ x[1] = 2;
+ x[null] = 1;
+ int c = 0;
+ x.forEach((int i, int j) {
+ c++;
+ Expect.isTrue(i == null || i is int, 'int or null expected');
+ });
+ Expect.equals(2, c);
+}
diff --git a/tests/language/language.status b/tests/language/language.status
index e788b73..cdf20d7 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -15,6 +15,9 @@
# 2) File a bug on each architecture for the failure due to the language change.
# 3) Update the language/src directory with the updated test.
+[ $compiler == dart2js && ($runtime == ie9 || $runtime == ie10) ]
+licm2_test: Skip # Issue: 12298
+
[ $compiler == dart2dart ]
mixin_super_constructor_named_test: Fail
mixin_super_constructor_positionals_test: Fail
@@ -28,6 +31,8 @@
library_juxtaposition_test: Fail # Issue 6877
pseudo_kw_illegal_test/14: Fail # Issue 356
bound_closure_equality_test: Fail # Issue 10849
+switch_int_double_test/01: Fail # Issue 7307
+switch_int_double_test/02: Fail # Issue 7307
# These bugs refer currently ongoing language discussions.
constructor5_test: Fail # (Discussion ongoing)
@@ -47,8 +52,6 @@
lazy_static3_test: Fail # Issue 3558
-type_error_test: Fail # http://dartbug.com/5280
-
# DartC specific tests that should not be run by the VM
*dartc_test: Skip
*dartc_negative_test: Skip
@@ -68,18 +71,10 @@
mixin_illegal_object_test/01: Crash # Issue 10952
mixin_illegal_object_test/02: Crash # Issue 10952
-type_variable_field_initializer_closure_test: Crash # issue 8847
-closures_initializer_test: Crash # issue 8847
-closures_initializer2_test: Crash # issue 8847
-
mixin_forwarding_constructor2_test: Fail # Issue 11888
mixin_typedef_constructor_test: Fail # Issue 11888
mixin_type_parameter2_test: Fail # Issue 11888
-const_constructor_mixin_test/01: Fail # Issue 11917
-const_constructor_mixin2_test/01: Fail # Issue 11917
-const_constructor_mixin3_test/01: Fail # Issue 11917
-
[ $compiler == none && $unchecked ]
# Only checked mode reports an error on type assignment
@@ -100,9 +95,6 @@
[ $compiler == none && $runtime == drt ]
-type_variable_field_initializer_closure_test: Fail # issue 8847
-closures_initializer_test: Fail # VM bug: issue 8847
-closures_initializer2_test: Fail # VM bug: issue 8847
final_variable_assignment_test/01: Fail
final_variable_assignment_test/02: Fail
final_variable_assignment_test/03: Fail
@@ -116,7 +108,6 @@
[ $runtime == vm || ($runtime == drt && $compiler == none) ]
first_class_types_literals_test: Fail # issue 11761
call_test: Fail # Issue 1604
-throw8_test: Fail # Issue 11972
[ $runtime == chrome ]
@@ -295,11 +286,7 @@
compile_time_constant_checked3_test/05: Fail, OK
compile_time_constant_checked3_test/06: Fail, OK
-type_error_test: Fail, OK # VM bug: http://dartbug.com/5280
-
-type_variable_field_initializer_closure_test: Crash # VM bug: issue 8847
-closures_initializer_test: Crash # VM bug: issue 8847
-closures_initializer2_test: Crash # VM bug: issue 8847
+positional_parameters_type_test: Fail # Triage this.
bound_closure_equality_test: Fail # Issue 10849
@@ -314,13 +301,5 @@
invocation_mirror_test: Fail, OK # hardcoded names.
super_call4_test: Fail, OK # hardcoded names.
-
-[ $arch == simarm || $arch == arm ]
-try_catch4_test: Crash, Fail
-
-
[ $arch == mips ]
*: Skip
-
-[ $arch == simmips ]
-try_catch4_test: Fail
diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status
index 3f4a04f..e8a968b 100644
--- a/tests/language/language_analyzer.status
+++ b/tests/language/language_analyzer.status
@@ -7,9 +7,6 @@
# Runtime negative test. No static errors or warnings.
closure_call_wrong_argument_count_negative_test: skip
-
-#argument_definition_test/01: fail # issue 11565 (passing for the wrong reason)
-
illegal_invocation_test/01: fail # Issue: 11892
# TBF: m([int p = 'String'])
@@ -47,8 +44,8 @@
f_bounded_quantification_test/01: fail
f_bounded_quantification_test/02: fail
-function_type_alias6_test/00: fail # Issue 11987
function_type_alias9_test/00: crash # Issue 11987
+
list_literal_syntax_test/01: fail # Issue 12103
list_literal_syntax_test/02: fail # Issue 12103
list_literal_syntax_test/03: fail # Issue 12103
@@ -56,6 +53,7 @@
# 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
@@ -106,16 +104,6 @@
block_scope_test: fail
lazy_static3_test: fail
-# test issue 10889, "throw" requires expression, "rethrow" should be used instead
-execute_finally10_test: fail
-execute_finally11_test: fail
-final_used_in_try_test: fail
-full_stacktrace2_test: fail
-stack_trace_test: fail
-throw3_test: fail
-try_catch3_test: fail
-type_error_test: fail
-
# test issue 10890; on-catch UnknownType is a static warning, not error
try_catch_on_syntax_test/01: fail
@@ -240,9 +228,6 @@
# test issue 11596. e is Unknown is not a compile time error
is_not_class2_negative_test: fail
-# test issue 11597, It is a compile-time error if part has no "part of" directive
-library_juxtaposition_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
@@ -283,14 +268,6 @@
static_final_field_negative_test: fail
constructor2_negative_test: fail
-# test issue 12158, 'native' is not in spec, so analyzer does not generate compile-time error
-syntax_test/28: fail
-syntax_test/29: fail
-syntax_test/30: fail
-syntax_test/31: fail
-syntax_test/32: fail
-syntax_test/33: fail
-
# test issue 12159, print(exception.message_); causes static warning, not an error
throw7_negative_test: fail
@@ -325,6 +302,8 @@
library_ambiguous_test/02: fail
library_ambiguous_test/03: fail
+# test issue 12289, assignment in assert statement
+type_error_test: fail
[ $compiler == dartanalyzer && $checked ]
factory1_test/00: fail
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index 387f350..5acf485 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -3,73 +3,12 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2analyzer ]
-#argument_definition_test/01: fail # issue 11565 (passing for the wrong reason)
-# test issue 11581, it is not warning to call dynamic
-call_through_getter_test: fail
-
-# test issue 11582, non-final field with 'const' constructor
-compile_time_constant10_test/none: fail
-
-# test issue 11583, int is valid key for constant map literal
-compile_time_constant_c_test/01: fail
-
-# test issue 11589, export D from 2 export directives
-export_cyclic_test: fail
-
-# test issue 11580, Function is not a malformed type
-black_listed_test/11: fail
-
-# test issue 11584, positional arguments cannot be used for named parameters
-compile_time_constant_e_test: fail
-
-# test issue 11585, static warning, not negative test
-constructor3_negative_test: fail # issue 11585
-constructor_call_wrong_argument_count_negative_test: fail
-instance_call_wrong_argument_count_negative_test: fail
-
-# test issue 11586, Class(args) is compile-time warning, not error
-constructor_negative_test: fail
-
-# test issue 11590, runtime only negative test
-field_method4_negative_test: fail
-
-# test issue 11591, assigning to the final variable is warning, not error
-final_for_in_variable_test/01: fail
-final_param_negative_test: fail
-final_var_negative_test: fail
-final_variable_assignment_test/01: fail
-final_variable_assignment_test/02: fail
-final_variable_assignment_test/03: fail
-final_variable_assignment_test/04: fail
-getter_no_setter_test/01: fail
-
-# test issue 11592, Function type alias (typedef) is not a constant
-first_class_types_constants_test: fail
-
-# test issue 11594, Reference to a not resolve identifier is static warning
-import_combinators_negative_test: fail
-interface_static_non_final_fields_negative_test: fail
-
-# test issue 11595, It is static warning to create instance (new) of the malformed type
-instantiate_type_variable_negative_test: fail
-
-# test issue 11596. e is Unknown is not a compile time error
-is_not_class2_negative_test: fail
-
-# test issue 11597, It is a compile-time error if part has no "part of" directive
-library_juxtaposition_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
+# Runtime negative test. No static errors or warnings.
+closure_call_wrong_argument_count_negative_test: skip
illegal_invocation_test/01: fail # Issue: 11892
-# TBF: a.imethod = () { return 1; };
-assign_instance_method_negative_test: fail
-
# TBF: m([int p = 'String'])
assign_static_type_test/06: fail
@@ -81,25 +20,14 @@
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.
-closure_call_wrong_argument_count_negative_test: fail
const_constructor_super_test/01: fail
compile_time_constant10_test/none: fail
compile_time_constant_c_test/01: fail
-# Runtime negative test. No static errors or warnings.
-closure_call_wrong_argument_count_negative_test: skip
-
# TBF: m([int p = 'String']) and call 'const' instance creation
compile_time_constant_checked2_test/03: fail
compile_time_constant_checked3_test/03: fail
-# TBF: not initialized final instance variable
-constructor2_negative_test: fail
-constructor3_negative_test: fail
-constructor_call_wrong_argument_count_negative_test: fail
-constructor_initializer_test: fail # uses argument definition test
-constructor_negative_test: 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
@@ -116,75 +44,68 @@
f_bounded_quantification_test/01: fail
f_bounded_quantification_test/02: fail
+function_type_alias9_test/00: crash # Issue 11987
+
+list_literal_syntax_test/01: fail # Issue 12103
+list_literal_syntax_test/02: fail # Issue 12103
+list_literal_syntax_test/03: fail # Issue 12103
+malformed_test/none: fail
+
+# TBF: disallowed in the most recent spec
named_parameters_aggregated_test/03: fail
-no_such_method_negative_test: 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
+
+# TBF: prefix T hidden by type variable T in 'new T.Class()'
prefix10_negative_test: fail
-prefix11_negative_test: fail
-prefix12_negative_test: fail
-prefix1_negative_test: fail
-prefix2_negative_test: fail
-prefix4_negative_test: fail
-prefix5_negative_test: fail
-prefix6_negative_test: fail
-prefix8_negative_test: fail
-prefix9_negative_test: fail
+
+# TBF: no error if A in our library, B extends A in other library, reference B._private from Test extends B in our library.
private_member1_negative_test: fail
private_member2_negative_test: fail
private_member3_negative_test: fail
-pseudo_kw_illegal_test/14: fail
+
+# TBF
pseudo_kw_test: fail
+
+# TBF: hiding at start of the block and declared after declaration statement
scope_negative_test: fail
-static_call_wrong_argument_count_negative_test: fail
+
+# TBF: 'instance.staticMethod()' is static warning
static_field_test/01: fail
static_field_test/02: fail
static_field_test/03: fail
-static_final_field2_negative_test: fail
-static_final_field_negative_test: fail
-syntax_test/28: fail
-syntax_test/29: fail
-syntax_test/30: fail
-syntax_test/31: fail
-syntax_test/32: fail
-syntax_test/33: fail
-throw7_negative_test: fail
-type_error_test: fail
-type_parameter_test/none: fail
-type_variable_bounds2_test/00: fail
-type_variable_bounds2_test/01: fail
-type_variable_bounds2_test/02: fail
-type_variable_bounds2_test/03: fail
-type_variable_bounds2_test/04: fail
-type_variable_bounds2_test/06: fail
-type_variable_static_context_negative_test: fail
-unresolved_in_factory_negative_test: fail
-unresolved_top_level_method_negative_test: fail
-unresolved_top_level_var_negative_test: 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
lazy_static3_test: fail
-# test issue 10752, there are 'implicit' scopes for 'if', 'while' and 'do-while'
-implicit_scope_test: fail
-
-# test issue 10889, "throw" requires expression, "rethrow" should be used instead
-execute_finally10_test: fail
-execute_finally11_test: fail
-final_used_in_try_test: fail
-full_stacktrace2_test: fail
-stack_trace_test: fail
-throw3_test: fail
-try_catch3_test: fail
-
# test issue 10890; on-catch UnknownType is a static warning, not error
try_catch_on_syntax_test/01: fail
-try_catch_on_syntax_test/07: fail
-try_catch_syntax_test/08: fail
# test issue 10899; it is static warning, not error, to call methods of class literal
class_literal_test/02: fail
@@ -231,23 +152,6 @@
# Test issue 11564, named parameter starts with '_'
named_parameters_with_object_property_names_test: 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
-
-# testing framework problem: we do report warning, framework does not understand it
-# may be https://codereview.chromium.org/18174010/ will fix this
-type_variable_bounds_test/08: fail
-wrong_number_type_arguments_test/01: fail
-
# test issue 11575, classes with abstrac members are not marked as abstract
abstract_factory_constructor_test/none: fail
abstract_syntax_test/none: fail
@@ -272,10 +176,135 @@
# test issue 11579, assignment, no setter
getter_no_setter_test/none: fail
-# issue 11918: mixin and const constructor
+# test issue 11580, Function is not a malformed type
+black_listed_test/11: fail
+
+# test issue 11581, it is not warning to call dynamic
+call_through_getter_test: fail
+
+# test issue 11582, non-final field with 'const' constructor
+compile_time_constant10_test/none: fail
+
+# test issue 11583, int is valid key for constant map literal
+compile_time_constant_c_test/01: fail
+
+# test issue 11584, positional arguments cannot be used for named parameters
+compile_time_constant_e_test: fail
+
+# test issue 11585, static warning, not negative test
+constructor3_negative_test: fail
+constructor_call_wrong_argument_count_negative_test: fail
+instance_call_wrong_argument_count_negative_test: fail
+
+# test issue 11586, Class(args) is compile-time warning, not error
+constructor_negative_test: fail
+
+# test issue 11589, export D from 2 export directives
+export_cyclic_test: fail
+
+# test issue 11590, runtime only negative test
+field_method4_negative_test: fail
+
+# test issue 11591, assigning to the final variable is warning, not error
+final_for_in_variable_test/01: fail
+final_param_negative_test: fail
+final_var_negative_test: fail
+final_variable_assignment_test/01: fail
+final_variable_assignment_test/02: fail
+final_variable_assignment_test/03: fail
+final_variable_assignment_test/04: fail
+getter_no_setter_test/01: fail
+
+# test issue 11592, Function type alias (typedef) is not a constant
+first_class_types_constants_test: fail
+
+# test issue 11594, Reference to a not resolve identifier is static warning
+import_combinators_negative_test: fail
+interface_static_non_final_fields_negative_test: fail
+
+# test issue 11595, It is static warning to create instance (new) of the malformed type
+instantiate_type_variable_negative_test: fail
+
+# test issue 11596. e is Unknown is not a compile time error
+is_not_class2_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
+
+# test issue 11698, no setter, so warning, not error
+assign_instance_method_negative_test: fail
+
+# test issue 11918: mixin and const constructor
const_constructor_mixin_test/01: fail
const_constructor_mixin3_test/01: fail
+# test issue 11958, fails only at runtime
+no_such_method_negative_test: fail
+
+# test issue 11962, it is warning, not error to reference undeclared identifier
+prefix1_negative_test: fail
+prefix2_negative_test: fail
+prefix4_negative_test: fail
+prefix5_negative_test: fail
+prefix12_negative_test: fail
+
+# test issue 11963, it is fine to access any property of the dynamic variable
+prefix6_negative_test: fail
+
+# test issue 11964, Any use of a malformed type gives rise to a static warning.
+prefix8_negative_test: fail
+prefix9_negative_test: fail
+prefix11_negative_test: fail
+
+# test issue 11965, 'source' is not built-in identifier anymore
+pseudo_kw_illegal_test/14: fail
+
+# test issue 12156, fails only at runtime
+static_call_wrong_argument_count_negative_test: fail
+
+# test issue 12157, uninitializer instance variable is warning, so not negative test
+static_final_field_negative_test: fail
+constructor2_negative_test: fail
+
+# test issue 12159, print(exception.message_); causes static warning, not an error
+throw7_negative_test: fail
+
+# test issue 12160, not annotated warnings for type variables from static member
+type_parameter_test/none: fail
+# test issue 12161, type variable in static, malformed type, static warning
+type_variable_static_context_negative_test: fail
+
+# test issue 12162, 'a' has dynamic type, so it statically it is assignable to anything
+type_variable_bounds2_test/00: fail
+type_variable_bounds2_test/01: fail
+type_variable_bounds2_test/02: fail
+type_variable_bounds2_test/03: fail
+type_variable_bounds2_test/04: fail
+type_variable_bounds2_test/06: fail
+
+# test issue 12163, unresolved identifier is static warning in static context
+unresolved_in_factory_negative_test: fail
+unresolved_top_level_method_negative_test: fail
+unresolved_top_level_var_negative_test: fail
+
+# test issue 12181, uses argument definition test
+constructor_initializer_test: fail
+
+# test issue 12184, It is static warning, not error, to assign to a constant variable.
+static_final_field2_negative_test: fail
+
+# test issue 12191, ambuguous import is always warning now
+prefix3_negative_test: fail
+library_ambiguous_test/00: fail
+library_ambiguous_test/01: fail
+library_ambiguous_test/02: fail
+library_ambiguous_test/03: fail
+
+# test issue 12289, assignment in assert statement
+type_error_test: fail
+
[ $compiler == dart2analyzer && $checked ]
factory1_test/00: fail
factory1_test/01: fail
@@ -291,10 +320,4 @@
getters_setters2_test/03: fail
type_variable_bounds3_test/00: fail
type_variable_bounds2_test/05: fail
-type_variable_scope_test/00: fail
-type_variable_scope_test/01: fail
-type_variable_scope_test/02: fail
-type_variable_scope_test/03: fail
-type_variable_scope_test/04: fail
-type_variable_scope_test/05: fail
diff --git a/tests/language/library_juxtaposition_part.dart b/tests/language/library_juxtaposition_part.dart
index 2b14942..708c854 100644
--- a/tests/language/library_juxtaposition_part.dart
+++ b/tests/language/library_juxtaposition_part.dart
@@ -2,4 +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.
+part of lib;
+
const c = 47;
diff --git a/tests/language/missing_part_of_tag_part.dart b/tests/language/missing_part_of_tag_part.dart
new file mode 100644
index 0000000..c4618bc
--- /dev/null
+++ b/tests/language/missing_part_of_tag_part.dart
@@ -0,0 +1,3 @@
+// 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.
diff --git a/tests/language/missing_part_of_tag_test.dart b/tests/language/missing_part_of_tag_test.dart
new file mode 100644
index 0000000..ffb360c
--- /dev/null
+++ b/tests/language/missing_part_of_tag_test.dart
@@ -0,0 +1,11 @@
+// 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 for missing part-of tag.
+
+library lib;
+
+part 'missing_part_of_tag_part.dart'; /// 01: compile-time error
+
+void main() {}
\ No newline at end of file
diff --git a/tests/language/mixin_type_parameter4_test.dart b/tests/language/mixin_type_parameter4_test.dart
new file mode 100644
index 0000000..00fe43e
--- /dev/null
+++ b/tests/language/mixin_type_parameter4_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.
+
+import "package:expect/expect.dart";
+
+class R<E, F> {}
+
+class M<J> implements R<bool, J> {}
+
+class B1 {}
+class B2 {}
+
+class A1<T> extends B1 with M<T> {}
+
+typedef A2<T> = B2 with M<T>;
+
+main() {
+ var ab = new A1<int>();
+ Expect.isTrue(ab is R<bool, int>);
+ ab = new A2<int>();
+ Expect.isTrue(ab is R<bool, int>);
+}
diff --git a/tests/language/named_parameters_type_test.dart b/tests/language/named_parameters_type_test.dart
index 304cbed..1eb7a7f 100644
--- a/tests/language/named_parameters_type_test.dart
+++ b/tests/language/named_parameters_type_test.dart
@@ -25,22 +25,25 @@
acceptFunNumOptBool(funNum); // No static type warning.
} on TypeError catch (error) {
result += 1;
- Expect.stringEquals("(num, {b: bool}) => void", error.dstType);
- Expect.stringEquals("(num) => void", error.srcType);
+ 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;
- Expect.stringEquals("(num, {b: bool}) => void", error.dstType);
- Expect.stringEquals("(num, bool) => void", error.srcType);
+ 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;
- Expect.stringEquals("(num, {b: bool}) => void", error.dstType);
- Expect.stringEquals("(num, {x: bool}) => void", error.srcType);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("(num, {b: bool}) => void")); // dstType
+ Expect.isTrue(msg.contains("(num, {x: bool}) => void")); // srcType
}
return result;
}
diff --git a/tests/language/positional_parameters_type_test.dart b/tests/language/positional_parameters_type_test.dart
index db26b84..6c3c77d 100644
--- a/tests/language/positional_parameters_type_test.dart
+++ b/tests/language/positional_parameters_type_test.dart
@@ -25,15 +25,23 @@
acceptFunNumOptBool(funNum); // No static type warning.
} on TypeError catch (error) {
result += 1;
- Expect.stringEquals("(num, [bool]) => void", error.dstType);
- Expect.stringEquals("(num) => void", error.srcType);
+ 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;
- Expect.stringEquals("(num, [bool]) => void", error.dstType);
- Expect.stringEquals("(num, bool) => void", error.srcType);
+ 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.
diff --git a/tests/language/regress_11800_test.dart b/tests/language/regress_11800_test.dart
new file mode 100644
index 0000000..14c8a6f
--- /dev/null
+++ b/tests/language/regress_11800_test.dart
@@ -0,0 +1,19 @@
+// 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=--optimization-counter-threshold=10
+
+import "package:expect/expect.dart";
+
+// Test correct register allocation with a value used twice at the same
+// instruction.
+test(List a, int v) {
+ a[v] = v;
+}
+
+main() {
+ var list = new List(2);
+ for (var i = 0; i < 20; i++) test(list, 1);
+ Expect.equals(null, list[0]);
+ Expect.equals(1, list[1]);
+}
diff --git a/tests/language/stack_trace_test.dart b/tests/language/stack_trace_test.dart
index 2f584a6..e2fd827 100644
--- a/tests/language/stack_trace_test.dart
+++ b/tests/language/stack_trace_test.dart
@@ -70,7 +70,7 @@
try {
func();
} on MyException catch (exception) {
- throw;
+ rethrow;
}
return 10;
}
diff --git a/tests/language/switch_int_double_test.dart b/tests/language/switch_int_double_test.dart
new file mode 100644
index 0000000..d6e02dd
--- /dev/null
+++ b/tests/language/switch_int_double_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.
+
+// Test that double literals with no fractional part is not treated as having
+// static type int.
+
+import "package:expect/expect.dart";
+
+void main() {
+ Expect.equals(100, test(1.0));
+ Expect.equals(75, test(0.75));
+ Expect.equals(null, test(0.5));
+}
+
+int test(num ratio) {
+ switch (ratio) {
+ case 0.75:
+ return 75;
+ case 1.0:
+ return 100;
+ case 2: /// 01: compile-time error
+ return 200; /// 01: continued
+ case 'foo': /// 02: compile-time error
+ return 400; /// 02: continued
+ }
+}
\ No newline at end of file
diff --git a/tests/language/throw3_test.dart b/tests/language/throw3_test.dart
index 111404c..9a3ef0a 100644
--- a/tests/language/throw3_test.dart
+++ b/tests/language/throw3_test.dart
@@ -37,7 +37,7 @@
}
} on MyException catch (ex) {
print(ex.message_);
- throw; // Rethrow the exception.
+ rethrow; // Rethrow the exception.
}
return 10;
}
diff --git a/tests/language/try_catch3_test.dart b/tests/language/try_catch3_test.dart
index b6b6e60..e485b61 100644
--- a/tests/language/try_catch3_test.dart
+++ b/tests/language/try_catch3_test.dart
@@ -81,7 +81,7 @@
} on MyParameterizedException<String, TestException> catch (e, trace) {
i = 800;
trace.printStackTrace(e);
- throw;
+ rethrow;
} on MyException catch (exception) {
i = 100;
print(exception.getMessage());
diff --git a/tests/language/try_catch_syntax_test.dart b/tests/language/try_catch_syntax_test.dart
index 68b8aec..b153d84 100644
--- a/tests/language/try_catch_syntax_test.dart
+++ b/tests/language/try_catch_syntax_test.dart
@@ -42,6 +42,6 @@
}
testIllegalRethrow() {
- try { throw; } catch (e) { } /// 16: compile-time error
- try { } catch (e) { } finally { throw; } /// 17: compile-time error
+ try { rethrow; } catch (e) { } /// 16: compile-time error
+ try { } catch (e) { } finally { rethrow; } /// 17: compile-time error
}
diff --git a/tests/language/type_cast_vm_test.dart b/tests/language/type_cast_vm_test.dart
index 90bb522..9285eb0 100644
--- a/tests/language/type_cast_vm_test.dart
+++ b/tests/language/type_cast_vm_test.dart
@@ -22,13 +22,13 @@
int result = 0;
try {
var i = "hello" as int; // Throws a CastError
- } on TypeError catch (error, stacktrace) {
+ } catch (error) {
result = 1;
Expect.isTrue(error is CastError);
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("type cast", error.dstName);
- checkTopFunction("type_cast_vm_test.dart:24:23", stacktrace);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("int")); // dstType
+ Expect.isTrue(msg.contains("String")); // srcType
+ checkTopFunction("type_cast_vm_test.dart:24:23", error.stackTrace);
}
return result;
}
@@ -44,7 +44,7 @@
a[0] = 0;
a[index()]++; // Type check succeeds, but does not create side effects.
Expect.equals(1, a[0]);
- } on TypeError catch (error) {
+ } catch (error) {
result = 100;
}
return result;
@@ -57,13 +57,13 @@
}
try {
int i = f("hello" as int); // Throws a CastError
- } on TypeError catch (error, stacktrace) {
+ } catch (error) {
result = 1;
Expect.isTrue(error is CastError);
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("type cast", error.dstName);
- checkTopFunction("type_cast_vm_test.dart:59:25", stacktrace);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("int")); // dstType
+ Expect.isTrue(msg.contains("String")); // srcType
+ checkTopFunction("type_cast_vm_test.dart:59:25", error.stackTrace);
}
return result;
}
@@ -75,13 +75,13 @@
}
try {
int i = f("hello");
- } on TypeError catch (error, stacktrace) {
+ } catch (error) {
result = 1;
Expect.isTrue(error is CastError);
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("type cast", error.dstName);
- checkTopFunction("type_cast_vm_test.dart:74:16", stacktrace);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("int")); // dstType
+ Expect.isTrue(msg.contains("String")); // srcType
+ checkTopFunction("type_cast_vm_test.dart:74:16", error.stackTrace);
}
return result;
}
@@ -93,12 +93,12 @@
Expect.equals(5, (field as String).length);
try {
field as int; // Throws a CastError
- } on TypeError catch (error, stacktrace) {
+ } catch (error) {
result = 1;
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("type cast", error.dstName);
- checkTopFunction("type_cast_vm_test.dart:95:13", stacktrace);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("int")); // dstType
+ Expect.isTrue(msg.contains("String")); // srcType
+ checkTopFunction("type_cast_vm_test.dart:95:13", error.stackTrace);
}
return result;
}
@@ -111,12 +111,12 @@
anyFunction = null as Function; // No error.
try {
var i = f as int; // Throws a TypeError if type checks are enabled.
- } on TypeError catch (error, stacktrace) {
+ } catch (error) {
result = 1;
- Expect.equals("int", error.dstType);
- Expect.equals("() => dynamic", error.srcType);
- Expect.equals("type cast", error.dstName);
- checkTopFunction("type_cast_vm_test.dart:113:17", stacktrace);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("int")); // dstType
+ Expect.isTrue(msg.contains("() => dynamic")); // srcType
+ checkTopFunction("type_cast_vm_test.dart:113:17", error.stackTrace);
}
return result;
}
diff --git a/tests/language/type_error_test.dart b/tests/language/type_error_test.dart
index b41ad07..fc62c23 100644
--- a/tests/language/type_error_test.dart
+++ b/tests/language/type_error_test.dart
@@ -133,7 +133,7 @@
} on TypeError catch (e) {
print(e); // This might provoke an error.
if (assertionsEnabled) return; // Expected type error.
- throw; // Rethrow unexpected type error.
+ rethrow; // Rethrow unexpected type error.
}
if (assertionsEnabled) {
throw 'expected TypeError';
@@ -145,7 +145,7 @@
assert(o);
} on TypeError catch (e) {
print(e); // This might provoke an error.
- if (!assertionsEnabled) throw; // Unexpected error.
+ if (!assertionsEnabled) rethrow; // Unexpected error.
}
}
@@ -154,7 +154,7 @@
print(o);
} on TypeError catch (e) {
print('unexpected type error: ${Error.safeToString(e)}');
- throw; // Unexpected type error.
+ rethrow; // Unexpected type error.
} on CastError catch (e) {
print(e); // This might provoke an error.
return; // Expected a cast error.
diff --git a/tests/language/type_vm_test.dart b/tests/language/type_vm_test.dart
index 29f7aff..fda7b1c 100644
--- a/tests/language/type_vm_test.dart
+++ b/tests/language/type_vm_test.dart
@@ -3,8 +3,15 @@
// BSD-style license that can be found in the LICENSE file.
// VMOptions=--enable_type_checks --no_show_internal_names
// Dart test program testing type checks.
+
import "package:expect/expect.dart";
+class C {
+ factory C() {
+ return 1; // Implicit result type is 'C', not int.
+ }
+}
+
class TypeTest {
static test() {
int result = 0;
@@ -12,17 +19,12 @@
int i = "hello"; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result = 1;
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("i", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(12, error.line);
- Expect.equals(15, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'int'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("'i'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:19:15"));
}
return result;
}
@@ -53,17 +55,12 @@
int i = f("hello"); // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result = 1;
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("i", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(49, error.line);
- Expect.equals(15, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'int'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("'i'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:51:15"));
}
return result;
}
@@ -77,17 +74,12 @@
int i = f("hello"); // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result = 1;
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("function result", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(74, error.line);
- Expect.equals(14, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'int'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("function result")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:71:14"));
}
return result;
}
@@ -99,17 +91,12 @@
field = "hello"; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result = 1;
- Expect.equals("int", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("field", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(99, error.line);
- Expect.equals(15, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'int'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("'field'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:91:15"));
}
return result;
}
@@ -123,17 +110,12 @@
int i = f; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result = 1;
- Expect.equals("int", error.dstType);
- Expect.equals("() => dynamic", error.srcType);
- Expect.equals("i", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(123, error.line);
- Expect.equals(15, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'int'")); // dstType
+ Expect.isTrue(msg.contains("'() => dynamic'")); // srcType
+ Expect.isTrue(msg.contains("'i'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:110:15"));
}
return result;
}
@@ -154,17 +136,12 @@
acceptObjFunObj(voidFunObj); // Throws a TypeError.
} on TypeError catch (error) {
result = 1;
- Expect.equals("(Object) => Object", error.dstType);
- Expect.equals("(Object) => void", error.srcType);
- Expect.equals("objFunObj", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(145, error.line);
- Expect.equals(33, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'(Object) => Object'")); // dstType
+ Expect.isTrue(msg.contains("'(Object) => void'")); // srcType
+ Expect.isTrue(msg.contains("'objFunObj'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:127:33"));
}
return result;
}
@@ -188,17 +165,12 @@
acceptFunNum(funString); // Throws an error.
} on TypeError catch (error) {
result = 1;
- Expect.equals("(num) => void", error.dstType);
- Expect.equals("(String) => void", error.srcType);
- Expect.equals("funNum", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(175, error.line);
- Expect.equals(28, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'(num) => void'")); // dstType
+ Expect.isTrue(msg.contains("'(String) => void'")); // srcType
+ Expect.isTrue(msg.contains("'funNum'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:152:28"));
}
return result;
}
@@ -209,145 +181,100 @@
bool i = !"hello"; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(209, error.line);
- Expect.equals(17, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:181:17"));
}
try {
while ("hello") {}; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(225, error.line);
- Expect.equals(14, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:192:14"));
}
try {
do {} while ("hello"); // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(241, error.line);
- Expect.equals(20, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:203:20"));
}
try {
for (;"hello";) {}; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(257, error.line);
- Expect.equals(13, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:214:13"));
}
try {
int i = "hello" ? 1 : 0; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(273, error.line);
- Expect.equals(15, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:225:15"));
}
try {
if ("hello") {}; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(289, error.line);
- Expect.equals(11, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:236:11"));
}
try {
if ("hello" || false) {}; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(305, error.line);
- Expect.equals(11, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:247:11"));
}
try {
if (false || "hello") {}; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("String", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(321, error.line);
- Expect.equals(20, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'String'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:258:20"));
}
try {
if (null) {}; // Throws a TypeError if type checks are enabled.
} on TypeError catch (error) {
result++;
- Expect.equals("bool", error.dstType);
- Expect.equals("Null", error.srcType);
- Expect.equals("boolean expression", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(337, error.line);
- Expect.equals(11, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'bool'")); // dstType
+ Expect.isTrue(msg.contains("'Null'")); // srcType
+ Expect.isTrue(msg.contains("boolean expression")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:269:11"));
}
return result;
}
@@ -359,17 +286,12 @@
var x = new C();
} on TypeError catch (error) {
result++;
- Expect.equals("C", error.dstType);
- Expect.equals("int", error.srcType);
- Expect.equals("function result", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(560, error.line);
- Expect.equals(12, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'C'")); // dstType
+ Expect.isTrue(msg.contains("'int'")); // srcType
+ Expect.isTrue(msg.contains("function result")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:11:12"));
}
return result;
}
@@ -392,49 +314,34 @@
List<int> ai = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<int>", error.dstType);
- Expect.equals("List<Object>", error.srcType);
- Expect.equals("ai", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(392, error.line);
- Expect.equals(24, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<int>'")); // dstType
+ Expect.isTrue(msg.contains("'List<Object>'")); // srcType
+ Expect.isTrue(msg.contains("'ai'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:314:24"));
}
try {
List<num> an = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<num>", error.dstType);
- Expect.equals("List<Object>", error.srcType);
- Expect.equals("an", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(408, error.line);
- Expect.equals(24, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<num>'")); // dstType
+ Expect.isTrue(msg.contains("'List<Object>'")); // srcType
+ Expect.isTrue(msg.contains("'an'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:325:24"));
}
try {
List<String> as = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<String>", error.dstType);
- Expect.equals("List<Object>", error.srcType);
- Expect.equals("as", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(424, error.line);
- Expect.equals(27, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<String>'")); // dstType
+ Expect.isTrue(msg.contains("'List<Object>'")); // srcType
+ Expect.isTrue(msg.contains("'as'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:336:27"));
}
}
{
@@ -447,17 +354,12 @@
List<String> as = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<String>", error.dstType);
- Expect.equals("List<int>", error.srcType);
- Expect.equals("as", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(447, error.line);
- Expect.equals(27, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<String>'")); // dstType
+ Expect.isTrue(msg.contains("'List<int>'")); // srcType
+ Expect.isTrue(msg.contains("'as'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:354:27"));
}
}
{
@@ -468,34 +370,24 @@
List<int> ai = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<int>", error.dstType);
- Expect.equals("List<num>", error.srcType);
- Expect.equals("ai", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(468, error.line);
- Expect.equals(24, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<int>'")); // dstType
+ Expect.isTrue(msg.contains("'List<num>'")); // srcType
+ Expect.isTrue(msg.contains("'ai'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:370:24"));
}
List<num> an = a;
try {
List<String> as = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<String>", error.dstType);
- Expect.equals("List<num>", error.srcType);
- Expect.equals("as", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(485, error.line);
- Expect.equals(27, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<String>'")); // dstType
+ Expect.isTrue(msg.contains("'List<num>'")); // srcType
+ Expect.isTrue(msg.contains("'as'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:382:27"));
}
}
{
@@ -506,33 +398,23 @@
List<int> ai = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<int>", error.dstType);
- Expect.equals("List<String>", error.srcType);
- Expect.equals("ai", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(506, error.line);
- Expect.equals(24, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<int>'")); // dstType
+ Expect.isTrue(msg.contains("'List<String>'")); // srcType
+ Expect.isTrue(msg.contains("'ai'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:398:24"));
}
try {
List<num> an = a;
} on TypeError catch (error) {
result++;
- Expect.equals("List<num>", error.dstType);
- Expect.equals("List<String>", error.srcType);
- Expect.equals("an", error.dstName);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("type_vm_test.dart", subs);
- Expect.equals(522, error.line);
- Expect.equals(24, error.column);
+ var msg = error.toString();
+ Expect.isTrue(msg.contains("'List<num>'")); // dstType
+ Expect.isTrue(msg.contains("'List<String>'")); // srcType
+ Expect.isTrue(msg.contains("'an'")); // dstName
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "type_vm_test.dart:409:24"));
}
List<String> as = a;
}
@@ -554,14 +436,6 @@
}
}
-
-class C {
- factory C() {
- return 1; // Implicit result type is 'C', not int.
- }
-}
-
-
main() {
TypeTest.testMain();
}
diff --git a/tests/language/unsupported_operators_test.dart b/tests/language/unsupported_operators_test.dart
new file mode 100644
index 0000000..a80987f
--- /dev/null
+++ b/tests/language/unsupported_operators_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 handling of unsupported operators.
+
+library unsupported_operators;
+
+class C {
+ m() {
+ print(
+ super === /// 01: compile-time error
+ null);
+ print(
+ super !== /// 02: compile-time error
+ null);
+ }
+}
+
+void main() {
+ new C().m();
+ new C().m();
+ print(
+ "foo" === /// 03: compile-time error
+ null);
+ print(
+ "foo" !== /// 04: compile-time error
+ null);
+}
\ No newline at end of file
diff --git a/tests/lib/analyzer/analyze_tests.status b/tests/lib/analyzer/analyze_tests.status
index 802f246..ca318fe 100644
--- a/tests/lib/analyzer/analyze_tests.status
+++ b/tests/lib/analyzer/analyze_tests.status
@@ -6,7 +6,6 @@
javascript_int_overflow_literal_test/01: fail, ok
# https://code.google.com/p/dart/issues/detail?id=11665
-standalone/assert_test: fail
standalone/io/directory_invalid_arguments_test: fail
standalone/io/file_constructor_test: fail
standalone/io/file_fuzz_test: fail
@@ -35,7 +34,6 @@
javascript_int_overflow_literal_test/01: fail, ok
# https://code.google.com/p/dart/issues/detail?id=11665
-standalone/assert_test: fail
standalone/io/directory_invalid_arguments_test: fail
standalone/io/file_constructor_test: fail
standalone/io/file_fuzz_test: fail
@@ -56,8 +54,5 @@
standalone/typed_data_view_test: fail
standalone/typed_data_test: fail
-# pkg issue https://code.google.com/p/dart/issues/detail?id=11856
-standalone/io/secure_socket_renegotiate_test: fail
-
# https://code.google.com/p/dart/issues/detail?id=11647
standalone/package/package_isolate_test: fail
diff --git a/tests/lib/convert/line_splitter_test.dart b/tests/lib/convert/line_splitter_test.dart
new file mode 100644
index 0000000..acdc633
--- /dev/null
+++ b/tests/lib/convert/line_splitter_test.dart
@@ -0,0 +1,180 @@
+// 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 line_splitter_test;
+import "package:expect/expect.dart";
+import 'dart:async';
+import 'dart:convert';
+import 'dart:math' as MATH;
+
+
+void main() {
+ testSimpleConvert();
+ testManyLines();
+ testReadLine1();
+ testReadLine2();
+}
+
+void testManyLines() {
+ const breaks = const ['\n', '\r\n'];
+ int breakIndex = 0;
+
+ var inputs = const ['line1', 'line2', 'long line 3', ' line 4 ', 'l5'];
+
+
+ var buffer = inputs.fold(new StringBuffer(), (buff, e) {
+ buff.write(e);
+ buff.write(breaks[breakIndex]);
+
+ breakIndex++;
+ breakIndex = breakIndex % breaks.length;
+
+ return buff;
+ });
+
+
+ var foo = _getLinesSliced(buffer.toString());
+ Expect.equals(inputs.join(), foo);
+}
+
+
+String _getLinesSliced(String str) {
+ String lines;
+ var stringSink =
+ new StringConversionSink.withCallback((result) => lines = result);
+ var sink = new LineSplitter().startChunkedConversion(stringSink);
+
+ const chunkSize = 3;
+ var index = 0;
+ while(index < str.length) {
+ var end = MATH.min(str.length, index + chunkSize);
+
+ sink.addSlice(str, index, end, false);
+ index += chunkSize;
+ }
+
+ sink.close();
+ return lines;
+}
+
+void testSimpleConvert() {
+ var test = """line1
+line2
+line3""";
+
+
+ var decoder = new LineSplitter();
+ var result = decoder.convert(test);
+
+ Expect.listEquals(['line1', 'line2', 'line3'], result);
+
+ test = "Line1\nLine2\r\nLine3\rLi"
+ "ne4\n"
+ "\n\n\r\n\r\n\r\r";
+
+ result = decoder.convert(test);
+
+ Expect.listEquals(
+ ['Line1', 'Line2', 'Line3', 'Line4', '', '', '', '', '', ''],
+ result);
+}
+
+void testReadLine1() {
+ var controller = new StreamController(sync: true);
+ var stream = controller.stream
+ .transform(new Utf8Decoder())
+ .transform(new LineSplitter());
+
+ var stage = 0;
+ var done = false;
+
+ void stringData(line) {
+ Expect.equals(stage, 0);
+ Expect.equals("Line", line);
+ stage++;
+ }
+
+ void streamClosed() {
+ Expect.equals(1, stage);
+ done = true;
+ }
+
+ stream.listen(
+ stringData,
+ onDone: streamClosed);
+
+ // Note: codeUnits is fine. Text is ASCII.
+ controller.add("Line".codeUnits);
+ controller.close();
+ Expect.isTrue(done, 'should be done by now');
+}
+
+void testReadLine2() {
+ var controller = new StreamController(sync: true);
+
+ var stream = controller.stream
+ .transform(new Utf8Decoder())
+ .transform(new LineSplitter());
+
+ var done = false;
+
+ var stage = 0;
+ var subStage = 0;
+ stream.listen((line) {
+ if (stage == 0) {
+ if (subStage == 0) {
+ Expect.equals("Line1", line);
+ subStage++;
+ } else if (subStage == 1) {
+ Expect.equals("Line2", line);
+ subStage++;
+ } else if (subStage == 2) {
+ Expect.equals("Line3", line);
+ subStage = 0;
+ stage++;
+ } else {
+ Expect.fail("Stage 0 failed");
+ }
+ } else if (stage == 1) {
+ if (subStage == 0) {
+ Expect.equals("Line4", line);
+ subStage = 0;
+ stage++;
+ } else {
+ Expect.fail("Stage 1 failed");
+ }
+ } else if (stage == 2) {
+ if (subStage < 4) {
+ // Expect 5 empty lines. As long as the stream is not closed the
+ // final \r cannot be interpreted as a end of line.
+ Expect.equals("", line);
+ subStage++;
+ } else if (subStage == 4) {
+ Expect.equals("", line);
+ subStage = 0;
+ stage++;
+ } else {
+ Expect.fail("Stage 2 failed");
+ }
+ } else if (stage == 3) {
+ if (subStage == 0) {
+ Expect.equals("", line);
+ stage++;
+ } else {
+ Expect.fail("Stage 3 failed");
+ }
+ }
+ }, onDone: () {
+ Expect.equals(4, stage);
+ Expect.equals(0, subStage);
+ done = true;
+ });
+
+ // Note: codeUnits is fine. Text is ASCII.
+ controller.add("Line1\nLine2\r\nLine3\rLi".codeUnits);
+ controller.add("ne4\n".codeUnits);
+ controller.add("\n\n\r\n\r\n\r\r".codeUnits);
+ controller.close();
+ Expect.isTrue(done, 'should be done here...');
+}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index b321b7a..31a0738 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -2,16 +2,25 @@
# 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 == d8 || $runtime == drt) ]
+convert/chunked_conversion_utf87_test: Pass, Fail # v8 bug: Issue 12293
+typed_data/byte_data_test: Pass, Fail # v8 bug: Issue 12293
+
[ $compiler == dart2js ]
math/*: Skip
+mirrors/invoke_test: Fail # Issue 11954
mirrors/class_mirror_type_variables_test: Fail # Issue 12087
mirrors/invoke_private_test: Fail # Issue 12164
mirrors/function_type_mirror_test: Fail # Issue 12166
+mirrors/generics_test: Fail # Issue 12333
+mirrors/fake_function_test: Fail # Issue 11612
mirrors/method_mirror_name_test: Fail # Issue 6335
mirrors/method_mirror_properties_test: Fail # Issue 11861
mirrors/method_mirror_returntype_test : Fail # Issue 11928
+mirrors/mixin_members_test : Fail # Issue 11863
mirrors/mirrors_test: Fail # TODO(ahe): I'm working on fixing this.
mirrors/null_test : Fail # Issue 12129
+mirrors/library_metadata_test: Fail # Issue 10905
mirrors/library_uri_io_test: Skip # Not intended for dart2js as it uses dart:io.
async/run_async3_test: Fail # _enqueueImmediate runs after Timer. http://dartbug.com/9002
async/run_async4_test: Pass, Fail # no global exception handler in isolates. http://dartbug.com/9012
diff --git a/tests/lib/math/random_test.dart b/tests/lib/math/random_test.dart
index d1e02bc..bb3b347 100644
--- a/tests/lib/math/random_test.dart
+++ b/tests/lib/math/random_test.dart
@@ -47,6 +47,12 @@
Expect.equals(2134030067, rnd.nextInt(1 << ++i));
Expect.equals(721180690, rnd.nextInt(1 << ++i));
Expect.equals(32, i);
- // If max is too large expect an ArgumentError.
+ // If max is too large expect an ArgumentError.
Expect.throws(() => rnd.nextInt((1 << i)+1), (e) => e is ArgumentError);
+
+ rnd = new Random(6790);
+ Expect.approxEquals(0.7360144236, rnd.nextDouble());
+ Expect.approxEquals(0.3292339731, rnd.nextDouble());
+ Expect.approxEquals(0.3489622548, rnd.nextDouble());
+ Expect.approxEquals(0.9815975892, rnd.nextDouble());
}
diff --git a/tests/lib/mirrors/fake_function_test.dart b/tests/lib/mirrors/fake_function_test.dart
new file mode 100644
index 0000000..a824be0
--- /dev/null
+++ b/tests/lib/mirrors/fake_function_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.
+
+import "dart:mirrors";
+
+import "package:expect/expect.dart";
+
+class WannabeFunction {
+ int call(int a, int b) => a + b;
+ method(x) => x * x;
+}
+
+main() {
+ Expect.isTrue(new WannabeFunction() is Function);
+
+ ClosureMirror cm = reflect(new WannabeFunction());
+ Expect.equals(7, cm.invoke(const Symbol("call"), [3,4]).reflectee);
+ Expect.throws(() => cm.invoke(const Symbol("call"), [3]),
+ (e) => e is NoSuchMethodError,
+ "Wrong arity");
+ Expect.equals(49, cm.invoke(const Symbol("method"), [7]).reflectee);
+ Expect.throws(() => cm.invoke(const Symbol("method"), [3, 4]),
+ (e) => e is NoSuchMethodError,
+ "Wrong arity");
+ Expect.equals(7, cm.apply([3,4]).reflectee);
+ Expect.throws(() => cm.apply([3]),
+ (e) => e is NoSuchMethodError,
+ "Wrong arity");
+
+ MethodMirror mm = cm.function;
+ Expect.equals(const Symbol("call"), mm.simpleName);
+ Expect.equals(reflectClass(WannabeFunction),
+ mm.owner);
+ Expect.isTrue(mm.isRegularMethod);
+ Expect.equals(const Symbol("int"), mm.returnType.simpleName);
+ Expect.equals(const Symbol("int"), mm.parameters[0].type.simpleName);
+ Expect.equals(const Symbol("int"), mm.parameters[1].type.simpleName);
+
+ ClassMirror km = cm.type;
+ Expect.equals(reflectClass(WannabeFunction), km);
+ Expect.equals(const Symbol("WannabeFunction"), km.simpleName);
+ Expect.equals(mm, km.members[const Symbol("call")]);
+ Expect.setEquals([const Symbol("call"), const Symbol("method")],
+ km.members.keys);
+}
diff --git a/tests/lib/mirrors/generics_test.dart b/tests/lib/mirrors/generics_test.dart
new file mode 100644
index 0000000..dcb9093
--- /dev/null
+++ b/tests/lib/mirrors/generics_test.dart
@@ -0,0 +1,133 @@
+// 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.type_arguments_test;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class A<T> {}
+class B extends A {} // Same as class B extends A<dynamic>.
+class C extends A<num, int> {} // Same as class C extends A<dynamic>.
+class D extends A<int> {}
+class E<S> extends A<S> {}
+class F<R> extends A<int> {}
+class G {}
+
+typeParameters(mirror, parameterNames) {
+ Expect.listEquals(parameterNames.map((n) => new Symbol(n)).toList(),
+ mirror.typeVariables.keys.toList());
+}
+
+typeArguments(mirror, argumentMirrors) {
+ Expect.listEquals(argumentMirrors,
+ mirror.typeArguments.values.toList());
+ if (!mirror.isOriginalDeclaration) {
+ Expect.listEquals(mirror.typeVariables.keys.toList(),
+ mirror.typeArguments.keys.toList());
+ }
+}
+
+main() {
+ // Declarations.
+ typeParameters(reflectClass(A), ['T']);
+ typeParameters(reflectClass(B), []);
+ typeParameters(reflectClass(C), []);
+ typeParameters(reflectClass(D), []);
+ typeParameters(reflectClass(E), ['S']);
+ typeParameters(reflectClass(F), ['R']);
+ typeParameters(reflectClass(G), []);
+
+ typeArguments(reflectClass(A), []);
+ typeArguments(reflectClass(B), []);
+ typeArguments(reflectClass(C), []);
+ typeArguments(reflectClass(D), []);
+ typeArguments(reflectClass(E), []);
+ typeArguments(reflectClass(F), []);
+ typeArguments(reflectClass(G), []);
+
+ Expect.isTrue(reflectClass(A).isOriginalDeclaration);
+ Expect.isTrue(reflectClass(B).isOriginalDeclaration);
+ Expect.isTrue(reflectClass(C).isOriginalDeclaration);
+ Expect.isTrue(reflectClass(D).isOriginalDeclaration);
+ Expect.isTrue(reflectClass(E).isOriginalDeclaration);
+ Expect.isTrue(reflectClass(F).isOriginalDeclaration);
+ Expect.isTrue(reflectClass(G).isOriginalDeclaration);
+
+ Expect.equals(reflectClass(A), reflectClass(A).originalDeclaration);
+ Expect.equals(reflectClass(B), reflectClass(B).originalDeclaration);
+ Expect.equals(reflectClass(C), reflectClass(C).originalDeclaration);
+ Expect.equals(reflectClass(D), reflectClass(D).originalDeclaration);
+ Expect.equals(reflectClass(E), reflectClass(E).originalDeclaration);
+ Expect.equals(reflectClass(F), reflectClass(F).originalDeclaration);
+ Expect.equals(reflectClass(G), reflectClass(G).originalDeclaration);
+
+ // Instantiations.
+ typeParameters(reflect(new A<num>()).type, ['T']);
+ typeParameters(reflect(new B<num>()).type, []);
+ typeParameters(reflect(new C()).type, []);
+ typeParameters(reflect(new D()).type, []);
+ typeParameters(reflect(new E()).type, ['S']);
+ typeParameters(reflect(new F<num>()).type, ['R']);
+ typeParameters(reflect(new G()).type, []);
+
+ var numMirror = reflectClass(num);
+ typeArguments(reflect(new A<num>()).type, [numMirror]);
+ typeArguments(reflect(new B()).type, []);
+ typeArguments(reflect(new C()).type, []);
+ typeArguments(reflect(new D()).type, []);
+ typeArguments(reflect(new E<num>()).type, [numMirror]);
+ typeArguments(reflect(new F<num>()).type, [numMirror]);
+ typeArguments(reflect(new G()).type, []);
+
+ Expect.isFalse(reflect(new A<num>()).type.isOriginalDeclaration);
+ Expect.isTrue(reflect(new B()).type.isOriginalDeclaration);
+ Expect.isTrue(reflect(new C()).type.isOriginalDeclaration);
+ Expect.isTrue(reflect(new D()).type.isOriginalDeclaration);
+ Expect.isFalse(reflect(new E<num>()).type.isOriginalDeclaration);
+ Expect.isFalse(reflect(new F<num>()).type.isOriginalDeclaration);
+ Expect.isTrue(reflect(new G()).type.isOriginalDeclaration);
+
+ Expect.equals(reflectClass(A),
+ reflect(new A<num>()).type.originalDeclaration);
+ Expect.equals(reflectClass(B),
+ reflect(new B()).type.originalDeclaration);
+ Expect.equals(reflectClass(C),
+ reflect(new C()).type.originalDeclaration);
+ Expect.equals(reflectClass(D),
+ reflect(new D()).type.originalDeclaration);
+ Expect.equals(reflectClass(E),
+ reflect(new E<num>()).type.originalDeclaration);
+ Expect.equals(reflectClass(F),
+ reflect(new F<num>()).type.originalDeclaration);
+ Expect.equals(reflectClass(G),
+ reflect(new G()).type.originalDeclaration);
+
+ Expect.notEquals(reflect(new A<num>()).type,
+ reflect(new A<num>()).type.originalDeclaration);
+ Expect.equals(reflect(new B()).type,
+ reflect(new B()).type.originalDeclaration);
+ Expect.equals(reflect(new C()).type,
+ reflect(new C()).type.originalDeclaration);
+ Expect.equals(reflect(new D()).type,
+ reflect(new D()).type.originalDeclaration);
+ Expect.notEquals(reflect(new E<num>()).type,
+ reflect(new E<num>()).type.originalDeclaration);
+ Expect.notEquals(reflect(new F<num>()).type,
+ reflect(new F<num>()).type.originalDeclaration);
+ Expect.equals(reflect(new G()).type,
+ reflect(new G()).type.originalDeclaration);
+
+ // Library members are all uninstantaited generics or non-generics.
+ currentMirrorSystem().libraries.values.forEach((libraryMirror) {
+ libraryMirror.classes.values.forEach((classMirror) {
+ // TODO(12282): Deal with generic typedefs.
+ if (classMirror is! TypedefMirror) {
+ Expect.isTrue(classMirror.isOriginalDeclaration);
+ Expect.equals(classMirror, classMirror.originalDeclaration);
+ }
+ });
+ });
+}
diff --git a/tests/lib/mirrors/invoke_test.dart b/tests/lib/mirrors/invoke_test.dart
new file mode 100644
index 0000000..e306ca2
--- /dev/null
+++ b/tests/lib/mirrors/invoke_test.dart
@@ -0,0 +1,355 @@
+// 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.invoke_test;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+import '../../async_helper.dart';
+
+class C {
+ var field;
+ C() : this.field = 'default';
+ C.named(this.field);
+
+ get getter => 'get $field';
+ set setter(v) => field = 'set $v';
+ method(x, y, z) => '$x+$y+$z';
+ toString() => 'a C';
+
+ noSuchMethod(invocation) => 'DNU';
+
+ static var staticField = 'initial';
+ static get staticGetter => 'sget $staticField';
+ static set staticSetter(v) => staticField = 'sset $v';
+ static staticFunction(x, y) => "($x,$y)";
+}
+
+var libraryField = 'a priori';
+get libraryGetter => 'lget $libraryField';
+set librarySetter(v) => libraryField = 'lset $v';
+libraryFunction(x,y) => '$x$y';
+
+Future expectValueThen(Future future, Function onValue) {
+ asyncStart();
+ wrappedOnValue(resultIn) {
+ var resultOut = onValue(resultIn);
+ asyncEnd();
+ return resultOut;
+ }
+ onError(e) {
+ Expect.fail("Value expected. ($e)");
+ }
+ return future.then(wrappedOnValue, onError: onError);
+}
+
+Future expectError(Future future, Function errorPredicate, String reason) {
+ asyncStart();
+ onValue(result) {
+ Expect.fail("Error expected ($reason)");
+ }
+ onError(e) {
+ asyncEnd();
+ if (!errorPredicate(e)) {
+ Expect.fail("Unexpected error ($reason)");
+ }
+ }
+ return future.then(onValue, onError: onError);
+}
+
+bool isNoSuchMethodError(e) {
+ return e is NoSuchMethodError;
+}
+
+testSync() {
+ var result;
+
+ // InstanceMirror invoke
+ C c = new C();
+ InstanceMirror im = reflect(c);
+ result = im.invoke(const Symbol('method'), [2,4,8]);
+ Expect.equals('2+4+8', result.reflectee);
+ result = im.invoke(const Symbol('doesntExist'), [2,4,8]);
+ Expect.equals('DNU', result.reflectee);
+ result = im.invoke(const Symbol('method'), [2,4]); // Wrong arity.
+ Expect.equals('DNU', result.reflectee);
+
+ // InstanceMirror invokeGetter
+ result = im.getField(const Symbol('getter'));
+ Expect.equals('get default', result.reflectee);
+ result = im.getField(const Symbol('field'));
+ Expect.equals('default', result.reflectee);
+ result = im.getField(const Symbol('doesntExist'));
+ Expect.equals('DNU', result.reflectee);
+
+ // InstanceMirror invokeSetter
+ result = im.setField(const Symbol('setter'), 'foo');
+ Expect.equals('foo', result.reflectee);
+ Expect.equals('set foo', c.field);
+ Expect.equals('set foo', im.getField(const Symbol('field')).reflectee);
+ result = im.setField(const Symbol('field'), 'bar');
+ Expect.equals('bar', result.reflectee);
+ Expect.equals('bar', c.field);
+ Expect.equals('bar', im.getField(const Symbol('field')).reflectee);
+ result = im.setField(const Symbol('doesntExist'), 'bar');
+ Expect.equals('bar', result.reflectee);
+
+ // ClassMirror invoke
+ ClassMirror cm = reflectClass(C);
+ result = cm.invoke(const Symbol('staticFunction'),[3,4]);
+ Expect.equals('(3,4)', result.reflectee);
+ Expect.throws(() => cm.invoke(const Symbol('doesntExist'),[3,4]),
+ isNoSuchMethodError,
+ 'Not defined');
+ Expect.throws(() => cm.invoke(const Symbol('staticFunction'),[3]),
+ isNoSuchMethodError,
+ 'Wrong arity');
+
+ // ClassMirror invokeGetter
+ result = cm.getField(const Symbol('staticGetter'));
+ Expect.equals('sget initial', result.reflectee);
+ result = cm.getField(const Symbol('staticField'));
+ Expect.equals('initial', result.reflectee);
+ Expect.throws(() => cm.getField(const Symbol('doesntExist')),
+ isNoSuchMethodError,
+ 'Not defined');
+
+ // ClassMirror invokeSetter
+ result = cm.setField(const Symbol('staticSetter'), 'sfoo');
+ Expect.equals('sfoo', result.reflectee);
+ Expect.equals('sset sfoo', C.staticField);
+ Expect.equals('sset sfoo',
+ cm.getField(const Symbol('staticField')).reflectee);
+ result = cm.setField(const Symbol('staticField'), 'sbar');
+ Expect.equals('sbar', result.reflectee);
+ Expect.equals('sbar', C.staticField);
+ Expect.equals('sbar', cm.getField(const Symbol('staticField')).reflectee);
+ Expect.throws(() => cm.setField(const Symbol('doesntExist'), 'sbar'),
+ isNoSuchMethodError,
+ 'Not defined');
+
+ // ClassMirror invokeConstructor
+ result = cm.newInstance(const Symbol(''), []);
+ Expect.isTrue(result.reflectee is C);
+ Expect.equals('default', result.reflectee.field);
+ result = cm.newInstance(const Symbol('named'), ['my value']);
+ Expect.isTrue(result.reflectee is C);
+ Expect.equals('my value', result.reflectee.field);
+ Expect.throws(() => cm.newInstance(const Symbol('doesntExist'), ['my value']),
+ isNoSuchMethodError,
+ 'Not defined');
+ Expect.throws(() => cm.newInstance(const Symbol('named'), []),
+ isNoSuchMethodError,
+ 'Wrong arity');
+
+ // LibraryMirror invoke
+ LibraryMirror lm = cm.owner;
+ result = lm.invoke(const Symbol('libraryFunction'),[':',')']);
+ Expect.equals(':)', result.reflectee);
+ Expect.throws(() => lm.invoke(const Symbol('doesntExist'), [':',')']),
+ isNoSuchMethodError,
+ 'Not defined');
+ Expect.throws(() => lm.invoke(const Symbol('libraryFunction'), [':']),
+ isNoSuchMethodError,
+ 'Wrong arity');
+
+ // LibraryMirror invokeGetter
+ result = lm.getField(const Symbol('libraryGetter'));
+ Expect.equals('lget a priori', result.reflectee);
+ result = lm.getField(const Symbol('libraryField'));
+ Expect.equals('a priori', result.reflectee);
+ Expect.throws(() => lm.getField(const Symbol('doesntExist')),
+ isNoSuchMethodError,
+ 'Not defined');
+
+ // LibraryMirror invokeSetter
+ result = lm.setField(const Symbol('librarySetter'), 'lfoo');
+ Expect.equals('lfoo', result.reflectee);
+ Expect.equals('lset lfoo', libraryField);
+ Expect.equals('lset lfoo',
+ lm.getField(const Symbol('libraryField')).reflectee);
+ result = lm.setField(const Symbol('libraryField'), 'lbar');
+ Expect.equals('lbar', result.reflectee);
+ Expect.equals('lbar', libraryField);
+ Expect.equals('lbar', lm.getField(const Symbol('libraryField')).reflectee);
+ Expect.throws(() => lm.setField(const Symbol('doesntExist'), 'lbar'),
+ isNoSuchMethodError,
+ 'Not defined');
+}
+
+testAsync() {
+ var future;
+
+ // InstanceMirror invoke
+ C c = new C();
+ InstanceMirror im = reflect(c);
+ future = im.invokeAsync(const Symbol('method'), [2,4,8]);
+ expectValueThen(future, (result) {
+ Expect.equals('2+4+8', result.reflectee);
+ });
+ future = im.invokeAsync(const Symbol('method'), [im,im,im]);
+ expectValueThen(future, (result) {
+ Expect.equals('a C+a C+a C', result.reflectee);
+ });
+ future = im.invokeAsync(const Symbol('doesntExist'), [2,4,8]);
+ expectValueThen(future, (result) {
+ Expect.equals('DNU', result.reflectee);
+ });
+ future = im.invokeAsync(const Symbol('method'), [2, 4]); // Wrong arity.
+ expectValueThen(future, (result) {
+ Expect.equals('DNU', result.reflectee);
+ });
+
+ // InstanceMirror invokeGetter
+ future = im.getFieldAsync(const Symbol('getter'));
+ expectValueThen(future, (result) {
+ Expect.equals('get default', result.reflectee);
+ });
+ future = im.getFieldAsync(const Symbol('field'));
+ expectValueThen(future, (result) {
+ Expect.equals('default', result.reflectee);
+ });
+ future = im.getFieldAsync(const Symbol('doesntExist'));
+ expectValueThen(future, (result) {
+ Expect.equals('DNU', result.reflectee);
+ });
+
+ // InstanceMirror invokeSetter
+ future = im.setFieldAsync(const Symbol('setter'), 'foo');
+ expectValueThen(future, (result) {
+ Expect.equals('foo', result.reflectee);
+ Expect.equals('set foo', c.field);
+ return im.setFieldAsync(const Symbol('field'), 'bar');
+ }).then((result) {
+ Expect.equals('bar', result.reflectee);
+ Expect.equals('bar', c.field);
+ return im.setFieldAsync(const Symbol('field'), im);
+ }).then((result) {
+ Expect.equals(im.reflectee, result.reflectee);
+ Expect.equals(c, c.field);
+ });
+ future = im.setFieldAsync(const Symbol('doesntExist'), 'bar');
+ expectValueThen(future, (result) {
+ Expect.equals('bar', result.reflectee);
+ });
+
+
+ // ClassMirror invoke
+ ClassMirror cm = reflectClass(C);
+ future = cm.invokeAsync(const Symbol('staticFunction'),[3,4]);
+ expectValueThen(future, (result) {
+ Expect.equals('(3,4)', result.reflectee);
+ });
+ future = cm.invokeAsync(const Symbol('staticFunction'),[im,im]);
+ expectValueThen(future, (result) {
+ Expect.equals('(a C,a C)', result.reflectee);
+ });
+ future = cm.invokeAsync(const Symbol('doesntExist'),[im,im]);
+ expectError(future, isNoSuchMethodError, 'Not defined');
+ future = cm.invokeAsync(const Symbol('staticFunction'),[3]);
+ expectError(future, isNoSuchMethodError, 'Wrong arity');
+
+ // ClassMirror invokeGetter
+ C.staticField = 'initial'; // Reset from synchronous test.
+ future = cm.getFieldAsync(const Symbol('staticGetter'));
+ expectValueThen(future, (result) {
+ Expect.equals('sget initial', result.reflectee);
+ });
+ future = cm.getFieldAsync(const Symbol('staticField'));
+ expectValueThen(future, (result) {
+ Expect.equals('initial', result.reflectee);
+ });
+ future = cm.getFieldAsync(const Symbol('doesntExist'));
+ expectError(future, isNoSuchMethodError, 'Not defined');
+
+ // ClassMirror invokeSetter
+ future = cm.setFieldAsync(const Symbol('staticSetter'), 'sfoo');
+ expectValueThen(future, (result) {
+ Expect.equals('sfoo', result.reflectee);
+ Expect.equals('sset sfoo', C.staticField);
+ return cm.setFieldAsync(const Symbol('staticField'), 'sbar');
+ }).then((result) {
+ Expect.equals('sbar', result.reflectee);
+ Expect.equals('sbar', C.staticField);
+ return cm.setFieldAsync(const Symbol('staticField'), im);;
+ }).then((result) {
+ Expect.equals(im.reflectee, result.reflectee);
+ Expect.equals(c, C.staticField);
+ });
+ future = cm.setFieldAsync(const Symbol('doesntExist'), 'sbar');
+ expectError(future, isNoSuchMethodError, 'Not defined');
+
+ // ClassMirror invokeConstructor
+ future = cm.newInstanceAsync(const Symbol(''), []);
+ expectValueThen(future, (result) {
+ Expect.isTrue(result.reflectee is C);
+ Expect.equals('default', result.reflectee.field);
+ });
+ future = cm.newInstanceAsync(const Symbol('named'), ['my value']);
+ expectValueThen(future, (result) {
+ Expect.isTrue(result.reflectee is C);
+ Expect.equals('my value', result.reflectee.field);
+ });
+ future = cm.newInstanceAsync(const Symbol('named'), [im]);
+ expectValueThen(future, (result) {
+ Expect.isTrue(result.reflectee is C);
+ Expect.equals(c, result.reflectee.field);
+ });
+ future = cm.newInstanceAsync(const Symbol('doesntExist'), ['my value']);
+ expectError(future, isNoSuchMethodError, 'Not defined');
+ future = cm.newInstanceAsync(const Symbol('named'), []);
+ expectError(future, isNoSuchMethodError, 'Wrong arity');
+
+
+ // LibraryMirror invoke
+ LibraryMirror lm = cm.owner;
+ future = lm.invokeAsync(const Symbol('libraryFunction'),[':',')']);
+ expectValueThen(future, (result) {
+ Expect.equals(':)', result.reflectee);
+ });
+ future = lm.invokeAsync(const Symbol('libraryFunction'),[im,im]);
+ expectValueThen(future, (result) {
+ Expect.equals('a Ca C', result.reflectee);
+ });
+ future = lm.invokeAsync(const Symbol('doesntExist'),[im,im]);
+ expectError(future, isNoSuchMethodError, 'Not defined');
+ future = lm.invokeAsync(const Symbol('libraryFunction'),[':']);
+ expectError(future, isNoSuchMethodError, 'Wrong arity');
+
+ // LibraryMirror invokeGetter
+ libraryField = 'a priori'; // Reset from synchronous test.
+ future = lm.getFieldAsync(const Symbol('libraryGetter'));
+ expectValueThen(future, (result) {
+ Expect.equals('lget a priori', result.reflectee);
+ });
+ future = lm.getFieldAsync(const Symbol('libraryField'));
+ expectValueThen(future, (result) {
+ Expect.equals('a priori', result.reflectee);
+ });
+ future = lm.getFieldAsync(const Symbol('doesntExist'));
+ expectError(future, isNoSuchMethodError, 'Not defined');
+
+ // LibraryMirror invokeSetter
+ future = lm.setFieldAsync(const Symbol('librarySetter'), 'lfoo');
+ expectValueThen(future, (result) {
+ Expect.equals('lfoo', result.reflectee);
+ Expect.equals('lset lfoo', libraryField);
+ return lm.setFieldAsync(const Symbol('libraryField'), 'lbar');
+ }).then((result) {
+ Expect.equals('lbar', result.reflectee);
+ Expect.equals('lbar', libraryField);
+ return lm.setFieldAsync(const Symbol('libraryField'), im);
+ }).then((result) {
+ Expect.equals(im.reflectee, result.reflectee);
+ Expect.equals(c, libraryField);
+ });
+ future = lm.setFieldAsync(const Symbol('doesntExist'), 'lbar');
+ expectError(future, isNoSuchMethodError, 'Not defined');
+}
+
+main() {
+ testSync();
+ testAsync();
+}
diff --git a/tests/lib/mirrors/library_metadata_test.dart b/tests/lib/mirrors/library_metadata_test.dart
index 259e398..5bb0cec 100644
--- a/tests/lib/mirrors/library_metadata_test.dart
+++ b/tests/lib/mirrors/library_metadata_test.dart
@@ -13,4 +13,6 @@
MirrorSystem mirrors = currentMirrorSystem();
checkMetadata(mirrors.findLibrary(const Symbol('test.library_metadata_test')).first,
[string, symbol]);
+ checkMetadata(mirrors.findLibrary(const Symbol('test.metadata_test')).first,
+ []);
}
diff --git a/tests/lib/mirrors/metadata_test.dart b/tests/lib/mirrors/metadata_test.dart
index 6db3e55..164a5ae 100644
--- a/tests/lib/mirrors/metadata_test.dart
+++ b/tests/lib/mirrors/metadata_test.dart
@@ -20,6 +20,7 @@
@string @symbol @string
myMethod() => 1;
+ myOtherMethod() => 2;
}
checkMetadata(DeclarationMirror mirror, List expectedMetadata) {
@@ -57,6 +58,8 @@
checkMetadata(function, [symbol, string, symbol]);
MethodMirror method = myClassMirror.methods[const Symbol('myMethod')];
checkMetadata(method, [string, symbol, string]);
+ method = myClassMirror.methods[const Symbol('myOtherMethod')];
+ checkMetadata(method, []);
VariableMirror xMirror = myClassMirror.variables[const Symbol('x')];
checkMetadata(xMirror, [hest, hest, symbol]);
diff --git a/tests/lib/mirrors/mixin_members_test.dart b/tests/lib/mirrors/mixin_members_test.dart
new file mode 100644
index 0000000..4b82534
--- /dev/null
+++ b/tests/lib/mirrors/mixin_members_test.dart
@@ -0,0 +1,49 @@
+// 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 "package:expect/expect.dart";
+
+class Fooer {
+ foo1();
+}
+
+class S implements Fooer {
+ foo1() {}
+ foo2() {}
+}
+
+class M1 {
+ bar1() {}
+ bar2() {}
+}
+
+class M2 {
+ baz1() {}
+ baz2() {}
+}
+
+class C extends S with M1, M2 {}
+
+main() {
+ ClassMirror cm = reflectClass(C);
+ Classmirror sM1M2 = cm.superclass;
+ Classmirror sM1 = sM1M2.superclass;
+ ClassMirror s = sM1.superclass;
+ Expect.equals(0, cm.members.length);
+ Expect.setEquals(sM1M2.members.keys,
+ [const Symbol("baz1"), const Symbol("baz2")]);
+ Expect.setEquals(sM1M2.superinterfaces.map((e) => e.simpleName),
+ [const Symbol("M2")]);
+ Expect.setEquals(sM1.members.keys,
+ [const Symbol("bar1"), const Symbol("bar2")]);
+ Expect.setEquals(sM1.superinterfaces.map((e) => e.simpleName),
+ [const Symbol("M1")]);
+ Expect.setEquals(s.members.keys.toSet(),
+ [const Symbol("foo1"), const Symbol("foo2")]);
+ Expect.setEquals(s.superinterfaces.map((e) => e.simpleName),
+ [const Symbol("Fooer")]);
+ Expect.equals(true, reflectClass(S) == s);
+}
diff --git a/tests/standalone/assert_test.dart b/tests/standalone/assert_test.dart
index af63a68..add14e3 100644
--- a/tests/standalone/assert_test.dart
+++ b/tests/standalone/assert_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.
// VMOptions=--enable_asserts
+
// Dart test program testing assert statements.
+
import "package:expect/expect.dart";
class AssertTest {
@@ -11,15 +13,9 @@
assert(false);
Expect.fail("Assertion 'false' didn't fail.");
} on AssertionError catch (error) {
- Expect.equals("false", error.failedAssertion);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("assert_test.dart", subs);
- Expect.equals(11, error.line);
- Expect.equals(14, error.column);
+ Expect.isTrue(error.toString().contains("'false'"));
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "assert_test.dart:13:14"));
}
}
static testClosure() {
@@ -27,15 +23,9 @@
assert(() => false);
Expect.fail("Assertion '() => false' didn't fail.");
} on AssertionError catch (error) {
- Expect.equals("() => false", error.failedAssertion);
- int pos = error.url.lastIndexOf("/", error.url.length);
- if (pos == -1) {
- pos = error.url.lastIndexOf("\\", error.url.length);
- }
- String subs = error.url.substring(pos + 1, error.url.length);
- Expect.equals("assert_test.dart", subs);
- Expect.equals(27, error.line);
- Expect.equals(14, error.column);
+ Expect.isTrue(error.toString().contains("'() => false'"));
+ Expect.isTrue(error.stackTrace.toString().contains(
+ "assert_test.dart:23:14"));
}
}
diff --git a/tests/standalone/io/dependency_graph_test.dart b/tests/standalone/io/dependency_graph_test.dart
new file mode 100644
index 0000000..495b9ea
--- /dev/null
+++ b/tests/standalone/io/dependency_graph_test.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+import '../../../tools/testing/dart/dependency_graph.dart' as graph;
+
+main() {
+ var dgraph = new graph.Graph();
+ var numberOfEvents = 0;
+ var eventAssertions = [];
+
+ graph.Node newNode(int i, List deps) {
+ graph.Node node = dgraph.newNode(i, deps);
+ Expect.isTrue(node.userData == i);
+ Expect.isTrue(dgraph.nodes.contains(node));
+ for (var dep in deps) {
+ Expect.isTrue(node.dependencies.contains(dep));
+ Expect.isTrue(dep.neededFor.contains(node));
+ }
+
+ numberOfEvents++;
+ eventAssertions.add((event) {
+ Expect.isTrue(event is graph.NodeAddedEvent);
+ Expect.isTrue(event.node == node);
+ });
+
+ return node;
+ }
+
+ changeState(graph.Node node, graph.NodeState newState) {
+ var oldState = node.state;
+
+ dgraph.changeState(node, newState);
+ Expect.isTrue(node.state == newState);
+
+ numberOfEvents++;
+ eventAssertions.add((event) {
+ Expect.isTrue(event is graph.StateChangedEvent);
+ Expect.isTrue(event.node == node);
+ Expect.isTrue(event.from == oldState);
+ Expect.isTrue(event.to == newState);
+ });
+ }
+
+ var node1, node2, node3;
+
+ node1 = newNode(1, []);
+ changeState(node1, graph.NodeState.Processing);
+ node2 = newNode(2, [node1]);
+ changeState(node1, graph.NodeState.Successful);
+ node3 = newNode(3, [node1, node2]);
+ changeState(node2, graph.NodeState.Failed);
+ changeState(node3, graph.NodeState.UnableToRun);
+
+ dgraph.events.take(numberOfEvents).toList().then((events) {
+ for (var i=0; i<events.length; i++) {
+ eventAssertions[i](events[i]);
+ }
+ });
+}
diff --git a/tests/standalone/io/file_constructor_test.dart b/tests/standalone/io/file_constructor_test.dart
index 4ed7bb7..251e1ad 100644
--- a/tests/standalone/io/file_constructor_test.dart
+++ b/tests/standalone/io/file_constructor_test.dart
@@ -20,8 +20,8 @@
new File(1);
Expect.fail('Error expected.');
} on ArgumentError catch(e) {
- if (developerMode) throw;
+ if (developerMode) rethrow;
} on TypeError catch(e) {
- if (!developerMode) throw;
+ if (!developerMode) rethrow;
}
}
diff --git a/tests/standalone/io/platform_test.dart b/tests/standalone/io/platform_test.dart
index ce6e977..1677e67a 100644
--- a/tests/standalone/io/platform_test.dart
+++ b/tests/standalone/io/platform_test.dart
@@ -3,9 +3,11 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
+import "dart:async";
import "dart:io";
+import "dart:isolate";
-main() {
+test() {
Expect.isTrue(Platform.numberOfProcessors > 0);
var os = Platform.operatingSystem;
Expect.isTrue(os == "android" || os == "linux" || os == "macos" ||
@@ -24,3 +26,47 @@
Expect.isTrue(Platform.script.replaceAll('\\', '/').
endsWith('tests/standalone/io/platform_test.dart'));
}
+
+void f() {
+ port.receive((msg, reply) {
+ if (msg == "Platform.executable") {
+ reply.send(Platform.executable);
+ }
+ if (msg == "Platform.script") {
+ reply.send(Platform.script);
+ }
+ if (msg == "new Options().executable") {
+ reply.send(new Options().executable);
+ }
+ if (msg == "new Options().script") {
+ reply.send(new Options().script);
+ }
+ if (msg == "close") {
+ reply.send("closed");
+ port.close();
+ }
+ });
+}
+
+testIsolate() {
+ var port = new ReceivePort();
+ var sendPort = spawnFunction(f);
+ Future.wait([sendPort.call("Platform.executable"),
+ sendPort.call("Platform.script"),
+ sendPort.call("new Options().executable"),
+ sendPort.call("new Options().script")])
+ .then((results) {
+ Expect.equals(Platform.executable, results[0]);
+ Expect.equals(Platform.executable, results[2]);
+ Uri uri = Uri.parse(results[1]);
+ Expect.equals(uri, Uri.parse(results[3]));
+ Expect.equals("file", uri.scheme);
+ Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart'));
+ sendPort.call("close").then((_) => port.close());
+ });
+}
+
+main() {
+ test();
+ testIsolate();
+}
diff --git a/tests/standalone/io/skipping_dart2js_compilations_test.dart b/tests/standalone/io/skipping_dart2js_compilations_test.dart
index 063caed..d2be72e 100644
--- a/tests/standalone/io/skipping_dart2js_compilations_test.dart
+++ b/tests/standalone/io/skipping_dart2js_compilations_test.dart
@@ -122,17 +122,15 @@
}
}
-class TestCompletedHandler {
+class CommandCompletedHandler {
FileUtils fileUtils;
DateTime _expectedTimestamp;
bool _shouldHaveRun;
- TestCompletedHandler(FileUtils this.fileUtils, bool this._shouldHaveRun);
+ CommandCompletedHandler(FileUtils this.fileUtils, bool this._shouldHaveRun);
- void processCompletedTest(runner.TestCase testCase) {
- var output = testCase.lastCommandOutput;
-
- Expect.isFalse(output.unexpectedOutput);
+ void processCompletedTest(CommandOutput output) {
+ Expect.isTrue(output.exitCode == 0);
Expect.isTrue(output.stderr.length == 0);
if (_shouldHaveRun) {
Expect.isTrue(output.stdout.length == 0);
@@ -145,7 +143,7 @@
}
}
-runner.TestCase makeTestCase(String testName, FileUtils fileUtils) {
+runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) {
var config = new options.TestOptionsParser().parse(['--timeout', '2'])[0];
var createFileScript = join(dirname(Platform.script),
'skipping_dart2js_compilations_helper.dart');
@@ -153,19 +151,14 @@
var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()];
var bootstrapDeps = [
Uri.parse("file://${fileUtils.testSnapshotFilePath}")];
- var commands = [new runner.CompilationCommand(
+ return runner.CommandBuilder.instance.getCompilationCommand(
'dart2js',
fileUtils.testJsFilePath.toNativePath(),
false,
bootstrapDeps,
executable,
- arguments)];
- return new runner.TestCase(
- testName,
- commands,
- config,
- (_) {},
- new Set<String>.from([status.PASS]));
+ arguments,
+ 'ReleaseIA32');
}
void main() {
@@ -213,11 +206,11 @@
fs_upToDate.touchFile(fs_upToDate.testJs);
Future runTest(String name, FileUtils fileUtils, bool shouldRun) {
- var completedHandler = new TestCompletedHandler(fileUtils, shouldRun);
- var testCase = makeTestCase(name, fileUtils);
- var process = new runner.RunningProcess(testCase, testCase.commands[0]);
- return process.start().then((_) {
- completedHandler.processCompletedTest(testCase);
+ var completedHandler = new CommandCompletedHandler(fileUtils, shouldRun);
+ var command = makeCompilationCommand(name, fileUtils);
+ var process = new runner.RunningProcess(command, 60);
+ return process.run().then((CommandOutput output) {
+ completedHandler.processCompletedTest(output);
});
}
// We run the tests in sequence, so that if one of them failes we clean up
diff --git a/tests/standalone/io/test_runner_test.dart b/tests/standalone/io/test_runner_test.dart
index d07558a..1bb41df 100644
--- a/tests/standalone/io/test_runner_test.dart
+++ b/tests/standalone/io/test_runner_test.dart
@@ -8,6 +8,7 @@
import "dart:utf";
import "../../../tools/testing/dart/test_runner.dart";
import "../../../tools/testing/dart/test_suite.dart";
+import "../../../tools/testing/dart/test_progress.dart" as progress;
import "../../../tools/testing/dart/status_file_parser.dart";
import "../../../tools/testing/dart/test_options.dart";
import "process_test_util.dart";
@@ -22,13 +23,12 @@
// Used as TestCase.completedCallback.
static processCompletedTest(TestCase testCase) {
numCompletedTests++;
- CommandOutput output = testCase.lastCommandOutput;
if (testCase.displayName == "fail-unexpected") {
- if (!output.unexpectedOutput) {
+ if (!testCase.unexpectedOutput) {
throw "Expected fail-unexpected";
}
} else {
- if (output.unexpectedOutput) {
+ if (testCase.unexpectedOutput) {
throw "Unexpected fail";
}
}
@@ -71,16 +71,16 @@
}
TestCase _makeNormalTestCase(name, expectations) {
- var command = new Command('custom',
- Platform.executable,
- [Platform.script, name]);
+ var command = CommandBuilder.instance.getCommand(
+ 'custom', Platform.executable, [Platform.script, name],
+ 'ReleaseIA32');
return _makeTestCase(name, DEFAULT_TIMEOUT, command, expectations);
}
_makeCrashTestCase(name, expectations) {
- var crashCommand = new Command('custom_crash',
- getProcessTestFileName(),
- ["0", "0", "1", "1"]);
+ var crashCommand = CommandBuilder.instance.getCommand(
+ 'custom_crash', getProcessTestFileName(), ["0", "0", "1", "1"],
+ 'ReleaseIA32');
// The crash test sometimes times out. Run it with a large timeout
// to help diagnose the delay.
// The test loads a new executable, which may sometimes take a long time.
@@ -95,7 +95,6 @@
return new TestCase(name,
[command],
configuration,
- TestController.processCompletedTest,
new Set<String>.from(expectations));
}
}
@@ -103,8 +102,15 @@
void testProcessQueue() {
var maxProcesses = 2;
var maxBrowserProcesses = maxProcesses;
- new ProcessQueue(maxProcesses, maxBrowserProcesses,
- new DateTime.now(), [new CustomTestSuite()], [], TestController.finished);
+ new ProcessQueue({'noBatch' : true}, maxProcesses, maxBrowserProcesses,
+ new DateTime.now(), [new CustomTestSuite()],
+ [new EventListener()], TestController.finished);
+}
+
+class EventListener extends progress.EventListener{
+ void done(TestCase test) {
+ TestController.processCompletedTest(test);
+ }
}
void main() {
diff --git a/tests/standalone/io/uri_platform_test.dart b/tests/standalone/io/uri_platform_test.dart
new file mode 100644
index 0000000..599f2a8
--- /dev/null
+++ b/tests/standalone/io/uri_platform_test.dart
@@ -0,0 +1,39 @@
+// 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:expect/expect.dart";
+import "dart:io";
+
+main() {
+ if (Platform.isWindows) {
+ Expect.equals("a\\b", Uri.parse("a/b").toFilePath());
+ Expect.equals("a\\b\\", Uri.parse("a/b/").toFilePath());
+ Expect.equals("a b", Uri.parse("a%20b").toFilePath());
+ Expect.equals("\\a b", Uri.parse("file:///a%20b").toFilePath());
+ Expect.equals("\\a\\b", Uri.parse("file:///a/b").toFilePath());
+ Expect.equals("C:\\", Uri.parse("file:///C:").toFilePath());
+ Expect.equals("C:\\", Uri.parse("file:///C:/").toFilePath());
+ Expect.equals("\\\\host\\a\\b", Uri.parse("file://host/a/b").toFilePath());
+
+ Expect.equals("a\\b", new Uri.file("a/b").toFilePath());
+ Expect.equals("a\\b", new Uri.file("a\\b").toFilePath());
+ Expect.equals("\\a\\b", new Uri.file("/a/b").toFilePath());
+ Expect.equals("\\a\\b", new Uri.file("\\a\\b").toFilePath());
+ Expect.equals("\\a\\b", new Uri.file("\\a/b").toFilePath());
+ Expect.equals("\\a\\b", new Uri.file("/a\\b").toFilePath());
+ } else {
+ Expect.equals("a/b", Uri.parse("a/b").toFilePath());
+ Expect.equals("a/b/", Uri.parse("a/b/").toFilePath());
+ Expect.equals("a b", Uri.parse("a%20b").toFilePath());
+ Expect.equals("/a b", Uri.parse("file:///a%20b").toFilePath());
+ Expect.equals("/a/b", Uri.parse("file:///a/b").toFilePath());
+ Expect.equals("/C:", Uri.parse("file:///C:").toFilePath());
+ Expect.equals("/C:/", Uri.parse("file:///C:/").toFilePath());
+ Expect.throws(() => Uri.parse("file://host/a/b").toFilePath(),
+ (e) => e is UnsupportedError);
+
+ Expect.equals("a/b", new Uri.file("a/b").toFilePath());
+ Expect.equals("a\\b", new Uri.file("a\\b").toFilePath());
+ }
+}
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index abac10e..d16ecc4 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -11,6 +11,16 @@
[ $runtime == vm ]
package/package_isolate_test: Fail # http://dartbug.com/7520.
+vmservice/isolate_echo_test: Pass, Fail # Issue: 12294
+vmservice/isolate_list_test: Pass, Fail # Issue: 12294
+vmservice/isolate_stacktrace_command_test: Pass, Fail # Issue: 12294
+vmservice/unknown_isolate_command_test: Pass, Fail # Issue: 12294
+
+[ $runtime == vm && $system == windows ]
+vmservice/isolate_class_test: Pass, Fail # Issue: 12294
+vmservice/isolate_code_test: Pass, Fail # Issue: 12294
+vmservice/isolate_function_test: Pass, Fail # Issue: 12294
+vmservice/isolate_library_test: Pass, Fail # Issue: 12294
[ $runtime == vm && $checked ]
# These tests have type errors on purpose.
@@ -152,6 +162,9 @@
oom_error_stacktrace_test: Skip # Fails on Linux
io/web_socket_ping_test: Skip # TODO(ajohnsen): Timeout issue
+[ $arch == simarm ]
+io/test_runner_test: Pass, Fail # Issue: 12239
+
[ $arch == mips ]
*: Skip
diff --git a/tests/standalone/vmservice/isolate_bad_class_test.dart b/tests/standalone/vmservice/isolate_bad_class_test.dart
new file mode 100644
index 0000000..4d84afa
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_bad_class_test.dart
@@ -0,0 +1,58 @@
+// 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 isolate_bad_class_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class NullCollectionTest extends VmServiceRequestHelper {
+ NullCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection/9999999');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('null', reply['type']);
+ }
+}
+
+class BadCollectionTest extends VmServiceRequestHelper {
+ BadCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('error', reply['type']);
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(1);
+ tester.checkIsolateNameContains('unknown_isolate_command_script.dart');
+ _isolateId = reply['members'][0]['id'];
+ }
+}
+
+main() {
+ var process = new TestLauncher('unknown_isolate_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var badCollectionRequest =
+ new BadCollectionTest(port, test._isolateId,
+ 'classes').makeRequest();
+ var nullCollectionRequest =
+ new NullCollectionTest(port, test._isolateId,
+ 'classes').makeRequest();
+ var requests = Future.wait([badCollectionRequest, nullCollectionRequest]);
+ requests.then((_) {
+ process.requestExit();
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_bad_code_test.dart b/tests/standalone/vmservice/isolate_bad_code_test.dart
new file mode 100644
index 0000000..fc6ef68
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_bad_code_test.dart
@@ -0,0 +1,58 @@
+// 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 isolate_bad_code_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class NullCollectionTest extends VmServiceRequestHelper {
+ NullCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection/50');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('null', reply['type']);
+ }
+}
+
+class BadCollectionTest extends VmServiceRequestHelper {
+ BadCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('error', reply['type']);
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(1);
+ tester.checkIsolateNameContains('unknown_isolate_command_script.dart');
+ _isolateId = reply['members'][0]['id'];
+ }
+}
+
+main() {
+ var process = new TestLauncher('unknown_isolate_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var badCollectionRequest =
+ new BadCollectionTest(port, test._isolateId,
+ 'codes').makeRequest();
+ var nullCollectionRequest =
+ new NullCollectionTest(port, test._isolateId,
+ 'codes').makeRequest();
+ var requests = Future.wait([badCollectionRequest, nullCollectionRequest]);
+ requests.then((_) {
+ process.requestExit();
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_bad_function_test.dart b/tests/standalone/vmservice/isolate_bad_function_test.dart
new file mode 100644
index 0000000..3b6c414
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_bad_function_test.dart
@@ -0,0 +1,58 @@
+// 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 isolate_bad_function_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class NullCollectionTest extends VmServiceRequestHelper {
+ NullCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection/-99');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('null', reply['type']);
+ }
+}
+
+class BadCollectionTest extends VmServiceRequestHelper {
+ BadCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('error', reply['type']);
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(1);
+ tester.checkIsolateNameContains('unknown_isolate_command_script.dart');
+ _isolateId = reply['members'][0]['id'];
+ }
+}
+
+main() {
+ var process = new TestLauncher('unknown_isolate_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var badCollectionRequest =
+ new BadCollectionTest(port, test._isolateId,
+ 'functions').makeRequest();
+ var nullCollectionRequest =
+ new NullCollectionTest(port, test._isolateId,
+ 'functions').makeRequest();
+ var requests = Future.wait([badCollectionRequest, nullCollectionRequest]);
+ requests.then((_) {
+ process.requestExit();
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_bad_library_test.dart b/tests/standalone/vmservice/isolate_bad_library_test.dart
new file mode 100644
index 0000000..c7d2c54
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_bad_library_test.dart
@@ -0,0 +1,55 @@
+// 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 isolate_bad_library_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class NullCollectionTest extends VmServiceRequestHelper {
+ NullCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection/-100');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('null', reply['type']);
+ }
+}
+
+class BadCollectionTest extends VmServiceRequestHelper {
+ BadCollectionTest(port, id, collection) :
+ super('http://127.0.0.1:$port/isolates/$id/$collection');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('error', reply['type']);
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(1);
+ tester.checkIsolateNameContains('unknown_isolate_command_script.dart');
+ _isolateId = reply['members'][0]['id'];
+ }
+}
+
+main() {
+ var process = new TestLauncher('unknown_isolate_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var nullCollectionRequest =
+ new NullCollectionTest(port, test._isolateId,
+ 'libraries').makeRequest();
+ var requests = Future.wait([nullCollectionRequest]);
+ requests.then((_) {
+ process.requestExit();
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_class_test.dart b/tests/standalone/vmservice/isolate_class_test.dart
new file mode 100644
index 0000000..3f9064e
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_class_test.dart
@@ -0,0 +1,82 @@
+// 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 isolate_class_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class ClassTest extends VmServiceRequestHelper {
+ ClassTest(port, id, classId) :
+ super('http://127.0.0.1:$port/isolates/$id/classes/$classId');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('Class', reply['type']);
+ Expect.equals('C', reply['name']);
+ Expect.equals('isolate_stacktrace_command_script',
+ reply['library']['name']);
+ }
+}
+
+class LibraryTest extends VmServiceRequestHelper {
+ LibraryTest(port, id, libId) :
+ super('http://127.0.0.1:$port/isolates/$id/libraries/$libId');
+
+ int _classId;
+ onRequestCompleted(Map reply) {
+ Expect.equals('Library', reply['type']);
+ Expect.equals('isolate_stacktrace_command_script', reply['name']);
+ Expect.equals(1, reply['classes'].length);
+ Expect.equals('@Class', reply['classes'][0]['type']);
+ Expect.equals('C', reply['classes'][0]['name']);
+ _classId = reply['classes'][0]['id'];
+ }
+}
+
+class RootLibraryTest extends VmServiceRequestHelper {
+ RootLibraryTest(port, id) :
+ super('http://127.0.0.1:$port/isolates/$id/libraries');
+
+ int _libId;
+ onRequestCompleted(Map reply) {
+ Expect.equals('@Library', reply['type']);
+ Expect.equals('isolate_stacktrace_command_script', reply['name']);
+ _libId = reply['id'];
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(2);
+ tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart');
+ _isolateId = tester.checkIsolateNameContains('myIsolateName');
+ }
+}
+
+main() {
+ var process = new TestLauncher('isolate_stacktrace_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var rootLibraryTest =
+ new RootLibraryTest(port, test._isolateId);
+ rootLibraryTest.makeRequest().then((_) {
+ var libraryTest = new LibraryTest(port, test._isolateId,
+ rootLibraryTest._libId);
+ libraryTest.makeRequest().then((_) {
+ var classTest = new ClassTest(port, test._isolateId,
+ libraryTest._classId);
+ classTest.makeRequest().then((_) {
+ process.requestExit();
+ });
+ });
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_code_test.dart b/tests/standalone/vmservice/isolate_code_test.dart
new file mode 100644
index 0000000..8ce58dd
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_code_test.dart
@@ -0,0 +1,81 @@
+// 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 isolate_class_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class CodeATest extends VmServiceRequestHelper {
+ CodeATest(port, id, codeId) :
+ super('http://127.0.0.1:$port/isolates/$id/codes/$codeId');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('Code', reply['type']);
+ Expect.equals('a', reply['function']['name']);
+ Expect.isTrue(reply['disassembly'].length > 0);
+ }
+}
+
+class CodeCTest extends VmServiceRequestHelper {
+ CodeCTest(port, id, codeId) :
+ super('http://127.0.0.1:$port/isolates/$id/codes/$codeId');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('Code', reply['type']);
+ Expect.equals('C.c', reply['function']['name']);
+ Expect.isTrue(reply['disassembly'].length > 0);
+ }
+}
+
+class StackTraceTest extends VmServiceRequestHelper {
+ StackTraceTest(port, id) :
+ super('http://127.0.0.1:$port/isolates/$id/stacktrace');
+
+ int _aId;
+ int _cId;
+ onRequestCompleted(Map reply) {
+ Expect.equals('StackTrace', reply['type']);
+ List members = reply['members'];
+ Expect.equals('a', members[0]['name']);
+ _aId = members[0]['code']['id'];
+ Expect.equals('c', members[2]['name']);
+ _cId = members[2]['code']['id'];
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(2);
+ tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart');
+ _isolateId = tester.checkIsolateNameContains('myIsolateName');
+ }
+}
+
+main() {
+ var process = new TestLauncher('isolate_stacktrace_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var stackTraceTest =
+ new StackTraceTest(port, test._isolateId);
+ stackTraceTest.makeRequest().then((_) {
+ var codeATest = new CodeATest(port, test._isolateId,
+ stackTraceTest._aId);
+ var codeCTest = new CodeCTest(port, test._isolateId,
+ stackTraceTest._cId);
+ var requests = Future.wait([codeATest.makeRequest(),
+ codeCTest.makeRequest()]);
+ requests.then((_) {
+ process.requestExit();
+ });
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_echo_script.dart b/tests/standalone/vmservice/isolate_echo_script.dart
new file mode 100644
index 0000000..a727441
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_echo_script.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.
+
+library isolate_echo_script;
+
+import 'dart:io';
+
+main() {
+ print(''); // Print blank line to signal that we are ready.
+
+ // Wait until signaled from spawning test.
+ stdin.first.then((_) => exit(0));
+}
diff --git a/tests/standalone/vmservice/isolate_echo_test.dart b/tests/standalone/vmservice/isolate_echo_test.dart
new file mode 100644
index 0000000..f5ed761
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_echo_test.dart
@@ -0,0 +1,60 @@
+// 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 isolate_echo_test;
+
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class EchoRequestTest extends VmServiceRequestHelper {
+ EchoRequestTest(port, id) :
+ super('http://127.0.0.1:$port/isolates/$id/_echo/foo/bar?a=b&k=&d=e&z=w');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('message', reply['type']);
+
+ Expect.equals(3, reply['message']['arguments'].length);
+ Expect.equals('_echo', reply['message']['arguments'][0]);
+ Expect.equals('foo', reply['message']['arguments'][1]);
+ Expect.equals('bar', reply['message']['arguments'][2]);
+
+ Expect.equals(4, reply['message']['option_keys'].length);
+ Expect.equals('a', reply['message']['option_keys'][0]);
+ Expect.equals('k', reply['message']['option_keys'][1]);
+ Expect.equals('d', reply['message']['option_keys'][2]);
+ Expect.equals('z', reply['message']['option_keys'][3]);
+
+ Expect.equals(4, reply['message']['option_values'].length);
+ Expect.equals('b', reply['message']['option_values'][0]);
+ Expect.equals('', reply['message']['option_values'][1]);
+ Expect.equals('e', reply['message']['option_values'][2]);
+ Expect.equals('w', reply['message']['option_values'][3]);
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(1);
+ tester.checkIsolateNameContains('isolate_echo_script.dart');
+ _isolateId = reply['members'][0]['id'];
+ }
+}
+
+
+main() {
+ var process = new TestLauncher('isolate_echo_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var echoRequestTest = new EchoRequestTest(port, test._isolateId);
+ echoRequestTest.makeRequest().then((_) {
+ process.requestExit();
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_function_test.dart b/tests/standalone/vmservice/isolate_function_test.dart
new file mode 100644
index 0000000..369616b
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_function_test.dart
@@ -0,0 +1,80 @@
+// 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 isolate_class_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class MethodTest extends VmServiceRequestHelper {
+ MethodTest(port, id, functionId) :
+ super('http://127.0.0.1:$port/isolates/$id/functions/$functionId');
+ onRequestCompleted(Map reply) {
+ Expect.equals('Function', reply['type']);
+ Expect.equals('C.c', reply['name']);
+ Expect.equals(false, reply['is_static']);
+ }
+}
+
+class FunctionTest extends VmServiceRequestHelper {
+ FunctionTest(port, id, functionId) :
+ super('http://127.0.0.1:$port/isolates/$id/functions/$functionId');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('Function', reply['type']);
+ Expect.equals('a', reply['name']);
+ Expect.equals(true, reply['is_static']);
+ }
+}
+
+class StackTraceTest extends VmServiceRequestHelper {
+ StackTraceTest(port, id) :
+ super('http://127.0.0.1:$port/isolates/$id/stacktrace');
+
+ int _aId;
+ int _cId;
+ onRequestCompleted(Map reply) {
+ Expect.equals('StackTrace', reply['type']);
+ List members = reply['members'];
+ Expect.equals('a', members[0]['name']);
+ _aId = members[0]['function']['id'];
+ Expect.equals('c', members[2]['name']);
+ _cId = members[2]['function']['id'];
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(2);
+ tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart');
+ _isolateId = tester.checkIsolateNameContains('myIsolateName');
+ }
+}
+
+main() {
+ var process = new TestLauncher('isolate_stacktrace_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var stackTraceTest =
+ new StackTraceTest(port, test._isolateId);
+ stackTraceTest.makeRequest().then((_) {
+ var functionTest = new FunctionTest(port, test._isolateId,
+ stackTraceTest._aId);
+ functionTest.makeRequest().then((_) {
+ var methodTest = new MethodTest(port, test._isolateId,
+ stackTraceTest._cId);
+ methodTest.makeRequest().then((_) {
+ process.requestExit();
+ });
+ });
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_library_test.dart b/tests/standalone/vmservice/isolate_library_test.dart
new file mode 100644
index 0000000..31d269b
--- /dev/null
+++ b/tests/standalone/vmservice/isolate_library_test.dart
@@ -0,0 +1,61 @@
+// 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 isolate_library_test;
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'package:expect/expect.dart';
+
+class LibraryTest extends VmServiceRequestHelper {
+ LibraryTest(port, id, libId) :
+ super('http://127.0.0.1:$port/isolates/$id/libraries/$libId');
+
+ onRequestCompleted(Map reply) {
+ Expect.equals('Library', reply['type']);
+ Expect.equals('isolate_stacktrace_command_script', reply['name']);
+ }
+}
+
+class RootLibraryTest extends VmServiceRequestHelper {
+ RootLibraryTest(port, id) :
+ super('http://127.0.0.1:$port/isolates/$id/libraries');
+
+ int _libId;
+ onRequestCompleted(Map reply) {
+ Expect.equals('@Library', reply['type']);
+ Expect.equals('isolate_stacktrace_command_script', reply['name']);
+ _libId = reply['id'];
+ }
+}
+
+class IsolateListTest extends VmServiceRequestHelper {
+ IsolateListTest(port) : super('http://127.0.0.1:$port/isolates');
+
+ int _isolateId;
+ onRequestCompleted(Map reply) {
+ IsolateListTester tester = new IsolateListTester(reply);
+ tester.checkIsolateCount(2);
+ tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart');
+ _isolateId = tester.checkIsolateNameContains('myIsolateName');
+ }
+}
+
+main() {
+ var process = new TestLauncher('isolate_stacktrace_command_script.dart');
+ process.launch().then((port) {
+ var test = new IsolateListTest(port);
+ test.makeRequest().then((_) {
+ var rootLibraryTest =
+ new RootLibraryTest(port, test._isolateId);
+ rootLibraryTest.makeRequest().then((_) {
+ var libraryTest = new LibraryTest(port, test._isolateId,
+ rootLibraryTest._libId);
+ libraryTest.makeRequest().then((_) {
+ process.requestExit();
+ });
+ });
+ });
+ });
+}
diff --git a/tests/standalone/vmservice/isolate_stacktrace_command_script.dart b/tests/standalone/vmservice/isolate_stacktrace_command_script.dart
index a573126..b9bbccf 100644
--- a/tests/standalone/vmservice/isolate_stacktrace_command_script.dart
+++ b/tests/standalone/vmservice/isolate_stacktrace_command_script.dart
@@ -9,6 +9,7 @@
void a() {
int x = 0;
+ print(''); // Print blank line to signal that we are ready.
while (true) {
x &= x;
}
@@ -30,7 +31,6 @@
main() {
spawnFunction(myIsolateName);
- print(''); // Print blank line to signal that we are ready.
// Wait until signaled from spawning test.
stdin.first.then((_) => exit(0));
}
diff --git a/tests/standalone/vmservice/multiple_isolate_list_script.dart b/tests/standalone/vmservice/multiple_isolate_list_script.dart
index 21e6a0a..128f61a 100644
--- a/tests/standalone/vmservice/multiple_isolate_list_script.dart
+++ b/tests/standalone/vmservice/multiple_isolate_list_script.dart
@@ -8,7 +8,9 @@
import 'dart:isolate';
void isolateMain1() {
- // Die immediately.
+ // Spawn another isolate.
+ spawnFunction(myIsolateName);
+ // Kill this isolate.
port.close();
}
@@ -17,12 +19,11 @@
port.receive((a, b) {
port.close();
});
+ print(''); // Print blank line to signal that we are ready.
}
main() {
spawnFunction(isolateMain1);
- spawnFunction(myIsolateName);
- print(''); // Print blank line to signal that we are ready.
// Wait until signaled from spawning test.
stdin.first.then((_) => exit(0));
}
diff --git a/tests/standalone/vmservice/test_helper.dart b/tests/standalone/vmservice/test_helper.dart
index 7e95539..e3f51c5 100644
--- a/tests/standalone/vmservice/test_helper.dart
+++ b/tests/standalone/vmservice/test_helper.dart
@@ -25,6 +25,7 @@
return response
.fold(new BytesBuilder(), (b, d) => b..add(d))
.then((builder) {
+ print('** GET: $uri');
_requestCompleted(builder.takeBytes(), response);
});
}).catchError((error) {
@@ -41,6 +42,7 @@
onRequestFailed(e);
return;
}
+ print('** Response: $replyAsString');
var reply;
try {
reply = JSON.parse(replyAsString);
@@ -85,6 +87,7 @@
Future<int> launch() {
String dartExecutable = Platform.executable;
+ print('** Launching $scriptPath');
return Process.start(dartExecutable,
['--enable-vm-service:0', scriptPath]).then((p) {
@@ -108,6 +111,7 @@
completer.complete(portNumber);
// Stop repeat completions.
first = false;
+ print('** Signaled to run test queries on $portNumber');
}
print(line);
});
@@ -123,6 +127,7 @@
}
void requestExit() {
+ print('** Requesting script to exit.');
process.stdin.add([32, 13, 10]);
}
}
diff --git a/tools/VERSION b/tools/VERSION
index b81bbdd..4a9b649 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 6
-BUILD 15
-PATCH 3
+BUILD 16
+PATCH 0
diff --git a/tools/dom/docs/docs.json b/tools/dom/docs/docs.json
index 7ce71fb..eb0de65 100644
--- a/tools/dom/docs/docs.json
+++ b/tools/dom/docs/docs.json
@@ -601,7 +601,7 @@
" *",
" * var request = new HttpRequest();",
" * request.open('GET', 'http://dartlang.org')",
- " * request.onLoad.add((event) => print('Request complete'));",
+ " * request.onLoad.listen((event) => print('Request complete'));",
" *",
" * is the (more verbose) equivalent of",
" *",
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index 5d067fe..d56916c 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -26,6 +26,30 @@
},
"support_level": "stable"
},
+ "AesCbcParams": {
+ "members": {
+ "iv": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
+ "AesKeyGenParams": {
+ "members": {
+ "length": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
+ "Algorithm": {
+ "members": {
+ "name": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"AnalyserNode": {
"comment": "https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AnalyserNode",
"members": {
@@ -108,6 +132,9 @@
"noteGrainOn": {},
"noteOff": {},
"noteOn": {},
+ "onended": {
+ "support_level": "untriaged"
+ },
"playbackRate": {},
"playbackState": {},
"start": {},
@@ -120,6 +147,9 @@
"members": {
"AudioContext": {},
"activeSourceCount": {},
+ "addEventListener": {
+ "support_level": "untriaged"
+ },
"createAnalyser": {},
"createBiquadFilter": {},
"createBuffer": {},
@@ -140,14 +170,23 @@
"createMediaStreamSource": {},
"createOscillator": {},
"createPanner": {},
+ "createPeriodicWave": {
+ "support_level": "untriaged"
+ },
"createScriptProcessor": {},
"createWaveShaper": {},
"createWaveTable": {},
"currentTime": {},
"decodeAudioData": {},
"destination": {},
+ "dispatchEvent": {
+ "support_level": "untriaged"
+ },
"listener": {},
"oncomplete": {},
+ "removeEventListener": {
+ "support_level": "untriaged"
+ },
"sampleRate": {},
"startRendering": {}
},
@@ -479,7 +518,10 @@
"length": {},
"parentRule": {},
"removeProperty": {},
- "setProperty": {}
+ "setProperty": {},
+ "var": {
+ "support_level": "untriaged"
+ }
},
"support_level": "stable"
},
@@ -548,6 +590,29 @@
},
"support_level": "deprecated"
},
+ "CSSVariablesMap": {
+ "members": {
+ "clear": {
+ "support_level": "untriaged"
+ },
+ "delete": {
+ "support_level": "untriaged"
+ },
+ "get": {
+ "support_level": "untriaged"
+ },
+ "has": {
+ "support_level": "untriaged"
+ },
+ "set": {
+ "support_level": "untriaged"
+ },
+ "size": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"CSSViewportRule": {
"members": {
"style": {
@@ -811,6 +876,12 @@
"comment": "http://www.w3.org/TR/ime-api/#idl-def-Composition",
"members": {
"caret": {},
+ "selectionEnd": {
+ "support_level": "untriaged"
+ },
+ "selectionStart": {
+ "support_level": "untriaged"
+ },
"text": {}
},
"support_level": "experimental"
@@ -917,6 +988,29 @@
},
"support_level": "experimental"
},
+ "CryptoOperation": {
+ "members": {
+ "abort": {
+ "support_level": "untriaged"
+ },
+ "algorithm": {
+ "support_level": "untriaged"
+ },
+ "finish": {
+ "support_level": "untriaged"
+ },
+ "process": {
+ "support_level": "untriaged"
+ },
+ "processByteBuffer": {
+ "support_level": "untriaged"
+ },
+ "processTypedData": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"CustomElementConstructor": {
"comment": "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-custom-element-constructor-generation",
"dart_action": "suppress",
@@ -1243,6 +1337,17 @@
},
"support_level": "experimental"
},
+ "DedicatedWorkerGlobalScope": {
+ "members": {
+ "onmessage": {
+ "support_level": "untriaged"
+ },
+ "postMessage": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"DelayNode": {
"comment": "https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#DelayNode",
"members": {
@@ -1498,6 +1603,12 @@
"onkeyup": {},
"onload": {},
"onmousedown": {},
+ "onmouseenter": {
+ "support_level": "untriaged"
+ },
+ "onmouseleave": {
+ "support_level": "untriaged"
+ },
"onmousemove": {},
"onmouseout": {},
"onmouseover": {},
@@ -1753,6 +1864,10 @@
"dart_action": "stable",
"support_level": "nonstandard"
},
+ "createShadowRoot": {
+ "comment": "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root",
+ "support_level": "experimental"
+ },
"dataset": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-dataset"
},
@@ -1855,6 +1970,12 @@
"onkeyup": {},
"onload": {},
"onmousedown": {},
+ "onmouseenter": {
+ "support_level": "untriaged"
+ },
+ "onmouseleave": {
+ "support_level": "untriaged"
+ },
"onmousemove": {},
"onmouseout": {},
"onmouseover": {},
@@ -1918,6 +2039,9 @@
"support_level": "nonstandard"
},
"previousElementSibling": {},
+ "pseudo": {
+ "support_level": "untriaged"
+ },
"querySelector": {},
"querySelectorAll": {},
"remove": {
@@ -1952,6 +2076,10 @@
"support_level": "deprecated"
},
"setAttributeNodeNS": {},
+ "shadowRoot": {
+ "comment": "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root",
+ "support_level": "experimental"
+ },
"spellcheck": {
"comment": "http://blog.whatwg.org/the-road-to-html-5-spellchecking",
"dart_action": "experimental",
@@ -1973,10 +2101,6 @@
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#the-translate-attribute",
"support_level": "experimental"
},
- "webkitCreateShadowRoot": {
- "comment": "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root",
- "support_level": "experimental"
- },
"webkitGetRegionFlowRanges": {
"comment": "http://dev.w3.org/csswg/css-regions/#dom-region-getregionflowranges",
"support_level": "experimental"
@@ -2010,10 +2134,6 @@
"comment": "https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#widl-Element-requestPointerLock-void",
"support_level": "experimental"
},
- "webkitShadowRoot": {
- "comment": "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#api-shadow-aware-create-shadow-root",
- "support_level": "experimental"
- },
"webkitdropzone": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#the-dropzone-attribute",
"support_level": "experimental"
@@ -2897,6 +3017,9 @@
"members": {
"close": {},
"open": {},
+ "returnValue": {
+ "support_level": "untriaged"
+ },
"show": {},
"showModal": {}
},
@@ -3394,6 +3517,9 @@
"support_level": "experimental"
},
"indeterminate": {},
+ "inputMode": {
+ "support_level": "untriaged"
+ },
"labels": {
"comment": "http://www.w3.org/TR/html5/forms.html#dom-lfe-labels"
},
@@ -4389,6 +4515,9 @@
},
"disabled": {},
"form": {},
+ "inputMode": {
+ "support_level": "untriaged"
+ },
"labels": {
"comment": "http://www.w3.org/TR/html5/forms.html#dom-lfe-labels",
"dart_action": "unstable"
@@ -4535,6 +4664,14 @@
},
"support_level": "stable"
},
+ "HmacParams": {
+ "members": {
+ "hash": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"IDBAny": {
"dart_action": "suppress",
"members": {},
@@ -4578,6 +4715,10 @@
"name": {},
"objectStoreNames": {},
"onabort": {},
+ "onclose": {
+ "comment": "https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540",
+ "support_level": "experimental"
+ },
"onerror": {},
"onversionchange": {},
"removeEventListener": {},
@@ -4730,6 +4871,21 @@
},
"support_level": "stable"
},
+ "ImageBitmap": {
+ "members": {
+ "height": {
+ "support_level": "untriaged"
+ },
+ "width": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
+ "ImageBitmapCallback": {
+ "members": {},
+ "support_level": "untriaged"
+ },
"ImageData": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#imagedata",
"members": {
@@ -4748,7 +4904,10 @@
"locale": {},
"open": {},
"setCaretRectangle": {},
- "setExclusionRectangle": {}
+ "setExclusionRectangle": {},
+ "target": {
+ "support_level": "untriaged"
+ }
},
"support_level": "experimental"
},
@@ -4782,6 +4941,23 @@
},
"support_level": "stable"
},
+ "Key": {
+ "members": {
+ "algorithm": {
+ "support_level": "untriaged"
+ },
+ "extractable": {
+ "support_level": "untriaged"
+ },
+ "type": {
+ "support_level": "untriaged"
+ },
+ "usages": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"KeyboardEvent": {
"comment": "http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent",
"members": {
@@ -5829,7 +6005,13 @@
"frequency": {},
"noteOff": {},
"noteOn": {},
+ "onended": {
+ "support_level": "untriaged"
+ },
"playbackState": {},
+ "setPeriodicWave": {
+ "support_level": "untriaged"
+ },
"setWaveTable": {},
"start": {},
"stop": {},
@@ -6099,6 +6281,10 @@
},
"support_level": "stable"
},
+ "PeriodicWave": {
+ "members": {},
+ "support_level": "untriaged"
+ },
"Plugin": {
"members": {
"__getter__": {},
@@ -6180,11 +6366,40 @@
"support_level": "stable"
},
"Promise": {
- "members": {},
+ "members": {
+ "_any": {
+ "support_level": "untriaged"
+ },
+ "every": {
+ "support_level": "untriaged"
+ },
+ "fulfill": {
+ "support_level": "untriaged"
+ },
+ "reject": {
+ "support_level": "untriaged"
+ },
+ "resolve": {
+ "support_level": "untriaged"
+ },
+ "some": {
+ "support_level": "untriaged"
+ }
+ },
"support_level": "untriaged"
},
"PromiseResolver": {
- "members": {},
+ "members": {
+ "fulfill": {
+ "support_level": "untriaged"
+ },
+ "reject": {
+ "support_level": "untriaged"
+ },
+ "resolve": {
+ "support_level": "untriaged"
+ }
+ },
"support_level": "untriaged"
},
"RGBColor": {
@@ -7089,7 +7304,13 @@
"id": {},
"ownerSVGElement": {},
"viewportElement": {},
- "xmlbase": {}
+ "xmlbase": {},
+ "xmllang": {
+ "support_level": "untriaged"
+ },
+ "xmlspace": {
+ "support_level": "untriaged"
+ }
},
"support_level": "stable"
},
@@ -7097,9 +7318,15 @@
"comment": "http://www.w3.org/TR/SVG/struct.html#InterfaceSVGElementInstance",
"dart_action": "unstable",
"members": {
+ "addEventListener": {
+ "support_level": "untriaged"
+ },
"childNodes": {},
"correspondingElement": {},
"correspondingUseElement": {},
+ "dispatchEvent": {
+ "support_level": "untriaged"
+ },
"firstChild": {},
"lastChild": {},
"nextSibling": {},
@@ -7129,6 +7356,12 @@
"onkeyup": {},
"onload": {},
"onmousedown": {},
+ "onmouseenter": {
+ "support_level": "untriaged"
+ },
+ "onmouseleave": {
+ "support_level": "untriaged"
+ },
"onmousemove": {},
"onmouseout": {},
"onmouseover": {},
@@ -7147,7 +7380,10 @@
"onsubmit": {},
"onunload": {},
"parentNode": {},
- "previousSibling": {}
+ "previousSibling": {},
+ "removeEventListener": {
+ "support_level": "untriaged"
+ }
},
"support_level": "stable"
},
@@ -8037,6 +8273,44 @@
},
"support_level": "stable"
},
+ "SVGGraphicsElement": {
+ "members": {
+ "farthestViewportElement": {
+ "support_level": "untriaged"
+ },
+ "getBBox": {
+ "support_level": "untriaged"
+ },
+ "getCTM": {
+ "support_level": "untriaged"
+ },
+ "getScreenCTM": {
+ "support_level": "untriaged"
+ },
+ "getTransformToElement": {
+ "support_level": "untriaged"
+ },
+ "hasExtension": {
+ "support_level": "untriaged"
+ },
+ "nearestViewportElement": {
+ "support_level": "untriaged"
+ },
+ "requiredExtensions": {
+ "support_level": "untriaged"
+ },
+ "requiredFeatures": {
+ "support_level": "untriaged"
+ },
+ "systemLanguage": {
+ "support_level": "untriaged"
+ },
+ "transform": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"SVGHKernElement": {
"comment": "http://www.w3.org/TR/SVG/fonts.html#InterfaceSVGHKernElement",
"dart_action": "unstable",
@@ -9661,6 +9935,9 @@
"originalPolicy": {},
"referrer": {},
"sourceFile": {},
+ "statusCode": {
+ "support_level": "untriaged"
+ },
"violatedDirective": {}
},
"support_level": "experimental"
@@ -9754,6 +10031,14 @@
},
"support_level": "nonstandard"
},
+ "SharedWorkerGlobalScope": {
+ "members": {
+ "name": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"SourceBuffer": {
"comment": "https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#sourcebuffer",
"members": {
@@ -9767,6 +10052,9 @@
"appendBuffer": {
"support_level": "untriaged"
},
+ "appendBufferView": {
+ "support_level": "untriaged"
+ },
"buffered": {},
"dispatchEvent": {
"support_level": "untriaged"
@@ -9951,6 +10239,12 @@
"comment": "https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#tts-section",
"members": {
"SpeechSynthesisUtterance": {},
+ "addEventListener": {
+ "support_level": "untriaged"
+ },
+ "dispatchEvent": {
+ "support_level": "untriaged"
+ },
"lang": {},
"onboundary": {},
"onend": {},
@@ -9961,6 +10255,9 @@
"onstart": {},
"pitch": {},
"rate": {},
+ "removeEventListener": {
+ "support_level": "untriaged"
+ },
"text": {},
"voice": {},
"volume": {}
@@ -10093,7 +10390,26 @@
"support_level": "stable"
},
"SubtleCrypto": {
- "members": {},
+ "members": {
+ "decrypt": {
+ "support_level": "untriaged"
+ },
+ "digest": {
+ "support_level": "untriaged"
+ },
+ "encrypt": {
+ "support_level": "untriaged"
+ },
+ "importKey": {
+ "support_level": "untriaged"
+ },
+ "sign": {
+ "support_level": "untriaged"
+ },
+ "verify": {
+ "support_level": "untriaged"
+ }
+ },
"support_level": "untriaged"
},
"Text": {
@@ -11405,6 +11721,9 @@
"closed": {},
"confirm": {},
"console": {},
+ "createImageBitmap": {
+ "support_level": "untriaged"
+ },
"crypto": {
"comment": "http://www.w3.org/TR/WebCryptoAPI/",
"support_level": "experimental"
@@ -11501,6 +11820,12 @@
"onloadstart": {},
"onmessage": {},
"onmousedown": {},
+ "onmouseenter": {
+ "support_level": "untriaged"
+ },
+ "onmouseleave": {
+ "support_level": "untriaged"
+ },
"onmousemove": {},
"onmouseout": {},
"onmouseover": {},
@@ -11686,6 +12011,17 @@
},
"support_level": "stable"
},
+ "WindowBase64": {
+ "members": {
+ "atob": {
+ "support_level": "untriaged"
+ },
+ "btoa": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"WindowTimers": {
"members": {
"clearInterval": {
@@ -11708,11 +12044,20 @@
"dart_action": "experimental",
"members": {
"Worker": {},
+ "addEventListener": {
+ "support_level": "untriaged"
+ },
+ "dispatchEvent": {
+ "support_level": "untriaged"
+ },
"onerror": {
"support_level": "untriaged"
},
"onmessage": {},
"postMessage": {},
+ "removeEventListener": {
+ "support_level": "untriaged"
+ },
"terminate": {}
},
"support_level": "stable"
@@ -11804,6 +12149,95 @@
},
"support_level": "untriaged"
},
+ "WorkerGlobalScope": {
+ "members": {
+ "PERSISTENT": {
+ "support_level": "untriaged"
+ },
+ "TEMPORARY": {
+ "support_level": "untriaged"
+ },
+ "addEventListener": {
+ "support_level": "untriaged"
+ },
+ "atob": {
+ "support_level": "untriaged"
+ },
+ "btoa": {
+ "support_level": "untriaged"
+ },
+ "clearInterval": {
+ "support_level": "untriaged"
+ },
+ "clearTimeout": {
+ "support_level": "untriaged"
+ },
+ "close": {
+ "support_level": "untriaged"
+ },
+ "crypto": {
+ "support_level": "untriaged"
+ },
+ "dispatchEvent": {
+ "support_level": "untriaged"
+ },
+ "importScripts": {
+ "support_level": "untriaged"
+ },
+ "indexedDB": {
+ "support_level": "untriaged"
+ },
+ "location": {
+ "support_level": "untriaged"
+ },
+ "navigator": {
+ "support_level": "untriaged"
+ },
+ "onerror": {
+ "support_level": "untriaged"
+ },
+ "openDatabase": {
+ "support_level": "untriaged"
+ },
+ "openDatabaseSync": {
+ "support_level": "untriaged"
+ },
+ "performance": {
+ "support_level": "untriaged"
+ },
+ "removeEventListener": {
+ "support_level": "untriaged"
+ },
+ "self": {
+ "support_level": "untriaged"
+ },
+ "setInterval": {
+ "support_level": "untriaged"
+ },
+ "setTimeout": {
+ "support_level": "untriaged"
+ },
+ "webkitIndexedDB": {
+ "support_level": "untriaged"
+ },
+ "webkitNotifications": {
+ "support_level": "untriaged"
+ },
+ "webkitRequestFileSystem": {
+ "support_level": "untriaged"
+ },
+ "webkitRequestFileSystemSync": {
+ "support_level": "untriaged"
+ },
+ "webkitResolveLocalFileSystemSyncURL": {
+ "support_level": "untriaged"
+ },
+ "webkitResolveLocalFileSystemURL": {
+ "support_level": "untriaged"
+ }
+ },
+ "support_level": "untriaged"
+ },
"WorkerLocation": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#workerlocation",
"members": {
diff --git a/tools/dom/idl/dart/dart.idl b/tools/dom/idl/dart/dart.idl
index 8c9035b..e7be42c 100644
--- a/tools/dom/idl/dart/dart.idl
+++ b/tools/dom/idl/dart/dart.idl
@@ -19,7 +19,7 @@
interface AudioParam {
// TODO(ager): Auto-generate this custom method when the info about retaining
// typed arrays is in the IDL.
- [Custom] void setValueCurveAtTime(Float32Array values, float time, float duration);
+ [Custom] void setValueCurveAtTime(Float32Array values, double time, double duration);
};
[Supplemental]
@@ -35,6 +35,11 @@
};
[Supplemental]
+interface Node {
+ Node cloneNode([Default=Undefined] optional boolean deep);
+};
+
+[Supplemental]
interface ScriptProcessorNode {
[Suppressed] attribute EventListener onaudioprocess;
[Custom] void _setEventListener(EventListener eventListener);
@@ -333,5 +338,3 @@
[Supplemental]
interface Window : EventTarget {};
-[Supplemental]
-interface AbstractWorker : EventTarget {};
diff --git a/tools/dom/scripts/dartgenerator.py b/tools/dom/scripts/dartgenerator.py
index 5954d4e..cde0484 100755
--- a/tools/dom/scripts/dartgenerator.py
+++ b/tools/dom/scripts/dartgenerator.py
@@ -200,11 +200,25 @@
visit(interface)
return ordered
+ def IsEventTarget(self, database, interface):
+ if interface.id == 'EventTarget':
+ return True
+ for parent in interface.parents:
+ parent_name = parent.type.id
+ if database.HasInterface(parent_name):
+ parent_interface = database.GetInterface(parent.type.id)
+ if self.IsEventTarget(database, parent_interface):
+ return True
+ return False
+
def FixEventTargets(self, database):
for interface in database.GetInterfaces():
- # Create fake EventTarget parent interface for interfaces that have
- # 'EventTarget' extended attribute.
- if 'EventTarget' in interface.ext_attrs and interface.id != 'EventTarget':
+ if self.IsEventTarget(database, interface):
+ # Add as an attribute for easy querying in generation code.
+ interface.ext_attrs['EventTarget'] = None
+ elif 'EventTarget' in interface.ext_attrs:
+ # Create fake EventTarget parent interface for interfaces that have
+ # 'EventTarget' extended attribute.
ast = [('Annotation', [('Id', 'WebKit')]),
('InterfaceType', ('ScopedName', 'EventTarget'))]
interface.parents.append(idlnode.IDLParentInterface(ast))
@@ -214,6 +228,8 @@
for interface in database.GetInterfaces():
for operation in interface.operations:
call_with = (operation.ext_attrs.get('CallWith', '').split('|') +
- operation.ext_attrs.get('ConstructorCallWith', '').split('|'))
+ operation.ext_attrs.get('ConstructorCallWith', '').split('|') +
+ operation.ext_attrs.get('CallWith', '').split('&') +
+ operation.ext_attrs.get('ConstructorCallWith', '').split('&'))
if 'ScriptArguments' in call_with:
operation.arguments.append(ARG)
diff --git a/tools/dom/scripts/dartmetadata.py b/tools/dom/scripts/dartmetadata.py
index 259b75b..ecbc261 100644
--- a/tools/dom/scripts/dartmetadata.py
+++ b/tools/dom/scripts/dartmetadata.py
@@ -398,14 +398,14 @@
'Window.webkitNotifications': _webkit_experimental_annotations,
'Window.webkitRequestFileSystem': _file_system_annotations,
'Window.webkitResolveLocalFileSystemURL': _file_system_annotations,
+ 'Element.createShadowRoot': [
+ "@SupportedBrowser(SupportedBrowser.CHROME, '25')",
+ "@Experimental()",
+ ],
'Element.ontransitionend': _all_but_ie9_annotations,
# Placeholder to add experimental flag, implementation for this is
# pending in a separate CL.
'Element.webkitMatchesSelector': ['@Experimental()'],
- 'Element.webkitCreateShadowRoot': [
- "@SupportedBrowser(SupportedBrowser.CHROME, '25')",
- "@Experimental()",
- ],
'Event.clipboardData': _webkit_experimental_annotations,
'FormData': _all_but_ie9_annotations,
'HashChangeEvent': [
diff --git a/tools/dom/scripts/database.py b/tools/dom/scripts/database.py
index 11f8667..624ad00 100755
--- a/tools/dom/scripts/database.py
+++ b/tools/dom/scripts/database.py
@@ -256,10 +256,6 @@
def walk(parents):
for parent in parents:
parent_name = parent.type.id
- if parent_name == 'EventTarget':
- # Currently EventTarget is implemented as a mixin, not a proper
- # super interface---ignore its members.
- continue
if IsDartCollectionType(parent_name):
result.append(parent_name)
continue
@@ -271,7 +267,7 @@
result = []
if interface.parents:
parent = interface.parents[0]
- if IsPureInterface(parent.type.id):
+ if IsPureInterface(parent.type.id) or parent.type.id == 'EventTarget':
walk(interface.parents)
else:
walk(interface.parents[1:])
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 9ec3351..d264a5c 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -17,7 +17,6 @@
# TODO(sra): DOMStringMap should be a class implementing Map<String,String>.
'DOMStringMap',
'ChildNode',
- 'ElementTimeControl',
'EventListener',
'MediaQueryListListener',
'MutationCallback',
@@ -25,15 +24,12 @@
'SVGExternalResourcesRequired',
'SVGFilterPrimitiveStandardAttributes',
'SVGFitToViewBox',
- 'SVGLangSpace',
- 'SVGLocatable',
'SVGTests',
- 'SVGTransformable',
'SVGURIReference',
'SVGZoomAndPan',
'TimeoutHandler',
+ 'WindowBase64',
'WindowTimers',
- 'WorkerPerformance',
])
def IsPureInterface(interface_name):
@@ -694,12 +690,7 @@
if not self._idl_type.startswith('SVG'):
return ['"%s.h"' % self.native_type()]
- if self._idl_type in ['SVGNumber', 'SVGPoint']:
- return ['"SVGPropertyTearOff.h"']
- if self._idl_type.startswith('SVGPathSeg'):
- include = self._idl_type.replace('Abs', '').replace('Rel', '')
- else:
- include = self._idl_type
+ include = self._idl_type
return ['"%s.h"' % include] + _svg_supplemental_includes
def receiver(self):
@@ -1108,7 +1099,7 @@
'SVGLength': TypeData(clazz='SVGTearOff'),
'SVGLengthList': TypeData(clazz='SVGTearOff', item_type='SVGLength'),
'SVGMatrix': TypeData(clazz='SVGTearOff'),
- 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<float>'),
+ 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<SVGNumber>'),
'SVGNumberList': TypeData(clazz='SVGTearOff', item_type='SVGNumber'),
'SVGPathSegList': TypeData(clazz='SVGTearOff', item_type='SVGPathSeg',
native_type='SVGPathSegListPropertyTearOff'),
@@ -1150,8 +1141,6 @@
match = re.match(r'(?:sequence<(\w+)>|(\w+)\[\])$', type_name)
if match:
type_data = TypeData('Sequence')
- if type_name == 'DOMString[]':
- return DOMStringArrayTypeInfo(type_data, self.TypeInfo('DOMString'))
item_info = self.TypeInfo(match.group(1) or match.group(2))
# TODO(vsm): Generalize this code.
if 'SourceInfo' in type_name:
@@ -1198,8 +1187,11 @@
type_name, type_data, dart_interface_name, self)
if type_data.clazz == 'BasicTypedList':
- dart_interface_name = self._renamer.RenameInterface(
- self._database.GetInterface(type_name))
+ if type_name == 'ArrayBuffer':
+ dart_interface_name = 'ByteBuffer'
+ else:
+ dart_interface_name = self._renamer.RenameInterface(
+ self._database.GetInterface(type_name))
return BasicTypedListIDLTypeInfo(
type_name, type_data, dart_interface_name, self)
diff --git a/tools/dom/scripts/htmleventgenerator.py b/tools/dom/scripts/htmleventgenerator.py
index b6566af..eee08c6 100644
--- a/tools/dom/scripts/htmleventgenerator.py
+++ b/tools/dom/scripts/htmleventgenerator.py
@@ -70,6 +70,8 @@
'*.loadedmetadata': ('loadedMetadata', 'Event'),
'*.message': ('message', 'MessageEvent'),
'*.mousedown': ('mouseDown', 'MouseEvent'),
+ '*.mouseenter': ('mouseEnter', 'MouseEvent'),
+ '*.mouseleave': ('mouseLeave', 'MouseEvent'),
'*.mousemove': ('mouseMove', 'MouseEvent'),
'*.mouseout': ('mouseOut', 'MouseEvent'),
'*.mouseover': ('mouseOver', 'MouseEvent'),
@@ -153,6 +155,7 @@
'HTMLMediaElement.webkitkeyerror': ('keyError', 'MediaKeyEvent'),
'HTMLMediaElement.webkitkeymessage': ('keyMessage', 'MediaKeyEvent'),
'HTMLMediaElement.webkitneedkey': ('needKey', 'MediaKeyEvent'),
+ 'IDBDatabase.close': ('close', 'Event'),
'IDBDatabase.versionchange': ('versionChange', 'VersionChangeEvent'),
'IDBOpenDBRequest.blocked': ('blocked', 'Event'),
'IDBOpenDBRequest.upgradeneeded': ('upgradeNeeded', 'VersionChangeEvent'),
@@ -173,7 +176,6 @@
'Notification.close': ('close', 'Event'),
'Notification.display': ('display', 'Event'),
'Notification.show': ('show', 'Event'),
- 'Performance.webkitresourcetimingbufferfull': ('resourceTimingBufferFull', 'Event'),
'RTCDTMFSender.tonechange': ('toneChange', 'RtcDtmfToneChangeEvent'),
'RTCDataChannel.close': ('close', 'Event'),
'RTCDataChannel.open': ('open', 'Event'),
@@ -184,7 +186,6 @@
'RTCPeerConnection.negotiationneeded': ('negotiationNeeded', 'Event'),
'RTCPeerConnection.removestream': ('removeStream', 'MediaStreamEvent'),
'RTCPeerConnection.signalingstatechange': ('signalingStateChange', 'Event'),
- 'SharedWorkerContext.connect': ('connect', 'Event'),
'SpeechRecognition.audioend': ('audioEnd', 'Event'),
'SpeechRecognition.audiostart': ('audioStart', 'Event'),
'SpeechRecognition.end': ('end', 'Event'),
@@ -271,7 +272,8 @@
TYPE=event_type)
def EmitStreamGetters(self, interface, custom_events,
- members_emitter, library_name):
+ members_emitter, library_name, stream_getter_signatures_emitter=None,
+ element_stream_getters_emitter=None):
events = self._GetEvents(interface, custom_events)
if not events:
return
@@ -291,14 +293,33 @@
annotations = self._metadata.GetFormattedMetadata(
library_name, interface, annotation_name, ' ')
- members_emitter.Emit(
- "\n"
- " $(ANNOTATIONS)Stream<$TYPE> get $(NAME) => "
- "$PROVIDER.forTarget(this);\n",
- ANNOTATIONS=annotations,
- NAME=getter_name,
- PROVIDER=provider,
- TYPE=event_type)
+ isElement = False
+ for parent in self._database.Hierarchy(interface):
+ if parent.id == 'Element':
+ isElement = True
+ # We add the same event stream getters Element, ElementList, and
+ # _FrozenElementList. So, in impl_Element.darttemplate, we have two
+ # additional emitters to add the correct variation of the stream getter
+ # for that context.
+ for emitter in [members_emitter, stream_getter_signatures_emitter,
+ element_stream_getters_emitter]:
+ if emitter == None:
+ continue
+ elem_type = 'Element' if isElement else ''
+ call_name = 'forElement' if isElement else 'forTarget'
+ if emitter == element_stream_getters_emitter:
+ call_name = '_forElementList'
+ emitter.Emit(
+ "\n"
+ " $(ANNOTATIONS)$(ELEM_TYPE)Stream<$TYPE> get $(NAME)$BODY;\n",
+ ANNOTATIONS=annotations,
+ ELEM_TYPE=elem_type,
+ NAME=getter_name,
+ BODY = ('' if emitter == stream_getter_signatures_emitter else
+ ' => %s.%s(this)' % (((''
+ if emitter != element_stream_getters_emitter else 'Element.')
+ + provider), call_name)),
+ TYPE=event_type)
def _GetRawEvents(self, interface):
all_interfaces = ([ interface ] +
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index a8ca1a2..73e10c4 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -71,7 +71,6 @@
'DOMFileSystemSync', # Workers
'DatabaseSync', # Workers
'DataView', # Typed arrays
- 'DedicatedWorkerContext', # Workers
'DirectoryEntrySync', # Workers
'DirectoryReaderSync', # Workers
'EntrySync', # Workers
@@ -114,11 +113,9 @@
'SVGTRefElement',
'SVGVKernElement',
'SharedWorker', # Workers
- 'SharedWorkerContext', # Workers
'WebKitMediaSource',
'WebKitSourceBuffer',
'WebKitSourceBufferList',
- 'WorkerContext', # Workers
'WorkerLocation', # Workers
'WorkerNavigator', # Workers
]
@@ -148,8 +145,8 @@
'RTCPeerConnection.setLocalDescription',
'RTCPeerConnection.setRemoteDescription',
'StorageInfo.requestQuota',
- 'WorkerContext.webkitResolveLocalFileSystemURL',
- 'WorkerContext.webkitRequestFileSystem',
+ 'WorkerGlobalScope.webkitResolveLocalFileSystemURL',
+ 'WorkerGlobalScope.webkitRequestFileSystem',
])
# Members from the standard dom that should not be exposed publicly in dart:html
@@ -312,6 +309,7 @@
'WebKitCSSKeyframesRule.insertRule': 'appendRule',
'CSSStyleDeclaration.getPropertyValue': '_getPropertyValue',
'CSSStyleDeclaration.setProperty': '_setProperty',
+ 'CSSStyleDeclaration.var': '_var',
'DirectoryEntry.getDirectory': '_getDirectory',
'DirectoryEntry.getFile': '_getFile',
'Document.createCDATASection': 'createCDataSection',
@@ -328,7 +326,6 @@
'Window.webkitRequestFileSystem': '_requestFileSystem',
'Window.webkitResolveLocalFileSystemURL': 'resolveLocalFileSystemUrl',
'Element.querySelector': 'query',
- 'Element.webkitCreateShadowRoot': 'createShadowRoot',
'Element.webkitMatchesSelector' : 'matches',
'MutationObserver.observe': '_observe',
'Navigator.webkitGetUserMedia': '_getUserMedia',
@@ -350,6 +347,7 @@
'WebGLRenderingContext.texSubImage2D': '_texSubImageImage2D',
'WheelEvent.wheelDeltaX': '_wheelDeltaX',
'WheelEvent.wheelDeltaY': '_wheelDeltaY',
+ 'Window.createImageBitmap': '_createImageBitmap',
#'WorkerContext.webkitRequestFileSystem': '_requestFileSystem',
#'WorkerContext.webkitRequestFileSystemSync': '_requestFileSystemSync',
})
@@ -362,6 +360,8 @@
'CSS.supports(DOMString conditionText)': 'supportsCondition',
'CanvasRenderingContext2D.createPattern(HTMLImageElement image, '
'DOMString repetitionType)': 'createPatternFromImage',
+ 'CryptoOperation.process(ArrayBuffer data)': 'processByteBuffer',
+ 'CryptoOperation.process(ArrayBufferView data)': 'processTypedData',
'DataTransferItemList.add(File file)': 'addFile',
'DataTransferItemList.add(DOMString data, DOMString type)': 'addData',
'FormData.append(DOMString name, Blob value, DOMString filename)':
@@ -376,7 +376,7 @@
'RTCDataChannel.send(ArrayBufferView data)': 'sendTypedData',
'RTCDataChannel.send(Blob data)': 'sendBlob',
'RTCDataChannel.send(DOMString data)': 'sendString',
- 'SourceBuffer.appendBuffer(ArrayBufferView view)': 'appendBufferView',
+ 'SourceBuffer.appendBuffer(ArrayBufferView data)': 'appendBufferView',
'URL.createObjectURL(MediaSource source)':
'createObjectUrlFromSource',
'URL.createObjectURL(WebKitMediaSource source)':
@@ -502,12 +502,10 @@
'Document.get:documentURI',
'Document.get:embeds',
'Document.get:forms',
- 'Document.get:height',
'Document.get:inputEncoding',
'Document.get:links',
'Document.get:plugins',
'Document.get:scripts',
- 'Document.get:width',
'Document.get:xmlEncoding',
'Document.getElementsByTagNameNS',
'Document.getOverrideStyle',
@@ -564,6 +562,9 @@
'Element.set:outerHTML',
'Element.setAttributeNode',
'Element.setAttributeNodeNS',
+ 'Element.webkitCreateShadowRoot',
+ 'Element.webkitPseudo',
+ 'Element.webkitShadowRoot',
'Event.returnValue',
'Event.srcElement',
'EventSource.URL',
@@ -709,7 +710,7 @@
'ShadowRoot.getElementsByTagNameNS',
'SVGStyledElement.getPresentationAttribute',
'WheelEvent.wheelDelta',
- 'WorkerContext.webkitIndexedDB',
+ 'WorkerGlobalScope.webkitIndexedDB',
# TODO(jacobr): should these be removed?
'Document.close',
'Document.hasFocus',
@@ -721,7 +722,6 @@
'Database': 'web_sql',
'Navigator': 'html',
'Window': 'html',
- 'WorkerContext': 'html',
})
class HtmlRenamer(object):
diff --git a/tools/dom/scripts/idlparser.py b/tools/dom/scripts/idlparser.py
index 01a19c2..d0fa567 100755
--- a/tools/dom/scripts/idlparser.py
+++ b/tools/dom/scripts/idlparser.py
@@ -91,7 +91,7 @@
'{', _Definitions, '}', MAYBE(';')])
def CallbackDeclaration():
- return [Callback, Type, '=', Type,'(', ')', ';']
+ return [Callback, Type, '=', Type,'(', _Arguments, ')', ';']
def Callback():
return ['callback']
@@ -243,7 +243,7 @@
[MAYBE(ExtAttrs), MAYBE(Optional), MAYBE('in'),
MAYBE(Optional), Type, MAYBE(AnEllipsis), Id],
# WebKit:
- [MAYBE(ExtAttrs), MAYBE(Optional), Type, Id])
+ [MAYBE(ExtAttrs), MAYBE(Optional), Type, MAYBE(AnEllipsis), Id])
def Optional():
return 'optional'
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index fbb0ee9..b889489 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -48,6 +48,7 @@
'Console.warn',
'WebKitCSSKeyframesRule.insertRule',
'CSSStyleDeclaration.setProperty',
+ 'Element.createShadowRoot',
'Element.insertAdjacentElement',
'Element.insertAdjacentHTML',
'Element.insertAdjacentText',
@@ -569,6 +570,17 @@
MIXINS=mixins_str,
DOMNAME=self._interface.doc_js_name,
NATIVESPEC=native_spec)
+ stream_getter_signatures_emitter = None
+ element_stream_getters_emitter = None
+ if type(self._implementation_members_emitter) == tuple:
+ # We add event stream getters for both Element and ElementList, so in
+ # impl_Element.darttemplate, we have two additional "holes" for emitters
+ # to fill in, with small variations. These store these specialized
+ # emitters.
+ stream_getter_signatures_emitter = self._implementation_members_emitter[0]
+ element_stream_getters_emitter = self._implementation_members_emitter[1]
+ self._implementation_members_emitter = \
+ self._implementation_members_emitter[2]
self._backend.StartInterface(self._implementation_members_emitter)
self._backend.EmitHelpers(base_class)
@@ -593,7 +605,8 @@
self._interface,
[],
self._implementation_members_emitter,
- self._library_name)
+ self._library_name, stream_getter_signatures_emitter,
+ element_stream_getters_emitter)
self._backend.FinishInterface()
def _ImplementationEmitter(self):
diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py
index 91dd180..0bf38cd 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -13,7 +13,9 @@
from idlnode import IDLArgument, IDLAttribute
from systemhtml import js_support_checks, GetCallbackInfo, HTML_LIBRARY_NAMES
-_cpp_type_map = {
+# TODO(vsm): This logic needs to pulled from the source IDL. These tables are
+# an ugly workaround.
+_cpp_callback_map = {
('DataTransferItem', 'webkitGetAsEntry'): 'DataTransferItemFileSystem',
('Document', 'webkitIsFullScreen'): 'DocumentFullscreen',
('Document', 'webkitFullScreenKeyboardInputAllowed'): 'DocumentFullscreen',
@@ -22,15 +24,19 @@
('Document', 'webkitFullscreenEnabled'): 'DocumentFullscreen',
('Document', 'webkitFullscreenElement'): 'DocumentFullscreen',
('Document', 'webkitExitFullscreen'): 'DocumentFullscreen',
- ('Window', 'crypto'): 'DOMWindowCrypto',
- ('Window', 'indexedDB'): 'DOMWindowIndexedDatabase',
- ('Window', 'speechSynthesis'): 'DOMWindowSpeechSynthesis',
- ('Window', 'webkitNotifications'): 'DOMWindowNotifications',
- ('Window', 'storage'): 'DOMWindowQuota',
- ('Window', 'webkitStorageInfo'): 'DOMWindowQuota',
- ('Window', 'openDatabase'): 'DOMWindowWebDatabase',
- ('Window', 'webkitRequestFileSystem'): 'DOMWindowFileSystem',
- ('Window', 'webkitResolveLocalFileSystemURL'): 'DOMWindowFileSystem',
+ ('DOMWindow', 'crypto'): 'DOMWindowCrypto',
+ ('DOMWindow', 'indexedDB'): 'DOMWindowIndexedDatabase',
+ ('DOMWindow', 'speechSynthesis'): 'DOMWindowSpeechSynthesis',
+ ('DOMWindow', 'webkitNotifications'): 'DOMWindowNotifications',
+ ('DOMWindow', 'storage'): 'DOMWindowQuota',
+ ('DOMWindow', 'webkitStorageInfo'): 'DOMWindowQuota',
+ ('DOMWindow', 'openDatabase'): 'DOMWindowWebDatabase',
+ ('DOMWindow', 'webkitRequestFileSystem'): 'DOMWindowFileSystem',
+ ('DOMWindow', 'webkitResolveLocalFileSystemURL'): 'DOMWindowFileSystem',
+ ('DOMWindow', 'atob'): 'DOMWindowBase64',
+ ('DOMWindow', 'btoa'): 'DOMWindowBase64',
+ ('DOMWindow', 'clearTimeout'): 'DOMWindowTimers',
+ ('DOMWindow', 'clearInterval'): 'DOMWindowTimers',
('HTMLInputElement', 'webkitEntries'): 'HTMLInputElementFileSystem',
('Navigator', 'doNotTrack'): 'NavigatorDoNotTrack',
('Navigator', 'geolocation'): 'NavigatorGeolocation',
@@ -42,29 +48,60 @@
('Navigator', 'webkitGetGamepads'): 'NavigatorGamepad',
('Navigator', 'requestMIDIAccess'): 'NavigatorWebMIDI',
('Navigator', 'vibrate'): 'NavigatorVibration',
+ ('WorkerGlobalScope', 'crypto'): 'WorkerGlobalScopeCrypto',
+ ('WorkerGlobalScope', 'indexedDB'): 'WorkerGlobalScopeIndexedDatabase',
+ ('WorkerGlobalScope', 'webkitNotifications'): 'WorkerGlobalScopeNotifications',
+ ('WorkerGlobalScope', 'openDatabase'): 'WorkerGlobalScopeWebDatabase',
+ ('WorkerGlobalScope', 'openDatabaseSync'): 'WorkerGlobalScopeWebDatabase',
+ ('WorkerGlobalScope', 'performance'): 'WorkerGlobalScopePerformance',
+ ('WorkerGlobalScope', 'webkitRequestFileSystem'): 'WorkerGlobalScopeFileSystem',
+ ('WorkerGlobalScope', 'webkitRequestFileSystemSync'): 'WorkerGlobalScopeFileSystem',
+ ('WorkerGlobalScope', 'webkitResolveLocalFileSystemURL'): 'WorkerGlobalScopeFileSystem',
+ ('WorkerGlobalScope', 'webkitResolveLocalFileSystemSyncURL'): 'WorkerGlobalScopeFileSystem',
+ ('WorkerGlobalScope', 'atob'): 'DOMWindowBase64',
+ ('WorkerGlobalScope', 'btoa'): 'DOMWindowBase64',
+ ('WorkerGlobalScope', 'clearTimeout'): 'DOMWindowTimers',
+ ('WorkerGlobalScope', 'clearInterval'): 'DOMWindowTimers',
}
+_cpp_overloaded_callback_map = {
+ ('DOMURL', 'createObjectUrlFromSourceCallback'): 'URLMediaSource',
+ ('DOMURL', 'createObjectUrlFromStreamCallback'): 'URLMediaStream',
+ ('DOMURL', '_createObjectUrlFromWebKitSourceCallback'): 'URLMediaSource',
+ ('DOMURL', '_createObjectURL_2Callback'): 'URLMediaSource',
+ ('DOMURL', '_createObjectURL_3Callback'): 'URLMediaSource',
+ ('DOMURL', '_createObjectURL_4Callback'): 'URLMediaStream',
+}
+
_cpp_partial_map = {}
-def _GetCPPPartialNames(interface_name):
+def _GetCPPPartialNames(interface):
+ interface_name = interface.ext_attrs.get('ImplementedAs', interface.id)
if not _cpp_partial_map:
- for (type, member) in _cpp_type_map.keys():
+ 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_type_map[(type, member)])
+ _cpp_partial_map[type].add(_cpp_callback_map[(type, member)])
+
+ for (type, member) in _cpp_overloaded_callback_map.keys():
+ if type not in _cpp_partial_map:
+ _cpp_partial_map[type] = set([])
+ _cpp_partial_map[type].add(_cpp_overloaded_callback_map[(type, member)])
if interface_name in _cpp_partial_map:
return _cpp_partial_map[interface_name]
else:
return set([])
-def _GetCPPTypeName(interface_name, callback_name):
+def _GetCPPTypeName(interface_name, callback_name, cpp_name):
# TODO(vsm): We need to track the original IDL file name in order to recover
# the proper CPP name.
cpp_tuple = (interface_name, callback_name)
- if cpp_tuple in _cpp_type_map:
- cpp_type_name = _cpp_type_map[cpp_tuple]
+ if cpp_tuple in _cpp_callback_map:
+ cpp_type_name = _cpp_callback_map[cpp_tuple]
+ elif (interface_name, cpp_name) in _cpp_overloaded_callback_map:
+ cpp_type_name = _cpp_overloaded_callback_map[(interface_name, cpp_name)]
else:
cpp_type_name = interface_name
return cpp_type_name
@@ -97,7 +134,7 @@
return
cpp_impl_includes = set(['"' + partial + '.h"'
- for partial in _GetCPPPartialNames(self._interface.id)])
+ for partial in _GetCPPPartialNames(self._interface)])
cpp_header_handlers_emitter = emitter.Emitter()
cpp_impl_handlers_emitter = emitter.Emitter()
class_name = 'Dart%s' % self._interface.id
@@ -187,7 +224,7 @@
self._members_emitter = members_emitter
self._cpp_declarations_emitter = emitter.Emitter()
self._cpp_impl_includes = set(['"' + partial + '.h"'
- for partial in _GetCPPPartialNames(self._interface.id)])
+ for partial in _GetCPPPartialNames(self._interface)])
self._cpp_definitions_emitter = emitter.Emitter()
self._cpp_resolver_emitter = emitter.Emitter()
@@ -412,8 +449,6 @@
webcore_function_name = 'css'
else:
webcore_function_name = self._ToWebKitName(attr.id)
- if attr.type.id.startswith('SVGAnimated'):
- webcore_function_name += 'Animated'
function_expression = self._GenerateWebCoreFunctionExpression(webcore_function_name, attr)
self._GenerateNativeCallback(
@@ -442,8 +477,6 @@
lambda s: s.group(1).upper(),
attr.id)
webcore_function_name = 'set%s' % webcore_function_name
- if attr.type.id.startswith('SVGAnimated'):
- webcore_function_name += 'Animated'
function_expression = self._GenerateWebCoreFunctionExpression(webcore_function_name, attr)
self._GenerateNativeCallback(
@@ -614,7 +647,7 @@
def _GenerateOperationNativeCallback(self, operation, arguments, cpp_callback_name):
webcore_function_name = operation.ext_attrs.get('ImplementedAs', operation.id)
- function_expression = self._GenerateWebCoreFunctionExpression(webcore_function_name, operation)
+ function_expression = self._GenerateWebCoreFunctionExpression(webcore_function_name, operation, cpp_callback_name)
self._GenerateNativeCallback(
cpp_callback_name,
not operation.is_static,
@@ -634,6 +667,7 @@
return_type,
return_type_is_nullable,
raises_dom_exception):
+
ext_attrs = node.ext_attrs
cpp_arguments = []
@@ -642,7 +676,9 @@
# TODO(antonm): unify with ScriptState below.
requires_stack_info = (ext_attrs.get('CallWith') == 'ScriptArguments|ScriptState' or
- ext_attrs.get('ConstructorCallWith') == 'ScriptArguments|ScriptState')
+ ext_attrs.get('ConstructorCallWith') == 'ScriptArguments|ScriptState' or
+ ext_attrs.get('CallWith') == 'ScriptArguments&ScriptState' or
+ ext_attrs.get('ConstructorCallWith') == 'ScriptArguments&ScriptState')
if requires_stack_info:
raises_exceptions = True
cpp_arguments = ['&state', 'scriptArguments.release()']
@@ -717,7 +753,6 @@
'\n'
'static void $CALLBACK_NAME(Dart_NativeArguments args)\n'
'{\n'
- ' DartApiScope dartApiScope;\n'
'$!BODY'
'}\n',
CALLBACK_NAME=callback_name)
@@ -817,7 +852,9 @@
type_info.to_native_info(argument, self._interface.id)
def AllowsNull():
- assert argument.ext_attrs.get('TreatNullAs', 'NullString') == 'NullString'
+ # TODO(vsm): HTMLSelectElement's indexed setter treats a null as a remove.
+ # We need to handle that.
+ # assert argument.ext_attrs.get('TreatNullAs', 'NullString') == 'NullString'
if argument.ext_attrs.get('TreatNullAs') == 'NullString':
return True
@@ -869,29 +906,23 @@
invocation_emitter = body_emitter
if raises_dom_exception:
- cpp_arguments.append('ec')
+ cpp_arguments.append('es')
invocation_emitter = body_emitter.Emit(
- ' ExceptionCode ec = 0;\n'
+ ' DartExceptionState es;\n'
'$!INVOCATION'
- ' if (UNLIKELY(ec)) {\n'
- ' exception = DartDOMWrapper::exceptionCodeToDartException(ec);\n'
+ ' if (es.hadException()) {\n'
+ ' exception = DartDOMWrapper::exceptionCodeToDartException(es);\n'
' goto fail;\n'
' }\n')
if needs_receiver:
interface_name = self._interface_type_info.native_type()
- cpp_type_name = _GetCPPTypeName(interface_name,
- node.id)
- # Hack to determine if this came from the _cpp_type_map.
+ # Hack to determine if this came from the _cpp_callback_map.
# In this case, the getter is mapped to a static method.
if (not function_expression.startswith('receiver->') and
not function_expression.startswith(interface_name + '::')):
- if 'childNodes' in callback_name:
- print function_expression
- print interface_name
- raise 'hell'
- if interface_name == 'DOMWindow' or interface_name == 'Navigator':
+ if interface_name == 'DOMWindow' or interface_name == 'Navigator' or interface_name == 'WorkerGlobalScope':
cpp_arguments.insert(0, 'receiver')
else:
cpp_arguments.append('receiver')
@@ -978,17 +1009,17 @@
attribute_name = attr.ext_attrs['Reflect'] or attr.id.lower()
return 'WebCore::%s::%sAttr' % (namespace, attribute_name)
- def _GenerateWebCoreFunctionExpression(self, function_name, idl_node):
+ def _GenerateWebCoreFunctionExpression(self, function_name, idl_node, cpp_callback_name=None):
if 'ImplementedBy' in idl_node.ext_attrs:
return '%s::%s' % (idl_node.ext_attrs['ImplementedBy'], function_name)
+ cpp_type_name = self._interface_type_info.native_type()
+ impl_type_name = _GetCPPTypeName(cpp_type_name, function_name, cpp_callback_name)
if idl_node.is_static:
- return '%s::%s' % (self._interface_type_info.native_type(), function_name)
- interface_name = self._interface_type_info.idl_type()
- cpp_type_name = _GetCPPTypeName(interface_name, function_name)
- if cpp_type_name == interface_name:
+ return '%s::%s' % (impl_type_name, function_name)
+ if cpp_type_name == impl_type_name:
return '%s%s' % (self._interface_type_info.receiver(), function_name)
else:
- return '%s::%s' % (cpp_type_name, function_name)
+ return '%s::%s' % (impl_type_name, function_name)
def _IsArgumentOptionalInWebCore(self, operation, argument):
if not IsOptional(argument):
diff --git a/tools/dom/src/EventStreamProvider.dart b/tools/dom/src/EventStreamProvider.dart
index 8e3b0bc..a4ad4c0f 100644
--- a/tools/dom/src/EventStreamProvider.dart
+++ b/tools/dom/src/EventStreamProvider.dart
@@ -30,6 +30,123 @@
}
}
+/** A specialized Stream available to [Element]s to enable event delegation. */
+abstract class ElementStream<T extends Event> implements Stream<T> {
+ /**
+ * Return a stream that only fires when the particular event fires for
+ * elements matching the specified CSS selector.
+ *
+ * This is the Dart equivalent to jQuery's
+ * [delegate](http://api.jquery.com/delegate/).
+ */
+ Stream<T> matches(String selector);
+}
+
+/**
+ * Adapter for exposing DOM Element events as streams, while also allowing
+ * event delegation.
+ */
+class _ElementEventStreamImpl<T extends Event> extends _EventStream<T>
+ implements ElementStream<T> {
+ _ElementEventStreamImpl(target, eventType, useCapture) :
+ super(target, eventType, useCapture);
+
+ Stream<T> matches(String selector) =>
+ this.where((event) => event.target.matches(selector, true));
+}
+
+/**
+ * Adapter for exposing events on a collection of DOM Elements as streams,
+ * while also allowing event delegation.
+ */
+class _ElementListEventStreamImpl<T extends Event> extends Stream<T>
+ implements ElementStream<T> {
+ final _StreamPool _pool;
+ Stream<T> _stream;
+
+ _ElementListEventStreamImpl(targetList, eventType, useCapture) :
+ _pool = new _StreamPool.broadcast() {
+ for (Element target in targetList) {
+ var stream = new _EventStream(target, eventType, useCapture);
+ _pool.add(stream);
+ }
+ _stream = _pool.stream;
+ }
+
+ Stream<T> matches(String selector) =>
+ this.where((event) => event.target.matches(selector, true));
+
+ // Delegate all regular Stream behavor to our wrapped Stream.
+ StreamSubscription<T> listen(void onData(T event),
+ { void onError(error),
+ void onDone(),
+ bool cancelOnError}) =>
+ _stream.listen(onData, onError: onError, onDone: onDone,
+ cancelOnError: cancelOnError);
+ Stream<T> asBroadcastStream({void onListen(StreamSubscription subscription),
+ void onCancel(StreamSubscription subscription)})
+ => _stream;
+ bool get isBroadcast => true;
+}
+
+/**
+ * A pool of streams whose events are unified and emitted through a central
+ * stream.
+ */
+// TODO (efortuna): Remove this when Issue 12218 is addressed.
+class _StreamPool<T> {
+ StreamController<T> _controller;
+
+ /// Subscriptions to the streams that make up the pool.
+ var _subscriptions = new Map<Stream<T>, StreamSubscription<T>>();
+
+ /**
+ * Creates a new stream pool where [stream] can be listened to more than
+ * once.
+ *
+ * Any events from buffered streams in the pool will be emitted immediately,
+ * regardless of whether [stream] has any subscribers.
+ */
+ _StreamPool.broadcast() {
+ _controller = new StreamController<T>.broadcast(sync: true,
+ onCancel: close);
+ }
+
+ /**
+ * The stream through which all events from streams in the pool are emitted.
+ */
+ Stream<T> get stream => _controller.stream;
+
+ /**
+ * Adds [stream] as a member of this pool.
+ *
+ * Any events from [stream] will be emitted through [this.stream]. If
+ * [stream] is sync, they'll be emitted synchronously; if [stream] is async,
+ * they'll be emitted asynchronously.
+ */
+ void add(Stream<T> stream) {
+ if (_subscriptions.containsKey(stream)) return;
+ _subscriptions[stream] = stream.listen(_controller.add,
+ onError: _controller.addError,
+ onDone: () => remove(stream));
+ }
+
+ /** Removes [stream] as a member of this pool. */
+ void remove(Stream<T> stream) {
+ var subscription = _subscriptions.remove(stream);
+ if (subscription != null) subscription.cancel();
+ }
+
+ /** Removes all streams from this pool and closes [stream]. */
+ void close() {
+ for (var subscription in _subscriptions.values) {
+ subscription.cancel();
+ }
+ _subscriptions.clear();
+ _controller.close();
+ }
+}
+
class _EventStreamSubscription<T extends Event> extends StreamSubscription<T> {
int _pauseCount = 0;
EventTarget _target;
@@ -107,7 +224,6 @@
}
}
-
/**
* A factory to expose DOM events as Streams.
*/
@@ -134,8 +250,43 @@
*
* [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
*/
- Stream<T> forTarget(EventTarget e, {bool useCapture: false}) {
- return new _EventStream(e, _eventType, useCapture);
+ Stream<T> forTarget(EventTarget e, {bool useCapture: false}) =>
+ new _EventStream(e, _eventType, useCapture);
+
+ /**
+ * Gets an [ElementEventStream] for this event type, on the specified element.
+ *
+ * This will always return a broadcast stream so multiple listeners can be
+ * used simultaneously.
+ *
+ * This may be used to capture DOM events:
+ *
+ * Element.keyDownEvent.forElement(element, useCapture: true).listen(...);
+ *
+ * See also:
+ *
+ * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
+ */
+ ElementStream<T> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventType, useCapture);
+ }
+
+ /**
+ * Gets an [ElementEventStream] for this event type, on the list of elements.
+ *
+ * This will always return a broadcast stream so multiple listeners can be
+ * used simultaneously.
+ *
+ * This may be used to capture DOM events:
+ *
+ * Element.keyDownEvent._forElementList(element, useCapture: true).listen(...);
+ *
+ * See also:
+ *
+ * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
+ */
+ ElementStream<T> _forElementList(ElementList e, {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventType, useCapture);
}
/**
@@ -164,6 +315,15 @@
return new _EventStream(e, _eventTypeGetter(e), useCapture);
}
+ ElementStream<T> forElement(Element e, {bool useCapture: false}) {
+ return new _ElementEventStreamImpl(e, _eventTypeGetter(e), useCapture);
+ }
+
+ ElementStream<T> _forElementList(ElementList e,
+ {bool useCapture: false}) {
+ return new _ElementListEventStreamImpl(e, _eventTypeGetter(e), useCapture);
+ }
+
String getEventType(EventTarget target) {
return _eventTypeGetter(target);
}
diff --git a/tools/dom/templates/html/impl/impl_AbstractWorker.darttemplate b/tools/dom/templates/html/impl/impl_AbstractWorker.darttemplate
new file mode 100644
index 0000000..2349ce5
--- /dev/null
+++ b/tools/dom/templates/html/impl/impl_AbstractWorker.darttemplate
@@ -0,0 +1,9 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of $LIBRARYNAME;
+
+@DocsEditable()
+$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$MIXINS implements EventTarget$NATIVESPEC {
+$!MEMBERS}
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 8cfb668..e708395 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -244,6 +244,7 @@
*/
@Experimental()
CssRect get marginEdge;
+$!STREAM_GETTER_SIGNATURES
}
// TODO(jacobr): this is an inefficient implementation but it is hard to see
@@ -297,6 +298,7 @@
CssRect get borderEdge => _elementList.first.borderEdge;
CssRect get marginEdge => _elementList.first.marginEdge;
+$!ELEMENT_STREAM_GETTERS
}
/**
@@ -875,19 +877,31 @@
/**
* Checks if this element matches the CSS selectors.
+ *
+ * If `includeAncestors` is true, we examine all of this element's parent
+ * elements and also return true if any of its parent elements matches
+ * `selectors`.
*/
@Experimental()
- bool matches(String selectors) {
- if (JS('bool', '!!#.matches', this)) {
- return JS('bool', '#.matches(#)', this, selectors);
- } else if (JS('bool', '!!#.webkitMatchesSelector', this)) {
- return JS('bool', '#.webkitMatchesSelector(#)', this, selectors);
- } else if (JS('bool', '!!#.mozMatchesSelector', this)) {
- return JS('bool', '#.mozMatchesSelector(#)', this, selectors);
- } else if (JS('bool', '!!#.msMatchesSelector', this)) {
- return JS('bool', '#.msMatchesSelector(#)', this, selectors);
- }
- throw new UnsupportedError("Not supported on this platform");
+ bool matches(String selectors, [includeAncestors = false]) {
+ var elem = this;
+ do {
+ bool matches = false;
+ if (JS('bool', '!!#.matches', elem)) {
+ matches = JS('bool', '#.matches(#)', elem, selectors);
+ } else if (JS('bool', '!!#.webkitMatchesSelector', elem)) {
+ matches = JS('bool', '#.webkitMatchesSelector(#)', elem, selectors);
+ } else if (JS('bool', '!!#.mozMatchesSelector', elem)) {
+ matches = JS('bool', '#.mozMatchesSelector(#)', elem, selectors);
+ } else if (JS('bool', '!!#.msMatchesSelector', elem)) {
+ matches = JS('bool', '#.msMatchesSelector(#)', elem, selectors);
+ } else {
+ throw new UnsupportedError("Not supported on this platform");
+ }
+ if (matches) return true;
+ elem = elem.parent;
+ } while(includeAncestors && elem != null);
+ return false;
}
$else
$endif
@@ -905,6 +919,17 @@
bool _templateIsDecorated;
+$if DART2JS
+ @DomName('Element.createShadowRoot')
+ @SupportedBrowser(SupportedBrowser.CHROME, '25')
+ @Experimental()
+ ShadowRoot createShadowRoot() {
+ return JS('ShadowRoot',
+ '(#.createShadowRoot || #.webkitCreateShadowRoot).call(#)',
+ this, this, this);
+ }
+$endif
+
/**
* Gets the template this node refers to.
@@ -1148,7 +1173,6 @@
$!MEMBERS
}
-
final _START_TAG_REGEXP = new RegExp('<(\\w+)');
class _ElementFactoryProvider {
static const _CUSTOM_PARENT_TAG_MAP = const {
diff --git a/tools/dom/templates/html/impl/impl_WebGLRenderingContext.darttemplate b/tools/dom/templates/html/impl/impl_WebGLRenderingContext.darttemplate
index 893d9df..3b233f3 100644
--- a/tools/dom/templates/html/impl/impl_WebGLRenderingContext.darttemplate
+++ b/tools/dom/templates/html/impl/impl_WebGLRenderingContext.darttemplate
@@ -24,8 +24,19 @@
$else
void texImage2D(int targetTexture, int levelOfDetail, int internalFormat,
int format, int type, data) {
- _texImage2D(targetTexture, levelOfDetail, internalFormat,
- format, type, data);
+ if (data is ImageElement) {
+ texImage2DImage(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ } else if (data is ImageData) {
+ texImage2DImageData(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ } else if (data is CanvasElement) {
+ texImage2DCanvas(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ } else {
+ texImage2DVideo(targetTexture, levelOfDetail, internalFormat, format,
+ type, data);
+ }
}
$endif
diff --git a/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate b/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
index 492fcc9..4a6a45e 100644
--- a/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
+++ b/tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate
@@ -52,6 +52,40 @@
}
/**
+ * Makes a server POST request with the specified data encoded as form data.
+ *
+ * This is similar to sending a FormData object with broader browser
+ * support but limited to string values.
+ *
+ * See also:
+ *
+ * * [request]
+ */
+ static Future<HttpRequest> postFormData(String url, Map<String, String> data,
+ {bool withCredentials, String responseType,
+ Map<String, String> requestHeaders,
+ void onProgress(ProgressEvent e)}) {
+
+ var parts = [];
+ data.forEach((key, value) {
+ parts.add('${Uri.encodeQueryComponent(key)}='
+ '${Uri.encodeQueryComponent(value)}');
+ });
+ var formData = parts.join('&');
+
+ if (requestHeaders == null) {
+ requestHeaders = <String, String>{};
+ }
+ requestHeaders.putIfAbsent('Content-Type',
+ () => 'application/x-www-form-urlencoded; charset=UTF-8');
+
+ return request(url, method: 'POST', withCredentials: withCredentials,
+ responseType: responseType,
+ requestHeaders: requestHeaders, sendData: formData,
+ onProgress: onProgress);
+ }
+
+ /**
* Creates a URL request for the specified [url].
*
* By default this will do an HTTP GET request, this can be overridden with
diff --git a/tools/print_version.py b/tools/print_version.py
index 65e700d..13cbf75 100755
--- a/tools/print_version.py
+++ b/tools/print_version.py
@@ -13,8 +13,12 @@
import sys
import utils
-def Main(argv):
- print(utils.GetVersion())
+def Main():
+ version = utils.GetVersion()
+ if not version:
+ print 'Error: Couldn\'t determine version string.'
+ return 1
+ print version
if __name__ == '__main__':
- sys.exit(Main(sys.argv))
+ sys.exit(Main())
diff --git a/tools/release/version.dart b/tools/release/version.dart
deleted file mode 100644
index cec7a3f..0000000
--- a/tools/release/version.dart
+++ /dev/null
@@ -1,237 +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 file contains functionality for getting dart version numbers using
- * our standard version construction method. Systems that does not include this
- * file should emulate the structure for revision numbers that we have here.
- *
- * The version number of a dart build is constructed as follows:
- * 1. The major, minor, build and patch numbers are extracted from the VERSION
- * file in the root directory. We call these MAJOR, MINOR, BUILD and PATCH.
- * 2. The svn revision number for the current checkout is extracted from the
- * source control system that is used in the current checkout. We call this
- * REVISION.
- * 3. If this is _not_ a official build, i.e., this is not build by our
- * buildbot infrastructure, we extract the user-name of the logged in
- * person from the operating system. We call this USERNAME.
- * 4. The version number is constructed as follows:
- * MAJOR.MINOR.BUILD.PATCH_rREVISION_USERNAME
- */
-
-library version;
-
-import "dart:async";
-import "dart:io";
-
-/**
- * Generates version information for builds.
- */
-class Version {
- String _versionFileName;
- String USERNAME;
- int REVISION;
- int MAJOR;
- int MINOR;
- int BUILD;
- int PATCH;
-
- Version(Path versionFile) {
- _versionFileName = versionFile.toNativePath();
- }
-
- /**
- * Get the version number for this specific build using the version info
- * from the VERSION file in the root directory and the revision info
- * from the source control system of the current checkout.
- */
- Future<String> getVersion() {
- File f = new File(_versionFileName);
- Completer c = new Completer();
-
- var wasCompletedWithError = false;
- completeError(String msg) {
- if (!wasCompletedWithError) {
- c.completeError(msg);
- wasCompletedWithError = true;
- }
- }
- f.exists().then((existed) {
- if (!existed) {
- completeError("No VERSION file");
- return;
- }
- Stream<String> stream =
- f.openRead().transform(new StringDecoder())
- .transform(new LineTransformer());
- stream.listen((String line) {
- if (line == null) {
- completeError(
- "VERSION input file seems to be in the wrong format");
- return;
- }
- var values = line.split(" ");
- if (values.length != 2) {
- completeError(
- "VERSION input file seems to be in the wrong format");
- return;
- }
- var number = 0;
- try {
- number = int.parse(values[1]);
- } catch (e) {
- completeError("Can't parse version numbers, not an int");
- return;
- }
- switch (values[0]) {
- case "MAJOR":
- MAJOR = number;
- break;
- case "MINOR":
- MINOR = number;
- break;
- case "BUILD":
- BUILD = number;
- break;
- case "PATCH":
- PATCH = number;
- break;
- default:
- completeError("Wrong format in VERSION file, line does not "
- "contain one of {MAJOR, MINOR, BUILD, PATCH}");
- return;
- }
- },
- onDone: () {
- // Only complete if we did not already complete with a failure.
- if (!wasCompletedWithError) {
- getRevision().then((revision) {
- REVISION = revision;
- USERNAME = getUserName();
- var userNameString = "";
- if (USERNAME != '') userNameString = "_$USERNAME";
- var revisionString = "";
- if (revision != 0) revisionString = "_r$revision";
- c.complete(
- "$MAJOR.$MINOR.$BUILD.$PATCH$revisionString$userNameString");
- return;
- });
- }
- });
- });
- return c.future;
- }
-
- String getExecutableSuffix() {
- if (Platform.operatingSystem == 'windows') {
- return '.bat';
- }
- return '';
- }
-
- int getRevisionFromSvnInfo(String info) {
- if (info == null || info == '') return 0;
- var lines = info.split("\n");
- RegExp exp = new RegExp(r"Last Changed Rev: (\d*)");
- for (var line in lines) {
- if (exp.hasMatch(line)) {
- String revisionString = (exp.firstMatch(line).group(1));
- try {
- return int.parse(revisionString);
- } catch(e) {
- return 0;
- }
- }
- }
- return 0;
- }
-
- Future<int> getRevision() {
- if (repositoryType == RepositoryType.UNKNOWN) {
- return new Future.value(0);
- }
- var isSvn = repositoryType == RepositoryType.SVN;
- var command = isSvn ? "svn" : "git";
- command = "$command${getExecutableSuffix()}";
- var arguments = isSvn ? ["info"] : ["svn", "info"];
- // Run the command from the root to get the last changed revision for this
- // "branch". Since we have both trunk and bleeding edge in the same
- // repository and since we always build TOT we need this to get the
- // right version number.
- Path toolsDirectory = new Path(_versionFileName).directoryPath;
- Path root = toolsDirectory.join(new Path(".."));
- var workingDirectory = root.toNativePath();
- return Process.run(command,
- arguments,
- workingDirectory: workingDirectory).then((result) {
- if (result.exitCode != 0) {
- return 0;
- }
- return getRevisionFromSvnInfo(result.stdout);
- });
- }
-
- bool isProductionBuild(String username) {
- return username == "chrome-bot";
- }
-
- String getUserName() {
- // TODO(ricow): Don't add this on the buildbot.
- var key = "USER";
- if (Platform.operatingSystem == 'windows') {
- key = "USERNAME";
- }
- if (!Platform.environment.containsKey(key)) return "";
- var username = Platform.environment[key];
- // If this is a production build, i.e., this is something we are shipping,
- // don't suffix the version with the username.
- if (isProductionBuild(username)) return "";
- return username;
- }
-
- RepositoryType get repositoryType {
- bool isWindows = Platform.operatingSystem == 'windows';
- bool hasDirectory(path, name) {
- return new Directory.fromPath(path.append(name)).existsSync();
- }
- bool isFileSystemRoot(absolutePath) {
- if (isWindows) {
- return "${absolutePath.directoryPath}" == '/';
- }
- return "$absolutePath" == '/';
- }
-
- var currentPath = new Path(Directory.current.path);
- while (true) {
- if (hasDirectory(currentPath, '.svn')) {
- return RepositoryType.SVN;
- } else if (hasDirectory(currentPath, '.git')) {
- return RepositoryType.GIT;
- }
- if (isFileSystemRoot(currentPath)) {
- break;
- }
- currentPath = currentPath.directoryPath;
- }
- return RepositoryType.UNKNOWN;
- }
-}
-
-class RepositoryType {
- static final RepositoryType SVN = const RepositoryType("SVN");
- static final RepositoryType GIT = const RepositoryType("GIT");
- static final RepositoryType UNKNOWN = const RepositoryType("UNKNOWN");
-
- const RepositoryType(String this.name);
-
- static RepositoryType guessType() {
- if (new Directory(".svn").existsSync()) return RepositoryType.SVN;
- if (new Directory(".git").existsSync()) return RepositoryType.GIT;
- return RepositoryType.UNKNOWN;
- }
-
- String toString() => name;
-
- final String name;
-}
diff --git a/tools/test.dart b/tools/test.dart
index cd43215..3147a36 100755
--- a/tools/test.dart
+++ b/tools/test.dart
@@ -102,18 +102,6 @@
exit(1);
}
- var testCaseRecorder;
- if (recordingPath != null) {
- testCaseRecorder = new TestCaseRecorder(new Path(recordingPath));
- }
-
- var testCaseOutputArchive;
- if (recordingOutputPath != null) {
- testCaseOutputArchive = new TestCaseOutputArchive();
- testCaseOutputArchive.loadFromPath(new Path(recordingOutputPath));
- }
-
-
if (!firstConf['append_logs']) {
var file = new File(TestUtils.flakyFileName());
if (file.existsSync()) {
@@ -159,6 +147,12 @@
conf['runtime']);
serverFutures.add(servers.startServers(conf['local_ip']));
conf['_servers_'] = servers;
+ if (verbose) {
+ serverFutures.last.then((_) {
+ var commandline = servers.httpServerCommandline();
+ print('Started HttpServers: $commandline');
+ });
+ }
}
// There should not be more than one InternetExplorerDriver instance
@@ -242,8 +236,10 @@
eventListener.add(new ExitCodeSetter());
void startProcessQueue() {
- // Start process queue.
- new ProcessQueue(maxProcesses,
+ // [firstConf] is needed here, since the ProcessQueue needs to know the
+ // settings of 'noBatch' and 'local_ip'
+ new ProcessQueue(firstConf,
+ maxProcesses,
maxBrowserProcesses,
startTime,
testSuites,
@@ -251,8 +247,8 @@
allTestsFinished,
verbose,
listTests,
- testCaseRecorder,
- testCaseOutputArchive);
+ recordingPath,
+ recordingOutputPath);
}
// Start all the HTTP servers required before starting the process queue.
diff --git a/tools/testing/dart/dependency_graph.dart b/tools/testing/dart/dependency_graph.dart
new file mode 100644
index 0000000..1de7b9e
--- /dev/null
+++ b/tools/testing/dart/dependency_graph.dart
@@ -0,0 +1,147 @@
+// 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 dependency_graph;
+
+import 'dart:async';
+import 'utils.dart';
+
+
+/*
+ * [Graph] represents a datastructure for representing an DAG (directed acyclic
+ * graph). Each node in the graph is in a given [NodeState] and can have data
+ * attachted to it with [Node.userData].
+ *
+ * It's interface consists basically of these methods:
+ * - newNode: Adds a new node to the graph with the given dependencies and
+ * the given user data. The node is in the [NodeState.Initialized]
+ * state.
+ * - changeState: Changes the state of a node.
+ * - sealGraph: Makes the graph immutable.
+ * - stateCount: Counts the number of nodes who are in a given [NodeState].
+ *
+ * Users of a [Graph] can listen for events by subscribing to the [events]
+ * stream. Three types of events will be fired (after the graph was modified):
+ * - NodeAddedEvent: Fired after a node was added ot the graph.
+ * - StateChangedEvent: Fired after the state of a node changed.
+ * - GraphSealedEvent: Fired after the graph was marked as immutable/sealed.
+ */
+class Graph {
+ final _nodes = new Set<Node>();
+ final _eventController = new StreamController<GraphEvent>();
+ final _stateCounts = new Map<NodeState, int>();
+ var _eventStream;
+ bool _isSealed = false;
+
+ Graph() {
+ _eventStream = _eventController.stream.asBroadcastStream();
+ }
+
+ Iterable<Node> get nodes => _nodes;
+ Stream<GraphEvent> get events => _eventStream;
+ bool get isSealed => _isSealed;
+
+ int stateCount(NodeState state) {
+ int count = _stateCounts[state];
+ return count == null ? 0 : count;
+ }
+
+ void DumpCounts() {
+ for (var state in _stateCounts.keys) {
+ print("Count[$state] = ${_stateCounts[state]}");
+ }
+ }
+
+ void sealGraph() {
+ assert(!_isSealed);
+ _isSealed = true;
+ _emitEvent(new GraphSealedEvent());
+ }
+
+ Node newNode(Object userData, Iterable<Node> dependencies) {
+ assert(!_isSealed);
+
+ var node = new Node._(userData);
+ _nodes.add(node);
+
+ for (var dependency in dependencies) {
+ dependency._neededFor.add(node);
+ node._dependencies.add(dependency);
+ }
+
+ _emitEvent(new NodeAddedEvent(node));
+
+ _stateCounts.putIfAbsent(node.state, () => 0);
+ _stateCounts[node.state] += 1;
+
+ return node;
+ }
+
+ void changeState(Node node, NodeState newState) {
+ var fromState = node.state;
+ node._state = newState;
+
+ _stateCounts[fromState] -= 1;
+ _stateCounts.putIfAbsent(newState, () => 0);
+ _stateCounts[newState] += 1;
+
+ _emitEvent(new StateChangedEvent(node, fromState, newState));
+ }
+
+ _emitEvent(GraphEvent event) {
+ // We emit events asynchronously so the graph can be build up in small
+ // batches and the events are delivered in small batches.
+ Timer.run(() {
+ _eventController.add(event);
+ });
+ }
+}
+
+class Node extends UniqueObject {
+ final Object _userData;
+ NodeState _state = NodeState.Initialized;
+ Set<Node> _dependencies = new Set<Node>();
+ Set<Node> _neededFor = new Set<Node>();
+
+ Node._(this._userData);
+
+ Object get userData => _userData;
+ NodeState get state => _state;
+ Iterable<Node> get dependencies => _dependencies;
+ Iterable<Node> get neededFor => _neededFor;
+}
+
+class NodeState extends UniqueObject {
+ static NodeState Initialized = new NodeState._("Initialized");
+ static NodeState Waiting = new NodeState._("Waiting");
+ static NodeState Enqueuing = new NodeState._("Enqueuing");
+ static NodeState Processing = new NodeState._("Running");
+ static NodeState Successful = new NodeState._("Successful");
+ static NodeState Failed = new NodeState._("Failed");
+ static NodeState UnableToRun = new NodeState._("UnableToRun");
+
+ final String name;
+
+ NodeState._(this.name);
+
+ String toString() => name;
+}
+
+abstract class GraphEvent {}
+
+class GraphSealedEvent extends GraphEvent {}
+
+class NodeAddedEvent extends GraphEvent {
+ final Node node;
+
+ NodeAddedEvent(this.node);
+}
+
+class StateChangedEvent extends GraphEvent {
+ final Node node;
+ final NodeState from;
+ final NodeState to;
+
+ StateChangedEvent(this.node, this.from, this.to);
+}
diff --git a/tools/testing/dart/record_and_replay.dart b/tools/testing/dart/record_and_replay.dart
index c2ba7c9..60fbedb 100644
--- a/tools/testing/dart/record_and_replay.dart
+++ b/tools/testing/dart/record_and_replay.dart
@@ -16,7 +16,6 @@
* [
* {
* 'name' : '...',
- * 'configuration' : '...',
* 'command' : {
* 'timeout_limit' : 60,
* 'executable' : '...',
@@ -34,6 +33,18 @@
* ]
*/
+List<String> makePathsRelativeToDart(String cwd, List<String> arguments) {
+ var relativeArguments = [];
+ for (var rawArgument in arguments) {
+ if (rawArgument.startsWith(cwd)) {
+ var relative = new Path(rawArgument).relativeTo(new Path(cwd));
+ relativeArguments.add(relative.toNativePath());
+ } else {
+ relativeArguments.add(rawArgument);
+ }
+ }
+ return relativeArguments;
+}
class TestCaseRecorder {
Path _outputPath;
@@ -44,27 +55,17 @@
_cwd = Directory.current.path;
}
- void nextTestCase(TestCase testCase) {
- assert(testCase.commands.length == 1);
-
- var command = testCase.commands[0];
- assert(command.environment == null);
-
- var arguments = [];
- for (var rawArgument in command.arguments) {
- if (rawArgument.startsWith(_cwd)) {
- var relative = new Path(rawArgument).relativeTo(new Path(_cwd));
- arguments.add(relative.toNativePath());
- } else {
- arguments.add(rawArgument);
- }
- }
+ void nextCommand(Command command, int timeout) {
+ // Convert arguments from absolute to relative paths (relative to the dart
+ // directory) because the absolute path on the machine where we record
+ // may be different from the absolute path on the machine where we execute
+ // the commands.
+ var arguments = makePathsRelativeToDart(_cwd, command.arguments);
var commandExecution = {
- 'name' : testCase.displayName,
- 'configuration' : testCase.configurationString,
+ 'name' : command.displayName,
'command' : {
- 'timeout_limit' : testCase.timeout,
+ 'timeout_limit' : timeout,
'executable' : command.executable,
'arguments' : arguments,
},
@@ -81,36 +82,45 @@
}
class TestCaseOutputArchive {
- Map<String, Map> _testCaseOutputRecords;
+ Map<String, Map> _commandOutputRecordings;
+ var _cwd;
+
+ TestCaseOutputArchive() {
+ _cwd = Directory.current.path;
+ }
void loadFromPath(Path recordingPath) {
var file = new File.fromPath(recordingPath);
- var testCases = json.parse(file.readAsStringSync());
- _testCaseOutputRecords = {};
- for (var testCase in testCases) {
- var key = _indexKey(testCase['configuration'], testCase['name']);
- _testCaseOutputRecords[key] = testCase['command_output'];
+ var commandRecordings = json.parse(file.readAsStringSync());
+ _commandOutputRecordings = {};
+ for (var commandRecording in commandRecordings) {
+ var key = _indexKey(commandRecording['command']['executable'],
+ commandRecording['command']['arguments'].join(' '));
+ _commandOutputRecordings[key] = commandRecording['command_output'];
}
}
- CommandOutput outputOf(TestCase testCase) {
- var key = _indexKey(testCase.configurationString, testCase.displayName);
- var command_output = _testCaseOutputRecords[key];
- if (command_output == null) {
- print("Sorry, but there is no command output for "
- "${testCase.displayName}");
+ CommandOutput outputOf(Command command) {
+ // Convert arguments from absolute to relative paths (relative to the dart
+ // directory) because the absolute path on the machine where we record
+ // may be different from the absolute path on the machine where we execute
+ // the commands.
+ var arguments = makePathsRelativeToDart(_cwd, command.arguments);
+ var key = _indexKey(command.executable, arguments.join(' '));
+ var command_output = _commandOutputRecordings[key];
+ if (command_output == null) {
+ print("Sorry, but there is no command output for ${command.displayName}"
+ " ($command)");
exit(42);
}
double seconds = command_output['duration'];
var duration = new Duration(seconds: seconds.round(),
milliseconds: (seconds/1000).round());
- var commandOutput = new CommandOutput.fromCase(
- testCase,
- testCase.commands.first,
+ var commandOutput = createCommandOutput(
+ command,
command_output['exit_code'],
- false,
command_output['did_timeout'],
encodeUtf8(command_output['stdout']),
encodeUtf8(command_output['stderr']),
@@ -119,8 +129,8 @@
return commandOutput;
}
- String _indexKey(String configuration, String name) {
- return "${configuration}__$name";
+ String _indexKey(String executable, String arguments) {
+ return "${executable}__$arguments";
}
}
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index 37a0411..f66c485 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -39,18 +39,6 @@
* Parser of test options.
*/
class TestOptionsParser {
- String specialCommandHelp =
-"""
-Special command support. Wraps the command line in
-a special command. The special command should contain
-an '@' character which will be replaced by the normal
-command executable.
-
-For example if the normal command line that will be executed
-is 'dart file.dart' and you specify special command
-'python -u valgrind.py @ suffix' the final command will be
-'python -u valgrind.py dart suffix file.dart'""";
-
/**
* Creates a test options parser initialized with the known options.
*/
@@ -225,19 +213,6 @@
false,
'bool'),
new _TestOptionSpecification(
- 'valgrind',
- 'Run tests through valgrind',
- ['--valgrind'],
- [],
- false,
- 'bool'),
- new _TestOptionSpecification(
- 'special-command',
- specialCommandHelp,
- ['--special-command'],
- [],
- ''),
- new _TestOptionSpecification(
'time',
'Print timing information after running tests',
['--time'],
@@ -582,16 +557,6 @@
if (configuration['mode'] == 'all') {
configuration['mode'] = 'debug,release';
}
- if (configuration['valgrind']) {
- // TODO(ager): Get rid of this when there is only one checkout and
- // we don't have to special case for the runtime checkout.
- File valgrindFile = new File('runtime/tools/valgrind.py');
- if (!valgrindFile.existsSync()) {
- valgrindFile = new File('../runtime/tools/valgrind.py');
- }
- String valgrind = valgrindFile.fullPathSync();
- configuration['special-command'] = 'python -u $valgrind @';
- }
// Use verbose progress indication for verbose output unless buildbot
// progress indication is requested.
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index 20da10f..d0b5aef 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -77,9 +77,10 @@
expected.write('$expectation ');
}
output.add(expected.toString());
- output.add('Actual: ${test.lastCommandOutput.result}');
+ output.add('Actual: ${test.result}');
if (!test.lastCommandOutput.hasTimedOut && test.info != null) {
- if (test.lastCommandOutput.incomplete && !test.info.hasCompileError) {
+ if (test.commandOutputs.length != test.commands.length
+ && !test.info.hasCompileError) {
output.add('Unexpected compile-time error.');
} else {
if (test.info.hasCompileError) {
@@ -130,7 +131,7 @@
var command = test.commands[i];
var commandOutput = test.commandOutputs[command];
output.add('');
- output.add('Command[$i]: $command');
+ output.add('Command[${command.displayName}]: $command');
if (commandOutput != null) {
output.add('Took ${commandOutput.time}');
} else {
@@ -161,7 +162,6 @@
class EventListener {
void testAdded() { }
- void start(TestCase test) { }
void done(TestCase test) { }
void allTestsKnown() { }
void allDone() { }
@@ -169,7 +169,7 @@
class ExitCodeSetter extends EventListener {
void done(TestCase test) {
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
io.exitCode = 1;
}
}
@@ -177,7 +177,7 @@
class FlakyLogWriter extends EventListener {
void done(TestCase test) {
- if (test.isFlaky && test.lastCommandOutput.result != PASS) {
+ if (test.isFlaky && test.result != PASS) {
var buf = new StringBuffer();
for (var l in _buildFailureOutput(test)) {
buf.write("$l\n");
@@ -203,31 +203,41 @@
}
class TimingPrinter extends EventListener {
- List<CommandOutput> _commandOutputs = <CommandOutput>[];
+ final _command2testCases = new Map<Command, List<TestCase>>();
+ final _commandOutputs = new Set<CommandOutput>();
DateTime _startTime;
TimingPrinter(this._startTime);
void done(TestCase testCase) {
for (var commandOutput in testCase.commandOutputs.values) {
+ var command = commandOutput.command;
_commandOutputs.add(commandOutput);
+ _command2testCases.putIfAbsent(command, () => <TestCase>[]);
+ _command2testCases[command].add(testCase);
}
}
void allDone() {
Duration d = (new DateTime.now()).difference(_startTime);
print('\n--- Total time: ${_timeString(d)} ---');
- _commandOutputs.sort((a, b) {
+ var outputs = _commandOutputs.toList();
+ outputs.sort((a, b) {
return b.time.inMilliseconds - a.time.inMilliseconds;
});
- for (int i = 0; i < 20 && i < _commandOutputs.length; i++) {
- var commandOutput = _commandOutputs[i];
+ for (int i = 0; i < 20 && i < outputs.length; i++) {
+ var commandOutput = outputs[i];
var command = commandOutput.command;
- var testCase = commandOutput.testCase;
+ var testCases = _command2testCases[command];
var duration = commandOutput.time;
- var configuration = testCase.configurationString;
- print('${commandOutput.time} - $configuration'
- ' - ${testCase.displayName} (${command.displayName})');
+
+ var testCasesDescription = testCases.map((testCase) {
+ return "${testCase.configurationString}/${testCase.displayName}";
+ }).join(', ');
+
+ print('${commandOutput.time} - '
+ '${command.displayName} - '
+ '$testCasesDescription');
}
}
}
@@ -237,7 +247,7 @@
var _failureSummary = <String>[];
void done(TestCase test) {
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
_printFailureOutput(test);
}
}
@@ -248,7 +258,7 @@
void _printFailureOutput(TestCase test) {
- String status = '${test.displayName}: ${test.lastCommandOutput.result}';
+ String status = '${test.displayName}: ${test.result}';
List<String> configs =
statusToConfigs.putIfAbsent(status, () => <String>[]);
configs.add(test.configurationString);
@@ -348,7 +358,7 @@
class LineProgressIndicator extends EventListener {
void done(TestCase test) {
var status = 'pass';
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
status = 'fail';
}
print('Done ${test.configurationString} ${test.displayName}: $status');
@@ -365,7 +375,7 @@
[this._formatter = const Formatter()]);
void done(TestCase test) {
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
_failedTests++;
var lines = _buildFailureOutput(test, _formatter);
for (var line in lines) {
@@ -400,12 +410,8 @@
void testAdded() { _foundTests++; }
- void start(TestCase test) {
- _printStartProgress(test);
- }
-
void done(TestCase test) {
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
_failedTests++;
} else {
_passedTests++;
@@ -417,7 +423,6 @@
_allTestsKnown = true;
}
- void _printStartProgress(TestCase test) {}
void _printDoneProgress(TestCase test) {}
int _completedTests() => _passedTests + _failedTests;
@@ -441,7 +446,6 @@
print('');
}
- void _printStartProgress(TestCase test) => _printProgress();
void _printDoneProgress(TestCase test) => _printProgress();
void _printProgress();
@@ -473,13 +477,9 @@
VerboseProgressIndicator(DateTime startTime)
: super(startTime);
- void _printStartProgress(TestCase test) {
- print('Starting ${test.configurationString} ${test.displayName}...');
- }
-
void _printDoneProgress(TestCase test) {
var status = 'pass';
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
status = 'fail';
}
print('Done ${test.configurationString} ${test.displayName}: $status');
@@ -495,14 +495,14 @@
void done(TestCase test) {
super.done(test);
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
_failureSummary.addAll(_buildFailureOutput(test));
}
}
void _printDoneProgress(TestCase test) {
var status = 'pass';
- if (test.lastCommandOutput.unexpectedOutput) {
+ if (test.unexpectedOutput) {
status = 'fail';
}
var percent = ((_completedTests() / _foundTests) * 100).toInt().toString();
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index e4a51d9..1012082 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -17,6 +17,8 @@
// CommandOutput.exitCode in subclasses of CommandOutput.
import "dart:io" as io;
import "dart:isolate";
+import "dart:math" as math;
+import 'dependency_graph.dart' as dgraph;
import "browser_controller.dart";
import "http_server.dart" as http_server;
import "status_file_parser.dart";
@@ -25,10 +27,8 @@
import "utils.dart";
import 'record_and_replay.dart';
-const int NO_TIMEOUT = 0;
-const int SLOW_TIMEOUT_MULTIPLIER = 4;
-
const int CRASHING_BROWSER_EXITCODE = -10;
+const int SLOW_TIMEOUT_MULTIPLIER = 4;
typedef void TestCaseEvent(TestCase testCase);
typedef void ExitCodeEvent(int exitCode);
@@ -41,77 +41,33 @@
'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY'];
-/**
- * [areByteArraysEqual] compares a range of bytes from [buffer1] with a
- * range of bytes from [buffer2].
- *
- * Returns [true] if the [count] bytes in [buffer1] (starting at
- * [offset1]) match the [count] bytes in [buffer2] (starting at
- * [offset2]).
- * Otherwise [false] is returned.
- */
-bool areByteArraysEqual(List<int> buffer1, int offset1,
- List<int> buffer2, int offset2,
- int count) {
- if ((offset1 + count) > buffer1.length ||
- (offset2 + count) > buffer2.length) {
- return false;
- }
-
- for (var i = 0; i < count; i++) {
- if (buffer1[offset1 + i] != buffer2[offset2 + i]) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * [findBytes] searches for [pattern] in [data] beginning at [startPos].
- *
- * Returns [true] if [pattern] was found in [data].
- * Otherwise [false] is returned.
- */
-int findBytes(List<int> data, List<int> pattern, [int startPos=0]) {
- // TODO(kustermann): Use one of the fast string-matching algorithms!
- for (int i=startPos; i < (data.length-pattern.length); i++) {
- bool found = true;
- for (int j=0; j<pattern.length; j++) {
- if (data[i+j] != pattern[j]) {
- found = false;
- }
- }
- if (found) {
- return i;
- }
- }
- return -1;
-}
-
-
/** A command executed as a step in a test case. */
class Command {
- static int nextHashCode = 0;
- final int hashCode = nextHashCode++;
- operator ==(other) => super == (other);
-
/** Path to the executable of this command. */
String executable;
- /** Command line arguments to the executable. */
- List<String> arguments;
-
- /** Environment for the command */
- Map<String,String> environment;
-
/** The actual command line that will be executed. */
String commandLine;
/** A descriptive name for this command. */
String displayName;
- Command(this.displayName, this.executable,
- this.arguments, [this.environment = null]) {
+ /** Command line arguments to the executable. */
+ List<String> arguments;
+
+ /** Environment for the command */
+ Map<String, String> environmentOverrides;
+
+ /** Number of times this command can be retried */
+ int get numRetries => 0;
+
+ // We compute the Command.hashCode lazily and cache it here, since it might
+ // be expensive to compute (and hashCode is called often).
+ int _cachedHashCode;
+
+ Command._(this.displayName, this.executable,
+ this.arguments, String configurationDir,
+ [this.environmentOverrides = null]) {
if (io.Platform.operatingSystem == 'windows') {
// Windows can't handle the first command if it is a .bat file or the like
// with the slashes going the other direction.
@@ -122,6 +78,76 @@
quotedArguments.add(escapeCommandLineArgument(executable));
quotedArguments.addAll(arguments.map(escapeCommandLineArgument));
commandLine = quotedArguments.join(' ');
+
+ if (configurationDir != null) {
+ if (environmentOverrides == null) {
+ environmentOverrides = new Map<String, String>();
+ }
+ environmentOverrides['DART_CONFIGURATION'] = configurationDir;
+ }
+ }
+
+ int get hashCode {
+ if (_cachedHashCode == null) {
+ var builder = new HashCodeBuilder();
+ _buildHashCode(builder);
+ _cachedHashCode = builder.value;
+ }
+ return _cachedHashCode;
+ }
+
+ operator ==(other) {
+ if (other is Command) {
+ return identical(this, other) || _equal(other as Command);
+ }
+ return false;
+ }
+
+ void _buildHashCode(HashCodeBuilder builder) {
+ builder.add(executable);
+ builder.add(commandLine);
+ builder.add(displayName);
+ for (var object in arguments) builder.add(object);
+ if (environmentOverrides != null) {
+ for (var key in environmentOverrides.keys) {
+ builder.add(key);
+ builder.add(environmentOverrides[key]);
+ }
+ }
+ }
+
+ bool _equal(Command other) {
+ if (hashCode != other.hashCode ||
+ executable != other.executable ||
+ commandLine != other.commandLine ||
+ displayName != other.displayName ||
+ arguments.length != other.arguments.length) {
+ return false;
+ }
+
+ if ((environmentOverrides != other.environmentOverrides) &&
+ (environmentOverrides == null || other.environmentOverrides == null)) {
+ return false;
+ }
+
+ if (environmentOverrides != null &&
+ environmentOverrides.length != other.environmentOverrides.length) {
+ return false;
+ }
+
+ for (var i = 0; i < arguments.length; i++) {
+ if (arguments[i] != other.arguments[i]) return false;
+ }
+
+ if (environmentOverrides != null) {
+ for (var key in environmentOverrides.keys) {
+ if (!other.environmentOverrides.containsKey(key) ||
+ environmentOverrides[key] != other.environmentOverrides[key]) {
+ return false;
+ }
+ }
+ }
+ return true;
}
String toString() => commandLine;
@@ -136,13 +162,18 @@
bool _neverSkipCompilation;
List<Uri> _bootstrapDependencies;
- CompilationCommand(String displayName,
- this._outputFile,
- this._neverSkipCompilation,
- this._bootstrapDependencies,
- String executable,
- List<String> arguments)
- : super(displayName, executable, arguments);
+ CompilationCommand._(String displayName,
+ this._outputFile,
+ this._neverSkipCompilation,
+ List<String> bootstrapDependencies,
+ String executable,
+ List<String> arguments,
+ String configurationDir)
+ : super._(displayName, executable, arguments, configurationDir) {
+ // We sort here, so we can do a fast hashCode/operator==
+ _bootstrapDependencies = new List.from(bootstrapDependencies);
+ _bootstrapDependencies.sort();
+ }
Future<bool> get outputIsUpToDate {
if (_neverSkipCompilation) return new Future.value(false);
@@ -184,6 +215,29 @@
return false;
});
}
+
+ void _buildHashCode(HashCodeBuilder builder) {
+ super._buildHashCode(builder);
+ builder.add(_outputFile);
+ builder.add(_neverSkipCompilation);
+ for (var uri in _bootstrapDependencies) builder.add(uri);
+ }
+
+ bool _equal(Command other) {
+ if (other is CompilationCommand &&
+ super._equal(other) &&
+ _outputFile == other._outputFile &&
+ _neverSkipCompilation == other._neverSkipCompilation &&
+ _bootstrapDependencies.length == other._bootstrapDependencies.length) {
+ for (var i = 0; i < _bootstrapDependencies.length; i++) {
+ if (_bootstrapDependencies[i] != other._bootstrapDependencies[i]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
}
class ContentShellCommand extends Command {
@@ -195,25 +249,25 @@
*/
io.Path expectedOutputPath;
- ContentShellCommand(String executable,
- String htmlFile,
- List<String> options,
- List<String> dartFlags,
- io.Path this.expectedOutputPath)
- : super("content_shell",
- executable,
- _getArguments(options, htmlFile),
- _getEnvironment(dartFlags));
+ ContentShellCommand._(String executable,
+ String htmlFile,
+ List<String> options,
+ List<String> dartFlags,
+ io.Path this.expectedOutputPath,
+ String configurationDir)
+ : super._("content_shell",
+ executable,
+ _getArguments(options, htmlFile),
+ configurationDir,
+ _getEnvironment(dartFlags));
static Map _getEnvironment(List<String> dartFlags) {
var needDartFlags = dartFlags != null && dartFlags.length > 0;
var env = null;
if (needDartFlags) {
- env = new Map.from(io.Platform.environment);
- if (needDartFlags) {
- env['DART_FLAGS'] = dartFlags.join(" ");
- }
+ env = new Map<String, String>();
+ env['DART_FLAGS'] = dartFlags.join(" ");
}
return env;
@@ -228,8 +282,186 @@
io.Path get expectedOutputFile => expectedOutputPath;
bool get isPixelTest => (expectedOutputFile != null &&
expectedOutputFile.filename.endsWith(".png"));
+
+ void _buildHashCode(HashCodeBuilder builder) {
+ super._buildHashCode(builder);
+ builder.add(expectedOutputPath.toString());
+ }
+
+ bool _equal(Command other) {
+ return
+ other is ContentShellCommand &&
+ super._equal(other) &&
+ expectedOutputPath.toString() == other.expectedOutputPath.toString();
+ }
+
+ // FIXME(kustermann): Remove this once we're stable
+ int get numRetries => 2;
}
+class BrowserTestCommand extends Command {
+ final String browser;
+ final String url;
+
+ BrowserTestCommand._(String _browser,
+ this.url,
+ String executable,
+ List<String> arguments,
+ String configurationDir)
+ : super._(_browser, executable, arguments, configurationDir),
+ browser = _browser;
+
+ void _buildHashCode(HashCodeBuilder builder) {
+ super._buildHashCode(builder);
+ builder.add(browser);
+ builder.add(url);
+ }
+
+ bool _equal(Command other) {
+ return
+ other is BrowserTestCommand &&
+ super._equal(other) &&
+ browser == other.browser &&
+ url == other.url;
+ }
+
+ // FIXME(kustermann): Remove this once we're stable
+ int get numRetries => 2;
+}
+
+class SeleniumTestCommand extends Command {
+ final String browser;
+ final String url;
+
+ SeleniumTestCommand._(String _browser,
+ this.url,
+ String executable,
+ List<String> arguments,
+ String configurationDir)
+ : super._(_browser, executable, arguments, configurationDir),
+ browser = _browser;
+
+ void _buildHashCode(HashCodeBuilder builder) {
+ super._buildHashCode(builder);
+ builder.add(browser);
+ builder.add(url);
+ }
+
+ bool _equal(Command other) {
+ return
+ other is SeleniumTestCommand &&
+ super._equal(other) &&
+ browser == other.browser &&
+ url == other.url;
+ }
+
+ // FIXME(kustermann): Remove this once we're stable
+ int get numRetries => 2;
+}
+
+class AnalysisCommand extends Command {
+ final String flavor;
+
+ AnalysisCommand._(this.flavor,
+ String displayName,
+ String executable,
+ List<String> arguments,
+ String configurationDir)
+ : super._(displayName, executable, arguments, configurationDir);
+
+ void _buildHashCode(HashCodeBuilder builder) {
+ super._buildHashCode(builder);
+ builder.add(flavor);
+ }
+
+ bool _equal(Command other) {
+ return
+ other is AnalysisCommand &&
+ super._equal(other) &&
+ flavor == other.flavor;
+ }
+}
+
+class CommandBuilder {
+ static final instance = new CommandBuilder._();
+
+ final _cachedCommands = new Map<Command, Command>();
+
+ CommandBuilder._();
+
+ ContentShellCommand getContentShellCommand(String executable,
+ String htmlFile,
+ List<String> options,
+ List<String> dartFlags,
+ io.Path expectedOutputPath,
+ String configurationDir) {
+ ContentShellCommand command = new ContentShellCommand._(
+ executable, htmlFile, options, dartFlags, expectedOutputPath,
+ configurationDir);
+ return _getUniqueCommand(command);
+ }
+
+ BrowserTestCommand getBrowserTestCommand(String browser,
+ String url,
+ String executable,
+ List<String> arguments,
+ String configurationDir) {
+ var command = new BrowserTestCommand._(
+ browser, url, executable, arguments, configurationDir);
+ return _getUniqueCommand(command);
+ }
+
+ SeleniumTestCommand getSeleniumTestCommand(String browser,
+ String url,
+ String executable,
+ List<String> arguments,
+ String configurationDir) {
+ var command = new SeleniumTestCommand._(
+ browser, url, executable, arguments, configurationDir);
+ return _getUniqueCommand(command);
+ }
+
+ CompilationCommand getCompilationCommand(String displayName,
+ outputFile,
+ neverSkipCompilation,
+ List<String> bootstrapDependencies,
+ String executable,
+ List<String> arguments,
+ String configurationDir) {
+ var command =
+ new CompilationCommand._(displayName, outputFile, neverSkipCompilation,
+ bootstrapDependencies, executable, arguments,
+ configurationDir);
+ return _getUniqueCommand(command);
+ }
+
+ AnalysisCommand getAnalysisCommand(
+ String displayName, executable, arguments, String configurationDir,
+ {String flavor: 'dartanalyzer'}) {
+ var command = new AnalysisCommand._(
+ flavor, displayName, executable, arguments, configurationDir);
+ return _getUniqueCommand(command);
+ }
+
+ Command getCommand(String displayName, executable, arguments,
+ String configurationDir, [environment = null]) {
+ var command = new Command._(displayName, executable, arguments,
+ configurationDir, environment);
+ return _getUniqueCommand(command);
+ }
+
+ Command _getUniqueCommand(Command command) {
+ // All Command classes have hashCode/operator==, so we check if this command
+ // has already been build, if so we return the cached one, otherwise we
+ // store the one given as [command] argument.
+ var cachedCommand = _cachedCommands[command];
+ if (cachedCommand != null) {
+ return cachedCommand;
+ }
+ _cachedCommands[command] = command;
+ return command;
+ }
+}
/**
* TestCase contains all the information needed to run a test and evaluate
@@ -248,7 +480,7 @@
* The TestCase has a callback function, [completedHandler], that is run when
* the test is completed.
*/
-class TestCase {
+class TestCase extends UniqueObject {
/**
* A list of commands to execute. Most test cases have a single command.
* Dart2js tests have two commands, one to compile the source and another
@@ -262,69 +494,25 @@
String displayName;
bool isNegative;
Set<String> expectedOutcomes;
- TestCaseEvent completedHandler;
TestInformation info;
TestCase(this.displayName,
this.commands,
this.configuration,
- this.completedHandler,
this.expectedOutcomes,
{this.isNegative: false,
this.info: null}) {
if (!isNegative) {
this.isNegative = displayName.contains("negative_test");
}
-
- // Special command handling. If a special command is specified
- // we have to completely rewrite the command that we are using.
- // We generate a new command-line that is the special command where we
- // replace '@' with the original command executable, and generate
- // a command formed like the following
- // Let PREFIX be what is before the @.
- // Let SUFFIX be what is after the @.
- // Let EXECUTABLE be the existing executable of the command.
- // Let ARGUMENTS be the existing arguments to the existing executable.
- // The new command will be:
- // PREFIX EXECUTABLE SUFFIX ARGUMENTS
- var specialCommand = configuration['special-command'];
- if (!specialCommand.isEmpty) {
- if (!specialCommand.contains('@')) {
- throw new FormatException("special-command must contain a '@' char");
- }
- var specialCommandSplit = specialCommand.split('@');
- var prefix = specialCommandSplit[0].trim();
- var suffix = specialCommandSplit[1].trim();
- List<Command> newCommands = [];
- for (Command c in commands) {
- // If we don't have a new prefix we will use the existing executable.
- var newExecutablePath = c.executable;;
- var newArguments = [];
-
- if (prefix.length > 0) {
- var prefixSplit = prefix.split(' ');
- newExecutablePath = prefixSplit[0];
- for (int i = 1; i < prefixSplit.length; i++) {
- var current = prefixSplit[i];
- if (!current.isEmpty) newArguments.add(current);
- }
- newArguments.add(c.executable);
- }
-
- // Add any suffixes to the arguments of the original executable.
- var suffixSplit = suffix.split(' ');
- suffixSplit.forEach((e) {
- if (!e.isEmpty) newArguments.add(e);
- });
-
- newArguments.addAll(c.arguments);
- final newCommand = new Command(newExecutablePath, newArguments);
- newCommands.add(newCommand);
- }
- commands = newCommands;
- }
}
+ bool get unexpectedOutput {
+ return !expectedOutcomes.contains(lastCommandOutput.result(this));
+ }
+
+ String get result => lastCommandOutput.result(this);
+
CommandOutput get lastCommandOutput {
if (commandOutputs.length == 0) {
throw new Exception("CommandOutputs is empty, maybe no command was run? ("
@@ -351,15 +539,10 @@
return "$compiler-$runtime$checked ${mode}_$arch";
}
- List<String> get batchRunnerArguments => ['-batch'];
List<String> get batchTestArguments => commands.last.arguments;
bool get usesWebDriver => TestUtils.usesWebDriver(configuration['runtime']);
- bool get usesBrowserController => configuration['use_browser_controller'];
-
- void completed() { completedHandler(this); }
-
bool get isFlaky {
if (expectedOutcomes.contains(SKIP)) {
return false;
@@ -370,6 +553,11 @@
..remove(SLOW);
return flags.contains(PASS) && flags.length > 1;
}
+
+ bool get isFinished {
+ return !lastCommandOutput.successfull ||
+ commands.length == commandOutputs.length;
+ }
}
@@ -379,61 +567,17 @@
* If the compilation command fails, then the rest of the test is not run.
*/
class BrowserTestCase extends TestCase {
- /**
- * Indicates the number of potential retries remaining, to compensate for
- * flaky browser tests.
- */
- int numRetries;
- /**
- * True if this test is dependent on another test completing before it can
- * star (for example, we might need to depend on some other test completing
- * first).
- */
- bool waitingForOtherTest;
-
- /**
- * The set of test cases that wish to be notified when this test has
- * completed.
- */
- List<BrowserTestCase> observers;
-
- BrowserTestCase(displayName, commands, configuration, completedHandler,
- expectedOutcomes, info, isNegative, this._testingUrl,
- [this.waitingForOtherTest = false])
- : super(displayName, commands, configuration, completedHandler,
- expectedOutcomes, isNegative: isNegative, info: info) {
- numRetries = 2; // Allow two retries to compensate for flaky browser tests.
- observers = [];
- }
-
- List<String> get _lastArguments => commands.last.arguments;
-
- List<String> get batchRunnerArguments => [_lastArguments[0], '--batch'];
-
- List<String> get batchTestArguments => _lastArguments.sublist(1);
+ BrowserTestCase(displayName, commands, configuration,
+ expectedOutcomes, info, isNegative, this._testingUrl)
+ : super(displayName, commands, configuration,
+ expectedOutcomes, isNegative: isNegative, info: info);
String _testingUrl;
- /** Add a test case to listen for when this current test has completed. */
- void addObserver(BrowserTestCase testCase) {
- observers.add(testCase);
- }
-
- /**
- * Notify all of the test cases that are dependent on this one that they can
- * proceed.
- */
- void notifyObservers() {
- for (BrowserTestCase testCase in observers) {
- testCase.waitingForOtherTest = false;
- }
- }
-
String get testingUrl => _testingUrl;
}
-
/**
* CommandOutput records the output of a completed command: the process's exit
* code, the standard output and standard error, whether the process timed out,
@@ -441,43 +585,21 @@
* [TestCase] this is the output of.
*/
abstract class CommandOutput {
- factory CommandOutput.fromCase(TestCase testCase,
- Command command,
- int exitCode,
- bool incomplete,
- bool timedOut,
- List<int> stdout,
- List<int> stderr,
- Duration time,
- bool compilationSkipped) {
- return new CommandOutputImpl.fromCase(testCase,
- command,
- exitCode,
- incomplete,
- timedOut,
- stdout,
- stderr,
- time,
- compilationSkipped);
- }
-
Command get command;
- TestCase testCase;
-
- bool get incomplete;
-
- String get result;
-
- bool get unexpectedOutput;
+ String result(TestCase testCase);
bool get hasCrashed;
bool get hasTimedOut;
- bool get didFail;
+ bool didFail(testcase);
- bool requestRetry;
+ bool hasFailed(TestCase testCase);
+
+ bool get canRunDependendCommands;
+
+ bool get successfull; // otherwise we might to retry running
Duration get time;
@@ -492,16 +614,11 @@
bool get compilationSkipped;
}
-class CommandOutputImpl implements CommandOutput {
+class CommandOutputImpl extends UniqueObject implements CommandOutput {
Command command;
- TestCase testCase;
int exitCode;
- /// Records if all commands were run, true if they weren't.
- final bool incomplete;
-
bool timedOut;
- bool failed = false;
List<int> stdout;
List<int> stderr;
Duration time;
@@ -514,80 +631,19 @@
*/
bool alreadyPrintedWarning = false;
- /**
- * Set to true if we encounter a condition in the output that indicates we
- * need to rerun this test.
- */
- bool requestRetry = false;
-
- // Don't call this constructor, call CommandOutput.fromCase() to
- // get a new TestOutput instance.
- CommandOutputImpl(TestCase this.testCase,
- Command this.command,
+ // TODO(kustermann): Remove testCase from this class.
+ CommandOutputImpl(Command this.command,
int this.exitCode,
- bool this.incomplete,
bool this.timedOut,
List<int> this.stdout,
List<int> this.stderr,
Duration this.time,
bool this.compilationSkipped) {
- testCase.commandOutputs[command] = this;
diagnostics = [];
}
- factory CommandOutputImpl.fromCase(TestCase testCase,
- Command command,
- int exitCode,
- bool incomplete,
- bool timedOut,
- List<int> stdout,
- List<int> stderr,
- Duration time,
- bool compilationSkipped) {
- if (testCase.usesBrowserController) {
- return new HTMLBrowserCommandOutputImpl(testCase,
- command,
- exitCode,
- incomplete,
- timedOut,
- stdout,
- stderr,
- time,
- compilationSkipped);
- } else if (testCase is BrowserTestCase) {
- return new BrowserCommandOutputImpl(testCase,
- command,
- exitCode,
- incomplete,
- timedOut,
- stdout,
- stderr,
- time,
- compilationSkipped);
- } else if (testCase.configuration['analyzer']) {
- return new AnalysisCommandOutputImpl(testCase,
- command,
- exitCode,
- timedOut,
- stdout,
- stderr,
- time,
- compilationSkipped);
- }
- return new CommandOutputImpl(testCase,
- command,
- exitCode,
- incomplete,
- timedOut,
- stdout,
- stderr,
- time,
- compilationSkipped);
- }
- String get result =>
- hasCrashed ? CRASH : (hasTimedOut ? TIMEOUT : (hasFailed ? FAIL : PASS));
-
- bool get unexpectedOutput => !testCase.expectedOutcomes.contains(result);
+ String result(TestCase testCase) => hasCrashed ? CRASH :
+ (hasTimedOut ? TIMEOUT : (hasFailed(testCase) ? FAIL : PASS));
bool get hasCrashed {
// The Java dartc runner and dart2js exits with code 253 in case
@@ -617,42 +673,66 @@
bool get hasTimedOut => timedOut;
- bool get didFail {
+ bool didFail(TestCase testCase) {
return (exitCode != 0 && !hasCrashed);
}
+ bool get canRunDependendCommands {
+ // FIXME(kustermann): We may need to change this
+ return !hasTimedOut && exitCode == 0;
+ }
+
+ bool get successfull {
+ // FIXME(kustermann): We may need to change this
+ return !hasTimedOut && exitCode == 0;
+ }
+
// Reverse result of a negative test.
- bool get hasFailed {
- // Always fail if a runtime-error is expected and compilation failed.
- if (testCase.info != null && testCase.info.hasRuntimeError && incomplete) {
- return true;
+ bool hasFailed(TestCase testCase) {
+ // FIXME(kustermann): this is a hack, remove it
+ bool isCompilationCommand = testCase.commands.first == command
+ && testCase.commands.length > 1;
+ if (isCompilationCommand &&
+ testCase.info != null && testCase.info.hasRuntimeError) {
+ return exitCode != 0;
}
- return testCase.isNegative ? !didFail : didFail;
+ return testCase.isNegative ? !didFail(testCase) : didFail(testCase);
}
}
class BrowserCommandOutputImpl extends CommandOutputImpl {
+ bool _failedBecauseOfMissingXDisplay;
+
BrowserCommandOutputImpl(
- testCase,
command,
exitCode,
- incomplete,
timedOut,
stdout,
stderr,
time,
compilationSkipped) :
- super(testCase,
- command,
+ super(command,
exitCode,
- incomplete,
timedOut,
stdout,
stderr,
time,
- compilationSkipped);
+ compilationSkipped) {
+ _failedBecauseOfMissingXDisplay = _didFailBecauseOfMissingXDisplay();
+ if (_failedBecauseOfMissingXDisplay) {
+ DebugLogger.warning("Warning: Test failure because of missing XDisplay");
+ // If we get the X server error, or DRT crashes with a core dump, retry
+ // the test.
+ }
+ }
- bool get didFail {
+ bool get canRunDependendCommands {
+ // We cannot rely on the exit code of content_shell as a method to determine
+ // if we were successful or not.
+ return super.canRunDependendCommands && !didFail(null);
+ }
+
+ bool didFail(TestCase _) {
if (_failedBecauseOfMissingXDisplay) {
return true;
}
@@ -664,7 +744,7 @@
return _browserTestFailure;
}
- bool get _failedBecauseOfMissingXDisplay {
+ bool _didFailBecauseOfMissingXDisplay() {
// Browser case:
// If the browser test failed, it may have been because content shell
// and the virtual framebuffer X server didn't hook up, or it crashed with
@@ -676,12 +756,6 @@
// This seems to happen quite frequently, we need to figure out why.
if (line.contains('Gtk-WARNING **: cannot open display') ||
line.contains('Failed to run command. return code=1')) {
- // If we get the X server error, or DRT crashes with a core dump, retry
- // the test.
- if ((testCase as BrowserTestCase).numRetries > 0) {
- requestRetry = true;
- }
- print("Warning: Test failure because of missing XDisplay");
return true;
}
}
@@ -705,7 +779,6 @@
* On a layout tests, the DRT output is directly compared with the
* content of the expected output.
*/
- var stdout = testCase.commandOutputs[command].stdout;
var file = new io.File.fromPath(command.expectedOutputFile);
if (file.existsSync()) {
var bytesContentLength = "Content-Length:".codeUnits;
@@ -754,16 +827,9 @@
case 'PASS':
if (has_content_type) {
if (exitCode != 0) {
- print("Warning: All tests passed, but exitCode != 0 "
- "(${testCase.displayName})");
+ print("Warning: All tests passed, but exitCode != 0 ($this)");
}
- if (testCase.configuration['runtime'] == 'drt') {
- // TODO(kustermann/ricow): Issue: 7563
- // We should eventually get rid of this hack.
- return false;
- } else {
- return (exitCode != 0 && !hasCrashed);
- }
+ return (exitCode != 0 && !hasCrashed);
}
break;
}
@@ -774,19 +840,15 @@
class HTMLBrowserCommandOutputImpl extends BrowserCommandOutputImpl {
HTMLBrowserCommandOutputImpl(
- testCase,
command,
exitCode,
- incomplete,
timedOut,
stdout,
stderr,
time,
compilationSkipped) :
- super(testCase,
- command,
+ super(command,
exitCode,
- incomplete,
timedOut,
stdout,
stderr,
@@ -815,33 +877,31 @@
bool alreadyComputed = false;
bool failResult;
- AnalysisCommandOutputImpl(testCase,
- command,
+ // TODO(kustermann): Remove testCase from this class
+ AnalysisCommandOutputImpl(command,
exitCode,
timedOut,
stdout,
stderr,
time,
compilationSkipped) :
- super(testCase,
- command,
+ super(command,
exitCode,
- false,
timedOut,
stdout,
stderr,
time,
compilationSkipped);
- bool get didFail {
+ bool didFail(TestCase testCase) {
if (!alreadyComputed) {
- failResult = _didFail();
+ failResult = _didFail(testCase);
alreadyComputed = true;
}
return failResult;
}
- bool _didFail() {
+ bool _didFail(TestCase testCase) {
if (hasCrashed) return false;
List<String> errors = [];
@@ -859,14 +919,16 @@
}
// OK to Skip error output that doesn't match the machine format
}
+ // FIXME(kustermann): This is wrong, we should give the expectations
+ // to Command
if (testCase.info != null
&& testCase.info.optionsFromFile['isMultitest']) {
- return _didMultitestFail(errors, staticWarnings);
+ return _didMultitestFail(testCase, errors, staticWarnings);
}
- return _didStandardTestFail(errors, staticWarnings);
+ return _didStandardTestFail(testCase, errors, staticWarnings);
}
- bool _didMultitestFail(List errors, List staticWarnings) {
+ bool _didMultitestFail(TestCase testCase, List errors, List staticWarnings) {
Set<String> outcome = testCase.info.multitestOutcome;
if (outcome == null) throw "outcome must not be null";
if (outcome.contains('compile-time error') && errors.length > 0) {
@@ -881,7 +943,7 @@
return false;
}
- bool _didStandardTestFail(List errors, List staticWarnings) {
+ bool _didStandardTestFail(TestCase testCase, List errors, List staticWarnings) {
bool hasFatalTypeErrors = false;
int numStaticTypeAnnotations = 0;
int numCompileTimeAnnotations = 0;
@@ -903,7 +965,11 @@
}
if (errors.length == 0) {
- if (!hasFatalTypeErrors && exitCode != 0) {
+ // If the analyzer has warnings it will exit 1.
+ // We should reconsider how we do this once we have landed a dart
+ // only version of the analyzer for stable use (as in not run in batch
+ // mode).
+ if (!hasFatalTypeErrors && exitCode != 0 && staticWarnings.length == 0) {
diagnostics.add("EXIT CODE MISMATCH: Expected error message:");
diagnostics.add(" command[0]:${testCase.commands[0]}");
diagnostics.add(" exitCode:${exitCode}");
@@ -978,6 +1044,36 @@
}
+CommandOutput createCommandOutput(Command command,
+ int exitCode,
+ bool timedOut,
+ List<int> stdout,
+ List<int> stderr,
+ Duration time,
+ bool compilationSkipped) {
+ if (command is ContentShellCommand) {
+ return new BrowserCommandOutputImpl(
+ command, exitCode, timedOut, stdout, stderr,
+ time, compilationSkipped);
+ } else if (command is BrowserTestCommand) {
+ return new HTMLBrowserCommandOutputImpl(
+ command, exitCode, timedOut, stdout, stderr,
+ time, compilationSkipped);
+ } else if (command is SeleniumTestCommand) {
+ return new BrowserCommandOutputImpl(
+ command, exitCode, timedOut, stdout, stderr,
+ time, compilationSkipped);
+ } else if (command is AnalysisCommand) {
+ return new AnalysisCommandOutputImpl(
+ command, exitCode, timedOut, stdout, stderr,
+ time, compilationSkipped);
+ }
+ return new CommandOutputImpl(
+ command, exitCode, timedOut, stdout, stderr,
+ time, compilationSkipped);
+}
+
+
/** Modifies the --timeout=XX parameter passed to run_selenium.py */
List<String> _modifySeleniumTimeout(List<String> arguments, int timeout) {
return arguments.map((argument) {
@@ -1001,8 +1097,8 @@
* be garbage collected as soon as it is done.
*/
class RunningProcess {
- TestCase testCase;
Command command;
+ int timeout;
bool timedOut = false;
DateTime startTime;
Timer timeoutTimer;
@@ -1011,13 +1107,9 @@
bool compilationSkipped = false;
Completer<CommandOutput> completer;
- RunningProcess(TestCase this.testCase, Command this.command);
+ RunningProcess(Command this.command, this.timeout);
- Future<CommandOutput> start() {
- if (testCase.expectedOutcomes.contains(SKIP)) {
- throw "testCase.expectedOutcomes must not contain 'SKIP'.";
- }
-
+ Future<CommandOutput> run() {
completer = new Completer<CommandOutput>();
startTime = new DateTime.now();
_runCommand();
@@ -1032,7 +1124,7 @@
} else {
var processEnvironment = _createProcessEnvironment();
var commandArguments = _modifySeleniumTimeout(command.arguments,
- testCase.timeout);
+ timeout);
Future processFuture =
io.Process.start(command.executable,
commandArguments,
@@ -1049,7 +1141,7 @@
process.exitCode.then(_commandComplete);
_drainStream(process.stdout, stdout);
_drainStream(process.stderr, stderr);
- timeoutTimer = new Timer(new Duration(seconds: testCase.timeout),
+ timeoutTimer = new Timer(new Duration(seconds: timeout),
timeoutHandler);
}).catchError((e) {
// TODO(floitsch): should we try to report the stacktrace?
@@ -1072,12 +1164,9 @@
}
CommandOutput _createCommandOutput(Command command, int exitCode) {
- var incomplete = command != testCase.commands.last;
- var commandOutput = new CommandOutput.fromCase(
- testCase,
+ var commandOutput = createCommandOutput(
command,
exitCode,
- incomplete,
timedOut,
stdout,
stderr,
@@ -1091,12 +1180,13 @@
}
Map<String, String> _createProcessEnvironment() {
- var baseEnvironment = command.environment != null ?
- command.environment : io.Platform.environment;
- var environment = new Map<String, String>.from(baseEnvironment);
- environment['DART_CONFIGURATION'] =
- TestUtils.configurationDir(testCase.configuration);
+ var environment = io.Platform.environment;
+ if (command.environmentOverrides != null) {
+ for (var key in command.environmentOverrides.keys) {
+ environment[key] = command.environmentOverrides[key];
+ }
+ }
for (var excludedEnvironmentVariable in EXCLUDED_ENVIRONMENT_VARIABLES) {
environment.remove(excludedEnvironmentVariable);
}
@@ -1106,73 +1196,100 @@
}
class BatchRunnerProcess {
+ static bool isWindows = io.Platform.operatingSystem == 'windows';
+
+ final batchRunnerTypes = {
+ 'selenium' : {
+ 'run_executable' : 'python',
+ 'run_arguments' : ['tools/testing/run_selenium.py', '--batch'],
+ 'terminate_command' : ['--terminate'],
+ },
+ 'dartanalyzer' : {
+ 'run_executable' :
+ isWindows ?
+ 'sdk\\bin\\dartanalyzer_developer.bat'
+ : 'sdk/bin/dartanalyzer_developer',
+ 'run_arguments' : ['--batch'],
+ 'terminate_command' : null,
+ },
+ 'dart2analyzer' : {
+ // This is a unix shell script, no windows equivalent available
+ 'run_executable' : 'editor/tools/analyzer_experimental',
+ 'run_arguments' : ['--batch'],
+ 'terminate_command' : null,
+ },
+ };
+
+ Completer<CommandOutput> _completer;
Command _command;
- String _executable;
- List<String> _batchArguments;
+ List<String> _arguments;
+ String _runnerType;
io.Process _process;
+ Map _processEnvironmentOverrides;
Completer _stdoutCompleter;
Completer _stderrCompleter;
StreamSubscription<String> _stdoutSubscription;
StreamSubscription<String> _stderrSubscription;
Function _processExitHandler;
- TestCase _currentTest;
+ bool _currentlyRunning = false;
List<int> _testStdout;
List<int> _testStderr;
String _status;
DateTime _startTime;
Timer _timer;
- bool _isWebDriver;
- BatchRunnerProcess(TestCase testCase) {
- _command = testCase.commands.last;
- _executable = testCase.commands.last.executable;
- _batchArguments = testCase.batchRunnerArguments;
- _isWebDriver = testCase.usesWebDriver;
- }
+ BatchRunnerProcess();
- bool get active => _currentTest != null;
+ Future<CommandOutput> runCommand(String runnerType, Command command,
+ int timeout, List<String> arguments) {
+ assert(_completer == null);
+ assert(!_currentlyRunning);
- void startTest(TestCase testCase) {
- if (_currentTest != null) throw "_currentTest must be null.";
- _currentTest = testCase;
- _command = testCase.commands.last;
+ _completer = new Completer<CommandOutput>();
+ bool sameRunnerType = _runnerType == runnerType &&
+ _dictEquals(_processEnvironmentOverrides, command.environmentOverrides);
+ _runnerType = runnerType;
+ _currentlyRunning = true;
+ _command = command;
+ _arguments = arguments;
+
+ _processEnvironmentOverrides = command.environmentOverrides;
+
if (_process == null) {
// Start process if not yet started.
- _executable = testCase.commands.last.executable;
_startProcess(() {
- doStartTest(testCase);
+ doStartTest(command, timeout);
});
- } else if (testCase.commands.last.executable != _executable) {
- // Restart this runner with the right executable for this test
- // if needed.
- _executable = testCase.commands.last.executable;
- _batchArguments = testCase.batchRunnerArguments;
+ } else if (!sameRunnerType) {
+ // Restart this runner with the right executable for this test if needed.
_processExitHandler = (_) {
_startProcess(() {
- doStartTest(testCase);
+ doStartTest(command, timeout);
});
};
_process.kill();
} else {
- doStartTest(testCase);
+ doStartTest(command, timeout);
}
+ return _completer.future;
}
Future terminate() {
if (_process == null) return new Future.value(true);
- Completer completer = new Completer();
+ Completer terminateCompleter = new Completer();
Timer killTimer;
_processExitHandler = (_) {
if (killTimer != null) killTimer.cancel();
- completer.complete(true);
+ terminateCompleter.complete(true);
};
- if (_isWebDriver) {
+ var shutdownCommand = batchRunnerTypes[_runnerType]['terminate_command'];
+ if (shutdownCommand != null && !shutdownCommand.isEmpty) {
// Use a graceful shutdown so our Selenium script can close
// the open browser processes. On Windows, signals do not exist
// and a kill is a hard kill.
- _process.stdin.writeln('--terminate');
+ _process.stdin.writeln(shutdownCommand.join(' '));
// In case the run_selenium process didn't close, kill it after 30s
killTimer = new Timer(new Duration(seconds: 30), _process.kill);
@@ -1180,26 +1297,20 @@
_process.kill();
}
- return completer.future;
+ return terminateCompleter.future;
}
- void doStartTest(TestCase testCase) {
+ void doStartTest(Command command, int timeout) {
_startTime = new DateTime.now();
_testStdout = [];
_testStderr = [];
_status = null;
_stdoutCompleter = new Completer();
_stderrCompleter = new Completer();
- _timer = new Timer(new Duration(seconds: testCase.timeout),
+ _timer = new Timer(new Duration(seconds: timeout),
_timeoutHandler);
- if (testCase.commands.last.environment != null) {
- print("Warning: command.environment != null, but we don't support custom "
- "environments for batch runner tests!");
- }
-
- var line = _createArgumentsLine(testCase.batchTestArguments,
- testCase.timeout);
+ var line = _createArgumentsLine(_arguments, timeout);
_process.stdin.write(line);
_stdoutSubscription.resume();
_stderrSubscription.resume();
@@ -1213,30 +1324,29 @@
}
void _reportResult() {
- if (!active) return;
+ if (!_currentlyRunning) return;
// _status == '>>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}'
var outcome = _status.split(" ")[2];
var exitCode = 0;
if (outcome == "CRASH") exitCode = CRASHING_BROWSER_EXITCODE;
if (outcome == "FAIL" || outcome == "TIMEOUT") exitCode = 1;
- new CommandOutput.fromCase(_currentTest,
- _command,
- exitCode,
- false,
- (outcome == "TIMEOUT"),
- _testStdout,
- _testStderr,
- new DateTime.now().difference(_startTime),
- false);
- var test = _currentTest;
- _currentTest = null;
- test.completed();
+ var output = createCommandOutput(_command,
+ exitCode,
+ (outcome == "TIMEOUT"),
+ _testStdout,
+ _testStderr,
+ new DateTime.now().difference(_startTime),
+ false);
+ assert(_completer != null);
+ _completer.complete(output);
+ _completer = null;
+ _currentlyRunning = false;
}
ExitCodeEvent makeExitHandler(String status) {
void handler(int exitCode) {
- if (active) {
+ if (_currentlyRunning) {
if (_timer != null) _timer.cancel();
_status = status;
_stdoutSubscription.cancel();
@@ -1255,7 +1365,17 @@
}
_startProcess(callback) {
- Future processFuture = io.Process.start(_executable, _batchArguments);
+ var executable = batchRunnerTypes[_runnerType]['run_executable'];
+ var arguments = batchRunnerTypes[_runnerType]['run_arguments'];
+ var environment = new Map.from(io.Platform.environment);
+ if (_processEnvironmentOverrides != null) {
+ for (var key in _processEnvironmentOverrides.keys) {
+ environment[key] = _processEnvironmentOverrides[key];
+ }
+ }
+ Future processFuture = io.Process.start(executable,
+ arguments,
+ environment: environment);
processFuture.then((io.Process p) {
_process = p;
@@ -1312,7 +1432,7 @@
}).catchError((e) {
// TODO(floitsch): should we try to report the stacktrace?
print("Process error:");
- print(" Command: $_executable ${_batchArguments.join(' ')}");
+ print(" Command: $executable ${arguments.join(' ')} ($_arguments)");
print(" Error: $e");
// If there is an error starting a batch process, chances are that
// it will always fail. So rather than re-trying a 1000+ times, we
@@ -1321,342 +1441,416 @@
return true;
});
}
+
+ bool _dictEquals(Map a, Map b) {
+ if (a == null) return b == null;
+ if (b == null) return false;
+ for (var key in a.keys) {
+ if (a[key] != b[key]) return false;
+ }
+ return true;
+ }
}
+
/**
- * ProcessQueue is the master control class, responsible for running all
- * the tests in all the TestSuites that have been registered. It includes
- * a rate-limited queue to run a limited number of tests in parallel,
- * a ProgressIndicator which prints output when tests are started and
- * and completed, and a summary report when all tests are completed,
- * and counters to determine when all of the tests in all of the test suites
- * have completed.
+ * [TestCaseEnqueuer] takes a list of TestSuites, generates TestCases and
+ * builds a dependency graph of all commands in every TestSuite.
*
- * Because multiple configurations may be run on each test suite, the
- * ProcessQueue contains a cache in which a test suite may record information
- * about its list of tests, and may retrieve that information when it is called
- * upon to enqueue its tests again.
+ * It will maintain three helper data structures
+ * - command2node: A mapping from a [Command] to a node in the dependency graph
+ * - command2testCases: A mapping from [Command] to all TestCases that it is
+ * part of.
+ * - remainingTestCases: A set of TestCases that were enqueued but are not
+ * finished
+ *
+ * [Command] and it's subclasses all have hashCode/operator== methods defined
+ * on them, so we can safely use them as keys in Map/Set objects.
*/
-class ProcessQueue {
- int _numProcesses = 0;
- int _maxProcesses;
- int _numBrowserProcesses = 0;
- int _maxBrowserProcesses;
- int _numFailedTests = 0;
- bool _allTestsWereEnqueued = false;
+class TestCaseEnqueuer {
+ final dgraph.Graph graph;
+ final Function _onTestCaseAdded;
- // Support for recording and replaying test commands.
- TestCaseRecorder _testCaseRecorder;
- TestCaseOutputArchive _testCaseOutputArchive;
+ final command2node = new Map<Command, dgraph.Node>();
+ final command2testCases = new Map<Command, List<TestCase>>();
+ final remainingTestCases = new Set<TestCase>();
- /** The number of tests we allow to actually fail before we stop retrying. */
- int _MAX_FAILED_NO_RETRY = 4;
- bool _verbose;
- bool _listTests;
- Function _allDone;
- Queue<TestCase> _tests;
- List<EventListener> _eventListener;
+ TestCaseEnqueuer(this.graph, this._onTestCaseAdded);
- // For dartc/selenium batch processing we keep a list of batch processes.
- Map<String, List<BatchRunnerProcess>> _batchProcesses;
+ void enqueueTestSuites(List<TestSuite> testSuites) {
+ void newTest(TestCase testCase) {
+ remainingTestCases.add(testCase);
- // Cache information about test cases per test suite. For multiple
- // configurations there is no need to repeatedly search the file
- // system, generate tests, and search test files for options.
- Map<String, List<TestInformation>> _testCache;
+ var lastNode;
+ for (var command in testCase.commands) {
+ // Make exactly *one* node in the dependency graph for every command.
+ // This ensures that we never have two commands c1 and c2 in the graph
+ // with "c1 == c2".
+ var node = command2node[command];
+ if (node == null) {
+ var requiredNodes = (lastNode != null) ? [lastNode] : [];
+ node = graph.newNode(command, requiredNodes);
+ command2node[command] = node;
+ command2testCases[command] = <TestCase>[];
+ }
+ // Keep mapping from command to all testCases that refer to it
+ command2testCases[command].add(testCase);
- Map<String, BrowserTestRunner> _browserTestRunners;
-
- /**
- * String indicating the browser used to run the tests. Empty if no browser
- * used.
- */
- String browserUsed = '';
-
- /**
- * Process running the selenium server .jar (only used for Safari and Opera
- * tests.)
- */
- io.Process _seleniumServer = null;
-
- /** True if we are in the process of starting the server. */
- bool _startingServer = false;
-
- /** True if we find that there is already a selenium jar running. */
- bool _seleniumAlreadyRunning = false;
-
- ProcessQueue(this._maxProcesses,
- this._maxBrowserProcesses,
- DateTime startTime,
- testSuites,
- this._eventListener,
- this._allDone,
- [bool verbose = false,
- bool listTests = false,
- this._testCaseRecorder,
- this._testCaseOutputArchive])
- : _verbose = verbose,
- _listTests = listTests,
- _tests = new Queue<TestCase>(),
- _batchProcesses = new Map<String, List<BatchRunnerProcess>>(),
- _testCache = new Map<String, List<TestInformation>>(),
- _browserTestRunners = new Map<String, BrowserTestRunner>() {
- _runTests(testSuites);
- }
-
- /**
- * Perform any cleanup needed once all tests in a TestSuite have completed
- * and notify our progress indicator that we are done.
- */
- void _cleanupAndMarkDone() {
- _allDone();
- if (browserUsed != '' && _seleniumServer != null) {
- _seleniumServer.kill();
- }
- eventAllTestsDone();
- }
-
- void _checkDone() {
- if (_allTestsWereEnqueued && _tests.isEmpty && _numProcesses == 0) {
- _terminateBatchRunners().then((_) {
- _terminateBrowserRunners().then((_) => _cleanupAndMarkDone());
- });
- }
- }
-
- void _runTests(List<TestSuite> testSuites) {
- var newTest;
- var allTestsKnown;
-
- if (_testCaseRecorder != null) {
- // Mode: recording.
- newTest = _testCaseRecorder.nextTestCase;
- allTestsKnown = () {
- // We don't call any event*() methods, so test_progress.dart will not be
- // notified (that's fine, since we're not running any tests).
- _testCaseRecorder.finish();
- _allDone();
- };
- } else {
- if (_testCaseOutputArchive != null) {
- // Mode: replaying.
- newTest = (TestCase testCase) {
- // We're doing this asynchronously to emulate the normal behaviour.
- eventTestAdded(testCase);
- Timer.run(() {
- var output = _testCaseOutputArchive.outputOf(testCase);
- testCase.completed();
- eventFinishedTestCase(testCase);
- });
- };
- allTestsKnown = () {
- // If we're replaying commands, we need to call [_cleanupAndMarkDone]
- // manually. We're putting it at the end of the event queue to make
- // sure all the previous events were fired.
- Timer.run(() => _cleanupAndMarkDone());
- };
- } else {
- // Mode: none (we're not recording/replaying).
- newTest = (TestCase testCase) {
- _tests.add(testCase);
- eventTestAdded(testCase);
- _runTest(testCase);
- };
- allTestsKnown = _checkDone;
+ lastNode = node;
}
+ _onTestCaseAdded(testCase);
}
- // FIXME: For some reason we cannot call this method on all test suites
- // in parallel.
- // If we do, not all tests get enqueued (if --arch=all was specified,
- // we don't get twice the number of tests [tested on -rvm -cnone])
- // Issue: 7927
+ // Cache information about test cases per test suite. For multiple
+ // configurations there is no need to repeatedly search the file
+ // system, generate tests, and search test files for options.
+ var testCache = new Map<String, List<TestInformation>>();
+
Iterator<TestSuite> iterator = testSuites.iterator;
void enqueueNextSuite() {
if (!iterator.moveNext()) {
- _allTestsWereEnqueued = true;
- allTestsKnown();
- eventAllTestsKnown();
+ // We're finished with building the dependency graph.
+ graph.sealGraph();
} else {
- iterator.current.forEachTest(newTest, _testCache, enqueueNextSuite);
+ iterator.current.forEachTest(newTest, testCache, enqueueNextSuite);
}
}
enqueueNextSuite();
}
+}
- /**
- * True if we are using a browser + platform combination that needs the
- * Selenium server jar.
- */
- bool get _needsSelenium => (io.Platform.operatingSystem == 'macos' &&
- browserUsed == 'safari') || browserUsed == 'opera';
- /** True if the Selenium Server is ready to be used. */
- bool get _isSeleniumAvailable => _seleniumServer != null ||
- _seleniumAlreadyRunning;
+/*
+ * [CommandEnqueuer] will
+ * - change node.state to NodeState.Enqueuing as soon as all dependencies have
+ * a state of NodeState.Successful
+ * - change node.state to NodeState.UnableToRun if one or more dependencies
+ * have a state of NodeState.Failed/NodeState.UnableToRun.
+ */
+class CommandEnqueuer {
+ static final INIT_STATES = [dgraph.NodeState.Initialized,
+ dgraph.NodeState.Waiting];
+ static final FINISHED_STATES = [dgraph.NodeState.Successful,
+ dgraph.NodeState.Failed,
+ dgraph.NodeState.UnableToRun];
+ final dgraph.Graph _graph;
- /**
- * Restart all the processes that have been waiting/stopped for the server to
- * start up. If we just call this once we end up with a single-"threaded" run.
- */
- void resumeTesting() {
- for (int i = 0; i < _maxProcesses; i++) _tryRunTest();
- }
+ CommandEnqueuer(this._graph) {
+ var eventCondition = _graph.events.where;
- /** Start the Selenium Server jar, if appropriate for this platform. */
- void _ensureSeleniumServerRunning() {
- if (!_isSeleniumAvailable && !_startingServer) {
- _startingServer = true;
+ eventCondition((e) => e is dgraph.NodeAddedEvent).listen((event) {
+ dgraph.Node node = event.node;
+ _changeNodeStateIfNecessary(node);
+ });
- // Check to see if the jar was already running before the program started.
- String cmd = 'ps';
- var arg = ['aux'];
- if (io.Platform.operatingSystem == 'windows') {
- cmd = 'tasklist';
- arg.add('/v');
- }
-
- Future processFuture = io.Process.start(cmd, arg);
- processFuture.then((io.Process p) {
- // Drain stderr to not leak resources.
- p.stderr.listen((_) {});
- final Stream<String> stdoutStringStream =
- p.stdout.transform(new io.StringDecoder())
- .transform(new io.LineTransformer());
- stdoutStringStream.listen((String line) {
- var regexp = new RegExp(r".*selenium-server-standalone.*");
- if (regexp.hasMatch(line)) {
- _seleniumAlreadyRunning = true;
- resumeTesting();
- }
- if (!_isSeleniumAvailable) {
- _startSeleniumServer();
- }
- });
- }).catchError((e) {
- // TODO(floitsch): should we try to report the stacktrace?
- print("Error starting process:");
- print(" Command: $cmd ${arg.join(' ')}");
- print(" Error: $e");
- // TODO(ahe): How to report this as a test failure?
- io.exit(1);
- return true;
- });
- }
- }
-
- void _runTest(TestCase test) {
- if (test.usesWebDriver) {
- browserUsed = test.configuration['runtime'];
- if (_needsSelenium) _ensureSeleniumServerRunning();
- }
- _tryRunTest();
- }
-
- /**
- * Monitor the output of the Selenium server, to know when we are ready to
- * begin running tests.
- * source: Output(Stream) from the Java server.
- */
- void seleniumServerHandler(String line) {
- if (new RegExp(r".*Started.*Server.*").hasMatch(line) ||
- new RegExp(r"Exception.*Selenium is already running.*").hasMatch(
- line)) {
- resumeTesting();
- }
- }
-
- /**
- * For browser tests using Safari or Opera, we need to use the Selenium 1.0
- * Java server.
- */
- void _startSeleniumServer() {
- // Get the absolute path to the Selenium jar.
- String filePath = TestUtils.testScriptPath;
- String pathSep = io.Platform.pathSeparator;
- int index = filePath.lastIndexOf(pathSep);
- filePath = '${filePath.substring(0, index)}${pathSep}testing${pathSep}';
- new io.Directory(filePath).list().listen((io.FileSystemEntity fse) {
- if (fse is io.File) {
- String file = fse.path;
- if (new RegExp(r"selenium-server-standalone-.*\.jar").hasMatch(file)
- && _seleniumServer == null) {
- Future processFuture = io.Process.start('java', ['-jar', file]);
- processFuture.then((io.Process server) {
- _seleniumServer = server;
- // Heads up: there seems to an obscure data race of some form in
- // the VM between launching the server process and launching the
- // test tasks that disappears when you read IO (which is
- // convenient, since that is our condition for knowing that the
- // server is ready).
- Stream<String> stdoutStringStream =
- _seleniumServer.stdout.transform(new io.StringDecoder())
- .transform(new io.LineTransformer());
- Stream<String> stderrStringStream =
- _seleniumServer.stderr.transform(new io.StringDecoder())
- .transform(new io.LineTransformer());
- stdoutStringStream.listen(seleniumServerHandler);
- stderrStringStream.listen(seleniumServerHandler);
- }).catchError((e) {
- // TODO(floitsch): should we try to report the stacktrace?
- print("Process error:");
- print(" Command: java -jar $file");
- print(" Error: $e");
- // TODO(ahe): How to report this as a test failure?
- io.exit(1);
- return true;
- });
+ eventCondition((e) => e is dgraph.StateChangedEvent).listen((event) {
+ if (event.from == dgraph.NodeState.Processing) {
+ assert(FINISHED_STATES.contains(event.to));
+ for (var dependendNode in event.node.neededFor) {
+ _changeNodeStateIfNecessary(dependendNode);
}
}
});
}
- Future _terminateBatchRunners() {
- var futures = new List();
- for (var runners in _batchProcesses.values) {
- for (var runner in runners) {
- futures.add(runner.terminate());
+ // Called when either a new node was added or if one of it's dependencies
+ // changed it's state.
+ void _changeNodeStateIfNecessary(dgraph.Node node) {
+ assert(INIT_STATES.contains(node.state));
+ bool allDependenciesFinished =
+ node.dependencies.every((node) => FINISHED_STATES.contains(node.state));
+
+ var newState = dgraph.NodeState.Waiting;
+ if (allDependenciesFinished) {
+ bool allDependenciesSuccessful = node.dependencies.every(
+ (dep) => dep.state == dgraph.NodeState.Successful);
+
+ if (allDependenciesSuccessful) {
+ newState = dgraph.NodeState.Enqueuing;
+ } else {
+ newState = dgraph.NodeState.UnableToRun;
}
}
- // Change to Future.wait when updating binaries.
- return Future.wait(futures);
- }
-
- Future _terminateBrowserRunners() {
- var futures = [];
- for (BrowserTestRunner runner in _browserTestRunners.values) {
- futures.add(runner.terminate());
+ if (node.state != newState) {
+ _graph.changeState(node, newState);
}
- return Future.wait(futures);
+ }
+}
+
+/*
+ * [CommandQueue] will listen for nodes entering the NodeState.ENQUEUING state,
+ * queue them up and run them. While nodes are processed they will be in the
+ * NodeState.PROCESSING state. After running a command, the node will change
+ * to a state of NodeState.Successfull or NodeState.Failed.
+ *
+ * It provides a synchronous stream [completedCommands] which provides the
+ * [CommandOutputs] for the finished commands.
+ *
+ * It provides a [done] future, which will complete once there are no more
+ * nodes left in the states Initialized/Waiting/Enqueing/Processing
+ * and the [executor] has cleaned up it's resources.
+ */
+class CommandQueue {
+ final dgraph.Graph graph;
+ final CommandExecutor executor;
+ final TestCaseEnqueuer enqueuer;
+
+ final Queue<Command> _runQueue = new Queue<Command>();
+ final _commandOutputStream = new StreamController<CommandOutput>(sync: true);
+ final _completer = new Completer();
+
+ int _numProcesses = 0;
+ int _maxProcesses;
+ int _numBrowserProcesses = 0;
+ int _maxBrowserProcesses;
+ bool _finishing = false;
+ bool _verbose = false;
+
+ CommandQueue(this.graph, this.enqueuer, this.executor,
+ this._maxProcesses, this._maxBrowserProcesses, this._verbose) {
+ var eventCondition = graph.events.where;
+ eventCondition((event) => event is dgraph.StateChangedEvent)
+ .listen((event) {
+ if (event.to == dgraph.NodeState.Enqueuing) {
+ assert(event.from == dgraph.NodeState.Initialized ||
+ event.from == dgraph.NodeState.Waiting);
+ graph.changeState(event.node, dgraph.NodeState.Processing);
+ var command = event.node.userData;
+ if (event.node.dependencies.length > 0) {
+ _runQueue.addFirst(command);
+ } else {
+ _runQueue.add(command);
+ }
+ Timer.run(() => _tryRunNextCommand());
+ }
+ });
+ // We're finished if the graph is sealed and all nodes are in a finished
+ // state (Successfull, Failed or UnableToRun).
+ // So we're calling '_checkDone()' to check whether that condition is met
+ // and we can cleanup.
+ graph.events.listen((dgraph.GraphEvent event) {
+ if (event is dgraph.GraphSealedEvent) {
+ _checkDone();
+ } else if (event is dgraph.StateChangedEvent) {
+ if (event.to == dgraph.NodeState.UnableToRun) {
+ _checkDone();
+ }
+ }
+ });
}
- BatchRunnerProcess _getBatchRunner(TestCase test) {
+ Stream<CommandOutput> get completedCommands => _commandOutputStream.stream;
+
+ Future get done => _completer.future;
+
+ void _tryRunNextCommand() {
+ _checkDone();
+
+ if (_numProcesses < _maxProcesses && !_runQueue.isEmpty) {
+ Command command = _runQueue.removeFirst();
+ var isBrowserCommand =
+ command is SeleniumTestCommand ||
+ command is BrowserTestCommand;
+
+ if (isBrowserCommand && _numBrowserProcesses == _maxBrowserProcesses) {
+ // If there is no free browser runner, put it back into the queue.
+ _runQueue.add(command);
+ // Don't lose a process.
+ new Timer(new Duration(milliseconds: 100), _tryRunNextCommand);
+ return;
+ }
+
+ _numProcesses++;
+ if (isBrowserCommand) _numBrowserProcesses++;
+
+ var node = enqueuer.command2node[command];
+ Iterable<TestCase> testCases = enqueuer.command2testCases[command];
+ // If a command is part of many TestCases we set the timeout to be
+ // the maximum over all [TestCase.timeout]s. At some point, we might
+ // eliminate [TestCase.timeout] completely and move it to [Command].
+ int timeout = testCases.map((TestCase test) => test.timeout)
+ .fold(0, math.max);
+
+ if (_verbose) {
+ print('Running "${command.displayName}" command: $command');
+ }
+
+ executor.runCommand(node, command, timeout).then((CommandOutput output) {
+ assert(command == output.command);
+
+ _commandOutputStream.add(output);
+ if (output.canRunDependendCommands) {
+ graph.changeState(node, dgraph.NodeState.Successful);
+ } else {
+ graph.changeState(node, dgraph.NodeState.Failed);
+ }
+
+ _numProcesses--;
+ if (isBrowserCommand) _numBrowserProcesses--;
+
+ // Don't loose a process
+ Timer.run(() => _tryRunNextCommand());
+ });
+ }
+ }
+
+ void _checkDone() {
+ if (!_finishing &&
+ _runQueue.isEmpty &&
+ _numProcesses == 0 &&
+ graph.isSealed &&
+ graph.stateCount(dgraph.NodeState.Initialized) == 0 &&
+ graph.stateCount(dgraph.NodeState.Waiting) == 0 &&
+ graph.stateCount(dgraph.NodeState.Enqueuing) == 0 &&
+ graph.stateCount(dgraph.NodeState.Processing) == 0) {
+ _finishing = true;
+ executor.cleanup().then((_) {
+ _completer.complete();
+ _commandOutputStream.close();
+ });
+ }
+ }
+}
+
+
+/*
+ * [CommandExecutor] is responsible for executing commands. It will make sure
+ * that the the following two constraints are satisfied
+ * - [:numberOfProcessesUsed <= maxProcesses:]
+ * - [:numberOfBrowserProcessesUsed <= maxBrowserProcesses:]
+ *
+ * It provides a [runCommand] method which will complete with a
+ * [CommandOutput] object.
+ *
+ * It provides a [cleanup] method to free all the allocated resources.
+ */
+abstract class CommandExecutor {
+ Future cleanup();
+ // TODO(kustermann): The [timeout] parameter should be a property of Command
+ Future<CommandOutput> runCommand(
+ dgraph.Node node, Command command, int timeout);
+}
+
+class CommandExecutorImpl implements CommandExecutor {
+ final Map globalConfiguration;
+ final int maxProcesses;
+ final int maxBrowserProcesses;
+
+ // For dartc/selenium batch processing we keep a list of batch processes.
+ final _batchProcesses = new Map<String, List<BatchRunnerProcess>>();
+ // For browser tests we keepa [BrowserTestRunner]
+ final _browserTestRunners = new Map<String, BrowserTestRunner>();
+
+ bool _finishing = false;
+
+ CommandExecutorImpl(
+ this.globalConfiguration, this.maxProcesses, this.maxBrowserProcesses);
+
+ Future cleanup() {
+ assert(!_finishing);
+ _finishing = true;
+
+ Future _terminateBatchRunners() {
+ var futures = [];
+ for (var runners in _batchProcesses.values) {
+ futures.addAll(runners.map((runner) => runner.terminate()));
+ }
+ return Future.wait(futures);
+ }
+
+ Future _terminateBrowserRunners() {
+ var futures =
+ _browserTestRunners.values.map((runner) => runner.terminate());
+ return Future.wait(futures);
+ }
+
+ return Future.wait([_terminateBatchRunners(), _terminateBrowserRunners()]);
+ }
+
+ Future<CommandOutput> runCommand(node, Command command, int timeout) {
+ assert(!_finishing);
+
+ Future<CommandOutput> runCommand(int retriesLeft) {
+ return _runCommand(command, timeout).then((CommandOutput output) {
+ if (!output.canRunDependendCommands && retriesLeft > 0) {
+ DebugLogger.warning("Rerunning Command: ($retriesLeft "
+ "attempt(s) remains) [cmd: $command]");
+ return runCommand(retriesLeft - 1);
+ } else {
+ return new Future.value(output);
+ }
+ });
+ }
+ return runCommand(command.numRetries);
+ }
+
+ Future<CommandOutput> _runCommand(Command command, int timeout) {
+ var batchMode = !globalConfiguration['noBatch'];
+
+ if (command is BrowserTestCommand) {
+ return _startBrowserControllerTest(command, timeout);
+ } else if (command is SeleniumTestCommand && batchMode) {
+ var arguments = ['--force-refresh', '--browser=${command.browser}',
+ '--timeout=${timeout}', '--out', '${command.url}'];
+ return _getBatchRunner(command.browser)
+ .runCommand('selenium', command, timeout, arguments);
+ } else if (command is AnalysisCommand && batchMode) {
+ return _getBatchRunner(command.flavor)
+ .runCommand(command.flavor, command, timeout, command.arguments);
+ } else {
+ return new RunningProcess(command, timeout).run();
+ }
+ }
+
+ BatchRunnerProcess _getBatchRunner(String identifier) {
// Start batch processes if needed
- var compiler = test.configuration['compiler'];
- var runners = _batchProcesses[compiler];
+ var runners = _batchProcesses[identifier];
if (runners == null) {
- runners = new List<BatchRunnerProcess>(_maxProcesses);
- for (int i = 0; i < _maxProcesses; i++) {
- runners[i] = new BatchRunnerProcess(test);
+ runners = new List<BatchRunnerProcess>(maxProcesses);
+ for (int i = 0; i < maxProcesses; i++) {
+ runners[i] = new BatchRunnerProcess();
}
- _batchProcesses[compiler] = runners;
+ _batchProcesses[identifier] = runners;
}
for (var runner in runners) {
- if (!runner.active) return runner;
+ if (!runner._currentlyRunning) return runner;
}
throw new Exception('Unable to find inactive batch runner.');
}
- Future<BrowserTestRunner> _getBrowserTestRunner(TestCase test) {
- var local_ip = test.configuration['local_ip'];
- var runtime = test.configuration['runtime'];
- var num_browsers = _maxBrowserProcesses;
- if (_browserTestRunners[runtime] == null) {
+ Future<CommandOutput> _startBrowserControllerTest(
+ BrowserTestCommand browserCommand, int timeout) {
+ var completer = new Completer<CommandOutput>();
+
+ var callback = (var output, var duration) {
+ var commandOutput = createCommandOutput(browserCommand,
+ 0,
+ output == "TIMEOUT",
+ encodeUtf8(output),
+ [],
+ duration,
+ false);
+ completer.complete(commandOutput);
+ };
+ BrowserTest browserTest = new BrowserTest(browserCommand.url,
+ callback,
+ timeout);
+ _getBrowserTestRunner(browserCommand.browser).then((testRunner) {
+ testRunner.queueTest(browserTest);
+ });
+
+ return completer.future;
+ }
+
+ Future<BrowserTestRunner> _getBrowserTestRunner(String browser) {
+ var local_ip = globalConfiguration['local_ip'];
+ var num_browsers = maxBrowserProcesses;
+ if (_browserTestRunners[browser] == null) {
var testRunner =
- new BrowserTestRunner(local_ip, runtime, num_browsers);
+ new BrowserTestRunner(local_ip, browser, num_browsers);
testRunner.logger = DebugLogger.info;
- _browserTestRunners[runtime] = testRunner;
+ _browserTestRunners[browser] = testRunner;
return testRunner.start().then((started) {
if (started) {
return testRunner;
@@ -1665,251 +1859,228 @@
io.exit(1);
});
}
- return new Future.value(_browserTestRunners[runtime]);
+ return new Future.value(_browserTestRunners[browser]);
+ }
+}
+
+class RecordingCommandExecutor implements CommandExecutor {
+ TestCaseRecorder _recorder;
+
+ RecordingCommandExecutor(io.Path path)
+ : _recorder = new TestCaseRecorder(path);
+
+ Future<CommandOutput> runCommand(node, Command command, int timeout) {
+ assert(node.dependencies.length == 0);
+ assert(_cleanEnvironmentOverrides(command.environmentOverrides));
+ _recorder.nextCommand(command, timeout);
+ // Return dummy CommandOutput
+ var output =
+ createCommandOutput(command, 0, false, [], [], const Duration(), false);
+ return new Future.value(output);
}
- void _startBrowserControllerTest(var test) {
- var callback = (var output, var duration) {
- var nextCommandIndex = test.commandOutputs.keys.length;
- new CommandOutput.fromCase(test,
- test.commands[nextCommandIndex],
- 0,
- false,
- output == "TIMEOUT",
- encodeUtf8(output),
- [],
- duration,
- false);
- test.completedHandler(test);
- };
- BrowserTest browserTest = new BrowserTest(test.testingUrl,
- callback,
- test.timeout);
- _getBrowserTestRunner(test).then((testRunner) {
- testRunner.queueTest(browserTest);
+ Future cleanup() {
+ _recorder.finish();
+ return new Future.value();
+ }
+
+ // Returns [:true:] if the environment contains only 'DART_CONFIGURATION'
+ bool _cleanEnvironmentOverrides(Map environment) {
+ if (environment == null) return true;
+ return environment.length == 0 ||
+ (environment.length == 1 &&
+ environment.containsKey("DART_CONFIGURATION"));
+
+ }
+}
+
+class ReplayingCommandExecutor implements CommandExecutor {
+ TestCaseOutputArchive _archive = new TestCaseOutputArchive();
+
+ ReplayingCommandExecutor(io.Path path) {
+ _archive.loadFromPath(path);
+ }
+
+ Future cleanup() => new Future.value();
+
+ Future<CommandOutput> runCommand(node, Command command, int timeout) {
+ assert(node.dependencies.length == 0);
+ return new Future.value(_archive.outputOf(command));
+ }
+}
+
+
+/*
+ * [TestCaseCompleter] will listen for
+ * NodeState.Processing -> NodeState.{Successfull,Failed} state changes and
+ * will complete a TestCase if it is finished.
+ *
+ * It provides a stream [finishedTestCases], which will stream all TestCases
+ * once they're finished. After all TestCases are done, the stream will be
+ * closed.
+ */
+class TestCaseCompleter {
+ static final COMPLETED_STATES = [dgraph.NodeState.Failed,
+ dgraph.NodeState.Successful];
+ final dgraph.Graph graph;
+ final TestCaseEnqueuer enqueuer;
+ final CommandQueue commandQueue;
+
+ Map<Command, CommandOutput> _outputs = new Map<Command, CommandOutput>();
+ bool _closed = false;
+ StreamController<TestCase> _controller = new StreamController<TestCase>();
+
+ TestCaseCompleter(this.graph, this.enqueuer, this.commandQueue) {
+ var eventCondition = graph.events.where;
+
+ // Store all the command outputs -- they will be delivered synchronously
+ // (i.e. before state changes in the graph)
+ commandQueue.completedCommands.listen((CommandOutput output) {
+ _outputs[output.command] = output;
+ });
+
+ // Listen for NodeState.Processing -> NodeState.{Successfull,Failed}
+ // changes.
+ eventCondition((event) => event is dgraph.StateChangedEvent)
+ .listen((dgraph.StateChangedEvent event) {
+ if (event.from == dgraph.NodeState.Processing) {
+ assert(COMPLETED_STATES.contains(event.to));
+ _completeTestCasesIfPossible(event.node.userData);
+
+ if (!_closed &&
+ graph.isSealed &&
+ enqueuer.remainingTestCases.isEmpty) {
+ _controller.close();
+ _closed = true;
+ }
+ }
+ });
+
+ // Listen also for GraphSealedEvent's. If there is not a single node in the
+ // graph, we still want to finish after the graph was sealed.
+ eventCondition((event) => event is dgraph.GraphSealedEvent)
+ .listen((dgraph.GraphSealedEvent event) {
+ if (!_closed && enqueuer.remainingTestCases.isEmpty) {
+ _controller.close();
+ _closed = true;
+ }
});
}
- void _tryRunTest() {
- _checkDone();
- // TODO(ricow): remove most of the hacked selenium code below when
- // we have eliminated the need.
+ Stream<TestCase> get finishedTestCases => _controller.stream;
- if (_numProcesses < _maxProcesses && !_tests.isEmpty) {
- TestCase test = _tests.removeFirst();
- if (_listTests) {
- var fields = [test.displayName,
- test.expectedOutcomes.join(','),
- test.isNegative.toString()];
- fields.addAll(test.commands.last.arguments);
- print(fields.join('\t'));
- return;
- }
+ void _completeTestCasesIfPossible(Command command) {
+ assert(_outputs[command] != null);
- if (test.usesWebDriver && _needsSelenium && !test.usesBrowserController
- && !_isSeleniumAvailable ||
- (test is BrowserTestCase && test.waitingForOtherTest)) {
- // The test is not yet ready to run. Put the test back in
- // the queue. Avoid spin-polling by using a timeout.
- _tests.add(test);
- new Timer(new Duration(milliseconds: 100),
- _tryRunTest); // Don't lose a process.
- return;
- }
- // Before running any commands, we print out all commands if '--verbose'
- // was specified.
- if (_verbose && test.commandOutputs.length == 0) {
- int i = 1;
- if (test is BrowserTestCase) {
- // Additional command for rerunning the steps locally after the fact.
- var command =
- test.configuration["_servers_"].httpServerCommandline();
- print('$i. $command');
- i++;
- }
- for (Command command in test.commands) {
- print('$i. $command');
- i++;
+ var testCases = enqueuer.command2testCases[command];
+
+ // Update TestCases with command outputs
+ for (TestCase test in testCases) {
+ for (var icommand in test.commands) {
+ var output = _outputs[icommand];
+ if (output != null) {
+ test.commandOutputs[icommand] = output;
}
}
+ }
- var isLastCommand =
- ((test.commands.length-1) == test.commandOutputs.length);
- var isBrowserCommand = isLastCommand && (test is BrowserTestCase);
- if (isBrowserCommand && _numBrowserProcesses == _maxBrowserProcesses) {
- // If there is no free browser runner, put it back into the queue.
- _tests.add(test);
- new Timer(new Duration(milliseconds: 100),
- _tryRunTest); // Don't lose a process.
- return;
- }
-
- eventStartTestCase(test);
-
- // Analyzer and browser test commands can be run by a [BatchRunnerProcess]
- var nextCommandIndex = test.commandOutputs.keys.length;
- var numberOfCommands = test.commands.length;
-
- var useBatchRunnerForAnalyzer =
- test.configuration['analyzer'] &&
- test.displayName != 'dartc/junit_tests';
- var isWebdriverCommand = nextCommandIndex == (numberOfCommands - 1) &&
- test.usesWebDriver &&
- !test.configuration['noBatch'];
- if (useBatchRunnerForAnalyzer || isWebdriverCommand) {
- TestCaseEvent oldCallback = test.completedHandler;
- void testCompleted(TestCase test_arg) {
- _numProcesses--;
- if (isBrowserCommand) {
- _numBrowserProcesses--;
- }
- eventFinishedTestCase(test_arg);
- if (test_arg is BrowserTestCase) {
- (test_arg as BrowserTestCase).notifyObservers();
- }
- oldCallback(test_arg);
- _tryRunTest();
- };
- test.completedHandler = testCompleted;
- if (test.usesBrowserController) {
- _startBrowserControllerTest(test);
- } else {
- _getBatchRunner(test).startTest(test);
- }
+ void completeTestCase(TestCase testCase) {
+ if (enqueuer.remainingTestCases.contains(testCase)) {
+ _controller.add(testCase);
+ enqueuer.remainingTestCases.remove(testCase);
} else {
- // Once we've actually failed a test, technically, we wouldn't need to
- // bother retrying any subsequent tests since the bot is already red.
- // However, we continue to retry tests until we have actually failed
- // four tests (arbitrarily chosen) for more debugable output, so that
- // the developer doesn't waste his or her time trying to fix a bunch of
- // tests that appear to be broken but were actually just flakes that
- // didn't get retried because there had already been one failure.
- bool allowRetry = _MAX_FAILED_NO_RETRY > _numFailedTests;
- runNextCommandWithRetries(test, allowRetry).then((TestCase testCase) {
- _numProcesses--;
- if (isBrowserCommand) {
- _numBrowserProcesses--;
- }
- if (isTestCaseFinished(testCase)) {
- testCase.completed();
- eventFinishedTestCase(testCase);
- if (testCase is BrowserTestCase) {
- (testCase as BrowserTestCase).notifyObservers();
- }
- } else {
- _tests.addFirst(testCase);
- }
- _tryRunTest();
- });
+ DebugLogger.error("${testCase.displayName} would be finished twice");
}
+ }
- _numProcesses++;
- if (isBrowserCommand) {
- _numBrowserProcesses++;
+ for (var testCase in testCases) {
+ // Ask the [testCase] if it's done. Note that we assume, that
+ // [TestCase.isFinished] will return true if all commands were executed
+ // or if a previous one failed.
+ if (testCase.isFinished) {
+ completeTestCase(testCase);
}
}
}
+}
- bool isTestCaseFinished(TestCase testCase) {
- var numberOfCommandOutputs = testCase.commandOutputs.keys.length;
- var numberOfCommands = testCase.commands.length;
- var lastCommandCompleted = (numberOfCommandOutputs == numberOfCommands);
- var lastCommandOutput = testCase.lastCommandOutput;
- var lastCommand = lastCommandOutput.command;
- var timedOut = lastCommandOutput.hasTimedOut;
- var nonZeroExitCode = lastCommandOutput.exitCode != 0;
- // NOTE: If this was the last command or there was unexpected output
- // we're done with the test.
- // Otherwise we need to enqueue it again into the test queue.
- if (lastCommandCompleted || timedOut || nonZeroExitCode) {
- var verbose = testCase.configuration['verbose'];
- if (lastCommandOutput.unexpectedOutput && verbose != null && verbose) {
- print(testCase.displayName);
- print("stderr:");
- print(decodeUtf8(lastCommandOutput.stderr));
- if (!lastCommand.isPixelTest) {
- print("stdout:");
- print(decodeUtf8(lastCommandOutput.stdout));
- } else {
- print("");
- print("DRT pixel test failed! stdout is not printed because it "
- "contains binary data!");
- }
- }
- return true;
+class ProcessQueue {
+ Map _globalConfiguration;
+
+ bool _allTestsWereEnqueued = false;
+
+ bool _listTests;
+ Function _allDone;
+ final dgraph.Graph _graph = new dgraph.Graph();
+ List<EventListener> _eventListener;
+
+ ProcessQueue(this._globalConfiguration,
+ maxProcesses,
+ maxBrowserProcesses,
+ DateTime startTime,
+ testSuites,
+ this._eventListener,
+ this._allDone,
+ [bool verbose = false,
+ this._listTests = false,
+ String recordingOutputFile,
+ String recordedInputFile]) {
+ bool recording = recordingOutputFile != null;
+ bool replaying = recordedInputFile != null;
+
+ // When the graph building is finished, notify event listeners.
+ _graph.events
+ .where((event) => event is dgraph.GraphSealedEvent).listen((event) {
+ eventAllTestsKnown();
+ });
+
+ // Build up the dependency graph
+ var testCaseEnqueuer = new TestCaseEnqueuer(_graph, (TestCase newTestCase) {
+ eventTestAdded(newTestCase);
+ });
+
+ // Queue commands as they become "runnable"
+ var commandEnqueuer = new CommandEnqueuer(_graph);
+
+ // CommandExecutor will execute commands
+ var executor;
+ if (recording) {
+ executor = new RecordingCommandExecutor(new io.Path(recordingOutputFile));
+ } else if (replaying) {
+ executor = new ReplayingCommandExecutor(new io.Path(recordedInputFile));
} else {
- return false;
+ executor = new CommandExecutorImpl(
+ _globalConfiguration, maxProcesses, maxBrowserProcesses);
}
- }
- Future runNextCommandWithRetries(TestCase testCase, bool allowRetry) {
- var completer = new Completer();
+ // Run "runnable commands" using [executor] subject to
+ // maxProcesses/maxBrowserProcesses constraint
+ var commandQueue = new CommandQueue(
+ _graph, testCaseEnqueuer, executor, maxProcesses, maxBrowserProcesses,
+ verbose);
- var nextCommandIndex = testCase.commandOutputs.keys.length;
- var numberOfCommands = testCase.commands.length;
- if (nextCommandIndex >= numberOfCommands) {
- throw "nextCommandIndex must be less than numberOfCommands";
- }
- var command = testCase.commands[nextCommandIndex];
- var isLastCommand = nextCommandIndex == (numberOfCommands - 1);
-
- void runCommand() {
- var runningProcess = new RunningProcess(testCase, command);
- runningProcess.start().then((CommandOutput commandOutput) {
- if (isLastCommand) {
- // NOTE: We need to call commandOutput.unexpectedOutput here.
- // Calling this getter may result in the side-effect, that
- // commandOutput.requestRetry is set to true.
- // (BrowserCommandOutputImpl._failedBecauseOfMissingXDisplay
- // does that for example)
- // TODO(ricow/kustermann): Issue 8206
- var unexpectedOutput = commandOutput.unexpectedOutput;
- if (unexpectedOutput && allowRetry) {
- if (testCase.usesWebDriver
- && (testCase as BrowserTestCase).numRetries > 0) {
- // Selenium tests can be flaky. Try rerunning.
- commandOutput.requestRetry = true;
- }
- // FIXME(kustermann): Remove this condition once we figured out why
- // content_shell is sometimes not able to fetch resources from the
- // HttpServer.
- var configuration = testCase.configuration;
- if (configuration['runtime'] == 'drt' &&
- configuration['system'] == 'windows' &&
- (testCase as BrowserTestCase).numRetries > 0) {
- assert(TestUtils.isBrowserRuntime(configuration['runtime']));
- commandOutput.requestRetry = true;
- }
- }
+ // Finish test cases when all commands were run (or some failed)
+ var testCaseCompleter =
+ new TestCaseCompleter(_graph, testCaseEnqueuer, commandQueue);
+ testCaseCompleter.finishedTestCases.listen(
+ (TestCase finishedTestCase) {
+ // If we're recording, we don't report any TestCases to listeners.
+ if (!recording) {
+ eventFinishedTestCase(finishedTestCase);
}
- if (commandOutput.requestRetry) {
- commandOutput.requestRetry = false;
- (testCase as BrowserTestCase).numRetries--;
- DebugLogger.warning("Rerunning Test: ${testCase.displayName} "
- "(${(testCase as BrowserTestCase).numRetries} "
- "attempt(s) remains) [cmd:$command]");
- runCommand();
- } else {
- completer.complete(testCase);
- }
+ },
+ onDone: () {
+ // Wait until the commandQueue/execturo is done (it may need to stop
+ // batch runners, browser controllers, ....)
+ commandQueue.done.then((_) => eventAllTestsDone());
});
- }
- runCommand();
- return completer.future;
- }
-
- void eventStartTestCase(TestCase testCase) {
- for (var listener in _eventListener) {
- listener.start(testCase);
- }
+ // Start enqueing all TestCases
+ testCaseEnqueuer.enqueueTestSuites(testSuites);
}
void eventFinishedTestCase(TestCase testCase) {
- if (testCase.lastCommandOutput.unexpectedOutput) {
- _numFailedTests++;
- }
for (var listener in _eventListener) {
listener.done(testCase);
}
@@ -1931,6 +2102,6 @@
for (var listener in _eventListener) {
listener.allDone();
}
+ _allDone();
}
}
-
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 5130abe..4f62e29 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -27,7 +27,6 @@
part "browser_test.dart";
-// TODO(rnystrom): Add to dart:core?
/**
* A simple function that tests [arg] and returns `true` or `false`.
*/
@@ -110,6 +109,10 @@
TestSuite(this.configuration, this.suiteName);
+ String get configurationDir {
+ return TestUtils.configurationDir(configuration);
+ }
+
/**
* Whether or not binaries should be found in the root build directory or
* in the built SDK.
@@ -307,7 +310,7 @@
String hostRunnerPath;
final String dartDir;
List<String> statusFilePaths;
- TestCaseEvent doTest;
+ Function doTest;
VoidFunction doDone;
ReceivePort receiveTestName;
TestExpectations testExpectations;
@@ -357,16 +360,17 @@
var args = TestUtils.standardOptions(configuration);
args.add(testName);
+ var command = CommandBuilder.instance.getCommand(
+ 'run_vm_unittest', targetRunnerPath, args, configurationDir);
doTest(
new TestCase(constructedName,
- [new Command('run_vm_unittest', targetRunnerPath, args)],
+ [command],
configuration,
- completeHandler,
expectations));
}
}
- void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) {
+ void forEachTest(Function onTest, Map testCache, [VoidFunction onDone]) {
doTest = onTest;
doDone = onDone;
@@ -389,9 +393,6 @@
statusFileRead);
}
}
-
- void completeHandler(TestCase testCase) {
- }
}
@@ -419,7 +420,7 @@
class StandardTestSuite extends TestSuite {
final Path suiteDir;
final List<String> statusFilePaths;
- TestCaseEvent doTest;
+ Function doTest;
TestExpectations testExpectations;
List<TestInformation> cachedTests;
final Path dartDir;
@@ -505,7 +506,7 @@
List<String> additionalOptions(Path filePath) => [];
- void forEachTest(TestCaseEvent onTest, Map testCache, [VoidFunction onDone]) {
+ void forEachTest(Function onTest, Map testCache, [VoidFunction onDone]) {
updateDartium().then((_) {
doTest = onTest;
@@ -743,7 +744,6 @@
doTest(new TestCase('$suiteName/$testName',
makeCommands(info, allVmOptions, commonArguments),
configuration,
- completeHandler,
expectations,
isNegative: isNegative,
info: info));
@@ -758,21 +758,20 @@
String tempDir = createOutputDirectory(info.filePath, '');
args.add('--out=$tempDir/out.js');
- List<Command> commands =
- <Command>[new CompilationCommand(compiler,
- "$tempDir/out.js",
- !useSdk,
- dart2JsBootstrapDependencies,
- compilerPath,
- args)];
+ var command = CommandBuilder.instance.getCompilationCommand(
+ compiler, "$tempDir/out.js", !useSdk,
+ dart2JsBootstrapDependencies, compilerPath, args, configurationDir);
+
+ List<Command> commands = <Command>[command];
if (info.hasCompileError) {
// Do not attempt to run the compiled result. A compilation
// error should be reported by the compilation command.
} else if (configuration['runtime'] == 'd8') {
- commands.add(new Command("d8", d8FileName, ['$tempDir/out.js']));
+ commands.add(CommandBuilder.instance.getCommand(
+ "d8", d8FileName, ['$tempDir/out.js'], configurationDir));
} else if (configuration['runtime'] == 'jsshell') {
- commands.add(
- new Command("jsshell", jsShellFileName, ['$tempDir/out.js']));
+ commands.add(CommandBuilder.instance.getCommand(
+ "jsshell", jsShellFileName, ['$tempDir/out.js'], configurationDir));
}
return commands;
@@ -783,12 +782,10 @@
args.add('--out=$tempDir/out.dart');
List<Command> commands =
- <Command>[new CompilationCommand(compiler,
- "$tempDir/out.dart",
- !useSdk,
- dart2JsBootstrapDependencies,
- compilerPath,
- args)];
+ <Command>[CommandBuilder.instance.getCompilationCommand(
+ compiler, "$tempDir/out.dart", !useSdk,
+ dart2JsBootstrapDependencies, compilerPath, args,
+ configurationDir)];
if (info.hasCompileError) {
// Do not attempt to run the compiled result. A compilation
// error should be reported by the compilation command.
@@ -797,21 +794,24 @@
var vmArguments = new List.from(vmOptions);
vmArguments.addAll([
'--ignore-unrecognized-flags', '$tempDir/out.dart']);
- commands.add(new Command("vm", vmFileName, vmArguments));
+ commands.add(CommandBuilder.instance.getCommand(
+ "vm", vmFileName, vmArguments, configurationDir));
} else {
throw 'Unsupported runtime ${configuration["runtime"]} for dart2dart';
}
return commands;
case 'none':
- case 'dartanalyzer':
- case 'dart2analyzer':
- var displayName = (configuration['compiler'] == 'none'
- ? 'vm' : configuration['compiler']);
var arguments = new List.from(vmOptions);
arguments.addAll(args);
- return <Command>[
- new Command(displayName, dartShellFileName, arguments)];
+ return <Command>[CommandBuilder.instance.getCommand(
+ 'vm', dartShellFileName, arguments, configurationDir)];
+
+ case 'dartanalyzer':
+ case 'dart2analyzer':
+ return <Command>[CommandBuilder.instance.getAnalysisCommand(
+ compiler, dartShellFileName, args, configurationDir,
+ flavor: compiler)];
default:
throw 'Unknown compiler ${configuration["compiler"]}';
@@ -903,7 +903,6 @@
dartWrapper.closeSync();
}
-
/**
* The [StandardTestSuite] has support for tests that
* compile a test from Dart to JavaScript, and then run the resulting
@@ -1011,17 +1010,10 @@
// Variables for browser multi-tests.
List<String> subtestNames = info.optionsFromFile['subtestNames'];
- BrowserTestCase multitestParentTest;
int subtestIndex = 0;
// Construct the command that executes the browser test
do {
List<Command> commandSet = new List<Command>.from(commands);
- if (subtestIndex != 0) {
- // NOTE: The first time we enter this loop, all the compilation
- // commands will be executed. On subsequent loop iterations, we
- // don't need to do any compilations. Thus we set "commandSet = []".
- commandSet = [];
- }
var htmlPath_subtest = _createUrlPathFromFile(new Path(htmlPath));
var fullHtmlPath = _getUriForBrowserTest(info, htmlPath_subtest,
@@ -1035,9 +1027,9 @@
args = ['tools/testing/dart/launch_browser.dart',
runtime,
fullHtmlPath];
- commandSet.add(new Command(runtime,
- TestUtils.dartTestExecutable.toString(),
- args));
+ commandSet.add(CommandBuilder.instance.getBrowserTestCommand(
+ runtime, fullHtmlPath,
+ TestUtils.dartTestExecutable.toString(), args, configurationDir));
} else if (TestUtils.usesWebDriver(runtime)) {
args = [
dartDir.append('tools/testing/run_selenium.py').toNativePath(),
@@ -1051,12 +1043,10 @@
if (subtestIndex != 0) {
args.add('--force-refresh');
}
- commandSet.add(new Command(runtime, 'python', args));
+ commandSet.add(CommandBuilder.instance.getSeleniumTestCommand(
+ runtime, fullHtmlPath, 'python', args, configurationDir));
} else {
- if (runtime != "drt") {
- print("Unknown runtime $runtime");
- exit(1);
- }
+ assert(runtime == "drt");
var dartFlags = [];
var contentShellOptions = [];
@@ -1080,11 +1070,9 @@
fullHtmlPath = "${fullHtmlPath}'-p";
}
}
- commandSet.add(new ContentShellCommand(contentShellFilename,
- fullHtmlPath,
- contentShellOptions,
- dartFlags,
- expectedOutput));
+ commandSet.add(CommandBuilder.instance.getContentShellCommand(
+ contentShellFilename, fullHtmlPath, contentShellOptions,
+ dartFlags, expectedOutput, configurationDir));
}
// Create BrowserTestCase and queue it.
@@ -1093,20 +1081,13 @@
if (info.optionsFromFile['isMultiHtmlTest']) {
testDisplayName = '$testDisplayName/${subtestNames[subtestIndex]}';
testCase = new BrowserTestCase(testDisplayName,
- commandSet, configuration, completeHandler,
+ commandSet, configuration,
expectations['$testName/${subtestNames[subtestIndex]}'],
- info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath,
- subtestIndex != 0);
+ info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath);
} else {
testCase = new BrowserTestCase(testDisplayName,
- commandSet, configuration, completeHandler, expectations,
- info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath,
- false);
- }
- if (subtestIndex == 0) {
- multitestParentTest = testCase;
- } else {
- multitestParentTest.addObserver(testCase);
+ commandSet, configuration, expectations,
+ info, info.hasCompileError || info.hasRuntimeError, fullHtmlPath);
}
doTest(testCase);
@@ -1133,12 +1114,9 @@
args.insert(0, executable);
executable = dartShellFileName;
}
- return new CompilationCommand(compiler,
- outputFile,
- !useSdk,
- dart2JsBootstrapDependencies,
- compilerPath,
- args);
+ return CommandBuilder.instance.getCompilationCommand(
+ compiler, outputFile, !useSdk,
+ dart2JsBootstrapDependencies, compilerPath, args, configurationDir);
}
/**
@@ -1230,9 +1208,6 @@
return dartDir.append('client/tests/dartium/chrome').toNativePath();
}
- void completeHandler(TestCase testCase) {
- }
-
List<String> commonArgumentsFromFile(Path filePath, Map optionsFromFile) {
List args = TestUtils.standardOptions(configuration);
@@ -1669,17 +1644,15 @@
updatedConfiguration[key] = value;
});
updatedConfiguration['timeout'] *= 3;
+ var command = CommandBuilder.instance.getCommand(
+ 'junit_test', 'java', args, configurationDir);
doTest(new TestCase(suiteName,
- [new Command('junit_test', 'java', args)],
+ [command],
updatedConfiguration,
- completeHandler,
new Set<String>.from([PASS])));
doDone();
}
- void completeHandler(TestCase testCase) {
- }
-
void computeClassPath() {
classPath =
['$buildDir/analyzer/util/analyzer/dart_analyzer.jar',
@@ -1693,7 +1666,7 @@
'$dartDir/third_party/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar',
'$dartDir/third_party/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar',
'$dartDir/third_party/junit/v4_8_2/junit.jar']
- .join(Platform.operatingSystem == 'windows'? ';': ':'); // Path separator.
+ .join(Platform.operatingSystem == 'windows'? ';': ':');
}
}
diff --git a/tools/testing/dart/utils.dart b/tools/testing/dart/utils.dart
index 3ddf330..888f8cf 100644
--- a/tools/testing/dart/utils.dart
+++ b/tools/testing/dart/utils.dart
@@ -64,6 +64,55 @@
static String get _datetime => "${new DateTime.now()}";
}
+
+/**
+ * [areByteArraysEqual] compares a range of bytes from [buffer1] with a
+ * range of bytes from [buffer2].
+ *
+ * Returns [true] if the [count] bytes in [buffer1] (starting at
+ * [offset1]) match the [count] bytes in [buffer2] (starting at
+ * [offset2]).
+ * Otherwise [false] is returned.
+ */
+bool areByteArraysEqual(List<int> buffer1, int offset1,
+ List<int> buffer2, int offset2,
+ int count) {
+ if ((offset1 + count) > buffer1.length ||
+ (offset2 + count) > buffer2.length) {
+ return false;
+ }
+
+ for (var i = 0; i < count; i++) {
+ if (buffer1[offset1 + i] != buffer2[offset2 + i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+/**
+ * [findBytes] searches for [pattern] in [data] beginning at [startPos].
+ *
+ * Returns [true] if [pattern] was found in [data].
+ * Otherwise [false] is returned.
+ */
+int findBytes(List<int> data, List<int> pattern, [int startPos=0]) {
+ // TODO(kustermann): Use one of the fast string-matching algorithms!
+ for (int i = startPos; i < (data.length - pattern.length); i++) {
+ bool found = true;
+ for (int j = 0; j < pattern.length; j++) {
+ if (data[i + j] != pattern[j]) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ return i;
+ }
+ }
+ return -1;
+}
+
List<int> encodeUtf8(String string) {
return utf.encodeUtf8(string);
}
@@ -84,3 +133,22 @@
return argument;
}
+class HashCodeBuilder {
+ int _value = 0;
+
+ void add(Object object) {
+ _value = ((_value * 31) ^ object.hashCode) & 0x3FFFFFFF;
+ }
+
+ int get value => _value;
+}
+
+class UniqueObject {
+ static int _nextId = 1;
+ final int _hashCode;
+
+ int get hashCode => _hashCode;
+ operator==(other) => other is UniqueObject && _hashCode == other._hashCode;
+
+ UniqueObject() : _hashCode = ++_nextId;
+}
\ No newline at end of file
diff --git a/tools/utils.py b/tools/utils.py
index 0abb0ed..54a53a8 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -205,7 +205,6 @@
return gsutil
def GetBuildMode(mode):
- global BUILD_MODES
return BUILD_MODES[mode]
@@ -214,10 +213,10 @@
ARCH_GUESS = GuessArchitecture()
BASE_DIR = os.path.abspath(os.path.join(os.curdir, '..'))
+DART_DIR = os.path.abspath(os.path.join(__file__, '..', '..'))
def GetBuildDir(host_os, target_os):
- global BUILD_ROOT
build_dir = BUILD_ROOT[host_os]
if target_os and target_os != host_os:
build_dir = os.path.join(build_dir, target_os)
@@ -233,28 +232,71 @@
return BASE_DIR
def GetVersion():
- dartbin = DartBinary()
- version_script = VersionScript()
- p = subprocess.Popen([dartbin, version_script], stdout = subprocess.PIPE,
- stderr = subprocess.STDOUT, shell=IsWindows())
- output, not_used = p.communicate()
- return output.strip()
+ version_tuple = ReadVersionFile()
+ if not version_tuple:
+ return None
+
+ (major, minor, build, patch) = version_tuple
+ revision = GetSVNRevision()
+ user = GetUserName()
+ # We don't add username to release builds (or any builds on the bots)
+ if user == 'chrome-bot':
+ user = ''
+
+ user_string = ''
+ revision_string = ''
+ if user:
+ user_string = '_%s' % user
+ if revision:
+ revision_string = '_r%s' % revision
+
+ return ("%s.%s.%s.%s%s%s" %
+ (major, minor, build, patch, revision_string, user_string))
+
+def GetUserName():
+ key = 'USER'
+ if sys.platform == 'win32':
+ key = 'USERNAME'
+ return os.environ.get(key, '')
+
+def ReadVersionFile():
+ version_file = os.path.join(DART_DIR, 'tools', 'VERSION')
+ try:
+ fd = open(version_file)
+ content = fd.read()
+ fd.close()
+ except:
+ print "Warning: Couldn't read VERSION file (%s)" % version_file
+ return None
+ major_match = re.search('MAJOR (\d+)', content)
+ minor_match = re.search('MINOR (\d+)', content)
+ build_match = re.search('BUILD (\d+)', content)
+ patch_match = re.search('PATCH (\d+)', content)
+ if major_match and minor_match and build_match and patch_match:
+ return (major_match.group(1), minor_match.group(1), build_match.group(1),
+ patch_match.group(1))
+ else:
+ print "Warning: VERSION file (%s) has wrong format" % version_file
+ return None
def GetSVNRevision():
+ # FIXME(kustermann): Make this work for newer SVN versions as well (where
+ # we've got only one '.svn' directory)
custom_env = dict(os.environ)
custom_env['LC_MESSAGES'] = 'en_GB'
p = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE,
stderr = subprocess.STDOUT, shell=IsWindows(),
- env = custom_env)
- output, not_used = p.communicate()
+ env = custom_env,
+ cwd = DART_DIR)
+ output, _ = p.communicate()
revision = ParseSvnInfoOutput(output)
if revision:
return revision
# maybe the builder is using git-svn, try that
p = subprocess.Popen(['git', 'svn', 'info'], stdout = subprocess.PIPE,
- stderr = subprocess.STDOUT, shell=IsWindows())
- output, not_used = p.communicate()
+ stderr = subprocess.STDOUT, shell=IsWindows(), cwd = DART_DIR)
+ output, _ = p.communicate()
revision = ParseSvnInfoOutput(output)
if revision:
return revision
@@ -262,9 +304,9 @@
return None
def ParseSvnInfoOutput(output):
- for line in output.split('\n'):
- if 'Revision' in line:
- return (line.strip().split())[1]
+ revision_match = re.search('Last Changed Rev: (\d+)', output)
+ if revision_match:
+ return revision_match.group(1)
return None
def RewritePathSeparator(path, workspace):
@@ -389,11 +431,6 @@
os.utime(name, None)
-def VersionScript():
- tools_dir = os.path.dirname(os.path.realpath(__file__))
- return os.path.join(tools_dir, 'version.dart')
-
-
def DartBinary():
tools_dir = os.path.dirname(os.path.realpath(__file__))
dart_binary_prefix = os.path.join(tools_dir, 'testing', 'bin')
diff --git a/tools/version.dart b/tools/version.dart
deleted file mode 100644
index 6972667..0000000
--- a/tools/version.dart
+++ /dev/null
@@ -1,22 +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 "dart:io";
-import "dart:async" show getAttachedStackTrace;
-import "release/version.dart";
-
-void main() {
- Path scriptPath = new Path(new Options().script).directoryPath;
- Version version = new Version(scriptPath.append("VERSION"));
- Future f = version.getVersion();
- f.then((currentVersion) {
- print(currentVersion);
- }).catchError((e) {
- print("Could not create version number, failed with: $e");
- var trace = getAttachedStackTrace(e);
- if (trace != null) print("StackTrace: $trace");
- return true;
- });
-}
diff --git a/utils/compiler/create_snapshot.dart b/utils/compiler/create_snapshot.dart
index e48900f..5e429bd 100644
--- a/utils/compiler/create_snapshot.dart
+++ b/utils/compiler/create_snapshot.dart
@@ -5,19 +5,15 @@
import 'dart:io';
Future<String> getVersion(var options, var rootPath) {
- var os = Platform.operatingSystem;
- var suffix = os == 'windows' ? '.exe' : '';
- var checkedInBinary =
- rootPath.join(new Path('tools/testing/bin/$os/dart$suffix'));
- var versionPath = rootPath.append("tools").append("version.dart");
- return Process.run(checkedInBinary.toNativePath(),
- [versionPath.toNativePath()])
- .then((result) {
- if (result.exitCode != 0) {
- throw "Could not generate version";
- }
- return result.stdout.trim();
- });
+ var suffix = Platform.operatingSystem == 'windows' ? '.exe' : '';
+ var printVersionScript =
+ rootPath.append("tools").append("print_version.py").toNativePath();
+ return Process.run("python$suffix", [printVersionScript]).then((result) {
+ if (result.exitCode != 0) {
+ throw "Could not generate version";
+ }
+ return result.stdout.trim();
+ });
}
Future<String> getSnapshotGenerationFile(var options, var args, var rootPath) {