Version 0.5.17.0
svn merge -r 23796:23890 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
git-svn-id: http://dart.googlecode.com/svn/trunk@23893 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/analyzer_experimental/bin/coverage.dart b/pkg/analyzer_experimental/bin/coverage.dart
new file mode 100644
index 0000000..87be02e
--- /dev/null
+++ b/pkg/analyzer_experimental/bin/coverage.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library runtime.coverage;
+
+import "package:logging/logging.dart" as log;
+
+import 'package:analyzer_experimental/src/services/runtime/coverage_impl.dart';
+
+
+main() {
+ var logger = log.Logger.root;
+ logger.level = log.Level.ALL;
+ logger.onRecord.listen((log.LogRecord record) {
+ String levelString = record.level.toString();
+ while (levelString.length < 6) levelString += ' ';
+ print('${record.time}: ${levelString} ${record.message}');
+ });
+ // TODO(scheglov) get script from options
+ new CoverageServer('/Users/scheglov/dart/Test/bin').start();
+}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/generated/ast.dart b/pkg/analyzer_experimental/lib/src/generated/ast.dart
index f18ed43..0adebba 100644
--- a/pkg/analyzer_experimental/lib/src/generated/ast.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/ast.dart
@@ -9,7 +9,7 @@
import 'scanner.dart';
import 'engine.dart' show AnalysisEngine;
import 'utilities_dart.dart';
-import 'element.dart' hide Annotation;
+import 'element.dart';
/**
* The abstract class {@code ASTNode} defines the behavior common to all nodes in the AST structure
* for a Dart program.
diff --git a/pkg/analyzer_experimental/lib/src/generated/element.dart b/pkg/analyzer_experimental/lib/src/generated/element.dart
index 62e1d3d..5cc4a23 100644
--- a/pkg/analyzer_experimental/lib/src/generated/element.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/element.dart
@@ -13,20 +13,6 @@
import 'constant.dart' show EvaluationResultImpl;
import 'utilities_dart.dart';
/**
- * The interface {@code Annotation} defines the behavior of objects representing a single annotation
- * associated with an element.
- * @coverage dart.engine.element
- */
-abstract class Annotation {
-
- /**
- * Return the element representing the field, variable, or const constructor being used as an
- * annotation.
- * @return the field, variable, or constructor being used as an annotation
- */
- Element get element;
-}
-/**
* The interface {@code ClassElement} defines the behavior of elements that represent a class.
* @coverage dart.engine.element
*/
@@ -258,8 +244,8 @@
abstract class ClassMemberElement implements Element {
/**
- * Return the type in which this constructor is defined.
- * @return the type in which this constructor is defined
+ * Return the type in which this member is defined.
+ * @return the type in which this member is defined
*/
ClassElement get enclosingElement;
}
@@ -441,7 +427,7 @@
* Return an array containing all of the metadata associated with this element.
* @return the metadata associated with this element
*/
- List<Annotation> get metadata;
+ List<ElementAnnotation> get metadata;
/**
* Return the name of this element, or {@code null} if this element does not have a name.
@@ -490,6 +476,20 @@
void visitChildren(ElementVisitor<Object> visitor);
}
/**
+ * The interface {@code ElementAnnotation} defines the behavior of objects representing a single
+ * annotation associated with an element.
+ * @coverage dart.engine.element
+ */
+abstract class ElementAnnotation {
+
+ /**
+ * Return the element representing the field, variable, or const constructor being used as an
+ * annotation.
+ * @return the field, variable, or constructor being used as an annotation
+ */
+ Element get element;
+}
+/**
* The enumeration {@code ElementKind} defines the various kinds of elements in the element model.
* @coverage dart.engine.element
*/
@@ -768,11 +768,11 @@
List<TypeVariableElement> get typeVariables;
}
/**
- * The interface {@code HideCombinator} defines the behavior of combinators that cause some of the
- * names in a namespace to be hidden when being imported.
+ * The interface {@code HideElementCombinator} defines the behavior of combinators that cause some
+ * of the names in a namespace to be hidden when being imported.
* @coverage dart.engine.element
*/
-abstract class HideCombinator implements NamespaceCombinator {
+abstract class HideElementCombinator implements NamespaceCombinator {
/**
* Return an array containing the names that are not to be made visible in the importing library
@@ -1019,6 +1019,13 @@
abstract class ParameterElement implements LocalElement, VariableElement {
/**
+ * Return a source range that covers the portion of the source in which the default value for this
+ * parameter is specified, or {@code null} if there is no default value.
+ * @return the range of characters in which the default value of this parameter is specified
+ */
+ SourceRange get defaultValueRange;
+
+ /**
* Return the kind of this parameter.
* @return the kind of this parameter
*/
@@ -1157,11 +1164,11 @@
bool isStatic();
}
/**
- * The interface {@code ShowCombinator} defines the behavior of combinators that cause some of the
- * names in a namespace to be visible (and the rest hidden) when being imported.
+ * The interface {@code ShowElementCombinator} defines the behavior of combinators that cause some
+ * of the names in a namespace to be visible (and the rest hidden) when being imported.
* @coverage dart.engine.element
*/
-abstract class ShowCombinator implements NamespaceCombinator {
+abstract class ShowElementCombinator implements NamespaceCombinator {
/**
* Return an array containing the names that are to be made visible in the importing library if
@@ -1481,33 +1488,6 @@
R visitTypeVariableElement(TypeVariableElement element) => null;
}
/**
- * Instances of the class {@code AnnotationImpl} implement an {@link Annotation}.
- * @coverage dart.engine.element
- */
-class AnnotationImpl implements Annotation {
-
- /**
- * The element representing the field, variable, or constructor being used as an annotation.
- */
- Element _element;
-
- /**
- * An empty array of annotations.
- */
- static List<AnnotationImpl> EMPTY_ARRAY = new List<AnnotationImpl>(0);
-
- /**
- * Initialize a newly created annotation.
- * @param element the element representing the field, variable, or constructor being used as an
- * annotation
- */
- AnnotationImpl(Element element) {
- this._element = element;
- }
- Element get element => _element;
- String toString() => "@${_element.toString()}";
-}
-/**
* Instances of the class {@code ClassElementImpl} implement a {@code ClassElement}.
* @coverage dart.engine.element
*/
@@ -2345,6 +2325,33 @@
}
}
/**
+ * Instances of the class {@code ElementAnnotationImpl} implement an {@link ElementAnnotation}.
+ * @coverage dart.engine.element
+ */
+class ElementAnnotationImpl implements ElementAnnotation {
+
+ /**
+ * The element representing the field, variable, or constructor being used as an annotation.
+ */
+ Element _element;
+
+ /**
+ * An empty array of annotations.
+ */
+ static List<ElementAnnotationImpl> EMPTY_ARRAY = new List<ElementAnnotationImpl>(0);
+
+ /**
+ * Initialize a newly created annotation.
+ * @param element the element representing the field, variable, or constructor being used as an
+ * annotation
+ */
+ ElementAnnotationImpl(Element element) {
+ this._element = element;
+ }
+ Element get element => _element;
+ String toString() => "@${_element.toString()}";
+}
+/**
* The abstract class {@code ElementImpl} implements the behavior common to objects that implement
* an {@link Element}.
* @coverage dart.engine.element
@@ -2376,7 +2383,7 @@
/**
* An array containing all of the metadata associated with this element.
*/
- List<Annotation> _metadata = AnnotationImpl.EMPTY_ARRAY;
+ List<ElementAnnotation> _metadata = ElementAnnotationImpl.EMPTY_ARRAY;
/**
* A cached copy of the calculated hashCode for this element.
@@ -2439,7 +2446,7 @@
Element get enclosingElement => _enclosingElement;
LibraryElement get library => getAncestor(LibraryElement);
ElementLocation get location => new ElementLocationImpl.con1(this);
- List<Annotation> get metadata => _metadata;
+ List<ElementAnnotation> get metadata => _metadata;
String get name => _name;
int get nameOffset => _nameOffset;
Source get source {
@@ -2466,7 +2473,7 @@
* Set the metadata associate with this element to the given array of annotations.
* @param metadata the metadata to be associated with this element
*/
- void set metadata(List<Annotation> metadata2) {
+ void set metadata(List<ElementAnnotation> metadata2) {
this._metadata = metadata2;
}
@@ -2625,7 +2632,23 @@
return false;
}
ElementLocationImpl location = object as ElementLocationImpl;
- return JavaArrays.equals(_components, location._components);
+ List<String> otherComponents = location._components;
+ int length = _components.length;
+ if (otherComponents.length != length) {
+ return false;
+ }
+ if (length > 0 && !equalSourceComponents(_components[0], otherComponents[0])) {
+ return false;
+ }
+ if (length > 1 && !equalSourceComponents(_components[1], otherComponents[1])) {
+ return false;
+ }
+ for (int i = 2; i < length; i++) {
+ if (_components[i] != otherComponents[i]) {
+ return false;
+ }
+ }
+ return true;
}
/**
@@ -2694,6 +2717,25 @@
builder.appendChar(currentChar);
}
}
+
+ /**
+ * Return {@code true} if the given components, when interpreted to be encoded sources with a
+ * leading source type indicator, are equal when the source type's are ignored.
+ * @param left the left component being compared
+ * @param right the right component being compared
+ * @return {@code true} if the given components are equal when the source type's are ignored
+ */
+ bool equalSourceComponents(String left, String right) {
+ if (left == null) {
+ return right == null;
+ } else if (right == null) {
+ return false;
+ }
+ if (left.length <= 1 || right.length <= 1) {
+ return left == right;
+ }
+ return left.substring(1) == right.substring(1);
+ }
}
/**
* Instances of the class {@code EmbeddedHtmlScriptElementImpl} implement an{@link EmbeddedHtmlScriptElement}.
@@ -3108,7 +3150,7 @@
_jtd_constructor_208_impl(int nameOffset) {
}
accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
- String get identifier => name;
+ String get identifier => "${name}@${nameOffset}";
ElementKind get kind => ElementKind.FUNCTION;
SourceRange get visibleRange {
if (_visibleRangeLength < 0) {
@@ -3255,10 +3297,10 @@
}
}
/**
- * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowCombinator}.
+ * Instances of the class {@code HideElementCombinatorImpl} implement a{@link HideElementCombinator}.
* @coverage dart.engine.element
*/
-class HideCombinatorImpl implements HideCombinator {
+class HideElementCombinatorImpl implements HideElementCombinator {
/**
* The names that are not to be made visible in the importing library even if they are defined in
@@ -3822,6 +3864,7 @@
builder.append(" ");
builder.append(displayName);
}
+ String get identifier => "${super.identifier}@${nameOffset}";
}
/**
* Instances of the class {@code MethodElementImpl} implement a {@code MethodElement}.
@@ -3972,7 +4015,7 @@
ElementKind get kind => ElementKind.ERROR;
LibraryElement get library => null;
ElementLocation get location => null;
- List<Annotation> get metadata => AnnotationImpl.EMPTY_ARRAY;
+ List<ElementAnnotation> get metadata => ElementAnnotationImpl.EMPTY_ARRAY;
String get name => _name;
int get nameOffset => -1;
Source get source => null;
@@ -4050,6 +4093,17 @@
ParameterKind _parameterKind;
/**
+ * The offset to the beginning of the default value range for this element.
+ */
+ int _defaultValueRangeOffset = 0;
+
+ /**
+ * The length of the default value range for this element, or {@code -1} if this element does not
+ * have a default value.
+ */
+ int _defaultValueRangeLength = -1;
+
+ /**
* The offset to the beginning of the visible range for this element.
*/
int _visibleRangeOffset = 0;
@@ -4072,6 +4126,12 @@
ParameterElementImpl(Identifier name) : super.con1(name) {
}
accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
+ SourceRange get defaultValueRange {
+ if (_defaultValueRangeLength < 0) {
+ return null;
+ }
+ return new SourceRange(_defaultValueRangeOffset, _defaultValueRangeLength);
+ }
ElementKind get kind => ElementKind.PARAMETER;
ParameterKind get parameterKind => _parameterKind;
List<ParameterElement> get parameters => _parameters;
@@ -4084,6 +4144,18 @@
bool isInitializingFormal() => false;
/**
+ * Set the range of the default value for this parameter to the range starting at the given offset
+ * with the given length.
+ * @param offset the offset to the beginning of the default value range for this element
+ * @param length the length of the default value range for this element, or {@code -1} if this
+ * element does not have a default value
+ */
+ void setDefaultValueRange(int offset, int length) {
+ _defaultValueRangeOffset = offset;
+ _defaultValueRangeLength = length;
+ }
+
+ /**
* Set the kind of this parameter to the given kind.
* @param parameterKind the new kind of this parameter
*/
@@ -4355,10 +4427,10 @@
}
}
/**
- * Instances of the class {@code ShowCombinatorImpl} implement a {@link ShowCombinator}.
+ * Instances of the class {@code ShowElementCombinatorImpl} implement a{@link ShowElementCombinator}.
* @coverage dart.engine.element
*/
-class ShowCombinatorImpl implements ShowCombinator {
+class ShowElementCombinatorImpl implements ShowElementCombinator {
/**
* The names that are to be made visible in the importing library if they are defined in the
@@ -4790,7 +4862,7 @@
ElementKind get kind => _baseElement.kind;
LibraryElement get library => _baseElement.library;
ElementLocation get location => _baseElement.location;
- List<Annotation> get metadata => _baseElement.metadata;
+ List<ElementAnnotation> get metadata => _baseElement.metadata;
String get name => _baseElement.name;
int get nameOffset => _baseElement.nameOffset;
Source get source => _baseElement.source;
@@ -4975,6 +5047,7 @@
return element;
}
ParameterElement get baseElement => super.baseElement as ParameterElement;
+ SourceRange get defaultValueRange => baseElement.defaultValueRange;
Element get enclosingElement => baseElement.enclosingElement;
ParameterKind get parameterKind => baseElement.parameterKind;
List<ParameterElement> get parameters {
@@ -5202,7 +5275,7 @@
return false;
}
JavaIterator<MapEntry<String, Type2>> firstIterator = new JavaIterator(getMapEntrySet(firstTypes));
- JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getMapEntrySet(firstTypes));
+ JavaIterator<MapEntry<String, Type2>> secondIterator = new JavaIterator(getMapEntrySet(secondTypes));
while (firstIterator.hasNext) {
MapEntry<String, Type2> firstEntry = firstIterator.next();
MapEntry<String, Type2> secondEntry = secondIterator.next();
@@ -5904,17 +5977,24 @@
return isMoreSpecificThan2((type as InterfaceType), new Set<ClassElement>());
}
bool isObject() => element.supertype == null;
- bool isSubtypeOf(Type2 type) {
- if (identical(type, DynamicTypeImpl.instance)) {
+ bool isSubtypeOf(Type2 type2) {
+ if (identical(type2, DynamicTypeImpl.instance)) {
return true;
- } else if (type is TypeVariableType) {
+ } else if (type2 is TypeVariableType) {
return true;
- } else if (type is! InterfaceType) {
+ } else if (type2 is FunctionType) {
+ ClassElement element = this.element;
+ MethodElement callMethod = element.lookUpMethod("call", element.library);
+ if (callMethod != null) {
+ return callMethod.type.isSubtypeOf(type2);
+ }
return false;
- } else if (this == type) {
+ } else if (type2 is! InterfaceType) {
+ return false;
+ } else if (this == type2) {
return true;
}
- return isSubtypeOf2((type as InterfaceType), new Set<ClassElement>());
+ return isSubtypeOf2((type2 as InterfaceType), new Set<ClassElement>());
}
ConstructorElement lookUpConstructor(String constructorName, LibraryElement library) {
ConstructorElement constructorElement;
diff --git a/pkg/analyzer_experimental/lib/src/generated/engine.dart b/pkg/analyzer_experimental/lib/src/generated/engine.dart
index 0b7365a..fd4a2e5 100644
--- a/pkg/analyzer_experimental/lib/src/generated/engine.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/engine.dart
@@ -1923,15 +1923,6 @@
if (source == null) {
return null;
}
- List<CharSequence> contentHolder = new List<CharSequence>(1);
- try {
- source.getContents(new Source_ContentReceiver_6(contentHolder));
- } catch (exception) {
- throw new AnalysisException.con2("Could not get contents of ${source.fullName}", exception);
- }
- if (contentHolder[0] == null) {
- return null;
- }
CompilationUnit unit = parseCompilationUnit(source);
if (unit == null) {
return null;
@@ -1944,8 +1935,11 @@
if (comment == null) {
return null;
}
- int offset = comment.offset;
- return contentHolder[0].subSequence(offset, offset + comment.length).toString();
+ JavaStringBuilder builder = new JavaStringBuilder();
+ for (Token token in comment.tokens) {
+ builder.append(token.lexeme);
+ }
+ return builder.toString();
}
nameNode = nameNode.parent;
}
@@ -2738,7 +2732,7 @@
*/
List<Source> getLibrarySources2(Source htmlSource, HtmlUnit htmlUnit) {
List<Source> libraries = new List<Source>();
- htmlUnit.accept(new RecursiveXmlVisitor_7(this, htmlSource, libraries));
+ htmlUnit.accept(new RecursiveXmlVisitor_6(this, htmlSource, libraries));
if (libraries.isEmpty) {
return Source.EMPTY_ARRAY;
}
@@ -2893,7 +2887,7 @@
}
AnalysisContextImpl_ScanResult internalScan(Source source, AnalysisErrorListener errorListener) {
AnalysisContextImpl_ScanResult result = new AnalysisContextImpl_ScanResult();
- Source_ContentReceiver receiver = new Source_ContentReceiver_8(source, errorListener, result);
+ Source_ContentReceiver receiver = new Source_ContentReceiver_7(source, errorListener, result);
try {
source.getContents(receiver);
} catch (exception) {
@@ -3219,21 +3213,11 @@
*/
List<int> _lineStarts;
}
-class Source_ContentReceiver_6 implements Source_ContentReceiver {
- List<CharSequence> contentHolder;
- Source_ContentReceiver_6(this.contentHolder);
- void accept(CharBuffer contents, int modificationTime) {
- contentHolder[0] = contents;
- }
- void accept2(String contents, int modificationTime) {
- contentHolder[0] = new CharSequence(contents);
- }
-}
-class RecursiveXmlVisitor_7 extends RecursiveXmlVisitor<Object> {
+class RecursiveXmlVisitor_6 extends RecursiveXmlVisitor<Object> {
final AnalysisContextImpl AnalysisContextImpl_this;
Source htmlSource;
List<Source> libraries;
- RecursiveXmlVisitor_7(this.AnalysisContextImpl_this, this.htmlSource, this.libraries) : super();
+ RecursiveXmlVisitor_6(this.AnalysisContextImpl_this, this.htmlSource, this.libraries) : super();
Object visitXmlTagNode(XmlTagNode node) {
if (javaStringEqualsIgnoreCase(node.tag.lexeme, AnalysisContextImpl._TAG_SCRIPT)) {
bool isDartScript = false;
@@ -3263,11 +3247,11 @@
return super.visitXmlTagNode(node);
}
}
-class Source_ContentReceiver_8 implements Source_ContentReceiver {
+class Source_ContentReceiver_7 implements Source_ContentReceiver {
Source source;
AnalysisErrorListener errorListener;
AnalysisContextImpl_ScanResult result;
- Source_ContentReceiver_8(this.source, this.errorListener, this.result);
+ Source_ContentReceiver_7(this.source, this.errorListener, this.result);
void accept(CharBuffer contents, int modificationTime2) {
CharBufferScanner scanner = new CharBufferScanner(source, contents, errorListener);
result._modificationTime = modificationTime2;
@@ -4296,8 +4280,9 @@
* @return an array of errors (not {@code null}, contains no {@code null}s)
*/
List<AnalysisError> get errors {
- Set<MapEntry<Source, List<AnalysisError>>> entrySet = getMapEntrySet(_errors);
- if (entrySet.length == 0) {
+ Iterable<MapEntry<Source, List<AnalysisError>>> entrySet = getMapEntrySet(_errors);
+ int numEntries = entrySet.length;
+ if (numEntries == 0) {
return AnalysisError.NO_ERRORS;
}
List<AnalysisError> resultList = new List<AnalysisError>();
diff --git a/pkg/analyzer_experimental/lib/src/generated/error.dart b/pkg/analyzer_experimental/lib/src/generated/error.dart
index 018ee78..6061cb0 100644
--- a/pkg/analyzer_experimental/lib/src/generated/error.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/error.dart
@@ -170,6 +170,14 @@
}
/**
+ * Creates an error with properties with the given error code and arguments.
+ * @param errorCode the error code of the error to be reported
+ * @param node the node specifying the location of the error
+ * @param arguments the arguments to the error, used to compose the error message
+ */
+ AnalysisErrorWithProperties newErrorWithProperties(ErrorCode errorCode, ASTNode node, List<Object> arguments) => new AnalysisErrorWithProperties.con2(_source, node.offset, node.length, errorCode, arguments);
+
+ /**
* Report a passed error.
* @param error the error to report
*/
diff --git a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
index 6821936..0f62806 100644
--- a/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/instrumentation.dart
@@ -32,13 +32,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_12();
/**
* 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_13();
/**
* The current instrumentation logger.
@@ -85,7 +85,7 @@
_CURRENT_LOGGER = logger2 == null ? _NULL_LOGGER : logger2;
}
}
-class InstrumentationBuilder_13 implements InstrumentationBuilder {
+class InstrumentationBuilder_12 implements InstrumentationBuilder {
InstrumentationBuilder data(String name, bool value) => this;
InstrumentationBuilder data2(String name, int value) => this;
InstrumentationBuilder data3(String name, String value) => this;
@@ -99,7 +99,7 @@
InstrumentationBuilder metric4(String name, List<String> value) => this;
InstrumentationBuilder record(Exception exception) => this;
}
-class InstrumentationLogger_14 implements InstrumentationLogger {
+class InstrumentationLogger_13 implements InstrumentationLogger {
InstrumentationBuilder createBuilder(String name) => Instrumentation._NULL_INSTRUMENTATION_BUILDER;
}
/**
diff --git a/pkg/analyzer_experimental/lib/src/generated/java_core.dart b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
index e8b1047..7e90245 100644
--- a/pkg/analyzer_experimental/lib/src/generated/java_core.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/java_core.dart
@@ -293,10 +293,6 @@
String toString() => "URISyntaxException";
}
-class IOException implements Exception {
- String toString() => "IOException";
-}
-
class MissingFormatArgumentException implements Exception {
final String s;
diff --git a/pkg/analyzer_experimental/lib/src/generated/parser.dart b/pkg/analyzer_experimental/lib/src/generated/parser.dart
index b03b6f2..bd5a1dc 100644
--- a/pkg/analyzer_experimental/lib/src/generated/parser.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/parser.dart
@@ -495,7 +495,7 @@
* Create a synthetic token representing the given keyword.
* @return the synthetic token that was created
*/
- Token createSyntheticToken(Keyword keyword) => new KeywordToken_11(keyword, _currentToken.offset);
+ Token createSyntheticToken(Keyword keyword) => new KeywordToken_10(keyword, _currentToken.offset);
/**
* Create a synthetic token with the given type.
@@ -1672,7 +1672,7 @@
}
try {
List<bool> errorFound = [false];
- AnalysisErrorListener listener = new AnalysisErrorListener_12(errorFound);
+ AnalysisErrorListener listener = new AnalysisErrorListener_11(errorFound);
StringScanner scanner = new StringScanner(null, referenceSource, listener);
scanner.setSourceStart(1, 1, sourceOffset);
Token firstToken = scanner.tokenize();
@@ -5187,13 +5187,13 @@
}
}
}
-class KeywordToken_11 extends KeywordToken {
- KeywordToken_11(Keyword arg0, int arg1) : super(arg0, arg1);
+class KeywordToken_10 extends KeywordToken {
+ KeywordToken_10(Keyword arg0, int arg1) : super(arg0, arg1);
int get length => 0;
}
-class AnalysisErrorListener_12 implements AnalysisErrorListener {
+class AnalysisErrorListener_11 implements AnalysisErrorListener {
List<bool> errorFound;
- AnalysisErrorListener_12(this.errorFound);
+ AnalysisErrorListener_11(this.errorFound);
void onError(AnalysisError error) {
errorFound[0] = true;
}
diff --git a/pkg/analyzer_experimental/lib/src/generated/resolver.dart b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
index abc4eb0..3a052ac 100644
--- a/pkg/analyzer_experimental/lib/src/generated/resolver.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/resolver.dart
@@ -12,11 +12,10 @@
import 'ast.dart';
import 'parser.dart' show Parser, ParserErrorCode;
import 'sdk.dart' show DartSdk, SdkLibrary;
-import 'element.dart' hide Annotation, HideCombinator, ShowCombinator;
+import 'element.dart';
import 'html.dart' as ht;
import 'engine.dart';
import 'constant.dart';
-import 'element.dart' as __imp_combi show HideCombinator, ShowCombinator;
/**
* Instances of the class {@code CompilationUnitBuilder} build an element model for a single
* compilation unit.
@@ -217,6 +216,10 @@
parameter.final2 = node.isFinal();
parameter.initializer = initializer;
parameter.parameterKind = node.kind;
+ Expression defaultValue = node.defaultValue;
+ if (defaultValue != null) {
+ parameter.setDefaultValueRange(defaultValue.offset, defaultValue.length);
+ }
FunctionBody body = getFunctionBody(node);
if (body != null) {
parameter.setVisibleRange(body.offset, body.length);
@@ -2216,11 +2219,11 @@
* @param annotationList the list of elements to which new elements are to be added
* @param annotations the AST nodes used to generate new elements
*/
- void addAnnotations(List<AnnotationImpl> annotationList, NodeList<Annotation> annotations) {
+ void addAnnotations(List<ElementAnnotationImpl> annotationList, NodeList<Annotation> annotations) {
for (Annotation annotationNode in annotations) {
Element resolvedElement = annotationNode.element;
if (resolvedElement != null) {
- annotationList.add(new AnnotationImpl(resolvedElement));
+ annotationList.add(new ElementAnnotationImpl(resolvedElement));
}
}
}
@@ -3218,7 +3221,7 @@
if (element is! ElementImpl) {
return;
}
- List<AnnotationImpl> annotationList = new List<AnnotationImpl>();
+ List<ElementAnnotationImpl> annotationList = new List<ElementAnnotationImpl>();
addAnnotations(annotationList, node.metadata);
if (node is VariableDeclaration && node.parent is VariableDeclarationList) {
VariableDeclarationList list = node.parent as VariableDeclarationList;
@@ -4484,11 +4487,11 @@
List<NamespaceCombinator> combinators = new List<NamespaceCombinator>();
for (Combinator combinator in directive.combinators) {
if (combinator is HideCombinator) {
- HideCombinatorImpl hide = new HideCombinatorImpl();
+ HideElementCombinatorImpl hide = new HideElementCombinatorImpl();
hide.hiddenNames = getIdentifiers(((combinator as HideCombinator)).hiddenNames);
combinators.add(hide);
} else {
- ShowCombinatorImpl show = new ShowCombinatorImpl();
+ ShowElementCombinatorImpl show = new ShowElementCombinatorImpl();
show.shownNames = getIdentifiers(((combinator as ShowCombinator)).shownNames);
combinators.add(show);
}
@@ -4827,7 +4830,7 @@
CompilationUnit unit = library.getAST(source);
ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, library.libraryElement, _typeProvider, library.inheritanceManager);
unit.accept(errorVerifier);
- unit.accept(new PubVerifier(errorReporter));
+ unit.accept(new PubVerifier(_analysisContext, errorReporter));
ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, _typeProvider);
unit.accept(constantVerifier);
}
@@ -7300,7 +7303,7 @@
}
if (identical(operator, sc.TokenType.MINUS) || identical(operator, sc.TokenType.PERCENT) || identical(operator, sc.TokenType.PLUS) || identical(operator, sc.TokenType.STAR)) {
Type2 doubleType = _typeProvider.doubleType;
- if (identical(getStaticType(node.leftOperand), doubleType) || identical(getStaticType(node.rightOperand), doubleType)) {
+ if (identical(getStaticType(node.leftOperand), _typeProvider.intType) && identical(getStaticType(node.rightOperand), doubleType)) {
return doubleType;
}
}
@@ -9108,10 +9111,10 @@
*/
Map<String, Element> apply(Map<String, Element> definedNames, List<NamespaceCombinator> combinators) {
for (NamespaceCombinator combinator in combinators) {
- if (combinator is __imp_combi.HideCombinator) {
- hide(definedNames, ((combinator as __imp_combi.HideCombinator)).hiddenNames);
- } else if (combinator is __imp_combi.ShowCombinator) {
- definedNames = show(definedNames, ((combinator as __imp_combi.ShowCombinator)).shownNames);
+ if (combinator is HideElementCombinator) {
+ hide(definedNames, ((combinator as HideElementCombinator)).hiddenNames);
+ } else if (combinator is ShowElementCombinator) {
+ definedNames = show(definedNames, ((combinator as ShowElementCombinator)).shownNames);
} else {
AnalysisEngine.instance.logger.logError("Unknown type of combinator: ${combinator.runtimeType.toString()}");
}
@@ -9579,7 +9582,7 @@
* @param expression the expression to validate
*/
void validateInitializerExpression(List<ParameterElement> parameterElements, Expression expression) {
- EvaluationResultImpl result = expression.accept(new ConstantVisitor_10(this, parameterElements));
+ EvaluationResultImpl result = expression.accept(new ConstantVisitor_9(this, parameterElements));
reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER);
}
@@ -9622,10 +9625,10 @@
}
}
}
-class ConstantVisitor_10 extends ConstantVisitor {
+class ConstantVisitor_9 extends ConstantVisitor {
final ConstantVerifier ConstantVerifier_this;
List<ParameterElement> parameterElements;
- ConstantVisitor_10(this.ConstantVerifier_this, this.parameterElements) : super();
+ ConstantVisitor_9(this.ConstantVerifier_this, this.parameterElements) : super();
EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) {
Element element = node.element;
for (ParameterElement parameterElement in parameterElements) {
@@ -11908,17 +11911,20 @@
stringTypeArray[i] = ((missingOverridesArray[i] as PropertyAccessorElement)).isGetter() ? GET : SET;
}
}
+ AnalysisErrorWithProperties analysisError;
if (missingOverridesSize == 1) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName]);
+ analysisError = _errorReporter.newErrorWithProperties(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName]);
} else if (missingOverridesSize == 2) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName]);
+ analysisError = _errorReporter.newErrorWithProperties(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName]);
} else if (missingOverridesSize == 3) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName]);
+ analysisError = _errorReporter.newErrorWithProperties(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName]);
} else if (missingOverridesSize == 4) {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, stringTypeArray[3], missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName]);
+ analysisError = _errorReporter.newErrorWithProperties(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, stringTypeArray[3], missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName]);
} else {
- _errorReporter.reportError2(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, stringTypeArray[3], missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName, missingOverridesArray.length - 4]);
+ analysisError = _errorReporter.newErrorWithProperties(StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS, node.name, [stringTypeArray[0], missingOverridesArray[0].enclosingElement.displayName, missingOverridesArray[0].displayName, stringTypeArray[1], missingOverridesArray[1].enclosingElement.displayName, missingOverridesArray[1].displayName, stringTypeArray[2], missingOverridesArray[2].enclosingElement.displayName, missingOverridesArray[2].displayName, stringTypeArray[3], missingOverridesArray[3].enclosingElement.displayName, missingOverridesArray[3].displayName, missingOverridesArray.length - 4]);
}
+ analysisError.setProperty(ErrorProperty.UNIMPLEMENTED_METHODS, missingOverridesArray);
+ _errorReporter.reportError(analysisError);
return true;
}
@@ -12642,12 +12648,19 @@
* 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(ErrorReporter errorReporter) {
+ PubVerifier(AnalysisContext context, ErrorReporter errorReporter) {
+ this._context = context;
this._errorReporter = errorReporter;
}
Object visitImportDirective(ImportDirective directive) {
@@ -12655,14 +12668,17 @@
}
/**
- * Determine if the file file path lies inside the "lib" directory hierarchy but references a file
- * outside that directory hierarchy.
- * @param directive the import directive (not {@code 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 {@code null})
* @param path the file path being verified (not {@code null})
- * @return {@code true} if the file is inside but references a file outside
+ * @return {@code 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(ImportDirective directive, String path) {
- String fullName = getSourceFullName(directive);
+ bool checkForFileImportInsideLibReferencesFileOutside(StringLiteral uriLiteral, String path) {
+ Source source = getSource(uriLiteral);
+ String fullName = getSourceFullName(source);
if (fullName != null) {
int pathIndex = 0;
int fullNameIndex = fullName.length;
@@ -12672,6 +12688,11 @@
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;
@@ -12681,49 +12702,88 @@
}
/**
- * Determine if the given file path lies outside the "lib" directory hierarchy but references a
- * file inside that directory hierarchy.
- * @param directive the import directive (not {@code null})
+ * 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 {@code null})
* @param path the file path being verified (not {@code null})
- * @return {@code true} if the file is outside but references a file inside
+ * @return {@code 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(ImportDirective directive, String path) {
- if (path.startsWith("lib/") || path.contains("/lib/")) {
- String fullName = getSourceFullName(directive);
- if (fullName != null) {
- if (!fullName.contains("/lib/")) {
- return true;
- }
+ 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 = path.indexOf("/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;
}
/**
- * Determine if the given package import path contains ".."
+ * This verifies that the passed package import directive does not contain ".."
+ * @param uriLiteral the import URL (not {@code null})
* @param path the path to be validated (not {@code null})
- * @return {@code true} if the import path contains ".."
+ * @return {@code true} if and only if an error code is generated on the passed node
+ * @see PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
*/
- bool checkForPackageImportContainsDotDot(String path) => path.startsWith("../") || path.contains("/../");
+ 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 full name of the source associated with the compilation unit containing the given
- * AST node. The returned value will have all {@link File#separatorChar} replace by '/'.
+ * Answer the source associated with the compilation unit containing the given AST node.
* @param node the node (not {@code null})
- * @return the full name or {@code null} if it could not be determined
+ * @return the source or {@code null} if it could not be determined
*/
- String getSourceFullName(ASTNode node) {
+ Source getSource(ASTNode node) {
+ Source source = null;
CompilationUnit unit = node.getAncestor(CompilationUnit);
if (unit != null) {
CompilationUnitElement element = unit.element;
if (element != null) {
- Source librarySource = element.source;
- if (librarySource != null) {
- String fullName = librarySource.fullName;
- if (fullName != null) {
- return fullName.replaceAll(r'\', '/');
- }
- }
+ source = element.source;
+ }
+ }
+ return source;
+ }
+
+ /**
+ * Answer the full name of the given source. The returned value will have all{@link File#separatorChar} replace by '/'.
+ * @param source the source
+ * @return the full name or {@code 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;
diff --git a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
index 2348b7f..baf26d7 100644
--- a/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
@@ -395,7 +395,7 @@
*/
LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) {
List<bool> foundError = [false];
- AnalysisErrorListener errorListener = new AnalysisErrorListener_9(foundError);
+ AnalysisErrorListener errorListener = new AnalysisErrorListener_8(foundError);
Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_URI);
StringScanner scanner = new StringScanner(source, libraryFileContents, errorListener);
Parser parser = new Parser(source, errorListener);
@@ -494,9 +494,9 @@
return null;
}
}
-class AnalysisErrorListener_9 implements AnalysisErrorListener {
+class AnalysisErrorListener_8 implements AnalysisErrorListener {
List<bool> foundError;
- AnalysisErrorListener_9(this.foundError);
+ AnalysisErrorListener_8(this.foundError);
void onError(AnalysisError error) {
foundError[0] = true;
}
diff --git a/pkg/analyzer_experimental/lib/src/services/runtime/coverage_impl.dart b/pkg/analyzer_experimental/lib/src/services/runtime/coverage_impl.dart
new file mode 100644
index 0000000..df37f7b
--- /dev/null
+++ b/pkg/analyzer_experimental/lib/src/services/runtime/coverage_impl.dart
@@ -0,0 +1,157 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// A library for code coverage support for Dart.
+library runtime.coverage_impl;
+
+import "dart:io";
+
+import "package:logging/logging.dart" as log;
+import "package:pathos/path.dart" as po;
+
+import 'package:analyzer_experimental/src/generated/source.dart' show Source;
+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';
+import 'package:analyzer_experimental/src/generated/engine.dart' show RecordingErrorListener;
+
+
+log.Logger logger = log.Logger.root;
+
+/// Abstract server that listens requests and serves files, may be rewriting them.
+abstract class RewriteServer {
+ String _basePath;
+ RewriteServer(this._basePath);
+ void start() {
+ HttpServer.bind("127.0.0.1", 3445).then((HttpServer server) {
+ logger.info('RewriteServer is listening at: ${server.port}.');
+ server.listen((HttpRequest request) {
+ var response = request.response;
+ // Prepare path.
+ var path = _basePath + '/' + request.uri.path;
+ path = po.normalize(path);
+ logger.info('[$path] Requested.');
+ // May be serve using just path.
+ {
+ String content = rewritePathContent(path);
+ if (content != null) {
+ logger.info('[$path] Request served by path.');
+ response.write(content);
+ response.close();
+ return;
+ }
+ }
+ // Serve from file.
+ logger.info('[$path] Serving file.');
+ var file = new File(path);
+ file.exists().then((bool found) {
+ if (found) {
+ logger.finest('[$path] Found file.');
+ file.readAsString().then((String content) {
+ logger.finest('[$path] Got file content.');
+ var sw = new Stopwatch();
+ sw.start();
+ try {
+ content = rewriteFileContent(path, content);
+ } finally {
+ sw.stop();
+ logger.fine('[$path] Rewritten in ${sw.elapsedMilliseconds} ms.');
+ }
+ response.write(content);
+ response.close();
+ });
+ } else {
+ logger.severe('[$path] File not found.');
+ response.statusCode = HttpStatus.NOT_FOUND;
+ response.close();
+ }
+ });
+ });
+ });
+ }
+
+ /// Subclasses implement this method to rewrite the provided [code] of the file with [path].
+ /// Returns some content or `null` if file content should be requested.
+ String rewritePathContent(String path);
+
+ /// Subclasses implement this method to rewrite the provided [code] of the file with [path].
+ String rewriteFileContent(String path, String code);
+}
+
+/// Server that rewrites Dart code so that it reports execution of statements and other nodes.
+class CoverageServer extends RewriteServer {
+ CoverageServer(String basePath) : super(basePath);
+
+ String rewritePathContent(String path) {
+ if (path.endsWith('__coverage_impl.dart')) {
+ String implPath = po.joinAll([
+ po.dirname(new Options().script),
+ '..', 'lib', 'src', 'services', 'runtime', 'coverage_lib.dart']);
+ return new File(implPath).readAsStringSync();
+ }
+ return null;
+ }
+
+ String rewriteFileContent(String path, String code) {
+ if (po.extension(path).toLowerCase() != '.dart') return code;
+ if (path.contains('packages')) return code;
+ var unit = _parseCode(code);
+ var injector = new StringInjector(code);
+ // Inject coverage library import.
+ var directives = unit.directives;
+ if (directives.isNotEmpty && directives[0] is LibraryDirective) {
+ injector.inject(directives[0].end, 'import "__coverage_impl.dart" as __cc;');
+ } else {
+ throw new Exception('Only single library coverage is implemented.');
+ }
+ // Insert touch() invocations.
+ unit.accept(new InsertTouchInvocationsVisitor(injector));
+ // Done.
+ code = injector.code;
+ logger.finest('[$path] Rewritten content\n$code');
+ return code;
+ }
+
+ CompilationUnit _parseCode(String code) {
+ var source = null;
+ var errorListener = new RecordingErrorListener();
+ var parser = new Parser(source, errorListener);
+ var scanner = new StringScanner(source, code, errorListener);
+ var token = scanner.tokenize();
+ return parser.parseCompilationUnit(token);
+ }
+}
+
+/// The visitor that inserts `touch` method invocations.
+class InsertTouchInvocationsVisitor extends GeneralizingASTVisitor {
+ StringInjector injector;
+ InsertTouchInvocationsVisitor(this.injector);
+ visitStatement(Statement node) {
+ super.visitStatement(node);
+ var offset = node.end;
+ if (node is Block) {
+ offset--;
+ }
+ if (node is Block && node.parent is BlockFunctionBody) return null;
+ injector.inject(offset, '__cc.touch(${node.offset});');
+ return null;
+ }
+}
+
+/// Helper for injecting fragments into some existing [String].
+class StringInjector {
+ String code;
+ int _lastOffset = -1;
+ int _delta = 0;
+ StringInjector(this.code);
+ void inject(int offset, String fragment) {
+ if (offset < _lastOffset) {
+ throw new ArgumentError('Only forward inserts are supported, was $_lastOffset given $offset');
+ }
+ _lastOffset = offset;
+ offset += _delta;
+ code = code.substring(0, offset) + fragment + code.substring(offset);
+ _delta += fragment.length;
+ }
+}
\ No newline at end of file
diff --git a/pkg/analyzer_experimental/lib/src/services/runtime/coverage_lib.dart b/pkg/analyzer_experimental/lib/src/services/runtime/coverage_lib.dart
new file mode 100644
index 0000000..945b38f
--- /dev/null
+++ b/pkg/analyzer_experimental/lib/src/services/runtime/coverage_lib.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.
+
+/// This library is injected into the applications under coverage.
+library coverage_lib;
+
+/// Notifies that the object with the given [id] - statement, token, etc was executed.
+touch(int id) {
+ print('touch: $id');
+}
diff --git a/pkg/analyzer_experimental/pubspec.yaml b/pkg/analyzer_experimental/pubspec.yaml
index 848a362..13b0f89 100644
--- a/pkg/analyzer_experimental/pubspec.yaml
+++ b/pkg/analyzer_experimental/pubspec.yaml
@@ -4,6 +4,7 @@
homepage: http://www.dartlang.org
dependencies:
args: any
+ logging: any
pathos: any
dev_dependencies:
unittest: any
diff --git a/pkg/analyzer_experimental/test/generated/ast_test.dart b/pkg/analyzer_experimental/test/generated/ast_test.dart
index a6903cd..ae71ad1b 100644
--- a/pkg/analyzer_experimental/test/generated/ast_test.dart
+++ b/pkg/analyzer_experimental/test/generated/ast_test.dart
@@ -735,7 +735,7 @@
String source = EngineTestCase.createSource(["class A {", " bool get g => true;", "}", "class B {", " int f() {", " num q() {", " return 3;", " }", " return q() + 4;", " }", "}", "A f(var p) {", " if ((p as A).g) {", " return p;", " } else {", " return null;", " }", "}"]);
CompilationUnit unit = ParserTestCase.parseCompilationUnit(source, []);
List<ASTNode> nodes = new List<ASTNode>();
- BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_15(nodes);
+ BreadthFirstVisitor<Object> visitor = new BreadthFirstVisitor_14(nodes);
visitor.visitAllNodes(unit);
EngineTestCase.assertSize(59, nodes);
EngineTestCase.assertInstanceOf(CompilationUnit, nodes[0]);
@@ -753,9 +753,9 @@
});
}
}
-class BreadthFirstVisitor_15 extends BreadthFirstVisitor<Object> {
+class BreadthFirstVisitor_14 extends BreadthFirstVisitor<Object> {
List<ASTNode> nodes;
- BreadthFirstVisitor_15(this.nodes) : super();
+ BreadthFirstVisitor_14(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 ca36ed7..a89b723 100644
--- a/pkg/analyzer_experimental/test/generated/element_test.dart
+++ b/pkg/analyzer_experimental/test/generated/element_test.dart
@@ -11,8 +11,8 @@
import 'package:analyzer_experimental/src/generated/error.dart';
import 'package:analyzer_experimental/src/generated/scanner.dart';
import 'package:analyzer_experimental/src/generated/utilities_dart.dart';
-import 'package:analyzer_experimental/src/generated/ast.dart' hide Annotation;
-import 'package:analyzer_experimental/src/generated/element.dart' hide Annotation;
+import 'package:analyzer_experimental/src/generated/ast.dart';
+import 'package:analyzer_experimental/src/generated/element.dart';
import 'package:analyzer_experimental/src/generated/engine.dart' show AnalysisContext, AnalysisContextImpl;
import 'package:unittest/unittest.dart' as _ut;
import 'test_support.dart';
@@ -31,6 +31,11 @@
ElementLocationImpl second = new ElementLocationImpl.con2(encoding);
JUnitTestCase.assertTrue(first == second);
}
+ void test_equals_equalWithDifferentUriKind() {
+ ElementLocationImpl first = new ElementLocationImpl.con2("fa;fb;c");
+ ElementLocationImpl second = new ElementLocationImpl.con2("pa;pb;c");
+ JUnitTestCase.assertTrue(first == second);
+ }
void test_equals_notEqual_differentLengths() {
ElementLocationImpl first = new ElementLocationImpl.con2("a;b;c");
ElementLocationImpl second = new ElementLocationImpl.con2("a;b;c;d");
@@ -69,6 +74,10 @@
final __test = new ElementLocationImplTest();
runJUnitTest(__test, __test.test_equals_equal);
});
+ _ut.test('test_equals_equalWithDifferentUriKind', () {
+ final __test = new ElementLocationImplTest();
+ runJUnitTest(__test, __test.test_equals_equalWithDifferentUriKind);
+ });
_ut.test('test_equals_notEqual_differentLengths', () {
final __test = new ElementLocationImplTest();
runJUnitTest(__test, __test.test_equals_notEqual_differentLengths);
@@ -793,6 +802,13 @@
JUnitTestCase.assertFalse(dynamicType.isSubtypeOf(typeA));
JUnitTestCase.assertTrue(typeA.isSubtypeOf(dynamicType));
}
+ void test_isSubtypeOf_function() {
+ InterfaceType stringType = _typeProvider.stringType;
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ classA.methods = <MethodElement> [ElementFactory.methodElement("call", VoidTypeImpl.instance, [stringType])];
+ FunctionType functionType = ElementFactory.functionElement5("f", <ClassElement> [stringType.element]).type;
+ JUnitTestCase.assertTrue(classA.type.isSubtypeOf(functionType));
+ }
void test_isSubtypeOf_interface() {
ClassElement classA = ElementFactory.classElement2("A", []);
ClassElement classB = ElementFactory.classElement("B", classA.type, []);
@@ -1368,6 +1384,10 @@
final __test = new InterfaceTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_dynamic);
});
+ _ut.test('test_isSubtypeOf_function', () {
+ final __test = new InterfaceTypeImplTest();
+ runJUnitTest(__test, __test.test_isSubtypeOf_function);
+ });
_ut.test('test_isSubtypeOf_interface', () {
final __test = new InterfaceTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_interface);
@@ -2206,7 +2226,7 @@
}
void test_isSubtypeOf_baseCase_classFunction() {
ClassElementImpl functionElement = ElementFactory.classElement2("Function", []);
- InterfaceTypeImpl functionType = new InterfaceTypeImpl_19(functionElement);
+ InterfaceTypeImpl functionType = new InterfaceTypeImpl_18(functionElement);
FunctionType f = ElementFactory.functionElement("f").type;
JUnitTestCase.assertTrue(f.isSubtypeOf(functionType));
}
@@ -2389,6 +2409,30 @@
FunctionType s = ElementFactory.functionElement2("s", ElementFactory.classElement2("B", [])).type;
JUnitTestCase.assertFalse(t.isSubtypeOf(s));
}
+ void test_isSubtypeOf_typeParameters_matchesBounds() {
+ TestTypeProvider provider = new TestTypeProvider();
+ InterfaceType boolType = provider.boolType;
+ InterfaceType stringType = provider.stringType;
+ TypeVariableElementImpl variableB = new TypeVariableElementImpl(ASTFactory.identifier3("B"));
+ variableB.bound = boolType;
+ TypeVariableTypeImpl typeB = new TypeVariableTypeImpl(variableB);
+ TypeVariableElementImpl variableS = new TypeVariableElementImpl(ASTFactory.identifier3("S"));
+ variableS.bound = stringType;
+ TypeVariableTypeImpl typeS = new TypeVariableTypeImpl(variableS);
+ FunctionElementImpl functionAliasElement = new FunctionElementImpl.con1(ASTFactory.identifier3("func"));
+ FunctionTypeImpl functionAliasType = new FunctionTypeImpl.con1(functionAliasElement);
+ functionAliasElement.type = functionAliasType;
+ functionAliasType.returnType = stringType;
+ functionAliasType.normalParameterTypes = <Type2> [typeB];
+ functionAliasType.optionalParameterTypes = <Type2> [typeS];
+ FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactory.identifier3("f"));
+ FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement);
+ functionElement.type = functionType;
+ functionType.returnType = provider.dynamicType;
+ functionType.normalParameterTypes = <Type2> [boolType];
+ functionType.optionalParameterTypes = <Type2> [stringType];
+ JUnitTestCase.assertTrue(functionType.isAssignableTo(functionAliasType));
+ }
void test_isSubtypeOf_wrongFunctionType_normal_named() {
ClassElement a = ElementFactory.classElement2("A", []);
FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).type;
@@ -2629,6 +2673,10 @@
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_returnType_tNotAssignableToS);
});
+ _ut.test('test_isSubtypeOf_typeParameters_matchesBounds', () {
+ final __test = new FunctionTypeImplTest();
+ runJUnitTest(__test, __test.test_isSubtypeOf_typeParameters_matchesBounds);
+ });
_ut.test('test_isSubtypeOf_wrongFunctionType_normal_named', () {
final __test = new FunctionTypeImplTest();
runJUnitTest(__test, __test.test_isSubtypeOf_wrongFunctionType_normal_named);
@@ -2664,8 +2712,8 @@
});
}
}
-class InterfaceTypeImpl_19 extends InterfaceTypeImpl {
- InterfaceTypeImpl_19(ClassElement arg0) : super.con1(arg0);
+class InterfaceTypeImpl_18 extends InterfaceTypeImpl {
+ InterfaceTypeImpl_18(ClassElement arg0) : super.con1(arg0);
bool isDartCoreFunction() => true;
}
main() {
diff --git a/pkg/analyzer_experimental/test/generated/parser_test.dart b/pkg/analyzer_experimental/test/generated/parser_test.dart
index b420160..9c5f3d8 100644
--- a/pkg/analyzer_experimental/test/generated/parser_test.dart
+++ b/pkg/analyzer_experimental/test/generated/parser_test.dart
@@ -3674,7 +3674,7 @@
* @throws Exception if the method could not be invoked or throws an exception
*/
String computeStringValue(String lexeme) {
- AnalysisErrorListener listener = new AnalysisErrorListener_20();
+ AnalysisErrorListener listener = new AnalysisErrorListener_19();
Parser parser = new Parser(null, listener);
return invokeParserMethodImpl(parser, "computeStringValue", <Object> [lexeme], null) as String;
}
@@ -5847,7 +5847,7 @@
});
}
}
-class AnalysisErrorListener_20 implements AnalysisErrorListener {
+class AnalysisErrorListener_19 implements AnalysisErrorListener {
void onError(AnalysisError event) {
JUnitTestCase.fail("Unexpected compilation error: ${event.message} (${event.offset}, ${event.length})");
}
diff --git a/pkg/analyzer_experimental/test/generated/resolver_test.dart b/pkg/analyzer_experimental/test/generated/resolver_test.dart
index a4a9b6b..c365a79 100644
--- a/pkg/analyzer_experimental/test/generated/resolver_test.dart
+++ b/pkg/analyzer_experimental/test/generated/resolver_test.dart
@@ -8,7 +8,7 @@
import 'package:analyzer_experimental/src/generated/source_io.dart';
import 'package:analyzer_experimental/src/generated/error.dart';
import 'package:analyzer_experimental/src/generated/scanner.dart';
-import 'package:analyzer_experimental/src/generated/ast.dart' hide Annotation;
+import 'package:analyzer_experimental/src/generated/ast.dart';
import 'package:analyzer_experimental/src/generated/parser.dart' show ParserErrorCode;
import 'package:analyzer_experimental/src/generated/element.dart';
import 'package:analyzer_experimental/src/generated/resolver.dart';
@@ -3141,8 +3141,7 @@
* @return the source object representing the added file
*/
Source addSource2(String filePath, String contents) {
- Source source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUtilities2.createFile(filePath));
- _sourceFactory.setContents(source, contents);
+ Source source = cacheSource(filePath, contents);
ChangeSet changeSet = new ChangeSet();
changeSet.added(source);
_analysisContext.applyChanges(changeSet);
@@ -3182,6 +3181,19 @@
}
/**
+ * Cache the source file content in the source factory but don't add the source to the analysis
+ * context. The file path should be absolute.
+ * @param filePath the path of the file being cached
+ * @param contents the contents to be returned by the content provider for the specified file
+ * @return the source object representing the cached file
+ */
+ Source cacheSource(String filePath, String contents) {
+ Source source = new FileBasedSource.con1(_sourceFactory.contentCache, FileUtilities2.createFile(filePath));
+ _sourceFactory.setContents(source, contents);
+ return source;
+ }
+
+ /**
* Create a library element that represents a library named {@code "test"} containing a single
* empty compilation unit.
* @return the library element that was created
@@ -7358,6 +7370,11 @@
}
}
class PubSuggestionCodeTest extends ResolverTestCase {
+ void test_import_package() {
+ Source source = addSource(EngineTestCase.createSource(["import 'package:somepackage/other.dart';"]));
+ resolve(source);
+ assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
+ }
void test_import_packageWithDotDot() {
Source source = addSource(EngineTestCase.createSource(["import 'package:somepackage/../other.dart';"]));
resolve(source);
@@ -7369,22 +7386,58 @@
assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST, PubSuggestionCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT]);
}
void test_import_referenceIntoLibDirectory() {
- Source source = addSource(EngineTestCase.createSource(["import '../lib/other.dart';"]));
+ cacheSource("/myproj/pubspec.yaml", "");
+ cacheSource("/myproj/lib/other.dart", "");
+ Source source = addSource2("/myproj/web/test.dart", EngineTestCase.createSource(["import '../lib/other.dart';"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST, PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE]);
+ assertErrors([PubSuggestionCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE]);
+ }
+ void test_import_referenceIntoLibDirectory_no_pubspec() {
+ cacheSource("/myproj/lib/other.dart", "");
+ Source source = addSource2("/myproj/web/test.dart", EngineTestCase.createSource(["import '../lib/other.dart';"]));
+ resolve(source);
+ assertNoErrors();
}
void test_import_referenceOutOfLibDirectory() {
- Source source = addSource2("lib/test.dart", EngineTestCase.createSource(["import '../web/other.dart';"]));
+ cacheSource("/myproj/pubspec.yaml", "");
+ cacheSource("/myproj/web/other.dart", "");
+ Source source = addSource2("/myproj/lib/test.dart", EngineTestCase.createSource(["import '../web/other.dart';"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST, PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE]);
+ assertErrors([PubSuggestionCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE]);
}
- void test_import_valid() {
- Source source = addSource2("lib2/test.dart", EngineTestCase.createSource(["import '../web/other.dart';"]));
+ void test_import_referenceOutOfLibDirectory_no_pubspec() {
+ cacheSource("/myproj/web/other.dart", "");
+ Source source = addSource2("/myproj/lib/test.dart", EngineTestCase.createSource(["import '../web/other.dart';"]));
resolve(source);
- assertErrors([CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
+ assertNoErrors();
+ }
+ void test_import_valid_inside_lib1() {
+ cacheSource("/myproj/pubspec.yaml", "");
+ cacheSource("/myproj/lib/other.dart", "");
+ Source source = addSource2("/myproj/lib/test.dart", EngineTestCase.createSource(["import 'other.dart';"]));
+ resolve(source);
+ assertNoErrors();
+ }
+ void test_import_valid_inside_lib2() {
+ cacheSource("/myproj/pubspec.yaml", "");
+ cacheSource("/myproj/lib/bar/other.dart", "");
+ Source source = addSource2("/myproj/lib/foo/test.dart", EngineTestCase.createSource(["import '../bar/other.dart';"]));
+ resolve(source);
+ assertNoErrors();
+ }
+ void test_import_valid_outside_lib() {
+ cacheSource("/myproj/pubspec.yaml", "");
+ cacheSource("/myproj/web/other.dart", "");
+ Source source = addSource2("/myproj/lib2/test.dart", EngineTestCase.createSource(["import '../web/other.dart';"]));
+ resolve(source);
+ assertNoErrors();
}
static dartSuite() {
_ut.group('PubSuggestionCodeTest', () {
+ _ut.test('test_import_package', () {
+ final __test = new PubSuggestionCodeTest();
+ runJUnitTest(__test, __test.test_import_package);
+ });
_ut.test('test_import_packageWithDotDot', () {
final __test = new PubSuggestionCodeTest();
runJUnitTest(__test, __test.test_import_packageWithDotDot);
@@ -7397,13 +7450,29 @@
final __test = new PubSuggestionCodeTest();
runJUnitTest(__test, __test.test_import_referenceIntoLibDirectory);
});
+ _ut.test('test_import_referenceIntoLibDirectory_no_pubspec', () {
+ final __test = new PubSuggestionCodeTest();
+ runJUnitTest(__test, __test.test_import_referenceIntoLibDirectory_no_pubspec);
+ });
_ut.test('test_import_referenceOutOfLibDirectory', () {
final __test = new PubSuggestionCodeTest();
runJUnitTest(__test, __test.test_import_referenceOutOfLibDirectory);
});
- _ut.test('test_import_valid', () {
+ _ut.test('test_import_referenceOutOfLibDirectory_no_pubspec', () {
final __test = new PubSuggestionCodeTest();
- runJUnitTest(__test, __test.test_import_valid);
+ runJUnitTest(__test, __test.test_import_referenceOutOfLibDirectory_no_pubspec);
+ });
+ _ut.test('test_import_valid_inside_lib1', () {
+ final __test = new PubSuggestionCodeTest();
+ runJUnitTest(__test, __test.test_import_valid_inside_lib1);
+ });
+ _ut.test('test_import_valid_inside_lib2', () {
+ final __test = new PubSuggestionCodeTest();
+ runJUnitTest(__test, __test.test_import_valid_inside_lib2);
+ });
+ _ut.test('test_import_valid_outside_lib', () {
+ final __test = new PubSuggestionCodeTest();
+ runJUnitTest(__test, __test.test_import_valid_outside_lib);
});
});
}
@@ -9474,6 +9543,16 @@
JUnitTestCase.assertSame(_typeProvider.doubleType, analyze(node));
_listener.assertNoErrors();
}
+ void test_visitBinaryExpression_star_notSpecial() {
+ ClassElementImpl classA = ElementFactory.classElement2("A", []);
+ InterfaceType typeA = classA.type;
+ 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);
+ 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, "*"));
@@ -10179,6 +10258,10 @@
final __test = new StaticTypeAnalyzerTest();
runJUnitTest(__test, __test.test_visitBinaryExpression_starID);
});
+ _ut.test('test_visitBinaryExpression_star_notSpecial', () {
+ final __test = new StaticTypeAnalyzerTest();
+ runJUnitTest(__test, __test.test_visitBinaryExpression_star_notSpecial);
+ });
_ut.test('test_visitBooleanLiteral_false', () {
final __test = new StaticTypeAnalyzerTest();
runJUnitTest(__test, __test.test_visitBooleanLiteral_false);
@@ -10394,7 +10477,7 @@
void test_define_duplicate() {
LibraryElement definingLibrary2 = createTestLibrary();
GatheringErrorListener errorListener2 = new GatheringErrorListener();
- Scope rootScope = new Scope_17(definingLibrary2, errorListener2);
+ Scope rootScope = new Scope_16(definingLibrary2, errorListener2);
EnclosedScope scope = new EnclosedScope(rootScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
VariableElement element2 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -10405,7 +10488,7 @@
void test_define_normal() {
LibraryElement definingLibrary3 = createTestLibrary();
GatheringErrorListener errorListener3 = new GatheringErrorListener();
- Scope rootScope = new Scope_18(definingLibrary3, errorListener3);
+ Scope rootScope = new Scope_17(definingLibrary3, errorListener3);
EnclosedScope outerScope = new EnclosedScope(rootScope);
EnclosedScope innerScope = new EnclosedScope(outerScope);
VariableElement element1 = ElementFactory.localVariableElement(ASTFactory.identifier3("v1"));
@@ -10427,18 +10510,18 @@
});
}
}
-class Scope_17 extends Scope {
+class Scope_16 extends Scope {
LibraryElement definingLibrary2;
GatheringErrorListener errorListener2;
- Scope_17(this.definingLibrary2, this.errorListener2) : super();
+ Scope_16(this.definingLibrary2, this.errorListener2) : super();
LibraryElement get definingLibrary => definingLibrary2;
AnalysisErrorListener get errorListener => errorListener2;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
}
-class Scope_18 extends Scope {
+class Scope_17 extends Scope {
LibraryElement definingLibrary3;
GatheringErrorListener errorListener3;
- Scope_18(this.definingLibrary3, this.errorListener3) : super();
+ Scope_17(this.definingLibrary3, this.errorListener3) : super();
LibraryElement get definingLibrary => definingLibrary3;
AnalysisErrorListener get errorListener => errorListener3;
Element lookup3(Identifier identifier, String name, LibraryElement referencingLibrary) => null;
@@ -10936,7 +11019,7 @@
JUnitTestCase.assertNotNull(unit);
List<ClassElement> classes = unit.types;
EngineTestCase.assertLength(1, classes);
- List<Annotation> annotations = classes[0].metadata;
+ List<ElementAnnotation> annotations = classes[0].metadata;
EngineTestCase.assertLength(1, annotations);
assertNoErrors();
verify([source]);
@@ -10950,7 +11033,7 @@
List<ClassElement> classes = unit.types;
EngineTestCase.assertLength(1, classes);
FieldElement field = classes[0].fields[0];
- List<Annotation> annotations = field.metadata;
+ List<ElementAnnotation> annotations = field.metadata;
EngineTestCase.assertLength(1, annotations);
assertNoErrors();
verify([source]);
@@ -10959,7 +11042,7 @@
Source source = addSource(EngineTestCase.createSource(["@A library lib;", "const A = null;"]));
LibraryElement library = resolve(source);
JUnitTestCase.assertNotNull(library);
- List<Annotation> annotations = library.metadata;
+ List<ElementAnnotation> annotations = library.metadata;
EngineTestCase.assertLength(1, annotations);
assertNoErrors();
verify([source]);
@@ -10973,7 +11056,7 @@
List<ClassElement> classes = unit.types;
EngineTestCase.assertLength(1, classes);
MethodElement method = classes[0].methods[0];
- List<Annotation> annotations = method.metadata;
+ List<ElementAnnotation> annotations = method.metadata;
EngineTestCase.assertLength(1, annotations);
assertNoErrors();
verify([source]);
diff --git a/pkg/browser/lib/dart.js b/pkg/browser/lib/dart.js
index d610647..48cd8ad 100644
--- a/pkg/browser/lib/dart.js
+++ b/pkg/browser/lib/dart.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -36,217 +36,3 @@
}
}, false);
}
-
-// ---------------------------------------------------------------------------
-// Experimental support for JS interoperability
-// ---------------------------------------------------------------------------
-function SendPortSync() {
-}
-
-function ReceivePortSync() {
- this.id = ReceivePortSync.id++;
- ReceivePortSync.map[this.id] = this;
-}
-
-(function() {
- // Serialize the following types as follows:
- // - primitives / null: unchanged
- // - lists: [ 'list', internal id, list of recursively serialized elements ]
- // - maps: [ 'map', internal id, map of keys and recursively serialized values ]
- // - send ports: [ 'sendport', type, isolate id, port id ]
- //
- // Note, internal id's are for cycle detection.
- function serialize(message) {
- var visited = [];
- function checkedSerialization(obj, serializer) {
- // Implementation detail: for now use linear search.
- // Another option is expando, but it may prohibit
- // VM optimizations (like putting object into slow mode
- // on property deletion.)
- var id = visited.indexOf(obj);
- if (id != -1) return [ 'ref', id ];
- var id = visited.length;
- visited.push(obj);
- return serializer(id);
- }
-
- function doSerialize(message) {
- if (message == null) {
- return null; // Convert undefined to null.
- } else if (typeof(message) == 'string' ||
- typeof(message) == 'number' ||
- typeof(message) == 'boolean') {
- return message;
- } else if (message instanceof Array) {
- return checkedSerialization(message, function(id) {
- var values = new Array(message.length);
- for (var i = 0; i < message.length; i++) {
- values[i] = doSerialize(message[i]);
- }
- return [ 'list', id, values ];
- });
- } else if (message instanceof LocalSendPortSync) {
- return [ 'sendport', 'nativejs', message.receivePort.id ];
- } else if (message instanceof DartSendPortSync) {
- return [ 'sendport', 'dart', message.isolateId, message.portId ];
- } else {
- return checkedSerialization(message, function(id) {
- var keys = Object.getOwnPropertyNames(message);
- var values = new Array(keys.length);
- for (var i = 0; i < keys.length; i++) {
- values[i] = doSerialize(message[keys[i]]);
- }
- return [ 'map', id, keys, values ];
- });
- }
- }
- return doSerialize(message);
- }
-
- function deserialize(message) {
- return deserializeHelper(message);
- }
-
- function deserializeHelper(message) {
- if (message == null ||
- typeof(message) == 'string' ||
- typeof(message) == 'number' ||
- typeof(message) == 'boolean') {
- return message;
- }
- switch (message[0]) {
- case 'map': return deserializeMap(message);
- case 'sendport': return deserializeSendPort(message);
- case 'list': return deserializeList(message);
- default: throw 'unimplemented';
- }
- }
-
- function deserializeMap(message) {
- var result = { };
- var id = message[1];
- var keys = message[2];
- var values = message[3];
- for (var i = 0, length = keys.length; i < length; i++) {
- var key = deserializeHelper(keys[i]);
- var value = deserializeHelper(values[i]);
- result[key] = value;
- }
- return result;
- }
-
- function deserializeSendPort(message) {
- var tag = message[1];
- switch (tag) {
- case 'nativejs':
- var id = message[2];
- return new LocalSendPortSync(ReceivePortSync.map[id]);
- case 'dart':
- var isolateId = message[2];
- var portId = message[3];
- return new DartSendPortSync(isolateId, portId);
- default:
- throw 'Illegal SendPortSync type: $tag';
- }
- }
-
- function deserializeList(message) {
- var values = message[2];
- var length = values.length;
- var result = new Array(length);
- for (var i = 0; i < length; i++) {
- result[i] = deserializeHelper(values[i]);
- }
- return result;
- }
-
- window.registerPort = function(name, port) {
- var stringified = JSON.stringify(serialize(port));
- var attrName = 'dart-port:' + name;
- document.documentElement.setAttribute(attrName, stringified);
- };
-
- window.lookupPort = function(name) {
- var attrName = 'dart-port:' + name;
- var stringified = document.documentElement.getAttribute(attrName);
- return deserialize(JSON.parse(stringified));
- };
-
- ReceivePortSync.id = 0;
- ReceivePortSync.map = {};
-
- ReceivePortSync.dispatchCall = function(id, message) {
- // TODO(vsm): Handle and propagate exceptions.
- var deserialized = deserialize(message);
- var result = ReceivePortSync.map[id].callback(deserialized);
- return serialize(result);
- };
-
- ReceivePortSync.prototype.receive = function(callback) {
- this.callback = callback;
- };
-
- ReceivePortSync.prototype.toSendPort = function() {
- return new LocalSendPortSync(this);
- };
-
- ReceivePortSync.prototype.close = function() {
- delete ReceivePortSync.map[this.id];
- };
-
- if (navigator.webkitStartDart) {
- window.addEventListener('js-sync-message', function(event) {
- var data = JSON.parse(getPortSyncEventData(event));
- var deserialized = deserialize(data.message);
- var result = ReceivePortSync.map[data.id].callback(deserialized);
- // TODO(vsm): Handle and propagate exceptions.
- dispatchEvent('js-result', serialize(result));
- }, false);
- }
-
- function LocalSendPortSync(receivePort) {
- this.receivePort = receivePort;
- }
-
- LocalSendPortSync.prototype = new SendPortSync();
-
- LocalSendPortSync.prototype.callSync = function(message) {
- // TODO(vsm): Do a direct deepcopy.
- message = deserialize(serialize(message));
- return this.receivePort.callback(message);
- }
-
- function DartSendPortSync(isolateId, portId) {
- this.isolateId = isolateId;
- this.portId = portId;
- }
-
- DartSendPortSync.prototype = new SendPortSync();
-
- function dispatchEvent(receiver, message) {
- var string = JSON.stringify(message);
- var event = document.createEvent('CustomEvent');
- event.initCustomEvent(receiver, false, false, string);
- window.dispatchEvent(event);
- }
-
- function getPortSyncEventData(event) {
- return event.detail;
- }
-
- DartSendPortSync.prototype.callSync = function(message) {
- var serialized = serialize(message);
- var target = 'dart-port-' + this.isolateId + '-' + this.portId;
- // TODO(vsm): Make this re-entrant.
- // TODO(vsm): Set this up set once, on the first call.
- var source = target + '-result';
- var result = null;
- var listener = function (e) {
- result = JSON.parse(getPortSyncEventData(e));
- };
- window.addEventListener(source, listener, false);
- dispatchEvent(target, [source, serialized]);
- window.removeEventListener(source, listener, false);
- return deserialize(result);
- }
-})();
diff --git a/pkg/browser/lib/interop.js b/pkg/browser/lib/interop.js
new file mode 100644
index 0000000..52cc966
--- /dev/null
+++ b/pkg/browser/lib/interop.js
@@ -0,0 +1,217 @@
+// 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.
+
+// ---------------------------------------------------------------------------
+// Support for JS interoperability
+// ---------------------------------------------------------------------------
+function SendPortSync() {
+}
+
+function ReceivePortSync() {
+ this.id = ReceivePortSync.id++;
+ ReceivePortSync.map[this.id] = this;
+}
+
+(function() {
+ // Serialize the following types as follows:
+ // - primitives / null: unchanged
+ // - lists: [ 'list', internal id, list of recursively serialized elements ]
+ // - maps: [ 'map', internal id, map of keys and recursively serialized values ]
+ // - send ports: [ 'sendport', type, isolate id, port id ]
+ //
+ // Note, internal id's are for cycle detection.
+ function serialize(message) {
+ var visited = [];
+ function checkedSerialization(obj, serializer) {
+ // Implementation detail: for now use linear search.
+ // Another option is expando, but it may prohibit
+ // VM optimizations (like putting object into slow mode
+ // on property deletion.)
+ var id = visited.indexOf(obj);
+ if (id != -1) return [ 'ref', id ];
+ var id = visited.length;
+ visited.push(obj);
+ return serializer(id);
+ }
+
+ function doSerialize(message) {
+ if (message == null) {
+ return null; // Convert undefined to null.
+ } else if (typeof(message) == 'string' ||
+ typeof(message) == 'number' ||
+ typeof(message) == 'boolean') {
+ return message;
+ } else if (message instanceof Array) {
+ return checkedSerialization(message, function(id) {
+ var values = new Array(message.length);
+ for (var i = 0; i < message.length; i++) {
+ values[i] = doSerialize(message[i]);
+ }
+ return [ 'list', id, values ];
+ });
+ } else if (message instanceof LocalSendPortSync) {
+ return [ 'sendport', 'nativejs', message.receivePort.id ];
+ } else if (message instanceof DartSendPortSync) {
+ return [ 'sendport', 'dart', message.isolateId, message.portId ];
+ } else {
+ return checkedSerialization(message, function(id) {
+ var keys = Object.getOwnPropertyNames(message);
+ var values = new Array(keys.length);
+ for (var i = 0; i < keys.length; i++) {
+ values[i] = doSerialize(message[keys[i]]);
+ }
+ return [ 'map', id, keys, values ];
+ });
+ }
+ }
+ return doSerialize(message);
+ }
+
+ function deserialize(message) {
+ return deserializeHelper(message);
+ }
+
+ function deserializeHelper(message) {
+ if (message == null ||
+ typeof(message) == 'string' ||
+ typeof(message) == 'number' ||
+ typeof(message) == 'boolean') {
+ return message;
+ }
+ switch (message[0]) {
+ case 'map': return deserializeMap(message);
+ case 'sendport': return deserializeSendPort(message);
+ case 'list': return deserializeList(message);
+ default: throw 'unimplemented';
+ }
+ }
+
+ function deserializeMap(message) {
+ var result = { };
+ var id = message[1];
+ var keys = message[2];
+ var values = message[3];
+ for (var i = 0, length = keys.length; i < length; i++) {
+ var key = deserializeHelper(keys[i]);
+ var value = deserializeHelper(values[i]);
+ result[key] = value;
+ }
+ return result;
+ }
+
+ function deserializeSendPort(message) {
+ var tag = message[1];
+ switch (tag) {
+ case 'nativejs':
+ var id = message[2];
+ return new LocalSendPortSync(ReceivePortSync.map[id]);
+ case 'dart':
+ var isolateId = message[2];
+ var portId = message[3];
+ return new DartSendPortSync(isolateId, portId);
+ default:
+ throw 'Illegal SendPortSync type: $tag';
+ }
+ }
+
+ function deserializeList(message) {
+ var values = message[2];
+ var length = values.length;
+ var result = new Array(length);
+ for (var i = 0; i < length; i++) {
+ result[i] = deserializeHelper(values[i]);
+ }
+ return result;
+ }
+
+ window.registerPort = function(name, port) {
+ var stringified = JSON.stringify(serialize(port));
+ var attrName = 'dart-port:' + name;
+ document.documentElement.setAttribute(attrName, stringified);
+ };
+
+ window.lookupPort = function(name) {
+ var attrName = 'dart-port:' + name;
+ var stringified = document.documentElement.getAttribute(attrName);
+ return deserialize(JSON.parse(stringified));
+ };
+
+ ReceivePortSync.id = 0;
+ ReceivePortSync.map = {};
+
+ ReceivePortSync.dispatchCall = function(id, message) {
+ // TODO(vsm): Handle and propagate exceptions.
+ var deserialized = deserialize(message);
+ var result = ReceivePortSync.map[id].callback(deserialized);
+ return serialize(result);
+ };
+
+ ReceivePortSync.prototype.receive = function(callback) {
+ this.callback = callback;
+ };
+
+ ReceivePortSync.prototype.toSendPort = function() {
+ return new LocalSendPortSync(this);
+ };
+
+ ReceivePortSync.prototype.close = function() {
+ delete ReceivePortSync.map[this.id];
+ };
+
+ if (navigator.webkitStartDart) {
+ window.addEventListener('js-sync-message', function(event) {
+ var data = JSON.parse(getPortSyncEventData(event));
+ var deserialized = deserialize(data.message);
+ var result = ReceivePortSync.map[data.id].callback(deserialized);
+ // TODO(vsm): Handle and propagate exceptions.
+ dispatchEvent('js-result', serialize(result));
+ }, false);
+ }
+
+ function LocalSendPortSync(receivePort) {
+ this.receivePort = receivePort;
+ }
+
+ LocalSendPortSync.prototype = new SendPortSync();
+
+ LocalSendPortSync.prototype.callSync = function(message) {
+ // TODO(vsm): Do a direct deepcopy.
+ message = deserialize(serialize(message));
+ return this.receivePort.callback(message);
+ }
+
+ function DartSendPortSync(isolateId, portId) {
+ this.isolateId = isolateId;
+ this.portId = portId;
+ }
+
+ DartSendPortSync.prototype = new SendPortSync();
+
+ function dispatchEvent(receiver, message) {
+ var string = JSON.stringify(message);
+ var event = document.createEvent('CustomEvent');
+ event.initCustomEvent(receiver, false, false, string);
+ window.dispatchEvent(event);
+ }
+
+ function getPortSyncEventData(event) {
+ return event.detail;
+ }
+
+ DartSendPortSync.prototype.callSync = function(message) {
+ var serialized = serialize(message);
+ var target = 'dart-port-' + this.isolateId + '-' + this.portId;
+ // TODO(vsm): Make this re-entrant.
+ // TODO(vsm): Set this up set once, on the first call.
+ var source = target + '-result';
+ var result = null;
+ var listener = function (e) {
+ result = JSON.parse(getPortSyncEventData(e));
+ };
+ window.addEventListener(source, listener, false);
+ dispatchEvent(target, [source, serialized]);
+ window.removeEventListener(source, listener, false);
+ return deserialize(result);
+ }
+})();
diff --git a/tests/lib/crypto/base64_test.dart b/pkg/crypto/test/base64_test.dart
similarity index 100%
rename from tests/lib/crypto/base64_test.dart
rename to pkg/crypto/test/base64_test.dart
diff --git a/tests/lib/crypto/hmac_md5_test.dart b/pkg/crypto/test/hmac_md5_test.dart
similarity index 100%
rename from tests/lib/crypto/hmac_md5_test.dart
rename to pkg/crypto/test/hmac_md5_test.dart
diff --git a/tests/lib/crypto/hmac_sha1_test.dart b/pkg/crypto/test/hmac_sha1_test.dart
similarity index 100%
rename from tests/lib/crypto/hmac_sha1_test.dart
rename to pkg/crypto/test/hmac_sha1_test.dart
diff --git a/tests/lib/crypto/hmac_sha1_test_vectors.dart b/pkg/crypto/test/hmac_sha1_test_vectors.dart
similarity index 100%
rename from tests/lib/crypto/hmac_sha1_test_vectors.dart
rename to pkg/crypto/test/hmac_sha1_test_vectors.dart
diff --git a/tests/lib/crypto/hmac_sha256_test.dart b/pkg/crypto/test/hmac_sha256_test.dart
similarity index 100%
rename from tests/lib/crypto/hmac_sha256_test.dart
rename to pkg/crypto/test/hmac_sha256_test.dart
diff --git a/tests/lib/crypto/hmac_sha256_test_vectors.dart b/pkg/crypto/test/hmac_sha256_test_vectors.dart
similarity index 100%
rename from tests/lib/crypto/hmac_sha256_test_vectors.dart
rename to pkg/crypto/test/hmac_sha256_test_vectors.dart
diff --git a/tests/lib/crypto/sha1_long_test_vectors.dart b/pkg/crypto/test/sha1_long_test_vectors.dart
similarity index 100%
rename from tests/lib/crypto/sha1_long_test_vectors.dart
rename to pkg/crypto/test/sha1_long_test_vectors.dart
diff --git a/tests/lib/crypto/sha1_short_test_vectors.dart b/pkg/crypto/test/sha1_short_test_vectors.dart
similarity index 100%
rename from tests/lib/crypto/sha1_short_test_vectors.dart
rename to pkg/crypto/test/sha1_short_test_vectors.dart
diff --git a/tests/lib/crypto/sha1_test.dart b/pkg/crypto/test/sha1_test.dart
similarity index 100%
rename from tests/lib/crypto/sha1_test.dart
rename to pkg/crypto/test/sha1_test.dart
diff --git a/tests/lib/crypto/sha256_long_test_vectors.dart b/pkg/crypto/test/sha256_long_test_vectors.dart
similarity index 100%
rename from tests/lib/crypto/sha256_long_test_vectors.dart
rename to pkg/crypto/test/sha256_long_test_vectors.dart
diff --git a/tests/lib/crypto/sha256_short_test_vectors.dart b/pkg/crypto/test/sha256_short_test_vectors.dart
similarity index 100%
rename from tests/lib/crypto/sha256_short_test_vectors.dart
rename to pkg/crypto/test/sha256_short_test_vectors.dart
diff --git a/tests/lib/crypto/sha256_test.dart b/pkg/crypto/test/sha256_test.dart
similarity index 100%
rename from tests/lib/crypto/sha256_test.dart
rename to pkg/crypto/test/sha256_test.dart
diff --git a/pkg/http/lib/src/base_client.dart b/pkg/http/lib/src/base_client.dart
index 2526a62..8c25265 100644
--- a/pkg/http/lib/src/base_client.dart
+++ b/pkg/http/lib/src/base_client.dart
@@ -112,7 +112,7 @@
if (url is String) url = Uri.parse(url);
var request = new Request(method, url);
- if (headers != null) mapAddAll(request.headers, headers);
+ if (headers != null) request.headers.addAll(headers);
if (fields != null && !fields.isEmpty) request.bodyFields = fields;
return send(request);
diff --git a/pkg/http/lib/src/base_request.dart b/pkg/http/lib/src/base_request.dart
index 415e27a..7c3ebc6 100644
--- a/pkg/http/lib/src/base_request.dart
+++ b/pkg/http/lib/src/base_request.dart
@@ -60,7 +60,7 @@
/// The maximum number of redirects to follow when [followRedirects] is true.
/// If this number is exceeded the [BaseResponse] future will signal a
- /// [RedirectLimitExceeded] exception. Defaults to 5.
+ /// [RedirectException]. Defaults to 5.
int get maxRedirects => _maxRedirects;
int _maxRedirects = 5;
diff --git a/pkg/http/lib/src/mock_client.dart b/pkg/http/lib/src/mock_client.dart
index 91c0dc0..ec88af4 100644
--- a/pkg/http/lib/src/mock_client.dart
+++ b/pkg/http/lib/src/mock_client.dart
@@ -38,7 +38,7 @@
request.persistentConnection = baseRequest.persistentConnection;
request.followRedirects = baseRequest.followRedirects;
request.maxRedirects = baseRequest.maxRedirects;
- mapAddAll(request.headers, baseRequest.headers);
+ request.headers.addAll(baseRequest.headers);
request.bodyBytes = bodyBytes;
request.finalize();
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index 9125ddc..1cbe6aa 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -42,15 +42,6 @@
return pairs.map((pair) => "${pair[0]}=${pair[1]}").join("&");
}
-/// Adds all key/value pairs from [source] to [destination], overwriting any
-/// pre-existing values.
-///
-/// var a = {"foo": "bar", "baz": "bang"};
-/// mapAddAll(a, {"baz": "zap", "qux": "quux"});
-/// a; //=> {"foo": "bar", "baz": "zap", "qux": "quux"}
-void mapAddAll(Map destination, Map source) =>
- source.forEach((key, value) => destination[key] = value);
-
/// Decodes a URL-encoded string. Unlike [Uri.decodeComponent], this includes
/// replacing `+` with ` `.
String urlDecode(String encoded) =>
diff --git a/pkg/http/test/client_test.dart b/pkg/http/test/client_test.dart
index aa7781f..287aee5 100644
--- a/pkg/http/test/client_test.dart
+++ b/pkg/http/test/client_test.dart
@@ -21,6 +21,7 @@
var request = new http.StreamedRequest("POST", serverUrl);
request.headers[HttpHeaders.CONTENT_TYPE] =
'application/json; charset=utf-8';
+ request.headers[HttpHeaders.USER_AGENT] = 'Dart';
expect(client.send(request).then((response) {
expect(response.request, equals(request));
@@ -37,6 +38,7 @@
'headers': {
'content-type': ['application/json; charset=utf-8'],
'accept-encoding': ['gzip'],
+ 'user-agent': ['Dart'],
'transfer-encoding': ['chunked']
},
'body': '{"hello": "world"}'
@@ -55,7 +57,7 @@
request.headers[HttpHeaders.CONTENT_TYPE] =
'application/json; charset=utf-8';
- expect(client.send(request), throwsSocketIOException);
+ expect(client.send(request), throwsSocketException);
request.sink.add('{"hello": "world"}'.codeUnits);
request.sink.close();
diff --git a/pkg/http/test/http_test.dart b/pkg/http/test/http_test.dart
index b3227f5..3f12984 100644
--- a/pkg/http/test/http_test.dart
+++ b/pkg/http/test/http_test.dart
@@ -28,7 +28,8 @@
expect(startServer().then((_) {
expect(http.get(serverUrl, headers: {
'X-Random-Header': 'Value',
- 'X-Other-Header': 'Other Value'
+ 'X-Other-Header': 'Other Value',
+ 'User-Agent': 'Dart'
}).then((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
@@ -37,6 +38,7 @@
'headers': {
'content-length': ['0'],
'accept-encoding': ['gzip'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
},
@@ -49,7 +51,8 @@
expect(startServer().then((_) {
expect(http.post(serverUrl, headers: {
'X-Random-Header': 'Value',
- 'X-Other-Header': 'Other Value'
+ 'X-Other-Header': 'Other Value',
+ 'User-Agent': 'Dart'
}, fields: {
'some-field': 'value',
'other-field': 'other value'
@@ -64,6 +67,7 @@
],
'content-length': ['40'],
'accept-encoding': ['gzip'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
},
@@ -78,7 +82,8 @@
expect(http.post(serverUrl, headers: {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value',
- 'Content-Type': 'text/plain'
+ 'Content-Type': 'text/plain',
+ 'User-Agent': 'Dart'
}).then((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
@@ -88,6 +93,7 @@
'accept-encoding': ['gzip'],
'content-length': ['0'],
'content-type': ['text/plain'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
}
@@ -100,7 +106,8 @@
expect(startServer().then((_) {
expect(http.put(serverUrl, headers: {
'X-Random-Header': 'Value',
- 'X-Other-Header': 'Other Value'
+ 'X-Other-Header': 'Other Value',
+ 'User-Agent': 'Dart'
}, fields: {
'some-field': 'value',
'other-field': 'other value'
@@ -115,6 +122,7 @@
],
'accept-encoding': ['gzip'],
'content-length': ['40'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
},
@@ -129,7 +137,8 @@
expect(http.put(serverUrl, headers: {
'X-Random-Header': 'Value',
'X-Other-Header': 'Other Value',
- 'Content-Type': 'text/plain'
+ 'Content-Type': 'text/plain',
+ 'User-Agent': 'Dart'
}).then((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
@@ -139,6 +148,7 @@
'content-length': ['0'],
'accept-encoding': ['gzip'],
'content-type': ['text/plain'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
}
@@ -151,7 +161,8 @@
expect(startServer().then((_) {
expect(http.delete(serverUrl, headers: {
'X-Random-Header': 'Value',
- 'X-Other-Header': 'Other Value'
+ 'X-Other-Header': 'Other Value',
+ 'User-Agent': 'Dart'
}).then((response) {
expect(response.statusCode, equals(200));
expect(response.body, parse(equals({
@@ -160,6 +171,7 @@
'headers': {
'content-length': ['0'],
'accept-encoding': ['gzip'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
}
@@ -172,13 +184,15 @@
expect(startServer().then((_) {
expect(http.read(serverUrl, headers: {
'X-Random-Header': 'Value',
- 'X-Other-Header': 'Other Value'
+ 'X-Other-Header': 'Other Value',
+ 'User-Agent': 'Dart'
}).then((val) => val), completion(parse(equals({
'method': 'GET',
'path': '/',
'headers': {
'content-length': ['0'],
'accept-encoding': ['gzip'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
},
@@ -196,7 +210,8 @@
expect(startServer().then((_) {
var future = http.readBytes(serverUrl, headers: {
'X-Random-Header': 'Value',
- 'X-Other-Header': 'Other Value'
+ 'X-Other-Header': 'Other Value',
+ 'User-Agent': 'Dart'
}).then((bytes) => new String.fromCharCodes(bytes));
expect(future, completion(parse(equals({
@@ -205,6 +220,7 @@
'headers': {
'content-length': ['0'],
'accept-encoding': ['gzip'],
+ 'user-agent': ['Dart'],
'x-random-header': ['Value'],
'x-other-header': ['Other Value']
},
diff --git a/pkg/http/test/request_test.dart b/pkg/http/test/request_test.dart
index 2e4c570..3ebe3e5 100644
--- a/pkg/http/test/request_test.dart
+++ b/pkg/http/test/request_test.dart
@@ -18,6 +18,7 @@
var request = new http.Request('POST', serverUrl);
request.body = "hello";
+ request.headers['User-Agent'] = 'Dart';
expect(request.send().then((response) {
expect(response.statusCode, equals(200));
@@ -28,6 +29,7 @@
'headers': {
'content-type': ['text/plain; charset=utf-8'],
'accept-encoding': ['gzip'],
+ 'user-agent': ['Dart'],
'content-length': ['5']
},
'body': 'hello'
diff --git a/pkg/http/test/safe_http_server.dart b/pkg/http/test/safe_http_server.dart
index a580770b..0f3b9f1 100644
--- a/pkg/http/test/safe_http_server.dart
+++ b/pkg/http/test/safe_http_server.dart
@@ -50,9 +50,9 @@
// Ignore socket error 104, which is caused by a request being cancelled
// before it writes any headers. There's no reason to care about such
// requests.
- if (error is SocketIOException && error.osError.errorCode == 104) return;
+ if (error is SocketException && error.osError.errorCode == 104) return;
// Ignore any parsing errors, which come from malformed requests.
- if (error is HttpParserException) return;
+ if (error is HttpException) return;
// Manually handle cancelOnError so the above (ignored) errors don't
// cause unsubscription.
if (cancelOnError) subscription.cancel();
diff --git a/pkg/http/test/utils.dart b/pkg/http/test/utils.dart
index c2ce9c4..6d86985 100644
--- a/pkg/http/test/utils.dart
+++ b/pkg/http/test/utils.dart
@@ -193,17 +193,17 @@
super("RedirectLimitExceededException");
bool matches(item, MatchState matchState) =>
- item is RedirectLimitExceededException;
+ item is RedirectException && item.message == "Redirect limit exceeded";
}
-/// A matcher for SocketIOExceptions.
-const isSocketIOException = const _SocketIOException();
+/// A matcher for SocketExceptions.
+const isSocketException = const _SocketException();
-/// A matcher for functions that throw SocketIOException.
-const Matcher throwsSocketIOException =
- const Throws(isSocketIOException);
+/// A matcher for functions that throw SocketException.
+const Matcher throwsSocketException =
+ const Throws(isSocketException);
-class _SocketIOException extends TypeMatcher {
- const _SocketIOException() : super("SocketIOException");
- bool matches(item, MatchState matchState) => item is SocketIOException;
+class _SocketException extends TypeMatcher {
+ const _SocketException() : super("SocketException");
+ bool matches(item, MatchState matchState) => item is SocketException;
}
diff --git a/pkg/oauth2/lib/src/utils.dart b/pkg/oauth2/lib/src/utils.dart
index d0e5f11..759357e 100644
--- a/pkg/oauth2/lib/src/utils.dart
+++ b/pkg/oauth2/lib/src/utils.dart
@@ -13,7 +13,7 @@
/// parameters if a name conflict occurs.
Uri addQueryParameters(Uri url, Map<String, String> parameters) {
var queryMap = queryToMap(url.query);
- mapAddAll(queryMap, parameters);
+ queryMap.addAll(parameters);
return url.resolve("?${mapToQuery(queryMap)}");
}
@@ -47,11 +47,6 @@
}).join("&");
}
-/// Add all key/value pairs from [source] to [destination], overwriting any
-/// pre-existing values.
-void mapAddAll(Map destination, Map source) =>
- source.forEach((key, value) => destination[key] = value);
-
/// Decode a URL-encoded string. Unlike [Uri.decodeComponent], this includes
/// replacing `+` with ` `.
String urlDecode(String encoded) =>
diff --git a/pkg/pkg.gyp b/pkg/pkg.gyp
index ed78787..172eef5 100644
--- a/pkg/pkg.gyp
+++ b/pkg/pkg.gyp
@@ -15,10 +15,11 @@
'<!@(["python", "../tools/list_pkg_directories.py", "."])',
],
'outputs': [
- '<(PRODUCT_DIR)/packages',
+ '<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
],
'action': [
'python', '../tools/make_links.py',
+ '--timestamp_file=<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
'<(PRODUCT_DIR)/packages',
'<@(_inputs)',
],
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 311fce9..5b5c18f 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -34,56 +34,17 @@
[$compiler == dart2dart]
*: Skip
-# Don't compile tests that use dart:io to JS
[ $compiler == dart2js || $compiler == dart2dart ]
-http/test/*: Skip
-oauth2/test/*: Skip
-pathos/test/*: Skip
-
-# Issue 8440 forces us to use pathos in the scheduled_test tests, which would
-# otherwise be dart2js-compatible.
-scheduled_test/test/*: Skip
-
-# We use pathos in the stack_trace tests. We can run them on dart2js when issue
-# 6943 is fixed.
-stack_trace/test/*: Skip
-
source_maps/test/vlq_test: Fail # A VLQ test checks for large numbers that
# overflow in JS (numbers slightly larger than
# 32 bits where we do bitwise operations).
-# Skip tests that use local file access if we're running in any browser
-[ $runtime == opera || $runtime == ff || $runtime == ie9 || $runtime == dartium || $runtime == chrome || $runtime == chromeOnAndroid || $runtime == safari || $runtime == drt || $runtime == jsshell]
-http/test/*: Skip
-oauth2/test/*: Skip
-pathos/test/*: Skip
-intl/test/date_time_format_file_even_test: Skip
-intl/test/date_time_format_file_odd_test: Skip
-intl/test/find_default_locale_standalone_test: Skip
-intl/test/message_extraction/message_extraction_test: Skip
-analyzer_experimental/test/options_test: Skip # Imports dart:io.
-analyzer_experimental/test/generated/ast_test: Skip # Imports dart:io.
-analyzer_experimental/test/generated/element_test: Skip # Imports dart:io.
-analyzer_experimental/test/generated/parser_test: Skip # Imports dart:io.
-analyzer_experimental/test/generated/resolver_test: Skip # Imports dart:io.
-analyzer_experimental/test/generated/scanner_test: Skip # Imports dart:io.
-analyzer_experimental/test/error_test: Skip # Imports dart:io.
-analyzer_experimental/test/services/formatter_test: Skip #Imports dart:io
-
-# Issue 8440 forces us to use pathos in the scheduled_test tests, which would
-# otherwise be dart2js-compatible.
-scheduled_test/test/*: Skip
-
-# We use pathos in the stack_trace tests. We can run them on dart2js when issue
-# 6943 is fixed.
-stack_trace/test/*: Skip
-
[ $runtime == opera && $compiler == dart2js ]
intl/test/find_default_locale_browser_test: Fail
intl/test/date_time_format_http_request_test: Skip # Timeout.
[ $runtime == ie9 ]
-intl/test/date_time_format_http_request_test: Skip # Issue 8983
+intl/test/date_time_format_http_request_test: Fail # Issue 8983
[ $runtime == safari ]
fixnum/test/int_64_test: Pass, Fail # Bug in JSC.
@@ -98,17 +59,10 @@
intl/test/message_extraction/message_extraction_test: Fail # Issue 9167
[ $compiler == dart2js ]
-# Skip intl_message tests that use mirrors on dart2js until it's been
-# implemented there.
-serialization/test/serialization_test: Skip # Issue 6490
-serialization/test/no_library_test: Skip # Issue 6490
-analyzer_experimental/test/generated/ast_test: Skip
-analyzer_experimental/test/generated/element_test: Skip
-analyzer_experimental/test/generated/parser_test: Skip
-analyzer_experimental/test/generated/resolver_test: Skip
-analyzer_experimental/test/generated/scanner_test: Skip
-analyzer_experimental/test/error_test: Skip # Imports dart:io.
-analyzer_experimental/test/services/formatter_test.dart: Skip #Imports dart:io
+serialization/test/serialization_test: Fail # Issue 6490
+serialization/test/no_library_test: Fail # Issue 6490
+analyzer_experimental/test/generated/ast_test: Fail
+unittest/test/instance_test: Fail # http://dartbug.com/11191
[ $compiler == dartc ]
unittest/test/mock_regexp_negative_test: Fail
@@ -122,9 +76,6 @@
unittest/test/mock_regexp_negative_test: fail
unittest/test/mock_stepwise_negative_test: fail
-[ $compiler == dart2js ]
-unittest/test/instance_test: Skip
-
[ $compiler == dart2js && $csp ]
unittest/test/unittest_test: Pass, Crash # Issue 10935
@@ -138,13 +89,77 @@
# The unminified unittest tests test that the real names of Dart types are
# printed. Minified versions of these tests exist that test the behavior when
# minified.
-unittest/test/*_unminified_test: Skip
+unittest/test/*_unminified_test: Skip # DO NOT COPY THIS UNLESS YOU WORK ON DART2JS
+
+[ $compiler == dart2js && $unchecked && ($runtime == d8 || $runtime == chrome || $runtime == drt) ]
+crypto/test/sha1_test: Fail # V8 bug: https://code.google.com/p/v8/issues/detail?id=2692
+
+[ $compiler == dart2js && $browser ]
+crypto/test/sha256_test: Slow, Pass
+crypto/test/sha1_test: Slow, Pass
+
+[ $browser ]
+analyzer_experimental/test/error_test: Fail, OK # Uses dart:io.
+analyzer_experimental/test/generated/element_test: Fail, OK # Uses dart:io.
+analyzer_experimental/test/generated/resolver_test: Fail, OK # Uses dart:io.
+analyzer_experimental/test/options_test: Fail, OK # Uses dart:io.
+analyzer_experimental/test/services/formatter_test: Fail, OK # Uses dart:io.
+http/test/client_test: Fail, OK # Uses dart:io.
+http/test/http_test: Fail, OK # Uses dart:io.
+http/test/mock_client_test: Fail, OK # Uses dart:io.
+http/test/multipart_test: Fail, OK # Uses dart:io.
+http/test/request_test: Fail, OK # Uses dart:io.
+http/test/response_test: Fail, OK # Uses dart:io.
+http/test/streamed_request_test: Fail, OK # Uses dart:io.
+intl/test/date_time_format_file_even_test: Fail, OK # Uses dart:io.
+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.
+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.
+oauth2/test/handle_access_token_response_test: Fail, OK # Uses dart:io.
+pathos/test/pathos_posix_test: Fail, OK # Uses dart:io.
+pathos/test/pathos_test: Fail, OK # Uses dart:io.
+pathos/test/pathos_url_test: Fail, OK # Uses dart:io.
+pathos/test/pathos_windows_test: Fail, OK # Uses dart:io.
+
+scheduled_test/test/descriptor/async_test: Fail # http://dartbug.com/8440
+scheduled_test/test/descriptor/directory_test: Fail # http://dartbug.com/8440
+scheduled_test/test/descriptor/file_test: Fail # http://dartbug.com/8440
+scheduled_test/test/descriptor/nothing_test: Fail # http://dartbug.com/8440
+scheduled_test/test/descriptor/pattern_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_future_matchers_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_process_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/abort_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/current_schedule_current_task_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/current_schedule_errors_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/current_schedule_state_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/nested_task_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/on_complete_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/on_exception_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/out_of_band_task_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/set_up_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/signal_error_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/simple_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/task_return_value_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/timeout_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/wrap_async_test: Fail # http://dartbug.com/8440
+scheduled_test/test/scheduled_test/wrap_future_test: Fail # http://dartbug.com/8440
+
+stack_trace/test/frame_test: Fail # http://dartbug.com/6943
+stack_trace/test/trace_test: Fail # http://dartbug.com/6943
+
+
+[ $runtime == safari]
+ # Bug in JSC: the test only passes when being debugged.
+crypto/test/hmac_md5_test: Fail, Pass
[ $minified == false ]
# The minified unittest tests test that the minified names of Dart types are
# printed. Unminified versions of these tests exist that test the behavior when
# not minified.
-unittest/test/*_minified_test: Skip
+unittest/test/*_minified_test: Skip # DO NOT COPY THIS UNLESS YOU WORK ON DART2JS
[ $compiler == none && $runtime == drt ]
dartdoc/test/dartdoc_test: Skip # See dartbug.com/4541.
diff --git a/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart b/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart
index a580770b..0f3b9f1 100644
--- a/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart
+++ b/pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart
@@ -50,9 +50,9 @@
// Ignore socket error 104, which is caused by a request being cancelled
// before it writes any headers. There's no reason to care about such
// requests.
- if (error is SocketIOException && error.osError.errorCode == 104) return;
+ if (error is SocketException && error.osError.errorCode == 104) return;
// Ignore any parsing errors, which come from malformed requests.
- if (error is HttpParserException) return;
+ if (error is HttpException) return;
// Manually handle cancelOnError so the above (ignored) errors don't
// cause unsubscription.
if (cancelOnError) subscription.cancel();
diff --git a/pkg/scheduled_test/test/scheduled_server_test.dart b/pkg/scheduled_test/test/scheduled_server_test.dart
index ec08bb5..b4cd897 100644
--- a/pkg/scheduled_test/test/scheduled_server_test.dart
+++ b/pkg/scheduled_test/test/scheduled_server_test.dart
@@ -38,16 +38,16 @@
test('test 2', () {
expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
// TODO(nweiz): There can be three errors due to issue 9151. The
- // HttpParserException is reported without a stack trace, and so when it's
+ // HttpException is reported without a stack trace, and so when it's
// wrapped twice it registers as a different exception each time (because
// it's given an ad-hoc stack trace). Always expect two exceptions when
// issue 9151 is fixed.
expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' received GET /hello "
"when no more requests were expected."));
- expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ expect(errors[1].error, new isInstanceOf<HttpException>());
if (errors.length > 2) {
- expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ expect(errors[2].error, new isInstanceOf<HttpException>());
}
});
}, passing: ['test 2']);
@@ -110,16 +110,16 @@
test('test 2', () {
// TODO(nweiz): There can be three errors due to issue 9151. The
- // HttpParserException is reported without a stack trace, and so when it's
+ // HttpException is reported without a stack trace, and so when it's
// wrapped twice it registers as a different exception each time (because
// it's given an ad-hoc stack trace). Always expect two exceptions when
// issue 9151 is fixed.
expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' received GET /hello "
"earlier than expected."));
- expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ expect(errors[1].error, new isInstanceOf<HttpException>());
if (errors.length > 2) {
- expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ expect(errors[2].error, new isInstanceOf<HttpException>());
}
expect(errors, everyElement(new isInstanceOf<ScheduleError>()));
});
@@ -166,16 +166,16 @@
test('test 2', () {
// TODO(nweiz): There can be three errors due to issue 9151. The
- // HttpParserException is reported without a stack trace, and so when it's
+ // HttpException is reported without a stack trace, and so when it's
// wrapped twice it registers as a different exception each time (because
// it's given an ad-hoc stack trace). Always expect two exceptions when
// issue 9151 is fixed.
expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' expected GET "
"/goodbye, but got GET /hello."));
- expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ expect(errors[1].error, new isInstanceOf<HttpException>());
if (errors.length > 2) {
- expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ expect(errors[2].error, new isInstanceOf<HttpException>());
}
});
}, passing: ['test 2']);
@@ -199,16 +199,16 @@
test('test 2', () {
// TODO(nweiz): There can be three errors due to issue 9151. The
- // HttpParserException is reported without a stack trace, and so when it's
+ // HttpException is reported without a stack trace, and so when it's
// wrapped twice it registers as a different exception each time (because
// it's given an ad-hoc stack trace). Always expect two exceptions when
// issue 9151 is fixed.
expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' expected GET "
"/hello, but got HEAD /hello."));
- expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ expect(errors[1].error, new isInstanceOf<HttpException>());
if (errors.length > 2) {
- expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ expect(errors[2].error, new isInstanceOf<HttpException>());
}
});
}, passing: ['test 2']);
@@ -304,16 +304,16 @@
test('test 2', () {
// TODO(nweiz): There can be three errors due to issue 9151. The
- // HttpParserException is reported without a stack trace, and so when it's
+ // HttpException is reported without a stack trace, and so when it's
// wrapped twice it registers as a different exception each time (because
// it's given an ad-hoc stack trace). Always expect two exceptions when
// issue 9151 is fixed.
expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals("'scheduled server 0' received GET "
"/hello/3 when no more requests were expected."));
- expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ expect(errors[1].error, new isInstanceOf<HttpException>());
if (errors.length > 2) {
- expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ expect(errors[2].error, new isInstanceOf<HttpException>());
}
});
}, passing: ['test 2']);
@@ -336,15 +336,15 @@
test('test 2', () {
// TODO(nweiz): There can be three errors due to issue 9151. The
- // HttpParserException is reported without a stack trace, and so when it's
+ // HttpException is reported without a stack trace, and so when it's
// wrapped twice it registers as a different exception each time (because
// it's given an ad-hoc stack trace). Always expect two exceptions when
// issue 9151 is fixed.
expect(errors.length, inInclusiveRange(2, 3));
expect(errors[0].error, equals('oh no'));
- expect(errors[1].error, new isInstanceOf<HttpParserException>());
+ expect(errors[1].error, new isInstanceOf<HttpException>());
if (errors.length > 2) {
- expect(errors[2].error, new isInstanceOf<HttpParserException>());
+ expect(errors[2].error, new isInstanceOf<HttpException>());
}
});
}, passing: ['test 2']);
diff --git a/pkg/serialization/lib/src/mirrors_helpers.dart b/pkg/serialization/lib/src/mirrors_helpers.dart
index 4058514..19360bf 100644
--- a/pkg/serialization/lib/src/mirrors_helpers.dart
+++ b/pkg/serialization/lib/src/mirrors_helpers.dart
@@ -13,6 +13,14 @@
export 'dart:mirrors';
import 'serialization_helpers.dart';
+// TODO(alanknight): Remove this method. It is working around a bug
+// in the Dart VM which incorrectly returns Object as the superclass
+// of Object.
+_getSuperclass(ClassMirror mirror) {
+ var superclass = mirror.superclass;
+ return (superclass == mirror) ? null : superclass;
+}
+
/**
* Return a list of all the public fields of a class, including inherited
* fields.
@@ -20,9 +28,9 @@
Iterable<VariableMirror> publicFields(ClassMirror mirror) {
var mine = mirror.variables.values.where(
(x) => !(x.isPrivate || x.isStatic));
- var mySuperclass = mirror.superclass;
- if (mySuperclass != mirror) {
- return append(publicFields(mirror.superclass), mine);
+ var mySuperclass = _getSuperclass(mirror);
+ if (mySuperclass != null) {
+ return append(publicFields(mySuperclass), mine);
} else {
return mine;
}
@@ -34,8 +42,8 @@
if (name == null) return false;
var field = mirror.variables[name];
if (field != null && !field.isStatic) return true;
- var superclass = mirror.superclass;
- if (superclass == mirror) return false;
+ var superclass = _getSuperclass(mirror);
+ if (superclass == null) return false;
return hasField(name, superclass);
}
@@ -45,9 +53,9 @@
*/
Iterable<MethodMirror> publicGetters(ClassMirror mirror) {
var mine = mirror.getters.values.where((x) => !(x.isPrivate || x.isStatic));
- var mySuperclass = mirror.superclass;
- if (mySuperclass != mirror) {
- return append(publicGetters(mirror.superclass), mine);
+ var mySuperclass = _getSuperclass(mirror);
+ if (mySuperclass != null) {
+ return append(publicGetters(mySuperclass), mine);
} else {
return mine.toList();
}
@@ -58,8 +66,8 @@
if (name == null) return false;
var getter = mirror.getters[name];
if (getter != null && !getter.isStatic) return true;
- var superclass = mirror.superclass;
- if (superclass == mirror) return false;
+ var superclass = _getSuperclass(mirror);
+ if (superclass == null) return false;
return hasField(name, superclass);
}
diff --git a/pkg/webdriver/lib/webdriver.dart b/pkg/webdriver/lib/webdriver.dart
index 0119c68..83ea292 100644
--- a/pkg/webdriver/lib/webdriver.dart
+++ b/pkg/webdriver/lib/webdriver.dart
@@ -882,9 +882,9 @@
* Potential Errors: NoSuchWindow, XPathLookupError.
*/
Future<String>
- findElementFromId(String id, String strategy, String searchValue) {
- _post('element/$id/element', { 'using': strategy, 'value' : searchValue });
- }
+ findElementFromId(String id, String strategy, String searchValue) =>
+ _post('element/$id/element',
+ { 'using': strategy, 'value' : searchValue });
/**
* Search for multiple elements on the page, starting from the element with
@@ -897,8 +897,7 @@
Future<List<String>>
findElementsFromId(String id, String strategy, String searchValue) =>
_post('element/$id/elements',
- params: { 'using': strategy, 'value' : searchValue });
-
+ { 'using': strategy, 'value' : searchValue });
/**
* Click on an element specified by [id].
*
diff --git a/runtime/bin/common.cc b/runtime/bin/common.cc
index ce9a9ef..fd6386e 100644
--- a/runtime/bin/common.cc
+++ b/runtime/bin/common.cc
@@ -58,5 +58,12 @@
Dart_ExitScope();
}
+
+void FUNCTION_NAME(Common_GetVersion)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ Dart_SetReturnValue(args, Dart_NewStringFromCString(Dart_VersionString()));
+ Dart_ExitScope();
+}
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/common_patch.dart b/runtime/bin/common_patch.dart
index 8b77d3a..e1d36f4 100644
--- a/runtime/bin/common_patch.dart
+++ b/runtime/bin/common_patch.dart
@@ -11,3 +11,7 @@
/* patch */ static Uint8List getRandomBytes(int count)
native "Crypto_GetRandomBytes";
}
+
+patch class _OptionsImpl {
+ /* patch */ String get version native "Common_GetVersion";
+}
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index fc90469..375c6d5 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -760,10 +760,10 @@
}
-Dart_Handle DartUtils::NewDartSocketIOException(const char* message,
- Dart_Handle os_error) {
- // Create a dart:io SocketIOException object.
- Dart_Handle clazz = GetDartClass(kIOLibURL, "SocketIOException");
+Dart_Handle DartUtils::NewDartSocketException(const char* message,
+ Dart_Handle os_error) {
+ // Create a dart:io SocketException object.
+ Dart_Handle clazz = GetDartClass(kIOLibURL, "SocketException");
Dart_Handle args[2];
args[0] = NewString(message);
args[1] = os_error;
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index b84e773f..48db952 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -140,8 +140,8 @@
static Dart_Handle NewDartOSError();
// Create a new Dart OSError object with the provided OS error.
static Dart_Handle NewDartOSError(OSError* os_error);
- static Dart_Handle NewDartSocketIOException(const char* message,
- Dart_Handle os_error);
+ static Dart_Handle NewDartSocketException(const char* message,
+ Dart_Handle os_error);
static Dart_Handle NewDartExceptionWithMessage(const char* library_url,
const char* exception_name,
const char* message);
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index d15d734..6ca4ac0 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -394,7 +394,7 @@
args[1] = DartUtils::NewString(dir_name);
args[2] = dart_os_error;
Dart_ThrowException(Dart_New(
- DartUtils::GetDartClass(DartUtils::kIOLibURL, "DirectoryIOException"),
+ DartUtils::GetDartClass(DartUtils::kIOLibURL, "DirectoryException"),
Dart_Null(),
3,
args));
diff --git a/runtime/bin/io_natives.cc b/runtime/bin/io_natives.cc
index 4678ba6..e5172b7 100644
--- a/runtime/bin/io_natives.cc
+++ b/runtime/bin/io_natives.cc
@@ -21,6 +21,7 @@
// builtin_natives.cc instead.
#define IO_NATIVE_LIST(V) \
V(Common_IsBuiltinList, 1) \
+ V(Common_GetVersion, 1) \
V(Crypto_GetRandomBytes, 1) \
V(EventHandler_Start, 1) \
V(EventHandler_SendData, 4) \
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 6f139b7..9081f70 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -112,6 +112,9 @@
static bool ProcessBreakpointOption(const char* funcname) {
ASSERT(funcname != NULL);
+ if (*funcname == '\0') {
+ return false;
+ }
breakpoint_at = funcname;
return true;
}
@@ -119,6 +122,9 @@
static bool ProcessPackageRootOption(const char* arg) {
ASSERT(arg != NULL);
+ if (*arg == '\0' || *arg == '-') {
+ return false;
+ }
package_root = arg;
return true;
}
@@ -197,6 +203,9 @@
static bool ProcessVmStatsRootOption(const char* arg) {
ASSERT(arg != NULL);
+ if (*arg == '\0') {
+ return false;
+ }
vmstats_root = arg;
return true;
}
@@ -217,8 +226,9 @@
return false;
}
generate_script_snapshot = true;
+ return true;
}
- return true;
+ return false;
}
@@ -233,12 +243,11 @@
{ "--verbose", ProcessVerboseOption },
{ "-v", ProcessVerboseOption },
{ "--package-root=", ProcessPackageRootOption },
- { "-p", ProcessPackageRootOption },
// VM specific options to the standalone dart program.
- { "--break_at=", ProcessBreakpointOption },
+ { "--break-at=", ProcessBreakpointOption },
{ "--compile_all", ProcessCompileAllOption },
{ "--debug", ProcessDebugOption },
- { "--generate-script-snapshot=", ProcessGenScriptSnapshotOption },
+ { "--snapshot=", ProcessGenScriptSnapshotOption },
{ "--stats-root=", ProcessVmStatsRootOption },
{ "--stats", ProcessVmStatsOption },
{ "--print-script", ProcessPrintScriptOption },
@@ -250,10 +259,13 @@
static bool ProcessMainOptions(const char* option) {
int i = 0;
const char* name = main_options[0].option_name;
+ int option_length = strlen(option);
while (name != NULL) {
int length = strlen(name);
- if (strncmp(option, name, length) == 0) {
- return main_options[i].process(option + length);
+ if ((option_length >= length) && (strncmp(option, name, length) == 0)) {
+ if (main_options[i].process(option + length)) {
+ return true;
+ }
}
i += 1;
name = main_options[i].option_name;
@@ -305,7 +317,20 @@
i++;
} else {
// Check if this flag is a potentially valid VM flag.
- if (!IsValidFlag(argv[i], kPrefix, kPrefixLen)) {
+ const char* kChecked = "-c";
+ const char* kPackageRoot = "-p";
+ if (strncmp(argv[i], kPackageRoot, strlen(kPackageRoot)) == 0) {
+ if (!ProcessPackageRootOption(argv[i] + strlen(kPackageRoot))) {
+ i++;
+ if (!ProcessPackageRootOption(argv[i])) {
+ Log::PrintErr("Invalid option specification : '%s'\n", argv[i - 1]);
+ i++;
+ break;
+ }
+ }
+ } else if (strncmp(argv[i], kChecked, strlen(kChecked)) == 0) {
+ vm_options->AddArgument("--checked");
+ } else if (!IsValidFlag(argv[i], kPrefix, kPrefixLen)) {
break;
}
const char* kPrintFlags1 = "--print-flags";
@@ -516,35 +541,38 @@
if (!has_verbose_option) {
Log::PrintErr(
"Common options:\n"
-"--checked Insert runtime type checks and enable assertions (checked mode).\n"
-"--version Print the VM version.\n"
-"--help Display this message (add --verbose for information about all\n"
-" VM options).\n");
+"--checked or -c\n"
+" Insert runtime type checks and enable assertions (checked mode).\n"
+"--help or -h\n"
+" Display this message (add -v or --verbose for information about\n"
+" all VM options).\n"
+"--package-root=<path> or -p<path>\n"
+" Where to find packages, that is, \"package:...\" imports.\n"
+"--version\n"
+" Print the VM version.\n");
} else {
Log::PrintErr(
"Supported options:\n"
-"--checked\n"
+"--checked or -c\n"
" Insert runtime type checks and enable assertions (checked mode).\n"
-"\n"
+"--help or -h\n"
+" Display this message (add -v or --verbose for information about\n"
+" all VM options).\n"
+"--package-root=<path> or -p<path>\n"
+" Where to find packages, that is, \"package:...\" imports.\n"
"--version\n"
" Print the VM version.\n"
"\n"
-"--help\n"
-" Display this message (add --verbose for information about all VM options).\n"
-"\n"
-"--package-root=<path>\n"
-" Where to find packages, that is, \"package:...\" imports.\n"
-"\n"
"--debug[:<port number>]\n"
" enables debugging and listens on specified port for debugger connections\n"
" (default port number is 5858)\n"
"\n"
-"--break_at=<location>\n"
+"--break-at=<location>\n"
" sets a breakpoint at specified location where <location> is one of :\n"
" url:<line_num> e.g. test.dart:10\n"
" [<class_name>.]<function_name> e.g. B.foo\n"
"\n"
-"--generate-script-snapshot=<file_name>\n"
+"--snapshot=<file_name>\n"
" loads Dart script and generates a snapshot in the specified file\n"
"\n"
"--print-script\n"
diff --git a/runtime/bin/secure_socket.h b/runtime/bin/secure_socket.h
index 45334d6..010b5ad 100644
--- a/runtime/bin/secure_socket.h
+++ b/runtime/bin/secure_socket.h
@@ -26,9 +26,9 @@
namespace bin {
static void ThrowException(const char* message) {
- Dart_Handle socket_io_exception =
- DartUtils::NewDartSocketIOException(message, Dart_Null());
- Dart_ThrowException(socket_io_exception);
+ Dart_Handle socket_exception =
+ DartUtils::NewDartSocketException(message, Dart_Null());
+ Dart_ThrowException(socket_exception);
}
@@ -38,9 +38,9 @@
const char* error_message = PR_ErrorToString(error_code, PR_LANGUAGE_EN);
OSError os_error_struct(error_code, error_message, OSError::kNSS);
Dart_Handle os_error = DartUtils::NewDartOSError(&os_error_struct);
- Dart_Handle socket_io_exception =
- DartUtils::NewDartSocketIOException(message, os_error);
- Dart_ThrowException(socket_io_exception);
+ Dart_Handle socket_exception =
+ DartUtils::NewDartSocketException(message, os_error);
+ Dart_ThrowException(socket_exception);
}
/*
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index d603532..7d0f5da 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -237,7 +237,7 @@
backlog,
v6Only);
if (result is OSError) {
- throw new SocketIOException(
+ throw new SocketException(
"Failed to create server socket", result);
}
if (port != 0) socket.localPort = port;
@@ -490,20 +490,20 @@
// error objects.
static createError(error, String message) {
if (error is OSError) {
- return new SocketIOException(message, error);
+ return new SocketException(message, error);
} else if (error is List) {
assert(isErrorResponse(error));
switch (error[0]) {
case _ILLEGAL_ARGUMENT_RESPONSE:
return new ArgumentError();
case _OSERROR_RESPONSE:
- return new SocketIOException(
+ return new SocketException(
message, new OSError(error[2], error[1]));
default:
return new Exception("Unknown error");
}
} else {
- return new SocketIOException(message);
+ return new SocketException(message);
}
}
diff --git a/runtime/bin/stdio_patch.dart b/runtime/bin/stdio_patch.dart
index cb1c920..90b3a41 100644
--- a/runtime/bin/stdio_patch.dart
+++ b/runtime/bin/stdio_patch.dart
@@ -12,7 +12,7 @@
case _STDIO_HANDLE_TYPE_FILE:
return new _StdStream(new _FileStream.forStdin());
default:
- throw new FileIOException("Unsupported stdin type");
+ throw new FileException("Unsupported stdin type");
}
}
@@ -26,14 +26,14 @@
case _STDIO_HANDLE_TYPE_FILE:
return new _StdSink(new IOSink(new _FileStreamConsumer.fromStdio(fd)));
default:
- throw new FileIOException("Unsupported stdin type");
+ throw new FileException("Unsupported stdin type");
}
}
static int _socketType(nativeSocket) {
var result = _getSocketType(nativeSocket);
if (result is OSError) {
- throw new FileIOException("Error retreiving socket type", result);
+ throw new FileException("Error retreiving socket type", result);
}
return result;
}
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 3cdb2a1..16c3232 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -467,75 +467,6 @@
String toLowerCase() native "String_toLowerCase";
- // Implementations of Strings methods follow below.
- static String join(Iterable<String> strings, String separator) {
- bool first = true;
- List<String> stringsList = <String>[];
- for (String string in strings) {
- if (first) {
- first = false;
- } else {
- stringsList.add(separator);
- }
-
- if (string is! String) {
- throw new ArgumentError(Error.safeToString(string));
- }
- stringsList.add(string);
- }
- return concatAll(stringsList);
- }
-
- static String concatAll(Iterable<String> strings) {
- _ObjectArray stringsArray;
- final len = strings.length;
- bool isOneByteString = true;
- int totalLength = 0;
- if (strings._cid == _ObjectArray._clCId) {
- stringsArray = strings;
- for (int i = 0; i < len; i++) {
- var string = strings[i];
- if (string._cid == _OneByteString._classId) {
- totalLength += string.length;
- } else {
- isOneByteString = false;
- if (string is! String) throw new ArgumentError(string);
- }
- }
- } else {
- // Copy into an _ObjectArray.
- stringsArray = new _ObjectArray(len);
- int i = 0;
- for (int i = 0; i < len; i++) {
- var string = strings[i];
- if (string._cid == _OneByteString.clCid) {
- totalLength += s.length;
- } else {
- isOneByteString = false;
- if (string is! String) throw new ArgumentError(string);
- }
- stringsArray[i++] = string;
- }
- }
- if (isOneByteString) {
- return _OneByteString._concatAll(stringsArray, totalLength);
- }
- return _concatAllNative(stringsArray);
- }
-
- static String _concatAll(_ObjectArray<String> strings) {
- int totalLength = 0;
- final stringsLength = strings.length;
- for (int i = 0; i < stringsLength; i++) {
- var e = strings[i];
- if (e._cid != _OneByteString._classId) {
- return _concatAllNative(strings);
- }
- totalLength += e.length;
- }
- return _OneByteString._concatAll(strings, totalLength);
- }
-
// Call this method if not all list elements are OneByteString-s.
static String _concatAllNative(_ObjectArray<String> strings)
native "Strings_concatAll";
diff --git a/runtime/lib/typed_data.cc b/runtime/lib/typed_data.cc
index b1b2632..23f0b83 100644
--- a/runtime/lib/typed_data.cc
+++ b/runtime/lib/typed_data.cc
@@ -42,16 +42,10 @@
// Checks to see if a length will not result in an OOM error.
static void LengthCheck(intptr_t len, intptr_t max) {
- if (len > max) {
+ if (len < 0 || len > max) {
const String& error = String::Handle(String::NewFormatted(
- "insufficient memory to allocate a TypedData object of length (%"Pd")",
- len));
- const Array& args = Array::Handle(Array::New(1));
- args.SetAt(0, error);
- Exceptions::ThrowByType(Exceptions::kOutOfMemory, args);
- } else if (len < 0) {
- const String& error = String::Handle(String::NewFormatted(
- "%"Pd" must be greater than 0", len));
+ "Length (%"Pd") of object must be in range [0..%"Pd"]",
+ len, max));
const Array& args = Array::Handle(Array::New(1));
args.SetAt(0, error);
Exceptions::ThrowByType(Exceptions::kArgument, args);
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 9130d89..b11812d 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -59,22 +59,21 @@
dart/byte_array_test: Fail
dart/byte_array_optimized_test: Fail
+[ $arch == arm ]
+cc/DoubleToFloatConversion: Fail # Issue: 11207
+cc/DoubleToIntConversion: Fail # Issue: 11207
+cc/FloatToDoubleConversion: Fail # Issue: 11207
+cc/FloatToIntConversion: Fail # Issue: 11207
+cc/IntToDoubleConversion: Fail # Issue: 11207
+cc/IntToFloatConversion: Fail # Issue: 11207
+
[ $arch == mips ]
*: Skip
[ $arch == simmips ]
# Tests missing code generation support.
-cc/CorelibCompileAll: Skip
-cc/Dart2JSCompileAll: Skip
-cc/ParsePatchLibrary: Skip
dart/byte_array_test: Skip
dart/byte_array_optimized_test: Skip
-dart/inline_stack_frame_test: Skip
-
-# Bug in optimized code generation.
-cc/ExternalStringDeoptimize: Skip
-dart/inline_stack_frame_test: Skip
-dart/isolate_mirror_local_test: Skip
# TODO(ajohnsen): Fix this as part of library changes.
[ $compiler == none ]
diff --git a/runtime/vm/assembler_mips.cc b/runtime/vm/assembler_mips.cc
index 889eea1..8f43046 100644
--- a/runtime/vm/assembler_mips.cc
+++ b/runtime/vm/assembler_mips.cc
@@ -335,6 +335,7 @@
void Assembler::EnterStubFrame(bool uses_pp) {
+ SetPrologueOffset();
if (uses_pp) {
addiu(SP, SP, Immediate(-4 * kWordSize));
sw(ZR, Address(SP, 3 * kWordSize)); // PC marker is 0 in stubs.
@@ -442,6 +443,8 @@
void Assembler::EnterDartFrame(intptr_t frame_size) {
const intptr_t offset = CodeSize();
+ SetPrologueOffset();
+
addiu(SP, SP, Immediate(-4 * kWordSize));
sw(RA, Address(SP, 2 * kWordSize));
sw(FP, Address(SP, 1 * kWordSize));
@@ -451,7 +454,7 @@
// Branch and link to the instruction after the delay slot to get the PC.
bal(&next);
// RA is the address of the sw instruction below. Save it in T0.
- delay_slot()->mov(T0, RA);
+ delay_slot()->mov(TMP1, RA);
// Calculate the offset of the pool pointer from the PC.
const intptr_t object_pool_pc_dist =
@@ -464,19 +467,19 @@
// Save PC in frame for fast identification of corresponding code.
if (offset == 0) {
- sw(T0, Address(SP, 3 * kWordSize));
+ sw(TMP1, Address(SP, 3 * kWordSize));
} else {
// Adjust saved PC for any intrinsic code that could have been generated
// before a frame is created.
- AddImmediate(T1, T0, -offset);
- sw(T1, Address(SP, 3 * kWordSize));
+ addiu(TMP1, TMP1, Immediate(-offset));
+ sw(TMP1, Address(SP, 3 * kWordSize));
}
// Set FP to the saved previous FP.
addiu(FP, SP, Immediate(kWordSize));
- // Load the pool pointer.
- lw(PP, Address(T0, -object_pool_pc_dist));
+ // Load the pool pointer. offset has already been subtracted from TMP1.
+ lw(PP, Address(TMP1, -object_pool_pc_dist + offset));
// Reserve space for locals.
AddImmediate(SP, -frame_size);
@@ -513,11 +516,9 @@
2 * kWordSize + // FP and RA.
kDartVolatileFpuRegCount * kWordSize;
- TraceSimMsg("EnterCallRuntimeFrame");
+ SetPrologueOffset();
- if (prologue_offset_ == -1) {
- prologue_offset_ = CodeSize();
- }
+ TraceSimMsg("EnterCallRuntimeFrame");
// Save volatile CPU and FPU registers on the stack:
// -------------
@@ -601,6 +602,32 @@
}
+static const char* cpu_reg_names[kNumberOfCpuRegisters] = {
+ "zr", "tmp", "v0", "v1", "a0", "a1", "a2", "a3",
+ "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra",
+};
+
+
+const char* Assembler::RegisterName(Register reg) {
+ ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters));
+ return cpu_reg_names[reg];
+}
+
+
+static const char* fpu_reg_names[kNumberOfFpuRegisters] = {
+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
+};
+
+
+const char* Assembler::FpuRegisterName(FpuRegister reg) {
+ ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
+ return fpu_reg_names[reg];
+}
+
+
void Assembler::Stop(const char* message) {
if (FLAG_print_stop_message) {
UNIMPLEMENTED();
diff --git a/runtime/vm/assembler_mips.h b/runtime/vm/assembler_mips.h
index 8becc75..9b22f3e 100644
--- a/runtime/vm/assembler_mips.h
+++ b/runtime/vm/assembler_mips.h
@@ -158,7 +158,7 @@
// Misc. functionality
int CodeSize() const { return buffer_.Size(); }
- int prologue_offset() const { return -1; }
+ int prologue_offset() const { return prologue_offset_; }
const ZoneGrowableArray<int>& GetPointerOffsets() const {
return buffer_.pointer_offsets();
}
@@ -205,14 +205,14 @@
const Code::Comments& GetCodeComments() const;
- static const char* RegisterName(Register reg) {
- UNIMPLEMENTED();
- return NULL;
- }
+ static const char* RegisterName(Register reg);
- static const char* FpuRegisterName(FpuRegister reg) {
- UNIMPLEMENTED();
- return NULL;
+ static const char* FpuRegisterName(FpuRegister reg);
+
+ void SetPrologueOffset() {
+ if (prologue_offset_ == -1) {
+ prologue_offset_ = CodeSize();
+ }
}
// A utility to be able to assemble an instruction into the delay slot.
@@ -816,7 +816,8 @@
}
void AddImmediate(Register rd, Register rs, int32_t value) {
- if (value == 0) return;
+ if ((value == 0) && (rd == rs)) return;
+ // If value is 0, we still want to move rs to rd if they aren't the same.
if (Utils::IsInt(kImmBits, value)) {
addiu(rd, rs, Immediate(value));
} else {
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 86ca5af..68e167f 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -1515,7 +1515,7 @@
// Copies saved registers and caller's frame into temporary buffers.
// Returns the stack size of unoptimized frame.
DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame,
- uword saved_registers_address) {
+ 1, uword saved_registers_address) {
Isolate* isolate = Isolate::Current();
StackZone zone(isolate);
HANDLESCOPE(isolate);
@@ -1639,7 +1639,7 @@
// The stack has been adjusted to fit all values for unoptimized frame.
// Fill the unoptimized frame.
-DEFINE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp) {
+DEFINE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, 1, uword last_fp) {
Isolate* isolate = Isolate::Current();
StackZone zone(isolate);
HANDLESCOPE(isolate);
@@ -1726,6 +1726,7 @@
DEFINE_LEAF_RUNTIME_ENTRY(intptr_t,
BigintCompare,
+ 2,
RawBigint* left,
RawBigint* right) {
Isolate* isolate = Isolate::Current();
diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h
index a1c3f9e..a68144f 100644
--- a/runtime/vm/constants_arm.h
+++ b/runtime/vm/constants_arm.h
@@ -130,8 +130,8 @@
// Register aliases for floating point scratch registers.
-const DRegister DTMP = D0; // Overlaps with STMP.
-const SRegister STMP = S0;
+const DRegister DTMP = D15; // Overlaps with STMP.
+const SRegister STMP = S30;
// Architecture independent aliases.
typedef DRegister FpuRegister;
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 0afd8df..bf35ec2 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -2043,7 +2043,7 @@
const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(list));
// If the list is immutable we call into Dart for the indexed setter to
// get the unsupported operation exception as the result.
- if (obj.IsArray() && !obj.IsImmutableArray()) {
+ if (obj.IsArray() && !Array::Cast(obj).IsImmutable()) {
SET_LIST_ELEMENT(isolate, Array, obj, index, value);
} else if (obj.IsGrowableObjectArray()) {
SET_LIST_ELEMENT(isolate, GrowableObjectArray, obj, index, value);
@@ -2297,7 +2297,7 @@
return Api::NewError("Invalid length passed in to access list elements");
}
}
- if (obj.IsArray() && !obj.IsImmutableArray()) {
+ if (obj.IsArray() && !Array::Cast(obj).IsImmutable()) {
// If the list is immutable we call into Dart for the indexed setter to
// get the unsupported operation exception as the result.
SET_LIST_ELEMENT_AS_BYTES(isolate,
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc
index 449370f..27abae0 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -387,6 +387,7 @@
const AbstractType& type,
Label* is_instance_lbl,
Label* is_not_instance_lbl) {
+ __ TraceSimMsg("UninstantiatedTypeTest");
__ Comment("UninstantiatedTypeTest");
ASSERT(!type.IsInstantiated());
// Skip check if destination is a dynamic type.
@@ -717,6 +718,7 @@
__ AddImmediate(T0, FP, (kFirstLocalSlotFromFp + 1) * kWordSize);
__ sll(T2, T2, 1); // T2 is a Smi.
+ __ Comment("Argument Copy Loop");
Label loop, loop_exit;
__ blez(T2, &loop_exit);
__ delay_slot()->subu(T0, T0, T2);
@@ -732,6 +734,7 @@
// Copy or initialize optional named arguments.
Label all_arguments_processed;
if (num_opt_named_params > 0) {
+ __ Comment("There are named parameters");
// Start by alphabetically sorting the names of the optional parameters.
LocalVariable** opt_param = new LocalVariable*[num_opt_named_params];
int* opt_param_position = new int[num_opt_named_params];
@@ -804,6 +807,7 @@
__ beq(T3, NULLREG, &all_arguments_processed);
} else {
ASSERT(num_opt_pos_params > 0);
+ __ Comment("There are optional positional parameters");
__ lw(T2,
FieldAddress(S4, ArgumentsDescriptor::positional_count_offset()));
__ SmiUntag(T2);
@@ -882,6 +886,7 @@
__ lw(T2, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
__ sll(T2, T2, 1); // T2 is a Smi.
+ __ Comment("Null arguments loop");
Label null_args_loop, null_args_loop_exit;
__ blez(T2, &null_args_loop_exit);
__ delay_slot()->addiu(T1, FP,
@@ -919,7 +924,6 @@
void FlowGraphCompiler::EmitFrameEntry() {
- __ TraceSimMsg("FrameEntry");
const Function& function = parsed_function().function();
if (CanOptimizeFunction() && function.is_optimizable()) {
const bool can_optimize = !is_optimizing() || may_reoptimize();
@@ -1144,7 +1148,6 @@
const ExternalLabel* label,
PcDescriptors::Kind kind,
LocationSummary* locs) {
- __ TraceSimMsg("Call");
__ BranchLinkPatchable(label);
AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
RecordSafepoint(locs);
@@ -1156,7 +1159,6 @@
const ExternalLabel* label,
PcDescriptors::Kind kind,
LocationSummary* locs) {
- __ TraceSimMsg("DartCall");
__ BranchLinkPatchable(label);
AddCurrentDescriptor(kind, deopt_id, token_pos);
RecordSafepoint(locs);
@@ -1179,7 +1181,6 @@
intptr_t deopt_id,
const RuntimeEntry& entry,
LocationSummary* locs) {
- __ TraceSimMsg("CallRuntime");
__ CallRuntime(entry);
AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos);
RecordSafepoint(locs);
@@ -1197,7 +1198,6 @@
token_pos);
}
}
- __ TraceSimMsg("CallRuntime return");
}
@@ -1215,6 +1215,7 @@
// top-level function (parsed_function().function()) which could be
// reoptimized and which counter needs to be incremented.
// Pass the function explicitly, it is used in IC stub.
+ __ TraceSimMsg("OptimizedInstanceCall");
__ LoadObject(T0, parsed_function().function());
__ LoadObject(S4, arguments_descriptor);
__ LoadObject(S5, ic_data);
@@ -1254,7 +1255,66 @@
intptr_t deopt_id,
intptr_t token_pos,
LocationSummary* locs) {
- UNIMPLEMENTED();
+ MegamorphicCacheTable* table = Isolate::Current()->megamorphic_cache_table();
+ const String& name = String::Handle(ic_data.target_name());
+ const MegamorphicCache& cache =
+ MegamorphicCache::ZoneHandle(table->Lookup(name, arguments_descriptor));
+ Label not_smi, load_cache;
+ __ TraceSimMsg("MegamorphicInstanceCall");
+ __ lw(T0, Address(SP, (argument_count - 1) * kWordSize));
+ __ andi(CMPRES, T0, Immediate(kSmiTagMask));
+ __ bne(CMPRES, ZR, ¬_smi);
+ __ LoadImmediate(T0, Smi::RawValue(kSmiCid));
+ __ b(&load_cache);
+
+ __ Bind(¬_smi);
+ __ LoadClassId(T0, T0);
+ __ SmiTag(T0);
+
+ // T0: class ID of the receiver (smi).
+ __ Bind(&load_cache);
+ __ LoadObject(T1, cache);
+ __ lw(T2, FieldAddress(T1, MegamorphicCache::buckets_offset()));
+ __ lw(T1, FieldAddress(T1, MegamorphicCache::mask_offset()));
+ // T2: cache buckets array.
+ // T1: mask.
+ __ mov(T3, T0);
+
+ Label loop, update, call_target_function;
+ __ b(&loop);
+
+ __ Bind(&update);
+ __ addiu(T3, T3, Immediate(Smi::RawValue(1)));
+ __ Bind(&loop);
+ __ and_(T3, T3, T1);
+ const intptr_t base = Array::data_offset();
+ // T3 is smi tagged, but table entries are two words, so LSL 2.
+ __ sll(TMP1, T3, 2);
+ __ addu(TMP1, T2, TMP1);
+ __ lw(T4, FieldAddress(TMP, base));
+
+ ASSERT(kIllegalCid == 0);
+ __ beq(T4, ZR, &call_target_function);
+ __ bne(T4, T0, &update);
+
+ __ Bind(&call_target_function);
+ // Call the target found in the cache. For a class id match, this is a
+ // proper target for the given name and arguments descriptor. If the
+ // illegal class id was found, the target is a cache miss handler that can
+ // be invoked as a normal Dart function.
+ __ sll(TMP1, T3, 2);
+ __ addu(TMP1, T2, TMP1);
+ __ lw(T0, FieldAddress(TMP, base + kWordSize));
+ __ lw(T0, FieldAddress(T0, Function::code_offset()));
+ __ lw(T0, FieldAddress(T0, Code::instructions_offset()));
+ __ LoadObject(S5, ic_data);
+ __ LoadObject(S4, arguments_descriptor);
+ __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag);
+ __ jalr(T0);
+ AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
+ RecordSafepoint(locs);
+ AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
+ __ Drop(argument_count);
}
@@ -1282,6 +1342,7 @@
const Object& obj,
bool needs_number_check,
intptr_t token_pos) {
+ __ TraceSimMsg("EqualityRegConstCompare");
if (needs_number_check &&
(obj.IsMint() || obj.IsDouble() || obj.IsBigint())) {
__ addiu(SP, SP, Immediate(-2 * kWordSize));
@@ -1292,6 +1353,7 @@
Isolate::kNoDeoptId,
token_pos);
__ delay_slot()->sw(TMP1, Address(SP, 0 * kWordSize));
+ __ TraceSimMsg("EqualityRegConstCompare return");
__ lw(reg, Address(SP, 1 * kWordSize)); // Restore 'reg'.
__ addiu(SP, SP, Immediate(2 * kWordSize)); // Discard constant.
return;
@@ -1325,9 +1387,27 @@
}
+// Implement equality spec: if any of the arguments is null do identity check.
+// Fallthrough calls super equality.
void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result,
Label* skip_call) {
- UNIMPLEMENTED();
+ Label check_identity, is_false, fall_through;
+ __ TraceSimMsg("SuperEqualityCallPrologue");
+ __ lw(result, Address(SP, 0 * kWordSize)); // Load right operand.
+ __ lw(TMP1, Address(SP, 1 * kWordSize)); // Load left operand.
+ __ beq(result, NULLREG, &check_identity); // Is right null?
+ __ bne(TMP1, NULLREG, &fall_through); // If right is non-null, check left.
+
+ __ Bind(&check_identity);
+ __ bne(result, TMP1, &is_false);
+ __ LoadObject(result, Bool::True());
+ __ Drop(2);
+ __ b(skip_call);
+ __ Bind(&is_false);
+ __ LoadObject(result, Bool::False());
+ __ Drop(2);
+ __ b(skip_call);
+ __ Bind(&fall_through);
}
@@ -1384,13 +1464,48 @@
void FlowGraphCompiler::EmitTestAndCall(const ICData& ic_data,
Register class_id_reg,
- intptr_t arg_count,
- const Array& arg_names,
+ intptr_t argument_count,
+ const Array& argument_names,
Label* deopt,
intptr_t deopt_id,
intptr_t token_index,
LocationSummary* locs) {
- UNIMPLEMENTED();
+ ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0));
+ Label match_found;
+ const intptr_t len = ic_data.NumberOfChecks();
+ GrowableArray<CidTarget> sorted(len);
+ SortICDataByCount(ic_data, &sorted);
+ ASSERT(class_id_reg != S4);
+ ASSERT(len > 0); // Why bother otherwise.
+ const Array& arguments_descriptor =
+ Array::ZoneHandle(ArgumentsDescriptor::New(argument_count,
+ argument_names));
+ __ TraceSimMsg("EmitTestAndCall");
+ __ LoadObject(S4, arguments_descriptor);
+ for (intptr_t i = 0; i < len; i++) {
+ const bool is_last_check = (i == (len - 1));
+ Label next_test;
+ if (is_last_check) {
+ __ BranchNotEqual(class_id_reg, sorted[i].cid, deopt);
+ } else {
+ __ BranchNotEqual(class_id_reg, sorted[i].cid, &next_test);
+ }
+ // Do not use the code from the function, but let the code be patched so
+ // that we can record the outgoing edges to other code.
+ GenerateDartCall(deopt_id,
+ token_index,
+ &StubCode::CallStaticFunctionLabel(),
+ PcDescriptors::kFuncCall,
+ locs);
+ const Function& function = *sorted[i].target;
+ AddStaticCallTarget(function);
+ __ Drop(argument_count);
+ if (!is_last_check) {
+ __ b(&match_found);
+ }
+ __ Bind(&next_test);
+ }
+ __ Bind(&match_found);
}
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 35b3f25..186e148 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -2453,27 +2453,27 @@
extern const RuntimeEntry kPowRuntimeEntry(
"libc_pow", reinterpret_cast<RuntimeFunction>(
- static_cast<BinaryMathCFunction>(&pow)), 0, true);
+ static_cast<BinaryMathCFunction>(&pow)), 2, true, true);
extern const RuntimeEntry kModRuntimeEntry(
"DartModulo", reinterpret_cast<RuntimeFunction>(
- static_cast<BinaryMathCFunction>(&DartModulo)), 0, true);
+ static_cast<BinaryMathCFunction>(&DartModulo)), 2, true, true);
extern const RuntimeEntry kFloorRuntimeEntry(
"libc_floor", reinterpret_cast<RuntimeFunction>(
- static_cast<UnaryMathCFunction>(&floor)), 0, true);
+ static_cast<UnaryMathCFunction>(&floor)), 1, true, true);
extern const RuntimeEntry kCeilRuntimeEntry(
"libc_ceil", reinterpret_cast<RuntimeFunction>(
- static_cast<UnaryMathCFunction>(&ceil)), 0, true);
+ static_cast<UnaryMathCFunction>(&ceil)), 1, true, true);
extern const RuntimeEntry kTruncRuntimeEntry(
"libc_trunc", reinterpret_cast<RuntimeFunction>(
- static_cast<UnaryMathCFunction>(&trunc)), 0, true);
+ static_cast<UnaryMathCFunction>(&trunc)), 1, true, true);
extern const RuntimeEntry kRoundRuntimeEntry(
"libc_round", reinterpret_cast<RuntimeFunction>(
- static_cast<UnaryMathCFunction>(&round)), 0, true);
+ static_cast<UnaryMathCFunction>(&round)), 1, true, true);
const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const {
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index e3971af..55746ec 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -1026,7 +1026,9 @@
// into the runtime system.
uword entry = reinterpret_cast<uword>(native_c_function());
#if defined(USING_SIMULATOR)
- entry = Simulator::RedirectExternalReference(entry, Simulator::kNativeCall);
+ entry = Simulator::RedirectExternalReference(entry,
+ Simulator::kNativeCall,
+ function().NumParameters());
#endif
__ LoadImmediate(R5, entry);
__ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function()));
@@ -2099,7 +2101,7 @@
} else if ((value < 0) || (value >= kCountLimit)) {
// This condition may not be known earlier in some cases because
// of constant propagation, inlining, etc.
- if ((value >=kCountLimit) && is_truncating) {
+ if ((value >= kCountLimit) && is_truncating) {
__ mov(result, ShifterOperand(0));
} else {
// Result is Mint or exception.
@@ -2159,7 +2161,7 @@
__ cmp(right, ShifterOperand(0));
__ b(deopt, MI);
}
- Label done, is_not_zero;
+
__ cmp(right,
ShifterOperand(reinterpret_cast<int32_t>(Smi::New(Smi::kBits))));
__ mov(result, ShifterOperand(0), CS);
@@ -3053,11 +3055,11 @@
const intptr_t kNumTemps = 0;
LocationSummary* result =
new LocationSummary(InputCount(), kNumTemps, LocationSummary::kCall);
- result->set_in(0, Location::FpuRegisterLocation(D1));
+ result->set_in(0, Location::FpuRegisterLocation(D0));
if (InputCount() == 2) {
- result->set_in(1, Location::FpuRegisterLocation(D2));
+ result->set_in(1, Location::FpuRegisterLocation(D1));
}
- result->set_out(Location::FpuRegisterLocation(D1));
+ result->set_out(Location::FpuRegisterLocation(D0));
return result;
}
@@ -3075,12 +3077,11 @@
__ b(&skip_call);
}
__ Bind(&do_call);
- __ vmovrrd(R0, R1, locs()->in(0).fpu_reg());
- __ vmovrrd(R2, R3, locs()->in(1).fpu_reg());
- // TODO(regis): This leaf runtime call is not yet supported by the simulator.
- // We need a new leaf floating point runtime call kind.
+ // We currently use 'hardfp' ('gnueabihf') rather than 'softfp'
+ // ('gnueabi') float ABI for leaf runtime calls, i.e. double values
+ // are passed and returned in vfp registers rather than in integer
+ // register pairs.
__ CallRuntime(TargetFunction());
- __ vmovdrr(locs()->out().fpu_reg(), R0, R1);
__ Bind(&skip_call);
}
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index 5610b8b..5c4a45c 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -268,13 +268,37 @@
LocationSummary* ArgumentDefinitionTestInstr::MakeLocationSummary() const {
- UNIMPLEMENTED();
- return NULL;
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* locs =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
+ locs->set_in(0, Location::RegisterLocation(T0));
+ locs->set_out(Location::RegisterLocation(T0));
+ return locs;
}
void ArgumentDefinitionTestInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register saved_args_desc = locs()->in(0).reg();
+ Register result = locs()->out().reg();
+
+ __ TraceSimMsg("ArgumentDefinitionTestInstr");
+
+ __ addiu(SP, SP, Immediate(-4 * kWordSize));
+ // Push the result place holder initialized to NULL.
+ __ LoadObject(TMP1, Object::ZoneHandle());
+ __ sw(TMP1, Address(SP, 3 * kWordSize));
+ __ LoadImmediate(TMP1, Smi::RawValue(formal_parameter_index()));
+ __ sw(TMP1, Address(SP, 2 * kWordSize));
+ __ LoadObject(TMP1, formal_parameter_name());
+ __ sw(TMP1, Address(SP, 1 * kWordSize));
+ __ sw(saved_args_desc, Address(SP, 0 * kWordSize));
+ compiler->GenerateCallRuntime(token_pos(),
+ deopt_id(),
+ kArgumentDefinitionTestRuntimeEntry,
+ locs());
+ __ lw(result, Address(SP, 3 * kWordSize)); // Pop bool result.
+ __ addiu(SP, SP, Immediate(4 * kWordSize));
}
@@ -355,7 +379,6 @@
Token::Kind kind,
LocationSummary* locs,
const ICData& original_ic_data) {
- __ TraceSimMsg("EmitEqualityAsInstanceCall");
if (!compiler->is_optimizing()) {
compiler->AddCurrentDescriptor(PcDescriptors::kDeopt,
deopt_id,
@@ -365,7 +388,10 @@
const Array& kNoArgumentNames = Array::Handle();
const int kNumArgumentsChecked = 2;
+ __ TraceSimMsg("EmitEqualityAsInstanceCall");
Label check_identity;
+ __ lw(A1, Address(SP, 1 * kWordSize));
+ __ lw(A0, Address(SP, 0 * kWordSize));
__ beq(A1, NULLREG, &check_identity);
__ beq(A0, NULLREG, &check_identity);
@@ -385,9 +411,6 @@
deopt_id,
kNumArgumentsChecked);
}
- __ addiu(SP, SP, Immediate(-2 * kWordSize));
- __ sw(A1, Address(SP, 1 * kWordSize));
- __ sw(A0, Address(SP, 0 * kWordSize));
compiler->GenerateInstanceCall(deopt_id,
token_pos,
kNumberOfArguments,
@@ -402,6 +425,9 @@
if (compiler->is_optimizing()) {
// No need to update IC data.
Label is_true;
+ __ lw(A1, Address(SP, 1 * kWordSize));
+ __ lw(A0, Address(SP, 0 * kWordSize));
+ __ addiu(SP, SP, Immediate(2 * kWordSize));
__ beq(A1, A0, &is_true);
__ LoadObject(V0, (kind == Token::kEQ) ? Bool::False() : Bool::True());
__ b(&equality_done);
@@ -422,6 +448,7 @@
&StubCode::EqualityWithNullArgLabel(),
PcDescriptors::kRuntimeCall,
locs);
+ __ Drop(2);
}
__ Bind(&check_ne);
if (kind == Token::kNE) {
@@ -458,6 +485,129 @@
}
+static Condition TokenKindToSmiCondition(Token::Kind kind) {
+ switch (kind) {
+ case Token::kEQ: return EQ;
+ case Token::kNE: return NE;
+ case Token::kLT: return LT;
+ case Token::kGT: return GT;
+ case Token::kLTE: return LE;
+ case Token::kGTE: return GE;
+ default:
+ UNREACHABLE();
+ return VS;
+ }
+}
+
+
+// Branches on condition c assuming comparison results in CMPRES and TMP1.
+static void EmitBranchAfterCompare(
+ FlowGraphCompiler* compiler, Condition c, Label* is_true) {
+ switch (c) {
+ case EQ: __ beq(CMPRES, TMP1, is_true); break;
+ case NE: __ bne(CMPRES, TMP1, is_true); break;
+ case GT: __ bne(TMP1, ZR, is_true); break;
+ case GE: __ beq(CMPRES, ZR, is_true); break;
+ case LT: __ bne(CMPRES, ZR, is_true); break;
+ case LE: __ beq(TMP1, ZR, is_true); break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+
+// A1: left, also on stack.
+// A0: right, also on stack.
+static void EmitEqualityAsPolymorphicCall(FlowGraphCompiler* compiler,
+ const ICData& orig_ic_data,
+ LocationSummary* locs,
+ BranchInstr* branch,
+ Token::Kind kind,
+ intptr_t deopt_id,
+ intptr_t token_pos) {
+ ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
+ const ICData& ic_data = ICData::Handle(orig_ic_data.AsUnaryClassChecks());
+ ASSERT(ic_data.NumberOfChecks() > 0);
+ ASSERT(ic_data.num_args_tested() == 1);
+ Label* deopt = compiler->AddDeoptStub(deopt_id, kDeoptEquality);
+ Register left = locs->in(0).reg();
+ Register right = locs->in(1).reg();
+ ASSERT(left == A1);
+ ASSERT(right == A0);
+ Register temp = locs->temp(0).reg();
+
+ __ TraceSimMsg("EmitEqualityAsPolymorphicCall");
+
+ LoadValueCid(compiler, temp, left,
+ (ic_data.GetReceiverClassIdAt(0) == kSmiCid) ? NULL : deopt);
+ // 'temp' contains class-id of the left argument.
+ ObjectStore* object_store = Isolate::Current()->object_store();
+ Condition cond = TokenKindToSmiCondition(kind);
+ Label done;
+ const intptr_t len = ic_data.NumberOfChecks();
+ for (intptr_t i = 0; i < len; i++) {
+ // Assert that the Smi is at position 0, if at all.
+ ASSERT((ic_data.GetReceiverClassIdAt(i) != kSmiCid) || (i == 0));
+ Label next_test;
+ if (i < len - 1) {
+ __ BranchNotEqual(temp, ic_data.GetReceiverClassIdAt(i), &next_test);
+ } else {
+ __ BranchNotEqual(temp, ic_data.GetReceiverClassIdAt(i), deopt);
+ }
+ const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(i));
+ if (target.Owner() == object_store->object_class()) {
+ // Object.== is same as ===.
+ __ Drop(2);
+ __ slt(CMPRES, left, right);
+ __ slt(TMP1, right, left);
+ if (branch != NULL) {
+ branch->EmitBranchOnCondition(compiler, cond);
+ } else {
+ Register result = locs->out().reg();
+ Label load_true;
+ EmitBranchAfterCompare(compiler, cond, &load_true);
+ __ LoadObject(result, Bool::False());
+ __ b(&done);
+ __ Bind(&load_true);
+ __ LoadObject(result, Bool::True());
+ }
+ } else {
+ const int kNumberOfArguments = 2;
+ const Array& kNoArgumentNames = Array::Handle();
+ compiler->GenerateStaticCall(deopt_id,
+ token_pos,
+ target,
+ kNumberOfArguments,
+ kNoArgumentNames,
+ locs);
+ if (branch == NULL) {
+ if (kind == Token::kNE) {
+ Label is_true;
+ __ CompareObject(CMPRES, TMP1, V0, Bool::True());
+ __ beq(CMPRES, TMP1, &is_true);
+ __ LoadObject(V0, Bool::True());
+ __ b(&done);
+ __ Bind(&is_true);
+ __ LoadObject(V0, Bool::False());
+ }
+ } else {
+ if (branch->is_checked()) {
+ EmitAssertBoolean(V0, token_pos, deopt_id, locs, compiler);
+ }
+ __ CompareObject(CMPRES, TMP1, V0, Bool::True());
+ branch->EmitBranchOnCondition(compiler, cond);
+ }
+ }
+ if (i < len - 1) {
+ __ b(&done);
+ __ Bind(&next_test);
+ }
+ }
+ __ Bind(&done);
+}
+
+
// Emit code when ICData's targets are all Object == (which is ===).
static void EmitCheckedStrictEqual(FlowGraphCompiler* compiler,
const ICData& ic_data,
@@ -479,45 +629,56 @@
const ICData& ic_data,
intptr_t deopt_id,
intptr_t token_pos) {
- UNIMPLEMENTED();
-}
+ ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
+ ASSERT(!ic_data.IsNull() && (ic_data.NumberOfChecks() > 0));
+ Register left = locs->in(0).reg();
+ Register right = locs->in(1).reg();
+ Label done, identity_compare, non_null_compare;
+ __ TraceSimMsg("EmitGenericEqualityCompare");
+ __ beq(right, NULLREG, &identity_compare);
+ __ bne(left, NULLREG, &non_null_compare);
-
-static Condition TokenKindToSmiCondition(Token::Kind kind) {
- switch (kind) {
- case Token::kEQ: return EQ;
- case Token::kNE: return NE;
- case Token::kLT: return LT;
- case Token::kGT: return GT;
- case Token::kLTE: return LE;
- case Token::kGTE: return GE;
- default:
- UNREACHABLE();
- return VS;
+ // Comparison with NULL is "===".
+ __ Bind(&identity_compare);
+ Condition cond = TokenKindToSmiCondition(kind);
+ __ slt(CMPRES, left, right);
+ __ slt(TMP1, right, left);
+ if (branch != NULL) {
+ branch->EmitBranchOnCondition(compiler, cond);
+ } else {
+ Register result = locs->out().reg();
+ Label load_true;
+ EmitBranchAfterCompare(compiler, cond, &load_true);
+ __ LoadObject(result, Bool::False());
+ __ b(&done);
+ __ Bind(&load_true);
+ __ LoadObject(result, Bool::True());
}
-}
-
-
-// Branches on condition c assuming comparison results in CMPRES and TMP1.
-static void EmitBranchAfterCompare(
- FlowGraphCompiler* compiler, Condition c, Label* is_true) {
- switch (c) {
- case EQ: __ beq(CMPRES, TMP1, is_true); break;
- case NE: __ bne(CMPRES, TMP1, is_true); break;
- case GT: __ bne(TMP1, ZR, is_true); break;
- case GE: __ beq(CMPRES, ZR, is_true); break;
- case LT: __ bne(CMPRES, ZR, is_true); break;
- case LE: __ beq(TMP1, ZR, is_true); break;
- default:
- UNREACHABLE();
- break;
- }
+ __ b(&done);
+ __ Bind(&non_null_compare); // Receiver is not null.
+ ASSERT(left == A1);
+ ASSERT(right == A0);
+ __ addiu(SP, SP, Immediate(-2 * kWordSize));
+ __ sw(A1, Address(SP, 1 * kWordSize));
+ __ sw(A0, Address(SP, 0 * kWordSize));
+ EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind,
+ deopt_id, token_pos);
+ __ Bind(&done);
}
static Condition FlipCondition(Condition condition) {
- UNIMPLEMENTED();
- return condition;
+ switch (condition) {
+ case EQ: return EQ;
+ case NE: return NE;
+ case LT: return GT;
+ case LE: return GE;
+ case GT: return LT;
+ case GE: return LE;
+ default:
+ UNREACHABLE();
+ return EQ;
+ }
}
@@ -612,6 +773,9 @@
Register right = locs()->in(1).reg();
ASSERT(left == A1);
ASSERT(right == A0);
+ __ addiu(SP, SP, Immediate(-2 * kWordSize));
+ __ sw(A1, Address(SP, 1 * kWordSize));
+ __ sw(A0, Address(SP, 0 * kWordSize));
EmitEqualityAsInstanceCall(compiler,
deopt_id(),
token_pos(),
@@ -655,6 +819,9 @@
Register right = locs()->in(1).reg();
ASSERT(left == A1);
ASSERT(right == A0);
+ __ addiu(SP, SP, Immediate(-2 * kWordSize));
+ __ sw(A1, Address(SP, 1 * kWordSize));
+ __ sw(A0, Address(SP, 0 * kWordSize));
EmitEqualityAsInstanceCall(compiler,
deopt_id(),
token_pos(),
@@ -853,13 +1020,26 @@
LocationSummary* StringFromCharCodeInstr::MakeLocationSummary() const {
- UNIMPLEMENTED();
- return NULL;
+ const intptr_t kNumInputs = 1;
+ // TODO(fschneider): Allow immediate operands for the char code.
+ return LocationSummary::Make(kNumInputs,
+ Location::RequiresRegister(),
+ LocationSummary::kNoCall);
}
void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register char_code = locs()->in(0).reg();
+ Register result = locs()->out().reg();
+
+ __ TraceSimMsg("StringFromCharCodeInstr");
+
+ __ LoadImmediate(result,
+ reinterpret_cast<uword>(Symbols::PredefinedAddress()));
+ __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize);
+ __ sll(TMP1, char_code, 1); // Char code is a smi.
+ __ addu(TMP1, TMP1, result);
+ __ lw(result, Address(TMP1));
}
@@ -986,6 +1166,7 @@
void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ TraceSimMsg("LoadIndexedInstr");
Register array = locs()->in(0).reg();
Location index = locs()->in(1);
@@ -1745,13 +1926,33 @@
LocationSummary* CloneContextInstr::MakeLocationSummary() const {
- UNIMPLEMENTED();
- return NULL;
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* locs =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
+ locs->set_in(0, Location::RegisterLocation(T0));
+ locs->set_out(Location::RegisterLocation(T0));
+ return locs;
}
void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register context_value = locs()->in(0).reg();
+ Register result = locs()->out().reg();
+
+ __ TraceSimMsg("CloneContextInstr");
+
+ __ addiu(SP, SP, Immediate(-2 * kWordSize));
+ __ LoadObject(TMP1, Object::ZoneHandle()); // Make room for the result.
+ __ sw(TMP1, Address(SP, 1 * kWordSize));
+ __ sw(context_value, Address(SP, 0 * kWordSize));
+
+ compiler->GenerateCallRuntime(token_pos(),
+ deopt_id(),
+ kCloneContextRuntimeEntry,
+ locs());
+ __ lw(result, Address(SP, 1 * kWordSize)); // Get result (cloned context).
+ __ addiu(SP, SP, Immediate(2 * kWordSize));
}
@@ -1850,6 +2051,118 @@
}
+static void EmitSmiShiftLeft(FlowGraphCompiler* compiler,
+ BinarySmiOpInstr* shift_left) {
+ const bool is_truncating = shift_left->is_truncating();
+ const LocationSummary& locs = *shift_left->locs();
+ Register left = locs.in(0).reg();
+ Register result = locs.out().reg();
+ Label* deopt = shift_left->CanDeoptimize() ?
+ compiler->AddDeoptStub(shift_left->deopt_id(), kDeoptBinarySmiOp) : NULL;
+
+ __ TraceSimMsg("EmitSmiShiftLeft");
+
+ if (locs.in(1).IsConstant()) {
+ const Object& constant = locs.in(1).constant();
+ ASSERT(constant.IsSmi());
+ // Immediate shift operation takes 5 bits for the count.
+ const intptr_t kCountLimit = 0x1F;
+ const intptr_t value = Smi::Cast(constant).Value();
+ if (value == 0) {
+ // No code needed.
+ } else if ((value < 0) || (value >= kCountLimit)) {
+ // This condition may not be known earlier in some cases because
+ // of constant propagation, inlining, etc.
+ if ((value >= kCountLimit) && is_truncating) {
+ __ mov(result, ZR);
+ } else {
+ // Result is Mint or exception.
+ __ b(deopt);
+ }
+ } else {
+ if (!is_truncating) {
+ // Check for overflow (preserve left).
+ __ sll(TMP1, left, value);
+ __ sra(TMP1, TMP1, value);
+ __ bne(TMP1, left, deopt); // Overflow.
+ }
+ // Shift for result now we know there is no overflow.
+ __ sll(result, left, value);
+ }
+ return;
+ }
+
+ // Right (locs.in(1)) is not constant.
+ Register right = locs.in(1).reg();
+ Range* right_range = shift_left->right()->definition()->range();
+ if (shift_left->left()->BindsToConstant() && !is_truncating) {
+ // TODO(srdjan): Implement code below for is_truncating().
+ // If left is constant, we know the maximal allowed size for right.
+ const Object& obj = shift_left->left()->BoundConstant();
+ if (obj.IsSmi()) {
+ const intptr_t left_int = Smi::Cast(obj).Value();
+ if (left_int == 0) {
+ __ bltz(right, deopt);
+ return;
+ }
+ const intptr_t max_right = kSmiBits - Utils::HighestBit(left_int);
+ const bool right_needs_check =
+ (right_range == NULL) ||
+ !right_range->IsWithin(0, max_right - 1);
+ if (right_needs_check) {
+ __ BranchUnsignedGreaterEqual(
+ right, reinterpret_cast<int32_t>(Smi::New(max_right)), deopt);
+ }
+ __ SmiUntag(right);
+ __ sllv(result, left, right);
+ }
+ return;
+ }
+
+ const bool right_needs_check =
+ (right_range == NULL) || !right_range->IsWithin(0, (Smi::kBits - 1));
+ if (is_truncating) {
+ if (right_needs_check) {
+ const bool right_may_be_negative =
+ (right_range == NULL) ||
+ !right_range->IsWithin(0, RangeBoundary::kPlusInfinity);
+ if (right_may_be_negative) {
+ ASSERT(shift_left->CanDeoptimize());
+ __ bltz(right, deopt);
+ }
+ Label done, is_not_zero;
+
+ __ sltiu(CMPRES,
+ right, Immediate(reinterpret_cast<int32_t>(Smi::New(Smi::kBits))));
+ __ movz(result, ZR, CMPRES); // result = right >= kBits ? 0 : result.
+ __ mov(TMP1, right);
+ __ SmiUntag(TMP1);
+ __ sllv(TMP1, left, TMP1);
+ // result = right < kBits ? left << right : result.
+ __ movn(result, TMP1, CMPRES);
+ } else {
+ __ SmiUntag(right);
+ __ sllv(result, left, right);
+ }
+ } else {
+ if (right_needs_check) {
+ ASSERT(shift_left->CanDeoptimize());
+ __ BranchUnsignedGreaterEqual(
+ right, reinterpret_cast<int32_t>(Smi::New(Smi::kBits)), deopt);
+ }
+ // Left is not a constant.
+ // Check if count too large for handling it inlined.
+ __ SmiUntag(right);
+ // Overflow test (preserve left and right);
+ __ sllv(TMP1, left, right);
+ __ srav(TMP1, TMP1, right);
+ __ bne(TMP1, left, deopt); // Overflow.
+ // Shift for result now we know there is no overflow.
+ __ sllv(result, left, right);
+ }
+}
+
+
LocationSummary* BinarySmiOpInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 2;
if (op_kind() == Token::kTRUNCDIV) {
@@ -1876,7 +2189,7 @@
void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
__ TraceSimMsg("BinarySmiOpInstr");
if (op_kind() == Token::kSHL) {
- UNIMPLEMENTED();
+ EmitSmiShiftLeft(compiler, this);
return;
}
@@ -1894,6 +2207,7 @@
int32_t imm = reinterpret_cast<int32_t>(constant.raw());
switch (op_kind()) {
case Token::kSUB: {
+ __ TraceSimMsg("kSUB imm");
if (deopt == NULL) {
__ AddImmediate(result, left, -imm);
} else {
@@ -1973,7 +2287,27 @@
break;
}
case Token::kSHR: {
- UNIMPLEMENTED();
+ // sarl operation masks the count to 5 bits.
+ const intptr_t kCountLimit = 0x1F;
+ intptr_t value = Smi::Cast(constant).Value();
+
+ __ TraceSimMsg("kSHR");
+
+ if (value == 0) {
+ // TODO(vegorov): should be handled outside.
+ __ break_(0);
+ break;
+ } else if (value < 0) {
+ // TODO(vegorov): should be handled outside.
+ __ b(deopt);
+ break;
+ }
+
+ value = value + kSmiTagSize;
+ if (value >= kCountLimit) value = kCountLimit;
+
+ __ sra(result, left, value);
+ __ SmiTag(result);
break;
}
@@ -1997,6 +2331,7 @@
break;
}
case Token::kSUB: {
+ __ TraceSimMsg("kSUB");
if (deopt == NULL) {
__ subu(result, left, right);
} else {
@@ -2006,11 +2341,14 @@
break;
}
case Token::kMUL: {
+ __ TraceSimMsg("kMUL");
__ SmiUntag(left);
__ mult(left, right);
__ mflo(result);
if (deopt != NULL) {
- UNIMPLEMENTED();
+ __ mfhi(TMP1);
+ __ sra(CMPRES, result, 31);
+ __ bne(TMP1, CMPRES, deopt);
}
break;
}
@@ -2442,9 +2780,9 @@
void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- __ TraceSimMsg("PolymorphicInstanceCallInstr");
Label* deopt = compiler->AddDeoptStub(deopt_id(),
kDeoptPolymorphicInstanceCallTestFail);
+ __ TraceSimMsg("PolymorphicInstanceCallInstr");
if (ic_data().NumberOfChecks() == 0) {
__ b(deopt);
return;
@@ -2826,10 +3164,10 @@
Register result = locs()->out().reg();
Label load_true, done;
if (kind() == Token::kEQ_STRICT) {
- __ beq(CMPRES, ZR, &load_true);
+ __ beq(CMPRES, TMP1, &load_true);
} else {
ASSERT(kind() == Token::kNE_STRICT);
- __ bne(CMPRES, ZR, &load_true);
+ __ bne(CMPRES, TMP1, &load_true);
}
__ LoadObject(result, Bool::False());
__ b(&done);
diff --git a/runtime/vm/intrinsifier_arm.cc b/runtime/vm/intrinsifier_arm.cc
index 71463e8..1e2dd8b 100644
--- a/runtime/vm/intrinsifier_arm.cc
+++ b/runtime/vm/intrinsifier_arm.cc
@@ -1530,7 +1530,7 @@
__ SmiTag(R0);
__ str(R0, FieldAddress(R1, String::hash_offset()));
__ Ret();
- return false;
+ return true;
}
diff --git a/runtime/vm/intrinsifier_mips.cc b/runtime/vm/intrinsifier_mips.cc
index 82c06b3..9ba29ff 100644
--- a/runtime/vm/intrinsifier_mips.cc
+++ b/runtime/vm/intrinsifier_mips.cc
@@ -1556,10 +1556,10 @@
bool Intrinsifier::OneByteString_getHashCode(Assembler* assembler) {
Label no_hash;
- __ Untested("Intrinsifier::OneByteString_getHashCode");
+
__ lw(T1, Address(SP, 0 * kWordSize));
- __ lw(T0, FieldAddress(T1, String::hash_offset()));
- __ beq(T0, ZR, &no_hash);
+ __ lw(V0, FieldAddress(T1, String::hash_offset()));
+ __ beq(V0, ZR, &no_hash);
__ Ret(); // Return if already computed.
__ Bind(&no_hash);
@@ -1568,12 +1568,12 @@
Label done;
// If the string is empty, set the hash to 1, and return.
__ BranchEqual(T2, Smi::RawValue(0), &done);
- __ delay_slot()->mov(T0, ZR);
+ __ delay_slot()->mov(V0, ZR);
__ SmiUntag(T2);
__ AddImmediate(T3, T1, OneByteString::data_offset() - kHeapObjectTag);
__ addu(T4, T3, T2);
- // T0: Hash code, untagged integer.
+ // V0: Hash code, untagged integer.
// T1: Instance of OneByteString.
// T2: String length, untagged integer.
// T3: String data start.
@@ -1586,37 +1586,38 @@
// hash_ ^= hash_ >> 6;
// Get one characters (ch).
__ Bind(&loop);
- __ lw(T5, Address(T3));
+ __ lbu(T5, Address(T3));
// T5: ch.
__ addiu(T3, T3, Immediate(1));
- __ addu(T0, T0, T5);
- __ sll(TMP, T0, 10);
- __ addu(T0, T0, TMP);
- __ srl(TMP, T0, 6);
- __ BranchUnsignedLess(T3, T4, &loop);
- __ delay_slot()->xor_(T0, T0, TMP);
+ __ addu(V0, V0, T5);
+ __ sll(TMP, V0, 10);
+ __ addu(V0, V0, TMP);
+ __ srl(TMP, V0, 6);
+ __ bne(T3, T4, &loop);
+ __ delay_slot()->xor_(V0, V0, TMP);
// Finalize.
// hash_ += hash_ << 3;
// hash_ ^= hash_ >> 11;
// hash_ += hash_ << 15;
- __ sll(TMP, T0, 3);
- __ addu(T0, T0, TMP);
- __ srl(TMP, T0, 11);
- __ xor_(T0, T0, TMP);
- __ sll(TMP, T0, 15);
- __ addu(T0, T0, TMP);
+ __ sll(TMP, V0, 3);
+ __ addu(V0, V0, TMP);
+ __ srl(TMP, V0, 11);
+ __ xor_(V0, V0, TMP);
+ __ sll(TMP, V0, 15);
+ __ addu(V0, V0, TMP);
// hash_ = hash_ & ((static_cast<intptr_t>(1) << bits) - 1);
__ LoadImmediate(TMP, (static_cast<intptr_t>(1) << String::kHashBits) - 1);
- __ and_(T0, T0, TMP);
+ __ and_(V0, V0, TMP);
__ Bind(&done);
__ LoadImmediate(T2, 1);
- __ movz(T0, T2, T0); // If T0 is 0, set to 1.
- __ SmiTag(T0);
+ __ movz(V0, T2, V0); // If V0 is 0, set to 1.
+ __ SmiTag(V0);
+
__ Ret();
- __ delay_slot()->sw(T0, FieldAddress(T1, String::hash_offset()));
- return false;
+ __ delay_slot()->sw(V0, FieldAddress(T1, String::hash_offset()));
+ return true;
}
@@ -1628,7 +1629,6 @@
Label* ok,
Label* failure) {
const Register length_reg = T2;
- Label fail;
__ mov(T6, length_reg); // Save the length register.
__ SmiUntag(length_reg);
@@ -1645,7 +1645,7 @@
// length_reg: allocation size.
__ AdduDetectOverflow(T1, V0, length_reg, CMPRES);
- __ bltz(CMPRES, &fail); // Fail on overflow.
+ __ bltz(CMPRES, failure); // Fail on overflow.
// Check if the allocation fits into the remaining space.
// V0: potential new object start.
@@ -1654,7 +1654,7 @@
// T3: heap->TopAddress().
__ LoadImmediate(T4, heap->EndAddress());
__ lw(T4, Address(T4, 0));
- __ BranchUnsignedGreaterEqual(T1, T4, &fail);
+ __ BranchUnsignedGreaterEqual(T1, T4, failure);
// Successfully allocated the object(s), now update top to point to
// next object start and initialize the object.
@@ -1692,9 +1692,6 @@
// Clear hash.
__ b(ok);
__ delay_slot()->sw(ZR, FieldAddress(V0, String::hash_offset()));
-
- __ Bind(&fail);
- __ b(failure);
}
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index cf218c8..c29dd4f 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -530,7 +530,7 @@
cls = Class::New<Array>();
isolate->object_store()->set_array_class(cls);
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
- cls = Class::New<ImmutableArray>();
+ cls = Class::New<Array>(kImmutableArrayCid);
isolate->object_store()->set_immutable_array_class(cls);
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
cls = Class::NewStringClass(kOneByteStringCid);
@@ -832,10 +832,11 @@
RegisterPrivateClass(cls, Symbols::GrowableObjectArray(), core_lib);
pending_classes.Add(cls, Heap::kOld);
- cls = Class::New<ImmutableArray>();
+ cls = Class::New<Array>(kImmutableArrayCid);
object_store->set_immutable_array_class(cls);
cls.set_type_arguments_field_offset(Array::type_arguments_offset());
ASSERT(object_store->immutable_array_class() != object_store->array_class());
+ cls.set_is_prefinalized();
RegisterPrivateClass(cls, Symbols::ImmutableArray(), core_lib);
pending_classes.Add(cls, Heap::kOld);
@@ -1083,11 +1084,6 @@
return error.raw();
}
- // Remove the Object superclass cycle by setting the super type to null (not
- // to the type of null).
- cls = object_store->object_class();
- cls.set_super_type(AbstractType::Handle());
-
ClassFinalizer::VerifyBootstrapClasses();
MarkInvisibleFunctions();
@@ -1125,7 +1121,7 @@
cls = Class::New<Array>();
object_store->set_array_class(cls);
- cls = Class::New<ImmutableArray>();
+ cls = Class::New<Array>(kImmutableArrayCid);
object_store->set_immutable_array_class(cls);
cls = Class::New<GrowableObjectArray>();
@@ -11713,7 +11709,15 @@
intptr_t char_size = kOneByteChar;
for (intptr_t i = 0; i < strings_len; i++) {
str ^= strings.At(i);
- result_len += str.Length();
+ intptr_t str_len = str.Length();
+ if ((kMaxElements - result_len) < str_len) {
+ Isolate* isolate = Isolate::Current();
+ const Instance& exception =
+ Instance::Handle(isolate->object_store()->out_of_memory());
+ Exceptions::Throw(exception);
+ UNREACHABLE();
+ }
+ result_len += str_len;
char_size = Utils::Maximum(char_size, str.CharSize());
}
if (char_size == kOneByteChar) {
@@ -12187,6 +12191,7 @@
str ^= strings.At(i);
intptr_t str_len = str.Length();
String::Copy(result, pos, str, 0, str_len);
+ ASSERT((kMaxElements - pos) >= str_len);
pos += str_len;
}
return OneByteString::raw(result);
@@ -12350,6 +12355,7 @@
str ^= strings.At(i);
intptr_t str_len = str.Length();
String::Copy(result, pos, str, 0, str_len);
+ ASSERT((kMaxElements - pos) >= str_len);
pos += str_len;
}
return TwoByteString::raw(result);
@@ -12547,9 +12553,10 @@
const char* Array::ToCString() const {
if (IsNull()) {
- return "Array NULL";
+ return IsImmutable() ? "ImmutableArray NULL" : "Array NULL";
}
- const char* format = "Array len:%"Pd"";
+ const char* format = !IsImmutable() ? "Array len:%"Pd"" :
+ "Immutable Array len:%"Pd"";
intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
OS::SNPrint(chars, len, format, Length());
@@ -12617,18 +12624,6 @@
}
-const char* ImmutableArray::ToCString() const {
- if (IsNull()) {
- return "ImmutableArray NULL";
- }
- const char* format = "ImmutableArray len:%"Pd"";
- intptr_t len = OS::SNPrint(NULL, 0, format, Length()) + 1;
- char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
- OS::SNPrint(chars, len, format, Length());
- return chars;
-}
-
-
void GrowableObjectArray::Add(const Object& value, Heap::Space space) const {
ASSERT(!IsNull());
if (Length() == Capacity()) {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 149b390..35786cb 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -4932,6 +4932,10 @@
StorePointer(ObjectAddr(index), value.raw());
}
+ bool IsImmutable() const {
+ return raw()->GetClassId() == kImmutableArrayCid;
+ }
+
virtual RawAbstractTypeArguments* GetTypeArguments() const {
return raw_ptr()->type_arguments_;
}
@@ -5005,19 +5009,38 @@
raw_ptr()->length_ = Smi::New(value);
}
- HEAP_OBJECT_IMPLEMENTATION(Array, Instance);
+ FINAL_HEAP_OBJECT_IMPLEMENTATION(Array, Instance);
friend class Class;
+ friend class ImmutableArray;
friend class Object;
friend class String;
};
-class ImmutableArray : public Array {
+class ImmutableArray : public AllStatic {
public:
static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew);
+ static RawImmutableArray* ReadFrom(SnapshotReader* reader,
+ intptr_t object_id,
+ intptr_t tags,
+ Snapshot::Kind kind);
+
+ static const ClassId kClassId = kImmutableArrayCid;
+
+ static intptr_t InstanceSize() {
+ return Array::InstanceSize();
+ }
+
+ static intptr_t InstanceSize(intptr_t len) {
+ return Array::InstanceSize(len);
+ }
+
private:
- FINAL_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray, Array);
+ static RawImmutableArray* raw(const Array& array) {
+ return reinterpret_cast<RawImmutableArray*>(array.raw());
+ }
+
friend class Class;
};
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index aff2cb1..eb3ea07 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -3334,10 +3334,12 @@
super_type = ParseMixins(super_type);
}
} else {
- // No extends clause: implicitly extend Object.
- super_type = Type::ObjectType();
+ // No extends clause: implicitly extend Object, unless Object itself.
+ if (!cls.IsObjectClass()) {
+ super_type = Type::ObjectType();
+ }
}
- ASSERT(!super_type.IsNull());
+ ASSERT(!super_type.IsNull() || cls.IsObjectClass());
cls.set_super_type(super_type);
if (CurrentToken() == Token::kIMPLEMENTS) {
@@ -8057,23 +8059,30 @@
}
-// If the field is already initialized, return no ast (NULL).
-// Otherwise, if the field is constant, initialize the field and return no ast.
-// If the field is not initialized and not const, return the ast for the getter.
+
+// If the field is constant, initialize the field if necessary and return
+// no ast (NULL).
+// Otherwise return NULL if no implicit getter exists (either never created
+// because trivial, or not needed or field not readable).
AstNode* Parser::RunStaticFieldInitializer(const Field& field) {
ASSERT(field.is_static());
+ const Class& field_owner = Class::ZoneHandle(field.owner());
+ const String& field_name = String::ZoneHandle(field.name());
+ const String& getter_name = String::Handle(Field::GetterName(field_name));
+ const Function& getter =
+ Function::Handle(field_owner.LookupStaticFunction(getter_name));
const Instance& value = Instance::Handle(field.value());
if (value.raw() == Object::transition_sentinel().raw()) {
if (field.is_const()) {
ErrorMsg("circular dependency while initializing static field '%s'",
- String::Handle(field.name()).ToCString());
+ field_name.ToCString());
} else {
// The implicit static getter will throw the exception if necessary.
return new StaticGetterNode(TokenPos(),
NULL,
false,
- Class::ZoneHandle(field.owner()),
- String::ZoneHandle(field.name()));
+ field_owner,
+ field_name);
}
} else if (value.raw() == Object::sentinel().raw()) {
// This field has not been referenced yet and thus the value has
@@ -8081,13 +8090,9 @@
// to evaluate the expression and canonicalize the value.
if (field.is_const()) {
field.set_value(Object::transition_sentinel());
- const String& field_name = String::Handle(field.name());
- const String& getter_name =
- String::Handle(Field::GetterName(field_name));
- const Class& cls = Class::Handle(field.owner());
const int kNumArguments = 0; // no arguments.
const Function& func =
- Function::Handle(Resolver::ResolveStatic(cls,
+ Function::Handle(Resolver::ResolveStatic(field_owner,
getter_name,
kNumArguments,
Object::empty_array(),
@@ -8120,15 +8125,20 @@
instance ^= instance.Canonicalize();
}
field.set_value(instance);
+ return NULL; // Constant
} else {
return new StaticGetterNode(TokenPos(),
NULL,
false,
- Class::ZoneHandle(field.owner()),
- String::ZoneHandle(field.name()));
+ field_owner,
+ field_name);
}
}
- return NULL;
+ if (getter.IsNull() || (getter.kind() == RawFunction::kConstImplicitGetter)) {
+ return NULL;
+ }
+ ASSERT(getter.kind() == RawFunction::kImplicitGetter);
+ return new StaticGetterNode(TokenPos(), NULL, false, field_owner, field_name);
}
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index 0d57f54..4a51160 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -211,7 +211,7 @@
if (class_id < kNumPredefinedCids) {
switch (class_id) {
#define RAW_VISITPOINTERS(clazz) \
- case clazz::kClassId: { \
+ case k##clazz##Cid: { \
Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(this); \
size = Raw##clazz::Visit##clazz##Pointers(raw_obj, visitor); \
break; \
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index fab5eec..1ef30f4 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -13,7 +13,7 @@
namespace dart {
// Macrobatics to define the Object hierarchy of VM implementation classes.
-#define CLASS_LIST_NO_OBJECT_OR_STRING(V) \
+#define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \
V(Class) \
V(UnresolvedClass) \
V(AbstractTypeArguments) \
@@ -60,8 +60,6 @@
V(Bigint) \
V(Double) \
V(Bool) \
- V(Array) \
- V(ImmutableArray) \
V(GrowableObjectArray) \
V(TypedData) \
V(ExternalTypedData) \
@@ -72,6 +70,9 @@
V(Float32x4) \
V(Uint32x4) \
+#define CLASS_LIST_ARRAYS(V) \
+ V(Array) \
+ V(ImmutableArray) \
#define CLASS_LIST_STRINGS(V) \
V(String) \
@@ -95,11 +96,13 @@
V(Float32x4Array) \
#define CLASS_LIST_FOR_HANDLES(V) \
- CLASS_LIST_NO_OBJECT_OR_STRING(V) \
+ CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \
+ V(Array) \
V(String)
#define CLASS_LIST_NO_OBJECT(V) \
- CLASS_LIST_NO_OBJECT_OR_STRING(V) \
+ CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \
+ CLASS_LIST_ARRAYS(V) \
CLASS_LIST_STRINGS(V)
#define CLASS_LIST(V) \
@@ -1602,9 +1605,9 @@
inline bool RawObject::IsBuiltinListClassId(intptr_t index) {
// Make sure this function is updated when new builtin List types are added.
ASSERT(kImmutableArrayCid == kArrayCid + 1 &&
- kGrowableObjectArrayCid == kArrayCid + 2 &&
- kTypedDataCid == kArrayCid + 3);
- return ((index >= kArrayCid && index < kTypedDataCid) ||
+ kTypedDataCid == kGrowableObjectArrayCid + 1);
+ return ((index >= kArrayCid && index < kImmutableArrayCid) ||
+ (index >= kGrowableObjectArrayCid && index < kTypedDataCid) ||
IsTypedDataClassId(index) ||
IsTypedDataViewClassId(index) ||
IsExternalTypedDataClassId(index));
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index cd4e0e5..d4f39a7 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -2082,16 +2082,15 @@
// Read the length so that we can determine instance size to allocate.
intptr_t len = reader->ReadSmiValue();
- ImmutableArray* array = reinterpret_cast<ImmutableArray*>(
- reader->GetBackRef(object_id));
+ Array* array = reinterpret_cast<Array*>(reader->GetBackRef(object_id));
if (array == NULL) {
- array = &(ImmutableArray::ZoneHandle(
+ array = &(Array::ZoneHandle(
reader->isolate(),
NEW_OBJECT_WITH_LEN_SPACE(ImmutableArray, len, kind)));
reader->AddBackRef(object_id, array, kIsDeserialized);
}
reader->ArrayReadFrom(*array, len, tags);
- return array->raw();
+ return raw(*array);
}
diff --git a/runtime/vm/runtime_entry.h b/runtime/vm/runtime_entry.h
index 8c1b8a2..5cdcf9b 100644
--- a/runtime/vm/runtime_entry.h
+++ b/runtime/vm/runtime_entry.h
@@ -23,19 +23,19 @@
class RuntimeEntry : public ValueObject {
public:
RuntimeEntry(const char* name, RuntimeFunction function,
- int argument_count, bool is_leaf)
- // TODO(regis): In order to simulate leaf runtime calls taking floating point
- // arguments, we need to add an 'is_float' flag.
+ int argument_count, bool is_leaf, bool is_float)
: name_(name),
function_(function),
argument_count_(argument_count),
- is_leaf_(is_leaf) { }
+ is_leaf_(is_leaf),
+ is_float_(is_float) { }
~RuntimeEntry() {}
const char* name() const { return name_; }
RuntimeFunction function() const { return function_; }
int argument_count() const { return argument_count_; }
bool is_leaf() const { return is_leaf_; }
+ bool is_float() const { return is_float_; }
uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); }
// Generate code to call the runtime entry.
@@ -46,6 +46,7 @@
const RuntimeFunction function_;
const int argument_count_;
const bool is_leaf_;
+ const bool is_float_;
DISALLOW_COPY_AND_ASSIGN(RuntimeEntry);
};
@@ -56,7 +57,7 @@
#define DEFINE_RUNTIME_ENTRY(name, argument_count) \
extern void DRT_##name(NativeArguments arguments); \
extern const RuntimeEntry k##name##RuntimeEntry( \
- "DRT_"#name, &DRT_##name, argument_count, false); \
+ "DRT_"#name, &DRT_##name, argument_count, false, false); \
static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments); \
void DRT_##name(NativeArguments arguments) { \
CHECK_STACK_ALIGNMENT; \
@@ -74,10 +75,11 @@
#define DECLARE_RUNTIME_ENTRY(name) \
extern const RuntimeEntry k##name##RuntimeEntry
-#define DEFINE_LEAF_RUNTIME_ENTRY(type, name, ...) \
+#define DEFINE_LEAF_RUNTIME_ENTRY(type, name, argument_count, ...) \
extern "C" type DLRT_##name(__VA_ARGS__); \
extern const RuntimeEntry k##name##RuntimeEntry( \
- "DLRT_"#name, reinterpret_cast<RuntimeFunction>(&DLRT_##name), 0, true); \
+ "DLRT_"#name, reinterpret_cast<RuntimeFunction>(&DLRT_##name), \
+ argument_count, true, false); \
type DLRT_##name(__VA_ARGS__) { \
CHECK_STACK_ALIGNMENT; \
NoGCScope no_gc_scope; \
diff --git a/runtime/vm/runtime_entry_arm.cc b/runtime/vm/runtime_entry_arm.cc
index af005b6..347e952 100644
--- a/runtime/vm/runtime_entry_arm.cc
+++ b/runtime/vm/runtime_entry_arm.cc
@@ -28,11 +28,17 @@
uword entry = GetEntryPoint();
#if defined(USING_SIMULATOR)
// Redirection to leaf runtime calls supports a maximum of 4 arguments passed
- // in registers.
- ASSERT(!is_leaf() || (argument_count() <= 4));
+ // in registers (maximum 2 double arguments for leaf float runtime calls).
+ ASSERT(argument_count() >= 0);
+ ASSERT(!is_leaf() ||
+ (!is_float() && (argument_count() <= 4)) ||
+ (argument_count() <= 2));
Simulator::CallKind call_kind =
- is_leaf() ? Simulator::kLeafRuntimeCall : Simulator::kRuntimeCall;
- entry = Simulator::RedirectExternalReference(entry, call_kind);
+ is_leaf() ? (is_float() ? Simulator::kLeafFloatRuntimeCall
+ : Simulator::kLeafRuntimeCall)
+ : Simulator::kRuntimeCall;
+ entry =
+ Simulator::RedirectExternalReference(entry, call_kind, argument_count());
#endif
if (is_leaf()) {
ExternalLabel label(name(), entry);
diff --git a/runtime/vm/runtime_entry_test.cc b/runtime/vm/runtime_entry_test.cc
index a368af6..cfd24c9 100644
--- a/runtime/vm/runtime_entry_test.cc
+++ b/runtime/vm/runtime_entry_test.cc
@@ -49,7 +49,7 @@
// arg0: a smi.
// arg1: a smi.
// returns a smi representing arg0 + arg1.
-DEFINE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd,
+DEFINE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, 2,
RawObject* arg0, RawObject* arg1) {
// Ignoring overflow in the calculation below and using the internal
// representation of Smi directly without using any handlized code.
diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc
index cea3b8d..acfed60 100644
--- a/runtime/vm/simulator_arm.cc
+++ b/runtime/vm/simulator_arm.cc
@@ -801,13 +801,16 @@
Simulator::CallKind call_kind() const { return call_kind_; }
+ int argument_count() const { return argument_count_; }
+
static Redirection* Get(uword external_function,
- Simulator::CallKind call_kind) {
+ Simulator::CallKind call_kind,
+ int argument_count) {
Redirection* current;
for (current = list_; current != NULL; current = current->next_) {
if (current->external_function_ == external_function) return current;
}
- return new Redirection(external_function, call_kind);
+ return new Redirection(external_function, call_kind, argument_count);
}
static Redirection* FromSvcInstruction(Instr* svc_instruction) {
@@ -820,9 +823,12 @@
private:
static const int32_t kRedirectSvcInstruction =
((AL << kConditionShift) | (0xf << 24) | kRedirectionSvcCode);
- Redirection(uword external_function, Simulator::CallKind call_kind)
+ Redirection(uword external_function,
+ Simulator::CallKind call_kind,
+ int argument_count)
: external_function_(external_function),
call_kind_(call_kind),
+ argument_count_(argument_count),
svc_instruction_(kRedirectSvcInstruction),
next_(list_) {
list_ = this;
@@ -830,6 +836,7 @@
uword external_function_;
Simulator::CallKind call_kind_;
+ int argument_count_;
uint32_t svc_instruction_;
Redirection* next_;
static Redirection* list_;
@@ -839,8 +846,11 @@
Redirection* Redirection::list_ = NULL;
-uword Simulator::RedirectExternalReference(uword function, CallKind call_kind) {
- Redirection* redirection = Redirection::Get(function, call_kind);
+uword Simulator::RedirectExternalReference(uword function,
+ CallKind call_kind,
+ int argument_count) {
+ Redirection* redirection =
+ Redirection::Get(function, call_kind, argument_count);
return redirection->address_of_svc_instruction();
}
@@ -1430,6 +1440,9 @@
typedef int32_t (*SimulatorLeafRuntimeCall)(
int32_t r0, int32_t r1, int32_t r2, int32_t r3);
+// Calls to leaf float Dart runtime functions are based on this interface.
+typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1);
+
// Calls to native Dart functions are based on this interface.
typedef void (*SimulatorNativeCall)(NativeArguments* arguments);
@@ -1448,7 +1461,8 @@
OS::Print("Call to host function at 0x%"Pd"\n", external);
}
- if (redirection->call_kind() != kLeafRuntimeCall) {
+ if ((redirection->call_kind() == kRuntimeCall) ||
+ (redirection->call_kind() == kNativeCall)) {
// The top_exit_frame_info of the current isolate points to the top of
// the simulator stack.
ASSERT((StackTop() - Isolate::Current()->top_exit_frame_info()) <
@@ -1468,6 +1482,8 @@
target(arguments);
set_register(R0, icount_); // Zap result register from void function.
} else if (redirection->call_kind() == kLeafRuntimeCall) {
+ ASSERT((0 <= redirection->argument_count()) &&
+ (redirection->argument_count() <= 4));
int32_t r0 = get_register(R0);
int32_t r1 = get_register(R1);
int32_t r2 = get_register(R2);
@@ -1476,6 +1492,19 @@
reinterpret_cast<SimulatorLeafRuntimeCall>(external);
r0 = target(r0, r1, r2, r3);
set_register(R0, r0); // Set returned result from function.
+ } else if (redirection->call_kind() == kLeafFloatRuntimeCall) {
+ ASSERT((0 <= redirection->argument_count()) &&
+ (redirection->argument_count() <= 2));
+ // We currently use 'hardfp' ('gnueabihf') rather than 'softfp'
+ // ('gnueabi') float ABI for leaf runtime calls, i.e. double values
+ // are passed and returned in vfp registers rather than in integer
+ // register pairs.
+ SimulatorLeafFloatRuntimeCall target =
+ reinterpret_cast<SimulatorLeafFloatRuntimeCall>(external);
+ double d0 = get_dregister(D0);
+ double d1 = get_dregister(D1);
+ d0 = target(d0, d1);
+ set_dregister(D0, d0);
} else {
ASSERT(redirection->call_kind() == kNativeCall);
NativeArguments* arguments;
@@ -1495,10 +1524,11 @@
set_register(IP, icount_);
set_register(LR, icount_);
double zap_dvalue = static_cast<double>(icount_);
- for (int i = D0; i <= D7; i++) {
+ // Do not zap D0, as it may contain a float result.
+ for (int i = D1; i <= D7; i++) {
set_dregister(static_cast<DRegister>(i), zap_dvalue);
}
- // The above loop also zaps overlapping registers S0-S15.
+ // The above loop also zaps overlapping registers S2-S15.
// Registers D8-D15 (overlapping with S16-S31) are preserved.
#ifdef VFPv3_D32
for (int i = D16; i <= D31; i++) {
diff --git a/runtime/vm/simulator_arm.h b/runtime/vm/simulator_arm.h
index 0fc5223..d6e8409 100644
--- a/runtime/vm/simulator_arm.h
+++ b/runtime/vm/simulator_arm.h
@@ -82,12 +82,12 @@
enum CallKind {
kRuntimeCall,
kLeafRuntimeCall,
+ kLeafFloatRuntimeCall,
kNativeCall
};
- // TODO(regis): In order to simulate leaf runtime calls taking floating point
- // arguments, we need to add a 'kLeafFloatRuntimeCall' CallKind and pass the
- // number of arguments.
- static uword RedirectExternalReference(uword function, CallKind call_kind);
+ static uword RedirectExternalReference(uword function,
+ CallKind call_kind,
+ int argument_count);
void Longjmp(uword pc,
uword sp,
diff --git a/runtime/vm/simulator_mips.cc b/runtime/vm/simulator_mips.cc
index 1d930b2..3687bc9 100644
--- a/runtime/vm/simulator_mips.cc
+++ b/runtime/vm/simulator_mips.cc
@@ -1711,7 +1711,7 @@
if (Simulator::IsIllegalAddress(addr)) {
HandleIllegalAccess(addr, instr);
} else {
- int32_t res = ReadBU(addr);
+ uint32_t res = ReadBU(addr);
set_register(instr->RtField(), res);
}
break;
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index c94965d..ff22e03 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -33,6 +33,8 @@
// Check if this is a class which is stored in the object store.
return (class_id == kObjectCid ||
(class_id >= kInstanceCid && class_id <= kWeakPropertyCid) ||
+ class_id == kArrayCid ||
+ class_id == kImmutableArrayCid ||
RawObject::IsStringClassId(class_id) ||
RawObject::IsTypedDataClassId(class_id) ||
RawObject::IsExternalTypedDataClassId(class_id));
@@ -296,7 +298,7 @@
if (class_id == kImmutableArrayCid) {
// Read the length and allocate an object based on the len.
intptr_t len = ReadSmiValue();
- ImmutableArray& array = ImmutableArray::ZoneHandle(
+ Array& array = Array::ZoneHandle(
isolate(),
(kind_ == Snapshot::kFull) ?
NewImmutableArray(len) : ImmutableArray::New(len, HEAP_SPACE(kind_)));
diff --git a/runtime/vm/store_buffer.cc b/runtime/vm/store_buffer.cc
index b5f39ec..acf7ca6 100644
--- a/runtime/vm/store_buffer.cc
+++ b/runtime/vm/store_buffer.cc
@@ -9,7 +9,7 @@
namespace dart {
-DEFINE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate) {
+DEFINE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, 1, Isolate* isolate) {
StoreBuffer* buffer = isolate->store_buffer();
buffer->Expand(true);
}
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 1491ec3..62314eb 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -101,7 +101,7 @@
// Print the stop message.
-DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, const char* message) {
+DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
OS::Print("Stop message: %s\n", message);
}
END_LEAF_RUNTIME_ENTRY
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 1acfc81..0cf7c9b 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -94,7 +94,7 @@
// Print the stop message.
-DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, const char* message) {
+DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
OS::Print("Stop message: %s\n", message);
}
END_LEAF_RUNTIME_ENTRY
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index 74f1cd4..e5cf95c 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -40,13 +40,14 @@
const intptr_t argv_offset = NativeArguments::argv_offset();
const intptr_t retval_offset = NativeArguments::retval_offset();
+ __ SetPrologueOffset();
__ TraceSimMsg("CallToRuntimeStub");
__ 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 R0.
+ // 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
@@ -112,7 +113,7 @@
// Print the stop message.
-DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, const char* message) {
+DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
OS::Print("Stop message: %s\n", message);
}
END_LEAF_RUNTIME_ENTRY
@@ -142,6 +143,7 @@
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));
@@ -170,10 +172,10 @@
// 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: T1 already contains argc.
+ // Set argc in NativeArguments: A1 already contains argc.
ASSERT(argv_offset == 2 * kWordSize);
- // Set argv in NativeArguments: T2 already contains argv.
+ // Set argv in NativeArguments: A2 already contains argv.
ASSERT(retval_offset == 3 * kWordSize);
__ addiu(A3, FP, Immediate(2 * kWordSize)); // Set retval in NativeArgs.
@@ -352,8 +354,6 @@
DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp);
-
-
// Used by eager and lazy deoptimization. Preserve result in V0 if necessary.
// This stub translates optimized frame into unoptimized frame. The optimized
// frame can contain values in registers and on stack, the unoptimized
@@ -380,12 +380,13 @@
// Parts of the code cannot GC, part of the code can GC.
static void GenerateDeoptimizationSequence(Assembler* assembler,
bool preserve_result) {
- __ TraceSimMsg("GenerateDeoptimizationSequence");
const intptr_t kPushedRegistersSize =
kNumberOfCpuRegisters * kWordSize +
4 * kWordSize + // PP, FP, RA, PC marker.
kNumberOfFRegisters * kWordSize;
+ __ SetPrologueOffset();
+ __ TraceSimMsg("GenerateDeoptimizationSequence");
// DeoptimizeCopyFrame expects a Dart frame, i.e. EnterDartFrame(0), but there
// is no need to set the correct PC marker or load PP, since they get patched.
__ addiu(SP, SP, Immediate(-kPushedRegistersSize * kWordSize));
@@ -419,7 +420,7 @@
}
__ mov(A0, SP); // Pass address of saved registers block.
- __ ReserveAlignedFrameSpace(0);
+ __ ReserveAlignedFrameSpace(1 * kWordSize);
__ CallRuntime(kDeoptimizeCopyFrameRuntimeEntry);
// Result (V0) is stack-size (FP - SP) in bytes, incl. the return address.
@@ -447,7 +448,7 @@
if (preserve_result) {
__ Push(T1); // Preserve result as first local.
}
- __ ReserveAlignedFrameSpace(0);
+ __ ReserveAlignedFrameSpace(1 * kWordSize);
__ CallRuntime(kDeoptimizeFillFrameRuntimeEntry); // Pass last FP in A0.
if (preserve_result) {
// Restore result into T1.
@@ -1065,7 +1066,7 @@
// Setup frame, push callee-saved registers.
__ EnterCallRuntimeFrame(0 * kWordSize);
- __ lw(T0, FieldAddress(CTX, Context::isolate_offset()));
+ __ lw(A0, FieldAddress(CTX, Context::isolate_offset()));
__ CallRuntime(kStoreBufferBlockProcessRuntimeEntry);
__ TraceSimMsg("UpdateStoreBufferStub return");
// Restore callee-saved registers, tear down frame.
@@ -1644,8 +1645,6 @@
__ lw(T3, FieldAddress(T3, Code::instructions_offset()));
__ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag);
__ jr(T3);
- __ delay_slot()->addiu(T3, T3,
- Immediate(Instructions::HeaderSize() - kHeapObjectTag));
// Instance in T3, return its class-id in T3 as Smi.
__ Bind(&get_class_id_as_smi);
@@ -1947,6 +1946,7 @@
// V0: result.
// TODO(srdjan): Move to VM stubs once Boolean objects become VM objects.
void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) {
+ __ TraceSimMsg("EqualityWithNullArgStub");
__ EnterStubFrame();
static const intptr_t kNumArgsTested = 2;
#if defined(DEBUG)
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 21ed7c9..0b49f59 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -95,7 +95,7 @@
// Print the stop message.
-DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, const char* message) {
+DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
OS::Print("Stop message: %s\n", message);
}
END_LEAF_RUNTIME_ENTRY
diff --git a/sdk/lib/_internal/compiler/implementation/apiimpl.dart b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
index c5cc391..abb492c 100644
--- a/sdk/lib/_internal/compiler/implementation/apiimpl.dart
+++ b/sdk/lib/_internal/compiler/implementation/apiimpl.dart
@@ -44,7 +44,7 @@
!hasOption(options, '--disable-native-live-type-analysis'),
emitJavaScript: !hasOption(options, '--output-type=dart'),
disallowUnsafeEval: hasOption(options, '--disallow-unsafe-eval'),
- analyzeAll: hasOption(options, '--analyze-all'),
+ analyzeAllFlag: hasOption(options, '--analyze-all'),
analyzeOnly: hasOption(options, '--analyze-only'),
analyzeSignaturesOnly:
hasOption(options, '--analyze-signatures-only'),
@@ -56,7 +56,7 @@
strips: extractCsvOption(options, '--force-strip='),
enableConcreteTypeInference:
hasOption(options, '--enable-concrete-type-inference'),
- disableTypeInference:
+ disableTypeInferenceFlag:
hasOption(options, '--disable-type-inference'),
preserveComments: hasOption(options, '--preserve-comments'),
verbose: hasOption(options, '--verbose'),
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 671b02a..04191ab 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -30,21 +30,18 @@
* Invariant: [element] must be a declaration element.
*/
final Element element;
- TreeElements get resolutionTree;
+ TreeElements resolutionTree;
WorkItem(this.element, this.compilationContext) {
assert(invariant(element, element.isDeclaration));
}
- bool isAnalyzed() => resolutionTree != null;
void run(Compiler compiler, Enqueuer world);
}
/// [WorkItem] used exclusively by the [ResolutionEnqueuer].
class ResolutionWorkItem extends WorkItem {
- TreeElements resolutionTree;
-
ResolutionWorkItem(Element element,
ItemCompilationContext compilationContext)
: super(element, compilationContext);
@@ -52,25 +49,25 @@
void run(Compiler compiler, ResolutionEnqueuer world) {
resolutionTree = compiler.analyze(this, world);
}
+
+ bool isAnalyzed() => resolutionTree != null;
}
/// [WorkItem] used exclusively by the [CodegenEnqueuer].
class CodegenWorkItem extends WorkItem {
- final TreeElements resolutionTree;
-
bool allowSpeculativeOptimization = true;
List<HTypeGuard> guards = const <HTypeGuard>[];
CodegenWorkItem(Element element,
- TreeElements this.resolutionTree,
ItemCompilationContext compilationContext)
- : super(element, compilationContext) {
- assert(invariant(element, resolutionTree != null,
- message: 'Resolution tree is null for $element in codegen work item'));
- }
+ : super(element, compilationContext);
void run(Compiler compiler, CodegenEnqueuer world) {
if (world.isProcessed(element)) return;
+ resolutionTree =
+ compiler.enqueuer.resolution.getCachedElements(element);
+ assert(invariant(element, resolutionTree != null,
+ message: 'Resolution tree is null for $element in codegen work item'));
compiler.codegen(this, world);
}
}
@@ -254,14 +251,14 @@
final bool enableUserAssertions;
final bool trustTypeAnnotations;
final bool enableConcreteTypeInference;
- final bool disableTypeInference;
+ final bool disableTypeInferenceFlag;
/**
* The maximum size of a concrete type before it widens to dynamic during
* concrete type inference.
*/
final int maxConcreteTypeSize;
- final bool analyzeAll;
+ final bool analyzeAllFlag;
final bool analyzeOnly;
/**
* If true, skip analysis of method bodies and field initializers. Implies
@@ -457,14 +454,14 @@
this.enableUserAssertions: false,
this.trustTypeAnnotations: false,
this.enableConcreteTypeInference: false,
- this.disableTypeInference: false,
+ this.disableTypeInferenceFlag: false,
this.maxConcreteTypeSize: 5,
this.enableMinification: false,
this.enableNativeLiveTypeAnalysis: false,
bool emitJavaScript: true,
bool generateSourceMap: true,
bool disallowUnsafeEval: false,
- this.analyzeAll: false,
+ this.analyzeAllFlag: false,
bool analyzeOnly: false,
bool analyzeSignaturesOnly: false,
this.rejectDeprecatedFeatures: false,
@@ -525,6 +522,12 @@
bool get mirrorsEnabled => mirrorSystemClass != null;
+ bool get analyzeAll => analyzeAllFlag || compileAll;
+
+ bool get compileAll => mirrorsEnabled;
+
+ bool get disableTypeInference => disableTypeInferenceFlag || mirrorsEnabled;
+
int getNextFreeClassId() => nextFreeClassId++;
void ensure(bool condition) {
@@ -836,7 +839,8 @@
log('Resolving...');
phase = PHASE_RESOLVING;
if (analyzeAll) {
- libraries.forEach((_, lib) => fullyEnqueueLibrary(lib));
+ libraries.forEach(
+ (_, lib) => fullyEnqueueLibrary(lib, enqueuer.resolution));
}
// Elements required by enqueueHelpers are global dependencies
// that are not pulled in by a particular element.
@@ -874,6 +878,9 @@
enqueuer.codegen.registerInvocation(NO_SUCH_METHOD, noSuchMethodSelector);
enqueuer.codegen.addToWorkList(createInvocationMirrorElement);
}
+ if (compileAll) {
+ libraries.forEach((_, lib) => fullyEnqueueLibrary(lib, enqueuer.codegen));
+ }
processQueue(enqueuer.codegen, main);
enqueuer.codegen.logSummary(log);
@@ -895,19 +902,21 @@
}
}
- void fullyEnqueueLibrary(LibraryElement library) {
- library.implementation.forEachLocalMember(fullyEnqueueTopLevelElement);
+ void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) {
+ void enqueueAll(Element element) {
+ fullyEnqueueTopLevelElement(element, world);
+ }
+ library.implementation.forEachLocalMember(enqueueAll);
}
- void fullyEnqueueTopLevelElement(Element element) {
+ void fullyEnqueueTopLevelElement(Element element, Enqueuer world) {
if (element.isClass()) {
ClassElement cls = element;
cls.ensureResolved(this);
- cls.forEachLocalMember(enqueuer.resolution.addToWorkList);
- enqueuer.resolution.registerInstantiatedClass(
- element, globalDependencies);
+ cls.forEachLocalMember(world.addToWorkList);
+ world.registerInstantiatedClass(element, globalDependencies);
} else {
- enqueuer.resolution.addToWorkList(element);
+ world.addToWorkList(element);
}
}
diff --git a/sdk/lib/_internal/compiler/implementation/enqueue.dart b/sdk/lib/_internal/compiler/implementation/enqueue.dart
index 116036a..a1a2ed2 100644
--- a/sdk/lib/_internal/compiler/implementation/enqueue.dart
+++ b/sdk/lib/_internal/compiler/implementation/enqueue.dart
@@ -22,12 +22,11 @@
Link<Element> members = const Link<Element>();
if (element.isLibrary()) {
LibraryElementX library = element;
- Uri uri = library.canonicalUri;
// Don't include private implementation libraries. These
// libraries contain special classes that cause problems
// in other parts of the resolver (in particular Null and Void).
// TODO(ahe): Consider lifting this restriction.
- if (uri.scheme != 'dart' || !uri.path.startsWith('_')) {
+ if (!library.isInternalLibrary) {
members = library.localMembers;
// TODO(ahe): Is this right? Is this necessary?
name = library.getLibraryOrScriptName();
@@ -111,42 +110,22 @@
*
* Invariant: [element] must be a declaration element.
*/
- void addToWorkList(Element element, [TreeElements elements]) {
+ void addToWorkList(Element element) {
assert(invariant(element, element.isDeclaration));
if (element.isForeign(compiler)) return;
if (element.isForwardingConstructor) {
- addToWorkList(element.targetConstructor, elements);
+ addToWorkList(element.targetConstructor);
return;
}
- if (!addElementToWorkList(element, elements)) return;
-
- // Enable runtime type support if we discover a getter called runtimeType.
- // We have to enable runtime type before hitting the codegen, so
- // that constructors know whether they need to generate code for
- // runtime type.
- if (element.isGetter() && element.name == Compiler.RUNTIME_TYPE) {
- compiler.enabledRuntimeType = true;
- // TODO(ahe): Record precise dependency here.
- compiler.backend.registerRuntimeType(compiler.globalDependencies);
- } else if (element == compiler.functionApplyMethod) {
- compiler.enabledFunctionApply = true;
- } else if (element == compiler.invokeOnMethod) {
- compiler.enabledInvokeOn = true;
- }
-
- nativeEnqueuer.registerElement(element);
+ internalAddToWorkList(element);
}
/**
* Adds [element] to the work list if it has not already been processed.
- *
- * Returns [:true:] if the [element] should be processed.
*/
- // TODO(johnniwinther): Change to 'Returns true if the element was added to
- // the work list'?
- bool addElementToWorkList(Element element, [TreeElements elements]);
+ void internalAddToWorkList(Element element);
void registerInstantiatedType(InterfaceType type, TreeElements elements) {
ClassElement cls = type.element;
@@ -612,6 +591,9 @@
if (element.enclosingElement.isClosure()) {
closureMapping.ClosureClassElement cls = element.enclosingElement;
element = cls.methodElement;
+ } else if (element.isGenerativeConstructorBody()) {
+ ConstructorBodyElement body = element;
+ element = body.constructor;
}
Element owner = element.getOutermostEnclosingMemberOrTopLevel();
if (owner == null) {
@@ -620,35 +602,15 @@
return resolvedElements[owner.declaration];
}
- /**
- * Sets the resolved elements of [element] to [elements], or if [elements] is
- * [:null:], to the elements found through [getCachedElements].
- *
- * Returns the resolved elements.
- */
- TreeElements ensureCachedElements(Element element, TreeElements elements) {
- if (elements == null) {
- elements = getCachedElements(element);
- }
- resolvedElements[element] = elements;
- return elements;
- }
-
- bool addElementToWorkList(Element element, [TreeElements elements]) {
+ void internalAddToWorkList(Element element) {
+ if (getCachedElements(element) != null) return;
if (queueIsClosed) {
- if (getCachedElements(element) != null) return false;
throw new SpannableAssertionFailure(element,
"Resolution work list is closed.");
}
- if (elements == null) {
- elements = getCachedElements(element);
- }
compiler.world.registerUsedElement(element);
- if (elements == null) {
- queue.add(
- new ResolutionWorkItem(element, itemCompilationContextCreator()));
- }
+ queue.add(new ResolutionWorkItem(element, itemCompilationContextCreator()));
// Enable isolate support if we start using something from the
// isolate library, or timers for the async library.
@@ -667,7 +629,21 @@
}
}
- return true;
+ if (element.isGetter() && element.name == Compiler.RUNTIME_TYPE) {
+ // Enable runtime type support if we discover a getter called runtimeType.
+ // We have to enable runtime type before hitting the codegen, so
+ // that constructors know whether they need to generate code for
+ // runtime type.
+ compiler.enabledRuntimeType = true;
+ // TODO(ahe): Record precise dependency here.
+ compiler.backend.registerRuntimeType(compiler.globalDependencies);
+ } else if (element == compiler.functionApplyMethod) {
+ compiler.enabledFunctionApply = true;
+ } else if (element == compiler.invokeOnMethod) {
+ compiler.enabledInvokeOn = true;
+ }
+
+ nativeEnqueuer.registerElement(element);
}
void enableIsolateSupport(LibraryElement element) {
@@ -746,23 +722,18 @@
bool isProcessed(Element member) =>
member.isAbstract(compiler) || generatedCode.containsKey(member);
- bool addElementToWorkList(Element element, [TreeElements elements]) {
+ void internalAddToWorkList(Element element) {
// Codegen inlines field initializers, so it does not need to add
// individual fields in the work list.
- if (element.isField() && element.isInstanceMember()) return true;
+ if (element.isField() && element.isInstanceMember()) return;
if (queueIsClosed) {
throw new SpannableAssertionFailure(element,
"Codegen work list is closed.");
}
- elements =
- compiler.enqueuer.resolution.ensureCachedElements(element, elements);
-
CodegenWorkItem workItem = new CodegenWorkItem(
- element, elements, itemCompilationContextCreator());
+ element, itemCompilationContextCreator());
queue.add(workItem);
-
- return true;
}
void forEach(f(WorkItem work)) {
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index fde02b4..1dfe675 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -4,607 +4,6 @@
part of js_backend;
-typedef void Recompile(Element element);
-
-class ReturnInfo {
- HType returnType;
- List<Element> compiledFunctions;
-
- ReturnInfo(HType this.returnType)
- : compiledFunctions = new List<Element>();
-
- ReturnInfo.unknownType() : this(null);
-
- void update(HType type, Recompile recompile, Compiler compiler) {
- HType newType =
- returnType != null ? returnType.union(type, compiler) : type;
- if (newType != returnType) {
- if (returnType == null && identical(newType, HType.UNKNOWN)) {
- // If the first actual piece of information is not providing any type
- // information there is no need to recompile callers.
- compiledFunctions.clear();
- }
- returnType = newType;
- if (recompile != null) {
- compiledFunctions.forEach(recompile);
- }
- compiledFunctions.clear();
- }
- }
-
- // Note that lazy initializers are treated like functions (but are not
- // of type [FunctionElement].
- addCompiledFunction(Element function) => compiledFunctions.add(function);
-}
-
-class OptionalParameterTypes {
- final List<SourceString> names;
- final List<HType> types;
-
- OptionalParameterTypes(int optionalArgumentsCount)
- : names = new List<SourceString>(optionalArgumentsCount),
- types = new List<HType>(optionalArgumentsCount);
-
- int get length => names.length;
- SourceString name(int index) => names[index];
- HType type(int index) => types[index];
- int indexOf(SourceString name) => names.indexOf(name);
-
- HType typeFor(SourceString name) {
- int index = indexOf(name);
- if (index == -1) return null;
- return type(index);
- }
-
- void update(int index, SourceString name, HType type) {
- names[index] = name;
- types[index] = type;
- }
-
- String toString() => "OptionalParameterTypes($names, $types)";
-}
-
-class HTypeList {
- final List<HType> types;
- final List<SourceString> namedArguments;
-
- HTypeList(int length)
- : types = new List<HType>(length),
- namedArguments = null;
- HTypeList.withNamedArguments(int length, this.namedArguments)
- : types = new List<HType>(length);
- const HTypeList.withAllUnknown()
- : types = null,
- namedArguments = null;
-
- factory HTypeList.fromStaticInvocation(HInvokeStatic node) {
- bool allUnknown = true;
- for (int i = 0; i < node.inputs.length; i++) {
- if (node.inputs[i].instructionType != HType.UNKNOWN) {
- allUnknown = false;
- break;
- }
- }
- if (allUnknown) return HTypeList.ALL_UNKNOWN;
-
- HTypeList result = new HTypeList(node.inputs.length);
- for (int i = 0; i < result.types.length; i++) {
- result.types[i] = node.inputs[i].instructionType;
- }
- return result;
- }
-
- factory HTypeList.fromDynamicInvocation(HInvoke node,
- Selector selector) {
- HTypeList result;
- int argumentsCount = node.inputs.length - 1;
- int startInvokeIndex = HInvoke.ARGUMENTS_OFFSET;
-
- if (node.isInterceptedCall) {
- argumentsCount--;
- startInvokeIndex++;
- }
-
- if (selector.namedArgumentCount > 0) {
- result =
- new HTypeList.withNamedArguments(
- argumentsCount, selector.namedArguments);
- } else {
- result = new HTypeList(argumentsCount);
- }
-
- for (int i = 0; i < result.types.length; i++) {
- result.types[i] = node.inputs[i + startInvokeIndex].instructionType;
- }
- return result;
- }
-
- static const HTypeList ALL_UNKNOWN = const HTypeList.withAllUnknown();
-
- bool get allUnknown => types == null;
- bool get hasNamedArguments => namedArguments != null;
- int get length => types.length;
- HType operator[](int index) => types[index];
- void operator[]=(int index, HType type) { types[index] = type; }
-
- HTypeList union(HTypeList other, Compiler compiler) {
- if (allUnknown) return this;
- if (other.allUnknown) return other;
- if (length != other.length) return HTypeList.ALL_UNKNOWN;
- bool onlyUnknown = true;
- HTypeList result = this;
- for (int i = 0; i < length; i++) {
- HType newType = this[i].union(other[i], compiler);
- if (result == this && newType != this[i]) {
- // Create a new argument types object with the matching types copied.
- result = new HTypeList(length);
- result.types.setRange(0, i, this.types);
- }
- if (result != this) {
- result.types[i] = newType;
- }
- if (result[i] != HType.UNKNOWN) onlyUnknown = false;
- }
- return onlyUnknown ? HTypeList.ALL_UNKNOWN : result;
- }
-
- HTypeList unionWithOptionalParameters(
- Selector selector,
- FunctionSignature signature,
- OptionalParameterTypes defaultValueTypes) {
- assert(allUnknown || selector.argumentCount == this.length);
- // Create a new HTypeList for holding types for all parameters.
- HTypeList result = new HTypeList(signature.parameterCount);
-
- // First fill in the type of the positional arguments.
- int nextTypeIndex = -1;
- if (allUnknown) {
- for (int i = 0; i < selector.positionalArgumentCount; i++) {
- result.types[i] = HType.UNKNOWN;
- }
- } else {
- result.types.setRange(0, selector.positionalArgumentCount, this.types);
- nextTypeIndex = selector.positionalArgumentCount;
- }
-
- // Next fill the type of the optional arguments.
- // As the selector can pass optional arguments positionally some of the
- // optional arguments might already have a type set. We only need to look
- // at the optional arguments not passed positionally.
- // The variable 'index' is counting the signatures optional arguments, the
- // variable 'next' is set to the next optional arguments to look at and
- // is used to skip some optional arguments.
- int next = selector.positionalArgumentCount;
- int index = signature.requiredParameterCount;
- signature.forEachOptionalParameter((Element element) {
- // If some optional parameters were passed positionally these have
- // already been filled.
- if (index == next) {
- assert(result.types[index] == null);
- HType type = null;
- if (hasNamedArguments &&
- selector.namedArguments.indexOf(element.name) >= 0) {
- type = types[nextTypeIndex++];
- } else {
- type = defaultValueTypes.typeFor(element.name);
- }
- result.types[index] = type;
- next++;
- }
- index++;
- });
- return result;
- }
-
- String toString() =>
- allUnknown ? "HTypeList.ALL_UNKNOWN" : "HTypeList $types";
-}
-
-class FieldTypesRegistry {
- final JavaScriptBackend backend;
-
- /**
- * For each class, [constructors] holds the set of constructors. If there is
- * more than one constructor for a class it is currently not possible to
- * infer the field types from construction, as the information collected does
- * not correlate the generative constructors and generative constructor
- * body/bodies.
- */
- final Map<ClassElement, Set<Element>> constructors;
-
- /**
- * The collected type information is stored in three maps. One for types
- * assigned in the initializer list(s) [fieldInitializerTypeMap], one for
- * types assigned in the constructor(s) [fieldConstructorTypeMap], and one
- * for types assigned in the rest of the code, where the field can be
- * resolved [fieldTypeMap].
- *
- * If a field has a type both from constructors and from the initializer
- * list(s), then the type from the constructor(s) will owerride the one from
- * the initializer list(s).
- *
- * Because the order in which generative constructors, generative constructor
- * bodies and normal method/function bodies are compiled is undefined, and
- * because they can all be recompiled, it is not possible to combine this
- * information into one map at the moment.
- */
- final Map<Element, HType> fieldInitializerTypeMap;
- final Map<Element, HType> fieldConstructorTypeMap;
- final Map<Element, HType> fieldTypeMap;
-
- /**
- * The set of current names setter selectors used. If a named selector is
- * used it is currently not possible to infer the type of the field.
- */
- final Set<SourceString> setterSelectorsUsed;
-
- final Map<Element, Set<Element>> optimizedStaticFunctions;
- final Map<Element, FunctionSet> optimizedFunctions;
-
- FieldTypesRegistry(JavaScriptBackend backend)
- : constructors = new Map<ClassElement, Set<Element>>(),
- fieldInitializerTypeMap = new Map<Element, HType>(),
- fieldConstructorTypeMap = new Map<Element, HType>(),
- fieldTypeMap = new Map<Element, HType>(),
- setterSelectorsUsed = new Set<SourceString>(),
- optimizedStaticFunctions = new Map<Element, Set<Element>>(),
- optimizedFunctions = new Map<Element, FunctionSet>(),
- this.backend = backend;
-
- Compiler get compiler => backend.compiler;
-
- void scheduleRecompilation(Element field) {
- Set optimizedStatics = optimizedStaticFunctions[field];
- if (optimizedStatics != null) {
- optimizedStatics.forEach(backend.scheduleForRecompilation);
- optimizedStaticFunctions.remove(field);
- }
- FunctionSet optimized = optimizedFunctions[field];
- if (optimized != null) {
- optimized.forEach(backend.scheduleForRecompilation);
- optimizedFunctions.remove(field);
- }
- }
-
- int constructorCount(Element element) {
- assert(element.isClass());
- Set<Element> ctors = constructors[element];
- return ctors == null ? 0 : ctors.length;
- }
-
- void registerFieldType(Map<Element, HType> typeMap,
- Element field,
- HType type) {
- assert(field.isField());
- HType before = optimisticFieldType(field);
-
- HType oldType = typeMap[field];
- HType newType;
-
- if (oldType != null) {
- newType = oldType.union(type, compiler);
- } else {
- newType = type;
- }
- typeMap[field] = newType;
- if (oldType != newType) {
- scheduleRecompilation(field);
- }
- }
-
- void registerConstructor(Element element) {
- assert(element.isGenerativeConstructor());
- Element cls = element.getEnclosingClass();
- constructors.putIfAbsent(cls, () => new Set<Element>());
- Set<Element> ctors = constructors[cls];
- if (ctors.contains(element)) return;
- ctors.add(element);
- // We cannot infer field types for classes with more than one constructor.
- // When the second constructor is seen, recompile all functions relying on
- // optimistic field types for that class.
- // TODO(sgjesse): Handle field types for classes with more than one
- // constructor.
- if (ctors.length == 2) {
- optimizedFunctions.keys.toList().forEach((Element field) {
- if (identical(field.enclosingElement, cls)) {
- scheduleRecompilation(field);
- }
- });
- }
- }
-
- void registerFieldInitializer(Element field, HType type) {
- registerFieldType(fieldInitializerTypeMap, field, type);
- }
-
- void registerFieldConstructor(Element field, HType type) {
- registerFieldType(fieldConstructorTypeMap, field, type);
- }
-
- void registerFieldSetter(Element element, Element field, HType type) {
- HType initializerType = fieldInitializerTypeMap[field];
- HType constructorType = fieldConstructorTypeMap[field];
- HType setterType = fieldTypeMap[field];
- if (type == HType.UNKNOWN
- && initializerType == null
- && constructorType == null
- && setterType == null) {
- // Don't register UNKNOWN if there is currently no type information
- // present for the field. Instead register the function holding the
- // setter for recompilation if better type information for the field
- // becomes available.
- registerOptimizedFunction(element, field, type);
- return;
- }
- registerFieldType(fieldTypeMap, field, type);
- }
-
- void addedDynamicSetter(Selector setter, HType type) {
- // Field type optimizations are disabled for all fields matching a
- // setter selector.
- assert(setter.isSetter());
- // TODO(sgjesse): Take the type of the setter into account.
- if (setterSelectorsUsed.contains(setter.name)) return;
- setterSelectorsUsed.add(setter.name);
- optimizedStaticFunctions.keys.toList().forEach((Element field) {
- if (field.name == setter.name) {
- scheduleRecompilation(field);
- }
- });
- optimizedFunctions.keys.toList().forEach((Element field) {
- if (field.name == setter.name) {
- scheduleRecompilation(field);
- }
- });
- }
-
- HType optimisticFieldType(Element field) {
- assert(field.isField());
- if (constructorCount(field.getEnclosingClass()) > 1) {
- return HType.UNKNOWN;
- }
- if (setterSelectorsUsed.contains(field.name)) {
- return HType.UNKNOWN;
- }
- HType initializerType = fieldInitializerTypeMap[field];
- HType constructorType = fieldConstructorTypeMap[field];
- if (initializerType == null && constructorType == null) {
- // If there are no constructor type information return UNKNOWN. This
- // ensures that the function will be recompiled if useful constructor
- // type information becomes available.
- return HType.UNKNOWN;
- }
- // A type set through the constructor overrides the type from the
- // initializer list.
- HType result = constructorType != null ? constructorType : initializerType;
- HType type = fieldTypeMap[field];
- if (type != null) result = result.union(type, compiler);
- return result;
- }
-
- void registerOptimizedFunction(Element element,
- Element field,
- HType type) {
- assert(field.isField());
- if (Elements.isStaticOrTopLevel(element)) {
- optimizedStaticFunctions.putIfAbsent(
- field, () => new Set<Element>());
- optimizedStaticFunctions[field].add(element);
- } else {
- optimizedFunctions.putIfAbsent(
- field, () => new FunctionSet(backend.compiler));
- optimizedFunctions[field].add(element);
- }
- }
-
- void dump() {
- Set<Element> allFields = new Set<Element>();
- fieldInitializerTypeMap.keys.forEach(allFields.add);
- fieldConstructorTypeMap.keys.forEach(allFields.add);
- fieldTypeMap.keys.forEach(allFields.add);
- allFields.forEach((Element field) {
- print("Inferred $field has type ${optimisticFieldType(field)}");
- });
- }
-}
-
-class ArgumentTypesRegistry {
- final JavaScriptBackend backend;
-
- /**
- * Documentation wanted -- johnniwinther
- *
- * Invariant: Keys must be declaration elements.
- */
- final Map<Element, HTypeList> staticTypeMap;
-
- /**
- * Documentation wanted -- johnniwinther
- *
- * Invariant: Elements must be declaration elements.
- */
- final Set<Element> optimizedStaticFunctions;
- final SelectorMap<HTypeList> selectorTypeMap;
- final FunctionSet optimizedFunctions;
-
- /**
- * Documentation wanted -- johnniwinther
- *
- * Invariant: Keys must be declaration elements.
- */
- final Map<Element, HTypeList> optimizedTypes;
- final Map<Element, OptionalParameterTypes> optimizedDefaultValueTypes;
-
- ArgumentTypesRegistry(JavaScriptBackend backend)
- : staticTypeMap = new Map<Element, HTypeList>(),
- optimizedStaticFunctions = new Set<Element>(),
- selectorTypeMap = new SelectorMap<HTypeList>(backend.compiler),
- optimizedFunctions = new FunctionSet(backend.compiler),
- optimizedTypes = new Map<Element, HTypeList>(),
- optimizedDefaultValueTypes =
- new Map<Element, OptionalParameterTypes>(),
- this.backend = backend;
-
- Compiler get compiler => backend.compiler;
-
- bool updateTypes(HTypeList oldTypes, HTypeList newTypes, var key, var map) {
- if (oldTypes.allUnknown) return false;
- newTypes = oldTypes.union(newTypes, backend.compiler);
- if (identical(newTypes, oldTypes)) return false;
- map[key] = newTypes;
- return true;
- }
-
- void registerStaticInvocation(HInvokeStatic node) {
- Element element = node.element;
- assert(invariant(node, element.isDeclaration));
- HTypeList oldTypes = staticTypeMap[element];
- HTypeList newTypes = new HTypeList.fromStaticInvocation(node);
- if (oldTypes == null) {
- staticTypeMap[element] = newTypes;
- } else if (updateTypes(oldTypes, newTypes, element, staticTypeMap)) {
- if (optimizedStaticFunctions.contains(element)) {
- backend.scheduleForRecompilation(element);
- }
- }
- }
-
- void registerNonCallStaticUse(HStatic node) {
- // When a static is used for anything else than a call target we cannot
- // infer anything about its parameter types.
- Element element = node.element;
- assert(invariant(node, element.isDeclaration));
- if (optimizedStaticFunctions.contains(element)) {
- backend.scheduleForRecompilation(element);
- }
- staticTypeMap[element] = HTypeList.ALL_UNKNOWN;
- }
-
- void registerDynamicInvocation(HTypeList providedTypes, Selector selector) {
- if (selector.isClosureCall()) {
- // We cannot use the current framework to do optimizations based
- // on the 'call' selector because we are also generating closure
- // calls during the emitter phase, which at this point, does not
- // track parameter types, nor invalidates optimized methods.
- return;
- }
- if (!selectorTypeMap.containsKey(selector)) {
- selectorTypeMap[selector] = providedTypes;
- } else {
- HTypeList oldTypes = selectorTypeMap[selector];
- updateTypes(oldTypes, providedTypes, selector, selectorTypeMap);
- }
-
- // If we're not compiling, we don't have to do anything.
- if (compiler.phase != Compiler.PHASE_COMPILING) return;
-
- // Run through all optimized functions and figure out if they need
- // to be recompiled because of this new invocation.
- for (Element element in optimizedFunctions.filter(selector)) {
- // TODO(kasperl): Maybe check if the element is already marked for
- // recompilation? Could be pretty cheap compared to computing
- // union types.
- HTypeList newTypes =
- parameterTypes(element, optimizedDefaultValueTypes[element]);
- bool recompile = false;
- if (newTypes.allUnknown) {
- recompile = true;
- } else {
- HTypeList oldTypes = optimizedTypes[element];
- assert(newTypes.length == oldTypes.length);
- for (int i = 0; i < oldTypes.length; i++) {
- if (newTypes[i] != oldTypes[i]) {
- recompile = true;
- break;
- }
- }
- }
- if (recompile) backend.scheduleForRecompilation(element);
- }
- }
-
- HTypeList parameterTypes(FunctionElement element,
- OptionalParameterTypes defaultValueTypes) {
- assert(invariant(element, element.isDeclaration));
- // Handle static functions separately.
- if (Elements.isStaticOrTopLevelFunction(element) ||
- element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
- HTypeList types = staticTypeMap[element];
- if (types != null) {
- if (!optimizedStaticFunctions.contains(element)) {
- optimizedStaticFunctions.add(element);
- }
- return types;
- } else {
- return HTypeList.ALL_UNKNOWN;
- }
- }
-
- // Getters have no parameters.
- if (element.isGetter()) return HTypeList.ALL_UNKNOWN;
-
- // TODO(kasperl): What kind of non-members do we get here?
- if (!element.isMember()) return HTypeList.ALL_UNKNOWN;
-
- // If there are any getters for this method we cannot know anything about
- // the types of the provided parameters. Use resolverWorld for now as that
- // information does not change during compilation.
- // TODO(ngeoffray): These checks should use the codegenWorld and keep track
- // of changes to this information.
- if (compiler.resolverWorld.hasInvokedGetter(element, compiler)) {
- return HTypeList.ALL_UNKNOWN;
- }
-
- FunctionSignature signature = element.computeSignature(compiler);
- HTypeList found = null;
- selectorTypeMap.visitMatching(element,
- (Selector selector, HTypeList types) {
- if (selector.argumentCount != signature.parameterCount ||
- selector.namedArgumentCount > 0) {
- types = types.unionWithOptionalParameters(selector,
- signature,
- defaultValueTypes);
- }
- assert(types.allUnknown || types.length == signature.parameterCount);
- found = (found == null) ? types : found.union(types, compiler);
- return !found.allUnknown;
- });
- return found != null ? found : HTypeList.ALL_UNKNOWN;
- }
-
- void registerOptimizedFunction(Element element,
- HTypeList parameterTypes,
- OptionalParameterTypes defaultValueTypes) {
- if (Elements.isStaticOrTopLevelFunction(element)) {
- if (parameterTypes.allUnknown) {
- optimizedStaticFunctions.remove(element);
- } else {
- optimizedStaticFunctions.add(element);
- }
- }
-
- // TODO(kasperl): What kind of non-members do we get here?
- if (!element.isInstanceMember()) return;
-
- if (parameterTypes.allUnknown) {
- optimizedFunctions.remove(element);
- optimizedTypes.remove(element);
- optimizedDefaultValueTypes.remove(element);
- } else {
- optimizedFunctions.add(element);
- optimizedTypes[element] = parameterTypes;
- optimizedDefaultValueTypes[element] = defaultValueTypes;
- }
- }
-
- void dump() {
- optimizedFunctions.forEach((Element element) {
- HTypeList types = optimizedTypes[element];
- print("Inferred $element has argument types ${types.types}");
- });
- }
-}
-
class JavaScriptItemCompilationContext extends ItemCompilationContext {
final Set<HInstruction> boundsChecked;
@@ -691,17 +90,6 @@
*/
ClassElement jsIndexingBehaviorInterface;
- final Map<Element, ReturnInfo> returnInfo;
-
- /**
- * Documentation wanted -- johnniwinther
- *
- * Invariant: Elements must be declaration elements.
- */
- final List<Element> invalidateAfterCodegen;
- ArgumentTypesRegistry argumentTypes;
- FieldTypesRegistry fieldTypes;
-
/**
* A collection of selectors of intercepted method calls. The
* emitter uses this set to generate the [:ObjectInterceptor:] class
@@ -762,8 +150,6 @@
JavaScriptBackend(Compiler compiler, bool generateSourceMap, bool disableEval)
: namer = determineNamer(compiler),
- returnInfo = new Map<Element, ReturnInfo>(),
- invalidateAfterCodegen = new List<Element>(),
usedInterceptors = new Set<Selector>(),
oneShotInterceptors = new Map<String, Selector>(),
interceptedElements = new Map<SourceString, Set<Element>>(),
@@ -776,8 +162,6 @@
builder = new SsaBuilderTask(this);
optimizer = new SsaOptimizerTask(this);
generator = new SsaCodeGeneratorTask(this);
- argumentTypes = new ArgumentTypesRegistry(this);
- fieldTypes = new FieldTypesRegistry(this);
}
static Namer determineNamer(Compiler compiler) {
@@ -1052,23 +436,10 @@
}
}
- void initializeNoSuchMethod() {
- // In case the emitter generates noSuchMethod calls, we need to
- // make sure all [noSuchMethod] methods know they might take a
- // [JsInvocationMirror] as parameter.
- HTypeList types = new HTypeList(1);
- types[0] = new HType.nonNullExact(
- compiler.jsInvocationMirrorClass.computeType(compiler),
- compiler);
- argumentTypes.registerDynamicInvocation(
- types, compiler.noSuchMethodSelector);
- }
-
void registerInstantiatedClass(ClassElement cls,
Enqueuer enqueuer,
TreeElements elements) {
if (!seenAnyClass) {
- initializeNoSuchMethod();
seenAnyClass = true;
if (enqueuer.isResolutionQueue) {
// TODO(9577): Make it so that these are not needed when there are no
@@ -1387,7 +758,13 @@
void codegen(CodegenWorkItem work) {
Element element = work.element;
- if (element.kind.category == ElementCategory.VARIABLE) {
+ var kind = element.kind;
+ if (kind == ElementKind.TYPEDEF) return;
+ if (element.isConstructor() && element.getEnclosingClass() == jsNullClass) {
+ // Work around a problem compiling JSNull's constructor.
+ return;
+ }
+ if (kind.category == ElementCategory.VARIABLE) {
Constant initialValue = compiler.constantHandler.compileWorkItem(work);
if (initialValue != null) {
return;
@@ -1411,8 +788,6 @@
}
jsAst.Expression code = generator.generateCode(work, graph);
generatedCode[element] = code;
- invalidateAfterCodegen.forEach(eagerRecompile);
- invalidateAfterCodegen.clear();
}
native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) {
@@ -1442,153 +817,6 @@
emitter.assembleProgram();
}
- /**
- * Documentation wanted -- johnniwinther
- *
- * Invariant: [element] must be a declaration element.
- */
- void scheduleForRecompilation(Element element) {
- assert(invariant(element, element.isDeclaration));
- if (compiler.phase == Compiler.PHASE_COMPILING) {
- invalidateAfterCodegen.add(element);
- }
- }
-
- /**
- * Register a dynamic invocation and collect the provided types for the
- * named selector.
- */
- void registerDynamicInvocation(HInvoke node, Selector selector) {
- HTypeList providedTypes =
- new HTypeList.fromDynamicInvocation(node, selector);
- argumentTypes.registerDynamicInvocation(providedTypes, selector);
- }
-
- /**
- * Register a static invocation and collect the provided types for the
- * named selector.
- */
- void registerStaticInvocation(HInvokeStatic node) {
- argumentTypes.registerStaticInvocation(node);
- }
-
- /**
- * Register that a static is used for something else than a direct call
- * target.
- */
- void registerNonCallStaticUse(HStatic node) {
- argumentTypes.registerNonCallStaticUse(node);
- }
-
- /**
- * Retrieve the types of the parameters used for calling the [element]
- * function. The types are optimistic in the sense as they are based on the
- * possible invocations of the function seen so far.
- *
- * Invariant: [element] must be a declaration element.
- */
- HTypeList optimisticParameterTypes(
- FunctionElement element,
- OptionalParameterTypes defaultValueTypes) {
- assert(invariant(element, element.isDeclaration));
- if (element.parameterCount(compiler) == 0) return HTypeList.ALL_UNKNOWN;
- return argumentTypes.parameterTypes(element, defaultValueTypes);
- }
-
- /**
- * Register that the function [element] has been optimized under the
- * assumptions that the types [parameterType] will be used for calling it.
- * The passed [defaultValueTypes] holds the types of default values for
- * the optional parameters. If this assumption fail the function will be
- * scheduled for recompilation.
- *
- * Invariant: [element] must be a declaration element.
- */
- registerParameterTypesOptimization(
- FunctionElement element,
- HTypeList parameterTypes,
- OptionalParameterTypes defaultValueTypes) {
- assert(invariant(element, element.isDeclaration));
- if (element.parameterCount(compiler) == 0) return;
- argumentTypes.registerOptimizedFunction(
- element, parameterTypes, defaultValueTypes);
- }
-
- registerFieldTypesOptimization(Element element,
- Element field,
- HType type) {
- fieldTypes.registerOptimizedFunction(element, field, type);
- }
-
- /**
- * Documentation wanted -- johnniwinther
- *
- * Invariant: [element] must be a declaration element.
- */
- void registerReturnType(FunctionElement element, HType returnType) {
- assert(invariant(element, element.isDeclaration));
- ReturnInfo info = returnInfo[element];
- if (info != null) {
- info.update(returnType, scheduleForRecompilation, compiler);
- } else {
- returnInfo[element] = new ReturnInfo(returnType);
- }
- }
-
- /**
- * Retrieve the return type of the function [callee]. The type is optimistic
- * in the sense that is is based on the compilation of [callee]. If [callee]
- * is recompiled the return type might change to someting broader. For that
- * reason [caller] is registered for recompilation if this happens. If the
- * function [callee] has not yet been compiled the returned type is [null].
- *
- * Invariant: Both [caller] and [callee] must be declaration elements.
- */
- HType optimisticReturnTypesWithRecompilationOnTypeChange(
- Element caller, FunctionElement callee) {
- assert(invariant(callee, callee.isDeclaration));
- returnInfo.putIfAbsent(callee, () => new ReturnInfo.unknownType());
- ReturnInfo info = returnInfo[callee];
- HType returnType = info.returnType;
- if (returnType != HType.UNKNOWN && returnType != null && caller != null) {
- assert(invariant(caller, caller.isDeclaration));
- info.addCompiledFunction(caller);
- }
- return info.returnType;
- }
-
- void dumpReturnTypes() {
- returnInfo.forEach((Element element, ReturnInfo info) {
- if (info.returnType != HType.UNKNOWN) {
- print("Inferred $element has return type ${info.returnType}");
- }
- });
- }
-
- void registerConstructor(Element element) {
- fieldTypes.registerConstructor(element);
- }
-
- void registerFieldInitializer(Element field, HType type) {
- fieldTypes.registerFieldInitializer(field, type);
- }
-
- void registerFieldConstructor(Element field, HType type) {
- fieldTypes.registerFieldConstructor(field, type);
- }
-
- void registerFieldSetter(Element element, Element field, HType type) {
- fieldTypes.registerFieldSetter(element, field, type);
- }
-
- void addedDynamicSetter(Selector setter, HType type) {
- fieldTypes.addedDynamicSetter(setter, type);
- }
-
- HType optimisticFieldType(Element element) {
- return fieldTypes.optimisticFieldType(element);
- }
-
Element getImplementationClass(Element element) {
if (element == compiler.intClass) {
return jsIntClass;
@@ -1740,21 +968,6 @@
}
}
- void dumpInferredTypes() {
- print("Inferred argument types:");
- print("------------------------");
- argumentTypes.dump();
- print("");
- print("Inferred return types:");
- print("----------------------");
- dumpReturnTypes();
- print("");
- print("Inferred field types:");
- print("------------------------");
- fieldTypes.dump();
- print("");
- }
-
Element getExceptionUnwrapper() {
return compiler.findHelper(const SourceString('unwrapException'));
}
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 494eebf..fb146ff 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -63,7 +63,8 @@
ConstantEmitter constantEmitter;
NativeEmitter nativeEmitter;
CodeBuffer mainBuffer;
- final CodeBuffer deferredBuffer = new CodeBuffer();
+ final CodeBuffer deferredLibraries = new CodeBuffer();
+ final CodeBuffer deferredConstants = new CodeBuffer();
/** Shorter access to [isolatePropertiesName]. Both here in the code, as
well as in the generated code. */
String isolateProperties;
@@ -1901,9 +1902,7 @@
for (FunctionElement element in
Elements.sortedByPosition(staticGetters.keys)) {
Element closure = staticGetters[element];
- // TODO(ahe): This should be emitted as a constant. Currently,
- // this breaks deferred loading.
- CodeBuffer buffer = eagerBuffer;
+ CodeBuffer buffer = isDeferred(element) ? deferredConstants : eagerBuffer;
String closureClass = namer.isolateAccess(closure);
String name = namer.getStaticClosureName(element);
String staticName = namer.getName(element);
@@ -3127,12 +3126,7 @@
mainBuffer
..write(getReflectionDataParser())
..write('([$n');
- emitDeferredPreambleWhenEmpty(deferredBuffer);
- deferredBuffer.add('\$\$$_=$_{};$n');
- deferredBuffer
- ..write(getReflectionDataParser())
- ..write('([$n');
var sortedLibraries = Elements.sortedByPosition(libraryBuffers.keys);
for (LibraryElement library in sortedLibraries) {
List<CodeBuffer> buffers = libraryBuffers[library];
@@ -3159,7 +3153,7 @@
}
buffer = buffers[1];
if (buffer != null) {
- deferredBuffer
+ deferredLibraries
..write('["${library.getLibraryOrScriptName()}",$_')
..write('"${uri}",$_')
..write('[],$_')
@@ -3171,15 +3165,6 @@
}
mainBuffer.write('])$N');
- deferredBuffer.write('])$N');
- if (!deferredClasses.isEmpty) {
- deferredBuffer.add('$finishClassesName(\$\$,'
- '$_${namer.CURRENT_ISOLATE},'
- '$_$isolatePropertiesName)$N');
- }
-
- // Reset the map.
- deferredBuffer.add("\$\$$_=${_}null$N$n");
emitFinishClassesInvocationIfNecessary(mainBuffer);
classesCollector = oldClassesCollector;
}
@@ -3213,7 +3198,7 @@
compiler.assembledCode = mainBuffer.getText();
outputSourceMap(mainBuffer, compiler.assembledCode, '');
- emitDeferredCode(deferredBuffer);
+ emitDeferredCode();
});
return compiler.assembledCode;
@@ -3235,8 +3220,6 @@
return buffer;
}
- bool firstDeferredConstant = true;
-
/**
* Returns the appropriate buffer for [constant]. If [constant] is
* itself an instance of a deferred type (or built from constants
@@ -3249,29 +3232,59 @@
while (!queue.isEmpty) {
constant = queue.removeFirst();
if (isDeferred(constant.computeType(compiler).element)) {
- emitDeferredPreambleWhenEmpty(deferredBuffer);
- if (firstDeferredConstant) {
- deferredBuffer.write(
- '${namer.CURRENT_ISOLATE}$_=${_}old${namer.CURRENT_ISOLATE}$N');
- deferredBuffer.write(
- 'old${namer.CURRENT_ISOLATE}$_=${_}${namer.CURRENT_ISOLATE}$N');
- }
- firstDeferredConstant = false;
- return deferredBuffer;
+ return deferredConstants;
}
queue.addAll(constant.getDependencies());
}
return eagerBuffer;
}
- void emitDeferredCode(CodeBuffer buffer) {
- if (buffer.isEmpty) return;
- buffer.write(n);
+
+ void emitDeferredCode() {
+ if (deferredLibraries.isEmpty && deferredConstants.isEmpty) return;
+
+ var oldClassesCollector = classesCollector;
+ classesCollector = r"$$";
+
+ // It does not make sense to defer constants if there are no
+ // deferred elements.
+ assert(!deferredLibraries.isEmpty);
+
+ var buffer = new CodeBuffer()
+ ..write(buildGeneratedBy())
+ ..write('var old${namer.CURRENT_ISOLATE}$_='
+ '$_${namer.CURRENT_ISOLATE}$N'
+ // TODO(ahe): This defines a lot of properties on the
+ // Isolate.prototype object. We know this will turn it into a
+ // slow object in V8, so instead we should do something similar
+ // to Isolate.$finishIsolateConstructor.
+ '${namer.CURRENT_ISOLATE}$_='
+ '$_${namer.isolateName}.prototype$N$n'
+ // The classesCollector object ($$).
+ '$classesCollector$_=$_{};$n')
+ ..write(getReflectionDataParser())
+ ..write('([$n')
+ ..addBuffer(deferredLibraries)
+ ..write('])$N');
+
+ if (!deferredClasses.isEmpty) {
+ buffer.write(
+ '$finishClassesName($classesCollector,$_${namer.CURRENT_ISOLATE},'
+ '$_$isolatePropertiesName)$N');
+ }
buffer.write(
+ // Reset the classesCollector ($$).
+ '$classesCollector$_=${_}null$N$n'
'${namer.CURRENT_ISOLATE}$_=${_}old${namer.CURRENT_ISOLATE}$N');
+ classesCollector = oldClassesCollector;
+
+ if (!deferredConstants.isEmpty) {
+ buffer.addBuffer(deferredConstants);
+ }
+
String code = buffer.getText();
compiler.outputProvider('part', 'js')
..add(code)
@@ -3279,22 +3292,6 @@
outputSourceMap(buffer, compiler.assembledCode, 'part');
}
- void emitDeferredPreambleWhenEmpty(CodeBuffer buffer) {
- if (!buffer.isEmpty) return;
-
- buffer.write(buildGeneratedBy());
-
- buffer.write('var old${namer.CURRENT_ISOLATE}$_='
- '$_${namer.CURRENT_ISOLATE}$N');
-
- // TODO(ahe): This defines a lot of properties on the
- // Isolate.prototype object. We know this will turn it into a
- // slow object in V8, so instead we should do something similar to
- // Isolate.$finishIsolateConstructor.
- buffer.write('${namer.CURRENT_ISOLATE}$_='
- '$_${namer.isolateName}.prototype$N$n');
- }
-
String buildGeneratedBy() {
var suffix = '';
if (compiler.hasBuildId) suffix = ' version: ${compiler.buildId}';
diff --git a/sdk/lib/_internal/compiler/implementation/lib/io_patch.dart b/sdk/lib/_internal/compiler/implementation/lib/io_patch.dart
index 37dc6b8..e006fa5 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/io_patch.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/io_patch.dart
@@ -303,3 +303,9 @@
throw new UnsupportedError("newZLibInflateFilter");
}
}
+
+patch class _OptionsImpl {
+ patch String get version {
+ throw new UnsupportedError("_OptionsImpl.version");
+ }
+}
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart b/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart
index c06e251..db8d87f 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_mirrors.dart
@@ -198,7 +198,9 @@
final Expando<ClassMirror> classMirrors = new Expando<ClassMirror>();
-ClassMirror reflectType(Type key) => reflectClassByName(s('$key'));
+ClassMirror reflectType(Type key) {
+ return reflectClassByName(s('$key'.split('<')[0]));
+}
ClassMirror reflectClassByName(Symbol symbol) {
String className = n(symbol);
@@ -316,6 +318,8 @@
final String _fields;
final List _fieldsMetadata;
List _metadata;
+ JsClassMirror _superclass;
+
// Set as side-effect of accessing JsLibraryMirror.classes.
JsLibraryMirror _owner;
@@ -346,8 +350,8 @@
Map<Symbol, VariableMirror> get variables {
var result = new Map<Symbol, VariableMirror>();
- var s = _fields.split(";");
- var fields = s[1] == "" ? [] : s[1].split(",");
+ var s = _fields.split(';');
+ var fields = s[1] == '' ? [] : s[1].split(',');
int fieldNumber = 0;
for (String field in fields) {
var metadata;
@@ -439,6 +443,16 @@
return _metadata.map(reflect).toList();
}
+ ClassMirror get superclass {
+ if (_superclass == null) {
+ var superclassName = _fields.split(';')[0];
+ // Use _superclass == this to represent class with no superclass (Object).
+ _superclass =
+ (superclassName == '') ? this : reflectClassByName(s(superclassName));
+ }
+ return _superclass == this ? null : _superclass;
+ }
+
String toString() => 'ClassMirror(${n(simpleName)})';
}
@@ -473,7 +487,7 @@
}
String jsName;
String accessorName = jsName = descriptor.substring(0, length);
- int divider = descriptor.indexOf(":");
+ int divider = descriptor.indexOf(':');
if (divider > 0) {
accessorName = accessorName.substring(0, divider);
jsName = accessorName.substring(divider + 1);
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 135da9d..d0ffd9a 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -485,8 +485,7 @@
cls.supertypeLoadState = STATE_DONE;
cls.allSupertypes = const Link<DartType>().prepend(
compiler.objectClass.computeType(compiler));
- // TODO(ahe): We should also set cls.supertype here to avoid
- // creating a malformed class hierarchy.
+ cls.supertype = cls.allSupertypes.head;
return;
}
cls.supertypeLoadState = STATE_STARTED;
@@ -3234,9 +3233,9 @@
// resolve this class again.
resolveTypeVariableBounds(node.typeParameters);
- // Setup the supertype for the element.
- assert(element.supertype == null);
- if (node.superclass != null) {
+ // Setup the supertype for the element (if there is a cycle in the
+ // class hierarchy, it has already been set to Object).
+ if (element.supertype == null && node.superclass != null) {
MixinApplication superMixin = node.superclass.asMixinApplication();
if (superMixin != null) {
DartType supertype = resolveSupertype(element, superMixin.superclass);
diff --git a/sdk/lib/_internal/compiler/implementation/source_file_provider.dart b/sdk/lib/_internal/compiler/implementation/source_file_provider.dart
index e10a4bd..9916c98 100644
--- a/sdk/lib/_internal/compiler/implementation/source_file_provider.dart
+++ b/sdk/lib/_internal/compiler/implementation/source_file_provider.dart
@@ -37,7 +37,7 @@
String source;
try {
source = readAll(uriPathToNative(resourceUri.path));
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
throw 'Error: Cannot read "${relativize(cwd, resourceUri, isWindows)}" '
'(${ex.osError}).';
}
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 1187969..9121747 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -54,33 +54,11 @@
if (!identical(kind, ElementKind.FIELD)) {
FunctionElement function = element;
graph.calledInLoop = compiler.world.isCalledInLoop(function);
- OptionalParameterTypes defaultValueTypes = null;
FunctionSignature signature = function.computeSignature(compiler);
- if (signature.optionalParameterCount > 0) {
- defaultValueTypes =
- new OptionalParameterTypes(signature.optionalParameterCount);
- int index = 0;
- signature.forEachOptionalParameter((Element parameter) {
- Constant defaultValue = builder.compileVariable(parameter);
- HType type = HGraph.mapConstantTypeToSsaType(defaultValue);
- defaultValueTypes.update(index, parameter.name, type);
- index++;
- });
- } else {
- // BUG(10938): the types are stored in the wrong order.
- // order.
- HTypeList parameterTypes =
- backend.optimisticParameterTypes(element.declaration,
- defaultValueTypes);
- if (!parameterTypes.allUnknown) {
- int i = 0;
- signature.forEachParameter((Element param) {
- builder.parameters[param].instructionType = parameterTypes[i++];
- });
- }
- backend.registerParameterTypesOptimization(
- element.declaration, parameterTypes, defaultValueTypes);
- }
+ signature.forEachOptionalParameter((Element parameter) {
+ // This ensures the default value will be computed.
+ builder.compileVariable(parameter);
+ });
}
if (compiler.tracer.enabled) {
@@ -1092,11 +1070,6 @@
});
if (bodyElement == null) {
bodyElement = new ConstructorBodyElementX(constructor);
- // [:resolveMethodElement:] require the passed element to be a
- // declaration.
- TreeElements treeElements =
- compiler.enqueuer.resolution.getCachedElements(
- constructor.declaration);
classElement.addBackendMember(bodyElement);
if (constructor.isPatch) {
@@ -1105,11 +1078,6 @@
bodyElement.origin.patch = bodyElement;
classElement.origin.addBackendMember(bodyElement.origin);
}
- // Set the [TreeElements] of the generative constructor body to
- // be the same as the generative constructor.
- compiler.enqueuer.resolution.ensureCachedElements(
- bodyElement.declaration,
- treeElements);
}
assert(bodyElement.isGenerativeConstructorBody());
return bodyElement;
@@ -1141,12 +1109,6 @@
List<HInstruction> compiledArguments;
bool isInstanceMember = function.isInstanceMember();
- if (function.isGenerativeConstructor()) {
- // The optimistic field type optimization requires
- // to know all generative constructors seen in codegen.
- backend.registerConstructor(function);
- }
-
if (currentNode == null
|| currentNode.asForIn() != null
|| !isInstanceMember
@@ -2454,7 +2416,7 @@
nestedClosureData.closureClassElement;
FunctionElement callElement = nestedClosureData.callElement;
// TODO(ahe): This should be registered in codegen, not here.
- compiler.enqueuer.codegen.addToWorkList(callElement, elements);
+ compiler.enqueuer.codegen.addToWorkList(callElement);
// TODO(ahe): This should be registered in codegen, not here.
compiler.enqueuer.codegen.registerInstantiatedClass(
closureClassElement, work.resolutionTree);
@@ -3790,14 +3752,6 @@
if (type == null) {
type = new HType.inferredReturnTypeForElement(element, compiler);
- if (type.isUnknown()) {
- // TODO(ngeoffray): Only do this if knowing the return type is
- // useful.
- type =
- builder.backend.optimisticReturnTypesWithRecompilationOnTypeChange(
- currentElement, element);
- if (type == null) type = HType.UNKNOWN;
- }
}
// TODO(5346): Try to avoid the need for calling [declaration] before
// creating an [HInvokeStatic].
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
index cbf3579..2287d54 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart
@@ -303,21 +303,6 @@
allocator.visitGraph(graph);
variableNames = allocator.names;
shouldGroupVarDeclarations = allocator.names.numberOfVariables > 1;
-
- // Don't register a return type for lazily initialized variables.
- if (work.element is! FunctionElement) return;
-
- // Register return types to the backend.
- graph.exit.predecessors.forEach((HBasicBlock block) {
- HInstruction last = block.last;
- assert(last is HGoto || last is HReturn || last is HThrow);
- if (last is HReturn) {
- backend.registerReturnType(
- work.element, last.inputs[0].instructionType);
- } else if (last is HGoto) {
- backend.registerReturnType(work.element, HType.NULL);
- }
- });
}
void handleDelayedVariableDeclarations() {
@@ -1545,10 +1530,19 @@
}
Selector getOptimizedSelectorFor(HInvokeDynamic node, Selector selector) {
+ if (node.element != null) {
+ // Create an artificial type mask to make sure only
+ // [node.element] will be enqueued. We're not using the receiver
+ // type because our optimizations might end up in a state where the
+ // invoke dynamic knows more than the receiver.
+ HType receiverType = new HType.fromMask(
+ new TypeMask.nonNullExact(node.element.getEnclosingClass().rawType),
+ compiler);
+ return receiverType.refine(selector, compiler);
+ }
// If [JSInvocationMirror._invokeOn] has been called, we must not create a
// typed selector based on the receiver type.
- if (node.element == null && // Invocation is not exact.
- backend.compiler.enabledInvokeOn) {
+ if (backend.compiler.enabledInvokeOn) {
return selector.asUntyped;
}
HType receiverType = node.getDartReceiver(compiler).instructionType;
@@ -1563,8 +1557,6 @@
void registerMethodInvoke(HInvokeDynamic node) {
Selector selector = getOptimizedSelectorFor(node, node.selector);
- // Register this invocation to collect the types used at all call sites.
- backend.registerDynamicInvocation(node, selector);
// If we don't know what we're calling or if we are calling a getter,
// we need to register that fact that we may be calling a closure
@@ -1595,7 +1587,6 @@
HType valueType = node.isInterceptedCall
? node.inputs[2].instructionType
: node.inputs[1].instructionType;
- backend.addedDynamicSetter(selector, valueType);
registerInvoke(node, selector);
}
@@ -1632,10 +1623,6 @@
}
visitInvokeStatic(HInvokeStatic node) {
- if (node.typeCode() == HInstruction.INVOKE_STATIC_TYPECODE) {
- // Register this invocation to collect the types used at all call sites.
- backend.registerStaticInvocation(node);
- }
Element element = node.element;
world.registerStaticUse(element);
ClassElement cls = element.getEnclosingClass();
@@ -1674,8 +1661,6 @@
new js.PropertyAccess.field(prototype, methodName);
push(jsPropertyCall(
method, "call", visitArguments(node.inputs, start: 0)), node);
- // Register this invocation to collect the types used at all call sites.
- backend.registerDynamicInvocation(node, node.selector);
}
}
@@ -1696,16 +1681,8 @@
visitFieldSet(HFieldSet node) {
Element element = node.element;
+ world.registerFieldSetter(element);
String name = _fieldPropertyName(element);
- if (!node.receiver.instructionType.isUnknown()) {
- // Field setters in the generative constructor body are handled in a
- // step "SsaConstructionFieldTypes" in the ssa optimizer.
- if (!work.element.isGenerativeConstructorBody()) {
- world.registerFieldSetter(element);
- backend.registerFieldSetter(
- work.element, element, node.value.instructionType);
- }
- }
use(node.receiver);
js.Expression receiver = pop();
use(node.value);
@@ -2020,7 +1997,6 @@
void visitStatic(HStatic node) {
Element element = node.element;
if (element.isFunction()) {
- backend.registerNonCallStaticUse(node);
world.registerInstantiatedClass(
compiler.functionClass, work.resolutionTree);
push(new js.VariableUse(
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
index a0a6005..68d1455 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
@@ -59,9 +59,6 @@
new SsaSimplifyInterceptors(compiler, constantSystem, work),
new SsaDeadCodeEliminator()];
runPhases(graph, phases);
- if (!speculative) {
- runPhase(graph, new SsaConstructionFieldTypes(backend, work));
- }
});
}
@@ -693,17 +690,8 @@
native.NativeBehavior.ofFieldLoad(field, compiler),
compiler);
} else {
- HType type = new HType.inferredTypeForElement(field, compiler);
- if (type.isUnknown()) {
- type = backend.optimisticFieldType(field);
- if (type != null) {
- backend.registerFieldTypesOptimization(
- work.element, field, result.instructionType);
- }
- }
- if (type != null) {
- result.instructionType = type;
- }
+ result.instructionType =
+ new HType.inferredTypeForElement(field, compiler);
}
return result;
}
@@ -1347,150 +1335,3 @@
}
}
}
-
-
-// Analyze the constructors to see if some fields will always have a specific
-// type after construction. If this is the case we can ignore the type given
-// by the field initializer. This is especially useful when the field
-// initializer is initializing the field to null.
-class SsaConstructionFieldTypes
- extends HBaseVisitor implements OptimizationPhase {
- final JavaScriptBackend backend;
- final CodegenWorkItem work;
- final String name = "SsaConstructionFieldTypes";
- final Set<HInstruction> thisUsers;
- final Set<Element> allSetters;
- final Map<HBasicBlock, Map<Element, HType>> blockFieldSetters;
- bool thisExposed = false;
- HGraph currentGraph;
- Map<Element, HType> currentFieldSetters;
-
- SsaConstructionFieldTypes(this.backend, this.work)
- : thisUsers = new Set<HInstruction>(),
- allSetters = new Set<Element>(),
- blockFieldSetters = new Map<HBasicBlock, Map<Element, HType>>();
-
- void visitGraph(HGraph graph) {
- currentGraph = graph;
- if (!work.element.isGenerativeConstructorBody() &&
- !work.element.isGenerativeConstructor()) return;
- visitDominatorTree(graph);
- if (work.element.isGenerativeConstructor()) {
- backend.registerConstructor(work.element);
- }
- }
-
- visitBasicBlock(HBasicBlock block) {
- if (block.predecessors.length == 0) {
- // Create a new empty map for the first block.
- currentFieldSetters = new Map<Element, HType>();
- } else {
- // Build a map which intersects the fields from all predecessors. For
- // each field in this intersection it unions the types.
- currentFieldSetters =
- new Map.from(blockFieldSetters[block.predecessors[0]]);
- // Loop headers are the only nodes with back edges.
- if (!block.isLoopHeader()) {
- for (int i = 1; i < block.predecessors.length; i++) {
- Map<Element, HType> predecessorsFieldSetters =
- blockFieldSetters[block.predecessors[i]];
- Map<Element, HType> newFieldSetters = new Map<Element, HType>();
- predecessorsFieldSetters.forEach((Element element, HType type) {
- HType currentType = currentFieldSetters[element];
- if (currentType != null) {
- newFieldSetters[element] =
- currentType.union(type, backend.compiler);
- }
- });
- currentFieldSetters = newFieldSetters;
- }
- } else {
- assert(block.predecessors.length <= 2);
- }
- }
- block.forEachPhi((HPhi phi) => phi.accept(this));
- block.forEachInstruction(
- (HInstruction instruction) => instruction.accept(this));
- assert(currentFieldSetters != null);
- blockFieldSetters[block] = currentFieldSetters;
- }
-
- visitInstruction(HInstruction instruction) {
- // All instructions not explicitly handled below will flag the this
- // exposure if using this.
- thisExposed = thisExposed || thisUsers.contains(instruction);
- }
-
- visitPhi(HPhi phi) {
- if (thisUsers.contains(phi)) {
- thisUsers.addAll(phi.usedBy);
- }
- }
-
- visitThis(HThis instruction) {
- // Collect all users of this in a set to make the this exposed check simple
- // and cheap.
- thisUsers.addAll(instruction.usedBy);
- }
-
- visitFieldGet(HInstruction _) {
- // The field get instruction is allowed to use this.
- }
-
- visitForeignNew(HForeignNew node) {
- if (!work.element.isGenerativeConstructor()) return;
- // Check if this is the new object allocated by this generative
- // constructor. Inlining might add other [HForeignNew]
- // instructions in the graph.
- if (!node.usedBy.any((user) => user is HReturn)) return;
- // The HForeignNew instruction is used in the generative constructor to
- // initialize all fields in newly created objects. The fields are
- // initialized to the value present in the initializer list or set to null
- // if not otherwise initialized.
- // Here we handle members in superclasses as well, as the handling of
- // the generative constructor bodies will ensure, that the initializer
- // type will not be used if the field is in any of these.
- int j = 0;
- node.element.forEachInstanceField(
- (ClassElement enclosingClass, Element element) {
- backend.registerFieldInitializer(
- element, node.inputs[j].instructionType);
- j++;
- },
- includeSuperAndInjectedMembers: true);
- }
-
- visitFieldSet(HFieldSet node) {
- Element field = node.element;
- HInstruction value = node.value;
- HType type = value.instructionType;
- // [HFieldSet] is also used for variables in try/catch.
- if (field.isField()) allSetters.add(field);
- // Don't handle fields defined in superclasses. Given that the field is
- // always added to the [allSetters] set, setting a field defined in a
- // superclass will get an inferred type of UNKNOWN.
- if (work.element.getEnclosingClass() == field.getEnclosingClass()) {
- currentFieldSetters[field] = type;
- }
- }
-
- visitExit(HExit node) {
- // If this has been exposed then we cannot say anything about types after
- // construction.
- if (!thisExposed) {
- // Register the known field types.
- currentFieldSetters.forEach((Element element, HType type) {
- if (type.isUnknown()) return;
- backend.registerFieldConstructor(element, type);
- allSetters.remove(element);
- });
- }
-
- // For other fields having setters in the generative constructor body, set
- // the type to UNKNOWN to avoid relying on the type set in the initializer
- // list.
- allSetters.forEach((Element element) {
- backend.registerFieldConstructor(element, HType.UNKNOWN);
- });
- }
-}
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart b/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
index 5227623..6eed301 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/types_propagation.dart
@@ -327,6 +327,10 @@
}
return desiredType;
}
+
+ bool hasBeenSpeculativelyOptimized(HInstruction instruction) {
+ return savedTypes.containsKey(instruction);
+ }
HType computeType(HInstruction instruction) {
// Once we are in a conflicting state don't update the type anymore.
@@ -334,7 +338,7 @@
if (oldType.isConflicting()) return oldType;
HType newType = super.computeType(instruction);
- if (oldType != newType && !savedTypes.containsKey(instruction)) {
+ if (oldType != newType && !hasBeenSpeculativelyOptimized(instruction)) {
savedTypes[instruction] = oldType;
}
// [computeDesiredType] goes to all usedBys and lets them compute their
@@ -344,11 +348,16 @@
HType desiredType = computeDesiredType(instruction);
// If the desired type is conflicting just return the computed type.
if (desiredType.isConflicting()) return newType;
+ if (desiredType.isUnknown() && hasBeenSpeculativelyOptimized(instruction)) {
+ // If we ever change our decision for a desired type to unknown,
+ // we stop the computation on this instruction.
+ return HType.CONFLICTING;
+ }
// TODO(ngeoffray): Allow speculative optimizations on
// non-primitive types?
if (!desiredType.isPrimitive()) return newType;
desiredType = newType.intersection(desiredType, compiler);
- if (desiredType != newType && !savedTypes.containsKey(instruction)) {
+ if (desiredType != newType && !hasBeenSpeculativelyOptimized(instruction)) {
savedTypes[instruction] = oldType;
}
return desiredType;
diff --git a/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart b/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
index 9a21b45..a75f930 100644
--- a/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
@@ -342,6 +342,7 @@
buildWorkQueue();
int analyzed = 0;
compiler.progress.reset();
+ int maxReanalysis = (numberOfElementsToAnalyze * 1.5).toInt();
do {
if (compiler.progress.elapsedMilliseconds > 500) {
compiler.log('Inferred $analyzed methods.');
@@ -353,7 +354,7 @@
bool wasAnalyzed = analyzeCount.containsKey(element);
if (wasAnalyzed) {
recompiles++;
- if (recompiles >= numberOfElementsToAnalyze) {
+ if (recompiles >= maxReanalysis) {
compiler.log('Ran out of budget for inferring.');
break;
}
@@ -1170,7 +1171,9 @@
if (constraint.isOperator()) {
// If the constraint is on an operator, we type the receiver
// to be the field.
- constraint = new TypedSelector(fieldType, constraint);
+ if (fieldType != null) {
+ constraint = new TypedSelector(fieldType, constraint);
+ }
} else {
// Otherwise the constraint is on the form [: field = other.field :].
assert(constraint.isGetter());
diff --git a/sdk/lib/_internal/compiler/implementation/universe/universe.dart b/sdk/lib/_internal/compiler/implementation/universe/universe.dart
index 8ee58d2b..ae3b54b 100644
--- a/sdk/lib/_internal/compiler/implementation/universe/universe.dart
+++ b/sdk/lib/_internal/compiler/implementation/universe/universe.dart
@@ -116,79 +116,93 @@
final int argumentCount;
final List<SourceString> namedArguments;
final List<SourceString> orderedNamedArguments;
+ final int hashCode;
- int cachedHashCode;
+ static const SourceString INDEX_NAME = const SourceString("[]");
+ static const SourceString INDEX_SET_NAME = const SourceString("[]=");
+ static const SourceString CALL_NAME = Compiler.CALL_OPERATOR_NAME;
- Selector(
- this.kind,
- SourceString name,
- LibraryElement library,
- this.argumentCount,
- [List<SourceString> namedArguments = const <SourceString>[]])
- : this.name = name,
- this.library = name.isPrivate() ? library : null,
- this.namedArguments = namedArguments,
- this.orderedNamedArguments = namedArguments.isEmpty
- ? namedArguments
- : <SourceString>[] {
+ Selector.internal(this.kind,
+ this.name,
+ this.library,
+ this.argumentCount,
+ this.namedArguments,
+ this.orderedNamedArguments,
+ this.hashCode) {
assert(!name.isPrivate() || library != null);
}
- Selector.getter(SourceString name, LibraryElement library)
- : this(SelectorKind.GETTER, name, library, 0);
+ factory Selector(SelectorKind kind,
+ SourceString name,
+ LibraryElement library,
+ int argumentCount,
+ [List<SourceString> namedArguments]) {
+ if (!name.isPrivate()) library = null;
+ List<SourceString> orderedNamedArguments = const <SourceString>[];
+ if (namedArguments == null) {
+ namedArguments = const <SourceString>[];
+ } else if (!namedArguments.isEmpty) {
+ orderedNamedArguments = <SourceString>[];
+ }
+ int hashCode = computeHashCode(
+ kind, name, library, argumentCount, namedArguments);
+ return new Selector.internal(
+ kind, name, library, argumentCount,
+ namedArguments, orderedNamedArguments,
+ hashCode);
+ }
- Selector.getterFrom(Selector selector)
- : this(SelectorKind.GETTER, selector.name, selector.library, 0);
+ factory Selector.getter(SourceString name, LibraryElement library)
+ => new Selector(SelectorKind.GETTER, name, library, 0);
- Selector.setter(SourceString name, LibraryElement library)
- : this(SelectorKind.SETTER, name, library, 1);
+ factory Selector.getterFrom(Selector selector)
+ => new Selector(SelectorKind.GETTER, selector.name, selector.library, 0);
- Selector.unaryOperator(SourceString name)
- : this(SelectorKind.OPERATOR,
- Elements.constructOperatorName(name, true),
- null, 0);
+ factory Selector.setter(SourceString name, LibraryElement library)
+ => new Selector(SelectorKind.SETTER, name, library, 1);
- Selector.binaryOperator(SourceString name)
- : this(SelectorKind.OPERATOR,
- Elements.constructOperatorName(name, false),
- null, 1);
+ factory Selector.unaryOperator(SourceString name)
+ => new Selector(SelectorKind.OPERATOR,
+ Elements.constructOperatorName(name, true),
+ null, 0);
- Selector.index()
- : this(SelectorKind.INDEX,
- Elements.constructOperatorName(const SourceString("[]"), false),
- null, 1);
+ factory Selector.binaryOperator(SourceString name)
+ => new Selector(SelectorKind.OPERATOR,
+ Elements.constructOperatorName(name, false),
+ null, 1);
- Selector.indexSet()
- : this(SelectorKind.INDEX,
- Elements.constructOperatorName(const SourceString("[]="), false),
- null, 2);
+ factory Selector.index()
+ => new Selector(SelectorKind.INDEX,
+ Elements.constructOperatorName(INDEX_NAME, false),
+ null, 1);
- Selector.call(SourceString name,
- LibraryElement library,
- int arity,
- [List<SourceString> named = const []])
- : this(SelectorKind.CALL, name, library, arity, named);
+ factory Selector.indexSet()
+ => new Selector(SelectorKind.INDEX,
+ Elements.constructOperatorName(INDEX_SET_NAME, false),
+ null, 2);
- Selector.callClosure(int arity, [List<SourceString> named = const []])
- : this(SelectorKind.CALL, Compiler.CALL_OPERATOR_NAME, null,
- arity, named);
+ factory Selector.call(SourceString name,
+ LibraryElement library,
+ int arity,
+ [List<SourceString> namedArguments])
+ => new Selector(SelectorKind.CALL, name, library, arity, namedArguments);
- Selector.callClosureFrom(Selector selector)
- : this(SelectorKind.CALL, Compiler.CALL_OPERATOR_NAME, null,
- selector.argumentCount, selector.namedArguments);
+ factory Selector.callClosure(int arity, [List<SourceString> namedArguments])
+ => new Selector(SelectorKind.CALL, CALL_NAME, null,
+ arity, namedArguments);
- Selector.callConstructor(SourceString constructorName,
- LibraryElement library,
- [int arity = 0,
- List<SourceString> named = const []])
- : this(SelectorKind.CALL,
- constructorName,
- library,
- arity,
- named);
+ factory Selector.callClosureFrom(Selector selector)
+ => new Selector(SelectorKind.CALL, CALL_NAME, null,
+ selector.argumentCount, selector.namedArguments);
- Selector.callDefaultConstructor(LibraryElement library)
- : this(SelectorKind.CALL, const SourceString(""), library, 0, const []);
+ factory Selector.callConstructor(SourceString name, LibraryElement library,
+ [int arity = 0,
+ List<SourceString> namedArguments])
+ => new Selector(SelectorKind.CALL, name, library,
+ arity, namedArguments);
+
+ factory Selector.callDefaultConstructor(LibraryElement library)
+ => new Selector(SelectorKind.CALL, const SourceString(""), library, 0);
bool isGetter() => identical(kind, SelectorKind.GETTER);
bool isSetter() => identical(kind, SelectorKind.SETTER);
@@ -369,26 +383,23 @@
bool operator ==(other) {
if (other is !Selector) return false;
if (identical(this, other)) return true;
- return mask == other.mask && equalsUntyped(other);
- }
-
- bool equalsUntyped(Selector other) {
return hashCode == other.hashCode // Fast because it is cached.
- && name == other.name
- && kind == other.kind
- && identical(library, other.library)
- && argumentCount == other.argumentCount
- && namedArguments.length == other.namedArguments.length
- && sameNames(namedArguments, other.namedArguments);
+ && kind == other.kind
+ && name == other.name
+ && mask == other.mask
+ && identical(library, other.library)
+ && argumentCount == other.argumentCount
+ && namedArguments.length == other.namedArguments.length
+ && sameNames(namedArguments, other.namedArguments);
}
- int get hashCode {
- // Check the hash code cache first.
- if (cachedHashCode != null) return cachedHashCode;
+ static int computeHashCode(SelectorKind kind,
+ SourceString name,
+ LibraryElement library,
+ int argumentCount,
+ List<SourceString> namedArguments) {
// Add bits from name and kind.
int hash = mixHashCodeBits(name.hashCode, kind.hashCode);
- // Add bits from the type mask.
- if (mask != null) hash = mixHashCodeBits(hash, mask.hashCode);
// Add bits from the library.
if (library != null) hash = mixHashCodeBits(hash, library.hashCode);
// Add bits from the unnamed arguments.
@@ -399,7 +410,7 @@
for (int i = 0; i < named; i++) {
hash = mixHashCodeBits(hash, namedArguments[i].hashCode);
}
- return cachedHashCode = hash;
+ return hash;
}
// TODO(kasperl): Move this out so it becomes useful in other places too?
@@ -456,25 +467,33 @@
final Selector asUntyped;
final TypeMask mask;
- TypedSelector(this.mask, Selector selector)
- : asUntyped = selector.asUntyped,
- super(selector.kind,
- selector.name,
- selector.library,
- selector.argumentCount,
- selector.namedArguments) {
+ TypedSelector.internal(this.mask, Selector selector, int hashCode)
+ : asUntyped = selector,
+ super.internal(selector.kind,
+ selector.name,
+ selector.library,
+ selector.argumentCount,
+ selector.namedArguments,
+ selector.orderedNamedArguments,
+ hashCode) {
+ assert(mask != null);
assert(asUntyped.mask == null);
}
- TypedSelector.exact(DartType base, Selector selector)
- : this(new TypeMask.exact(base), selector);
+ factory TypedSelector(TypeMask mask, Selector selector) {
+ Selector untyped = selector.asUntyped;
+ int hashCode = Selector.mixHashCodeBits(untyped.hashCode, mask.hashCode);
+ return new TypedSelector.internal(mask, untyped, hashCode);
+ }
- TypedSelector.subclass(DartType base, Selector selector)
- : this(new TypeMask.subclass(base), selector);
+ factory TypedSelector.exact(DartType base, Selector selector)
+ => new TypedSelector(new TypeMask.exact(base), selector);
- TypedSelector.subtype(DartType base, Selector selector)
- : this(new TypeMask.subtype(base), selector);
+ factory TypedSelector.subclass(DartType base, Selector selector)
+ => new TypedSelector(new TypeMask.subclass(base), selector);
+ factory TypedSelector.subtype(DartType base, Selector selector)
+ => new TypedSelector(new TypeMask.subtype(base), selector);
bool appliesUnnamed(Element element, Compiler compiler) {
assert(sameNameHack(element, compiler));
diff --git a/sdk/lib/_internal/compiler/samples/leap/leap_server.dart b/sdk/lib/_internal/compiler/samples/leap/leap_server.dart
index fd46a37..31aaa55 100644
--- a/sdk/lib/_internal/compiler/samples/leap/leap_server.dart
+++ b/sdk/lib/_internal/compiler/samples/leap/leap_server.dart
@@ -71,7 +71,7 @@
}
static onError(error) {
- if (error is HttpParserException) {
+ if (error is HttpException) {
print('Error: ${error.message}');
} else {
print('Error: ${error}');
diff --git a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
index ed1e8a6..7d5eba0 100644
--- a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
@@ -87,7 +87,7 @@
// due to invalid result from dir.existsSync() (probably due to race
// conditions).
outputDir.createSync();
- } on DirectoryIOException catch (e) {
+ } on DirectoryException catch (e) {
// Ignore.
}
}
@@ -140,7 +140,8 @@
new Path(dartPath), libPath,
options: const <String>['--categories=Client,Server', '--minify'])
.then((jsCode) {
- if (jsCode != null) writeString(new File(jsPath), jsCode);
+ if (jsCode == null) throw new StateError("No javascript was generated.");
+ writeString(new File(jsPath), jsCode);
});
}
@@ -601,7 +602,7 @@
// race conditions).
try {
dir.createSync();
- } on DirectoryIOException catch (e) {
+ } on DirectoryException catch (e) {
// Ignore.
}
}
@@ -778,9 +779,10 @@
/// Gets the path to the dartdoc directory normalized for running in different
/// places.
- String get normalizedDartdocPath => runningFromSdk ?
- pathos.join(sdkDir, 'lib', '_internal', 'dartdoc') :
- dartdocPath.toString();
+ String get normalizedDartdocPath => pathos.normalize(
+ pathos.absolute(runningFromSdk ?
+ pathos.join(sdkDir, 'lib', '_internal', 'dartdoc') :
+ dartdocPath.toString()));
void docNavigationDart() {
var tmpDir = new Directory(tmpPath);
@@ -791,20 +793,15 @@
String dartString = jsonString.replaceAll(r"$", r"\$");
var filePath = pathos.join(tmpPath, 'client.dart');
- var fileBuilder = new pathos.Builder(style: pathos.Style.url);
-
- var clientDir = fileBuilder.join(
- 'file:///',
- fileBuilder.relative(
- fileBuilder.join(normalizedDartdocPath, 'lib', 'src', 'client'),
- from: tmpPath));
+ var clientDir = pathos.join(normalizedDartdocPath,'lib', 'src', 'client');
writeString(new File(filePath),
'''library client;
import 'dart:html';
import 'dart:json';
- import '${fileBuilder.join(clientDir, 'client-shared.dart')}';
- import '${fileBuilder.join(clientDir, 'dropdown.dart')}';
+ import r'${pathToFileUri(
+ pathos.join(clientDir, 'client-shared.dart'))}';
+ import r'${pathToFileUri(pathos.join(clientDir, 'dropdown.dart'))}';
main() {
setup();
diff --git a/sdk/lib/_internal/dartdoc/lib/src/export_map.dart b/sdk/lib/_internal/dartdoc/lib/src/export_map.dart
index 0173009..28d8503 100644
--- a/sdk/lib/_internal/dartdoc/lib/src/export_map.dart
+++ b/sdk/lib/_internal/dartdoc/lib/src/export_map.dart
@@ -46,7 +46,7 @@
var importsAndExports;
try {
importsAndExports = _importsAndExportsForFile(path, packageRoot);
- } on FileIOException catch (_) {
+ } on FileException catch (_) {
// Ignore unreadable/nonexistent files.
return;
}
diff --git a/sdk/lib/_internal/docgen/docgen.dart b/sdk/lib/_internal/docgen/docgen.dart
new file mode 100644
index 0000000..b245bf5
--- /dev/null
+++ b/sdk/lib/_internal/docgen/docgen.dart
@@ -0,0 +1,177 @@
+/**
+ * The docgen tool takes in a library as input and produces documentation
+ * for the library as well as all libraries it imports and uses. The tool can
+ * be run by passing in the path to a .dart file like this:
+ *
+ * ./dart docgen.dart path/to/file.dart
+ *
+ * This outputs information about all classes, variables, functions, and
+ * methods defined in the library and its imported libraries.
+ */
+library docgen;
+
+import 'dart:io';
+import 'dart:async';
+import 'lib/src/dart2js_mirrors.dart';
+import 'lib/dart2yaml.dart';
+import '../../../../pkg/args/lib/args.dart';
+import '../compiler/implementation/mirrors/mirrors.dart';
+import '../compiler/implementation/mirrors/mirrors_util.dart';
+
+/**
+ * Entry function to create YAML documentation from Dart files.
+ */
+void main() {
+ // TODO(tmandel): Use args library once flags are clear.
+ Options opts = new Options();
+
+ if (opts.arguments.length > 0) {
+ List<Path> libraries = [new Path(opts.arguments[0])];
+ Path sdkDirectory = new Path("../../../");
+ var workingMirrors = analyze(libraries, sdkDirectory,
+ options: ['--preserve-comments', '--categories=Client,Server']);
+ workingMirrors.then( (MirrorSystem mirrorSystem) {
+ var mirrors = mirrorSystem.libraries;
+ if (mirrors.isEmpty) {
+ print("no LibraryMirrors");
+ } else {
+ mirrors.values.forEach( (library) {
+ // TODO(tmandel): Use flags to filter libraries.
+ if (library.uri.scheme != "dart") {
+ String result = _getDocumentation(library);
+ if (result != null) {
+ _writeToFile(result, "${library.qualifiedName}.yaml");
+ }
+ }
+ });
+ }
+ });
+ }
+}
+
+/**
+ * Creates YAML output from relevant libraries.
+ */
+//TODO(tmandel): Also allow for output to JSON based on flags
+String _getDocumentation(LibraryMirror library) {
+ Map libMap = new Map();
+ String libraryName = library.qualifiedName;
+
+ // Get library top-level information.
+ libMap[libraryName] = new Map();
+
+ libMap[libraryName]["variables"] = new Map();
+ _getVariables(libMap[libraryName]["variables"], library.variables);
+
+ libMap[libraryName]["functions"] = new Map();
+ _getMethods(libMap[libraryName]["functions"], library.functions);
+
+ String comment = _getComment(library);
+ libMap[libraryName]["comment"] = comment != null ? comment.trim() : null;
+
+ // Get specific information about each class.
+ Map classes = new Map();
+ library.classes.forEach( (String cName, ClassMirror mir) {
+
+ classes[cName] = new Map();
+ _getMethods(classes[cName], mir.methods);
+
+ classes[cName]["variables"] = new Map();
+ _getVariables(classes[cName]["variables"], mir.variables);
+
+ classes[cName]["superclass"] = mir.superclass;
+ classes[cName]["interfaces"] = mir.superinterfaces;
+ classes[cName]["abstract"] = mir.isAbstract;
+
+ String comment = _getComment(mir);
+ classes[cName]["comment"] = comment != null ? comment.trim() : null;
+
+ });
+ libMap[libraryName]["classes"] = classes;
+ return getYamlString(libMap);
+}
+
+/**
+ * Returns any documentation comments associated with a mirror.
+ */
+// TODO(tmandel): Handle reference links in comments.
+String _getComment(DeclarationMirror mirror) {
+ String commentText;
+ mirror.metadata.forEach( (metadata) {
+ if (metadata is CommentInstanceMirror) {
+ CommentInstanceMirror comment = metadata;
+ if (comment.isDocComment) {
+ if (commentText == null) {
+ commentText = comment.trimmedText;
+ } else {
+ commentText = "$commentText ${comment.trimmedText}";
+ }
+ }
+ }
+ });
+ return commentText;
+}
+
+/**
+ * Populates an input Map with characteristics of variables.
+ */
+void _getVariables(Map data, Map<String, VariableMirror> mirrorMap) {
+ mirrorMap.forEach( (String name, VariableMirror mirror) {
+ data[name] = new Map();
+ data[name]["final"] = mirror.isFinal.toString();
+ data[name]["static"] = mirror.isStatic.toString();
+ data[name]["type"] = mirror.type.toString();
+
+ String comment = _getComment(mirror);
+ data[name]["comment"] = comment != null ? comment.trim() : null;
+ });
+}
+
+/**
+ * Populates an input Map with characteristics of methods.
+ */
+void _getMethods(Map data, Map<String, MethodMirror> mirrorMap) {
+ mirrorMap.forEach( (String mirrorName, MethodMirror mirror) {
+ String category = mirror.isSetter ? "setters" :
+ mirror.isGetter ? "getters" :
+ mirror.isConstructor ? "constructors" :
+ mirror.isTopLevel ? "functions" : "methods";
+
+ if (data[category] == null) {
+ data[category] = new Map();
+ }
+ data[category][mirrorName] = new Map();
+ data[category][mirrorName]["operator"] = mirror.isOperator;
+ data[category][mirrorName]["static"] = mirror.isStatic;
+ data[category][mirrorName]["rtype"] = mirror.returnType;
+ data[category][mirrorName]["parameters"] = new Map();
+ List parameters = mirror.parameters;
+ parameters.forEach( (ParameterMirror param) {
+ String pName = param.simpleName;
+ data[category][mirrorName]
+ ["parameters"][pName] = new Map();
+ data[category][mirrorName]
+ ["parameters"][pName]["optional"] = param.isOptional;
+ data[category][mirrorName]
+ ["parameters"][pName]["default"] = param.defaultValue;
+ data[category][mirrorName]
+ ["parameters"][pName]["type"] = param.type.toString();
+ });
+ String comment = _getComment(mirror);
+ data[category][mirrorName]["comment"] =
+ comment != null ? comment.trim() : null;
+ });
+}
+
+/**
+ * Writes documentation for a library to a file.
+ */
+//TODO(tmandel): Use flags to put files in specific directory if supported.
+void _writeToFile(String text, String filename) {
+ File file = new File(filename);
+ if (!file.exists()) {
+ file.createSync();
+ }
+ file.openSync();
+ file.writeAsString(text);
+}
\ No newline at end of file
diff --git a/sdk/lib/_internal/docgen/examples/test.dart b/sdk/lib/_internal/docgen/examples/test.dart
new file mode 100755
index 0000000..026663e
--- /dev/null
+++ b/sdk/lib/_internal/docgen/examples/test.dart
@@ -0,0 +1,52 @@
+/**
+ * This library is used solely for testing during development and is not
+ * intended to be run by the testing machines.
+ */
+// TODO(tmandel): Remove this file once docgen is ready for more clear tests.
+library DummyLibrary;
+
+import 'dart:json';
+
+/// Doc comment for top-level variable.
+int _variable1 = 0;
+
+void set variable1(int abc) => _variable1 = abc;
+
+abstract class B {
+
+}
+
+/**
+ * Doc comment for class A.
+ */
+/*
+ * Normal comment for class A.
+ */
+class A implements B {
+
+ int _someNumber;
+
+ A() {
+ _someNumber = 12;
+ }
+
+ int get someNumber => _someNumber;
+
+ void doThis(int a) {
+ print(a);
+ }
+
+ int multi(int a) {
+ return a * _someNumber;
+ }
+
+}
+
+main() {
+ A a = new A();
+ print(a.someNumber);
+}
+
+A getA(int testInt, [String testString="default"]) {
+ return new A();
+}
\ No newline at end of file
diff --git a/sdk/lib/_internal/docgen/lib/dart2yaml.dart b/sdk/lib/_internal/docgen/lib/dart2yaml.dart
new file mode 100644
index 0000000..a8be283
--- /dev/null
+++ b/sdk/lib/_internal/docgen/lib/dart2yaml.dart
@@ -0,0 +1,66 @@
+/**
+ * This library is used to convert data from a map to a YAML string.
+ */
+library dart2yaml;
+
+/**
+ * Gets a String representing the input Map in YAML format.
+ */
+String getYamlString(Map documentData) {
+ StringBuffer yaml = new StringBuffer();
+ _addLevel(yaml, documentData, 0);
+ return yaml.toString();
+}
+
+/**
+ * This recursive function adds to its input StringBuffer and builds
+ * a YAML string from the input Map.
+ */
+// TODO(tmandel): Fix quotes with String objects.
+void _addLevel(StringBuffer yaml, Map documentData, int level) {
+ documentData.keys.forEach( (key) {
+ _calcSpaces(level, yaml);
+ yaml.write("\"$key\" : ");
+
+ if (documentData[key] is Map) {
+ yaml.write("\n");
+ _addLevel(yaml, documentData[key], level + 1);
+
+ } else if (documentData[key] is List) {
+ var elements = documentData[key];
+ yaml.write("\n");
+ elements.forEach( (element) {
+ if (element is Map) {
+ _addLevel(yaml, element, level + 1);
+ } else {
+ _calcSpaces(level + 1, yaml);
+ yaml.write("- ${_processElement(element)}");
+ }
+ });
+
+ } else {
+ yaml.write(_processElement(documentData[key]));
+ }
+ });
+}
+
+/**
+ * Writes to a StringBuffer the correct output for the inputted element.
+ */
+String _processElement(var element) {
+ if (element.toString().contains("\"")) {
+ return "$element\n";
+ } else {
+ return "\"$element\"\n";
+ }
+}
+
+/**
+ * Based on the depth in the file, this function returns the correct spacing
+ * for an element in the YAML output.
+ */
+void _calcSpaces(int spaceLevel, StringBuffer yaml) {
+ for (int i = 0; i < spaceLevel; i++) {
+ yaml.write(" ");
+ }
+}
\ No newline at end of file
diff --git a/sdk/lib/_internal/docgen/lib/src/dart2js_mirrors.dart b/sdk/lib/_internal/docgen/lib/src/dart2js_mirrors.dart
new file mode 100644
index 0000000..1885363
--- /dev/null
+++ b/sdk/lib/_internal/docgen/lib/src/dart2js_mirrors.dart
@@ -0,0 +1,77 @@
+// 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.
+
+library dart2js_util;
+
+// TODO(tmandel): This is a temporary copy of the dart2js_mirrors.dart
+// file in the dartdoc folder. One of the two should be deleted
+// when docgen can replace dartdoc.
+
+import 'dart:async' show Future;
+import 'dart:io' show Path;
+
+import '../../../compiler/compiler.dart' as api;
+import '../../../compiler/implementation/mirrors/dart2js_mirror.dart' as dart2js
+ show analyze, Dart2JsMirrorSystem;
+import '../../../compiler/implementation/mirrors/mirrors.dart'
+ show MirrorSystem;
+import '../../../compiler/implementation/source_file_provider.dart'
+ show FormattingDiagnosticHandler, SourceFileProvider;
+import '../../../compiler/implementation/filenames.dart'
+ show appendSlash, currentDirectory;
+
+// TODO(johnniwinther): Support client configurable providers.
+
+/**
+ * Returns a future that completes to a non-null String when [script]
+ * has been successfully compiled.
+ */
+// TODO(amouravski): Remove this method and call dart2js via a process instead.
+Future<String> compile(Path script,
+ Path libraryRoot,
+ {Path packageRoot,
+ List<String> options: const <String>[],
+ api.DiagnosticHandler diagnosticHandler}) {
+ SourceFileProvider provider = new SourceFileProvider();
+ if (diagnosticHandler == null) {
+ diagnosticHandler =
+ new FormattingDiagnosticHandler(provider).diagnosticHandler;
+ }
+ Uri scriptUri = currentDirectory.resolve(script.toString());
+ Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
+ Uri packageUri = null;
+ if (packageRoot != null) {
+ packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
+ }
+ return api.compile(scriptUri, libraryUri, packageUri,
+ provider.readStringFromUri, diagnosticHandler, options);
+}
+
+/**
+ * Analyzes set of libraries and provides a mirror system which can be used for
+ * static inspection of the source code.
+ */
+Future<MirrorSystem> analyze(List<Path> libraries,
+ Path libraryRoot,
+ {Path packageRoot,
+ List<String> options: const <String>[],
+ api.DiagnosticHandler diagnosticHandler}) {
+ SourceFileProvider provider = new SourceFileProvider();
+ if (diagnosticHandler == null) {
+ diagnosticHandler =
+ new FormattingDiagnosticHandler(provider).diagnosticHandler;
+ }
+ Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
+ Uri packageUri = null;
+ if (packageRoot != null) {
+ packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
+ }
+ List<Uri> librariesUri = <Uri>[];
+ for (Path library in libraries) {
+ librariesUri.add(currentDirectory.resolve(library.toString()));
+ }
+ return dart2js.analyze(librariesUri, libraryUri, packageUri,
+ provider.readStringFromUri, diagnosticHandler,
+ options);
+}
diff --git a/sdk/lib/_internal/pub/lib/src/command.dart b/sdk/lib/_internal/pub/lib/src/command.dart
index abc2468..73bf471 100644
--- a/sdk/lib/_internal/pub/lib/src/command.dart
+++ b/sdk/lib/_internal/pub/lib/src/command.dart
@@ -173,8 +173,8 @@
/// Returns the appropriate exit code for [exception], falling back on 1 if no
/// appropriate exit code could be found.
int _chooseExitCode(exception) {
- if (exception is HttpException || exception is HttpParserException ||
- exception is SocketIOException || exception is PubHttpException) {
+ if (exception is HttpException || exception is HttpException ||
+ exception is SocketException || exception is PubHttpException) {
return exit_codes.UNAVAILABLE;
} else if (exception is FormatException) {
return exit_codes.DATA;
diff --git a/sdk/lib/_internal/pub/lib/src/hosted_source.dart b/sdk/lib/_internal/pub/lib/src/hosted_source.dart
index beabfd1..6967aa6 100644
--- a/sdk/lib/_internal/pub/lib/src/hosted_source.dart
+++ b/sdk/lib/_internal/pub/lib/src/hosted_source.dart
@@ -156,7 +156,7 @@
fail('Timed out trying to find package "$package" at $url.');
}
- if (error is io.SocketIOException) {
+ if (error is io.SocketException) {
fail('Got socket error trying to find package "$package" at $url.\n'
'${error.osError}');
}
diff --git a/sdk/lib/_internal/pub/lib/src/http.dart b/sdk/lib/_internal/pub/lib/src/http.dart
index e7da34c..b23dfd0 100644
--- a/sdk/lib/_internal/pub/lib/src/http.dart
+++ b/sdk/lib/_internal/pub/lib/src/http.dart
@@ -86,7 +86,7 @@
throw new PubHttpException(response);
});
}).catchError((error) {
- if (error is SocketIOException &&
+ if (error is SocketException &&
error.osError != null) {
if (error.osError.errorCode == 8 ||
error.osError.errorCode == -2 ||
diff --git a/sdk/lib/_internal/pub/lib/src/io.dart b/sdk/lib/_internal/pub/lib/src/io.dart
index e9d803b..8b6c7fd 100644
--- a/sdk/lib/_internal/pub/lib/src/io.dart
+++ b/sdk/lib/_internal/pub/lib/src/io.dart
@@ -217,7 +217,7 @@
try {
createDir(dirPath);
- } on DirectoryIOException catch (ex) {
+ } on DirectoryException catch (ex) {
// Error 17 means the directory already exists (or 183 on Windows).
if (ex.osError.errorCode == 17 || ex.osError.errorCode == 183) {
log.fine("Got 'already exists' error when creating directory.");
diff --git a/sdk/lib/_internal/pub/lib/src/safe_http_server.dart b/sdk/lib/_internal/pub/lib/src/safe_http_server.dart
index a580770b..0f3b9f1 100644
--- a/sdk/lib/_internal/pub/lib/src/safe_http_server.dart
+++ b/sdk/lib/_internal/pub/lib/src/safe_http_server.dart
@@ -50,9 +50,9 @@
// Ignore socket error 104, which is caused by a request being cancelled
// before it writes any headers. There's no reason to care about such
// requests.
- if (error is SocketIOException && error.osError.errorCode == 104) return;
+ if (error is SocketException && error.osError.errorCode == 104) return;
// Ignore any parsing errors, which come from malformed requests.
- if (error is HttpParserException) return;
+ if (error is HttpException) return;
// Manually handle cancelOnError so the above (ignored) errors don't
// cause unsubscription.
if (cancelOnError) subscription.cancel();
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
index aceec1c..c67ce57 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -298,7 +298,7 @@
/// parameters if a name conflict occurs.
Uri addQueryParameters(Uri url, Map<String, String> parameters) {
var queryMap = queryToMap(url.query);
- mapAddAll(queryMap, parameters);
+ queryMap.addAll(parameters);
return url.resolve("?${mapToQuery(queryMap)}");
}
@@ -342,11 +342,6 @@
return uri;
}
-/// Add all key/value pairs from [source] to [destination], overwriting any
-/// pre-existing values.
-void mapAddAll(Map destination, Map source) =>
- source.forEach((key, value) => destination[key] = value);
-
/// Decodes a URL-encoded string. Unlike [Uri.decodeComponent], this includes
/// replacing `+` with ` `.
String urlDecode(String encoded) =>
@@ -534,14 +529,14 @@
bool isUserFacingException(error) {
return error is ApplicationException ||
// TODO(nweiz): clean up this branch when issue 9955 is fixed.
- error is DirectoryIOException ||
- error is FileIOException ||
+ error is DirectoryException ||
+ error is FileException ||
error is HttpException ||
- error is HttpParserException ||
- error is LinkIOException ||
+ error is HttpException ||
+ error is LinkException ||
error is MimeMultipartException ||
error is OSError ||
error is ProcessException ||
- error is SocketIOException ||
+ error is SocketException ||
error is WebSocketException;
}
diff --git a/sdk/lib/_internal/pub/pub.status b/sdk/lib/_internal/pub/pub.status
index 00fafbc..7d8c4fb 100644
--- a/sdk/lib/_internal/pub/pub.status
+++ b/sdk/lib/_internal/pub/pub.status
@@ -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.
-test/pub_uploader_test: Pass, Fail # Issue 9357
-test/oauth2/with_server_rejected_credentials_authenticates_again_test: Pass, Fail # Issue 9839.
-
# Pub only runs on the VM, so just rule out all compilers.
[ $compiler == dart2js || $compiler == dart2dart ]
*: Skip
diff --git a/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart b/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
index 6457091..f670fe1 100644
--- a/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
+++ b/sdk/lib/_internal/pub/test/oauth2/with_server_rejected_credentials_authenticates_again_test.dart
@@ -41,9 +41,7 @@
// TODO(rnystrom): The confirm line is run together with this one because
// in normal usage, the user will have entered a newline on stdin which
// gets echoed to the terminal. Do something better here?
- expect(pub.nextLine(), completion(equals(
- 'Looks great! Are you ready to upload your package (y/n)? '
- 'Pub needs your authorization to upload packages on your behalf.')));
+ expect(pub.nextLine(), completion(equals('Uploading...')));
pub.kill();
});
}
diff --git a/sdk/lib/_internal/pub/test/pub_uploader_test.dart b/sdk/lib/_internal/pub/test/pub_uploader_test.dart
index 741abf0..b52a5e3 100644
--- a/sdk/lib/_internal/pub/test/pub_uploader_test.dart
+++ b/sdk/lib/_internal/pub/test/pub_uploader_test.dart
@@ -17,15 +17,16 @@
import 'test_pub.dart';
final USAGE_STRING = '''
- Manage uploaders for a package on pub.dartlang.org.
+Manage uploaders for a package on pub.dartlang.org.
- Usage: pub uploader [options] {add/remove} <email>
- --server The package server on which the package is hosted
+Usage: pub uploader [options] {add/remove} <email>
+-h, --help Print usage information for this command.
+ --server The package server on which the package is hosted.
(defaults to "https://pub.dartlang.org")
- --package The package whose uploaders will be modified
+ --package The package whose uploaders will be modified.
(defaults to the current package)
- ''';
+''';
ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) {
var tokenEndpoint = server.url.then((url) =>
diff --git a/sdk/lib/_internal/pub/test/test_pub.dart b/sdk/lib/_internal/pub/test/test_pub.dart
index 0414397..4700896 100644
--- a/sdk/lib/_internal/pub/test/test_pub.dart
+++ b/sdk/lib/_internal/pub/test/test_pub.dart
@@ -675,7 +675,7 @@
};
if (full) {
- mapAddAll(map, {
+ map.addAll({
'downloads': 0,
'created': '2012-09-25T18:38:28.685260',
'libraries': ['$name.dart'],
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 3086f7d..47c51ec 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -86,35 +86,67 @@
}
class _FutureImpl<T> implements Future<T> {
+ // State of the future. The state determines the interpretation of the
+ // [resultOrListeners] field.
+ // TODO(lrn): rename field since it can also contain a chained future.
+
+ /// Initial state, waiting for a result. In this state, the
+ /// [resultOrListeners] field holds a single-linked list of
+ /// [FutureListener] listeners.
static const int _INCOMPLETE = 0;
- static const int _VALUE = 1;
- static const int _ERROR = 2;
- static const int _UNHANDLED_ERROR = 4;
+ /// The future has been chained to another future. The result of that
+ /// other future becomes the result of this future as well.
+ /// In this state, the [resultOrListeners] field holds the future that
+ /// will give the result to this future. Both existing and new listeners are
+ /// forwarded directly to the other future.
+ static const int _CHAINED = 1;
+ /// The future has been chained to another future, but there hasn't been
+ /// any listeners added to this future yet. If it is completed with an
+ /// error, the error will be considered unhandled.
+ static const int _CHAINED_UNLISTENED = 3;
+ /// The future has been completed with a value result.
+ static const int _VALUE = 4;
+ /// The future has been completed with an error result.
+ static const int _ERROR = 6;
+ /// Extra bit set when the future has been completed with an error result.
+ /// but no listener has been scheduled to receive the error.
+ /// If the bit is still set when a [runAsync] call triggers, the error will
+ /// be reported to the top-level handler.
+ /// Assigning a listener before that time will clear the bit.
+ static const int _UNHANDLED_ERROR = 8;
/** Whether the future is complete, and as what. */
int _state = _INCOMPLETE;
- bool get _isComplete => _state != _INCOMPLETE;
+ bool get _isChained => (_state & _CHAINED) != 0;
+ bool get _hasChainedListener => _state == _CHAINED;
+ bool get _isComplete => _state >= _VALUE;
bool get _hasValue => _state == _VALUE;
- bool get _hasError => (_state & _ERROR) != 0;
- bool get _hasUnhandledError => (_state & _UNHANDLED_ERROR) != 0;
+ bool get _hasError => _state >= _ERROR;
+ bool get _hasUnhandledError => _state >= _UNHANDLED_ERROR;
void _clearUnhandledError() {
- // Works because _UNHANDLED_ERROR is highest bit in use.
_state &= ~_UNHANDLED_ERROR;
}
/**
- * Either the result, or a list of listeners until the future completes.
+ * Either the result, a list of listeners or another future.
*
* The result of the future is either a value or an error.
* A result is only stored when the future has completed.
*
* The listeners is an internally linked list of [_FutureListener]s.
- * Listeners are only remembered while the future is not yet complete.
+ * Listeners are only remembered while the future is not yet complete,
+ * and it is not chained to another future.
*
- * Since the result and the listeners cannot occur at the same time,
- * we can use the same field for both.
+ * The future is another future that his future is chained to. This future
+ * is waiting for the other future to complete, and when it does, this future
+ * will complete with the same result.
+ * All listeners are forwarded to the other future.
+ *
+ * The cases are disjoint (incomplete and unchained, incomplete and
+ * chained, or completed with value or error), so the field only needs to hold
+ * one value at a time.
*/
var _resultOrListeners;
@@ -185,7 +217,7 @@
void _setValue(T value) {
if (_isComplete) throw new StateError("Future already completed");
- _FutureListener listeners = _removeListeners();
+ _FutureListener listeners = _isChained ? null : _removeListeners();
_state = _VALUE;
_resultOrListeners = value;
while (listeners != null) {
@@ -198,29 +230,42 @@
void _setError(error) {
if (_isComplete) throw new StateError("Future already completed");
- _FutureListener listeners = _removeListeners();
+
+ _FutureListener listeners;
+ bool hasListeners;
+ if (_isChained) {
+ listeners = null;
+ hasListeners = (_state == _CHAINED); // and not _CHAINED_UNLISTENED.
+ } else {
+ listeners = _removeListeners();
+ hasListeners = (listeners != null);
+ }
+
_state = _ERROR;
_resultOrListeners = error;
- if (listeners == null) {
+
+ if (!hasListeners) {
_scheduleUnhandledError();
return;
}
- do {
+ while (listeners != null) {
_FutureListener listener = listeners;
listeners = listener._nextListener;
listener._nextListener = null;
listener._sendError(error);
- } while (listeners != null);
+ }
}
void _scheduleUnhandledError() {
- _state |= _UNHANDLED_ERROR;
+ assert(_state == _ERROR);
+ _state = _ERROR | _UNHANDLED_ERROR;
// Wait for the rest of the current event's duration to see
// if a subscriber is added to handle the error.
runAsync(() {
if (_hasUnhandledError) {
// No error handler has been added since the error was set.
_clearUnhandledError();
+ // TODO(floitsch): Hook this into unhandled error handling.
var error = _resultOrListeners;
print("Uncaught Error: ${error}");
var trace = getAttachedStackTrace(error);
@@ -233,6 +278,12 @@
}
void _addListener(_FutureListener listener) {
+ if (_isChained) {
+ _state = _CHAINED; // In case it was _CHAINED_UNLISTENED.
+ _FutureImpl resultSource = _chainSource;
+ resultSource._addListener(listener);
+ return;
+ }
if (_isComplete) {
_clearUnhandledError();
// Handle late listeners asynchronously.
@@ -278,7 +329,7 @@
*/
void _chain(_FutureImpl future) {
if (!_isComplete) {
- _addListener(future._asListener());
+ future._chainFromFuture(this);
} else if (_hasValue) {
future._setValue(_resultOrListeners);
} else {
@@ -289,12 +340,67 @@
}
/**
+ * Returns the future that this future is chained to.
+ *
+ * If that future is itself chained to something else,
+ * get the [_chainSource] of that future instead, and make this
+ * future chain directly to the earliest source.
+ */
+ _FutureImpl get _chainSource {
+ assert(_isChained);
+ _FutureImpl future = _resultOrListeners;
+ if (future._isChained) {
+ future = _resultOrListeners = future._chainSource;
+ }
+ return future;
+ }
+
+ /**
+ * Make this incomplete future end up with the same result as [resultSource].
+ *
+ * This is done by moving all listeners to [resultSource] and forwarding all
+ * future [_addListener] calls to [resultSource] directly.
+ */
+ void _chainFromFuture(_FutureImpl resultSource) {
+ assert(!_isComplete);
+ assert(!_isChained);
+ if (resultSource._isChained) {
+ resultSource = resultSource._chainSource;
+ }
+ assert(!resultSource._isChained);
+ if (identical(this, resultSource)) {
+ // The only unchained future in a future dependency tree (as defined
+ // by the chain-relations) is the "root" that every other future depends
+ // on. The future we are adding is unchained, so if it is already in the
+ // tree, it must be the root, so that's the only one we need to check
+ // against to detect a cycle.
+ _setError(new StateError("Cyclic future dependency."));
+ return;
+ }
+ _FutureListener cursor = _removeListeners();
+ bool hadListeners = cursor != null;
+ while (cursor != null) {
+ _FutureListener listener = cursor;
+ cursor = cursor._nextListener;
+ listener._nextListener = null;
+ resultSource._addListener(listener);
+ }
+ // Listen with this future as well, so that when the other future completes,
+ // this future will be completed as well.
+ resultSource._addListener(this._asListener());
+ _resultOrListeners = resultSource;
+ _state = hadListeners ? _CHAINED : _CHAINED_UNLISTENED;
+ }
+
+ /**
* Helper function to handle the result of transforming an incoming event.
*
* If the result is itself a [Future], this future is linked to that
* future's output. If not, this future is completed with the result.
*/
void _setOrChainValue(var result) {
+ assert(!_isChained);
+ assert(!_isComplete);
if (result is Future) {
// Result should be a Future<T>.
if (result is _FutureImpl) {
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index b959a55..20cc84c 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -248,6 +248,9 @@
SplayTreeMap([int compare(K key1, K key2)])
: _comparator = (compare == null) ? Comparable.compare : compare;
+ factory SplayTreeMap.from(Map<K, V> other, [int compare(K key1, K key2)]) =>
+ new SplayTreeMap(compare)..addAll(other);
+
int _compare(K key1, K key2) => _comparator(key1, key2);
SplayTreeMap._internal();
@@ -307,9 +310,11 @@
return value;
}
+ void addAll(Map<K, V> other) {
+ other.forEach((K key, V value) { this[key] = value; });
+ }
+
bool get isEmpty {
- // assert(!((_root == null) && (_count != 0)));
- // assert(!((_count == 0) && (_root != null)));
return (_root == null);
}
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index fe68fd8..4f67ea1 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -19,7 +19,6 @@
*/
factory Map.from(Map<K, V> other) => new HashMap<K, V>.from(other);
-
/**
* Returns whether this map contains the given [value].
*/
@@ -54,6 +53,17 @@
V putIfAbsent(K key, V ifAbsent());
/**
+ * Adds all key-value pairs of [other] to this map.
+ *
+ * If a key of [other] is already in this map, its value is overwritten.
+ *
+ * The operation is equivalent to doing `this[key] = value` for each key
+ * and associated value in other. It iterates over [other], which must
+ * therefore not change during the iteration.
+ */
+ void addAll(Map<K, V> other);
+
+ /**
* Removes the association for the given [key]. Returns the value for
* [key] in the map or null if [key] is not in the map. Note that values
* can be null and a returned null value does not always imply that the
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 703977e..1022653 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -65,7 +65,8 @@
return JS('var', r'ReceivePortSync.dispatchCall(#, #)', id, message);
}
-spawnDomFunction(Function f) => IsolateNatives.spawnDomFunction(f);
+Future<SendPort> spawnDomFunction(Function f) =>
+ new Future.value(IsolateNatives.spawnDomFunction(f));
// 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.
@@ -1928,12 +1929,11 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://www.w3.org/TR/filter-effects/
class CssFilterRule extends CssRule native "WebKitCSSFilterRule" {
@DomName('WebKitCSSFilterRule.style')
@DocsEditable
- @Experimental // untriaged
final CssStyleDeclaration style;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -1946,77 +1946,64 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssFilterValue extends _CssValueList native "WebKitCSSFilterValue" {
@DomName('WebKitCSSFilterValue.CSS_FILTER_BLUR')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_BLUR = 10;
@DomName('WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_BRIGHTNESS = 8;
@DomName('WebKitCSSFilterValue.CSS_FILTER_CONTRAST')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_CONTRAST = 9;
@DomName('WebKitCSSFilterValue.CSS_FILTER_CUSTOM')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_CUSTOM = 12;
@DomName('WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_DROP_SHADOW = 11;
@DomName('WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_GRAYSCALE = 2;
@DomName('WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_HUE_ROTATE = 5;
@DomName('WebKitCSSFilterValue.CSS_FILTER_INVERT')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_INVERT = 6;
@DomName('WebKitCSSFilterValue.CSS_FILTER_OPACITY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_OPACITY = 7;
@DomName('WebKitCSSFilterValue.CSS_FILTER_REFERENCE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_REFERENCE = 1;
@DomName('WebKitCSSFilterValue.CSS_FILTER_SATURATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_SATURATE = 4;
@DomName('WebKitCSSFilterValue.CSS_FILTER_SEPIA')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_SEPIA = 3;
@DomName('WebKitCSSFilterValue.operationType')
@DocsEditable
- @Experimental // untriaged
final int operationType;
@DomName('WebKitCSSFilterValue.__getter__')
@DocsEditable
- @Experimental // untriaged
_CSSValue __getter__(int index) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2108,17 +2095,15 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface
class CssKeyframeRule extends CssRule native "WebKitCSSKeyframeRule" {
@DomName('WebKitCSSKeyframeRule.keyText')
@DocsEditable
- @Experimental // untriaged
String keyText;
@DomName('WebKitCSSKeyframeRule.style')
@DocsEditable
- @Experimental // untriaged
final CssStyleDeclaration style;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2131,39 +2116,33 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://www.w3.org/TR/css3-animations/#csskeyframesrule
class CssKeyframesRule extends CssRule native "WebKitCSSKeyframesRule" {
@DomName('WebKitCSSKeyframesRule.cssRules')
@DocsEditable
- @Experimental // untriaged
@Returns('_CssRuleList')
@Creates('_CssRuleList')
final List<CssRule> cssRules;
@DomName('WebKitCSSKeyframesRule.name')
@DocsEditable
- @Experimental // untriaged
String name;
@DomName('WebKitCSSKeyframesRule.__getter__')
@DocsEditable
- @Experimental // untriaged
CssKeyframeRule __getter__(int index) native;
@DomName('WebKitCSSKeyframesRule.deleteRule')
@DocsEditable
- @Experimental // untriaged
void deleteRule(String key) native;
@DomName('WebKitCSSKeyframesRule.findRule')
@DocsEditable
- @Experimental // untriaged
CssKeyframeRule findRule(String key) native;
@DomName('WebKitCSSKeyframesRule.insertRule')
@DocsEditable
- @Experimental // untriaged
void insertRule(String rule) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2179,7 +2158,8 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssMatrix native "WebKitCSSMatrix" {
@DomName('WebKitCSSMatrix.CSSMatrix')
@@ -2195,162 +2175,130 @@
@DomName('WebKitCSSMatrix.a')
@DocsEditable
- @Experimental // untriaged
num a;
@DomName('WebKitCSSMatrix.b')
@DocsEditable
- @Experimental // untriaged
num b;
@DomName('WebKitCSSMatrix.c')
@DocsEditable
- @Experimental // untriaged
num c;
@DomName('WebKitCSSMatrix.d')
@DocsEditable
- @Experimental // untriaged
num d;
@DomName('WebKitCSSMatrix.e')
@DocsEditable
- @Experimental // untriaged
num e;
@DomName('WebKitCSSMatrix.f')
@DocsEditable
- @Experimental // untriaged
num f;
@DomName('WebKitCSSMatrix.m11')
@DocsEditable
- @Experimental // untriaged
num m11;
@DomName('WebKitCSSMatrix.m12')
@DocsEditable
- @Experimental // untriaged
num m12;
@DomName('WebKitCSSMatrix.m13')
@DocsEditable
- @Experimental // untriaged
num m13;
@DomName('WebKitCSSMatrix.m14')
@DocsEditable
- @Experimental // untriaged
num m14;
@DomName('WebKitCSSMatrix.m21')
@DocsEditable
- @Experimental // untriaged
num m21;
@DomName('WebKitCSSMatrix.m22')
@DocsEditable
- @Experimental // untriaged
num m22;
@DomName('WebKitCSSMatrix.m23')
@DocsEditable
- @Experimental // untriaged
num m23;
@DomName('WebKitCSSMatrix.m24')
@DocsEditable
- @Experimental // untriaged
num m24;
@DomName('WebKitCSSMatrix.m31')
@DocsEditable
- @Experimental // untriaged
num m31;
@DomName('WebKitCSSMatrix.m32')
@DocsEditable
- @Experimental // untriaged
num m32;
@DomName('WebKitCSSMatrix.m33')
@DocsEditable
- @Experimental // untriaged
num m33;
@DomName('WebKitCSSMatrix.m34')
@DocsEditable
- @Experimental // untriaged
num m34;
@DomName('WebKitCSSMatrix.m41')
@DocsEditable
- @Experimental // untriaged
num m41;
@DomName('WebKitCSSMatrix.m42')
@DocsEditable
- @Experimental // untriaged
num m42;
@DomName('WebKitCSSMatrix.m43')
@DocsEditable
- @Experimental // untriaged
num m43;
@DomName('WebKitCSSMatrix.m44')
@DocsEditable
- @Experimental // untriaged
num m44;
@DomName('WebKitCSSMatrix.inverse')
@DocsEditable
- @Experimental // untriaged
CssMatrix inverse() native;
@DomName('WebKitCSSMatrix.multiply')
@DocsEditable
- @Experimental // untriaged
CssMatrix multiply(CssMatrix secondMatrix) native;
@DomName('WebKitCSSMatrix.rotate')
@DocsEditable
- @Experimental // untriaged
CssMatrix rotate(num rotX, num rotY, num rotZ) native;
@DomName('WebKitCSSMatrix.rotateAxisAngle')
@DocsEditable
- @Experimental // untriaged
CssMatrix rotateAxisAngle(num x, num y, num z, num angle) native;
@DomName('WebKitCSSMatrix.scale')
@DocsEditable
- @Experimental // untriaged
CssMatrix scale(num scaleX, num scaleY, num scaleZ) native;
@DomName('WebKitCSSMatrix.setMatrixValue')
@DocsEditable
- @Experimental // untriaged
void setMatrixValue(String string) native;
@DomName('WebKitCSSMatrix.skewX')
@DocsEditable
- @Experimental // untriaged
CssMatrix skewX(num angle) native;
@DomName('WebKitCSSMatrix.skewY')
@DocsEditable
- @Experimental // untriaged
CssMatrix skewY(num angle) native;
@DomName('WebKitCSSMatrix.toString')
@DocsEditable
- @Experimental // untriaged
String toString() native;
@DomName('WebKitCSSMatrix.translate')
@DocsEditable
- @Experimental // untriaged
CssMatrix translate(num x, num y, num z) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2390,7 +2338,8 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssMixFunctionValue extends _CssValueList native "WebKitCSSMixFunctionValue" {
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2420,12 +2369,11 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/css-regions/#region-style-rule-interface
class CssRegionRule extends CssRule native "WebKitCSSRegionRule" {
@DomName('WebKitCSSRegionRule.cssRules')
@DocsEditable
- @Experimental // untriaged
@Returns('_CssRuleList')
@Creates('_CssRuleList')
final List<CssRule> cssRules;
@@ -2549,7 +2497,6 @@
@DomName('CSSStyleDeclaration.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(String propertyName, String propertyValue) native;
@DomName('CSSStyleDeclaration.getPropertyPriority')
@@ -5858,122 +5805,100 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssTransformValue extends _CssValueList native "WebKitCSSTransformValue" {
@DomName('WebKitCSSTransformValue.CSS_MATRIX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_MATRIX = 11;
@DomName('WebKitCSSTransformValue.CSS_MATRIX3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_MATRIX3D = 21;
@DomName('WebKitCSSTransformValue.CSS_PERSPECTIVE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_PERSPECTIVE = 20;
@DomName('WebKitCSSTransformValue.CSS_ROTATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATE = 4;
@DomName('WebKitCSSTransformValue.CSS_ROTATE3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATE3D = 17;
@DomName('WebKitCSSTransformValue.CSS_ROTATEX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATEX = 14;
@DomName('WebKitCSSTransformValue.CSS_ROTATEY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATEY = 15;
@DomName('WebKitCSSTransformValue.CSS_ROTATEZ')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATEZ = 16;
@DomName('WebKitCSSTransformValue.CSS_SCALE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALE = 5;
@DomName('WebKitCSSTransformValue.CSS_SCALE3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALE3D = 19;
@DomName('WebKitCSSTransformValue.CSS_SCALEX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALEX = 6;
@DomName('WebKitCSSTransformValue.CSS_SCALEY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALEY = 7;
@DomName('WebKitCSSTransformValue.CSS_SCALEZ')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALEZ = 18;
@DomName('WebKitCSSTransformValue.CSS_SKEW')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SKEW = 8;
@DomName('WebKitCSSTransformValue.CSS_SKEWX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SKEWX = 9;
@DomName('WebKitCSSTransformValue.CSS_SKEWY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SKEWY = 10;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATE = 1;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATE3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATE3D = 13;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATEX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATEX = 2;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATEY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATEY = 3;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATEZ')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATEZ = 12;
@DomName('WebKitCSSTransformValue.operationType')
@DocsEditable
- @Experimental // untriaged
final int operationType;
@DomName('WebKitCSSTransformValue.__getter__')
@DocsEditable
- @Experimental // untriaged
_CSSValue __getter__(int index) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -6018,6 +5943,7 @@
@DomName('CustomEvent.detail')
@DocsEditable
+ @Creates('Null')
final Object detail;
@JSName('initCustomEvent')
@@ -7553,7 +7479,6 @@
@DomName('DOMSettableTokenList.__getter__')
@DocsEditable
- @Experimental // untriaged
String __getter__(int index) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -8076,8 +8001,7 @@
Rect get offset => new Rect(offsetLeft, offsetTop, offsetWidth, offsetHeight);
/**
- * Adds the specified text as a text node after the last child of this
- * element.
+ * Adds the specified text after the last child of this element.
*/
void appendText(String text) {
this.insertAdjacentText('beforeend', text);
@@ -8211,7 +8135,7 @@
return 'transitionend';
}
/**
- * Creates a text node and inserts it into the DOM at the specified location.
+ * Inserts text into the DOM at the specified location.
*
* To see the possible values for [where], read the doc for
* [insertAdjacentHtml].
@@ -9596,12 +9520,10 @@
@DomName('HTMLEmbedElement.__getter__')
@DocsEditable
- @Experimental // untriaged
bool __getter__(index_OR_name) native;
@DomName('HTMLEmbedElement.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(index_OR_name, Node value) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -10286,6 +10208,7 @@
@JSName('lastModifiedDate')
@DomName('File.lastModifiedDate')
@DocsEditable
+ @Creates('Null')
final dynamic _get_lastModifiedDate;
@DomName('File.name')
@@ -10855,6 +10778,7 @@
@JSName('relatedTarget')
@DomName('FocusEvent.relatedTarget')
@DocsEditable
+ @Creates('Null')
final dynamic _get_relatedTarget;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -11046,7 +10970,6 @@
@DomName('HTMLFormElement.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(int index) native;
@DomName('HTMLFormElement.checkValidity')
@@ -11467,7 +11390,6 @@
@DomName('HTMLAllCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(int index) native;
@DomName('HTMLAllCollection.item')
@@ -11543,7 +11465,6 @@
@DomName('HTMLCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(String name) native;
@DomName('HTMLCollection.item')
@@ -11741,7 +11662,6 @@
@DomName('HTMLFormControlsCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(int index) native;
@DomName('HTMLFormControlsCollection.namedItem')
@@ -12811,6 +12731,7 @@
@JSName('valueAsDate')
@DomName('HTMLInputElement.valueAsDate')
@DocsEditable
+ @Creates('Null')
final dynamic _get_valueAsDate;
void set valueAsDate(DateTime value) {
@@ -13750,7 +13671,8 @@
@DomName('HTMLLinkElement.import')
@DocsEditable
- @Experimental // untriaged
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#interface-import
+ @Experimental
final DocumentFragment import;
@DomName('HTMLLinkElement.media')
@@ -13837,11 +13759,6 @@
@DocsEditable
String toString() native;
- @DomName('Location.valueOf')
- @DocsEditable
- @Experimental // nonstandard
- Object valueOf() native;
-
@DomName('Location.origin')
String get origin {
@@ -14624,6 +14541,27 @@
@Experimental
class MediaKeySession extends EventTarget native "MediaKeySession" {
+ @DomName('MediaKeySession.webkitkeyaddedEvent')
+ @DocsEditable
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental
+ static const EventStreamProvider<MediaKeyEvent> keyAddedEvent = const EventStreamProvider<MediaKeyEvent>('webkitkeyadded');
+
+ @DomName('MediaKeySession.webkitkeyerrorEvent')
+ @DocsEditable
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental
+ static const EventStreamProvider<MediaKeyEvent> keyErrorEvent = const EventStreamProvider<MediaKeyEvent>('webkitkeyerror');
+
+ @DomName('MediaKeySession.webkitkeymessageEvent')
+ @DocsEditable
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental
+ static const EventStreamProvider<MediaKeyEvent> keyMessageEvent = const EventStreamProvider<MediaKeyEvent>('webkitkeymessage');
+
@DomName('MediaKeySession.error')
@DocsEditable
final MediaKeyError error;
@@ -14657,6 +14595,18 @@
@DomName('MediaKeySession.update')
@DocsEditable
void update(Uint8List key) native;
+
+ @DomName('MediaKeySession.onwebkitkeyadded')
+ @DocsEditable
+ Stream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forTarget(this);
+
+ @DomName('MediaKeySession.onwebkitkeyerror')
+ @DocsEditable
+ Stream<MediaKeyEvent> get onKeyError => keyErrorEvent.forTarget(this);
+
+ @DomName('MediaKeySession.onwebkitkeymessage')
+ @DocsEditable
+ Stream<MediaKeyEvent> get onKeyMessage => keyMessageEvent.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
@@ -15244,6 +15194,10 @@
@DomName('HTMLMetaElement')
class MetaElement extends Element native "HTMLMetaElement" {
+ @DomName('HTMLMetaElement.HTMLMetaElement')
+ @DocsEditable
+ factory MetaElement() => document.$dom_createElement("meta");
+
@DomName('HTMLMetaElement.content')
@DocsEditable
String content;
@@ -15271,6 +15225,7 @@
@JSName('modificationTime')
@DomName('Metadata.modificationTime')
@DocsEditable
+ @Creates('Null')
final dynamic _get_modificationTime;
@DomName('Metadata.size')
@@ -15346,35 +15301,47 @@
@DocsEditable
@DomName('MIDIAccess')
-@Experimental // untriaged
+// http://webaudio.github.io/web-midi-api/#midiaccess-interface
+@Experimental
class MidiAccess extends EventTarget native "MIDIAccess" {
+ @DomName('MIDIAccess.connectEvent')
+ @DocsEditable
+ static const EventStreamProvider<MidiConnectionEvent> connectEvent = const EventStreamProvider<MidiConnectionEvent>('connect');
+
+ @DomName('MIDIAccess.disconnectEvent')
+ @DocsEditable
+ static const EventStreamProvider<MidiConnectionEvent> disconnectEvent = const EventStreamProvider<MidiConnectionEvent>('disconnect');
+
@JSName('addEventListener')
@DomName('MIDIAccess.addEventListener')
@DocsEditable
- @Experimental // untriaged
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
@DomName('MIDIAccess.dispatchEvent')
@DocsEditable
- @Experimental // untriaged
bool dispatchEvent(Event event) native;
@DomName('MIDIAccess.inputs')
@DocsEditable
- @Experimental // untriaged
List<MidiInput> inputs() native;
@DomName('MIDIAccess.outputs')
@DocsEditable
- @Experimental // untriaged
List<MidiOutput> outputs() native;
@JSName('removeEventListener')
@DomName('MIDIAccess.removeEventListener')
@DocsEditable
- @Experimental // untriaged
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
+
+ @DomName('MIDIAccess.onconnect')
+ @DocsEditable
+ Stream<MidiConnectionEvent> get onConnect => connectEvent.forTarget(this);
+
+ @DomName('MIDIAccess.ondisconnect')
+ @DocsEditable
+ Stream<MidiConnectionEvent> get onDisconnect => disconnectEvent.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
@@ -15401,6 +15368,14 @@
// http://webaudio.github.io/web-midi-api/#idl-def-MIDIInput
@Experimental
class MidiInput extends MidiPort implements EventTarget native "MIDIInput" {
+
+ @DomName('MIDIInput.midimessageEvent')
+ @DocsEditable
+ static const EventStreamProvider<MidiMessageEvent> midiMessageEvent = const EventStreamProvider<MidiMessageEvent>('midimessage');
+
+ @DomName('MIDIInput.onmidimessage')
+ @DocsEditable
+ Stream<MidiMessageEvent> get onMidiMessage => midiMessageEvent.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
@@ -15575,7 +15550,6 @@
@DomName('MimeTypeArray.__getter__')
@DocsEditable
- @Experimental // untriaged
MimeType __getter__(String name) native;
@DomName('MimeTypeArray.item')
@@ -16067,7 +16041,6 @@
@DomName('WebKitNamedFlowCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
NamedFlow __getter__(String name) native;
@DomName('WebKitNamedFlowCollection.item')
@@ -16289,17 +16262,14 @@
@DomName('NavigatorUserMediaError.constraintName')
@DocsEditable
- @Experimental // untriaged
final String constraintName;
@DomName('NavigatorUserMediaError.message')
@DocsEditable
- @Experimental // untriaged
final String message;
@DomName('NavigatorUserMediaError.name')
@DocsEditable
- @Experimental // untriaged
final String name;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -17248,12 +17218,10 @@
@DomName('HTMLObjectElement.__getter__')
@DocsEditable
- @Experimental // untriaged
bool __getter__(index_OR_name) native;
@DomName('HTMLObjectElement.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(index_OR_name, Node value) native;
@DomName('HTMLObjectElement.checkValidity')
@@ -17933,7 +17901,6 @@
@DomName('Plugin.__getter__')
@DocsEditable
- @Experimental // untriaged
MimeType __getter__(String name) native;
@DomName('Plugin.item')
@@ -18004,7 +17971,6 @@
@DomName('PluginArray.__getter__')
@DocsEditable
- @Experimental // untriaged
Plugin __getter__(String name) native;
@DomName('PluginArray.item')
@@ -18201,6 +18167,10 @@
@DomName('HTMLQuoteElement')
class QuoteElement extends Element native "HTMLQuoteElement" {
+ @DomName('HTMLQuoteElement.HTMLQuoteElement')
+ @DocsEditable
+ factory QuoteElement() => document.$dom_createElement("q");
+
@DomName('HTMLQuoteElement.cite')
@DocsEditable
String cite;
@@ -18442,12 +18412,12 @@
@DocsEditable
@DomName('ResourceProgressEvent')
-@Experimental // untriaged
+// https://chromiumcodereview.appspot.com/14773025/
+@deprecated // experimental
class ResourceProgressEvent extends ProgressEvent native "ResourceProgressEvent" {
@DomName('ResourceProgressEvent.url')
@DocsEditable
- @Experimental // untriaged
final String url;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -19050,6 +19020,7 @@
@JSName('timestamp')
@DomName('RTCStatsReport.timestamp')
@DocsEditable
+ @Creates('Null')
final dynamic _get_timestamp;
@DomName('RTCStatsReport.type')
@@ -19077,7 +19048,6 @@
@DomName('RTCStatsResponse.__getter__')
@DocsEditable
- @Experimental // untriaged
RtcStatsReport __getter__(String name) native;
@DomName('RTCStatsResponse.namedItem')
@@ -19398,7 +19368,6 @@
@DomName('HTMLSelectElement.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(int index, OptionElement value) native;
@DomName('HTMLSelectElement.checkValidity')
@@ -19571,6 +19540,10 @@
// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-element
class ShadowElement extends Element native "HTMLShadowElement" {
+ @DomName('HTMLShadowElement.HTMLShadowElement')
+ @DocsEditable
+ factory ShadowElement() => document.$dom_createElement("shadow");
+
/// Checks if this type is supported on the current platform.
static bool get supported => Element.isTagSupported('shadow');
@@ -20470,17 +20443,14 @@
@DomName('Storage.__delete__')
@DocsEditable
- @Experimental // untriaged
bool __delete__(index_OR_name) native;
@DomName('Storage.__getter__')
@DocsEditable
- @Experimental // untriaged
String __getter__(index_OR_name) native;
@DomName('Storage.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(index_OR_name, String value) native;
@JSName('clear')
@@ -22091,6 +22061,7 @@
@DomName('TrackEvent.track')
@DocsEditable
+ @Creates('Null')
final Object track;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -23466,7 +23437,6 @@
@DomName('Window.__getter__')
@DocsEditable
- @Experimental // untriaged
@Creates('Window|=Object')
@Returns('Window|=Object')
WindowBase __getter__(index_OR_name) {
@@ -23481,14 +23451,12 @@
@JSName('__getter__')
@DomName('Window.__getter__')
@DocsEditable
- @Experimental // untriaged
@Creates('Window|=Object')
@Returns('Window|=Object')
___getter___1(int index) native;
@JSName('__getter__')
@DomName('Window.__getter__')
@DocsEditable
- @Experimental // untriaged
@Creates('Window|=Object')
@Returns('Window|=Object')
___getter___2(String name) native;
@@ -23638,6 +23606,7 @@
@DomName('Window.showModalDialog')
@DocsEditable
+ @Creates('Null')
Object showModalDialog(String url, [Object dialogArgs, String featureArgs]) native;
@DomName('Window.stop')
@@ -24779,7 +24748,7 @@
@DocsEditable
@DomName('Entity')
-@Experimental // untriaged
+@deprecated // deprecated
class _Entity extends Node native "Entity" {
@DomName('Entity.notationName')
@@ -25172,7 +25141,6 @@
@DomName('NamedNodeMap.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(String name) native;
@DomName('NamedNodeMap.getNamedItem')
@@ -25462,7 +25430,6 @@
@DomName('StyleSheetList.__getter__')
@DocsEditable
- @Experimental // untriaged
CssStyleSheet __getter__(String name) native;
@DomName('StyleSheetList.item')
@@ -25475,150 +25442,6 @@
@DocsEditable
-@DomName('WebKitCSSFilterValue')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSFilterValue extends _CssValueList native "WebKitCSSFilterValue" {
-}
-// 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('WebKitCSSMatrix')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSMatrix native "WebKitCSSMatrix" {
-
- @DomName('WebKitCSSMatrix.WebKitCSSMatrix')
- @DocsEditable
- factory _WebKitCSSMatrix([String cssValue]) {
- if (cssValue != null) {
- return _WebKitCSSMatrix._create_1(cssValue);
- }
- return _WebKitCSSMatrix._create_2();
- }
- static _WebKitCSSMatrix _create_1(cssValue) => JS('_WebKitCSSMatrix', 'new WebKitCSSMatrix(#)', cssValue);
- static _WebKitCSSMatrix _create_2() => JS('_WebKitCSSMatrix', 'new WebKitCSSMatrix()');
-}
-// 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('WebKitCSSMixFunctionValue')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSMixFunctionValue extends _CssValueList native "WebKitCSSMixFunctionValue" {
-}
-// 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('WebKitCSSTransformValue')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSTransformValue extends _CssValueList native "WebKitCSSTransformValue" {
-}
-// 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('WebKitCSSFilterRule')
-// http://www.w3.org/TR/filter-effects/
-@Experimental
-class _WebKitCssFilterRule extends CssRule native "WebKitCSSFilterRule" {
-
- @DomName('WebKitCSSFilterRule.style')
- @DocsEditable
- final CssStyleDeclaration style;
-}
-// 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('WebKitCSSKeyframeRule')
-// http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface
-@Experimental
-class _WebKitCssKeyframeRule extends CssRule native "WebKitCSSKeyframeRule" {
-
- @DomName('WebKitCSSKeyframeRule.keyText')
- @DocsEditable
- String keyText;
-
- @DomName('WebKitCSSKeyframeRule.style')
- @DocsEditable
- final CssStyleDeclaration style;
-}
-// 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('WebKitCSSKeyframesRule')
-// http://www.w3.org/TR/css3-animations/#csskeyframesrule
-@Experimental
-class _WebKitCssKeyframesRule extends CssRule native "WebKitCSSKeyframesRule" {
-
- @DomName('WebKitCSSKeyframesRule.cssRules')
- @DocsEditable
- @Returns('_CssRuleList')
- @Creates('_CssRuleList')
- final List<CssRule> cssRules;
-
- @DomName('WebKitCSSKeyframesRule.name')
- @DocsEditable
- String name;
-
- @DomName('WebKitCSSKeyframesRule.__getter__')
- @DocsEditable
- @Experimental // untriaged
- _WebKitCssKeyframeRule __getter__(int index) native;
-
- @DomName('WebKitCSSKeyframesRule.deleteRule')
- @DocsEditable
- void deleteRule(String key) native;
-
- @DomName('WebKitCSSKeyframesRule.findRule')
- @DocsEditable
- _WebKitCssKeyframeRule findRule(String key) native;
-
- @DomName('WebKitCSSKeyframesRule.insertRule')
- @DocsEditable
- void insertRule(String rule) native;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-@DocsEditable
-@DomName('WebKitCSSRegionRule')
-// http://dev.w3.org/csswg/css-regions/#region-style-rule-interface
-@Experimental
-class _WebKitCssRegionRule extends CssRule native "WebKitCSSRegionRule" {
-
- @DomName('WebKitCSSRegionRule.cssRules')
- @DocsEditable
- @Returns('_CssRuleList')
- @Creates('_CssRuleList')
- final List<CssRule> cssRules;
-}
-// 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
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 420dd93..8409fee 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -2332,13 +2332,12 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://www.w3.org/TR/filter-effects/
class CssFilterRule extends CssRule {
CssFilterRule.internal() : super.internal();
@DomName('WebKitCSSFilterRule.style')
@DocsEditable
- @Experimental // untriaged
CssStyleDeclaration get style native "CSSFilterRule_style_Getter";
}
@@ -2354,78 +2353,65 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssFilterValue extends _CssValueList {
CssFilterValue.internal() : super.internal();
@DomName('WebKitCSSFilterValue.CSS_FILTER_BLUR')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_BLUR = 10;
@DomName('WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_BRIGHTNESS = 8;
@DomName('WebKitCSSFilterValue.CSS_FILTER_CONTRAST')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_CONTRAST = 9;
@DomName('WebKitCSSFilterValue.CSS_FILTER_CUSTOM')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_CUSTOM = 12;
@DomName('WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_DROP_SHADOW = 11;
@DomName('WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_GRAYSCALE = 2;
@DomName('WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_HUE_ROTATE = 5;
@DomName('WebKitCSSFilterValue.CSS_FILTER_INVERT')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_INVERT = 6;
@DomName('WebKitCSSFilterValue.CSS_FILTER_OPACITY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_OPACITY = 7;
@DomName('WebKitCSSFilterValue.CSS_FILTER_REFERENCE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_REFERENCE = 1;
@DomName('WebKitCSSFilterValue.CSS_FILTER_SATURATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_SATURATE = 4;
@DomName('WebKitCSSFilterValue.CSS_FILTER_SEPIA')
@DocsEditable
- @Experimental // untriaged
static const int CSS_FILTER_SEPIA = 3;
@DomName('WebKitCSSFilterValue.operationType')
@DocsEditable
- @Experimental // untriaged
int get operationType native "CSSFilterValue_operationType_Getter";
@DomName('WebKitCSSFilterValue.__getter__')
@DocsEditable
- @Experimental // untriaged
_CSSValue __getter__(int index) native "CSSFilterValue___getter___Callback";
}
@@ -2534,23 +2520,20 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface
class CssKeyframeRule extends CssRule {
CssKeyframeRule.internal() : super.internal();
@DomName('WebKitCSSKeyframeRule.keyText')
@DocsEditable
- @Experimental // untriaged
String get keyText native "CSSKeyframeRule_keyText_Getter";
@DomName('WebKitCSSKeyframeRule.keyText')
@DocsEditable
- @Experimental // untriaged
void set keyText(String value) native "CSSKeyframeRule_keyText_Setter";
@DomName('WebKitCSSKeyframeRule.style')
@DocsEditable
- @Experimental // untriaged
CssStyleDeclaration get style native "CSSKeyframeRule_style_Getter";
}
@@ -2566,43 +2549,36 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://www.w3.org/TR/css3-animations/#csskeyframesrule
class CssKeyframesRule extends CssRule {
CssKeyframesRule.internal() : super.internal();
@DomName('WebKitCSSKeyframesRule.cssRules')
@DocsEditable
- @Experimental // untriaged
List<CssRule> get cssRules native "CSSKeyframesRule_cssRules_Getter";
@DomName('WebKitCSSKeyframesRule.name')
@DocsEditable
- @Experimental // untriaged
String get name native "CSSKeyframesRule_name_Getter";
@DomName('WebKitCSSKeyframesRule.name')
@DocsEditable
- @Experimental // untriaged
void set name(String value) native "CSSKeyframesRule_name_Setter";
@DomName('WebKitCSSKeyframesRule.__getter__')
@DocsEditable
- @Experimental // untriaged
CssKeyframeRule __getter__(int index) native "CSSKeyframesRule___getter___Callback";
@DomName('WebKitCSSKeyframesRule.deleteRule')
@DocsEditable
- @Experimental // untriaged
void deleteRule(String key) native "CSSKeyframesRule_deleteRule_Callback";
@DomName('WebKitCSSKeyframesRule.findRule')
@DocsEditable
- @Experimental // untriaged
CssKeyframeRule findRule(String key) native "CSSKeyframesRule_findRule_Callback";
@DomName('WebKitCSSKeyframesRule.insertRule')
@DocsEditable
- @Experimental // untriaged
void insertRule(String rule) native "CSSKeyframesRule_insertRule_Callback";
}
@@ -2621,7 +2597,8 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssMatrix extends NativeFieldWrapperClass1 {
CssMatrix.internal();
@@ -2636,272 +2613,218 @@
@DomName('WebKitCSSMatrix.a')
@DocsEditable
- @Experimental // untriaged
num get a native "CSSMatrix_a_Getter";
@DomName('WebKitCSSMatrix.a')
@DocsEditable
- @Experimental // untriaged
void set a(num value) native "CSSMatrix_a_Setter";
@DomName('WebKitCSSMatrix.b')
@DocsEditable
- @Experimental // untriaged
num get b native "CSSMatrix_b_Getter";
@DomName('WebKitCSSMatrix.b')
@DocsEditable
- @Experimental // untriaged
void set b(num value) native "CSSMatrix_b_Setter";
@DomName('WebKitCSSMatrix.c')
@DocsEditable
- @Experimental // untriaged
num get c native "CSSMatrix_c_Getter";
@DomName('WebKitCSSMatrix.c')
@DocsEditable
- @Experimental // untriaged
void set c(num value) native "CSSMatrix_c_Setter";
@DomName('WebKitCSSMatrix.d')
@DocsEditable
- @Experimental // untriaged
num get d native "CSSMatrix_d_Getter";
@DomName('WebKitCSSMatrix.d')
@DocsEditable
- @Experimental // untriaged
void set d(num value) native "CSSMatrix_d_Setter";
@DomName('WebKitCSSMatrix.e')
@DocsEditable
- @Experimental // untriaged
num get e native "CSSMatrix_e_Getter";
@DomName('WebKitCSSMatrix.e')
@DocsEditable
- @Experimental // untriaged
void set e(num value) native "CSSMatrix_e_Setter";
@DomName('WebKitCSSMatrix.f')
@DocsEditable
- @Experimental // untriaged
num get f native "CSSMatrix_f_Getter";
@DomName('WebKitCSSMatrix.f')
@DocsEditable
- @Experimental // untriaged
void set f(num value) native "CSSMatrix_f_Setter";
@DomName('WebKitCSSMatrix.m11')
@DocsEditable
- @Experimental // untriaged
num get m11 native "CSSMatrix_m11_Getter";
@DomName('WebKitCSSMatrix.m11')
@DocsEditable
- @Experimental // untriaged
void set m11(num value) native "CSSMatrix_m11_Setter";
@DomName('WebKitCSSMatrix.m12')
@DocsEditable
- @Experimental // untriaged
num get m12 native "CSSMatrix_m12_Getter";
@DomName('WebKitCSSMatrix.m12')
@DocsEditable
- @Experimental // untriaged
void set m12(num value) native "CSSMatrix_m12_Setter";
@DomName('WebKitCSSMatrix.m13')
@DocsEditable
- @Experimental // untriaged
num get m13 native "CSSMatrix_m13_Getter";
@DomName('WebKitCSSMatrix.m13')
@DocsEditable
- @Experimental // untriaged
void set m13(num value) native "CSSMatrix_m13_Setter";
@DomName('WebKitCSSMatrix.m14')
@DocsEditable
- @Experimental // untriaged
num get m14 native "CSSMatrix_m14_Getter";
@DomName('WebKitCSSMatrix.m14')
@DocsEditable
- @Experimental // untriaged
void set m14(num value) native "CSSMatrix_m14_Setter";
@DomName('WebKitCSSMatrix.m21')
@DocsEditable
- @Experimental // untriaged
num get m21 native "CSSMatrix_m21_Getter";
@DomName('WebKitCSSMatrix.m21')
@DocsEditable
- @Experimental // untriaged
void set m21(num value) native "CSSMatrix_m21_Setter";
@DomName('WebKitCSSMatrix.m22')
@DocsEditable
- @Experimental // untriaged
num get m22 native "CSSMatrix_m22_Getter";
@DomName('WebKitCSSMatrix.m22')
@DocsEditable
- @Experimental // untriaged
void set m22(num value) native "CSSMatrix_m22_Setter";
@DomName('WebKitCSSMatrix.m23')
@DocsEditable
- @Experimental // untriaged
num get m23 native "CSSMatrix_m23_Getter";
@DomName('WebKitCSSMatrix.m23')
@DocsEditable
- @Experimental // untriaged
void set m23(num value) native "CSSMatrix_m23_Setter";
@DomName('WebKitCSSMatrix.m24')
@DocsEditable
- @Experimental // untriaged
num get m24 native "CSSMatrix_m24_Getter";
@DomName('WebKitCSSMatrix.m24')
@DocsEditable
- @Experimental // untriaged
void set m24(num value) native "CSSMatrix_m24_Setter";
@DomName('WebKitCSSMatrix.m31')
@DocsEditable
- @Experimental // untriaged
num get m31 native "CSSMatrix_m31_Getter";
@DomName('WebKitCSSMatrix.m31')
@DocsEditable
- @Experimental // untriaged
void set m31(num value) native "CSSMatrix_m31_Setter";
@DomName('WebKitCSSMatrix.m32')
@DocsEditable
- @Experimental // untriaged
num get m32 native "CSSMatrix_m32_Getter";
@DomName('WebKitCSSMatrix.m32')
@DocsEditable
- @Experimental // untriaged
void set m32(num value) native "CSSMatrix_m32_Setter";
@DomName('WebKitCSSMatrix.m33')
@DocsEditable
- @Experimental // untriaged
num get m33 native "CSSMatrix_m33_Getter";
@DomName('WebKitCSSMatrix.m33')
@DocsEditable
- @Experimental // untriaged
void set m33(num value) native "CSSMatrix_m33_Setter";
@DomName('WebKitCSSMatrix.m34')
@DocsEditable
- @Experimental // untriaged
num get m34 native "CSSMatrix_m34_Getter";
@DomName('WebKitCSSMatrix.m34')
@DocsEditable
- @Experimental // untriaged
void set m34(num value) native "CSSMatrix_m34_Setter";
@DomName('WebKitCSSMatrix.m41')
@DocsEditable
- @Experimental // untriaged
num get m41 native "CSSMatrix_m41_Getter";
@DomName('WebKitCSSMatrix.m41')
@DocsEditable
- @Experimental // untriaged
void set m41(num value) native "CSSMatrix_m41_Setter";
@DomName('WebKitCSSMatrix.m42')
@DocsEditable
- @Experimental // untriaged
num get m42 native "CSSMatrix_m42_Getter";
@DomName('WebKitCSSMatrix.m42')
@DocsEditable
- @Experimental // untriaged
void set m42(num value) native "CSSMatrix_m42_Setter";
@DomName('WebKitCSSMatrix.m43')
@DocsEditable
- @Experimental // untriaged
num get m43 native "CSSMatrix_m43_Getter";
@DomName('WebKitCSSMatrix.m43')
@DocsEditable
- @Experimental // untriaged
void set m43(num value) native "CSSMatrix_m43_Setter";
@DomName('WebKitCSSMatrix.m44')
@DocsEditable
- @Experimental // untriaged
num get m44 native "CSSMatrix_m44_Getter";
@DomName('WebKitCSSMatrix.m44')
@DocsEditable
- @Experimental // untriaged
void set m44(num value) native "CSSMatrix_m44_Setter";
@DomName('WebKitCSSMatrix.inverse')
@DocsEditable
- @Experimental // untriaged
CssMatrix inverse() native "CSSMatrix_inverse_Callback";
@DomName('WebKitCSSMatrix.multiply')
@DocsEditable
- @Experimental // untriaged
CssMatrix multiply(CssMatrix secondMatrix) native "CSSMatrix_multiply_Callback";
@DomName('WebKitCSSMatrix.rotate')
@DocsEditable
- @Experimental // untriaged
CssMatrix rotate(num rotX, num rotY, num rotZ) native "CSSMatrix_rotate_Callback";
@DomName('WebKitCSSMatrix.rotateAxisAngle')
@DocsEditable
- @Experimental // untriaged
CssMatrix rotateAxisAngle(num x, num y, num z, num angle) native "CSSMatrix_rotateAxisAngle_Callback";
@DomName('WebKitCSSMatrix.scale')
@DocsEditable
- @Experimental // untriaged
CssMatrix scale(num scaleX, num scaleY, num scaleZ) native "CSSMatrix_scale_Callback";
@DomName('WebKitCSSMatrix.setMatrixValue')
@DocsEditable
- @Experimental // untriaged
void setMatrixValue(String string) native "CSSMatrix_setMatrixValue_Callback";
@DomName('WebKitCSSMatrix.skewX')
@DocsEditable
- @Experimental // untriaged
CssMatrix skewX(num angle) native "CSSMatrix_skewX_Callback";
@DomName('WebKitCSSMatrix.skewY')
@DocsEditable
- @Experimental // untriaged
CssMatrix skewY(num angle) native "CSSMatrix_skewY_Callback";
@DomName('WebKitCSSMatrix.toString')
@DocsEditable
- @Experimental // untriaged
String toString() native "CSSMatrix_toString_Callback";
@DomName('WebKitCSSMatrix.translate')
@DocsEditable
- @Experimental // untriaged
CssMatrix translate(num x, num y, num z) native "CSSMatrix_translate_Callback";
}
@@ -2946,7 +2869,8 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssMixFunctionValue extends _CssValueList {
CssMixFunctionValue.internal() : super.internal();
@@ -2988,13 +2912,12 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/css-regions/#region-style-rule-interface
class CssRegionRule extends CssRule {
CssRegionRule.internal() : super.internal();
@DomName('WebKitCSSRegionRule.cssRules')
@DocsEditable
- @Experimental // untriaged
List<CssRule> get cssRules native "CSSRegionRule_cssRules_Getter";
}
@@ -3130,7 +3053,6 @@
@DomName('CSSStyleDeclaration.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(String propertyName, String propertyValue) native "CSSStyleDeclaration___setter___Callback";
@DomName('CSSStyleDeclaration.getPropertyPriority')
@@ -6447,123 +6369,101 @@
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
-@Experimental // untriaged
+// http://dev.w3.org/csswg/cssom/
+@deprecated // deprecated
class CssTransformValue extends _CssValueList {
CssTransformValue.internal() : super.internal();
@DomName('WebKitCSSTransformValue.CSS_MATRIX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_MATRIX = 11;
@DomName('WebKitCSSTransformValue.CSS_MATRIX3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_MATRIX3D = 21;
@DomName('WebKitCSSTransformValue.CSS_PERSPECTIVE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_PERSPECTIVE = 20;
@DomName('WebKitCSSTransformValue.CSS_ROTATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATE = 4;
@DomName('WebKitCSSTransformValue.CSS_ROTATE3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATE3D = 17;
@DomName('WebKitCSSTransformValue.CSS_ROTATEX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATEX = 14;
@DomName('WebKitCSSTransformValue.CSS_ROTATEY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATEY = 15;
@DomName('WebKitCSSTransformValue.CSS_ROTATEZ')
@DocsEditable
- @Experimental // untriaged
static const int CSS_ROTATEZ = 16;
@DomName('WebKitCSSTransformValue.CSS_SCALE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALE = 5;
@DomName('WebKitCSSTransformValue.CSS_SCALE3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALE3D = 19;
@DomName('WebKitCSSTransformValue.CSS_SCALEX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALEX = 6;
@DomName('WebKitCSSTransformValue.CSS_SCALEY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALEY = 7;
@DomName('WebKitCSSTransformValue.CSS_SCALEZ')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SCALEZ = 18;
@DomName('WebKitCSSTransformValue.CSS_SKEW')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SKEW = 8;
@DomName('WebKitCSSTransformValue.CSS_SKEWX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SKEWX = 9;
@DomName('WebKitCSSTransformValue.CSS_SKEWY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_SKEWY = 10;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATE')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATE = 1;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATE3D')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATE3D = 13;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATEX')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATEX = 2;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATEY')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATEY = 3;
@DomName('WebKitCSSTransformValue.CSS_TRANSLATEZ')
@DocsEditable
- @Experimental // untriaged
static const int CSS_TRANSLATEZ = 12;
@DomName('WebKitCSSTransformValue.operationType')
@DocsEditable
- @Experimental // untriaged
int get operationType native "CSSTransformValue_operationType_Getter";
@DomName('WebKitCSSTransformValue.__getter__')
@DocsEditable
- @Experimental // untriaged
_CSSValue __getter__(int index) native "CSSTransformValue___getter___Callback";
}
@@ -8115,7 +8015,6 @@
@DomName('DOMSettableTokenList.__getter__')
@DocsEditable
- @Experimental // untriaged
String __getter__(int index) native "DOMSettableTokenList___getter___Callback";
}
@@ -8203,17 +8102,14 @@
@DomName('DOMStringMap.__delete__')
@DocsEditable
- @Experimental // untriaged
bool __delete__(String name) native "DOMStringMap___delete___Callback";
@DomName('DOMStringMap.__getter__')
@DocsEditable
- @Experimental // untriaged
String __getter__(String name) native "DOMStringMap___getter___Callback";
@DomName('DOMStringMap.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(String name, String value) native "DOMStringMap___setter___Callback";
}
@@ -8669,8 +8565,7 @@
Rect get offset => new Rect(offsetLeft, offsetTop, offsetWidth, offsetHeight);
/**
- * Adds the specified text as a text node after the last child of this
- * element.
+ * Adds the specified text after the last child of this element.
*/
void appendText(String text) {
this.insertAdjacentText('beforeend', text);
@@ -10075,12 +9970,10 @@
@DomName('HTMLEmbedElement.__getter__')
@DocsEditable
- @Experimental // untriaged
bool __getter__(index_OR_name) native "HTMLEmbedElement___getter___Callback";
@DomName('HTMLEmbedElement.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(index_OR_name, Node value) native "HTMLEmbedElement___setter___Callback";
}
@@ -11603,7 +11496,6 @@
@DomName('HTMLFormElement.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(int index) native "HTMLFormElement___getter___Callback";
@DomName('HTMLFormElement.checkValidity')
@@ -12024,7 +11916,6 @@
@DomName('HTMLAllCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(int index) native "HTMLAllCollection___getter___Callback";
@DomName('HTMLAllCollection.item')
@@ -12103,7 +11994,6 @@
@DomName('HTMLCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(String name) native "HTMLCollection___getter___Callback";
@DomName('HTMLCollection.item')
@@ -12313,7 +12203,6 @@
@DomName('HTMLFormControlsCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(int index) native "HTMLFormControlsCollection___getter___Callback";
@DomName('HTMLFormControlsCollection.namedItem')
@@ -14682,7 +14571,8 @@
@DomName('HTMLLinkElement.import')
@DocsEditable
- @Experimental // untriaged
+ // https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#interface-import
+ @Experimental
DocumentFragment get import native "HTMLLinkElement_import_Getter";
@DomName('HTMLLinkElement.media')
@@ -14823,11 +14713,6 @@
@DocsEditable
String toString() native "Location_toString_Callback";
- @DomName('Location.valueOf')
- @DocsEditable
- @Experimental // nonstandard
- Object valueOf() native "Location_valueOf_Callback";
-
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -15746,6 +15631,27 @@
class MediaKeySession extends EventTarget {
MediaKeySession.internal() : super.internal();
+ @DomName('MediaKeySession.webkitkeyaddedEvent')
+ @DocsEditable
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental
+ static const EventStreamProvider<MediaKeyEvent> keyAddedEvent = const EventStreamProvider<MediaKeyEvent>('webkitkeyadded');
+
+ @DomName('MediaKeySession.webkitkeyerrorEvent')
+ @DocsEditable
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental
+ static const EventStreamProvider<MediaKeyEvent> keyErrorEvent = const EventStreamProvider<MediaKeyEvent>('webkitkeyerror');
+
+ @DomName('MediaKeySession.webkitkeymessageEvent')
+ @DocsEditable
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental
+ static const EventStreamProvider<MediaKeyEvent> keyMessageEvent = const EventStreamProvider<MediaKeyEvent>('webkitkeymessage');
+
@DomName('MediaKeySession.error')
@DocsEditable
MediaKeyError get error native "MediaKeySession_error_Getter";
@@ -15778,6 +15684,18 @@
@DocsEditable
void update(Uint8List key) native "MediaKeySession_update_Callback";
+ @DomName('MediaKeySession.onwebkitkeyadded')
+ @DocsEditable
+ Stream<MediaKeyEvent> get onKeyAdded => keyAddedEvent.forTarget(this);
+
+ @DomName('MediaKeySession.onwebkitkeyerror')
+ @DocsEditable
+ Stream<MediaKeyEvent> get onKeyError => keyErrorEvent.forTarget(this);
+
+ @DomName('MediaKeySession.onwebkitkeymessage')
+ @DocsEditable
+ Stream<MediaKeyEvent> get onKeyMessage => keyMessageEvent.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
@@ -16402,6 +16320,10 @@
class MetaElement extends _Element_Merged {
MetaElement.internal() : super.internal();
+ @DomName('HTMLMetaElement.HTMLMetaElement')
+ @DocsEditable
+ factory MetaElement() => document.$dom_createElement("meta");
+
@DomName('HTMLMetaElement.content')
@DocsEditable
String get content native "HTMLMetaElement_content_Getter";
@@ -16547,35 +16469,47 @@
@DocsEditable
@DomName('MIDIAccess')
-@Experimental // untriaged
+// http://webaudio.github.io/web-midi-api/#midiaccess-interface
+@Experimental
class MidiAccess extends EventTarget {
MidiAccess.internal() : super.internal();
+ @DomName('MIDIAccess.connectEvent')
+ @DocsEditable
+ static const EventStreamProvider<MidiConnectionEvent> connectEvent = const EventStreamProvider<MidiConnectionEvent>('connect');
+
+ @DomName('MIDIAccess.disconnectEvent')
+ @DocsEditable
+ static const EventStreamProvider<MidiConnectionEvent> disconnectEvent = const EventStreamProvider<MidiConnectionEvent>('disconnect');
+
@DomName('MIDIAccess.addEventListener')
@DocsEditable
- @Experimental // untriaged
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native "MIDIAccess_addEventListener_Callback";
@DomName('MIDIAccess.dispatchEvent')
@DocsEditable
- @Experimental // untriaged
bool dispatchEvent(Event event) native "MIDIAccess_dispatchEvent_Callback";
@DomName('MIDIAccess.inputs')
@DocsEditable
- @Experimental // untriaged
List<MidiInput> inputs() native "MIDIAccess_inputs_Callback";
@DomName('MIDIAccess.outputs')
@DocsEditable
- @Experimental // untriaged
List<MidiOutput> outputs() native "MIDIAccess_outputs_Callback";
@DomName('MIDIAccess.removeEventListener')
@DocsEditable
- @Experimental // untriaged
void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native "MIDIAccess_removeEventListener_Callback";
+ @DomName('MIDIAccess.onconnect')
+ @DocsEditable
+ Stream<MidiConnectionEvent> get onConnect => connectEvent.forTarget(this);
+
+ @DomName('MIDIAccess.ondisconnect')
+ @DocsEditable
+ Stream<MidiConnectionEvent> get onDisconnect => disconnectEvent.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
@@ -16610,6 +16544,14 @@
class MidiInput extends MidiPort implements EventTarget {
MidiInput.internal() : super.internal();
+ @DomName('MIDIInput.midimessageEvent')
+ @DocsEditable
+ static const EventStreamProvider<MidiMessageEvent> midiMessageEvent = const EventStreamProvider<MidiMessageEvent>('midimessage');
+
+ @DomName('MIDIInput.onmidimessage')
+ @DocsEditable
+ Stream<MidiMessageEvent> get onMidiMessage => midiMessageEvent.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
@@ -16811,7 +16753,6 @@
@DomName('MimeTypeArray.__getter__')
@DocsEditable
- @Experimental // untriaged
MimeType __getter__(String name) native "MimeTypeArray___getter___Callback";
@DomName('MimeTypeArray.item')
@@ -17285,7 +17226,6 @@
@DomName('WebKitNamedFlowCollection.__getter__')
@DocsEditable
- @Experimental // untriaged
NamedFlow __getter__(String name) native "DOMNamedFlowCollection___getter___Callback";
@DomName('WebKitNamedFlowCollection.item')
@@ -17502,17 +17442,14 @@
@DomName('NavigatorUserMediaError.constraintName')
@DocsEditable
- @Experimental // untriaged
String get constraintName native "NavigatorUserMediaError_constraintName_Getter";
@DomName('NavigatorUserMediaError.message')
@DocsEditable
- @Experimental // untriaged
String get message native "NavigatorUserMediaError_message_Getter";
@DomName('NavigatorUserMediaError.name')
@DocsEditable
- @Experimental // untriaged
String get name native "NavigatorUserMediaError_name_Getter";
}
@@ -18518,12 +18455,10 @@
@DomName('HTMLObjectElement.__getter__')
@DocsEditable
- @Experimental // untriaged
bool __getter__(index_OR_name) native "HTMLObjectElement___getter___Callback";
@DomName('HTMLObjectElement.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(index_OR_name, Node value) native "HTMLObjectElement___setter___Callback";
@DomName('HTMLObjectElement.checkValidity')
@@ -19303,7 +19238,6 @@
@DomName('Plugin.__getter__')
@DocsEditable
- @Experimental // untriaged
MimeType __getter__(String name) native "Plugin___getter___Callback";
@DomName('Plugin.item')
@@ -19379,7 +19313,6 @@
@DomName('PluginArray.__getter__')
@DocsEditable
- @Experimental // untriaged
Plugin __getter__(String name) native "PluginArray___getter___Callback";
@DomName('PluginArray.item')
@@ -19616,6 +19549,10 @@
class QuoteElement extends _Element_Merged {
QuoteElement.internal() : super.internal();
+ @DomName('HTMLQuoteElement.HTMLQuoteElement')
+ @DocsEditable
+ factory QuoteElement() => document.$dom_createElement("q");
+
@DomName('HTMLQuoteElement.cite')
@DocsEditable
String get cite native "HTMLQuoteElement_cite_Getter";
@@ -19862,13 +19799,13 @@
@DocsEditable
@DomName('ResourceProgressEvent')
-@Experimental // untriaged
+// https://chromiumcodereview.appspot.com/14773025/
+@deprecated // experimental
class ResourceProgressEvent extends ProgressEvent {
ResourceProgressEvent.internal() : super.internal();
@DomName('ResourceProgressEvent.url')
@DocsEditable
- @Experimental // untriaged
String get url native "ResourceProgressEvent_url_Getter";
}
@@ -20462,7 +20399,6 @@
@DomName('RTCStatsResponse.__getter__')
@DocsEditable
- @Experimental // untriaged
RtcStatsReport __getter__(String name) native "RTCStatsResponse___getter___Callback";
@DomName('RTCStatsResponse.namedItem')
@@ -20868,7 +20804,6 @@
@DomName('HTMLSelectElement.__setter__')
@DocsEditable
- @Experimental // untriaged
void __setter__(int index, OptionElement value) native "HTMLSelectElement___setter___Callback";
@DomName('HTMLSelectElement.checkValidity')
@@ -21048,6 +20983,10 @@
class ShadowElement extends _Element_Merged {
ShadowElement.internal() : super.internal();
+ @DomName('HTMLShadowElement.HTMLShadowElement')
+ @DocsEditable
+ factory ShadowElement() => document.$dom_createElement("shadow");
+
/// Checks if this type is supported on the current platform.
static bool get supported => true;
@@ -26697,7 +26636,7 @@
@DocsEditable
@DomName('Entity')
-@Experimental // untriaged
+@deprecated // deprecated
class _Entity extends Node {
_Entity.internal() : super.internal();
@@ -27157,7 +27096,6 @@
@DomName('NamedNodeMap.__getter__')
@DocsEditable
- @Experimental // untriaged
Node __getter__(String name) native "NamedNodeMap___getter___Callback";
@DomName('NamedNodeMap.getNamedItem')
@@ -27481,7 +27419,6 @@
@DomName('StyleSheetList.__getter__')
@DocsEditable
- @Experimental // untriaged
CssStyleSheet __getter__(String name) native "StyleSheetList___getter___Callback";
@DomName('StyleSheetList.item')
@@ -27497,184 +27434,6 @@
@DocsEditable
-@DomName('WebKitCSSFilterValue')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSFilterValue extends _CssValueList {
- _WebKitCSSFilterValue.internal() : super.internal();
-
-}
-// 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('WebKitCSSMatrix')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSMatrix extends NativeFieldWrapperClass1 {
- _WebKitCSSMatrix.internal();
-
- @DomName('WebKitCSSMatrix.WebKitCSSMatrix')
- @DocsEditable
- factory _WebKitCSSMatrix([String cssValue]) {
- return _WebKitCSSMatrix._create_1(cssValue);
- }
-
- @DocsEditable
- static _WebKitCSSMatrix _create_1(cssValue) native "WebKitCSSMatrix__create_1constructorCallback";
-
-}
-// 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('WebKitCSSMixFunctionValue')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSMixFunctionValue extends _CssValueList {
- _WebKitCSSMixFunctionValue.internal() : super.internal();
-
-}
-// 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('WebKitCSSTransformValue')
-// http://dev.w3.org/csswg/cssom/
-@deprecated // deprecated
-abstract class _WebKitCSSTransformValue extends _CssValueList {
- _WebKitCSSTransformValue.internal() : super.internal();
-
-}
-// 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('WebKitCSSFilterRule')
-// http://www.w3.org/TR/filter-effects/
-@Experimental
-class _WebKitCssFilterRule extends CssRule {
- _WebKitCssFilterRule.internal() : super.internal();
-
- @DomName('WebKitCSSFilterRule.style')
- @DocsEditable
- CssStyleDeclaration get style native "WebKitCSSFilterRule_style_Getter";
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
-
-@DocsEditable
-@DomName('WebKitCSSKeyframeRule')
-// http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface
-@Experimental
-class _WebKitCssKeyframeRule extends CssRule {
- _WebKitCssKeyframeRule.internal() : super.internal();
-
- @DomName('WebKitCSSKeyframeRule.keyText')
- @DocsEditable
- String get keyText native "WebKitCSSKeyframeRule_keyText_Getter";
-
- @DomName('WebKitCSSKeyframeRule.keyText')
- @DocsEditable
- void set keyText(String value) native "WebKitCSSKeyframeRule_keyText_Setter";
-
- @DomName('WebKitCSSKeyframeRule.style')
- @DocsEditable
- CssStyleDeclaration get style native "WebKitCSSKeyframeRule_style_Getter";
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// WARNING: Do not edit - generated code.
-
-
-@DocsEditable
-@DomName('WebKitCSSKeyframesRule')
-// http://www.w3.org/TR/css3-animations/#csskeyframesrule
-@Experimental
-class _WebKitCssKeyframesRule extends CssRule {
- _WebKitCssKeyframesRule.internal() : super.internal();
-
- @DomName('WebKitCSSKeyframesRule.cssRules')
- @DocsEditable
- List<CssRule> get cssRules native "WebKitCSSKeyframesRule_cssRules_Getter";
-
- @DomName('WebKitCSSKeyframesRule.name')
- @DocsEditable
- String get name native "WebKitCSSKeyframesRule_name_Getter";
-
- @DomName('WebKitCSSKeyframesRule.name')
- @DocsEditable
- void set name(String value) native "WebKitCSSKeyframesRule_name_Setter";
-
- @DomName('WebKitCSSKeyframesRule.__getter__')
- @DocsEditable
- @Experimental // untriaged
- _WebKitCssKeyframeRule __getter__(int index) native "WebKitCSSKeyframesRule___getter___Callback";
-
- @DomName('WebKitCSSKeyframesRule.deleteRule')
- @DocsEditable
- void deleteRule(String key) native "WebKitCSSKeyframesRule_deleteRule_Callback";
-
- @DomName('WebKitCSSKeyframesRule.findRule')
- @DocsEditable
- _WebKitCssKeyframeRule findRule(String key) native "WebKitCSSKeyframesRule_findRule_Callback";
-
- @DomName('WebKitCSSKeyframesRule.insertRule')
- @DocsEditable
- void insertRule(String rule) native "WebKitCSSKeyframesRule_insertRule_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('WebKitCSSRegionRule')
-// http://dev.w3.org/csswg/css-regions/#region-style-rule-interface
-@Experimental
-class _WebKitCssRegionRule extends CssRule {
- _WebKitCssRegionRule.internal() : super.internal();
-
- @DomName('WebKitCSSRegionRule.cssRules')
- @DocsEditable
- List<CssRule> get cssRules native "WebKitCSSRegionRule_cssRules_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('WorkerContext')
// http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#WorkerGlobalScope-partial
@Experimental // stable
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index ee98234..9dd0d9a 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -171,10 +171,14 @@
@DomName('IDBCursor.primaryKey')
@DocsEditable
+ @_annotation_Creates_IDBKey
+ @_annotation_Returns_IDBKey
final Object primaryKey;
@DomName('IDBCursor.source')
@DocsEditable
+ @Creates('Null')
+ @Returns('ObjectStore|Index|Null')
final dynamic source;
@DomName('IDBCursor.advance')
@@ -291,6 +295,8 @@
@DomName('IDBDatabase.version')
@DocsEditable
+ @Creates('int|String|Null')
+ @Returns('int|String|Null')
final dynamic version;
@JSName('addEventListener')
@@ -588,6 +594,7 @@
@DomName('IDBIndex.keyPath')
@DocsEditable
+ @annotation_Creates_SerializedScriptValue
final dynamic keyPath;
@DomName('IDBIndex.multiEntry')
@@ -674,6 +681,7 @@
@DomName('IDBKeyRange.lower')
@DocsEditable
+ @annotation_Creates_SerializedScriptValue
final Object lower;
@DomName('IDBKeyRange.lowerOpen')
@@ -682,6 +690,7 @@
@DomName('IDBKeyRange.upper')
@DocsEditable
+ @annotation_Creates_SerializedScriptValue
final Object upper;
@DomName('IDBKeyRange.upperOpen')
@@ -862,6 +871,7 @@
@DomName('IDBObjectStore.keyPath')
@DocsEditable
+ @annotation_Creates_SerializedScriptValue
final dynamic keyPath;
@DomName('IDBObjectStore.name')
@@ -1249,10 +1259,14 @@
@DomName('IDBVersionChangeEvent.newVersion')
@DocsEditable
+ @Creates('int|String|Null')
+ @Returns('int|String|Null')
final dynamic newVersion;
@DomName('IDBVersionChangeEvent.oldVersion')
@DocsEditable
+ @Creates('int|String|Null')
+ @Returns('int|String|Null')
final dynamic oldVersion;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
diff --git a/sdk/lib/io/common.dart b/sdk/lib/io/common.dart
index 3fcee62..31ce72b 100644
--- a/sdk/lib/io/common.dart
+++ b/sdk/lib/io/common.dart
@@ -31,19 +31,26 @@
case _OSERROR_RESPONSE:
var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
response[_OSERROR_RESPONSE_ERROR_CODE]);
- return new FileIOException(message, err);
+ return new FileException(message, err);
case _FILE_CLOSED_RESPONSE:
- return new FileIOException("File closed");
+ return new FileException("File closed");
default:
return new Exception("Unknown error");
}
}
/**
+ * Base class for all IO related exceptions.
+ */
+abstract class IOException implements Exception {
+ String toString() => "IOException";
+}
+
+/**
* An [OSError] object holds information about an error from the
* operating system.
*/
-class OSError implements Error {
+class OSError {
/** Constant used to indicate that no OS error code is available. */
static const int noErrorCode = -1;
diff --git a/sdk/lib/io/directory.dart b/sdk/lib/io/directory.dart
index dfe5637..c8423b5 100644
--- a/sdk/lib/io/directory.dart
+++ b/sdk/lib/io/directory.dart
@@ -210,13 +210,13 @@
}
-class DirectoryIOException implements Exception {
- const DirectoryIOException([String this.message = "",
+class DirectoryException implements IOException {
+ const DirectoryException([String this.message = "",
String this.path = "",
OSError this.osError = null]);
String toString() {
StringBuffer sb = new StringBuffer();
- sb.write("DirectoryIOException");
+ sb.write("DirectoryException");
if (!message.isEmpty) {
sb.write(": $message");
if (path != null) {
diff --git a/sdk/lib/io/directory_impl.dart b/sdk/lib/io/directory_impl.dart
index 4d51796..cdb6df4 100644
--- a/sdk/lib/io/directory_impl.dart
+++ b/sdk/lib/io/directory_impl.dart
@@ -32,7 +32,7 @@
var result = _setCurrent(path);
if (result is ArgumentError) throw result;
if (result is OSError) {
- throw new DirectoryIOException(
+ throw new DirectoryException(
"Setting current working directory failed", path, result);
}
}
@@ -56,7 +56,7 @@
}
var result = _exists(_path);
if (result is OSError) {
- throw new DirectoryIOException("Exists failed", _path, result);
+ throw new DirectoryException("Exists failed", _path, result);
}
return (result == 1);
}
@@ -155,7 +155,7 @@
if (recursive) return createRecursivelySync();
var result = _create(_path);
if (result is OSError) {
- throw new DirectoryIOException("Creation failed", _path, result);
+ throw new DirectoryException("Creation failed", _path, result);
}
}
@@ -179,7 +179,7 @@
}
var result = _createTemp(path);
if (result is OSError) {
- throw new DirectoryIOException("Creation of temporary directory failed",
+ throw new DirectoryException("Creation of temporary directory failed",
_path,
result);
}
@@ -209,7 +209,7 @@
}
var result = _delete(_path, recursive);
if (result is OSError) {
- throw new DirectoryIOException("Deletion failed", _path, result);
+ throw new DirectoryException("Deletion failed", _path, result);
}
}
@@ -233,7 +233,7 @@
}
var result = _rename(_path, newPath);
if (result is OSError) {
- throw new DirectoryIOException("Rename failed", _path, result);
+ throw new DirectoryException("Rename failed", _path, result);
}
return new Directory(newPath);
}
@@ -261,7 +261,7 @@
responsePort.receive((message, replyTo) {
if (message is !List || message[RESPONSE_TYPE] is !int) {
responsePort.close();
- controller.addError(new DirectoryIOException("Internal error"));
+ controller.addError(new DirectoryException("Internal error"));
return;
}
switch (message[RESPONSE_TYPE]) {
@@ -287,11 +287,11 @@
var errorPath = message[RESPONSE_PATH];
if (errorPath == null) errorPath = path;
controller.addError(
- new DirectoryIOException("Directory listing failed",
+ new DirectoryException("Directory listing failed",
errorPath,
err));
} else {
- controller.addError(new DirectoryIOException("Internal error"));
+ controller.addError(new DirectoryException("Internal error"));
}
break;
case LIST_DONE:
@@ -327,7 +327,7 @@
case _OSERROR_RESPONSE:
var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
response[_OSERROR_RESPONSE_ERROR_CODE]);
- return new DirectoryIOException(message, _path, err);
+ return new DirectoryException(message, _path, err);
default:
return new Exception("Unknown error");
}
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index 455aa48..ac1a268 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -60,7 +60,7 @@
* by [createSync]. Calling [createSync] on an existing file might fail
* if there are restrictive permissions on the file.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void createSync();
@@ -75,7 +75,7 @@
* Synchronously delete the file. Only a file or a link to a file
* can be deleted with this method, not a directory or a broken link.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void deleteSync();
@@ -94,7 +94,7 @@
/**
* Synchronously get the length of the file.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
int lengthSync();
@@ -109,7 +109,7 @@
* Get the last-modified time of the file. Throws an exception
* if the file does not exist.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
DateTime lastModifiedSync();
@@ -140,7 +140,7 @@
*
* See [open] for information on the [mode] argument.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
RandomAccessFile openSync({FileMode mode: FileMode.READ});
@@ -153,7 +153,7 @@
/**
* Synchronously get the canonical full path corresponding to the file path.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
String fullPathSync();
@@ -201,7 +201,7 @@
/**
* Synchronously read the entire file contents as a list of bytes.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
List<int> readAsBytesSync();
@@ -218,7 +218,7 @@
* Synchronously read the entire file contents as a string using the
* given [Encoding].
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
String readAsStringSync({Encoding encoding: Encoding.UTF_8});
@@ -235,7 +235,7 @@
* Synchronously read the entire file contents as lines of text
* using the given [Encoding].
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
List<String> readAsLinesSync({Encoding encoding: Encoding.UTF_8});
@@ -261,7 +261,7 @@
* the file if it already exists. In order to append the bytes to an existing
* file, pass [FileMode.APPEND] as the optional mode parameter.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void writeAsBytesSync(List<int> bytes, {FileMode mode: FileMode.WRITE});
@@ -291,7 +291,7 @@
* to an existing file, pass [FileMode.APPEND] as the optional mode
* parameter.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void writeAsStringSync(String contents,
{FileMode mode: FileMode.WRITE,
@@ -319,7 +319,7 @@
/**
* Synchronously closes the file.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void closeSync();
@@ -333,7 +333,7 @@
* Synchronously reads a single byte from the file. If end-of-file
* has been reached -1 is returned.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
int readByteSync();
@@ -346,7 +346,7 @@
* Synchronously reads a maximum of [bytes] bytes from a file and
* returns the result in a list of bytes.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
List<int> readSync(int bytes);
@@ -368,7 +368,7 @@
* read into [buffer], otherwise up to [buffer.length]. If [end] == [start]
* nothing happends.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
int readIntoSync(List<int> buffer, [int start, int end]);
@@ -383,7 +383,7 @@
* Synchronously writes a single byte to the file. Returns the
* number of bytes successfully written.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
int writeByteSync(int value);
@@ -403,7 +403,7 @@
* start from index 0. If [end] is omitted, it will write to the end of
* [buffer].
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void writeFromSync(List<int> buffer, [int start, int end]);
@@ -419,7 +419,7 @@
* Synchronously writes a single string to the file using the given
* [Encoding].
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void writeStringSync(String string,
{Encoding encoding: Encoding.UTF_8});
@@ -433,7 +433,7 @@
/**
* Synchronously gets the current byte position in the file.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
int positionSync();
@@ -447,7 +447,7 @@
/**
* Synchronously sets the byte position in the file.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void setPositionSync(int position);
@@ -461,7 +461,7 @@
/**
* Synchronously truncates (or extends) the file to [length] bytes.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void truncateSync(int length);
@@ -474,7 +474,7 @@
/**
* Synchronously gets the length of the file.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
int lengthSync();
@@ -488,7 +488,7 @@
/**
* Synchronously flushes the contents of the file to disk.
*
- * Throws a [FileIOException] if the operation fails.
+ * Throws a [FileException] if the operation fails.
*/
void flushSync();
@@ -504,12 +504,12 @@
}
-class FileIOException implements Exception {
- const FileIOException([String this.message = "",
+class FileException implements IOException {
+ const FileException([String this.message = "",
OSError this.osError = null]);
String toString() {
StringBuffer sb = new StringBuffer();
- sb.write("FileIOException");
+ sb.write("FileException");
if (!message.isEmpty) {
sb.write(": $message");
if (osError != null) {
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index b855fef..34808d8 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -393,7 +393,7 @@
if (mode != FileMode.READ &&
mode != FileMode.WRITE &&
mode != FileMode.APPEND) {
- throw new FileIOException("Unknown file mode. Use FileMode.READ, "
+ throw new FileException("Unknown file mode. Use FileMode.READ, "
"FileMode.WRITE or FileMode.APPEND.");
}
var id = _open(_path, mode._mode);
@@ -406,7 +406,7 @@
static RandomAccessFile _openStdioSync(int fd) {
var id = _openStdio(fd);
if (id == 0) {
- throw new FileIOException("Cannot open stdio file for: $fd");
+ throw new FileException("Cannot open stdio file for: $fd");
}
return new _RandomAccessFile(id, "");
}
@@ -442,7 +442,7 @@
Encoding encoding: Encoding.UTF_8}) {
if (mode != FileMode.WRITE &&
mode != FileMode.APPEND) {
- throw new FileIOException(
+ throw new FileException(
"Wrong FileMode. Use FileMode.WRITE or FileMode.APPEND");
}
var consumer = new _FileStreamConsumer(this, mode);
@@ -559,7 +559,7 @@
static throwIfError(Object result, String msg) {
if (result is OSError) {
- throw new FileIOException(msg, result);
+ throw new FileException(msg, result);
}
}
@@ -586,7 +586,7 @@
_id = result;
return this;
} else {
- throw new FileIOException("Cannot close file '$_path'");
+ throw new FileException("Cannot close file '$_path'");
}
});
}
@@ -597,7 +597,7 @@
_checkNotClosed();
var id = _close(_id);
if (id == -1) {
- throw new FileIOException("Cannot close file '$_path'");
+ throw new FileException("Cannot close file '$_path'");
}
_id = id;
}
@@ -623,7 +623,7 @@
_checkNotClosed();
var result = _readByte(_id);
if (result is OSError) {
- throw new FileIOException("readByte failed for file '$_path'", result);
+ throw new FileException("readByte failed for file '$_path'", result);
}
return result;
}
@@ -631,7 +631,7 @@
Future<List<int>> read(int bytes) {
_ensureFileService();
if (bytes is !int) {
- return new Future.error(new FileIOException(
+ return new Future.error(new FileException(
"Invalid arguments to read for file '$_path'"));
}
if (closed) return _closedException();
@@ -653,12 +653,12 @@
List<int> readSync(int bytes) {
_checkNotClosed();
if (bytes is !int) {
- throw new FileIOException(
+ throw new FileException(
"Invalid arguments to readSync for file '$_path'");
}
var result = _read(_id, bytes);
if (result is OSError) {
- throw new FileIOException("readSync failed for file '$_path'",
+ throw new FileException("readSync failed for file '$_path'",
result);
}
return result;
@@ -669,7 +669,7 @@
if (buffer is !List ||
(start != null && start is !int) ||
(end != null && end is !int)) {
- return new Future.error(new FileIOException(
+ return new Future.error(new FileException(
"Invalid arguments to readInto for file '$_path'"));
};
if (closed) return _closedException();
@@ -706,7 +706,7 @@
if (buffer is !List ||
(start != null && start is !int) ||
(end != null && end is !int)) {
- throw new FileIOException(
+ throw new FileException(
"Invalid arguments to readInto for file '$_path'");
}
if (start == null) start = 0;
@@ -715,7 +715,7 @@
_checkReadWriteListArguments(buffer.length, start, end);
var result = _readInto(_id, buffer, start, end);
if (result is OSError) {
- throw new FileIOException("readInto failed for file '$_path'",
+ throw new FileException("readInto failed for file '$_path'",
result);
}
return result;
@@ -724,7 +724,7 @@
Future<RandomAccessFile> writeByte(int value) {
_ensureFileService();
if (value is !int) {
- return new Future.error(new FileIOException(
+ return new Future.error(new FileException(
"Invalid argument to writeByte for file '$_path'"));
}
if (closed) return _closedException();
@@ -746,12 +746,12 @@
int writeByteSync(int value) {
_checkNotClosed();
if (value is !int) {
- throw new FileIOException(
+ throw new FileException(
"Invalid argument to writeByte for file '$_path'");
}
var result = _writeByte(_id, value);
if (result is OSError) {
- throw new FileIOException("writeByte failed for file '$_path'",
+ throw new FileException("writeByte failed for file '$_path'",
result);
}
return result;
@@ -762,7 +762,7 @@
if ((buffer is !List && buffer is !ByteData) ||
(start != null && start is !int) ||
(end != null && end is !int)) {
- return new Future.error(new FileIOException(
+ return new Future.error(new FileException(
"Invalid arguments to writeFrom for file '$_path'"));
}
@@ -797,7 +797,7 @@
if (buffer is !List ||
(start != null && start is !int) ||
(end != null && end is !int)) {
- throw new FileIOException(
+ throw new FileException(
"Invalid arguments to writeFrom for file '$_path'");
}
if (start == null) start = 0;
@@ -811,14 +811,14 @@
bufferAndStart.start,
end - (start - bufferAndStart.start));
if (result is OSError) {
- throw new FileIOException("writeFrom failed for file '$_path'", result);
+ throw new FileException("writeFrom failed for file '$_path'", result);
}
}
Future<RandomAccessFile> writeString(String string,
{Encoding encoding: Encoding.UTF_8}) {
if (encoding is! Encoding) {
- return new Future.error(new FileIOException(
+ return new Future.error(new FileException(
"Invalid encoding in writeString: $encoding"));
}
var data = _encodeString(string, encoding);
@@ -827,7 +827,7 @@
void writeStringSync(String string, {Encoding encoding: Encoding.UTF_8}) {
if (encoding is! Encoding) {
- throw new FileIOException(
+ throw new FileException(
"Invalid encoding in writeStringSync: $encoding");
}
var data = _encodeString(string, encoding);
@@ -855,7 +855,7 @@
_checkNotClosed();
var result = _position(_id);
if (result is OSError) {
- throw new FileIOException("position failed for file '$_path'", result);
+ throw new FileException("position failed for file '$_path'", result);
}
return result;
}
@@ -882,7 +882,7 @@
_checkNotClosed();
var result = _setPosition(_id, position);
if (result is OSError) {
- throw new FileIOException("setPosition failed for file '$_path'", result);
+ throw new FileException("setPosition failed for file '$_path'", result);
}
}
@@ -908,7 +908,7 @@
_checkNotClosed();
var result = _truncate(_id, length);
if (result is OSError) {
- throw new FileIOException("truncate failed for file '$_path'", result);
+ throw new FileException("truncate failed for file '$_path'", result);
}
}
@@ -933,7 +933,7 @@
_checkNotClosed();
var result = _length(_id);
if (result is OSError) {
- throw new FileIOException("length failed for file '$_path'", result);
+ throw new FileException("length failed for file '$_path'", result);
}
return result;
}
@@ -959,7 +959,7 @@
_checkNotClosed();
var result = _flush(_id);
if (result is OSError) {
- throw new FileIOException("flush failed for file '$_path'", result);
+ throw new FileException("flush failed for file '$_path'", result);
}
}
@@ -975,12 +975,12 @@
void _checkNotClosed() {
if (closed) {
- throw new FileIOException("File closed '$_path'");
+ throw new FileException("File closed '$_path'");
}
}
Future _closedException() {
- return new Future.error(new FileIOException("File closed '$_path'"));
+ return new Future.error(new FileException("File closed '$_path'"));
}
final String _path;
diff --git a/sdk/lib/io/file_system_entity.dart b/sdk/lib/io/file_system_entity.dart
index 0a1ee9e..1723508 100644
--- a/sdk/lib/io/file_system_entity.dart
+++ b/sdk/lib/io/file_system_entity.dart
@@ -371,7 +371,7 @@
static _throwIfError(Object result, String msg) {
if (result is OSError) {
- throw new FileIOException(msg, result);
+ throw new FileException(msg, result);
} else if (result is ArgumentError) {
throw result;
}
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 4ea77f7..b045c11 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -171,6 +171,16 @@
* current connections handled by the server.
*/
HttpConnectionsInfo connectionsInfo();
+
+ /**
+ * Set and get the default value of the `Server` header for all responses
+ * generated by this [HttpServer]. The default value is
+ * `Dart/<version> (dart:io)`.
+ *
+ * If the serverHeader is set to `null`, no default `Server` header will be
+ * added to each response.
+ */
+ String serverHeader;
}
@@ -879,6 +889,16 @@
*/
Duration idleTimeout;
+ /**
+ * Set and get the default value of the `User-Agent` header for all requests
+ * generated by this [HttpClient]. The default value is
+ * `Dart/<version> (dart:io)`.
+ *
+ * If the userAgent is set to `null`, no default `User-Agent` header will be
+ * added to each request.
+ */
+ String userAgent;
+
factory HttpClient() => new _HttpClient();
/**
@@ -1174,8 +1194,9 @@
/**
* Set this property to the maximum number of redirects to follow
* when [followRedirects] is [:true:]. If this number is exceeded the
- * [onError] callback will be called with a [RedirectLimitExceeded]
- * exception. The default value is 5.
+ * [onError] callback will be called with a [RedirectException].
+ *
+ * The default value is 5.
*/
int maxRedirects;
@@ -1353,27 +1374,21 @@
}
-class HttpException implements Exception {
- const HttpException([String this.message = ""]);
- String toString() => "HttpException: $message";
+class HttpException implements IOException {
final String message;
+
+ const HttpException([String this.message = ""]);
+
+ String toString() => "HttpException: $message";
}
-class RedirectException extends HttpException {
- const RedirectException(String message,
- List<RedirectInfo> this.redirects) : super(message);
+class RedirectException implements HttpException {
+ final String message;
final List<RedirectInfo> redirects;
-}
+ const RedirectException(String this.message,
+ List<RedirectInfo> this.redirects);
-class RedirectLimitExceededException extends RedirectException {
- const RedirectLimitExceededException(List<RedirectInfo> redirects)
- : super("Redirect limit exceeded", redirects);
-}
-
-
-class RedirectLoopException extends RedirectException {
- const RedirectLoopException(List<RedirectInfo> redirects)
- : super("Redirect loop detected", redirects);
+ String toString() => "RedirectException: $message";
}
diff --git a/sdk/lib/io/http_body.dart b/sdk/lib/io/http_body.dart
index b6e106b..47a28f0 100644
--- a/sdk/lib/io/http_body.dart
+++ b/sdk/lib/io/http_body.dart
@@ -6,9 +6,67 @@
/**
- * [HttpBodyHandler] is a helper class for parsing and collecting HTTP message
- * data in an easy-to-use [HttpBody] object. The content body is parsed,
- * depending on the 'Content-Type' header field.
+ * [HttpBodyHandler] is a helper class for processing and collecting
+ * HTTP message data in an easy-to-use [HttpBody] object. The content
+ * body is parsed, depending on the `Content-Type` header field. When
+ * the full body is read and parsed the body content is made
+ * available. The class can be used to process both server requests
+ * and client responses.
+ *
+ * The following content types are recognized:
+ *
+ * text/\*
+ * application/json
+ * application/x-www-form-urlencoded
+ * multipart/form-data
+ *
+ * For content type `text/\*` the body is decoded into a string. The
+ * 'charset' parameter of the content type specifies the encoding
+ * used for decoding. If no 'charset' is present the default encoding
+ * of ISO-8859-1 is used.
+ *
+ * For content type `application/json` the body is decoded into a
+ * string which is then parsed as JSON. The resulting body is a
+ * [Map]. The 'charset' parameter of the content type specifies the
+ * encoding used for decoding. If no 'charset' is present the default
+ * encoding of UTF-8 is used.
+ *
+ * For content type `application/x-www-form-urlencoded` the body is a
+ * query string which is then split according to the rules for
+ * splitting a query string. The resulting body is a `Map<String,
+ * String>`. If the same name is present several times in the query
+ * string, then the last value seen for this name will be in the
+ * resulting map. The encoding US-ASCII is always used for decoding
+ * the body.
+ *
+ * For content type `multipart/form-data` the body is parsed into
+ * it's different fields. The resulting body is a `Map<String,
+ * dynamic>`, where the value is a [String] for normal fields and a
+ * [HttpBodyFileUpload] instance for file upload fields. If the same
+ * name is present several times, then the last value seen for this
+ * name will be in the resulting map.
+ *
+ * When using content type `multipart/form-data` the encoding of
+ * fields with [String] values is determined by the browser sending
+ * the HTTP request with the form data. The encoding is specified
+ * either by the attribute `accept-charset` on the HTML form, or by
+ * the content type of the web page containing the form. If the HTML
+ * form has an `accept-charset` attribute the browser will use the
+ * encoding specified there. If the HTML form has no `accept-charset`
+ * attribute the browser determines the encoding from the content
+ * type of the web page containing the form. Using a content type of
+ * `text/html; charset=utf-8` for the page and setting
+ * `accept-charset` on the HTML form to `utf-8` is recommended as the
+ * default for [HttpBodyHandler] is UTF-8. It is important to get
+ * these encoding values right, as the actual `multipart/form-data`
+ * HTTP request sent by the browser does _not_ contain any
+ * information on the encoding. If something else than UTF-8 is used
+ * `defaultEncoding` needs to be set in the [HttpBodyHandler]
+ * constructor and calls to [processRequest] and [processResponse].
+ *
+ * For all other content types the body will be treated as
+ * uninterpreted binary data. The resulting body will be of type
+ * `List<int>`.
*
* To use with the [HttpServer] for request messages, [HttpBodyHandler] can be
* used as either a [StreamTransformer] or as a per-request handler (see
@@ -31,11 +89,6 @@
* ...
* });
*
- * The following mime-types will be handled specially:
- * - text/\*
- * - application/json
- *
- * All other mime-types will be returned as [List<int>].
*/
class HttpBodyHandler
implements StreamTransformer<HttpRequest, HttpRequestBody> {
@@ -45,9 +98,10 @@
* Create a new [HttpBodyHandler] to be used with a [Stream]<[HttpRequest]>,
* e.g. a [HttpServer].
*
- * If the page was served using different encoding than UTF-8, set
+ * If the page is served using different encoding than UTF-8, set
* [defaultEncoding] accordingly. This is required for parsing
- * 'application/x-www-form-urlencoded' content correctly.
+ * `multipart/form-data` content correctly. See the class comment
+ * for more information on `multipart/form-data`.
*/
HttpBodyHandler({Encoding defaultEncoding: Encoding.UTF_8})
: _transformer = new _HttpBodyHandlerTransformer(defaultEncoding);
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 15d7ee8..b272976 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -216,7 +216,7 @@
for (var redirect in redirects) {
if (redirect.location == url) {
return new Future.error(
- new RedirectLoopException(redirects));
+ new RedirectException("Redirect loop detected", redirects));
}
}
}
@@ -573,7 +573,7 @@
},
onError: (error) {
_socketError = true;
- if (error is SocketIOException &&
+ if (error is SocketException &&
_outbound is HttpResponse) {
_cancel();
_done();
@@ -676,8 +676,11 @@
_HttpRequest _httpRequest;
_HttpResponse(String protocolVersion,
- _HttpOutgoing _outgoing)
- : super(protocolVersion, _outgoing);
+ _HttpOutgoing _outgoing,
+ String serverHeader)
+ : super(protocolVersion, _outgoing) {
+ if (serverHeader != null) headers.set('Server', serverHeader);
+ }
List<Cookie> get cookies {
if (_cookies == null) _cookies = new List<Cookie>();
@@ -894,7 +897,8 @@
// End with exception, too many redirects.
future = response.drain()
.then((_) => new Future.error(
- new RedirectLimitExceededException(response.redirects)));
+ new RedirectException("Redirect limit exceeded",
+ response.redirects)));
}
} else if (response._shouldAuthenticateProxy) {
future = response._authenticate(true);
@@ -1149,6 +1153,9 @@
request.headers.host = uri.host;
request.headers.port = port;
request.headers.set(HttpHeaders.ACCEPT_ENCODING, "gzip");
+ if (_httpClient.userAgent != null) {
+ request.headers.set('User-Agent', _httpClient.userAgent);
+ }
if (proxy.isAuthenticated) {
// If the proxy configuration contains user information use that
// for proxy basic authorization.
@@ -1227,10 +1234,8 @@
})
// If we see a state error, we failed to get the 'first'
// element.
- // Transform the error to a HttpParserException, for
- // consistency.
.catchError((error) {
- throw new HttpParserException(
+ throw new HttpException(
"Connection closed before data was received");
}, test: (error) => error is StateError)
.catchError((error) {
@@ -1346,6 +1351,8 @@
Duration get idleTimeout => _idleTimeout;
+ String userAgent = _getHttpVersion();
+
void set idleTimeout(Duration timeout) {
_idleTimeout = timeout;
_idleConnections.values.forEach(
@@ -1356,6 +1363,7 @@
}));
}
+
Future<HttpClientRequest> open(String method,
String host,
int port,
@@ -1755,7 +1763,8 @@
_state = _ACTIVE;
var outgoing = new _HttpOutgoing(_socket);
var response = new _HttpResponse(incoming.headers.protocolVersion,
- outgoing);
+ outgoing,
+ _httpServer.serverHeader);
var request = new _HttpRequest(response, incoming, _httpServer, this);
_streamFuture = outgoing.done
.then((_) {
@@ -1819,6 +1828,7 @@
// HTTP server waiting for socket connections.
class _HttpServer extends Stream<HttpRequest> implements HttpServer {
+ String serverHeader = _getHttpVersion();
static Future<HttpServer> bind(address, int port, int backlog) {
return ServerSocket.bind(address, port, backlog: backlog).then((socket) {
@@ -1842,10 +1852,16 @@
});
}
- _HttpServer._(this._serverSocket, this._closeServer);
+ _HttpServer._(this._serverSocket, this._closeServer) {
+ _controller = new StreamController<HttpRequest>(sync: true,
+ onCancel: close);
+ }
_HttpServer.listenOn(ServerSocket this._serverSocket)
- : _closeServer = false;
+ : _closeServer = false {
+ _controller = new StreamController<HttpRequest>(sync: true,
+ onCancel: close);
+ }
StreamSubscription<HttpRequest> listen(void onData(HttpRequest event),
{void onError(error),
@@ -1937,8 +1953,7 @@
// Set of currently connected clients.
final Set<_HttpConnection> _connections = new Set<_HttpConnection>();
- final StreamController<HttpRequest> _controller
- = new StreamController<HttpRequest>(sync: true);
+ StreamController<HttpRequest> _controller;
// TODO(ajohnsen): Use close queue?
}
@@ -2344,3 +2359,11 @@
final String method;
final Uri location;
}
+
+String _getHttpVersion() {
+ var version = new Options().version;
+ // Only include major and minor version numbers.
+ int index = version.indexOf('.', version.indexOf('.') + 1);
+ version = version.substring(0, index);
+ return 'Dart/$version (dart:io)';
+}
diff --git a/sdk/lib/io/http_parser.dart b/sdk/lib/io/http_parser.dart
index 8edaa0c..bcd27e0 100644
--- a/sdk/lib/io/http_parser.dart
+++ b/sdk/lib/io/http_parser.dart
@@ -273,10 +273,10 @@
assert(!_parserCalled);
_parserCalled = true;
if (_state == _State.CLOSED) {
- throw new HttpParserException("Data on closed connection");
+ throw new HttpException("Data on closed connection");
}
if (_state == _State.FAILURE) {
- throw new HttpParserException("Data on failed connection");
+ throw new HttpException("Data on failed connection");
}
while (_buffer != null &&
_index < _buffer.length &&
@@ -298,11 +298,11 @@
} else {
// Start parsing method.
if (!_isTokenChar(byte)) {
- throw new HttpParserException("Invalid request method");
+ throw new HttpException("Invalid request method");
}
_method_or_status_code.add(byte);
if (!_requestParser) {
- throw new HttpParserException("Invalid response line");
+ throw new HttpException("Invalid response line");
}
_state = _State.REQUEST_LINE_METHOD;
}
@@ -319,7 +319,7 @@
// method anymore.
_httpVersionIndex++;
if (_requestParser) {
- throw new HttpParserException("Invalid request line");
+ throw new HttpException("Invalid request line");
}
_state = _State.RESPONSE_HTTP_VERSION;
} else {
@@ -333,7 +333,7 @@
_method_or_status_code.add(byte);
_httpVersion = _HttpVersion.UNDETERMINED;
if (!_requestParser) {
- throw new HttpParserException("Invalid response line");
+ throw new HttpException("Invalid response line");
}
_state = _State.REQUEST_LINE_METHOD;
}
@@ -362,7 +362,7 @@
// HTTP version parsed.
_state = _State.RESPONSE_LINE_STATUS_CODE;
} else {
- throw new HttpParserException("Invalid response line");
+ throw new HttpException("Invalid response line");
}
break;
@@ -371,7 +371,7 @@
_state = _State.REQUEST_LINE_URI;
} else {
if (_Const.SEPARATORS_AND_CR_LF.indexOf(byte) != -1) {
- throw new HttpParserException("Invalid request method");
+ throw new HttpException("Invalid request method");
}
_method_or_status_code.add(byte);
}
@@ -380,13 +380,13 @@
case _State.REQUEST_LINE_URI:
if (byte == _CharCode.SP) {
if (_uri_or_reason_phrase.length == 0) {
- throw new HttpParserException("Invalid request URI");
+ throw new HttpException("Invalid request URI");
}
_state = _State.REQUEST_LINE_HTTP_VERSION;
_httpVersionIndex = 0;
} else {
if (byte == _CharCode.CR || byte == _CharCode.LF) {
- throw new HttpParserException("Invalid request URI");
+ throw new HttpException("Invalid request URI");
}
_uri_or_reason_phrase.add(byte);
}
@@ -408,7 +408,7 @@
_persistentConnection = false;
_httpVersionIndex++;
} else {
- throw new HttpParserException("Invalid response line");
+ throw new HttpException("Invalid response line");
}
} else {
_expect(byte, _CharCode.CR);
@@ -425,12 +425,12 @@
case _State.RESPONSE_LINE_STATUS_CODE:
if (byte == _CharCode.SP) {
if (_method_or_status_code.length != 3) {
- throw new HttpParserException("Invalid response status code");
+ throw new HttpException("Invalid response status code");
}
_state = _State.RESPONSE_LINE_REASON_PHRASE;
} else {
if (byte < 0x30 && 0x39 < byte) {
- throw new HttpParserException("Invalid response status code");
+ throw new HttpException("Invalid response status code");
} else {
_method_or_status_code.add(byte);
}
@@ -442,7 +442,7 @@
_state = _State.RESPONSE_LINE_ENDING;
} else {
if (byte == _CharCode.CR || byte == _CharCode.LF) {
- throw new HttpParserException("Invalid response reason phrase");
+ throw new HttpException("Invalid response reason phrase");
}
_uri_or_reason_phrase.add(byte);
}
@@ -454,7 +454,7 @@
_statusCode = int.parse(
new String.fromCharCodes(_method_or_status_code));
if (_statusCode < 100 || _statusCode > 599) {
- throw new HttpParserException("Invalid response status code");
+ throw new HttpException("Invalid response status code");
} else {
// Check whether this response will never have a body.
_noMessageBody = _statusCode <= 199 || _statusCode == 204 ||
@@ -479,7 +479,7 @@
_state = _State.HEADER_VALUE_START;
} else {
if (!_isTokenChar(byte)) {
- throw new HttpParserException("Invalid header field name");
+ throw new HttpException("Invalid header field name");
}
_headerField.add(_toLowerCase(byte));
}
@@ -728,8 +728,7 @@
!(_state == _State.START && !_requestParser) &&
!(_state == _State.BODY && !_chunked && _transferLength == -1)) {
_bodyController.addError(
- new HttpParserException(
- "Connection closed while receiving data"));
+ new HttpException("Connection closed while receiving data"));
}
_closeIncoming(true);
_controller.close();
@@ -738,7 +737,7 @@
// If the connection is idle the HTTP stream is closed.
if (_state == _State.START) {
if (!_requestParser) {
- error(new HttpParserException(
+ error(new HttpException(
"Connection closed before full header was received"));
}
_controller.close();
@@ -754,7 +753,7 @@
_state = _State.FAILURE;
// Report the error through the error callback if any. Otherwise
// throw the error.
- error(new HttpParserException(
+ error(new HttpException(
"Connection closed before full header was received"));
_controller.close();
return;
@@ -766,7 +765,7 @@
_state = _State.FAILURE;
// Report the error through the error callback if any. Otherwise
// throw the error.
- error(new HttpParserException(
+ error(new HttpException(
"Connection closed before full body was received"));
}
_controller.close();
@@ -863,7 +862,7 @@
int _expect(int val1, int val2) {
if (val1 != val2) {
- throw new HttpParserException("Failed to parse HTTP");
+ throw new HttpException("Failed to parse HTTP");
}
}
@@ -875,7 +874,7 @@
} else if (0x61 <= byte && byte <= 0x66) {
return byte - 0x61 + 10; // a - f
} else {
- throw new HttpParserException("Failed to parse HTTP");
+ throw new HttpException("Failed to parse HTTP");
}
}
@@ -988,10 +987,3 @@
StreamController<_HttpIncoming> _controller;
StreamController<List<int>> _bodyController;
}
-
-
-class HttpParserException implements Exception {
- const HttpParserException([String this.message = ""]);
- String toString() => "HttpParserException: $message";
- final String message;
-}
diff --git a/sdk/lib/io/link.dart b/sdk/lib/io/link.dart
index ddca031..955622f 100644
--- a/sdk/lib/io/link.dart
+++ b/sdk/lib/io/link.dart
@@ -68,7 +68,7 @@
* the link when it has been deleted. This does not delete, or otherwise
* affect, the target of the link. It also works on broken links, but if
* the link does not exist or is not actually a link, it completes the
- * future with a LinkIOException.
+ * future with a LinkException.
*/
Future<Link> delete();
@@ -76,7 +76,7 @@
* Synchronously deletes the link. This does not delete, or otherwise
* affect, the target of the link. It also works on broken links, but if
* the link does not exist or is not actually a link, it throws a
- * LinkIOException.
+ * LinkException.
*/
void deleteSync();
@@ -88,7 +88,7 @@
* directory containing the link.
*
* If the link does not exist, or is not a link, the future completes with
- * a LinkIOException.
+ * a LinkException.
*/
Future<String> target();
@@ -98,7 +98,7 @@
* If the returned target is a relative path, it is relative to the
* directory containing the link.
*
- * If the link does not exist, or is not a link, throws a LinkIOException.
+ * If the link does not exist, or is not a link, throws a LinkException.
*/
String targetSync();
}
@@ -213,7 +213,7 @@
static throwIfError(Object result, String msg) {
if (result is OSError) {
- throw new LinkIOException(msg, result);
+ throw new LinkException(msg, result);
}
}
@@ -235,7 +235,7 @@
case _OSERROR_RESPONSE:
var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
response[_OSERROR_RESPONSE_ERROR_CODE]);
- return new LinkIOException(message, err);
+ return new LinkException(message, err);
default:
return new Exception("Unknown error");
}
@@ -243,13 +243,13 @@
}
-class LinkIOException implements Exception {
- const LinkIOException([String this.message = "",
+class LinkException implements IOException {
+ const LinkException([String this.message = "",
String this.path = "",
OSError this.osError = null]);
String toString() {
StringBuffer sb = new StringBuffer();
- sb.write("LinkIOException");
+ sb.write("LinkException");
if (!message.isEmpty) {
sb.write(": $message");
if (path != null) {
diff --git a/sdk/lib/io/mime_multipart_parser.dart b/sdk/lib/io/mime_multipart_parser.dart
index 1e3c548..e4d8f8a 100644
--- a/sdk/lib/io/mime_multipart_parser.dart
+++ b/sdk/lib/io/mime_multipart_parser.dart
@@ -398,7 +398,7 @@
}
-class MimeMultipartException implements Exception {
+class MimeMultipartException implements IOException {
const MimeMultipartException([String this.message = ""]);
String toString() => "MimeMultipartException: $message";
final String message;
diff --git a/sdk/lib/io/options.dart b/sdk/lib/io/options.dart
index 91a8e58..7b483e5 100644
--- a/sdk/lib/io/options.dart
+++ b/sdk/lib/io/options.dart
@@ -41,6 +41,12 @@
* string is returned.
*/
String get script;
+
+
+ /**
+ * Returns the version of the current dart runtime.
+ */
+ String get version;
}
class _OptionsImpl implements Options {
@@ -60,6 +66,8 @@
return _nativeScript;
}
+ external String get version;
+
List<String> _arguments = null;
// This arguments singleton is written to by the embedder if applicable.
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index a8e7bbc..808bce5 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -255,7 +255,7 @@
}
-class ProcessException implements Exception {
+class ProcessException implements IOException {
const ProcessException(String this.executable,
List<String> this.arguments,
[String this.message = "",
diff --git a/sdk/lib/io/secure_server_socket.dart b/sdk/lib/io/secure_server_socket.dart
index 18966a3..e9da3c6 100644
--- a/sdk/lib/io/secure_server_socket.dart
+++ b/sdk/lib/io/secure_server_socket.dart
@@ -227,18 +227,14 @@
_controller.add(secureConnection);
}
}).catchError((e) {
- if (_closed) {
- throw e;
- } else {
+ if (!_closed) {
_controller.addError(e);
- close();
}
});
}
void _onError(e) {
_controller.addError(e);
- close();
}
void _onDone() {
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index 0db4e46..05ec18c 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -614,7 +614,7 @@
List<int> read([int len]) {
if (_closedRead) {
- throw new SocketIOException("Reading from a closed socket");
+ throw new SocketException("Reading from a closed socket");
}
if (_status != CONNECTED) {
return null;
@@ -663,7 +663,7 @@
// up handlers to flush the pipeline when possible.
int write(List<int> data, [int offset, int bytes]) {
if (_closedWrite) {
- _controller.addError(new SocketIOException("Writing to a closed socket"));
+ _controller.addError(new SocketException("Writing to a closed socket"));
return 0;
}
if (_status != CONNECTED) return 0;
@@ -750,7 +750,7 @@
} else {
if (_status != CONNECTED) {
// Cannot happen.
- throw new SocketIOException("Internal SocketIO Error");
+ throw new SocketException("Internal SocketIO Error");
}
try {
_readEncryptedData();
@@ -783,12 +783,12 @@
void _reportError(e, String message) {
// TODO(whesse): Call _reportError from all internal functions that throw.
- if (e is SocketIOException) {
- e = new SocketIOException('$message (${e.message})', e.osError);
+ if (e is SocketException) {
+ e = new SocketException('$message (${e.message})', e.osError);
} else if (e is OSError) {
- e = new SocketIOException(message, e);
+ e = new SocketException(message, e);
} else {
- e = new SocketIOException('$message (${e.toString()})', null);
+ e = new SocketException('$message (${e.toString()})', null);
}
if (_connectPending) {
_handshakeComplete.completeError(e);
@@ -811,7 +811,7 @@
}
} else if (_status == HANDSHAKE) {
_reportError(
- new SocketIOException('Connection terminated during handshake'),
+ new SocketException('Connection terminated during handshake'),
'handshake error');
}
}
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index 040cf39..7164bf1 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -409,12 +409,12 @@
}
-class SocketIOException implements Exception {
- const SocketIOException([String this.message = "",
- OSError this.osError = null]);
+class SocketException implements IOException {
+ const SocketException([String this.message = "",
+ OSError this.osError = null]);
String toString() {
StringBuffer sb = new StringBuffer();
- sb.write("SocketIOException");
+ sb.write("SocketException");
if (!message.isEmpty) {
sb.write(": $message");
if (osError != null) {
diff --git a/sdk/lib/io/websocket.dart b/sdk/lib/io/websocket.dart
index 994fdec..370d694 100644
--- a/sdk/lib/io/websocket.dart
+++ b/sdk/lib/io/websocket.dart
@@ -153,7 +153,7 @@
}
-class WebSocketException implements Exception {
+class WebSocketException implements IOException {
const WebSocketException([String this.message = ""]);
String toString() => "WebSocketException: $message";
final String message;
diff --git a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
index 5269d55..a61c68d 100644
--- a/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
+++ b/sdk/lib/web_audio/dart2js/web_audio_dart2js.dart
@@ -340,7 +340,7 @@
ScriptProcessorNode createScriptProcessor(int bufferSize,
[int numberOfInputChannels, int numberOfOutputChannels]) {
- var function = JS('dynamic', '#.createScriptProcessor || '
+ var function = JS('=Object', '#.createScriptProcessor || '
'#.createJavaScriptNode', this, this);
if (numberOfOutputChannels != null) {
return JS('ScriptProcessorNode', '#.call(#, #, #, #)', function, this,
@@ -1050,7 +1050,6 @@
@DomName('WaveShaperNode.oversample')
@DocsEditable
- @Experimental // untriaged
String oversample;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
diff --git a/sdk/lib/web_audio/dartium/web_audio_dartium.dart b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
index 2f3e649..94ece93 100644
--- a/sdk/lib/web_audio/dartium/web_audio_dartium.dart
+++ b/sdk/lib/web_audio/dartium/web_audio_dartium.dart
@@ -1316,12 +1316,10 @@
@DomName('WaveShaperNode.oversample')
@DocsEditable
- @Experimental // untriaged
String get oversample native "WaveShaperNode_oversample_Getter";
@DomName('WaveShaperNode.oversample')
@DocsEditable
- @Experimental // untriaged
void set oversample(String value) native "WaveShaperNode_oversample_Setter";
}
diff --git a/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart b/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart
index efa45f5..1cad109 100644
--- a/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart
+++ b/sdk/lib/web_gl/dart2js/web_gl_dart2js.dart
@@ -677,7 +677,8 @@
@DocsEditable
@DomName('EXTFragDepth')
-@Experimental // untriaged
+// http://www.khronos.org/registry/webgl/extensions/EXT_frag_depth/
+@Experimental
class ExtFragDepth native "EXTFragDepth" {
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
@@ -2295,6 +2296,8 @@
@DomName('WebGLRenderingContext.getBufferParameter')
@DocsEditable
+ @Creates('int|Null')
+ @Returns('int|Null')
Object getBufferParameter(int target, int pname) native;
@DomName('WebGLRenderingContext.getContextAttributes')
@@ -2311,6 +2314,8 @@
@DomName('WebGLRenderingContext.getFramebufferAttachmentParameter')
@DocsEditable
+ @Creates('int|Renderbuffer|Texture|Null')
+ @Returns('int|Renderbuffer|Texture|Null')
Object getFramebufferAttachmentParameter(int target, int attachment, int pname) native;
@DomName('WebGLRenderingContext.getParameter')
@@ -2325,10 +2330,14 @@
@DomName('WebGLRenderingContext.getProgramParameter')
@DocsEditable
+ @Creates('int|bool|Null')
+ @Returns('int|bool|Null')
Object getProgramParameter(Program program, int pname) native;
@DomName('WebGLRenderingContext.getRenderbufferParameter')
@DocsEditable
+ @Creates('int|Null')
+ @Returns('int|Null')
Object getRenderbufferParameter(int target, int pname) native;
@DomName('WebGLRenderingContext.getShaderInfoLog')
@@ -2337,6 +2346,8 @@
@DomName('WebGLRenderingContext.getShaderParameter')
@DocsEditable
+ @Creates('int|Null')
+ @Returns('int|Null')
Object getShaderParameter(Shader shader, int pname) native;
@DomName('WebGLRenderingContext.getShaderPrecisionFormat')
@@ -2353,10 +2364,14 @@
@DomName('WebGLRenderingContext.getTexParameter')
@DocsEditable
+ @Creates('int|Null')
+ @Returns('int|Null')
Object getTexParameter(int target, int pname) native;
@DomName('WebGLRenderingContext.getUniform')
@DocsEditable
+ @Creates('Null|num|String|bool|=List|Float32List|Int32List|Uint32List')
+ @Returns('Null|num|String|bool|=List|Float32List|Int32List|Uint32List')
Object getUniform(Program program, UniformLocation location) native;
@DomName('WebGLRenderingContext.getUniformLocation')
@@ -2365,6 +2380,8 @@
@DomName('WebGLRenderingContext.getVertexAttrib')
@DocsEditable
+ @Creates('Null|num|bool|Float32List|Buffer')
+ @Returns('Null|num|bool|Float32List|Buffer')
Object getVertexAttrib(int index, int pname) native;
@DomName('WebGLRenderingContext.getVertexAttribOffset')
diff --git a/sdk/lib/web_gl/dartium/web_gl_dartium.dart b/sdk/lib/web_gl/dartium/web_gl_dartium.dart
index d3e5ddc..a1e5550 100644
--- a/sdk/lib/web_gl/dartium/web_gl_dartium.dart
+++ b/sdk/lib/web_gl/dartium/web_gl_dartium.dart
@@ -745,7 +745,8 @@
@DocsEditable
@DomName('EXTFragDepth')
-@Experimental // untriaged
+// http://www.khronos.org/registry/webgl/extensions/EXT_frag_depth/
+@Experimental
class ExtFragDepth extends NativeFieldWrapperClass1 {
ExtFragDepth.internal();
diff --git a/tests/compiler/dart2js/backend_htype_list_test.dart b/tests/compiler/dart2js/backend_htype_list_test.dart
deleted file mode 100644
index 67acff3..0000000
--- a/tests/compiler/dart2js/backend_htype_list_test.dart
+++ /dev/null
@@ -1,243 +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.
-
-import "package:expect/expect.dart";
-import '../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart';
-
-import 'compiler_helper.dart';
-import 'parser_helper.dart';
-
-// Source names used throughout the tests.
-const SourceString x = const SourceString("x");
-const SourceString p1 = const SourceString("p1");
-const SourceString p2 = const SourceString("p2");
-const SourceString p3 = const SourceString("p3");
-
-// Lists of types.
-List<HType> B;
-List<HType> I;
-List<HType> II;
-List<HType> IBS;
-List<HType> IIS;
-List<HType> BII;
-List<HType> IBI;
-List<HType> IIB;
-List<HType> III;
-
-FunctionSignature compileAndFindSignature(String code,
- String className,
- String memberName) {
- Uri uri = new Uri(scheme: 'source');
- var compiler = compilerFor(code, uri);
- compiler.runCompiler(uri);
- var cls = findElement(compiler, className);
- var member = cls.lookupLocalMember(buildSourceString(memberName));
- var signature = member.computeSignature(compiler);
- return signature;
-}
-
-HTypeList createHTypeList(List<HType> types) {
- HTypeList result = new HTypeList(types.length);
- result.types.setRange(0, result.length, types);
- return result;
-}
-
-HTypeList createHTypeListWithNamed(List<HType> types,
- List<SourceString> namedArguments) {
- HTypeList result = new HTypeList.withNamedArguments(types.length,
- namedArguments);
- result.types.setRange(0, result.length, types);
- return result;
-}
-
-void checkHTypeList(HTypeList types, List<HType> expected) {
- Expect.equals(expected.length, types.length);
- for (int i = 0; i < expected.length; i++) {
- Expect.equals(expected[i], types.types[i]);
- }
-}
-
-const String TEST_1 = r"""
- class A {
- x(p) => null;
- }
- main() {
- new A().x(1);
- }
-""";
-
-test1() {
- FunctionSignature signature = compileAndFindSignature(TEST_1, "A", "x");
- HTypeList types = createHTypeList(I);
- Selector s = new Selector.call(x, null, 1);
- types = types.unionWithOptionalParameters(s, signature, null);
- checkHTypeList(types, I);
-}
-
-const String TEST_2 = r"""
- class A {
- x(p1, [p2, p3]) => null;
- }
- main() {
- new A().x(1);
- }
-""";
-
-test2_1() {
- FunctionSignature signature = compileAndFindSignature(TEST_2, "A", "x");
- HTypeList types = createHTypeList(<HType>[HType.INTEGER]);
- Selector s = new Selector.call(x, null, 1);
-
- OptionalParameterTypes defaultTypes;
- defaultTypes = new OptionalParameterTypes(2);
- defaultTypes.update(0, p2, HType.BOOLEAN);
- defaultTypes.update(1, p3, HType.STRING);
-
- HTypeList t2 = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(t2, IBS);
-}
-
-test2_2() {
- FunctionSignature signature = compileAndFindSignature(TEST_2, "A", "x");
- HTypeList types = createHTypeList(II);
- Selector s = new Selector.call(x, null, 2);
-
- OptionalParameterTypes defaultTypes;
- defaultTypes = new OptionalParameterTypes(2);
- defaultTypes.update(0, p2, HType.BOOLEAN);
- defaultTypes.update(1, p3, HType.STRING);
-
- HTypeList t2 = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(t2, IIS);
-}
-
-
-test2_3() {
- FunctionSignature signature = compileAndFindSignature(TEST_2, "A", "x");
- HTypeList types = createHTypeList(III);
- Selector s = new Selector.call(x, null, 3);
-
- OptionalParameterTypes defaultTypes;
- defaultTypes = new OptionalParameterTypes(2);
- defaultTypes.update(0, p2, HType.BOOLEAN);
- defaultTypes.update(1, p3, HType.STRING);
-
- HTypeList t2 = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(t2, III);
-}
-
-
-const String TEST_3 = r"""
- class A {
- x(p1, [p2, p3]) => null;
- }
- main() {
- new A().x(1);
- }
-""";
-
-test3_1() {
- FunctionSignature signature = compileAndFindSignature(TEST_3, "A", "x");
-
- OptionalParameterTypes defaultTypes;
- defaultTypes = new OptionalParameterTypes(2);
- defaultTypes.update(0, p2, HType.BOOLEAN);
- defaultTypes.update(1, p3, HType.STRING);
-
- HTypeList types;
- Selector s;
- HTypeList result;
-
- s = new Selector.call(x, null, 2, <SourceString>[p2]);
- types = createHTypeListWithNamed(II, <SourceString>[p2]);
- result = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(result, IIS);
-
- s = new Selector.call(x, null, 2, <SourceString>[p3]);
- types = createHTypeListWithNamed(II, <SourceString>[p3]);
- result = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(result, IBI);
-}
-
-test3_2() {
- FunctionSignature signature = compileAndFindSignature(TEST_2, "A", "x");
-
- OptionalParameterTypes defaultTypes;
- defaultTypes = new OptionalParameterTypes(2);
- defaultTypes.update(0, p2, HType.BOOLEAN);
- defaultTypes.update(1, p3, HType.STRING);
-
- HTypeList types;
- Selector s;
- HTypeList result;
-
- s = new Selector.call(x, null, 2, <SourceString>[p2, p3]);
- types = createHTypeListWithNamed(III, <SourceString>[p2, p3]);
- result = types.unionWithOptionalParameters(s1, signature, defaultTypes);
- checkHTypeList(result, III);
-
- s = new Selector.call(x, null, 2, <SourceString>[p3, p3]);
- types = createHTypeListWithNamed(III, <SourceString>[p2, p3]);
- result = types.unionWithOptionalParameters(s2, signature, defaultTypes);
- checkHTypeList(result, III);
-}
-
-
-const String TEST_4 = r"""
- class A {
- x([p1, p2, p3]) => null;
- }
- main() {
- new A().x();
- }
-""";
-
-test4() {
- FunctionSignature signature = compileAndFindSignature(TEST_4, "A", "x");
-
- OptionalParameterTypes defaultTypes;
- defaultTypes = new OptionalParameterTypes(3);
- defaultTypes.update(0, p1, HType.INTEGER);
- defaultTypes.update(1, p2, HType.INTEGER);
- defaultTypes.update(2, p3, HType.INTEGER);
-
- HTypeList types;
- Selector s;
- HTypeList result;
-
- s = new Selector.call(x, null, 1, <SourceString>[p1]);
- types = createHTypeListWithNamed(B, <SourceString>[p1]);
- result = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(result, BII);
-
- s = new Selector.call(x, null, 1, <SourceString>[p2]);
- types = createHTypeListWithNamed(B, <SourceString>[p2]);
- result = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(result, IBI);
-
- s = new Selector.call(x, null, 1, <SourceString>[p3]);
- types = createHTypeListWithNamed(B, <SourceString>[p3]);
- result = types.unionWithOptionalParameters(s, signature, defaultTypes);
- checkHTypeList(result, IIB);
-}
-
-main() {
- B = <HType>[HType.BOOLEAN];
- I = <HType>[HType.INTEGER];
- II = <HType>[HType.INTEGER, HType.INTEGER];
- IBS = <HType>[HType.INTEGER, HType.BOOLEAN, HType.STRING];
- IIS = <HType>[HType.INTEGER, HType.INTEGER, HType.STRING];
- BII = <HType>[HType.BOOLEAN, HType.INTEGER, HType.INTEGER];
- IBI = <HType>[HType.INTEGER, HType.BOOLEAN, HType.INTEGER];
- IIB = <HType>[HType.INTEGER, HType.INTEGER, HType.BOOLEAN];
- III = <HType>[HType.INTEGER, HType.INTEGER, HType.INTEGER];
-
- test1();
- test2_1();
- test2_2();
- test2_3();
- test3_1();
- test4();
-}
diff --git a/tests/compiler/dart2js/call_site_type_inferer_static_test.dart b/tests/compiler/dart2js/call_site_type_inferer_static_test.dart
deleted file mode 100644
index e8a1f0b..0000000
--- a/tests/compiler/dart2js/call_site_type_inferer_static_test.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.
-
-import "package:expect/expect.dart";
-import "../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart";
-import "../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart";
-
-import 'compiler_helper.dart';
-import 'parser_helper.dart';
-
-void compileAndFind(String code,
- String functionName,
- bool disableInlining,
- check(compiler, element)) {
- Uri uri = new Uri(scheme: 'source');
- var compiler = compilerFor(code, uri);
- compiler.disableInlining = disableInlining;
- compiler.runCompiler(uri);
- var fun = findElement(compiler, functionName);
- return check(compiler, fun);
-}
-
-// The 'f' function has an 'if' to make it non-inlinable.
-const String TEST_ONE = r"""
- f(p) { if (p == null) return p; return p; }
- main() { f("s"); }
-""";
-
-const String TEST_TWO = r"""
- f(p) { if (p == null) return p; return p; }
- main() { f(1); }
-""";
-
-const String TEST_THREE = r"""
- f(p) { if (p == null) return p; return p; }
- main() { f(1); f(2); }
-""";
-
-const String TEST_FOUR = r"""
- f(p) { if (p == null) return p; return p; }
- main() { f(1.1); }
-""";
-
-const String TEST_FIVE = r"""
- f(p) { if (p == null) return p; return p; }
- main() { f(1); f(2.2); }
-""";
-
-const String TEST_SIX = r"""
- f(p) { if (p == null) return p; return p; }
- main() { f(1.1); f(2); }
-""";
-
-const String TEST_SEVEN = r"""
- f(p) { if (p == null) return p; return p; }
- main() { f(1); f("s"); }
-""";
-
-const String TEST_EIGHT = r"""
- f(p1, p2) { if (p1 == null) return p1; return p2; }
- main() { f(1, 2); f(1, "s"); }
-""";
-
-const String TEST_NINE = r"""
- f(p1, p2) { if (p1 == null) return p1; return p2; }
- main() { f("s", 2); f(1, "s"); }
-""";
-
-const String TEST_TEN = r"""
- f(p) { if (p == null) return p; return p; }
- g(p) { if (p== null) return null; return p(1); }
- main() { f(1); g(f); }
-""";
-
-void doTest(String test,
- bool enableInlining,
- List<Function> expectedTypes) {
- compileAndFind(
- test,
- 'f',
- enableInlining,
- (compiler, x) {
- HTypeList types = compiler.backend.optimisticParameterTypes(x, null);
- if (expectedTypes != null) {
- Expect.isFalse(types.allUnknown);
- Expect.listEquals(
- expectedTypes.map((f) => f(compiler)).toList(),
- types.types.map((e) => e.simplify(compiler)).toList());
- } else {
- Expect.isTrue(types.allUnknown);
- }
- });
-}
-
-void runTest(String test, [List<Function> expectedTypes]) {
- doTest(test, false, expectedTypes);
- doTest(test, true, expectedTypes);
-}
-
-void test() {
- subclassOfInterceptor(compiler) =>
- findHType(compiler, 'Interceptor', 'nonNullSubclass');
-
- runTest(TEST_ONE, [(compiler) => HType.STRING]);
- runTest(TEST_TWO, [(compiler) => HType.INTEGER]);
- runTest(TEST_THREE, [(compiler) => HType.INTEGER]);
- runTest(TEST_FOUR, [(compiler) => HType.DOUBLE]);
- runTest(TEST_FIVE, [(compiler) => HType.NUMBER]);
- runTest(TEST_SIX, [(compiler) => HType.NUMBER]);
- runTest(TEST_SEVEN, [subclassOfInterceptor]);
- runTest(TEST_EIGHT, [(compiler) => HType.INTEGER, subclassOfInterceptor]);
- runTest(TEST_NINE, [subclassOfInterceptor, subclassOfInterceptor]);
- runTest(TEST_TEN);
-}
-
-void main() {
- test();
-}
diff --git a/tests/compiler/dart2js/call_site_type_inferer_test.dart b/tests/compiler/dart2js/call_site_type_inferer_test.dart
deleted file mode 100644
index 7e75dd1..0000000
--- a/tests/compiler/dart2js/call_site_type_inferer_test.dart
+++ /dev/null
@@ -1,293 +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.
-
-import "package:expect/expect.dart";
-import '../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart';
-
-import 'compiler_helper.dart';
-import 'parser_helper.dart';
-
-void compileAndFind(String code,
- String className,
- String memberName,
- bool disableInlining,
- check(compiler, element)) {
- Uri uri = new Uri(scheme: 'source');
- var compiler = compilerFor(code, uri);
- compiler.disableInlining = disableInlining;
- compiler.runCompiler(uri);
- var cls = findElement(compiler, className);
- var member = cls.lookupLocalMember(buildSourceString(memberName));
- return check(compiler, member);
-}
-
-const String TEST_1 = r"""
- class A {
- x(p) => p;
- }
- main() { new A().x("s"); }
-""";
-
-const String TEST_2 = r"""
- class A {
- x(p) => p;
- }
- main() { new A().x(1); }
-""";
-
-const String TEST_3 = r"""
- class A {
- x(p) => x(p - 1);
- }
- main() { new A().x(1); }
-""";
-
-const String TEST_4 = r"""
- class A {
- x(p) => x(p - 1);
- }
- main() { new A().x(1.5); }
-""";
-
-const String TEST_5 = r"""
- class A {
- x(p) => p;
- }
- main() {
- new A().x(1);
- new A().x(1.5);
- }
-""";
-
-const String TEST_6 = r"""
- class A {
- x(p) => p;
- }
- main() {
- new A().x(1.5);
- new A().x(1);
- }
-""";
-
-const String TEST_7a = r"""
- class A {
- x(p) => x("x");
- }
- main() {
- new A().x(1);
- }
-""";
-
-const String TEST_7b = r"""
- class A {
- x(p) => x("x");
- }
- main() {
- new A().x({});
- }
-""";
-
-const String TEST_8 = r"""
- class A {
- x(p1, p2, p3) => x(p1, "x", {});
- }
- main() {
- new A().x(1, 2, 3);
- }
-""";
-
-const String TEST_9 = r"""
- class A {
- x(p1, p2) => x(p1, p2);
- }
- main() {
- new A().x(1, 2);
- }
-""";
-
-const String TEST_10 = r"""
- class A {
- x(p1, p2) => x(p1, p2);
- }
- void f(p) {
- p.x("x", "y");
- }
- main() {
- f(null);
- new A().x(1, 2);
- }
-""";
-
-const String TEST_11 = r"""
- class A {
- x(p1, p2) => x(1, 2);
- }
- main() {
- new A().x("x", "y");
- }
-""";
-
-const String TEST_12 = r"""
- class A {
- x(p1, [p2 = 1]) => 1;
- }
- main() {
- new A().x("x", 1);
- new A().x("x");
- }
-""";
-
-const String TEST_13 = r"""
- class A {
- x(p) => 1;
- }
- f(p) => p.x(2.2);
- main() {
- new A().x(1);
- f(new A());
- }
-""";
-
-const String TEST_14 = r"""
- class A {
- x(p1, [p2 = "s"]) => 1;
- }
- main() {
- new A().x(1);
- }
-""";
-
-const String TEST_15 = r"""
- class A {
- x(p1, [p2 = true]) => 1;
- }
- f(p) => p.a("x");
- main() {
- new A().x("x");
- new A().x("x", false);
- f(null);
- }
-""";
-
-const String TEST_16 = r"""
- class A {
- x(p1, [p2 = 1, p3 = "s"]) => 1;
- }
- main() {
- new A().x(1);
- new A().x(1, 2);
- new A().x(1, 2, "x");
- new A().x(1, p2: 2);
- new A().x(1, p3: "x");
- new A().x(1, p3: "x", p2: 2);
- new A().x(1, p2: 2, p3: "x");
- }
-""";
-
-const String TEST_17 = r"""
- class A {
- x(p1, [p2 = 1, p3 = "s"]) => 1;
- }
- main() {
- new A().x(1, true, 1.1);
- new A().x(1, false, 2.2);
- new A().x(1, p3: 3.3, p2: true);
- new A().x(1, p2: false, p3: 4.4);
- }
-""";
-
-const String TEST_18 = r"""
- class A {
- x(p1, p2) => x(p1, p2);
- }
- class B extends A {
- }
- main() {
- new B().x("a", "b");
- new A().x(1, 2);
- }
-""";
-
-void doTest(String test,
- bool disableInlining,
- List expectedTypes, // HTypes, or functions constructing HTypes.
- OptionalParameterTypes defaultTypes) {
- compileAndFind(
- test,
- 'A',
- 'x',
- disableInlining,
- (compiler, x) {
- HTypeList types =
- compiler.backend.optimisticParameterTypes(x, defaultTypes);
- if (expectedTypes != null) {
- expectedTypes = expectedTypes
- .map((e) => e is HType ? e : e(compiler))
- .toList();
- Expect.isFalse(types.allUnknown);
- Expect.equals(expectedTypes.length, types.types.length);
- Expect.listEquals(expectedTypes,
- types.types.map((t) => t.simplify(compiler)).toList());
- } else {
- Expect.isTrue(types.allUnknown);
- }
- });
-}
-
-void runTest(String test,
- [List<HType> expectedTypes,
- OptionalParameterTypes defaultTypes]) {
- doTest(test, true, expectedTypes, defaultTypes);
-}
-
-void test() {
- OptionalParameterTypes defaultTypes;
-
- subclassOfInterceptor(compiler) =>
- findHType(compiler, 'Interceptor', 'nonNullSubclass');
-
- runTest(TEST_1, [HType.STRING]);
- runTest(TEST_2, [HType.INTEGER]);
- runTest(TEST_3, [HType.INTEGER]);
- runTest(TEST_4, [HType.DOUBLE]);
- runTest(TEST_5, [HType.NUMBER]);
- runTest(TEST_6, [HType.NUMBER]);
- runTest(TEST_7a, [subclassOfInterceptor]);
- runTest(TEST_7b, [HType.NON_NULL]);
- runTest(TEST_8, [HType.INTEGER, subclassOfInterceptor, HType.NON_NULL]);
- runTest(TEST_9, [HType.INTEGER, HType.INTEGER]);
- runTest(TEST_10, [HType.INTEGER, HType.INTEGER]);
- runTest(TEST_11, [subclassOfInterceptor, subclassOfInterceptor]);
-
- defaultTypes = new OptionalParameterTypes(1);
- defaultTypes.update(0, const SourceString("p2"), HType.INTEGER);
- runTest(TEST_12, [HType.STRING, HType.INTEGER], defaultTypes);
-
- runTest(TEST_13, [HType.NUMBER]);
-
- defaultTypes = new OptionalParameterTypes(1);
- defaultTypes.update(0, const SourceString("p2"), HType.STRING);
- runTest(TEST_14, [HType.INTEGER, HType.STRING], defaultTypes);
-
- defaultTypes = new OptionalParameterTypes(1);
- defaultTypes.update(0, const SourceString("p2"), HType.BOOLEAN);
- runTest(TEST_15, [HType.STRING, HType.BOOLEAN], defaultTypes);
-
- defaultTypes = new OptionalParameterTypes(2);
- defaultTypes.update(0, const SourceString("p2"), HType.INTEGER);
- defaultTypes.update(1, const SourceString("p3"), HType.STRING);
- runTest(TEST_16, [HType.INTEGER, HType.INTEGER, HType.STRING], defaultTypes);
-
- defaultTypes = new OptionalParameterTypes(2);
- defaultTypes.update(0, const SourceString("p2"), HType.INTEGER);
- defaultTypes.update(1, const SourceString("p3"), HType.STRING);
- runTest(TEST_17, [HType.INTEGER, HType.BOOLEAN, HType.DOUBLE], defaultTypes);
-
- runTest(TEST_18, [subclassOfInterceptor, subclassOfInterceptor]);
-}
-
-void main() {
- test();
-}
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index 880a85e..d891603 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -71,7 +71,7 @@
new leg.ResolutionWorkItem(element, context);
resolutionWork.run(compiler, compiler.enqueuer.resolution);
leg.CodegenWorkItem work =
- new leg.CodegenWorkItem(element, resolutionWork.resolutionTree, context);
+ new leg.CodegenWorkItem(element, context);
compiler.phase = Compiler.PHASE_COMPILING;
work.run(compiler, compiler.enqueuer.codegen);
js.JavaScriptBackend backend = compiler.backend;
diff --git a/tests/compiler/dart2js/field_type_inferer_test.dart b/tests/compiler/dart2js/field_type_inferer_test.dart
deleted file mode 100644
index ee2b5fb..0000000
--- a/tests/compiler/dart2js/field_type_inferer_test.dart
+++ /dev/null
@@ -1,394 +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.
-
-import "package:expect/expect.dart";
-import '../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart';
-import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.dart';
-
-import 'compiler_helper.dart';
-import 'parser_helper.dart';
-
-void compileAndFind(String code,
- String className,
- String memberName,
- bool disableInlining,
- check(compiler, element)) {
- Uri uri = new Uri(scheme: 'source');
- var compiler = compilerFor(code, uri);
- compiler.runCompiler(uri);
- compiler.disableInlining = disableInlining;
- var cls = findElement(compiler, className);
- var member = cls.lookupMember(buildSourceString(memberName));
- return check(compiler.backend, member);
-}
-
-const String TEST_1 = r"""
- class A {
- int f;
- }
- main() { new A(); }
-""";
-
-const String TEST_2 = r"""
- class A {
- int f1;
- int f2 = 1;
- }
- main() { new A(); }
-""";
-
-const String TEST_3 = r"""
- class A {
- int f1;
- int f2;
- A() : f1 = 1;
- }
- main() { new A().f2 = 2; }
-""";
-
-const String TEST_4 = r"""
- class A {
- int f1;
- int f2;
- A() : f1 = 1;
- }
- main() {
- A a = new A();
- a.f1 = "a";
- a.f2 = "a";
- }
-""";
-
-const String TEST_5 = r"""
- class A {
- int f1 = 1;
- int f2 = 1;
- A(x) {
- f1 = "1";
- if (x) {
- f2 = "1";
- } else {
- f2 = "2";
- }
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-const String TEST_6 = r"""
- class A {
- int f1 = 1;
- int f2 = 1;
- A(x) {
- f1 = "1";
- if (x) {
- f2 = "1";
- } else {
- f2 = "2";
- }
- if (x) {
- f2 = new List();
- } else {
- f2 = new List();
- }
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-const String TEST_7 = r"""
- class A {
- int f1 = 1;
- int f2 = 1;
- A(x) {
- f1 = "1";
- if (x) {
- f2 = "1";
- } else {
- f2 = "2";
- }
- if (x) {
- f1 = new List();
- f2 = new List();
- } else {
- f2 = new List();
- }
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-const String TEST_8 = r"""
- class A {
- int f;
- A(x) {
- if (x) {
- f = "1";
- } else {
- }
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-const String TEST_9 = r"""
- class A {
- int f;
- A(x) {
- if (x) {
- } else {
- f = "1";
- }
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-const String TEST_10 = r"""
- class A {
- int f;
- A() {
- f = 1;
- }
- m() => f + 1;
- }
- void f(x) { x.f = "2"; }
- main() {
- A a;
- f(a);
- a = new A();
- a.m();
- }
-""";
-
-
-const String TEST_11 = r"""
- class S {
- int fs = 1;
- ms() { fs = 1; }
- }
-
- class A extends S {
- m() { ms(); }
- }
-
- main() {
- A a = new A();
- a.m();
- }
-""";
-
-const String TEST_12 = r"""
- class S {
- int fs = 1;
- S() { fs = "2"; }
- }
-
- class A extends S {
- }
-
- main() {
- A a = new A();
- }
-""";
-
-const String TEST_13 = r"""
- class S {
- int fs;
- S() { fs = 1; }
- }
-
- class A extends S {
- A() { fs = 1; }
- }
-
- main() {
- A a = new A();
- }
-""";
-
-const String TEST_14 = r"""
- class A {
- var f;
- A() { f = 1; }
- A.other() { f = 2; }
- }
-
- main() {
- A a = new A();
- a = new A.other();
- }
-""";
-
-const String TEST_15 = r"""
- class A {
- var f;
- A() { f = "1"; }
- A.other() { f = new List(); }
- }
-
- main() {
- A a = new A();
- a = new A.other();
- }
-""";
-
-const String TEST_16 = r"""
- class A {
- var f;
- A() { f = "1"; }
- A.other() : f = 1 { }
- }
-
- main() {
- A a = new A();
- a = new A.other();
- }
-""";
-
-const String TEST_17 = r"""
- g([p]) => p.f = 1;
- class A {
- var f;
- A(x) {
- var a;
- if (x) {
- a = this;
- } else {
- a = g;
- }
- a();
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-// In this test this is only used in a field set (f3 = a) and therefore we infer
-// types for f1, f2 and f3.
-const String TEST_18 = r"""
- class A {
- var f1;
- var f2;
- var f3;
- A(x) {
- f1 = 1;
- var a;
- if (x) {
- f2 = "1";
- a = this;
- } else {
- a = 1;
- f2 = "1";
- }
- f3 = a;
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-// In this test this is exposed through a(), and therefore we don't infer
-// any types.
-const String TEST_19 = r"""
- class A {
- var f1;
- var f2;
- var f3;
- A(x) {
- f1 = 1;
- var a;
- if (x) {
- f2 = "1";
- a = this;
- } else {
- a = 1;
- f2 = "1";
- }
- f3 = a;
- a();
- }
- }
- main() {
- new A(true);
- new A(false);
- }
-""";
-
-void doTest(String test, bool disableInlining, Map<String, dynamic> fields) {
- fields.forEach((String name, type) {
- compileAndFind(
- test,
- 'A',
- name,
- disableInlining,
- (backend, field) {
- HType inferredType =
- backend.optimisticFieldType(field).simplify(backend.compiler);
- if (type is Function) type = type(backend.compiler);
- Expect.equals(type, inferredType);
- });
- });
-}
-
-void runTest(String test, Map<String, HType> fields) {
- doTest(test, false, fields);
- doTest(test, true, fields);
-}
-
-void test() {
- HType interceptorType(compiler) =>
- findHType(compiler, 'Interceptor', 'nonNullSubclass');
-
- runTest(TEST_1, {'f': HType.NULL});
- runTest(TEST_2, {'f1': HType.NULL, 'f2': HType.INTEGER});
- runTest(TEST_3, {'f1': HType.INTEGER, 'f2': HType.INTEGER_OR_NULL});
- runTest(TEST_4, {'f1': interceptorType, 'f2': HType.STRING_OR_NULL});
- runTest(TEST_5, {'f1': HType.STRING, 'f2': HType.STRING});
- runTest(TEST_6, {'f1': HType.STRING, 'f2': HType.EXTENDABLE_ARRAY});
- runTest(TEST_7, {'f1': HType.INDEXABLE_PRIMITIVE,
- 'f2': HType.EXTENDABLE_ARRAY});
- runTest(TEST_8, {'f': HType.UNKNOWN});
- runTest(TEST_9, {'f': HType.UNKNOWN});
- runTest(TEST_10, {'f': HType.UNKNOWN});
- runTest(TEST_11, {'fs': HType.INTEGER});
- runTest(TEST_12, {'fs': HType.STRING});
- // TODO(sgjesse): We should actually infer int.
- runTest(TEST_13, {'fs': HType.UNKNOWN});
- // TODO(sgjesse): We should actually infer int.
- runTest(TEST_14, {'f': HType.UNKNOWN});
- runTest(TEST_15, {'f': HType.UNKNOWN});
- runTest(TEST_16, {'f': HType.UNKNOWN});
- runTest(TEST_17, {'f': HType.UNKNOWN});
- runTest(TEST_18, {'f1': HType.INTEGER,
- 'f2': HType.STRING,
- 'f3': HType.NON_NULL});
- runTest(TEST_19, {'f1': HType.UNKNOWN,
- 'f2': HType.UNKNOWN,
- 'f3': HType.UNKNOWN});
-}
-
-void main() {
- test();
-}
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 14fa226..4d80094 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -204,8 +204,8 @@
enableMinification: enableMinification,
enableConcreteTypeInference: enableConcreteTypeInference,
maxConcreteTypeSize: maxConcreteTypeSize,
- disableTypeInference: disableTypeInference,
- analyzeAll: analyzeAll,
+ disableTypeInferenceFlag: disableTypeInference,
+ analyzeAllFlag: analyzeAll,
analyzeOnly: analyzeOnly,
preserveComments: preserveComments) {
coreLibrary = createLibrary("core", coreSource);
diff --git a/tests/compiler/dart2js/return_type_inferer_test.dart b/tests/compiler/dart2js/return_type_inferer_test.dart
deleted file mode 100644
index 30b854d..0000000
--- a/tests/compiler/dart2js/return_type_inferer_test.dart
+++ /dev/null
@@ -1,97 +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.
-
-import "package:expect/expect.dart";
-import '../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart';
-
-import 'compiler_helper.dart';
-
-const String TEST_ONE = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f("s"); }
-""";
-
-const String TEST_TWO = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); }
-""";
-
-const String TEST_THREE = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); f(2); }
-""";
-
-const String TEST_FOUR = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1.1); }
-""";
-
-const String TEST_FIVE = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); f(2.2); }
-""";
-
-const String TEST_SIX = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1.1); f(2); }
-""";
-
-const String TEST_SEVEN = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); f("s"); }
-""";
-
-const String TEST_EIGHT = r"""
- f(p1, p2) {
- if (p1 == null) return p1;
- else return p1;
- }
- main() { f(1, 2); f(1, "s"); }
-""";
-
-const String TEST_NINE = r"""
- f(p1, p2) {
- if (p1 == null) return p1;
- else return p1;
- }
- main() { f("s", 2); f(1, "s"); }
-""";
-
-const String TEST_TEN = r"""
- f(p) { if (p == null) return p; else return p; }
- g(p) { if (p == null) return p; else return p; }
- main() { f(1); g(f); }
-""";
-
-void runTest(String test, Function findExpectedType) {
- compileAndCheck(
- test,
- 'f',
- (compiler, x) {
- var backend = compiler.backend;
- HType type =
- backend.optimisticReturnTypesWithRecompilationOnTypeChange(null, x);
- Expect.equals(findExpectedType(compiler), type.simplify(compiler));
- });
-}
-
-void test() {
- subclassOfInterceptor(compiler) =>
- findHType(compiler, 'Interceptor', 'nonNullSubclass');
-
- runTest(TEST_ONE, (compiler) => HType.STRING);
- runTest(TEST_TWO, (compiler) => HType.INTEGER);
- runTest(TEST_THREE, (compiler) => HType.INTEGER);
- runTest(TEST_FOUR, (compiler) => HType.DOUBLE);
- runTest(TEST_FIVE, (compiler) => HType.NUMBER);
- runTest(TEST_SIX, (compiler) => HType.NUMBER);
- runTest(TEST_SEVEN, subclassOfInterceptor);
- runTest(TEST_EIGHT, (compiler) => HType.INTEGER);
- runTest(TEST_NINE, subclassOfInterceptor);
- runTest(TEST_TEN, (compiler) => HType.UNKNOWN);
-}
-
-void main() {
- test();
-}
diff --git a/tests/compiler/dart2js/unneeded_part_js_test.dart b/tests/compiler/dart2js/unneeded_part_js_test.dart
new file mode 100644
index 0000000..aa1e641
--- /dev/null
+++ b/tests/compiler/dart2js/unneeded_part_js_test.dart
@@ -0,0 +1,65 @@
+// 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 no parts are emitted when deferred loading isn't used.
+
+import 'package:expect/expect.dart';
+import 'memory_source_file_helper.dart';
+
+import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
+ show NullSink;
+
+import '../../../sdk/lib/_internal/compiler/compiler.dart'
+ show Diagnostic;
+
+import 'dart:async';
+
+main() {
+ Uri script = currentDirectory.resolve(nativeToUriPath(new Options().script));
+ Uri libraryRoot = script.resolve('../../../sdk/');
+ Uri packageRoot = script.resolve('./packages/');
+
+ MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
+ var provider = new MemorySourceFileProvider();
+ void diagnosticHandler(Uri uri, int begin, int end,
+ String message, Diagnostic kind) {
+ if (kind == Diagnostic.VERBOSE_INFO) {
+ return;
+ }
+ throw '$uri:$begin:$end:$message:$kind';
+ }
+
+ EventSink<String> outputProvider(String name, String extension) {
+ if (name != '') throw 'Attempt to output file "$name.$extension"';
+ return new NullSink('$name.$extension');
+ }
+
+ Compiler compiler = new Compiler(provider.readStringFromUri,
+ outputProvider,
+ diagnosticHandler,
+ libraryRoot,
+ packageRoot,
+ []);
+ compiler.run(Uri.parse('memory:main.dart'));
+ Expect.isFalse(compiler.compilationFailed);
+}
+
+const Map MEMORY_SOURCE_FILES = const {
+ 'main.dart': """
+class Greeting {
+ final message;
+ const Greeting(this.message);
+}
+
+const fisk = const Greeting('Hello, World!');
+
+main() {
+ var x = fisk;
+ if (new DateTime.now().millisecondsSinceEpoch == 42) {
+ x = new Greeting(\"I\'m confused\");
+ }
+ print(x.message);
+}
+""",
+};
diff --git a/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart b/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
index c5980fb..3f15bec6 100644
--- a/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
+++ b/tests/compiler/dart2js_extra/deferred/deferred_function_test.dart
@@ -13,16 +13,25 @@
isNoSuchMethodError(e) => e is NoSuchMethodError;
+readFoo() {
+ // TODO(ahe): There is a problem with type inference of deferred
+ // function closures. We think they are never null.
+ if (new DateTime.now().millisecondsSinceEpoch == 87) return null;
+ return foo;
+}
+
main() {
print('unittest-suite-wait-for-done');
Expect.throws(() { foo('a'); }, isNoSuchMethodError);
+ Expect.isNull(readFoo());
int counter = 0;
lazy.load().then((bool didLoad) {
Expect.isTrue(didLoad);
Expect.equals(1, ++counter);
print('lazy was loaded');
Expect.equals(42, foo('b'));
+ Expect.isNotNull(readFoo());
});
Expect.equals(0, counter);
lazy.load().then((bool didLoad) {
@@ -30,8 +39,10 @@
Expect.equals(2, ++counter);
print('lazy was loaded');
Expect.equals(42, foo('b'));
+ Expect.isNotNull(readFoo());
print('unittest-suite-success');
});
Expect.equals(0, counter);
Expect.throws(() { foo('a'); }, isNoSuchMethodError);
+ Expect.isNull(readFoo());
}
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 55913e5..c155d64 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -104,9 +104,6 @@
list_insert_test: fail
list_removeat_test: fail
-[ $arch == arm ]
-*: Skip
-
[ $arch == simarm ]
*: Skip
diff --git a/tests/corelib/map_test.dart b/tests/corelib/map_test.dart
index 05afcf6..4f48be4 100644
--- a/tests/corelib/map_test.dart
+++ b/tests/corelib/map_test.dart
@@ -207,6 +207,41 @@
Expect.equals(10, map[key1]);
Expect.equals(10,
map.putIfAbsent(key1, () => 11));
+
+ // Test Map.addAll.
+ map.clear();
+ otherMap.clear();
+ otherMap[99] = 1;
+ otherMap[50] = 50;
+ otherMap[1] = 99;
+ map.addAll(otherMap);
+ Expect.equals(3, map.length);
+ Expect.equals(1, map[99]);
+ Expect.equals(50, map[50]);
+ Expect.equals(99, map[1]);
+ otherMap[50] = 42;
+ map.addAll(new HashMap.from(otherMap));
+ Expect.equals(3, map.length);
+ Expect.equals(1, map[99]);
+ Expect.equals(42, map[50]);
+ Expect.equals(99, map[1]);
+ otherMap[99] = 7;
+ map.addAll(new SplayTreeMap.from(otherMap));
+ Expect.equals(3, map.length);
+ Expect.equals(7, map[99]);
+ Expect.equals(42, map[50]);
+ Expect.equals(99, map[1]);
+ otherMap.remove(99);
+ map[99] = 0;
+ map.addAll(otherMap);
+ Expect.equals(3, map.length);
+ Expect.equals(0, map[99]);
+ Expect.equals(42, map[50]);
+ Expect.equals(99, map[1]);
+ map.clear();
+ otherMap.clear();
+ map.addAll(otherMap);
+ Expect.equals(0, map.length);
}
void testDeletedElement(Map map) {
diff --git a/tests/html/documentfragment_test.dart b/tests/html/documentfragment_test.dart
index d384c98..62d4b73 100644
--- a/tests/html/documentfragment_test.dart
+++ b/tests/html/documentfragment_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
library DocumentFragmentTest;
-import "package:expect/expect.dart";
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'util.dart';
diff --git a/tests/html/element_types_test.dart b/tests/html/element_types_test.dart
index f10713b..2638d3a 100644
--- a/tests/html/element_types_test.dart
+++ b/tests/html/element_types_test.dart
@@ -82,229 +82,107 @@
});
});
+ check(String name, bool fn(), [bool supported = true]) {
+ test(name, () {
+ var expectation = supported ? returnsNormally : throws;
+ expect(() {
+ expect(fn(), isTrue);
+ }, expectation);
+ });
+
+ }
+
group('constructors', () {
- test('a', () {
- expect((new AnchorElement()) is AnchorElement, true);
+ check('a', () => new AnchorElement() is AnchorElement);
+ check('area', () => new AreaElement() is AreaElement);
+ check('audio', () => new AudioElement() is AudioElement);
+ check('body', () => new BodyElement() is BodyElement);
+ check('br', () => new BRElement() is BRElement);
+ check('base', () => new BaseElement() is BaseElement);
+ check('button', () => new ButtonElement() is ButtonElement);
+ check('canvas', () => new CanvasElement() is CanvasElement);
+ check('caption', () => new TableCaptionElement() is TableCaptionElement);
+ check('content', () => new ContentElement() is ContentElement,
+ ContentElement.supported);
+ check('details', () => new DetailsElement() is DetailsElement,
+ DetailsElement.supported);
+ check('datalist', () => new DataListElement() is DataListElement,
+ DataListElement.supported);
+ check('dl', () => new DListElement() is DListElement);
+ check('div', () => new DivElement() is DivElement);
+ check('embed', () => new EmbedElement() is EmbedElement,
+ EmbedElement.supported);
+ check('fieldset', () => new FieldSetElement() is FieldSetElement);
+ check('form', () => new FormElement() is FormElement);
+ check('head', () => new HeadElement() is HeadElement);
+ check('hr', () => new HRElement() is HRElement);
+ check('html', () => new HtmlElement() is HtmlElement);
+ check('h1', () => new HeadingElement.h1() is HeadingElement);
+ check('h2', () => new HeadingElement.h2() is HeadingElement);
+ check('h3', () => new HeadingElement.h3() is HeadingElement);
+ check('h4', () => new HeadingElement.h4() is HeadingElement);
+ check('h5', () => new HeadingElement.h5() is HeadingElement);
+ check('h6', () => new HeadingElement.h6() is HeadingElement);
+ check('iframe', () => new IFrameElement() is IFrameElement);
+ check('img', () => new ImageElement() is ImageElement);
+ check('input', () => new InputElement() is InputElement);
+ check('keygen', () => new KeygenElement() is KeygenElement,
+ KeygenElement.supported);
+ check('li', () => new LIElement() is LIElement);
+ check('label', () => new LabelElement() is LabelElement);
+ check('legen', () => new LegendElement() is LegendElement);
+ check('link', () => new LinkElement() is LinkElement);
+ check('map', () => new MapElement() is MapElement);
+ check('menu', () => new MenuElement() is MenuElement);
+ check('meta', () => new MetaElement() is MetaElement);
+ check('meter', () => new MeterElement() is MeterElement,
+ MeterElement.supported);
+ check('del', () => new Element.tag('del') is ModElement);
+ check('ins', () => new Element.tag('ins') is ModElement);
+ check('object', () => new ObjectElement() is ObjectElement,
+ ObjectElement.supported);
+ check('ol', () => new OListElement() is OListElement);
+ check('optgroup', () => new OptGroupElement() is OptGroupElement);
+ check('option', () => new OptionElement() is OptionElement);
+ check('output', () => new OutputElement() is OutputElement,
+ OutputElement.supported);
+ check('p', () => new ParagraphElement() is ParagraphElement);
+ check('param', () => new ParamElement() is ParamElement);
+ check('pre', () => new PreElement() is PreElement);
+ check('progress', () => new ProgressElement() is ProgressElement,
+ ProgressElement.supported);
+ check('q', () => new QuoteElement() is QuoteElement);
+ check('script', () => new ScriptElement() is ScriptElement);
+ check('select', () => new SelectElement() is SelectElement);
+ check('shadow', () => new ShadowElement() is ShadowElement,
+ ShadowElement.supported);
+ check('source', () => new SourceElement() is SourceElement);
+ check('span', () => new SpanElement() is SpanElement);
+ check('style', () => new StyleElement() is StyleElement);
+ check('table', () => new TableElement() is TableElement);
+ check('template', () => new TemplateElement() is TemplateElement,
+ TemplateElement.supported);
+ check('textarea', () => new TextAreaElement() is TextAreaElement);
+ check('title', () => new TitleElement() is TitleElement);
+ check('td', () => new TableCellElement() is TableCellElement);
+ check('col', () => new TableColElement() is TableColElement);
+ check('colgroup', () => new Element.tag('colgroup') is TableColElement);
+ check('tr', () => new TableRowElement() is TableRowElement);
+ check('tbody', () => new Element.tag('tbody') is TableSectionElement);
+ check('tfoot', () => new Element.tag('tfoot') is TableSectionElement);
+ check('thead', () => new Element.tag('thead') is TableSectionElement);
+ check('track', () => new TrackElement() is TrackElement,
+ TrackElement.supported);
+ group('ul', () {
+ check('ul', () => new UListElement() is UListElement);
+
+ test('accepts li', () {
+ var ul = new UListElement();
+ var li = new LIElement();
+ ul.append(li);
+ });
});
- test('area', () {
- expect((new AreaElement()) is AreaElement, true);
- });
- test('audio', () {
- expect((new AudioElement()) is AudioElement, true);
- });
- test('body', () {
- expect((new BodyElement()) is BodyElement, true);
- });
- test('br', () {
- expect((new BRElement()) is BRElement, true);
- });
- test('base', () {
- expect((new BaseElement()) is BaseElement, true);
- });
- test('button', () {
- expect((new ButtonElement()) is ButtonElement, true);
- });
- test('canvas', () {
- expect((new CanvasElement()) is CanvasElement, true);
- });
- test('caption', () {
- expect((new TableCaptionElement()) is TableCaptionElement, true);
- });
- test('content', () {
- expect((new ContentElement()) is ContentElement,
- ContentElement.supported);
- });
- test('details', () {
- expect((new DetailsElement()) is DetailsElement,
- DetailsElement.supported);
- });
- test('dl', () {
- expect((new DListElement()) is DListElement, true);
- });
- test('datalist', () {
- expect((new DataListElement()) is DataListElement,
- DataListElement.supported);
- });
- test('div', () {
- expect((new DivElement()) is DivElement, true);
- });
- test('embed', () {
- expect((new EmbedElement()) is EmbedElement, EmbedElement.supported);
- });
- test('fieldset', () {
- expect((new FieldSetElement()) is FieldSetElement, true);
- });
- test('form', () {
- expect((new FormElement()) is FormElement, true);
- });
- test('head', () {
- expect((new HeadElement()) is HeadElement, true);
- });
- test('hr', () {
- expect((new HRElement()) is HRElement, true);
- });
- test('html', () {
- expect((new HtmlElement()) is HtmlElement, true);
- });
- test('h1', () {
- expect((new HeadingElement.h1()) is HeadingElement, true);
- expect(new Element.tag('h1') is HeadingElement, true);
- });
- test('h2', () {
- expect((new HeadingElement.h2()) is HeadingElement, true);
- expect(new Element.tag('h2') is HeadingElement, true);
- });
- test('h3', () {
- expect((new HeadingElement.h3()) is HeadingElement, true);
- expect(new Element.tag('h3') is HeadingElement, true);
- });
- test('h4', () {
- expect((new HeadingElement.h4()) is HeadingElement, true);
- expect(new Element.tag('h4') is HeadingElement, true);
- });
- test('h5', () {
- expect((new HeadingElement.h5()) is HeadingElement, true);
- expect(new Element.tag('h5') is HeadingElement, true);
- });
- test('h6', () {
- expect((new HeadingElement.h6()) is HeadingElement, true);
- expect(new Element.tag('h6') is HeadingElement, true);
- });
- test('iframe', () {
- expect((new IFrameElement()) is IFrameElement, true);
- });
- test('img', () {
- expect((new ImageElement()) is ImageElement, true);
- });
- test('input', () {
- expect((new InputElement()) is InputElement, true);
- });
- test('keygen', () {
- expect((new KeygenElement()) is KeygenElement, KeygenElement.supported);
- });
- test('li', () {
- expect((new LIElement()) is LIElement, true);
- });
- test('label', () {
- expect((new LabelElement()) is LabelElement, true);
- });
- test('legend', () {
- expect((new LegendElement()) is LegendElement, true);
- });
- test('link', () {
- expect((new LinkElement()) is LinkElement, true);
- });
- test('map', () {
- expect((new MapElement()) is MapElement, true);
- });
- test('menu', () {
- expect((new MenuElement()) is MenuElement, true);
- });
- test('meta', () {
- expect((new Element.tag('meta')) is MetaElement, true);
- });
- test('meter', () {
- expect((new Element.tag('meter')) is MeterElement, MeterElement.supported);
- });
- test('del', () {
- expect((new Element.tag('del')) is ModElement, true);
- });
- test('ins', () {
- expect((new Element.tag('ins')) is ModElement, true);
- });
- test('object', () {
- expect((new ObjectElement()) is ObjectElement, ObjectElement.supported);
- });
- test('ol', () {
- expect((new OListElement()) is OListElement, true);
- });
- test('optgroup', () {
- expect((new OptGroupElement()) is OptGroupElement, true);
- });
- test('option', () {
- expect((new OptionElement()) is OptionElement, true);
- });
- test('output', () {
- expect((new OutputElement()) is OutputElement, OutputElement.supported);
- });
- test('p', () {
- expect((new ParagraphElement()) is ParagraphElement, true);
- });
- test('param', () {
- expect((new ParamElement()) is ParamElement, true);
- });
- test('pre', () {
- expect((new PreElement()) is PreElement, true);
- });
- test('progress', () {
- expect((new ProgressElement()) is ProgressElement,
- ProgressElement.supported);
- });
- test('q', () {
- expect((new Element.tag('q')) is QuoteElement, true);
- });
- test('script', () {
- expect((new ScriptElement()) is ScriptElement, true);
- });
- test('select', () {
- expect((new SelectElement()) is SelectElement, true);
- });
- test('shadow', () {
- expect((new Element.tag('shadow')) is ShadowElement,
- ShadowElement.supported);
- });
- test('source', () {
- expect((new SourceElement()) is SourceElement, true);
- });
- test('span', () {
- expect((new SpanElement()) is SpanElement, true);
- });
- test('style', () {
- expect((new StyleElement()) is StyleElement, true);
- });
- test('table', () {
- expect((new TableElement()) is TableElement, true);
- });
- test('template', () {
- expect((new TemplateElement()) is TemplateElement,
- TemplateElement.supported);
- });
- test('textarea', () {
- expect((new TextAreaElement()) is TextAreaElement, true);
- });
- test('title', () {
- expect((new TitleElement()) is TitleElement, true);
- });
- test('td', () {
- expect((new TableCellElement()) is TableCellElement, true);
- });
- test('col', () {
- expect((new TableColElement()) is TableColElement, true);
- expect((new Element.tag('colgroup')) is TableColElement, true);
- });
- test('tr', () {
- expect((new TableRowElement()) is TableRowElement, true);
- });
- test('table section', () {
- expect((new Element.tag('tbody')) is TableSectionElement, true);
- expect((new Element.tag('tfoot')) is TableSectionElement, true);
- expect((new Element.tag('thead')) is TableSectionElement, true);
- });
- test('track', () {
- expect((new Element.tag('track')) is TrackElement,
- TrackElement.supported);
- });
- test('ul', () {
- expect((new UListElement()) is UListElement, true);
- var ul = new UListElement();
- var li = new LIElement();
- ul.append(li);
- });
- test('video', () {
- expect((new VideoElement()) is VideoElement, true);
- });
- test('unknown', () {
- expect((new Element.tag('someunknown')) is UnknownElement, true);
- });;
+ check('video', () => new VideoElement() is VideoElement);
+ check('unknown', () => new Element.tag('someunknown') is UnknownElement);
});
}
diff --git a/tests/html/event_customevent_test.dart b/tests/html/event_customevent_test.dart
index 73ae1d9..dc2951e 100644
--- a/tests/html/event_customevent_test.dart
+++ b/tests/html/event_customevent_test.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
library EventCustomEventTest;
-import "package:expect/expect.dart";
+
import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
diff --git a/tests/html/html.status b/tests/html/html.status
index 3d6077d..545b4c4 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -260,9 +260,6 @@
speechrecognition_test/supported: Fail
touchevent_test/supported: Fail
-[ $runtime == ie9 && $checked ]
-element_types_test/constructors: Fail # Issue 10796
-
[ $runtime == opera ]
blob_constructor_test: Fail
canvas_test: Fail
diff --git a/tests/html/svgelement_test.dart b/tests/html/svgelement_test.dart
index 256e766..6bc60b0 100644
--- a/tests/html/svgelement_test.dart
+++ b/tests/html/svgelement_test.dart
@@ -422,4 +422,21 @@
expect(el.classes.length, 0);
});
});
+
+ group('getBoundingClientRect', () {
+ test('is a Rect', () {
+ var element = new svg.RectElement();
+ element.attributes['width'] = '100';
+ element.attributes['height'] = '100';
+ var root = new svg.SvgSvgElement();
+ root.append(element);
+
+ document.body.append(root);
+
+ var rect = element.getBoundingClientRect();
+ expect(rect is Rect, isTrue);
+ expect(rect.width, closeTo(100, 1));
+ expect(rect.height, closeTo(100, 1));
+ });
+ });
}
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 02886a3..e001f6d 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -138,12 +138,21 @@
[ $compiler == dart2js && ( $runtime == ff || $runtime == safari ) ]
isolate_stress_test: Pass, Timeout # http://dartbug.com/10697
-[ $arch == arm ]
-*: Skip
-
[ $arch == simarm ]
*: Skip
+[ $arch == arm ]
+count_stream_test: Crash # Issue: 11207
+cross_isolate_message_stream_test: Crash # Issue: 11207
+mandel_isolate_stream_test: Crash # Issue: 11207
+message2_test: Crash # Issue: 11207
+message_stream2_test: Crash # Issue: 11207
+nested_spawn_stream2_test: Crash # Issue: 11207
+nested_spawn_stream_test: Crash # Issue: 11207
+spawn_function_negative_test: Crash # Issue: 11207
+spawn_uri_vm_negative_test: Crash # Issue: 11207
+stream_mangling_test: Crash # Issue: 11207
+
[ $arch == mips ]
*: Skip
diff --git a/tests/language/cyclic_class_member_test.dart b/tests/language/cyclic_class_member_test.dart
new file mode 100644
index 0000000..63c9651
--- /dev/null
+++ b/tests/language/cyclic_class_member_test.dart
@@ -0,0 +1,17 @@
+// 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 class with a cyclic hierarchy doesn't cause a loop in dart2js.
+
+class A
+ extends A /// 01: compile-time error
+{
+ // When checking that foo isn't overriding an instance method in the
+ // superclass, dart2js might loop.
+ static foo() {}
+}
+
+main() {
+ new A();
+}
diff --git a/tests/language/inferrer_constructor3_test.dart b/tests/language/inferrer_constructor3_test.dart
new file mode 100644
index 0000000..b39012b
--- /dev/null
+++ b/tests/language/inferrer_constructor3_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for dart2js that used to optimistically infer the
+// wrong types for fields because of generative constructors being
+// inlined.
+
+import "package:expect/expect.dart";
+import "compiler_annotations.dart";
+
+class A {
+ var field;
+ A(this.field);
+}
+
+var c = () => new List(42)[0];
+
+main() {
+ bar();
+ // Defeat type inferencing.
+ new A(c());
+ doIt();
+ bar();
+}
+
+@DontInline
+doIt() {
+ () => 42;
+ var c = new A(null);
+ Expect.throws(() => c.field + 42, (e) => e is NoSuchMethodError);
+}
+
+@DontInline
+bar() {
+ () => 42;
+ return inlineLevel1();
+}
+
+inlineLevel1() {
+ return inlineLevel2();
+}
+
+inlineLevel2() {
+ return inlineLevel3();
+}
+
+inlineLevel3() {
+ return inlineLevel4();
+}
+
+inlineLevel4() {
+ return new A(42);
+}
diff --git a/tests/language/language.status b/tests/language/language.status
index f988626..305a45a 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -548,11 +548,6 @@
stack_overflow_test: Crash, Pass
stack_overflow_stacktrace_test: Crash, Pass
-# math_vm_test and double_modulo test fail on SIMARM because the simulator
-# isn't implementing the softfp calling convention correctly.
-math_vm_test: Fail, Pass
-double_modulo_test: Fail, Pass
-
[ $arch == mips ]
*: Skip
diff --git a/tests/language/language_analyzer.status b/tests/language/language_analyzer.status
index 48bf4fc..ebaff6e 100644
--- a/tests/language/language_analyzer.status
+++ b/tests/language/language_analyzer.status
@@ -26,7 +26,6 @@
call_nonexistent_static_test/09: fail
call_nonexistent_static_test/10: fail
call_through_getter_test: fail
-callable_test/none: fail
cast_test/04: fail
cast_test/05: fail
class_cycle_test/03: fail
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index e9b7cf7..31cf098 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -26,7 +26,6 @@
call_nonexistent_static_test/09: fail
call_nonexistent_static_test/10: fail
call_through_getter_test: fail
-callable_test/none: fail
cast_test/04: fail
cast_test/05: fail
class_cycle_test/03: fail
diff --git a/tests/language/string_overflow.dart b/tests/language/string_overflow.dart
new file mode 100644
index 0000000..fd1f285
--- /dev/null
+++ b/tests/language/string_overflow.dart
@@ -0,0 +1,24 @@
+// 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 to ensure that the VM does not have an integer overflow issue
+// when concatenating strings.
+
+import "package:expect/expect.dart";
+
+main()
+{
+ String a = "a";
+ for( ; a.length < 256 * 1024 * 1024 ; )
+ a = a + a;
+
+ var exception_thrown = false;
+ try {
+ var concat = "$a$a$a$a$a$a$a$a";
+ } on OutOfMemoryError catch (exc) {
+ exception_thrown = true;
+ }
+ Expect.isTrue(exception_thrown);
+}
+
diff --git a/tests/language/type_propagation2_test.dart b/tests/language/type_propagation2_test.dart
new file mode 100644
index 0000000..a09041b9
--- /dev/null
+++ b/tests/language/type_propagation2_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for dart2js that used to infinite loop on
+// speculatively propagating types.
+
+class Bar {
+ noSuchMethod(e) => null;
+}
+
+main() {
+ var d = new Bar();
+
+ while (false) {
+ // [input] will change from indexable to unknown: the use line 20
+ // changes its decision because [a2] changes its type from unknown to
+ // null.
+ var input = ((x) {})(null);
+ var p2 = input.keys.firstWhere(null);
+ var a2 = input.keys.firstWhere(null);
+ print(input[a2] == p2);
+ }
+}
diff --git a/tests/lib/async/future_test.dart b/tests/lib/async/future_test.dart
index 7af6893..0074d81 100644
--- a/tests/lib/async/future_test.dart
+++ b/tests/lib/async/future_test.dart
@@ -10,7 +10,7 @@
const Duration MS = const Duration(milliseconds: 1);
-testValue() {
+void testValue() {
final future = new Future<String>.value("42");
var port = new ReceivePort();
future.then((x) {
@@ -19,7 +19,7 @@
});
}
-testSync() {
+void testSync() {
compare(func) {
// Compare the results of the following two futures.
Future f1 = new Future.sync(func);
@@ -52,14 +52,14 @@
Expect.isTrue(hasExecuted);
}
-testNeverComplete() {
+void testNeverComplete() {
final completer = new Completer<int>();
final future = completer.future;
future.then((v) => Expect.fails("Value not expected"));
future.catchError((e) => Expect.fails("Value not expected"));
}
-testComplete() {
+void testComplete() {
final completer = new Completer<int>();
final future = completer.future;
Expect.isFalse(completer.isCompleted);
@@ -72,7 +72,7 @@
// Tests for [then]
-testCompleteWithSuccessHandlerBeforeComplete() {
+void testCompleteWithSuccessHandlerBeforeComplete() {
final completer = new Completer<int>();
final future = completer.future;
@@ -89,7 +89,7 @@
Expect.isNull(after);
}
-testCompleteWithSuccessHandlerAfterComplete() {
+void testCompleteWithSuccessHandlerAfterComplete() {
final completer = new Completer<int>();
final future = completer.future;
@@ -105,7 +105,7 @@
});
}
-testCompleteManySuccessHandlers() {
+void testCompleteManySuccessHandlers() {
final completer = new Completer<int>();
final future = completer.future;
int before;
@@ -129,7 +129,7 @@
// Tests for [catchError]
-testException() {
+void testException() {
final completer = new Completer<int>();
final future = completer.future;
final ex = new Exception();
@@ -144,7 +144,7 @@
completer.completeError(ex);
}
-testExceptionHandler() {
+void testExceptionHandler() {
final completer = new Completer<int>();
final future = completer.future;
final ex = new Exception();
@@ -163,7 +163,7 @@
});
}
-testExceptionHandlerReturnsTrue() {
+void testExceptionHandlerReturnsTrue() {
final completer = new Completer<int>();
final future = completer.future;
final ex = new Exception();
@@ -178,7 +178,7 @@
Expect.isFalse(reached);
}
-testExceptionHandlerReturnsTrue2() {
+void testExceptionHandlerReturnsTrue2() {
final completer = new Completer<int>();
final future = completer.future;
final ex = new Exception();
@@ -196,7 +196,7 @@
});
}
-testExceptionHandlerReturnsFalse() {
+void testExceptionHandlerReturnsFalse() {
final completer = new Completer<int>();
final future = completer.future;
final ex = new Exception();
@@ -213,7 +213,7 @@
Expect.isFalse(reached);
}
-testFutureAsStreamCompleteAfter() {
+void testFutureAsStreamCompleteAfter() {
var completer = new Completer();
bool gotValue = false;
var port = new ReceivePort();
@@ -230,7 +230,7 @@
completer.complete("value");
}
-testFutureAsStreamCompleteBefore() {
+void testFutureAsStreamCompleteBefore() {
var completer = new Completer();
bool gotValue = false;
var port = new ReceivePort();
@@ -247,7 +247,7 @@
});
}
-testFutureAsStreamCompleteImmediate() {
+void testFutureAsStreamCompleteImmediate() {
bool gotValue = false;
var port = new ReceivePort();
new Future.value("value").asStream().listen(
@@ -262,7 +262,7 @@
});
}
-testFutureAsStreamCompleteErrorAfter() {
+void testFutureAsStreamCompleteErrorAfter() {
var completer = new Completer();
bool gotError = false;
var port = new ReceivePort();
@@ -282,7 +282,7 @@
completer.completeError("error");
}
-testFutureAsStreamWrapper() {
+void testFutureAsStreamWrapper() {
var completer = new Completer();
bool gotValue = false;
var port = new ReceivePort();
@@ -301,7 +301,7 @@
});
}
-testFutureWhenCompleteValue() {
+void testFutureWhenCompleteValue() {
var port = new ReceivePort();
int counter = 2;
countDown() {
@@ -317,7 +317,7 @@
completer.complete(42);
}
-testFutureWhenCompleteError() {
+void testFutureWhenCompleteError() {
var port = new ReceivePort();
int counter = 2;
countDown() {
@@ -333,7 +333,7 @@
completer.completeError("error");
}
-testFutureWhenCompleteValueNewError() {
+void testFutureWhenCompleteValueNewError() {
var port = new ReceivePort();
int counter = 2;
countDown() {
@@ -352,7 +352,7 @@
completer.complete(42);
}
-testFutureWhenCompleteErrorNewError() {
+void testFutureWhenCompleteErrorNewError() {
var port = new ReceivePort();
int counter = 2;
countDown() {
@@ -371,7 +371,7 @@
completer.completeError("error");
}
-testFutureWhenCompletePreValue() {
+void testFutureWhenCompletePreValue() {
var port = new ReceivePort();
int counter = 2;
countDown() {
@@ -389,7 +389,7 @@
});
}
-testFutureWhenValueFutureValue() {
+void testFutureWhenValueFutureValue() {
var port = new ReceivePort();
int counter = 3;
@@ -414,7 +414,7 @@
completer.complete(42);
}
-testFutureWhenValueFutureError() {
+void testFutureWhenValueFutureError() {
var port = new ReceivePort();
int counter = 3;
countDown(int expect) {
@@ -440,7 +440,7 @@
completer.complete(42);
}
-testFutureWhenErrorFutureValue() {
+void testFutureWhenErrorFutureValue() {
var port = new ReceivePort();
int counter = 3;
countDown(int expect) {
@@ -466,7 +466,7 @@
completer.completeError("Error");
}
-testFutureWhenErrorFutureError() {
+void testFutureWhenErrorFutureError() {
var port = new ReceivePort();
int counter = 3;
countDown(int expect) {
@@ -492,7 +492,7 @@
completer.completeError("Error");
}
-testFutureThenThrowsAsync() {
+void testFutureThenThrowsAsync() {
final completer = new Completer<int>();
final future = completer.future;
int error = 42;
@@ -507,7 +507,7 @@
completer.complete(0);
}
-testFutureCatchThrowsAsync() {
+void testFutureCatchThrowsAsync() {
final completer = new Completer<int>();
final future = completer.future;
int error = 42;
@@ -522,7 +522,7 @@
completer.completeError(0);
}
-testFutureCatchRethrowsAsync() {
+void testFutureCatchRethrowsAsync() {
final completer = new Completer<int>();
final future = completer.future;
var error;
@@ -538,7 +538,7 @@
completer.completeError(0);
}
-testFutureWhenThrowsAsync() {
+void testFutureWhenThrowsAsync() {
final completer = new Completer<int>();
final future = completer.future;
var error = 42;
@@ -553,7 +553,7 @@
completer.complete(0);
}
-testCompleteWithError() {
+void testCompleteWithError() {
final completer = new Completer<int>();
final future = completer.future;
var error = 42;
@@ -567,7 +567,7 @@
completer.completeError(error);
}
-testChainedFutureValue() {
+void testChainedFutureValue() {
final completer = new Completer();
final future = completer.future;
var port = new ReceivePort();
@@ -580,7 +580,7 @@
completer.complete(21);
}
-testChainedFutureValueDelay() {
+void testChainedFutureValueDelay() {
final completer = new Completer();
final future = completer.future;
var port = new ReceivePort();
@@ -594,7 +594,7 @@
completer.complete(21);
}
-testChainedFutureValue2Delay() {
+void testChainedFutureValue2Delay() {
var port = new ReceivePort();
new Future.delayed(const Duration(milliseconds: 10))
@@ -603,7 +603,8 @@
port.close();
});
}
-testChainedFutureError() {
+
+void testChainedFutureError() {
final completer = new Completer();
final future = completer.future;
var port = new ReceivePort();
@@ -616,6 +617,22 @@
completer.complete(21);
}
+void testChainedFutureCycle() {
+ var port = new ReceivePort(); // Keep alive until port is closed.
+ var completer = new Completer();
+ var future, future2;
+ future = completer.future.then((_) => future2);
+ future2 = completer.future.then((_) => future);
+ completer.complete(42);
+ int ctr = 2;
+ void receiveError(e) {
+ Expect.isTrue(e is StateError);
+ if (--ctr == 0) port.close();
+ }
+ future.catchError(receiveError);
+ future.catchError(receiveError);
+}
+
main() {
testValue();
testSync();
@@ -657,6 +674,5 @@
testChainedFutureValue();
testChainedFutureValueDelay();
testChainedFutureError();
+ testChainedFutureCycle();
}
-
-
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index b746139..093283e 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -21,19 +21,17 @@
[ $compiler == dart2js && $minified ]
mirrors/mirrors_resolve_fields_test: Fail # Issue 6490
+mirrors/disable_tree_shaking_test: Fail # Issue 6490
[ $csp ]
mirrors/metadata_test: Fail # Issue 6490
mirrors/reflect_runtime_type_test: Fail # Issue 6490
mirrors/reflect_uninstantiated_class_test: Fail # Issue 6490
-
+mirrors/superclass_test: Fail # Issue 6490
[ $compiler == dart2js && $checked ]
async/stream_event_transform_test: Fail # Issue 7733.
-[ $compiler == dart2js && $unchecked && ($runtime == d8 || $runtime == chrome || $runtime == drt) ]
-crypto/sha1_test: Fail # V8 bug: https://code.google.com/p/v8/issues/detail?id=2692
-
[ $compiler == dart2js && $jscl ]
async/future_test: Fail # Timer interface not supported; dartbug.com/7728.
async/slow_consumer2_test: Fail # Timer interface not supported; dartbug.com/7728.
@@ -57,8 +55,6 @@
async/stream_periodic5_test: Fail # Timer interface not supported; dartbug.com/7728.
[ $compiler == dart2js && $browser ]
-crypto/sha256_test: Slow, Pass
-crypto/sha1_test: Slow, Pass
async/timer_not_available_test: Fail, OK # only meant to test when there is no way to
# implement timer (currently only in d8)
@@ -75,12 +71,9 @@
typed_data/float32x4_unbox_regress_test: Fail # Issue 10961
mirrors/reflect_runtime_type_test: Fail
mirrors/reflect_uninstantiated_class_test: Fail
+mirrors/disable_tree_shaking_test: Fail
-[ $runtime == safari]
- # Bug in JSC: the test only passes when being debugged.
-crypto/hmac_md5_test: Fail, Pass
-
[ $runtime == ff ]
# FF setTimeout can fire early: https://bugzilla.mozilla.org/show_bug.cgi?id=291386
multiple_timer_test: Pass, Fail
@@ -105,6 +98,7 @@
[ $runtime == vm || ($compiler == none && $runtime == drt) ]
async/run_async3_test: Fail # _enqueueImmediate runs after Timer. http://dartbug.com/9001.
mirrors/metadata_test: Fail # http://dartbug.com/10906
+mirrors/superclass_test: Fail # http://dartbug.com/11142
[ $compiler == none && $runtime == drt ]
async/timer_isolate_test: Skip # See Issue 4997
@@ -117,12 +111,29 @@
async/multiple_timer_test: Fail, Pass # See Issue 10982
async/timer_test: Fail, Pass # See Issue 10982
-[ $arch == arm ]
-*: Skip
-
[ $arch == simarm ]
*: Skip
+[ $arch == arm ]
+async/slow_consumer2_test: Crash # Issue: 11207
+async/slow_consumer3_test: Crash # Issue: 11207
+async/slow_consumer_test: Crash # Issue: 11207
+async/stream_controller_async_test: Crash # Issue: 11207
+async/stream_from_iterable_test: Crash # Issue: 11207
+async/stream_periodic3_test: Crash # Issue: 11207
+async/stream_periodic4_test: Crash # Issue: 11207
+async/stream_periodic5_test: Crash # Issue: 11207
+async/stream_state_nonzero_timer_test: Crash # Issue: 11207
+async/stream_state_test: Crash # Issue: 11207
+async/stream_subscription_as_future_test: Crash # Issue: 11207
+async/stream_transform_test: Crash # Issue: 11207
+math/pi_test: Fail # Issue: 11207
+math/random_test: Fail # Issue: 11207
+typed_data/float32x4_list_test: Crash # Issue: 11207
+typed_data/float32x4_test: Crash # Issue: 11207
+typed_data/float32x4_unbox_phi_test: Crash # Issue: 11207
+typed_data/float32x4_unbox_regress_test: Crash # Issue: 11207
+
[ $arch == mips ]
*: Skip
diff --git a/tests/lib/mirrors/disable_tree_shaking_test.dart b/tests/lib/mirrors/disable_tree_shaking_test.dart
new file mode 100644
index 0000000..b34f352
--- /dev/null
+++ b/tests/lib/mirrors/disable_tree_shaking_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.
+
+// Ensure that reflection works on methods that would otherwise be
+// tree-shaken away.
+
+import "dart:mirrors";
+
+class Foo {
+ Foo();
+ foo() => 42;
+}
+
+main() {
+ // Do NOT instantiate Foo.
+ var m = reflectClass(Foo);
+ var instanceMirror = m.newInstance(new Symbol(''), []);
+ var result = instanceMirror.invoke(new Symbol('foo'), []).reflectee;
+ if (result != 42) {
+ throw 'Expected 42, but got $result';
+ }
+}
diff --git a/tests/lib/mirrors/generic_list_test.dart b/tests/lib/mirrors/generic_list_test.dart
new file mode 100644
index 0000000..79d5e94
--- /dev/null
+++ b/tests/lib/mirrors/generic_list_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.superclass;
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+class Foo<T> {
+ List<T> makeList() {
+ if (new DateTime.now().millisecondsSinceEpoch == 42) return [];
+ return new List<T>();
+ }
+}
+
+main() {
+ List<String> list = new Foo<String>().makeList();
+ var cls = reflectClass(list.runtimeType);
+ Expect.isNotNull(cls, 'Failed to reflect on MyClass.');
+}
diff --git a/tests/lib/mirrors/superclass_test.dart b/tests/lib/mirrors/superclass_test.dart
new file mode 100644
index 0000000..a558c9d
--- /dev/null
+++ b/tests/lib/mirrors/superclass_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.superclass;
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+class MyClass {
+}
+
+main() {
+ var cls = reflectClass(MyClass);
+ Expect.isNotNull(cls, 'Failed to reflect on MyClass.');
+ var superclass = cls.superclass;
+ Expect.isNotNull(superclass, 'Failed to obtain superclass of MyClass.');
+ Expect.equals(
+ reflectClass(Object), superclass, 'Superclass of MyClass is not Object.');
+ Expect.isNull(superclass.superclass, 'Superclass of Object is not null.');
+}
diff --git a/tests/standalone/io/directory_error_test.dart b/tests/standalone/io/directory_error_test.dart
index 123954c..9026513 100644
--- a/tests/standalone/io/directory_error_test.dart
+++ b/tests/standalone/io/directory_error_test.dart
@@ -15,7 +15,7 @@
bool checkCreateInNonExistentFileException(e) {
- Expect.isTrue(e is DirectoryIOException);
+ Expect.isTrue(e is DirectoryException);
Expect.isTrue(e.osError != null);
Expect.isTrue(e.toString().indexOf("Creation failed") != -1);
if (Platform.operatingSystem == "linux") {
@@ -43,7 +43,7 @@
bool checkCreateTempInNonExistentFileException(e) {
- Expect.isTrue(e is DirectoryIOException);
+ Expect.isTrue(e is DirectoryException);
Expect.isTrue(e.osError != null);
if (Platform.operatingSystem == "linux") {
Expect.equals(2, e.osError.errorCode);
@@ -70,7 +70,7 @@
bool checkDeleteNonExistentFileException(e) {
- Expect.isTrue(e is DirectoryIOException);
+ Expect.isTrue(e is DirectoryException);
Expect.isTrue(e.osError != null);
// File not not found has error code 2 on all supported platforms.
Expect.equals(2, e.osError.errorCode);
@@ -92,7 +92,7 @@
bool checkDeleteRecursivelyNonExistentFileException(e) {
- Expect.isTrue(e is DirectoryIOException);
+ Expect.isTrue(e is DirectoryException);
Expect.isTrue(e.osError != null);
Expect.isTrue(e.toString().indexOf("Deletion failed") != -1);
// File not not found has error code 2 on all supported platforms.
@@ -115,7 +115,7 @@
bool checkListNonExistentFileException(e) {
- Expect.isTrue(e is DirectoryIOException);
+ Expect.isTrue(e is DirectoryException);
Expect.isTrue(e.osError != null);
Expect.isTrue(e.toString().indexOf("Directory listing failed") != -1);
if (Platform.operatingSystem == "linux") {
@@ -137,7 +137,7 @@
void testListNonExistent(Directory temp, Function done) {
Directory nonExistent = new Directory("${temp.path}/nonExistent");
- Expect.throws(() => nonExistent.listSync(), (e) => e is DirectoryIOException);
+ Expect.throws(() => nonExistent.listSync(), (e) => e is DirectoryException);
nonExistent.list().listen(
(_) => Expect.fail("listing should not succeed"),
onError: (e) {
@@ -151,11 +151,11 @@
Directory nonExistent = new Directory("${temp.path}/nonExistent");
var newPath = "${temp.path}/nonExistent2";
Expect.throws(() => nonExistent.renameSync(newPath),
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
var renameDone = nonExistent.rename(newPath);
renameDone.then((ignore) => Expect.fail('rename non existent'))
.catchError((error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
done();
});
}
@@ -167,11 +167,11 @@
f.createSync();
var d = new Directory(f.path);
Expect.throws(() => d.renameSync(newPath),
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
var renameDone = d.rename(newPath);
renameDone.then((ignore) => Expect.fail('rename file as directory'))
.catchError((error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
done();
});
}
@@ -183,11 +183,11 @@
var fileName = '${temp.path}/x';
new File(fileName).createSync();
Expect.throws(() => temp1.renameSync(fileName),
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
var renameDone = temp1.rename(fileName);
renameDone.then((ignore) => Expect.fail('rename dir overwrite file'))
.catchError((error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
temp1.deleteSync(recursive: true);
done();
});
diff --git a/tests/standalone/io/directory_list_nonexistent_test.dart b/tests/standalone/io/directory_list_nonexistent_test.dart
index 1e58f63..b514924 100644
--- a/tests/standalone/io/directory_list_nonexistent_test.dart
+++ b/tests/standalone/io/directory_list_nonexistent_test.dart
@@ -15,9 +15,9 @@
var keepAlive = new ReceivePort();
new Directory("").createTemp().then((d) {
d.delete().then((ignore) {
- Expect.throws(() => d.listSync(), (e) => e is DirectoryIOException);
+ Expect.throws(() => d.listSync(), (e) => e is DirectoryException);
Expect.throws(() => d.listSync(recursive: true),
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
keepAlive.close();
});
});
@@ -38,9 +38,9 @@
}
var long = new Directory("${buffer.toString()}");
Expect.throws(() => long.listSync(),
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
Expect.throws(() => long.listSync(recursive: true),
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
d.deleteSync(recursive: true);
keepAlive.close();
});
diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart
index e455343..6592281 100644
--- a/tests/standalone/io/directory_test.dart
+++ b/tests/standalone/io/directory_test.dart
@@ -90,7 +90,7 @@
stream.listen(
(_) => Expect.fail("Listing of non-existing directory should fail"),
onError: (error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
});
}
new Directory("").createTemp().then((d) {
@@ -109,7 +109,7 @@
stream.listen(
(_) => Expect.fail("Listing of non-existing directory should fail"),
onError: (error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
if (++errors == 2) {
d.delete(recursive: true).then((_) {
port.close();
@@ -140,7 +140,7 @@
future.then((ignore) {
Expect.fail("Deletion of non-existing directory should fail");
}).catchError((error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
});
}
@@ -168,7 +168,7 @@
var long = new Directory("${buffer.toString()}");
var errors = 0;
onError(error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
if (++errors == 2) {
d.delete(recursive: true).then((ignore) => port.close());
}
@@ -473,7 +473,7 @@
var location = illegalTempDirectoryLocation();
if (location != null) {
Expect.throws(new Directory(location).createTempSync,
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
}
}
@@ -537,7 +537,7 @@
file.createSync();
Expect.isTrue(file.existsSync());
Expect.throws(new Directory(path).createSync,
- (e) => e is DirectoryIOException);
+ (e) => e is DirectoryException);
temp.deleteSync(recursive: true);
}
@@ -554,7 +554,7 @@
subDir.create()
.then((_) { Expect.fail("dir create should fail on existing file"); })
.catchError((error) {
- Expect.isTrue(error is DirectoryIOException);
+ Expect.isTrue(error is DirectoryException);
temp.delete(recursive: true).then((_) {
port.close();
});
diff --git a/tests/standalone/io/file_error_test.dart b/tests/standalone/io/file_error_test.dart
index 8af6f1f..27753d6 100644
--- a/tests/standalone/io/file_error_test.dart
+++ b/tests/standalone/io/file_error_test.dart
@@ -14,7 +14,7 @@
bool checkNonExistentFileException(e, str) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.osError != null);
Expect.isTrue(e.toString().indexOf(str) != -1);
// File not not found has error code 2 on all supported platforms.
@@ -105,7 +105,7 @@
bool checkCreateInNonExistentDirectoryException(e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.osError != null);
Expect.isTrue(e.toString().indexOf("Cannot create file") != -1);
if (Platform.operatingSystem == "linux") {
@@ -141,7 +141,7 @@
}
bool checkFullPathOnNonExistentDirectoryException(e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.osError != null);
Expect.isTrue(e.toString().indexOf("Cannot retrieve full path") != -1);
// File not not found has error code 2 on all supported platforms.
@@ -235,7 +235,7 @@
}
bool checkWriteReadOnlyFileException(e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.osError != null);
Expect.isTrue(e.osError.errorCode != OSError.noErrorCode);
return true;
@@ -313,7 +313,7 @@
}
bool checkFileClosedException(e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.toString().indexOf("File closed") != -1);
Expect.isTrue(e.osError == null);
return true;
@@ -405,7 +405,7 @@
var closeFuture = openedFile.close();
closeFuture.then((ignore) => null)
.catchError((error) {
- Expect.isTrue(error is FileIOException);
+ Expect.isTrue(error is FileException);
port.send(null);
});
});
@@ -417,7 +417,7 @@
var openedFile = file.openSync();
openedFile.closeSync();
Expect.throws(openedFile.closeSync,
- (e) => e is FileIOException);
+ (e) => e is FileException);
port.send(null);
});
}
@@ -427,7 +427,7 @@
var bigint = 100000000000000000000000000000000000000000;
var openedFile = file.openSync();
Expect.throws(() => openedFile.readSync(bigint),
- (e) => e is FileIOException);
+ (e) => e is FileException);
openedFile.closeSync();
port.send(null);
});
@@ -438,7 +438,7 @@
var openedFile = file.openSync();
openedFile.closeSync();
Expect.throws(() => openedFile.readSync(1),
- (e) => e is FileIOException);
+ (e) => e is FileException);
port.send(null);
});
}
diff --git a/tests/standalone/io/file_invalid_arguments_test.dart b/tests/standalone/io/file_invalid_arguments_test.dart
index 273a8c7..3ae9a9c 100644
--- a/tests/standalone/io/file_invalid_arguments_test.dart
+++ b/tests/standalone/io/file_invalid_arguments_test.dart
@@ -15,7 +15,7 @@
file.readSync(arg);
Expect.fail('exception expected');
} catch (e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.toString().contains('Invalid arguments'));
}
@@ -25,7 +25,7 @@
Expect.fail('exception expected');
}).catchError((error) {
errors++;
- Expect.isTrue(error is FileIOException);
+ Expect.isTrue(error is FileException);
Expect.isTrue(error.toString().contains('Invalid arguments'));
file.close().then((ignore) {
Expect.equals(1, errors);
@@ -42,7 +42,7 @@
file.readIntoSync(buffer, start, end);
Expect.fail('exception expected');
} catch (e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.toString().contains('Invalid arguments'));
}
@@ -52,7 +52,7 @@
Expect.fail('exception expected');
}).catchError((error) {
errors++;
- Expect.isTrue(error is FileIOException);
+ Expect.isTrue(error is FileException);
Expect.isTrue(error.toString().contains('Invalid arguments'));
file.close().then((ignore) {
Expect.equals(1, errors);
@@ -69,7 +69,7 @@
file.writeByteSync(value);
Expect.fail('exception expected');
} catch (e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.toString().contains('Invalid argument'));
}
@@ -77,7 +77,7 @@
writeByteFuture.then((ignore) {
Expect.fail('exception expected');
}).catchError((error) {
- Expect.isTrue(error is FileIOException);
+ Expect.isTrue(error is FileException);
Expect.isTrue(error.toString().contains('Invalid argument'));
file.close().then((ignore) {
port.close();
@@ -93,7 +93,7 @@
file.writeFromSync(buffer, start, end);
Expect.fail('exception expected');
} catch (e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
Expect.isTrue(e.toString().contains('Invalid arguments'));
}
@@ -101,7 +101,7 @@
writeFromFuture.then((ignore) {
Expect.fail('exception expected');
}).catchError((error) {
- Expect.isTrue(error is FileIOException);
+ Expect.isTrue(error is FileException);
Expect.isTrue(error.toString().contains('Invalid arguments'));
file.close().then((ignore) {
port.close();
@@ -117,14 +117,14 @@
file.writeStringSync(string, encoding: encoding);
Expect.fail('exception expected');
} catch (e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
}
var writeStringFuture = file.writeString(string, encoding: encoding);
writeStringFuture.then((ignore) {
Expect.fail('exception expected');
}).catchError((error) {
- Expect.isTrue(error is FileIOException);
+ Expect.isTrue(error is FileException);
file.close().then((ignore) {
port.close();
});
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index 64cedd8..b931475 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -713,7 +713,7 @@
openedFile.closeSync();
try {
openedFile.readByteSync();
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -723,7 +723,7 @@
exceptionCaught = false;
try {
openedFile.writeByteSync(1);
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -733,7 +733,7 @@
exceptionCaught = false;
try {
openedFile.writeStringSync("Test");
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -744,7 +744,7 @@
try {
List<int> buffer = new List<int>(100);
openedFile.readIntoSync(buffer, 0, 10);
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -755,7 +755,7 @@
try {
List<int> buffer = new List<int>(100);
openedFile.writeFromSync(buffer, 0, 10);
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -765,7 +765,7 @@
exceptionCaught = false;
try {
openedFile.positionSync();
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -775,7 +775,7 @@
exceptionCaught = false;
try {
openedFile.lengthSync();
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -785,7 +785,7 @@
exceptionCaught = false;
try {
openedFile.flushSync();
- } on FileIOException catch (ex) {
+ } on FileException catch (ex) {
exceptionCaught = true;
} on Exception catch (ex) {
wrongExceptionCaught = true;
@@ -922,7 +922,7 @@
f.openSync();
Expect.fail("Expected exception opening directory as file");
} catch (e) {
- Expect.isTrue(e is FileIOException);
+ Expect.isTrue(e is FileException);
}
}
@@ -1086,9 +1086,9 @@
Expect.equals(1, message);
});
var f = new File('.');
- Expect.throws(f.readAsBytesSync, (e) => e is FileIOException);
- Expect.throws(f.readAsStringSync, (e) => e is FileIOException);
- Expect.throws(f.readAsLinesSync, (e) => e is FileIOException);
+ Expect.throws(f.readAsBytesSync, (e) => e is FileException);
+ Expect.throws(f.readAsStringSync, (e) => e is FileException);
+ Expect.throws(f.readAsLinesSync, (e) => e is FileException);
var readAsBytesFuture = f.readAsBytes();
readAsBytesFuture.then((bytes) => Expect.fail("no bytes expected"))
.catchError((e) {
diff --git a/tests/standalone/io/http_client_connect_test.dart b/tests/standalone/io/http_client_connect_test.dart
index 67ee2a5..c4c4798 100644
--- a/tests/standalone/io/http_client_connect_test.dart
+++ b/tests/standalone/io/http_client_connect_test.dart
@@ -76,7 +76,7 @@
Expect.fail("Request not expected");
})
.catchError((error) => port.close(),
- test: (error) => error is HttpParserException);
+ test: (error) => error is HttpException);
});
}
diff --git a/tests/standalone/io/http_content_length_test.dart b/tests/standalone/io/http_content_length_test.dart
index 335121d..645e8e8 100644
--- a/tests/standalone/io/http_content_length_test.dart
+++ b/tests/standalone/io/http_content_length_test.dart
@@ -1,6 +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.
+//
+// VMOptions=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
import "package:expect/expect.dart";
import "dart:async";
@@ -8,7 +13,7 @@
import "dart:io";
void testNoBody(int totalConnections, bool explicitContentLength) {
- var errors = 0;
+ int count = 0;
HttpServer.bind("127.0.0.1", 0, backlog: totalConnections).then((server) {
server.listen(
(HttpRequest request) {
@@ -22,6 +27,9 @@
})
.catchError((error) {
Expect.isTrue(error is HttpException);
+ if (++count == totalConnections) {
+ server.close();
+ }
});
// write with content length 0 closes the connection and
// reports an error.
@@ -42,7 +50,6 @@
Expect.fail(msg);
});
- int count = 0;
HttpClient client = new HttpClient();
for (int i = 0; i < totalConnections; i++) {
client.get("127.0.0.1", server.port, "/")
@@ -55,14 +62,7 @@
.then((response) {
Expect.equals("0", response.headers.value('content-length'));
Expect.equals(0, response.contentLength);
- response.listen(
- (d) {},
- onDone: () {
- if (++count == totalConnections) {
- client.close();
- server.close();
- }
- });
+ response.drain();
})
.catchError((e) {
String msg = "Unexpected error $e";
@@ -258,7 +258,9 @@
void main() {
testNoBody(5, false);
+ testNoBody(25, false);
testNoBody(5, true);
+ testNoBody(25, true);
testBody(5, false);
testBody(5, true);
testBodyChunked(5, false);
diff --git a/tests/standalone/io/http_date_test.dart b/tests/standalone/io/http_date_test.dart
index df88afe..f3205ab 100644
--- a/tests/standalone/io/http_date_test.dart
+++ b/tests/standalone/io/http_date_test.dart
@@ -6,6 +6,7 @@
import "dart:async";
import "dart:math";
+part '../../../sdk/lib/io/common.dart';
part "../../../sdk/lib/io/io_sink.dart";
part "../../../sdk/lib/io/http.dart";
part "../../../sdk/lib/io/http_impl.dart";
diff --git a/tests/standalone/io/http_detach_socket_test.dart b/tests/standalone/io/http_detach_socket_test.dart
index 2345079..1ced3d8 100644
--- a/tests/standalone/io/http_detach_socket_test.dart
+++ b/tests/standalone/io/http_detach_socket_test.dart
@@ -13,6 +13,7 @@
void testServerDetachSocket() {
HttpServer.bind("127.0.0.1", 0).then((server) {
+ server.serverHeader = null;
server.listen((request) {
var response = request.response;
response.contentLength = 0;
@@ -89,6 +90,7 @@
});
var client = new HttpClient();
+ client.userAgent = null;
client.get("127.0.0.1", server.port, "/")
.then((request) => request.close())
.then((response) {
diff --git a/tests/standalone/io/http_headers_test.dart b/tests/standalone/io/http_headers_test.dart
index b477497..a6cca81 100644
--- a/tests/standalone/io/http_headers_test.dart
+++ b/tests/standalone/io/http_headers_test.dart
@@ -6,6 +6,7 @@
import 'dart:async';
import 'dart:math';
+part '../../../sdk/lib/io/common.dart';
part "../../../sdk/lib/io/io_sink.dart";
part "../../../sdk/lib/io/http.dart";
part "../../../sdk/lib/io/http_headers.dart";
diff --git a/tests/standalone/io/http_parser_test.dart b/tests/standalone/io/http_parser_test.dart
index a2ebc78..8ff7713 100644
--- a/tests/standalone/io/http_parser_test.dart
+++ b/tests/standalone/io/http_parser_test.dart
@@ -8,6 +8,7 @@
import 'dart:typed_data';
import 'dart:isolate';
+part '../../../sdk/lib/io/common.dart';
part '../../../sdk/lib/io/io_sink.dart';
part '../../../sdk/lib/io/http.dart';
part '../../../sdk/lib/io/http_impl.dart';
diff --git a/tests/standalone/io/http_redirect_test.dart b/tests/standalone/io/http_redirect_test.dart
index f67ff751..d0b78a0 100644
--- a/tests/standalone/io/http_redirect_test.dart
+++ b/tests/standalone/io/http_redirect_test.dart
@@ -391,7 +391,7 @@
Expect.equals(5, error.redirects.length);
server.close();
client.close();
- }, test: (e) => e is RedirectLimitExceededException);
+ }, test: (e) => e is RedirectException);
});
}
@@ -406,7 +406,7 @@
Expect.equals(2, error.redirects.length);
server.close();
client.close();
- }, test: (e) => e is RedirectLoopException);
+ }, test: (e) => e is RedirectException);
});
}
diff --git a/tests/standalone/io/http_server_response_test.dart b/tests/standalone/io/http_server_response_test.dart
index f31d183..307cec1 100644
--- a/tests/standalone/io/http_server_response_test.dart
+++ b/tests/standalone/io/http_server_response_test.dart
@@ -43,12 +43,12 @@
client.close();
},
onError: (error) {
- Expect.isTrue(error is HttpParserException);
+ Expect.isTrue(error is HttpException);
});
})
.catchError((error) {
client.close();
- }, test: (e) => e is HttpParserException);
+ }, test: (e) => e is HttpException);
});
}
diff --git a/tests/standalone/io/http_shutdown_test.dart b/tests/standalone/io/http_shutdown_test.dart
index f6b1424..dd5b622 100644
--- a/tests/standalone/io/http_shutdown_test.dart
+++ b/tests/standalone/io/http_shutdown_test.dart
@@ -173,7 +173,7 @@
return request.close();
})
.then((response) { })
- .catchError((e) { }, test: (e) => e is HttpParserException);
+ .catchError((e) { }, test: (e) => e is HttpException);
}
bool clientClosed = false;
new Timer.periodic(new Duration(milliseconds: 100), (timer) {
diff --git a/tests/standalone/io/raw_secure_server_socket_test.dart b/tests/standalone/io/raw_secure_server_socket_test.dart
index a07083b..a886f7d 100644
--- a/tests/standalone/io/raw_secure_server_socket_test.dart
+++ b/tests/standalone/io/raw_secure_server_socket_test.dart
@@ -33,7 +33,7 @@
RawSecureServerSocket.bind("ko.faar.__hest__", 0, CERTIFICATE).then((_) {
Expect.fail("Failure expected");
}).catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -41,7 +41,7 @@
RawSecureServerSocket.bind("8.8.8.8", 0, CERTIFICATE).then((_) {
Expect.fail("Failure expected");
}).catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -61,7 +61,7 @@
})
.catchError((error) {
Expect.notEquals('windows', Platform.operatingSystem);
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
s.close();
port.toSendPort().send(1);
});
@@ -83,7 +83,7 @@
});
}
-void testSimpleConnectFail(String certificate) {
+void testSimpleConnectFail(String certificate, bool cancelOnError) {
ReceivePort port = new ReceivePort();
RawSecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
var clientEndFuture = RawSecureSocket.connect(HOST_NAME, server.port)
@@ -91,15 +91,19 @@
Expect.fail("No client connection expected.");
})
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
});
server.listen((serverEnd) {
Expect.fail("No server connection expected.");
},
onError: (error) {
- Expect.isTrue(error is SocketIOException);
- clientEndFuture.then((_) => port.close());
- });
+ Expect.isTrue(error is SocketException);
+ clientEndFuture.then((_) {
+ if (!cancelOnError) server.close();
+ port.close();
+ });
+ },
+ cancelOnError: cancelOnError);
});
}
@@ -445,8 +449,10 @@
testInvalidBind();
testSimpleConnect(CERTIFICATE);
testSimpleConnect("CN=localhost");
- testSimpleConnectFail("not_a_nickname");
- testSimpleConnectFail("CN=notARealDistinguishedName");
+ testSimpleConnectFail("not_a_nickname", false);
+ testSimpleConnectFail("CN=notARealDistinguishedName", false);
+ testSimpleConnectFail("not_a_nickname", true);
+ testSimpleConnectFail("CN=notARealDistinguishedName", true);
testServerListenAfterConnect();
testSimpleReadWrite(true, true, false);
testSimpleReadWrite(true, false, false);
diff --git a/tests/standalone/io/raw_socket_test.dart b/tests/standalone/io/raw_socket_test.dart
index ed5c494..609b96f 100644
--- a/tests/standalone/io/raw_socket_test.dart
+++ b/tests/standalone/io/raw_socket_test.dart
@@ -35,7 +35,7 @@
RawServerSocket.bind("ko.faar.__hest__", 0)
.then((_) { Expect.fail("Failure expected"); } )
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -43,7 +43,7 @@
RawServerSocket.bind("8.8.8.8", 0)
.then((_) { Expect.fail("Failure expected"); } )
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -61,7 +61,7 @@
})
.catchError((error) {
Expect.notEquals('windows', Platform.operatingSystem);
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
});
diff --git a/tests/standalone/io/secure_no_builtin_roots_database_test.dart b/tests/standalone/io/secure_no_builtin_roots_database_test.dart
index dcdb2be..b5a06af 100644
--- a/tests/standalone/io/secure_no_builtin_roots_database_test.dart
+++ b/tests/standalone/io/secure_no_builtin_roots_database_test.dart
@@ -14,7 +14,7 @@
.then((request) => request.close())
.then((response) => Expect.fail("Unexpected successful connection"))
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
keepAlive.close();
client.close();
});
diff --git a/tests/standalone/io/secure_no_builtin_roots_test.dart b/tests/standalone/io/secure_no_builtin_roots_test.dart
index a71c5fc..9bc5ef6 100644
--- a/tests/standalone/io/secure_no_builtin_roots_test.dart
+++ b/tests/standalone/io/secure_no_builtin_roots_test.dart
@@ -14,7 +14,7 @@
.then((request) => request.close())
.then((response) => Expect.fail("Unexpected successful connection"))
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
keepAlive.close();
client.close();
});
diff --git a/tests/standalone/io/secure_server_socket_test.dart b/tests/standalone/io/secure_server_socket_test.dart
index 478a53a..a7c0801 100644
--- a/tests/standalone/io/secure_server_socket_test.dart
+++ b/tests/standalone/io/secure_server_socket_test.dart
@@ -33,7 +33,7 @@
SecureServerSocket.bind("ko.faar.__hest__", 0, CERTIFICATE).then((_) {
Expect.fail("Failure expected");
}).catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -41,7 +41,7 @@
SecureServerSocket.bind("8.8.8.8", 0, CERTIFICATE).then((_) {
Expect.fail("Failure expected");
}).catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -60,7 +60,7 @@
port.toSendPort().send(1);
}).catchError((error) {
Expect.notEquals('windows', Platform.operatingSystem);
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
s.close();
port.toSendPort().send(1);
});
@@ -82,7 +82,7 @@
});
}
-void testSimpleConnectFail(String certificate) {
+void testSimpleConnectFail(String certificate, bool cancelOnError) {
ReceivePort port = new ReceivePort();
SecureServerSocket.bind(HOST_NAME, 0, certificate).then((server) {
var clientEndFuture = SecureSocket.connect(HOST_NAME, server.port)
@@ -90,15 +90,19 @@
Expect.fail("No client connection expected.");
})
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
});
server.listen((serverEnd) {
Expect.fail("No server connection expected.");
},
onError: (error) {
- Expect.isTrue(error is SocketIOException);
- clientEndFuture.then((_) => port.close());
- });
+ Expect.isTrue(error is SocketException);
+ clientEndFuture.then((_) {
+ if (!cancelOnError) server.close();
+ port.close();
+ });
+ },
+ cancelOnError: cancelOnError);
});
}
@@ -198,8 +202,10 @@
testInvalidBind();
testSimpleConnect(CERTIFICATE);
testSimpleConnect("CN=localhost");
- testSimpleConnectFail("not_a_nickname");
- testSimpleConnectFail("CN=notARealDistinguishedName");
+ testSimpleConnectFail("not_a_nickname", false);
+ testSimpleConnectFail("CN=notARealDistinguishedName", false);
+ testSimpleConnectFail("not_a_nickname", true);
+ testSimpleConnectFail("CN=notARealDistinguishedName", true);
testServerListenAfterConnect();
testSimpleReadWrite();
}
diff --git a/tests/standalone/io/socket_exception_test.dart b/tests/standalone/io/socket_exception_test.dart
index 79f5b72..41290d6 100644
--- a/tests/standalone/io/socket_exception_test.dart
+++ b/tests/standalone/io/socket_exception_test.dart
@@ -20,7 +20,7 @@
server.close();
try {
server.close();
- } on SocketIOException catch(ex) {
+ } on SocketException catch(ex) {
exceptionCaught = true;
} catch (ex) {
wrongExceptionCaught = true;
@@ -31,7 +31,7 @@
// Test invalid host.
ServerSocket.bind("__INVALID_HOST__", 0)
.then((server) { })
- .catchError((e) => e is SocketIOException);
+ .catchError((e) => e is SocketException);
});
}
@@ -70,7 +70,7 @@
client.close();
try {
client.close();
- } on SocketIOException catch(ex) {
+ } on SocketException catch(ex) {
exceptionCaught = true;
} catch (ex) {
wrongExceptionCaught = true;
@@ -79,7 +79,7 @@
Expect.isFalse(wrongExceptionCaught);
try {
client.destroy();
- } on SocketIOException catch(ex) {
+ } on SocketException catch(ex) {
exceptionCaught = true;
} catch (ex) {
print(ex);
@@ -164,7 +164,7 @@
client.listen(
(data) => Expect.fail("Unexpected data"),
onError: (error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
errors++;
},
onDone: () {
@@ -184,7 +184,7 @@
Expect.fail("Expected error");
},
onError: (error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.close();
});
});
@@ -218,7 +218,7 @@
Socket.connect("hede.hule.hest", 1234)
.then((socket) => Expect.fail("Connection completed"))
- .catchError((e) => port.close(), test: (e) => e is SocketIOException);
+ .catchError((e) => port.close(), test: (e) => e is SocketException);
}
diff --git a/tests/standalone/io/socket_invalid_arguments_test.dart b/tests/standalone/io/socket_invalid_arguments_test.dart
index e3b8714..24025ae 100644
--- a/tests/standalone/io/socket_invalid_arguments_test.dart
+++ b/tests/standalone/io/socket_invalid_arguments_test.dart
@@ -20,7 +20,7 @@
testSocketCreation(host, port) {
Socket.connect(host, port)
.then((socket) => Expect.fail("Shouldn't get connected"))
- .catchError((e) => null, test: (e) => e is SocketIOException)
+ .catchError((e) => null, test: (e) => e is SocketException)
.catchError((e) => null, test: (e) => e is ArgumentError);
}
diff --git a/tests/standalone/io/socket_test.dart b/tests/standalone/io/socket_test.dart
index e9f2077..32e7742 100644
--- a/tests/standalone/io/socket_test.dart
+++ b/tests/standalone/io/socket_test.dart
@@ -35,7 +35,7 @@
ServerSocket.bind("ko.faar.__hest__", 0)
.then((_) { Expect.fail("Failure expected"); } )
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -43,7 +43,7 @@
ServerSocket.bind("8.8.8.8", 0)
.then((_) { Expect.fail("Failure expected"); } )
.catchError((error) {
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
@@ -61,7 +61,7 @@
})
.catchError((error) {
Expect.notEquals('windows', Platform.operatingSystem);
- Expect.isTrue(error is SocketIOException);
+ Expect.isTrue(error is SocketException);
port.toSendPort().send(1);
});
});
diff --git a/tests/standalone/io/url_encoding_test.dart b/tests/standalone/io/url_encoding_test.dart
index cbe2130..f16a2ec 100644
--- a/tests/standalone/io/url_encoding_test.dart
+++ b/tests/standalone/io/url_encoding_test.dart
@@ -6,6 +6,7 @@
import "dart:async";
import "dart:utf";
+part '../../../sdk/lib/io/common.dart';
part '../../../sdk/lib/io/io_sink.dart';
part "../../../sdk/lib/io/http.dart";
part "../../../sdk/lib/io/http_impl.dart";
diff --git a/tests/standalone/io/web_socket_protocol_processor_test.dart b/tests/standalone/io/web_socket_protocol_processor_test.dart
index 2aa9fb9..f5c362f 100644
--- a/tests/standalone/io/web_socket_protocol_processor_test.dart
+++ b/tests/standalone/io/web_socket_protocol_processor_test.dart
@@ -10,6 +10,7 @@
import "dart:typed_data";
import "dart:isolate";
+part '../../../sdk/lib/io/common.dart';
part "../../../sdk/lib/io/http.dart";
part "../../../sdk/lib/io/buffer_list.dart";
part "../../../sdk/lib/io/io_sink.dart";
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index 5a03bd8..e690afa 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -16,11 +16,6 @@
# Skip this because it is leaving temp directories behind when it fails.
io/skipping_dart2js_compilations_test: Skip
-io/http_content_length_test: Pass, Fail # Issue 10934
-
-[ $runtime == vm && ( $system == windows ) ]
-io/raw_socket_test: Pass, Fail # Issue 8901
-
[ $runtime == vm ]
package/package_isolate_test: Fail # http://dartbug.com/7520.
# The test is flaky, and is timing out, causing buildbot cycle times to rise.
@@ -164,12 +159,123 @@
# Skip until we stabilize language tests.
*: Skip
-[ $arch == arm ]
-*: Skip
-
[ $arch == simarm ]
*: Skip
+[ $arch == arm ]
+constant_left_shift_test: Fail # Issue: 11207
+coverage_test: Crash # Issue: 11207
+debugger/basic_debugger_test: Crash # Issue: 11207
+debugger/closure_debugger_test: Crash # Issue: 11207
+deoptimization_test: Crash # Issue: 11207
+float_array_test: Crash # Issue: 11207
+http_launch_test: Crash # Issue: 11207
+io/dart_std_io_pipe_test: Crash # Issue: 11207
+io/delete_symlink_test: Crash # Issue: 11207
+io/directory_test: Crash # Issue: 11207
+io/echo_server_stream_test: Crash # Issue: 11207
+io/file_error_test: Crash # Issue: 11207
+io/file_fuzz_test: Crash # Issue: 11207
+io/file_non_ascii_test: Crash # Issue: 11207
+io/file_read_special_device_test: Fail # Issue: 11207
+io/file_stat_test: Crash # Issue: 11207
+io/file_system_async_links_test: Crash # Issue: 11207
+io/file_test: Crash # Issue: 11207
+io/file_write_as_test: Crash # Issue: 11207
+io/http_10_test: Crash # Issue: 11207
+io/http_advanced_test: Crash # Issue: 11207
+io/http_auth_digest_test: Crash # Issue: 11207
+io/http_auth_test: Crash # Issue: 11207
+io/http_basic_test: Crash # Issue: 11207
+io/http_body_test: Crash # Issue: 11207
+io/http_client_connect_test: Crash # Issue: 11207
+io/http_client_request_test: Crash # Issue: 11207
+io/http_client_timeout_test: Crash # Issue: 11207
+io/http_close_test: Crash # Issue: 11207
+io/http_compression_test: Crash # Issue: 11207
+io/http_connection_close_test: Crash # Issue: 11207
+io/http_connection_header_test: Crash # Issue: 11207
+io/http_connection_info_test: Crash # Issue: 11207
+io/http_content_length_test: Crash # Issue: 11207
+io/http_cookie_test: Crash # Issue: 11207
+io/http_detach_socket_test: Crash # Issue: 11207
+io/http_headers_state_test: Crash # Issue: 11207
+io/http_head_test: Crash # Issue: 11207
+io/http_keep_alive_test: Crash # Issue: 11207
+io/http_multipart_test: Crash # Issue: 11207
+io/http_proxy_test: Crash # Issue: 11207
+io/http_read_test: Crash # Issue: 11207
+io/http_redirect_test: Crash # Issue: 11207
+io/http_request_pipeling_test: Crash # Issue: 11207
+io/https_client_certificate_test: Crash # Issue: 11207
+io/http_server_early_client_close2_test: Crash # Issue: 11207
+io/http_server_early_client_close_test: Crash # Issue: 11207
+io/http_server_early_server_close_test: Crash # Issue: 11207
+io/http_server_response_test: Crash # Issue: 11207
+io/http_server_test: Crash # Issue: 11207
+io/http_session_test: Crash # Issue: 11207
+io/http_shutdown_test: Crash # Issue: 11207
+io/https_server_test: Crash # Issue: 11207
+io/http_stream_close_test: Crash # Issue: 11207
+io/link_async_test: Crash # Issue: 11207
+io/link_test: Crash # Issue: 11207
+io/pipe_server_test: Crash # Issue: 11207
+io/process_check_arguments_test: Crash # Issue: 11207
+io/process_environment_test: Crash # Issue: 11207
+io/process_exit_test: Crash # Issue: 11207
+io/process_invalid_arguments_test: Crash # Issue: 11207
+io/process_path_environment_test: Crash # Issue: 11207
+io/process_path_test: Crash # Issue: 11207
+io/process_pid_test: Crash # Issue: 11207
+io/process_run_output_test: Crash # Issue: 11207
+io/process_segfault_test: Crash # Issue: 11207
+io/process_set_exit_code_test: Crash # Issue: 11207
+io/process_shell_test: Crash # Issue: 11207
+io/process_stderr_test: Crash # Issue: 11207
+io/process_stdin_transform_unsubscribe_test: Crash # Issue: 11207
+io/process_stdout_test: Crash # Issue: 11207
+io/process_working_directory_test: Crash # Issue: 11207
+io/raw_secure_server_closing_test: Crash # Issue: 11207
+io/raw_secure_server_socket_argument_test: Crash # Issue: 11207
+io/raw_secure_server_socket_test: Crash # Issue: 11207
+io/raw_secure_socket_pause_test: Crash # Issue: 11207
+io/raw_secure_socket_test: Crash # Issue: 11207
+io/raw_socket_test: Crash # Issue: 11207
+io/regress_10026_test: Crash # Issue: 11207
+io/regress_7191_test: Crash # Issue: 11207
+io/regress_8828_test: Crash # Issue: 11207
+io/regress_9194_test: Crash # Issue: 11207
+io/secure_builtin_roots_database_test: Crash # Issue: 11207
+io/secure_builtin_roots_test: Crash # Issue: 11207
+io/secure_client_raw_server_test: Crash # Issue: 11207
+io/secure_client_server_test: Crash # Issue: 11207
+io/secure_multiple_client_server_test: Crash # Issue: 11207
+io/secure_no_builtin_roots_database_test: Crash # Issue: 11207
+io/secure_no_builtin_roots_test: Crash # Issue: 11207
+io/secure_server_client_certificate_test: Crash # Issue: 11207
+io/secure_server_closing_test: Crash # Issue: 11207
+io/secure_server_socket_test: Crash # Issue: 11207
+io/secure_session_resume_test: Crash # Issue: 11207
+io/secure_socket_argument_test: Crash # Issue: 11207
+io/secure_socket_bad_certificate_test: Crash # Issue: 11207
+io/secure_socket_test: Crash # Issue: 11207
+io/socket_close_test: Crash # Issue: 11207
+io/socket_exception_test: timeout # Issue: 11207
+io/socket_invalid_arguments_test: Crash # Issue: 11207
+io/socket_ipv6_test: Crash # Issue: 11207
+io/socket_test: Crash # Issue: 11207
+io/socket_upgrade_to_secure_test: Crash # Issue: 11207
+io/status_file_parser_test: Crash # Issue: 11207
+io/stdout_stderr_test: Crash # Issue: 11207
+io/stream_pipe_test: Crash # Issue: 11207
+io/test_extension_fail_test: Crash # Issue: 11207
+io/test_extension_test: Crash # Issue: 11207
+io/web_socket_protocol_processor_test: Crash # Issue: 11207
+io/web_socket_test: Crash # Issue: 11207
+left_shift_bit_and_op_test: Fail # Issue: 11207
+typed_data_test: Crash # Issue: 11207
+
+
[ $arch == mips ]
*: Skip
diff --git a/tools/VERSION b/tools/VERSION
index 708e4dc..6a33a33 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
MAJOR 0
MINOR 5
-BUILD 16
+BUILD 17
PATCH 0
diff --git a/tools/build.py b/tools/build.py
index 71b9247..c666fbab 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -119,7 +119,8 @@
def SetTools(arch, toolchainprefix):
toolsOverride = None
if arch == 'arm' and toolchainprefix == None:
- toolchainprefix = DEFAULT_ARM_CROSS_COMPILER_PATH + "/bin/arm-linux-gnueabi"
+ toolchainprefix = (DEFAULT_ARM_CROSS_COMPILER_PATH +
+ "/bin/arm-linux-gnueabihf")
if toolchainprefix:
toolsOverride = {
"CC.target" : toolchainprefix + "-gcc",
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index 224f22e..5e3e72f 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -299,59 +299,32 @@
"support_level": "experimental"
},
"CSSFilterRule": {
+ "comment": "http://www.w3.org/TR/filter-effects/",
"members": {
- "style": {
- "support_level": "untriaged"
- }
+ "style": {}
},
- "support_level": "untriaged"
+ "support_level": "experimental"
},
"CSSFilterValue": {
+ "comment": "http://dev.w3.org/csswg/cssom/",
+ "dart_action": "suppress",
"members": {
- "CSS_FILTER_BLUR": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_BRIGHTNESS": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_CONTRAST": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_CUSTOM": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_DROP_SHADOW": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_GRAYSCALE": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_HUE_ROTATE": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_INVERT": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_OPACITY": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_REFERENCE": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_SATURATE": {
- "support_level": "untriaged"
- },
- "CSS_FILTER_SEPIA": {
- "support_level": "untriaged"
- },
- "__getter__": {
- "support_level": "untriaged"
- },
- "operationType": {
- "support_level": "untriaged"
- }
+ "CSS_FILTER_BLUR": {},
+ "CSS_FILTER_BRIGHTNESS": {},
+ "CSS_FILTER_CONTRAST": {},
+ "CSS_FILTER_CUSTOM": {},
+ "CSS_FILTER_DROP_SHADOW": {},
+ "CSS_FILTER_GRAYSCALE": {},
+ "CSS_FILTER_HUE_ROTATE": {},
+ "CSS_FILTER_INVERT": {},
+ "CSS_FILTER_OPACITY": {},
+ "CSS_FILTER_REFERENCE": {},
+ "CSS_FILTER_SATURATE": {},
+ "CSS_FILTER_SEPIA": {},
+ "__getter__": {},
+ "operationType": {}
},
- "support_level": "untriaged"
+ "support_level": "deprecated"
},
"CSSFontFaceLoadEvent": {
"comment": "http://www.w3.org/TR/css3-fonts/",
@@ -387,140 +360,64 @@
"support_level": "stable"
},
"CSSKeyframeRule": {
+ "comment": "http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface",
"members": {
- "keyText": {
- "support_level": "untriaged"
- },
- "style": {
- "support_level": "untriaged"
- }
+ "keyText": {},
+ "style": {}
},
- "support_level": "untriaged"
+ "support_level": "experimental"
},
"CSSKeyframesRule": {
+ "comment": "http://www.w3.org/TR/css3-animations/#csskeyframesrule",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
- "cssRules": {
- "support_level": "untriaged"
- },
- "deleteRule": {
- "support_level": "untriaged"
- },
- "findRule": {
- "support_level": "untriaged"
- },
- "insertRule": {
- "support_level": "untriaged"
- },
- "name": {
- "support_level": "untriaged"
- }
+ "__getter__": {},
+ "cssRules": {},
+ "deleteRule": {},
+ "findRule": {},
+ "insertRule": {},
+ "name": {}
},
- "support_level": "untriaged"
+ "support_level": "experimental"
},
"CSSMatrix": {
+ "comment": "http://dev.w3.org/csswg/cssom/",
+ "dart_action": "suppress",
"members": {
"CSSMatrix": {},
- "a": {
- "support_level": "untriaged"
- },
- "b": {
- "support_level": "untriaged"
- },
- "c": {
- "support_level": "untriaged"
- },
- "d": {
- "support_level": "untriaged"
- },
- "e": {
- "support_level": "untriaged"
- },
- "f": {
- "support_level": "untriaged"
- },
- "inverse": {
- "support_level": "untriaged"
- },
- "m11": {
- "support_level": "untriaged"
- },
- "m12": {
- "support_level": "untriaged"
- },
- "m13": {
- "support_level": "untriaged"
- },
- "m14": {
- "support_level": "untriaged"
- },
- "m21": {
- "support_level": "untriaged"
- },
- "m22": {
- "support_level": "untriaged"
- },
- "m23": {
- "support_level": "untriaged"
- },
- "m24": {
- "support_level": "untriaged"
- },
- "m31": {
- "support_level": "untriaged"
- },
- "m32": {
- "support_level": "untriaged"
- },
- "m33": {
- "support_level": "untriaged"
- },
- "m34": {
- "support_level": "untriaged"
- },
- "m41": {
- "support_level": "untriaged"
- },
- "m42": {
- "support_level": "untriaged"
- },
- "m43": {
- "support_level": "untriaged"
- },
- "m44": {
- "support_level": "untriaged"
- },
- "multiply": {
- "support_level": "untriaged"
- },
- "rotate": {
- "support_level": "untriaged"
- },
- "rotateAxisAngle": {
- "support_level": "untriaged"
- },
- "scale": {
- "support_level": "untriaged"
- },
- "setMatrixValue": {
- "support_level": "untriaged"
- },
- "skewX": {
- "support_level": "untriaged"
- },
- "skewY": {
- "support_level": "untriaged"
- },
- "toString": {
- "support_level": "untriaged"
- },
- "translate": {
- "support_level": "untriaged"
- }
+ "a": {},
+ "b": {},
+ "c": {},
+ "d": {},
+ "e": {},
+ "f": {},
+ "inverse": {},
+ "m11": {},
+ "m12": {},
+ "m13": {},
+ "m14": {},
+ "m21": {},
+ "m22": {},
+ "m23": {},
+ "m24": {},
+ "m31": {},
+ "m32": {},
+ "m33": {},
+ "m34": {},
+ "m41": {},
+ "m42": {},
+ "m43": {},
+ "m44": {},
+ "multiply": {},
+ "rotate": {},
+ "rotateAxisAngle": {},
+ "scale": {},
+ "setMatrixValue": {},
+ "skewX": {},
+ "skewY": {},
+ "toString": {},
+ "translate": {}
},
- "support_level": "untriaged"
+ "support_level": "deprecated"
},
"CSSMediaRule": {
"comment": "http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule",
@@ -533,8 +430,10 @@
"support_level": "stable"
},
"CSSMixFunctionValue": {
+ "comment": "http://dev.w3.org/csswg/cssom/",
+ "dart_action": "suppress",
"members": {},
- "support_level": "untriaged"
+ "support_level": "deprecated"
},
"CSSPageRule": {
"comment": "http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSPageRule",
@@ -590,12 +489,11 @@
"support_level": "deprecated"
},
"CSSRegionRule": {
+ "comment": "http://dev.w3.org/csswg/css-regions/#region-style-rule-interface",
"members": {
- "cssRules": {
- "support_level": "untriaged"
- }
+ "cssRules": {}
},
- "support_level": "untriaged"
+ "support_level": "experimental"
},
"CSSRule": {
"comment": "http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule",
@@ -650,9 +548,7 @@
"CSSStyleDeclaration": {
"comment": "http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface",
"members": {
- "__setter__": {
- "support_level": "untriaged"
- },
+ "__setter__": {},
"cssText": {},
"getPropertyCSSValue": {
"comment": "http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface",
@@ -707,78 +603,34 @@
"support_level": "standard"
},
"CSSTransformValue": {
+ "comment": "http://dev.w3.org/csswg/cssom/",
+ "dart_action": "suppress",
"members": {
- "CSS_MATRIX": {
- "support_level": "untriaged"
- },
- "CSS_MATRIX3D": {
- "support_level": "untriaged"
- },
- "CSS_PERSPECTIVE": {
- "support_level": "untriaged"
- },
- "CSS_ROTATE": {
- "support_level": "untriaged"
- },
- "CSS_ROTATE3D": {
- "support_level": "untriaged"
- },
- "CSS_ROTATEX": {
- "support_level": "untriaged"
- },
- "CSS_ROTATEY": {
- "support_level": "untriaged"
- },
- "CSS_ROTATEZ": {
- "support_level": "untriaged"
- },
- "CSS_SCALE": {
- "support_level": "untriaged"
- },
- "CSS_SCALE3D": {
- "support_level": "untriaged"
- },
- "CSS_SCALEX": {
- "support_level": "untriaged"
- },
- "CSS_SCALEY": {
- "support_level": "untriaged"
- },
- "CSS_SCALEZ": {
- "support_level": "untriaged"
- },
- "CSS_SKEW": {
- "support_level": "untriaged"
- },
- "CSS_SKEWX": {
- "support_level": "untriaged"
- },
- "CSS_SKEWY": {
- "support_level": "untriaged"
- },
- "CSS_TRANSLATE": {
- "support_level": "untriaged"
- },
- "CSS_TRANSLATE3D": {
- "support_level": "untriaged"
- },
- "CSS_TRANSLATEX": {
- "support_level": "untriaged"
- },
- "CSS_TRANSLATEY": {
- "support_level": "untriaged"
- },
- "CSS_TRANSLATEZ": {
- "support_level": "untriaged"
- },
- "__getter__": {
- "support_level": "untriaged"
- },
- "operationType": {
- "support_level": "untriaged"
- }
+ "CSS_MATRIX": {},
+ "CSS_MATRIX3D": {},
+ "CSS_PERSPECTIVE": {},
+ "CSS_ROTATE": {},
+ "CSS_ROTATE3D": {},
+ "CSS_ROTATEX": {},
+ "CSS_ROTATEY": {},
+ "CSS_ROTATEZ": {},
+ "CSS_SCALE": {},
+ "CSS_SCALE3D": {},
+ "CSS_SCALEX": {},
+ "CSS_SCALEY": {},
+ "CSS_SCALEZ": {},
+ "CSS_SKEW": {},
+ "CSS_SKEWX": {},
+ "CSS_SKEWY": {},
+ "CSS_TRANSLATE": {},
+ "CSS_TRANSLATE3D": {},
+ "CSS_TRANSLATEX": {},
+ "CSS_TRANSLATEY": {},
+ "CSS_TRANSLATEZ": {},
+ "__getter__": {},
+ "operationType": {}
},
- "support_level": "untriaged"
+ "support_level": "deprecated"
},
"CSSUnknownRule": {
"comment": "http://dev.w3.org/csswg/cssom/#the-cssstylesheet-interface",
@@ -1340,9 +1192,7 @@
"DOMNamedFlowCollection": {
"comment": "http://dev.w3.org/csswg/css-regions/#dom-named-flow-collection",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"item": {},
"length": {},
"namedItem": {}
@@ -1369,9 +1219,7 @@
"DOMSettableTokenList": {
"comment": "http://dev.w3.org/html5/spec-LC/common-dom-interfaces.html#domsettabletokenlist-0",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"value": {}
},
"support_level": "stable"
@@ -1388,15 +1236,9 @@
"DOMStringMap": {
"comment": "http://dev.w3.org/html5/spec-LC/common-dom-interfaces.html#domstringmap-0",
"members": {
- "__delete__": {
- "support_level": "untriaged"
- },
- "__getter__": {
- "support_level": "untriaged"
- },
- "__setter__": {
- "support_level": "untriaged"
- }
+ "__delete__": {},
+ "__getter__": {},
+ "__setter__": {}
},
"support_level": "stable"
},
@@ -1424,9 +1266,7 @@
"comment": "http://www.w3.org/TR/file-system-api/#idl-def-LocalFileSystem",
"support_level": "experimental"
},
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"addEventListener": {},
"alert": {},
"applicationCache": {},
@@ -2122,8 +1962,7 @@
"support_level": "experimental"
},
"preferredStylesheetSet": {
- "comment": "http://dev.w3.org/csswg/cssom/#widl-Document-preferredStyleSheetSet",
- "dart_action": "private"
+ "comment": "http://dev.w3.org/csswg/cssom/#widl-Document-preferredStyleSheetSet"
},
"queryCommandEnabled": {},
"queryCommandIndeterm": {},
@@ -2139,8 +1978,7 @@
"support_level": "experimental"
},
"selectedStylesheetSet": {
- "comment": "http://dev.w3.org/csswg/cssom/#widl-Document-selectedStyleSheetSet",
- "dart_action": "private"
+ "comment": "http://dev.w3.org/csswg/cssom/#widl-Document-selectedStyleSheetSet"
},
"styleSheets": {},
"title": {},
@@ -2320,8 +2158,9 @@
"support_level": "stable"
},
"EXTFragDepth": {
+ "comment": "http://www.khronos.org/registry/webgl/extensions/EXT_frag_depth/",
"members": {},
- "support_level": "untriaged"
+ "support_level": "experimental"
},
"EXTTextureFilterAnisotropic": {
"comment": "http://www.khronos.org/registry/webgl/extensions/EXT_texture_filter_anisotropic/",
@@ -2656,12 +2495,13 @@
"support_level": "stable"
},
"Entity": {
+ "dart_action": "suppress",
"members": {
"notationName": {},
"publicId": {},
"systemId": {}
},
- "support_level": "untriaged"
+ "support_level": "deprecated"
},
"EntityReference": {
"dart_action": "suppress",
@@ -3206,9 +3046,7 @@
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#dom-document-all",
"dart_action": "suppress",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"item": {},
"length": {},
"namedItem": {},
@@ -3451,9 +3289,7 @@
"HTMLCollection": {
"comment": "http://www.w3.org/TR/domcore/#interface-htmlcollection",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"item": {},
"length": {},
"namedItem": {}
@@ -3662,12 +3498,8 @@
"dart_action": "unstable",
"members": {
"HTMLEmbedElement": {},
- "__getter__": {
- "support_level": "untriaged"
- },
- "__setter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
+ "__setter__": {},
"align": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#HTMLEmbedElement-partial",
"dart_action": "suppress",
@@ -3717,9 +3549,7 @@
"HTMLFormControlsCollection": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection-0",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"namedItem": {}
},
"support_level": "stable"
@@ -3728,9 +3558,7 @@
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#the-form-element",
"members": {
"HTMLFormElement": {},
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"acceptCharset": {},
"action": {},
"autocomplete": {
@@ -4150,7 +3978,8 @@
"href": {},
"hreflang": {},
"import": {
- "support_level": "untriaged"
+ "comment": "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#interface-import",
+ "support_level": "experimental"
},
"media": {},
"rel": {},
@@ -4375,6 +4204,7 @@
"HTMLMetaElement": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#the-meta-element",
"members": {
+ "HTMLMetaElement": {},
"content": {},
"httpEquiv": {},
"name": {},
@@ -4433,12 +4263,8 @@
"dart_action": "unstable",
"members": {
"HTMLObjectElement": {},
- "__getter__": {
- "support_level": "untriaged"
- },
- "__setter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
+ "__setter__": {},
"align": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#HTMLObjectElement-partial",
"dart_action": "suppress",
@@ -4632,6 +4458,7 @@
"HTMLQuoteElement": {
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/grouping-content.html#the-blockquote-element",
"members": {
+ "HTMLQuoteElement": {},
"cite": {}
},
"support_level": "stable"
@@ -4671,9 +4498,7 @@
"comment": "http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-select-element",
"members": {
"HTMLSelectElement": {},
- "__setter__": {
- "support_level": "untriaged"
- },
+ "__setter__": {},
"autofocus": {},
"checkValidity": {},
"disabled": {},
@@ -4704,6 +4529,7 @@
"HTMLShadowElement": {
"comment": "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-element",
"members": {
+ "HTMLShadowElement": {},
"olderShadowRoot": {},
"resetStyleInheritance": {}
},
@@ -5468,24 +5294,17 @@
"support_level": "stable"
},
"MIDIAccess": {
+ "comment": "http://webaudio.github.io/web-midi-api/#midiaccess-interface",
"members": {
- "addEventListener": {
- "support_level": "untriaged"
- },
- "dispatchEvent": {
- "support_level": "untriaged"
- },
- "inputs": {
- "support_level": "untriaged"
- },
- "outputs": {
- "support_level": "untriaged"
- },
- "removeEventListener": {
- "support_level": "untriaged"
- }
+ "addEventListener": {},
+ "dispatchEvent": {},
+ "inputs": {},
+ "onconnect": {},
+ "ondisconnect": {},
+ "outputs": {},
+ "removeEventListener": {}
},
- "support_level": "untriaged"
+ "support_level": "experimental"
},
"MIDIConnectionEvent": {
"comment": "http://webaudio.github.io/web-midi-api/#midiconnectionevent-interface",
@@ -5501,7 +5320,9 @@
},
"MIDIInput": {
"comment": "http://webaudio.github.io/web-midi-api/#idl-def-MIDIInput",
- "members": {},
+ "members": {
+ "onmidimessage": {}
+ },
"support_level": "experimental"
},
"MIDIMessageEvent": {
@@ -5635,6 +5456,9 @@
"dispatchEvent": {},
"error": {},
"keySystem": {},
+ "onwebkitkeyadded": {},
+ "onwebkitkeyerror": {},
+ "onwebkitkeymessage": {},
"removeEventListener": {},
"sessionId": {},
"update": {}
@@ -5829,9 +5653,7 @@
},
"MimeTypeArray": {
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"item": {},
"length": {},
"namedItem": {}
@@ -5956,9 +5778,7 @@
"comment": "http://dom.spec.whatwg.org/#namednodemap",
"dart_action": "suppress",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"getNamedItem": {},
"getNamedItemNS": {},
"item": {},
@@ -6081,15 +5901,9 @@
"dart_action": "experimental",
"support_level": "nonstandard"
},
- "constraintName": {
- "support_level": "untriaged"
- },
- "message": {
- "support_level": "untriaged"
- },
- "name": {
- "support_level": "untriaged"
- }
+ "constraintName": {},
+ "message": {},
+ "name": {}
},
"support_level": "experimental"
},
@@ -6676,9 +6490,7 @@
},
"Plugin": {
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"description": {},
"filename": {},
"item": {},
@@ -6690,9 +6502,7 @@
},
"PluginArray": {
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"item": {},
"length": {},
"namedItem": {},
@@ -6918,9 +6728,7 @@
"RTCStatsResponse": {
"comment": "http://dev.w3.org/2011/webrtc/editor/webrtc.html#widl-RTCStatsReport-RTCStats-getter-DOMString-id",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"namedItem": {},
"result": {}
},
@@ -7038,12 +6846,12 @@
"support_level": "stable"
},
"ResourceProgressEvent": {
+ "comment": "https://chromiumcodereview.appspot.com/14773025/",
+ "dart_action": "suppress",
"members": {
- "url": {
- "support_level": "untriaged"
- }
+ "url": {}
},
- "support_level": "untriaged"
+ "support_level": "experimental"
},
"SQLError": {
"comment": "http://www.w3.org/TR/webdatabase/#sqlerror",
@@ -10493,15 +10301,9 @@
"comment": "http://www.w3.org/TR/webstorage/#the-storage-interface",
"dart_action": "unstable",
"members": {
- "__delete__": {
- "support_level": "untriaged"
- },
- "__getter__": {
- "support_level": "untriaged"
- },
- "__setter__": {
- "support_level": "untriaged"
- },
+ "__delete__": {},
+ "__getter__": {},
+ "__setter__": {},
"clear": {},
"getItem": {},
"key": {},
@@ -10595,9 +10397,7 @@
"StyleSheetList": {
"comment": "http://dev.w3.org/csswg/cssom/#the-stylesheetlist-sequence",
"members": {
- "__getter__": {
- "support_level": "untriaged"
- },
+ "__getter__": {},
"item": {},
"length": {}
},
@@ -10948,9 +10748,7 @@
"comment": "https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#dfn-WaveShaperNode",
"members": {
"curve": {},
- "oversample": {
- "support_level": "untriaged"
- }
+ "oversample": {}
},
"support_level": "experimental"
},
@@ -11556,137 +11354,6 @@
"members": {},
"support_level": "experimental"
},
- "WebKitCSSFilterRule": {
- "comment": "http://www.w3.org/TR/filter-effects/",
- "members": {
- "style": {}
- },
- "support_level": "experimental"
- },
- "WebKitCSSFilterValue": {
- "comment": "http://dev.w3.org/csswg/cssom/",
- "dart_action": "suppress",
- "members": {
- "CSS_FILTER_BLUR": {},
- "CSS_FILTER_BRIGHTNESS": {},
- "CSS_FILTER_CONTRAST": {},
- "CSS_FILTER_CUSTOM": {},
- "CSS_FILTER_DROP_SHADOW": {},
- "CSS_FILTER_GRAYSCALE": {},
- "CSS_FILTER_HUE_ROTATE": {},
- "CSS_FILTER_INVERT": {},
- "CSS_FILTER_OPACITY": {},
- "CSS_FILTER_REFERENCE": {},
- "CSS_FILTER_SATURATE": {},
- "CSS_FILTER_SEPIA": {},
- "operationType": {}
- },
- "support_level": "deprecated"
- },
- "WebKitCSSKeyframeRule": {
- "comment": "http://www.w3.org/TR/css3-animations/#CSSKeyframeRule-interface",
- "members": {
- "keyText": {},
- "style": {}
- },
- "support_level": "experimental"
- },
- "WebKitCSSKeyframesRule": {
- "comment": "http://www.w3.org/TR/css3-animations/#csskeyframesrule",
- "members": {
- "__getter__": {
- "support_level": "untriaged"
- },
- "cssRules": {},
- "deleteRule": {},
- "findRule": {},
- "insertRule": {},
- "name": {}
- },
- "support_level": "experimental"
- },
- "WebKitCSSMatrix": {
- "comment": "http://dev.w3.org/csswg/cssom/",
- "dart_action": "suppress",
- "members": {
- "WebKitCSSMatrix": {},
- "a": {},
- "b": {},
- "c": {},
- "d": {},
- "e": {},
- "f": {},
- "inverse": {},
- "m11": {},
- "m12": {},
- "m13": {},
- "m14": {},
- "m21": {},
- "m22": {},
- "m23": {},
- "m24": {},
- "m31": {},
- "m32": {},
- "m33": {},
- "m34": {},
- "m41": {},
- "m42": {},
- "m43": {},
- "m44": {},
- "multiply": {},
- "rotate": {},
- "rotateAxisAngle": {},
- "scale": {},
- "setMatrixValue": {},
- "skewX": {},
- "skewY": {},
- "toString": {},
- "translate": {}
- },
- "support_level": "deprecated"
- },
- "WebKitCSSMixFunctionValue": {
- "comment": "http://dev.w3.org/csswg/cssom/",
- "dart_action": "suppress",
- "members": {},
- "support_level": "deprecated"
- },
- "WebKitCSSRegionRule": {
- "comment": "http://dev.w3.org/csswg/css-regions/#region-style-rule-interface",
- "members": {
- "cssRules": {}
- },
- "support_level": "experimental"
- },
- "WebKitCSSTransformValue": {
- "comment": "http://dev.w3.org/csswg/cssom/",
- "dart_action": "suppress",
- "members": {
- "CSS_MATRIX": {},
- "CSS_MATRIX3D": {},
- "CSS_PERSPECTIVE": {},
- "CSS_ROTATE": {},
- "CSS_ROTATE3D": {},
- "CSS_ROTATEX": {},
- "CSS_ROTATEY": {},
- "CSS_ROTATEZ": {},
- "CSS_SCALE": {},
- "CSS_SCALE3D": {},
- "CSS_SCALEX": {},
- "CSS_SCALEY": {},
- "CSS_SCALEZ": {},
- "CSS_SKEW": {},
- "CSS_SKEWX": {},
- "CSS_SKEWY": {},
- "CSS_TRANSLATE": {},
- "CSS_TRANSLATE3D": {},
- "CSS_TRANSLATEX": {},
- "CSS_TRANSLATEY": {},
- "CSS_TRANSLATEZ": {},
- "operationType": {}
- },
- "support_level": "deprecated"
- },
"WebKitMediaSource": {
"comment": "https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#mediasource",
"members": {
diff --git a/tools/dom/scripts/dartmetadata.py b/tools/dom/scripts/dartmetadata.py
index e54caf0..34d151a 100644
--- a/tools/dom/scripts/dartmetadata.py
+++ b/tools/dom/scripts/dartmetadata.py
@@ -56,6 +56,10 @@
"@Returns('String|CanvasGradient|CanvasPattern')",
],
+ 'CustomEvent.detail': [
+ "@Creates('Null')",
+ ],
+
# Normally DOMWindow is nevernull, but starting from a <template> element in
# JavaScript, this will be null:
# template.content.ownerDocument.defaultView
@@ -75,6 +79,10 @@
"@Creates('SqlDatabase')",
],
+ 'DOMWindow.showModalDialog': [
+ "@Creates('Null')",
+ ],
+
# To be in callback with the browser-created Event, we had to have called
# addEventListener on the target, so we avoid
'Event.currentTarget': [
@@ -88,19 +96,20 @@
"@Returns('EventTarget|=Object')",
],
- 'MouseEvent.relatedTarget': [
- "@Creates('Node')",
- "@Returns('EventTarget|=Object')",
- ],
-
- # Touch targets are Elements in a Document, or the Document.
- 'Touch.target': [
- "@Creates('Element|Document')",
- "@Returns('Element|Document')",
+ 'File.lastModifiedDate': [
+ "@Creates('Null')", # JS date object.
],
'FileReader.result': ["@Creates('String|ByteBuffer|Null')"],
+ 'FocusEvent.relatedTarget': [
+ "@Creates('Null')",
+ ],
+
+ 'HTMLInputElement.valueAsDate': [
+ "@Creates('Null')", # JS date object.
+ ],
+
# Rather than have the result of an IDBRequest as a union over all possible
# results, we mark the result as instantiating any classes, and mark
# each operation with the classes that it could cause to be asynchronously
@@ -138,9 +147,35 @@
"@_annotation_Returns_IDBKey",
],
- '+IDBRequest': [
- "@Returns('Request')",
- "@Creates('Request')",
+ 'IDBCursor.primaryKey': [
+ "@_annotation_Creates_IDBKey",
+ "@_annotation_Returns_IDBKey",
+ ],
+
+ 'IDBCursor.source': [
+ "@Creates('Null')",
+ "@Returns('ObjectStore|Index|Null')",
+ ],
+
+ 'IDBDatabase.version': [
+ "@Creates('int|String|Null')",
+ "@Returns('int|String|Null')",
+ ],
+
+ 'IDBIndex.keyPath': [
+ "@annotation_Creates_SerializedScriptValue",
+ ],
+
+ 'IDBKeyRange.lower': [
+ "@annotation_Creates_SerializedScriptValue",
+ ],
+
+ 'IDBKeyRange.upper': [
+ "@annotation_Creates_SerializedScriptValue",
+ ],
+
+ 'IDBObjectStore.keyPath': [
+ "@annotation_Creates_SerializedScriptValue",
],
'+IDBOpenDBRequest': [
@@ -148,16 +183,46 @@
"@Creates('Request')",
],
+ '+IDBRequest': [
+ "@Returns('Request')",
+ "@Creates('Request')",
+ ],
+
+ 'IDBVersionChangeEvent.newVersion': [
+ "@Creates('int|String|Null')",
+ "@Returns('int|String|Null')",
+ ],
+
+ 'IDBVersionChangeEvent.oldVersion': [
+ "@Creates('int|String|Null')",
+ "@Returns('int|String|Null')",
+ ],
+
'MessageEvent.ports': ["@Creates('=List')"],
'MessageEvent.data': [
"@annotation_Creates_SerializedScriptValue",
"@annotation_Returns_SerializedScriptValue",
],
+
+ 'Metadata.modificationTime': [
+ "@Creates('Null')", # JS date object.
+ ],
+
+ 'MouseEvent.relatedTarget': [
+ "@Creates('Node')",
+ "@Returns('EventTarget|=Object')",
+ ],
+
'PopStateEvent.state': [
"@annotation_Creates_SerializedScriptValue",
"@annotation_Returns_SerializedScriptValue",
],
+
+ 'RTCStatsReport.timestamp': [
+ "@Creates('Null')", # JS date object.
+ ],
+
'SerializedScriptValue': [
"@annotation_Creates_SerializedScriptValue",
"@annotation_Returns_SerializedScriptValue",
@@ -165,6 +230,56 @@
'SQLResultSetRowList.item': ["@Creates('=Object')"],
+ # Touch targets are Elements in a Document, or the Document.
+ 'Touch.target': [
+ "@Creates('Element|Document')",
+ "@Returns('Element|Document')",
+ ],
+
+ 'TrackEvent.track': [
+ "@Creates('Null')",
+ ],
+
+ 'WebGLRenderingContext.getBufferParameter': [
+ "@Creates('int|Null')",
+ "@Returns('int|Null')",
+ ],
+
+ 'WebGLRenderingContext.getFramebufferAttachmentParameter': [
+ "@Creates('int|Renderbuffer|Texture|Null')",
+ "@Returns('int|Renderbuffer|Texture|Null')",
+ ],
+
+ 'WebGLRenderingContext.getProgramParameter': [
+ "@Creates('int|bool|Null')",
+ "@Returns('int|bool|Null')",
+ ],
+
+ 'WebGLRenderingContext.getRenderbufferParameter': [
+ "@Creates('int|Null')",
+ "@Returns('int|Null')",
+ ],
+
+ 'WebGLRenderingContext.getShaderParameter': [
+ "@Creates('int|Null')",
+ "@Returns('int|Null')",
+ ],
+
+ 'WebGLRenderingContext.getTexParameter': [
+ "@Creates('int|Null')",
+ "@Returns('int|Null')",
+ ],
+
+ 'WebGLRenderingContext.getUniform': [
+ "@Creates('Null|num|String|bool|=List|Float32List|Int32List|Uint32List')",
+ "@Returns('Null|num|String|bool|=List|Float32List|Int32List|Uint32List')",
+ ],
+
+ 'WebGLRenderingContext.getVertexAttrib': [
+ "@Creates('Null|num|bool|Float32List|Buffer')",
+ "@Returns('Null|num|bool|Float32List|Buffer')",
+ ],
+
'WebGLRenderingContext.getParameter': [
# Taken from http://www.khronos.org/registry/webgl/specs/latest/
# Section 5.14.3 Setting and getting state
@@ -610,6 +725,8 @@
annotations.append('@deprecated // %s' % support_level)
# TODO (blois): suppress generation of these APIs as a separate CL.
pass
+ elif dart_action == 'stable':
+ pass
else:
_logger.warn('Unknown dart_action - %s:%s' % (interface_id, member_id))
elif support_level == 'untriaged':
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 05e0b21..b4bccf9 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -458,7 +458,7 @@
metadata = ''
if '_RenamingAnnotation' in dir(self):
metadata = (self._RenamingAnnotation(info.declared_name, html_name) +
- self._Metadata(info.type_name, info.declared_name))
+ self._Metadata(info.type_name, info.declared_name, None))
self._members_emitter.Emit(
'\n'
' $METADATA$MODIFIERS$TYPE$FUTURE_GENERIC $NAME($PARAMS) {\n'
diff --git a/tools/dom/scripts/htmleventgenerator.py b/tools/dom/scripts/htmleventgenerator.py
index c2ead7c..da50b72 100644
--- a/tools/dom/scripts/htmleventgenerator.py
+++ b/tools/dom/scripts/htmleventgenerator.py
@@ -155,10 +155,16 @@
'IDBOpenDBRequest.upgradeneeded': ('upgradeNeeded', 'VersionChangeEvent'),
'IDBRequest.success': ('success', 'Event'),
'IDBTransaction.complete': ('complete', 'Event'),
+ 'MediaKeySession.webkitkeyadded': ('keyAdded', 'MediaKeyEvent'),
+ 'MediaKeySession.webkitkeyerror': ('keyError', 'MediaKeyEvent'),
+ 'MediaKeySession.webkitkeymessage': ('keyMessage', 'MediaKeyEvent'),
'MediaStream.addtrack': ('addTrack', 'Event'),
'MediaStream.removetrack': ('removeTrack', 'Event'),
'MediaStreamTrack.mute': ('mute', 'Event'),
'MediaStreamTrack.unmute': ('unmute', 'Event'),
+ 'MIDIAccess.connect': ('connect', 'MidiConnectionEvent'),
+ 'MIDIAccess.disconnect': ('disconnect', 'MidiConnectionEvent'),
+ 'MIDIInput.midimessage': ('midiMessage', 'MidiMessageEvent'),
'MIDIPort.disconnect': ('disconnect', 'MidiConnectionEvent'),
'Notification.click': ('click', 'Event'),
'Notification.close': ('close', 'Event'),
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index d9a9d48..59d7edc 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -57,10 +57,6 @@
'SVGSVGElement': 'SvgSvgElement', # Manual to avoid name conflicts.
'StringCallback': '_StringCallback',
'WebGLVertexArrayObjectOES': 'VertexArrayObject',
- 'WebKitCSSFilterRule': '_WebKitCssFilterRule',
- 'WebKitCSSKeyframeRule': '_WebKitCssKeyframeRule',
- 'WebKitCSSKeyframesRule': '_WebKitCssKeyframesRule',
- 'WebKitCSSRegionRule': '_WebKitCssRegionRule',
'XMLHttpRequest': 'HttpRequest',
'XMLHttpRequestProgressEvent': 'HttpRequestProgressEvent',
'XMLHttpRequestUpload': 'HttpRequestUpload',
@@ -119,10 +115,6 @@
'SVGVKernElement',
'SharedWorker', # Workers
'SharedWorkerContext', # Workers
- 'WebKitCSSFilterValue',
- 'WebKitCSSMatrix',
- 'WebKitCSSMixFunctionValue',
- 'WebKitCSSTransformValue',
'WorkerContext', # Workers
'WorkerLocation', # Workers
'WorkerNavigator', # Workers
@@ -592,6 +584,7 @@
'HTMLTitleElement.text',
'HTMLUListElement.compact',
'HTMLUListElement.type',
+ 'Location.valueOf',
'MessageEvent.webkitInitMessageEvent',
'MouseEvent.x',
'MouseEvent.y',
diff --git a/tools/dom/scripts/logging.conf b/tools/dom/scripts/logging.conf
index 6dbf12e..bc2e8cc 100644
--- a/tools/dom/scripts/logging.conf
+++ b/tools/dom/scripts/logging.conf
@@ -1,5 +1,5 @@
[loggers]
-keys=root,pegparser,database,databasebuilder,dartgenerator,dartmetadata,snippet_manager,htmlrenamer,fremontcutbuilder
+keys=root,pegparser,database,databasebuilder,dartgenerator,dartmetadata,snippet_manager,htmlrenamer,fremontcutbuilder, systemhtml
[handlers]
keys=consoleHandler
@@ -65,6 +65,12 @@
handlers=consoleHandler
qualname=dartmetadata
+[logger_systemhtml]
+level=INFO
+propagate=0
+handlers=consoleHandler
+qualname=systemhtml
+
[formatter_simpleFormatter]
format=%(name)s - %(levelname)s - %(message)s
datefmt=
diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py
index cc0d179..304c145 100644
--- a/tools/dom/scripts/systemhtml.py
+++ b/tools/dom/scripts/systemhtml.py
@@ -7,11 +7,15 @@
Dart:html APIs from the IDL database."""
import emitter
+import logging
import monitored
import os
+import re
from generator import *
from htmldartgenerator import *
+_logger = logging.getLogger('systemhtml')
+
HTML_LIBRARY_NAMES = ['chrome', 'html', 'indexed_db', 'svg',
'web_audio', 'web_gl', 'web_sql']
@@ -163,6 +167,7 @@
'HTMLLinkElement': 'link',
'HTMLMapElement': 'map',
'HTMLMenuElement': 'menu',
+ 'HTMLMetaElement': 'meta',
'HTMLMeterElement': 'meter',
'HTMLOListElement': 'ol',
'HTMLObjectElement': 'object',
@@ -172,8 +177,10 @@
'HTMLParamElement': 'param',
'HTMLPreElement': 'pre',
'HTMLProgressElement': 'progress',
+ 'HTMLQuoteElement': 'q',
'HTMLScriptElement': 'script',
'HTMLSelectElement': 'select',
+ 'HTMLShadowElement': 'shadow',
'HTMLSourceElement': 'source',
'HTMLSpanElement': 'span',
'HTMLStyleElement': 'style',
@@ -794,7 +801,7 @@
output_type = self.SecureOutputType(attribute.type.id)
input_type = self._NarrowInputType(attribute.type.id)
- metadata = self._Metadata(attribute.type.id, attribute.id)
+ metadata = self._Metadata(attribute.type.id, attribute.id, output_type)
rename = self._RenamingAnnotation(attribute.id, html_name)
if not read_only:
self._members_emitter.Emit(
@@ -867,7 +874,7 @@
"\n @JSName('$NAME')"
'\n $(METADATA)final $NATIVE_TYPE _get_$HTML_NAME;'
'\n',
- METADATA=self._Metadata(attr.type.id, html_name),
+ METADATA=self._Metadata(attr.type.id, html_name, conversion.input_type),
CONVERT=conversion.function_name,
HTML_NAME=html_name,
NAME=attr.id,
@@ -916,7 +923,8 @@
'\n'
' $RENAME$METADATA$MODIFIERS$TYPE $NAME($PARAMS) native;\n',
RENAME=self._RenamingAnnotation(info.declared_name, html_name),
- METADATA=self._Metadata(info.type_name, info.declared_name),
+ METADATA=self._Metadata(info.type_name, info.declared_name,
+ self.SecureOutputType(info.type_name)),
MODIFIERS='static ' if info.IsStatic() else '',
TYPE=self.SecureOutputType(info.type_name),
NAME=html_name,
@@ -998,14 +1006,14 @@
self._members_emitter.Emit(
' $RENAME$METADATA$MODIFIERS$TYPE$TARGET($PARAMS) native;\n',
RENAME=self._RenamingAnnotation(info.declared_name, target),
- METADATA=self._Metadata(info.type_name, info.declared_name),
+ METADATA=self._Metadata(info.type_name, info.declared_name, None),
MODIFIERS='static ' if info.IsStatic() else '',
TYPE=TypeOrNothing(native_return_type),
TARGET=target,
PARAMS=', '.join(target_parameters))
declaration = '%s%s%s %s(%s)' % (
- self._Metadata(info.type_name, info.declared_name),
+ self._Metadata(info.type_name, info.declared_name, return_type),
'static ' if info.IsStatic() else '',
return_type,
html_name,
@@ -1053,7 +1061,7 @@
return "@JSName('%s')\n " % idl_name
return ''
- def _Metadata(self, idl_type, idl_member_name, indent=' '):
+ def _Metadata(self, idl_type, idl_member_name, dart_type, indent=' '):
anns = self._metadata.GetDart2JSMetadata(
idl_type, self._library_name, self._interface, idl_member_name)
@@ -1066,6 +1074,13 @@
"@Returns('%s')" % native_type,
"@Creates('%s')" % native_type,
]
+ if dart_type == 'dynamic' or dart_type == 'Object':
+ def js_type_annotation(ann):
+ return re.search('^@.*Returns', ann) or re.search('^@.*Creates', ann)
+ if not filter(js_type_annotation, anns):
+ _logger.warn('Member with wildcard native type: %s.%s' %
+ (self._interface.id, idl_member_name))
+
return self._metadata.FormatMetadata(anns, indent);
def CustomJSMembers(self):
diff --git a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
index b843324..b9885df 100644
--- a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
@@ -92,4 +92,5 @@
return JS('var', r'ReceivePortSync.dispatchCall(#, #)', id, message);
}
-spawnDomFunction(Function f) => IsolateNatives.spawnDomFunction(f);
+Future<SendPort> spawnDomFunction(Function f) =>
+ new Future.value(IsolateNatives.spawnDomFunction(f));
diff --git a/tools/dom/templates/html/impl/impl_AudioContext.darttemplate b/tools/dom/templates/html/impl/impl_AudioContext.darttemplate
index 9100aba..a500495 100644
--- a/tools/dom/templates/html/impl/impl_AudioContext.darttemplate
+++ b/tools/dom/templates/html/impl/impl_AudioContext.darttemplate
@@ -20,7 +20,7 @@
ScriptProcessorNode createScriptProcessor(int bufferSize,
[int numberOfInputChannels, int numberOfOutputChannels]) {
- var function = JS('dynamic', '#.createScriptProcessor || '
+ var function = JS('=Object', '#.createScriptProcessor || '
'#.createJavaScriptNode', this, this);
if (numberOfOutputChannels != null) {
return JS('ScriptProcessorNode', '#.call(#, #, #, #)', function, this,
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index cea6c05..a6e165d 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -410,8 +410,7 @@
Rect get offset => new Rect(offsetLeft, offsetTop, offsetWidth, offsetHeight);
/**
- * Adds the specified text as a text node after the last child of this
- * element.
+ * Adds the specified text after the last child of this element.
*/
void appendText(String text) {
this.insertAdjacentText('beforeend', text);
@@ -550,7 +549,7 @@
return 'transitionend';
}
/**
- * Creates a text node and inserts it into the DOM at the specified location.
+ * Inserts text into the DOM at the specified location.
*
* To see the possible values for [where], read the doc for
* [insertAdjacentHtml].
diff --git a/tools/gyp/configurations_make.gypi b/tools/gyp/configurations_make.gypi
index adcbbdf..ba2445a 100644
--- a/tools/gyp/configurations_make.gypi
+++ b/tools/gyp/configurations_make.gypi
@@ -51,7 +51,6 @@
'-marm',
'-march=armv7-a',
'-mfpu=vfp',
- '-mfloat-abi=softfp',
'-Wno-psabi', # suppresses va_list warning
'-fno-strict-overflow',
],
diff --git a/tools/make_links.py b/tools/make_links.py
index 965d04f..66f94e6 100644
--- a/tools/make_links.py
+++ b/tools/make_links.py
@@ -11,15 +11,23 @@
the name of the target link.
Usage:
- python tools/make_links.py TARGET SOURCES...
+ python tools/make_links.py OPTIONS TARGET SOURCES...
'''
+import optparse
import os
import subprocess
import sys
import utils
+def get_options():
+ result = optparse.OptionParser()
+ result.add_option("--timestamp_file", "",
+ help='Create a timestamp file when done creating the links.',
+ default='')
+ return result.parse_args()
+
def make_link(source, target):
if os.path.islink(target):
print 'Removing %s' % target
@@ -39,12 +47,20 @@
else:
return subprocess.call(['ln', '-s', source, target])
+def create_timestamp_file(options):
+ if options.timestamp_file != '':
+ dir_name = os.path.dirname(options.timestamp_file)
+ if not os.path.exists(dir_name):
+ os.mkdir(dir_name)
+ open(options.timestamp_file, 'w').close()
+
def main(argv):
- target = os.path.relpath(argv[1])
+ (options, args) = get_options()
+ target = os.path.relpath(args[0])
if not os.path.exists(target):
os.makedirs(target)
- for source in argv[2:]:
+ for source in args[1:]:
# Assume the source directory is named ".../NAME/lib".
(name, lib) = os.path.split(source)
if lib != 'lib':
@@ -58,6 +74,7 @@
exit_code = make_link(source, os.path.join(target, name))
if exit_code != 0:
return exit_code
+ create_timestamp_file(options)
return 0
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index 2e9ec0a..3d9dbd9 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -29,6 +29,8 @@
</script>
<script type="text/javascript"
src="/root_dart/pkg/browser/lib/dart.js"></script>
+ <script type="text/javascript"
+ src="/root_dart/pkg/browser/lib/interop.js"></script>
</body>
</html>
""";
diff --git a/utils/compiler/compiler.gyp b/utils/compiler/compiler.gyp
index 8c95316..e5eb4ab 100644
--- a/utils/compiler/compiler.gyp
+++ b/utils/compiler/compiler.gyp
@@ -12,6 +12,7 @@
'type': 'none',
'dependencies': [
'../../runtime/dart-runtime.gyp:dart',
+ '../../pkg/pkg.gyp:pkg_packages',
],
'actions': [
{
@@ -21,6 +22,7 @@
'../../sdk/lib/_internal/libraries.dart',
'<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../sdk/lib/_internal/compiler", "../../runtime/lib", "../../sdk/lib/_internal/dartdoc"])',
'create_snapshot.dart',
+ '<(SHARED_INTERMEDIATE_DIR)/packages.stamp',
],
'outputs': [
'<(SHARED_INTERMEDIATE_DIR)/utils_wrapper.dart.snapshot',
diff --git a/utils/compiler/create_snapshot.dart b/utils/compiler/create_snapshot.dart
index d3a460e..e48900f 100644
--- a/utils/compiler/create_snapshot.dart
+++ b/utils/compiler/create_snapshot.dart
@@ -58,7 +58,7 @@
Future createSnapshot(var options, var dart_file, var packageRoot) {
return Process.run(options.executable,
["--package-root=$packageRoot",
- "--generate-script-snapshot=$dart_file.snapshot",
+ "--snapshot=$dart_file.snapshot",
dart_file])
.then((result) {
if (result.exitCode != 0) {
diff --git a/utils/pub/pub.gyp b/utils/pub/pub.gyp
index d15bcdb..fd5e147 100644
--- a/utils/pub/pub.gyp
+++ b/utils/pub/pub.gyp
@@ -27,7 +27,7 @@
'action': [
'<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
'--package-root=<(PRODUCT_DIR)/packages/',
- '--generate-script-snapshot=<(SHARED_INTERMEDIATE_DIR)/pub.dart.snapshot',
+ '--snapshot=<(SHARED_INTERMEDIATE_DIR)/pub.dart.snapshot',
'../../sdk/lib/_internal/pub/bin/pub.dart',
],
},